Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make virtio drivers work again. It will try to use MSIX, but not MSI.…

… Since we

don't support MSIX right now, disable that check. This results in us falling
back on legacy interrupts.
  • Loading branch information...
commit 7c8e72975cef3ac7f19ca0ab63111b9c8ffb859d 1 parent 29a9f7f
@bissont authored
Showing with 12 additions and 5 deletions.
  1. +12 −5 pci/virtio_pci.c
View
17 pci/virtio_pci.c
@@ -58,6 +58,8 @@ struct vtpci_softc {
struct resource *vtpci_msix_res;
uint64_t vtpci_features;
uint32_t vtpci_flags;
+ int vtpci_irq_type;
+ int vtpci_irq_rid;
#define VIRTIO_PCI_FLAG_NO_MSI 0x0001
#define VIRTIO_PCI_FLAG_MSI 0x0002
#define VIRTIO_PCI_FLAG_NO_MSIX 0x0010
@@ -254,13 +256,13 @@ vtpci_attach(device_t dev)
if (pci_find_extcap(dev, PCIY_MSI, NULL) != 0)
sc->vtpci_flags |= VIRTIO_PCI_FLAG_NO_MSI;
-
+#if OLD_MSI
if (pci_find_extcap(dev, PCIY_MSIX, NULL) == 0) {
rid = PCIR_BAR(1);
sc->vtpci_msix_res = bus_alloc_resource_any(dev,
SYS_RES_MEMORY, &rid, RF_ACTIVE);
}
-
+#endif
if (sc->vtpci_msix_res == NULL)
sc->vtpci_flags |= VIRTIO_PCI_FLAG_NO_MSIX;
@@ -840,6 +842,7 @@ vtpci_alloc_msi(struct vtpci_softc *sc)
{
device_t dev;
int nmsi, cnt;
+ u_int irq_flags;
dev = sc->vtpci_dev;
nmsi = pci_msi_count(dev);
@@ -848,8 +851,11 @@ vtpci_alloc_msi(struct vtpci_softc *sc)
return (1);
cnt = 1;
- if (pci_alloc_msi(dev, &cnt) == 0 && cnt == 1)
- return (0);
+
+ sc->vtpci_irq_rid = 0;
+ sc->vtpci_irq_type = pci_alloc_1intr(dev, 1,
+ &sc->vtpci_irq_rid, &irq_flags);
+
return (1);
}
@@ -857,6 +863,7 @@ vtpci_alloc_msi(struct vtpci_softc *sc)
static int
vtpci_alloc_msix(struct vtpci_softc *sc, int nvectors)
{
+#ifdef OLD_MSI
device_t dev;
int nmsix, cnt, required;
@@ -900,7 +907,7 @@ vtpci_alloc_msix(struct vtpci_softc *sc, int nvectors)
else
device_printf(dev, "using per virtqueue MSIX\n");
}
-
+#endif
return (0);
}
Please sign in to comment.
Something went wrong with that request. Please try again.