vfio/pci: Hide SR-IOV capability
commite37dac06dc4e85a2f46c24261c0dfdf2a30b50e3
authorAlex Williamson <alex.williamson@redhat.com>
Thu, 30 Jun 2016 19:00:23 +0000 (30 13:00 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Thu, 30 Jun 2016 19:00:23 +0000 (30 13:00 -0600)
treed757086868b65eb07c682f80c6fd4c7b09b9c141
parent325ae8d548ebeee99cbebd38e2ff0909a9081c50
vfio/pci: Hide SR-IOV capability

The kernel currently exposes the SR-IOV capability as read-only
through vfio-pci.  This is sufficient to protect the host kernel, but
has the potential to confuse guests without further virtualization.
In particular, OVMF tries to size the VF BARs and comes up with absurd
results, ending with an assert.  There's not much point in adding
virtualization to a read-only capability, so we simply hide it for
now.  If the kernel ever enables SR-IOV virtualization, we should
easily be able to test it through VF BAR sizing or explicit flags.

Testing whether we should parse extended capabilities is also pulled
into the function to keep these assumptions in one place.

Tested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
hw/vfio/pci.c
hw/vfio/trace-events