mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
msix: Add SystemAllocator to MsixConfig
The point here is to let MsixConfig take care of the GSI allocation, which means the SystemAllocator must be passed from the vmm crate all the way down to the pci crate. Once this is done, the GSI allocation and irq_fd creation is performed by MsixConfig directly. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Samuel Ortiz
parent
f77d2c2d16
commit
86c760a0d9
@@ -340,7 +340,7 @@ impl VfioPciDevice {
|
||||
gsi_msi_routes,
|
||||
};
|
||||
|
||||
vfio_pci_device.parse_capabilities();
|
||||
vfio_pci_device.parse_capabilities(allocator);
|
||||
|
||||
// Allocate temporary interrupt routes for now.
|
||||
// The MSI vectors will be filled when the guest driver programs the device.
|
||||
@@ -394,7 +394,7 @@ impl VfioPciDevice {
|
||||
.map_err(VfioPciError::SetGsiRouting)
|
||||
}
|
||||
|
||||
fn parse_msix_capabilities(&mut self, cap: u8) {
|
||||
fn parse_msix_capabilities(&mut self, cap: u8, allocator: &mut SystemAllocator) {
|
||||
let msg_ctl = self
|
||||
.vfio_pci_configuration
|
||||
.read_config_word((cap + 2).into());
|
||||
@@ -412,7 +412,7 @@ impl VfioPciDevice {
|
||||
table,
|
||||
pba,
|
||||
};
|
||||
let msix_config = MsixConfig::new(msix_cap.table_size());
|
||||
let msix_config = MsixConfig::new(msix_cap.table_size(), allocator);
|
||||
|
||||
self.interrupt.msix = Some(VfioMsix {
|
||||
bar: msix_config,
|
||||
@@ -435,7 +435,7 @@ impl VfioPciDevice {
|
||||
});
|
||||
}
|
||||
|
||||
fn parse_capabilities(&mut self) {
|
||||
fn parse_capabilities(&mut self, allocator: &mut SystemAllocator) {
|
||||
let mut cap_next = self
|
||||
.vfio_pci_configuration
|
||||
.read_config_byte(PCI_CONFIG_CAPABILITY_OFFSET);
|
||||
@@ -450,7 +450,7 @@ impl VfioPciDevice {
|
||||
self.parse_msi_capabilities(cap_next);
|
||||
}
|
||||
PciCapabilityID::MSIX => {
|
||||
self.parse_msix_capabilities(cap_next);
|
||||
self.parse_msix_capabilities(cap_next, allocator);
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user