virtio: Add PCI memory BAR in addition to PIO BAR
authorDavid Gibson <david@gibson.dropbear.id.au>
Fri, 30 Sep 2011 05:26:16 +0000 (15:26 +1000)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 1 Nov 2011 21:52:08 +0000 (16:52 -0500)
commit12b270d5291d598395b8901bf3f6e7cd5f6f446d
tree05dbc9ad7102c6ef3fc74af31de8cf8c42956c82
parent0a104bdced752b9dc834fa8135dba6849efe0ef7
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>
hw/virtio-pci.c