From 9f532244047171ee3787053fcbfb221094396cfb Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 10 Oct 2024 06:00:42 +0000 Subject: [PATCH] allow MSI with the QEMU default pc-i440fx machine This makes it possible to use MSI for virtual functions of Intel network devices without having to specify the q35 machine. QEMU is detected by testing for the Qumranet pci subsystem vendor id, suggested by sf@. MSI previously wasn't enabled as 82441FX is in the list of excluded devices. Initial patch from Yuichiro NAITO. ok yasuoka@ sf@ --- sys/arch/i386/pci/pci_machdep.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c index 9887a48f8ab..5b375c7e1d0 100644 --- a/sys/arch/i386/pci/pci_machdep.c +++ b/sys/arch/i386/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.87 2021/03/11 11:16:57 jsg Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.88 2024/10/10 06:00:42 jsg Exp $ */ /* $NetBSD: pci_machdep.c,v 1.28 1997/06/06 23:29:17 thorpej Exp $ */ /*- @@ -324,6 +324,11 @@ pci_attach_hook(struct device *parent, struct device *self, break; } + /* Enable MSI for QEMU */ + id = pci_conf_read(pc, tag, PCI_SUBSYS_ID_REG); + if (PCI_VENDOR(id) == PCI_VENDOR_QUMRANET) + pba->pba_flags |= PCI_FLAGS_MSI_ENABLED; + /* * Don't enable MSI on a HyperTransport bus. In order to * determine that bus 0 is a HyperTransport bus, we look at -- 2.20.1