Linux seems to write zeros to MSI registers when unregistering an MSI interrupt:
[...] pci_bus_write_config_dword+0x14/0x20 __pci_write_msi_msg+0xcc/0x130 pci_msi_domain_write_msg+0x1d/0x20 msi_domain_deactivate+0x28/0x30 <-- this writes zeros irq_domain_deactivate_irq+0x28/0x40 irq_shutdown+0x39/0x70 __free_irq+0x1ee/0x290 free_irq+0x34/0x80 tg3_test_interrupt+0x3f/0x230 tg3_start+0xfa3/0x1130 [...] (taken with 4.9-rt) Let's check if the target address actually matches the MSI address space and, if not, simply declare the vector invalid. That will block it from being used, raising an IOMMU runtime error at most when the device should fire nevertheless. But we no longer panic the writer. Signed-off-by: Jan Kiszka <[email protected]> Tested-by: Rajiv Vaidyanath <[email protected]> --- hypervisor/arch/x86/pci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hypervisor/arch/x86/pci.c b/hypervisor/arch/x86/pci.c index 19d0ea9..86c5633 100644 --- a/hypervisor/arch/x86/pci.c +++ b/hypervisor/arch/x86/pci.c @@ -248,6 +248,13 @@ x86_pci_translate_msi(struct pci_device *device, unsigned int vector, struct apic_irq_message irq_msg = { .valid = 0 }; unsigned int idx; + /* + * Ignore invalid target addresses, e.g. if the cell programmed the + * register to all-zero. + */ + if (msi.native.address != MSI_ADDRESS_VALUE) + return irq_msg; + if (iommu_cell_emulates_ir(device->cell)) { if (!msi.remap.remapped) return irq_msg; -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
