[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/17] vfio/igd: fix GTT stolen memory size calculation for gen 8+
From: |
Cédric Le Goater |
Subject: |
[PULL 01/17] vfio/igd: fix GTT stolen memory size calculation for gen 8+ |
Date: |
Tue, 24 Dec 2024 16:15:31 +0100 |
From: Tomita Moeko <tomitamoeko@gmail.com>
On gen 8 and later devices, the GTT stolen memory size when GGMS equals
0 is 0 (no preallocated memory) rather than 1MB [1].
[1] 3.1.13, 5th Generation Intel Core Processor Family Datasheet Vol. 2
https://www.intel.com/content/www/us/en/content-details/330835
Fixes: c4c45e943e51 ("vfio/pci: Intel graphics legacy mode assignment")
Reported-By: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Link: 20241206122749.9893-2-tomitamoeko@gmail.com">https://lore.kernel.org/r/20241206122749.9893-2-tomitamoeko@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/igd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index
4047f4f0717f82f48f8e255873f9895a157e210a..73ed1ec8e6af60ed58fe6546f750d07fc972193e
100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -268,7 +268,7 @@ static int vfio_igd_gtt_max(VFIOPCIDevice *vdev)
gmch = vfio_pci_read_config(&vdev->pdev, IGD_GMCH, sizeof(gmch));
ggms = (gmch >> (gen < 8 ? 8 : 6)) & 0x3;
- if (gen > 6) {
+ if (gen > 6 && ggms != 0) {
ggms = 1 << ggms;
}
@@ -678,7 +678,7 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
/* Determine the size of stolen memory needed for GTT */
ggms_mb = (gmch >> (gen < 8 ? 8 : 6)) & 0x3;
- if (gen > 6) {
+ if (gen > 6 && ggms_mb != 0) {
ggms_mb = 1 << ggms_mb;
}
--
2.47.1
- [PULL 00/17] vfio queue, Cédric Le Goater, 2024/12/24
- [PULL 01/17] vfio/igd: fix GTT stolen memory size calculation for gen 8+,
Cédric Le Goater <=
- [PULL 02/17] vfio/igd: remove unsupported device ids, Cédric Le Goater, 2024/12/24
- [PULL 04/17] vfio/igd: canonicalize memory size calculations, Cédric Le Goater, 2024/12/24
- [PULL 05/17] vfio/igd: add Gemini Lake and Comet Lake device ids, Cédric Le Goater, 2024/12/24
- [PULL 03/17] vfio/igd: align generation with i915 kernel driver, Cédric Le Goater, 2024/12/24
- [PULL 06/17] vfio/igd: add Alder/Raptor/Rocket/Ice/Jasper Lake device ids, Cédric Le Goater, 2024/12/24
- [PULL 08/17] vfio/igd: emulate GGC register in mmio bar0, Cédric Le Goater, 2024/12/24
- [PULL 10/17] vfio/igd: add x-igd-gms option back to set DSM region size for guest, Cédric Le Goater, 2024/12/24
- [PULL 09/17] vfio/igd: emulate BDSM in mmio bar0 for gen 6-10 devices, Cédric Le Goater, 2024/12/24
- [PULL 12/17] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic, Cédric Le Goater, 2024/12/24
- [PULL 13/17] vfio/migration: Refactor vfio_devices_all_running_and_mig_active() logic, Cédric Le Goater, 2024/12/24