Hi,

so on the new Parallels version, when using the 'Other' OS setting,
virtio(4) won't attach.  Apparently it's not Virtio 1.0, because even
Fedora 34 falls back to the 'legacy' driver.

While our code expects (and requires) an I/O BAR, it seems to be that
the PCI device only provides two memory BARs.

Linux still works, probably because they don't care about the type.
So I figured, let's just do that as well.  With the following diff,
virtio(4) attach es again, and I can install over vio(4).

I don't know if this violates any official virtio(4) spec, but on
the other hand... it fixes as bug, makes it work, and just loosens
up the requirement a little.

ok?

Patrick

diff --git a/sys/dev/pci/virtio_pci.c b/sys/dev/pci/virtio_pci.c
index c99f50136cd..0a29293e16c 100644
--- a/sys/dev/pci/virtio_pci.c
+++ b/sys/dev/pci/virtio_pci.c
@@ -508,7 +508,10 @@ int
 virtio_pci_attach_09(struct virtio_pci_softc *sc, struct pci_attach_args *pa)
 {
        struct virtio_softc *vsc = &sc->sc_sc;
-       if (pci_mapreg_map(pa, PCI_MAPREG_START, PCI_MAPREG_TYPE_IO, 0,
+       pcireg_t type;
+
+       type = pci_mapreg_type(pa->pa_pc, pa->pa_tag, PCI_MAPREG_START);
+       if (pci_mapreg_map(pa, PCI_MAPREG_START, type, 0,
            &sc->sc_iot, &sc->sc_ioh, NULL, &sc->sc_iosize, 0)) {
                printf("%s: can't map i/o space\n", vsc->sc_dev.dv_xname);
                return EIO;

Reply via email to