[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/17] vfio/igd: align generation with i915 kernel driver
From: |
Cédric Le Goater |
Subject: |
[PULL 03/17] vfio/igd: align generation with i915 kernel driver |
Date: |
Tue, 24 Dec 2024 16:15:33 +0100 |
From: Tomita Moeko <tomitamoeko@gmail.com>
Define the igd device generations according to i915 kernel driver to
avoid confusion, and adjust comment placement to clearly reflect the
relationship between ids and devices.
The condition of how GTT stolen memory size is calculated is changed
accordingly as GGMS is in multiple of 2 starting from gen 8.
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: 20241206122749.9893-4-tomitamoeko@gmail.com">https://lore.kernel.org/r/20241206122749.9893-4-tomitamoeko@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/igd.c | 45 +++++++++++++++++++++++----------------------
1 file changed, 23 insertions(+), 22 deletions(-)
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index
059ed56439f127c92cd9df33c6368a8792f07675..09bd4e53837482540591546b3efcff818d576a12
100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -59,33 +59,34 @@
*/
static int igd_gen(VFIOPCIDevice *vdev)
{
- if ((vdev->device_id & 0xfff) == 0xa84) {
- return 8; /* Broxton */
+ /*
+ * Device IDs for Broxton/Apollo Lake are 0x0a84, 0x1a84, 0x1a85, 0x5a84
+ * and 0x5a85, match bit 11:1 here
+ * Prefix 0x0a is taken by Haswell, this rule should be matched first.
+ */
+ if ((vdev->device_id & 0xffe) == 0xa84) {
+ return 9;
}
switch (vdev->device_id & 0xff00) {
- /* SandyBridge, IvyBridge, ValleyView, Haswell */
- case 0x0100:
- case 0x0400:
- case 0x0a00:
- case 0x0c00:
- case 0x0d00:
- case 0x0f00:
+ case 0x0100: /* SandyBridge, IvyBridge */
return 6;
- /* BroadWell, CherryView, SkyLake, KabyLake */
- case 0x1600:
- case 0x1900:
- case 0x2200:
- case 0x5900:
+ case 0x0400: /* Haswell */
+ case 0x0a00: /* Haswell */
+ case 0x0c00: /* Haswell */
+ case 0x0d00: /* Haswell */
+ case 0x0f00: /* Valleyview/Bay Trail */
+ return 7;
+ case 0x1600: /* Broadwell */
+ case 0x2200: /* Cherryview */
return 8;
- /* CoffeeLake */
- case 0x3e00:
+ case 0x1900: /* Skylake */
+ case 0x5900: /* Kaby Lake */
+ case 0x3e00: /* Coffee Lake */
return 9;
- /* ElkhartLake */
- case 0x4500:
+ case 0x4500: /* Elkhart Lake */
return 11;
- /* TigerLake */
- case 0x9A00:
+ case 0x9A00: /* Tiger Lake */
return 12;
}
@@ -258,7 +259,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 && ggms != 0) {
+ if (gen >= 8 && ggms != 0) {
ggms = 1 << ggms;
}
@@ -668,7 +669,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 && ggms_mb != 0) {
+ if (gen >= 8 && 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, 2024/12/24
- [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 <=
- [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
- [PULL 07/17] vfio/igd: add macro for declaring mirrored registers, Cédric Le Goater, 2024/12/24
- [PULL 11/17] vfio/container: Add dirty tracking started flag, Cédric Le Goater, 2024/12/24
- [PULL 14/17] vfio/migration: Rename vfio_devices_all_dirty_tracking(), Cédric Le Goater, 2024/12/24
- [PULL 16/17] migration: Drop migration_is_device(), Cédric Le Goater, 2024/12/24