summary refs log tree commit diff
path: root/arch
diff options
context:
space:
mode:
authorTomasz Jeznach <tjeznach@chromium.org>2020-05-01 09:54:59 -0700
committerCommit Bot <commit-bot@chromium.org>2020-05-05 00:03:46 +0000
commite94b5f84da58d7f74a2c093143b665699c1bebca (patch)
treeded356f3de7bd0b56fe6394b342f3460aa69e121 /arch
parent6fe08fa36338ee6339dd4748173865763bfc7b31 (diff)
downloadcrosvm-e94b5f84da58d7f74a2c093143b665699c1bebca.tar
crosvm-e94b5f84da58d7f74a2c093143b665699c1bebca.tar.gz
crosvm-e94b5f84da58d7f74a2c093143b665699c1bebca.tar.bz2
crosvm-e94b5f84da58d7f74a2c093143b665699c1bebca.tar.lz
crosvm-e94b5f84da58d7f74a2c093143b665699c1bebca.tar.xz
crosvm-e94b5f84da58d7f74a2c093143b665699c1bebca.tar.zst
crosvm-e94b5f84da58d7f74a2c093143b665699c1bebca.zip
pci: refactor FDT/MPTABLE creation to use PciAddress.
Simple refactor of FDT and MPTables generation to use PCI device
addressing and allow declatation of non-zero PCI bus ids for x86
architectures. It also allows non sequential IRQ allocation for
PCI devices.

BUG=None
TEST=build_test & tast run crostini.Sanity

Change-Id: I6cc31ce412199a732499b2d8d18d99f08d765690
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2175739
Tested-by: Tomasz Jeznach <tjeznach@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/src/lib.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/src/lib.rs b/arch/src/lib.rs
index 6fedf9d..ba09fa2 100644
--- a/arch/src/lib.rs
+++ b/arch/src/lib.rs
@@ -184,8 +184,14 @@ pub fn generate_pci_root(
     mmio_bus: &mut Bus,
     resources: &mut SystemAllocator,
     vm: &mut Vm,
-) -> Result<(PciRoot, Vec<(u32, PciInterruptPin)>, BTreeMap<u32, String>), DeviceRegistrationError>
-{
+) -> Result<
+    (
+        PciRoot,
+        Vec<(PciAddress, u32, PciInterruptPin)>,
+        BTreeMap<u32, String>,
+    ),
+    DeviceRegistrationError,
+> {
     let mut root = PciRoot::new();
     let mut pci_irqs = Vec::new();
     let mut pid_labels = BTreeMap::new();
@@ -230,7 +236,7 @@ pub fn generate_pci_root(
         keep_fds.push(irqfd.as_raw_fd());
         keep_fds.push(irq_resample_fd.as_raw_fd());
         device.assign_irq(irqfd, irq_resample_fd, irq_num, pci_irq_pin);
-        pci_irqs.push((dev_idx as u32, pci_irq_pin));
+        pci_irqs.push((address, irq_num, pci_irq_pin));
 
         let ranges = device
             .allocate_io_bars(resources)