Move legacy interrupt allocation for virtio devices to common code.
There are a number of assumptions about legacy interrupts always being available in virtio so don't allow back-ends to make the decision to support them. This fixes the issue seen with virtio-rnd on OpenBSD. MSI-x vectors were not being used, and the virtio-rnd backend wasn't allocating a legacy interrupt resulting in a bhyve assert and guest exit. Reported by: Julian Hsiao, madoka at nyanisore dot net Reviewed by: neel MFC after: 1 week
This commit is contained in:
parent
86fa361d59
commit
d96cec83fc
@ -370,8 +370,6 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts)
|
||||
pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE);
|
||||
pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_BLOCK);
|
||||
|
||||
pci_lintr_request(pi);
|
||||
|
||||
if (vi_intr_init(&sc->vbsc_vs, 1, fbsdrun_virtio_msix())) {
|
||||
blockif_close(sc->bc);
|
||||
free(sc);
|
||||
|
@ -640,8 +640,6 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts)
|
||||
pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_NETWORK);
|
||||
pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_NET);
|
||||
|
||||
pci_lintr_request(pi);
|
||||
|
||||
/* link always up */
|
||||
sc->vsc_config.status = 1;
|
||||
|
||||
|
@ -148,8 +148,13 @@ vi_intr_init(struct virtio_softc *vs, int barnum, int use_msix)
|
||||
return (1);
|
||||
} else
|
||||
vs->vs_flags &= ~VIRTIO_USE_MSIX;
|
||||
|
||||
/* Only 1 MSI vector for bhyve */
|
||||
pci_emul_add_msicap(vs->vs_pi, 1);
|
||||
|
||||
/* Legacy interrupts are mandatory for virtio devices */
|
||||
pci_lintr_request(vs->vs_pi);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user