]> git.ipfire.org Git - thirdparty/qemu.git/commit
vfio/igd: add new bar0 quirk to emulate BDSM mirror
authorCorvin Köhne <corvin.koehne@gmail.com>
Wed, 28 Aug 2024 13:43:25 +0000 (15:43 +0200)
committerCédric Le Goater <clg@redhat.com>
Tue, 17 Sep 2024 08:37:55 +0000 (10:37 +0200)
commit11b5ce95beecfd51d1b17858d23fe9cbb0b5783f
treea7be64c87337857854662332f97650f18baae4fe
parent7bafcd17672934284d59b82a2e2a876566c3f6f9
vfio/igd: add new bar0 quirk to emulate BDSM mirror

The BDSM register is mirrored into MMIO space at least for gen 11 and
later devices. Unfortunately, the Windows driver reads the register
value from MMIO space instead of PCI config space for those devices [1].
Therefore, we either have to keep a 1:1 mapping for the host and guest
address or we have to emulate the MMIO register too. Using the igd in
legacy mode is already hard due to it's many constraints. Keeping a 1:1
mapping may not work in all cases and makes it even harder to use. An
MMIO emulation has to trap the whole MMIO page. This makes accesses to
this page slower compared to using second level address translation.
Nevertheless, it doesn't have any constraints and I haven't noticed any
performance degradation yet making it a better solution.

[1] https://github.com/projectacrn/acrn-hypervisor/blob/5c351bee0f6ae46250eefc07f44b4a31e770f3cf/devicemodel/hw/pci/passthrough.c#L650-L653

Signed-off-by: Corvin Köhne <c.koehne@beckhoff.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
hw/vfio/igd.c
hw/vfio/pci-quirks.c
hw/vfio/pci.h