mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-18 10:35:23 +00:00
pci: vfio: Check VFIO device interrupt's support
In case the VFIO device does not support MSI or MSI-X, the capabilities should not be parsed, avoiding the exposure of unsupported capabilities. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
27515a6ec4
commit
9af477e964
@ -537,11 +537,23 @@ impl VfioPciDevice {
|
|||||||
|
|
||||||
match PciCapabilityID::from(cap_id) {
|
match PciCapabilityID::from(cap_id) {
|
||||||
PciCapabilityID::MessageSignalledInterrupts => {
|
PciCapabilityID::MessageSignalledInterrupts => {
|
||||||
|
if let Some(irq_info) = self.device.get_irq_info(VFIO_PCI_MSI_IRQ_INDEX) {
|
||||||
|
if irq_info.count > 0 {
|
||||||
|
// Parse capability only if the VFIO device
|
||||||
|
// supports MSI.
|
||||||
self.parse_msi_capabilities(cap_next, interrupt_manager);
|
self.parse_msi_capabilities(cap_next, interrupt_manager);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
PciCapabilityID::MSIX => {
|
PciCapabilityID::MSIX => {
|
||||||
|
if let Some(irq_info) = self.device.get_irq_info(VFIO_PCI_MSIX_IRQ_INDEX) {
|
||||||
|
if irq_info.count > 0 {
|
||||||
|
// Parse capability only if the VFIO device
|
||||||
|
// supports MSI-X.
|
||||||
self.parse_msix_capabilities(cap_next, interrupt_manager);
|
self.parse_msix_capabilities(cap_next, interrupt_manager);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user