[SeaBIOS] [PATCH 2/2] vp_init_simple: enable PCI bus-mastering before relying on DMA.

Eric Northup digitaleric at google.com
Wed Mar 12 21:42:36 CET 2014


An analogous change was made in the LSI scsi driver, commit
7d052575258ad2fc487ca3f9a6b62eff1b767900. Qemu works around guests that don't
correctly enable PCI bus mastering before using virtio queues' DMA (search for
VIRTIO_PCI_BUG_BUS_MASTER / VIRTIO_PCI_FLAG_BUS_MASTER_BUG ), but it'd be
better to be correct.

Signed-off-by: Eric Northup <digitaleric at google.com>
---
 src/hw/virtio-pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/hw/virtio-pci.c b/src/hw/virtio-pci.c
index a382504..b9b3ab1 100644
--- a/src/hw/virtio-pci.c
+++ b/src/hw/virtio-pci.c
@@ -90,6 +90,7 @@ u16 vp_init_simple(u16 bdf)
         PCI_BASE_ADDRESS_IO_MASK;
 
     vp_reset(ioaddr);
+    pci_config_maskw(bdf, PCI_COMMAND, 0, PCI_COMMAND_MASTER);
     vp_set_status(ioaddr, VIRTIO_CONFIG_S_ACKNOWLEDGE |
                   VIRTIO_CONFIG_S_DRIVER );
     return ioaddr;
-- 
1.9.0.279.gdc9e3eb




More information about the SeaBIOS mailing list