upstream a few file from dev/pci
The files include
- coiommu.rs
- msix.rs
- pci_configuration.rs
- pci_root.rs
- pci_bridge.rs
- pvpanic.rs
- stub.rs
Rest of the changes in the patch are supporting changes to build
and test.
Test: presubmit
Bug: b:213149278
Change-Id: Ic8fbcda4ad95370689b232c1656e782ee33425e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3541336
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
diff --git a/devices/src/pci/msix.rs b/devices/src/pci/msix.rs
index f1da7d4..e5d70e9 100644
--- a/devices/src/pci/msix.rs
+++ b/devices/src/pci/msix.rs
@@ -48,6 +48,8 @@
enabled: bool,
msi_device_socket: Tube,
msix_num: u16,
+ pci_id: u32,
+ device_name: String,
}
#[sorted]
@@ -76,7 +78,7 @@
}
impl MsixConfig {
- pub fn new(msix_vectors: u16, vm_socket: Tube) -> Self {
+ pub fn new(msix_vectors: u16, vm_socket: Tube, pci_id: u32, device_name: String) -> Self {
assert!(msix_vectors <= MAX_MSIX_VECTORS_PER_DEVICE);
let mut table_entries: Vec<MsixTableEntry> = Vec::new();
@@ -100,6 +102,8 @@
enabled: false,
msi_device_socket: vm_socket,
msix_num: msix_vectors,
+ pci_id,
+ device_name,
}
}
@@ -239,7 +243,12 @@
return Ok(());
}
let irqfd = Event::new().map_err(MsixError::AllocateOneMsi)?;
- let request = VmIrqRequest::AllocateOneMsi { irqfd };
+ let request = VmIrqRequest::AllocateOneMsi {
+ irqfd,
+ device_id: self.pci_id,
+ queue_id: index as usize,
+ device_name: self.device_name.clone(),
+ };
self.msi_device_socket
.send(&request)
.map_err(MsixError::AllocateOneMsiSend)?;
@@ -255,7 +264,7 @@
}
self.irq_vec[index] = Some(IrqfdGsi {
irqfd: match request {
- VmIrqRequest::AllocateOneMsi { irqfd } => irqfd,
+ VmIrqRequest::AllocateOneMsi { irqfd, .. } => irqfd,
_ => unreachable!(),
},
gsi: irq_num,
@@ -518,7 +527,7 @@
}
}
- /// Return the raw fd of the MSI device socket
+ /// Return the raw descriptor of the MSI device socket
pub fn get_msi_socket(&self) -> RawDescriptor {
self.msi_device_socket.as_raw_descriptor()
}
@@ -634,6 +643,7 @@
}
}
+ #[cfg(unix)]
pub fn msg_ctl(&self) -> MsixCtrl {
self.msg_ctl
}