From: jsg Date: Thu, 10 Oct 2024 05:51:23 +0000 (+0000) Subject: allow MSI with the QEMU default pc-i440fx machine X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=84053e14a5f097f20156856cc9d8ae8b6571deea;p=openbsd 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 i440fx models a machine from 1996 with ACPI 1.0, and MSI is only enabled for ACPI >= 2.0. Initial patch from Yuichiro NAITO. ok yasuoka@ sf@ --- diff --git a/sys/arch/amd64/pci/acpipci.c b/sys/arch/amd64/pci/acpipci.c index 52e2bc504d4..51cd1360383 100644 --- a/sys/arch/amd64/pci/acpipci.c +++ b/sys/arch/amd64/pci/acpipci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpipci.c,v 1.8 2024/05/13 01:15:50 jsg Exp $ */ +/* $OpenBSD: acpipci.c,v 1.9 2024/10/10 05:51:23 jsg Exp $ */ /* * Copyright (c) 2018 Mark Kettenis * @@ -194,12 +194,18 @@ acpipci_attach_bus(struct device *parent, struct acpipci_softc *sc) (sc->sc_acpi->sc_fadt->iapc_boot_arch & FADT_NO_MSI) == 0) pba.pba_flags |= PCI_FLAGS_MSI_ENABLED; + /* Enable MSI for QEMU claiming ACPI 1.0 */ + tag = pci_make_tag(pba.pba_pc, sc->sc_bus, 0, 0); + id = pci_conf_read(pba.pba_pc, tag, PCI_SUBSYS_ID_REG); + if (sc->sc_acpi->sc_fadt->hdr.revision == 1 && + PCI_VENDOR(id) == PCI_VENDOR_QUMRANET) + pba.pba_flags |= PCI_FLAGS_MSI_ENABLED; + /* * Don't enable MSI on chipsets from low-end manufacturers * like VIA and SiS. We do this by looking at the host * bridge, which should be device 0 function 0. */ - tag = pci_make_tag(pba.pba_pc, sc->sc_bus, 0, 0); id = pci_conf_read(pba.pba_pc, tag, PCI_ID_REG); class = pci_conf_read(pba.pba_pc, tag, PCI_CLASS_REG); if (PCI_CLASS(class) == PCI_CLASS_BRIDGE &&