aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomita Moeko <tomitamoeko@gmail.com>2024-12-06 20:27:47 +0800
committerCédric Le Goater <clg@redhat.com>2024-12-26 07:23:37 +0100
commitf926baa03b7babb8291ea4c1cbeadaf224977dae (patch)
treeaee7d0e50d3fd3cd4da72eb5ddaeb0cf9cf1d696
parentea652c2beeaec51035f76aeb976af06858ee85ce (diff)
downloadqemu-f926baa03b7babb8291ea4c1cbeadaf224977dae.zip
qemu-f926baa03b7babb8291ea4c1cbeadaf224977dae.tar.gz
qemu-f926baa03b7babb8291ea4c1cbeadaf224977dae.tar.bz2
vfio/igd: emulate BDSM in mmio bar0 for gen 6-10 devices
A recent commit in i915 driver [1] claims the BDSM register at 0x1080c0 of mmio bar0 has been there since gen 6. Mirror this register to the 32 bit BDSM register at 0x5c in pci config space for gen6-10 devices. [1] https://patchwork.freedesktop.org/patch/msgid/20240202224340.30647-7-ville.syrjala@linux.intel.com Reviewed-by: Corvin Köhne <c.koehne@beckhoff.com> Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Link: https://lore.kernel.org/r/20241206122749.9893-10-tomitamoeko@gmail.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
-rw-r--r--hw/vfio/igd.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index 828222c..c15a14e 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -489,7 +489,8 @@ static const MemoryRegionOps vfio_igd_quirk_mirror_##name = { \
};
VFIO_IGD_QUIRK_MIRROR_REG(IGD_GMCH, ggc)
-VFIO_IGD_QUIRK_MIRROR_REG(IGD_BDSM_GEN11, bdsm)
+VFIO_IGD_QUIRK_MIRROR_REG(IGD_BDSM, bdsm)
+VFIO_IGD_QUIRK_MIRROR_REG(IGD_BDSM_GEN11, bdsm64)
#define IGD_GGC_MMIO_OFFSET 0x108040
#define IGD_BDSM_MMIO_OFFSET 0x1080C0
@@ -516,7 +517,7 @@ void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
* into MMIO space and read from MMIO space by the Windows driver.
*/
gen = igd_gen(vdev);
- if (gen < 11) {
+ if (gen < 6) {
return;
}
@@ -530,12 +531,21 @@ void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
IGD_GGC_MMIO_OFFSET, &quirk->mem[0],
1);
- memory_region_init_io(&quirk->mem[1], OBJECT(vdev),
- &vfio_igd_quirk_mirror_bdsm, vdev,
- "vfio-igd-bdsm-quirk", 8);
- memory_region_add_subregion_overlap(vdev->bars[0].region.mem,
- IGD_BDSM_MMIO_OFFSET, &quirk->mem[1],
- 1);
+ if (gen < 11) {
+ memory_region_init_io(&quirk->mem[1], OBJECT(vdev),
+ &vfio_igd_quirk_mirror_bdsm, vdev,
+ "vfio-igd-bdsm-quirk", 4);
+ memory_region_add_subregion_overlap(vdev->bars[0].region.mem,
+ IGD_BDSM_MMIO_OFFSET,
+ &quirk->mem[1], 1);
+ } else {
+ memory_region_init_io(&quirk->mem[1], OBJECT(vdev),
+ &vfio_igd_quirk_mirror_bdsm64, vdev,
+ "vfio-igd-bdsm-quirk", 8);
+ memory_region_add_subregion_overlap(vdev->bars[0].region.mem,
+ IGD_BDSM_MMIO_OFFSET,
+ &quirk->mem[1], 1);
+ }
QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next);
}