From 297c777bd0240ebe4d3d176bcb0ef506783e956c Mon Sep 17 00:00:00 2001 From: Changyuan Lyu Date: Sun, 22 Dec 2024 16:09:44 -0800 Subject: [PATCH] refactor(vfio): get MSIX count from capability Signed-off-by: Changyuan Lyu --- alioth/src/vfio/pci.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/alioth/src/vfio/pci.rs b/alioth/src/vfio/pci.rs index 7d5624b2..3ab9ac0a 100644 --- a/alioth/src/vfio/pci.rs +++ b/alioth/src/vfio/pci.rs @@ -491,9 +491,13 @@ where let config_header = ConfigHeader::Device(dev_header); cdev.dev.reset()?; - let msix_info = cdev.dev.get_irq_info(VfioPciIrq::MSIX.raw())?; + + let msix_count = match &msix_cap { + Some(cap) => cap.control.table_len() + 1, + None => 0, + }; let msix_entries = RwLock::new( - (0..msix_info.count) + (0..msix_count) .map(|_| MsixTableMmioEntry::Entry(MsixTableEntry::default())) .collect(), );