[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/17] vfio/igd: add x-igd-gms option back to set DSM region size
From: |
Cédric Le Goater |
Subject: |
[PULL 10/17] vfio/igd: add x-igd-gms option back to set DSM region size for guest |
Date: |
Tue, 24 Dec 2024 16:15:40 +0100 |
From: Tomita Moeko <tomitamoeko@gmail.com>
DSM region is likely to store framebuffer in Windows, a small DSM
region may cause display issues (e.g. half of the screen is black).
Since 971ca22f041b ("vfio/igd: don't set stolen memory size to zero"),
the x-igd-gms option was functionally removed, QEMU uses host's
original value, which is determined by DVMT Pre-Allocated option in
Intel FSP of host bios.
However, some vendors do not expose this config item to users. In
such cases, x-igd-gms option can be used to manually set the data
stolen memory size for guest. So this commit brings this option back,
keeping its old behavior. When it is not specified, QEMU uses host's
value.
When DVMT Pre-Allocated option is available in host BIOS, user should
set DSM region size there instead of using x-igd-gms option.
Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Link: 20241206122749.9893-11-tomitamoeko@gmail.com">https://lore.kernel.org/r/20241206122749.9893-11-tomitamoeko@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/igd.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index
73c06bbf64d85b8dbf1575dac34ef8b7e64a3490..b0fef90240ca6dcc0ead7ed536202d618546b4b1
100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -14,6 +14,7 @@
#include "qemu/units.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
+#include "qapi/qmp/qerror.h"
#include "hw/hw.h"
#include "hw/nvram/fw_cfg.h"
#include "pci.h"
@@ -722,6 +723,31 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next);
+ /*
+ * Allow user to override dsm size using x-igd-gms option, in multiples of
+ * 32MiB. This option should only be used when the desired size cannot be
+ * set from DVMT Pre-Allocated option in host BIOS.
+ */
+ if (vdev->igd_gms) {
+ if (gen < 8) {
+ if (vdev->igd_gms <= 0x10) {
+ gmch &= ~(IGD_GMCH_GEN6_GMS_MASK << IGD_GMCH_GEN6_GMS_SHIFT);
+ gmch |= vdev->igd_gms << IGD_GMCH_GEN6_GMS_SHIFT;
+ } else {
+ error_report(QERR_INVALID_PARAMETER_VALUE,
+ "x-igd-gms", "0~0x10");
+ }
+ } else {
+ if (vdev->igd_gms <= 0x40) {
+ gmch &= ~(IGD_GMCH_GEN8_GMS_MASK << IGD_GMCH_GEN8_GMS_SHIFT);
+ gmch |= vdev->igd_gms << IGD_GMCH_GEN8_GMS_SHIFT;
+ } else {
+ error_report(QERR_INVALID_PARAMETER_VALUE,
+ "x-igd-gms", "0~0x40");
+ }
+ }
+ }
+
ggms_size = igd_gtt_memory_size(gen, gmch);
gms_size = igd_stolen_memory_size(gen, gmch);
--
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, 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 <=
- [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
- [PULL 15/17] system/dirtylimit: Don't use migration_is_active(), Cédric Le Goater, 2024/12/24
- [PULL 17/17] migration: Unexport migration_is_active(), Cédric Le Goater, 2024/12/24
- Re: [PULL 00/17] vfio queue, Stefan Hajnoczi, 2024/12/25