qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio: Add PCI memory BAR in addition to PIO BAR
@ 2011-09-30  5:26 David Gibson
  2011-11-01 22:20 ` Anthony Liguori
  0 siblings, 1 reply; 16+ messages in thread
From: David Gibson @ 2011-09-30  5:26 UTC (permalink / raw)
  To: aliguori; +Cc: rusty, qemu-devel

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>
---
 hw/virtio-pci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index df27c19..68cd5bc 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -659,6 +659,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;
-- 
1.7.6.3

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2011-11-03 14:53 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-30  5:26 [Qemu-devel] [PATCH] virtio: Add PCI memory BAR in addition to PIO BAR David Gibson
2011-11-01 22:20 ` Anthony Liguori
2011-11-02  0:16   ` David Gibson
2011-11-02  0:32     ` Anthony Liguori
2011-11-02  3:22   ` Rusty Russell
2011-11-02 12:39     ` Anthony Liguori
2011-11-02 21:51     ` Michael S. Tsirkin
2011-11-03 10:36   ` Avi Kivity
2011-11-03 13:07     ` Anthony Liguori
2011-11-03 13:13       ` Avi Kivity
2011-11-03 13:38         ` Anthony Liguori
2011-11-03 13:45           ` Avi Kivity
2011-11-03 13:49             ` Anthony Liguori
2011-11-03 14:31               ` Michael S. Tsirkin
2011-11-03 14:37                 ` Anthony Liguori
2011-11-03 14:53                   ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).