aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-pci.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2011-09-30 15:26:16 +1000
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-01 16:52:08 -0500
commit46d95bfec7f9429d5228078219413d7e33496d65 (patch)
tree05dbc9ad7102c6ef3fc74af31de8cf8c42956c82 /hw/virtio-pci.c
parentfff23ee9a5de74ab111b3cea9eec56782e7d7c50 (diff)
downloadqemu-46d95bfec7f9429d5228078219413d7e33496d65.zip
qemu-46d95bfec7f9429d5228078219413d7e33496d65.tar.gz
qemu-46d95bfec7f9429d5228078219413d7e33496d65.tar.bz2
virtio: Add PCI memory BAR in addition to PIO BAR
Currently, virtio devices are usually presented to the guest as an emulated PCI device, virtio_pci. Although the actual IO operations are done through system memory, the configuration of the virtio device is done through the one PCI IO space BAR that virtio_pci presents. But PCI IO space (aka PIO) is deprecated for modern PCI devices, and on some systems with many PCI domains accessing PIO space can be problematic. For example on the existing PowerVM implementation of the PAPR spec, PCI PIO access is not supported at all. We're hoping that our KVM implementation will support PCI PIO (once we support PCI at all), but it will probably have some irritating limitations. This patch, therefore, extends the virtio_pci device to have a PCI memory space (MMIO) BAR as well as the IO BAR. The MMIO BAR contains exactly the same registers, in exactly the same layout as the existing PIO BAR. Because the PIO BAR is still present, existing guest drivers should still work fine. With this change in place, future guest drivers can check for an MMIO BAR and use that if present (falling back to PIO when possible to support older qemu versions). Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-pci.c')
-rw-r--r--hw/virtio-pci.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index ca5923c..83a4b35 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -654,6 +654,8 @@ void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev)
"virtio-pci", size);
pci_register_bar(&proxy->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO,
&proxy->bar);
+ pci_register_bar(&proxy->pci_dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY,
+ &proxy->bar);
if (!kvm_has_many_ioeventfds()) {
proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD;