mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: Calculate number of msix interrupts in VirtioPciDevice
Rather than calculate in the DeviceManager and pass it through do it in the device where it already has all the required information. Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -403,7 +403,6 @@ impl VirtioPciDevice {
|
||||
id: String,
|
||||
memory: GuestMemoryAtomic<GuestMemoryMmap>,
|
||||
device: Arc<Mutex<dyn VirtioDevice>>,
|
||||
msix_num: u16,
|
||||
access_platform: Option<&Arc<dyn AccessPlatform>>,
|
||||
interrupt_manager: &dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>,
|
||||
pci_device_bdf: u32,
|
||||
@@ -434,6 +433,11 @@ impl VirtioPciDevice {
|
||||
|
||||
let pci_device_id = VIRTIO_PCI_DEVICE_ID_BASE + locked_device.device_type() as u16;
|
||||
|
||||
// Allows support for one MSI-X vector per interrupt needed by the device.
|
||||
// It also adds 1 as we need to take into account the dedicated vector to notify
|
||||
// about a virtio config change.
|
||||
let msix_num = (locked_device.queue_max_sizes().len() + 1) as u16;
|
||||
|
||||
let interrupt_source_group: MaybeMutInterruptSourceGroup = {
|
||||
let config = MsiIrqGroupConfig {
|
||||
base: 0,
|
||||
|
||||
Reference in New Issue
Block a user