]> xenbits.xensource.com Git - seabios.git/commitdiff
vp_init_simple: enable PCI bus-mastering before relying on DMA.
authorEric Northup <digitaleric@google.com>
Wed, 12 Mar 2014 20:42:36 +0000 (13:42 -0700)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 20 Mar 2014 16:35:48 +0000 (12:35 -0400)
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@google.com>
src/hw/virtio-pci.c

index a38250485a6d4d24c33eb1050f46ec3b31368766..b9b3ab1e31935d7df10b9878550fabb2ed30b344 100644 (file)
@@ -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;