hw/vfio: Add VMD Passthrough Quirk
commitee7932b0bba2062a0fad1e70d576ef13c4906c83
authorJon Derrick <jonathan.derrick@intel.com>
Thu, 11 Jun 2020 17:36:39 +0000 (11 11:36 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Thu, 11 Jun 2020 17:36:39 +0000 (11 11:36 -0600)
tree167f52300ea37d622de3342769f4df674265053d
parent3666f684761a3cccd86d13c752273be207ecade4
hw/vfio: Add VMD Passthrough Quirk

The VMD endpoint provides a real PCIe domain to the guest, including
bridges and endpoints. Because the VMD domain is enumerated by the guest
kernel, the guest kernel will assign Guest Physical Addresses to the
downstream endpoint BARs and bridge windows.

When the guest kernel performs MMIO to VMD sub-devices, MMU will
translate from the guest address space to the physical address space.
Because the bridges have been programmed with guest addresses, the
bridges will reject the transaction containing physical addresses.

VMD device 28C0 natively assists passthrough by providing the Host
Physical Address in shadow registers accessible to the guest for bridge
window assignment. The shadow registers are valid if bit 1 is set in VMD
VMLOCK config register 0x70.

In order to support existing VMDs, this quirk provides the shadow
registers in a vendor-specific PCI capability to the vfio-passthrough
device for all VMD device ids which don't natively assist with
passthrough. The Linux VMD driver is updated to check for this new
vendor-specific capability.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
hw/vfio/pci-quirks.c