* [PULL 00/17] vfio queue
@ 2024-01-08 7:32 Cédric Le Goater
2024-01-08 13:16 ` Peter Maydell
0 siblings, 1 reply; 22+ messages in thread
From: Cédric Le Goater @ 2024-01-08 7:32 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Williamson, Eric Auger, Cédric Le Goater
The following changes since commit 0c1eccd368af8805ec0fb11e6cf25d0684d37328:
Merge tag 'hw-cpus-20240105' of https://github.com/philmd/qemu into staging (2024-01-05 16:08:58 +0000)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-vfio-20240107
for you to fetch changes up to 19368b1905b4b917e915526fcbd5bfa3f7439451:
backends/iommufd: Remove mutex (2024-01-05 21:25:20 +0100)
----------------------------------------------------------------
vfio queue:
* Minor cleanups
* Fix for a regression in device reset introduced in 8.2
* Coverity fixes, including the removal of the iommufd backend mutex
* Introduced VFIOIOMMUClass, to avoid compiling spapr when !CONFIG_PSERIES
----------------------------------------------------------------
Avihai Horon (1):
vfio/migration: Add helper function to set state or reset device
Cédric Le Goater (14):
vfio/spapr: Extend VFIOIOMMUOps with a release handler
vfio/container: Introduce vfio_legacy_setup() for further cleanups
vfio/container: Initialize VFIOIOMMUOps under vfio_init_container()
vfio/container: Introduce a VFIOIOMMU QOM interface
vfio/container: Introduce a VFIOIOMMU legacy QOM interface
vfio/container: Intoduce a new VFIOIOMMUClass::setup handler
vfio/spapr: Introduce a sPAPR VFIOIOMMU QOM interface
vfio/iommufd: Introduce a VFIOIOMMU iommufd QOM interface
vfio/spapr: Only compile sPAPR IOMMU support when needed
vfio/iommufd: Remove CONFIG_IOMMUFD usage
vfio/container: Replace basename with g_path_get_basename
vfio/iommufd: Remove the use of stat() to check file existence
backends/iommufd: Remove check on number of backend users
backends/iommufd: Remove mutex
Volker Rümelin (1):
hw/vfio: fix iteration over global VFIODevice list
Zhenzhong Duan (1):
vfio/container: Rename vfio_init_container to vfio_set_iommu
include/hw/vfio/vfio-common.h | 2 -
include/hw/vfio/vfio-container-base.h | 27 +++++-
include/sysemu/iommufd.h | 2 -
backends/iommufd.c | 12 ---
hw/vfio/common.c | 19 +++--
hw/vfio/container-base.c | 12 ++-
hw/vfio/container.c | 153 +++++++++++++++++++++-------------
hw/vfio/iommufd.c | 41 +++++----
hw/vfio/migration.c | 41 ++++-----
hw/vfio/pci.c | 2 +-
hw/vfio/spapr.c | 60 +++++++------
hw/vfio/meson.build | 2 +-
12 files changed, 222 insertions(+), 151 deletions(-)
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PULL 00/17] vfio queue
2024-01-08 7:32 Cédric Le Goater
@ 2024-01-08 13:16 ` Peter Maydell
0 siblings, 0 replies; 22+ messages in thread
From: Peter Maydell @ 2024-01-08 13:16 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: qemu-devel, Alex Williamson, Eric Auger
On Mon, 8 Jan 2024 at 07:34, Cédric Le Goater <clg@redhat.com> wrote:
>
> The following changes since commit 0c1eccd368af8805ec0fb11e6cf25d0684d37328:
>
> Merge tag 'hw-cpus-20240105' of https://github.com/philmd/qemu into staging (2024-01-05 16:08:58 +0000)
>
> are available in the Git repository at:
>
> https://github.com/legoater/qemu/ tags/pull-vfio-20240107
>
> for you to fetch changes up to 19368b1905b4b917e915526fcbd5bfa3f7439451:
>
> backends/iommufd: Remove mutex (2024-01-05 21:25:20 +0100)
>
> ----------------------------------------------------------------
> vfio queue:
>
> * Minor cleanups
> * Fix for a regression in device reset introduced in 8.2
> * Coverity fixes, including the removal of the iommufd backend mutex
> * Introduced VFIOIOMMUClass, to avoid compiling spapr when !CONFIG_PSERIES
>
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/9.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PULL 00/17] vfio queue
@ 2024-12-24 15:15 Cédric Le Goater
2024-12-24 15:15 ` [PULL 01/17] vfio/igd: fix GTT stolen memory size calculation for gen 8+ Cédric Le Goater
` (17 more replies)
0 siblings, 18 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Williamson, Cédric Le Goater
The following changes since commit aa3a285b5bc56a4208b3b57d4a55291e9c260107:
Merge tag 'mem-2024-12-21' of https://github.com/davidhildenbrand/qemu into staging (2024-12-22 14:33:27 -0500)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-vfio-20241224
for you to fetch changes up to 242c3cb9a0b0375515630f11c4ecf277f00d1f37:
migration: Unexport migration_is_active() (2024-12-23 20:15:55 +0100)
----------------------------------------------------------------
vfio queue:
* Add support for IGD passthrough on all Intel Gen 11 and 12 devices
* Refactor dirty tracking engine to include VFIO state in calc-dirty-rate
* Drop usage migration_is_device() and migration_is_active()
----------------------------------------------------------------
Avihai Horon (7):
vfio/container: Add dirty tracking started flag
vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic
vfio/migration: Refactor vfio_devices_all_running_and_mig_active() logic
vfio/migration: Rename vfio_devices_all_dirty_tracking()
system/dirtylimit: Don't use migration_is_active()
migration: Drop migration_is_device()
migration: Unexport migration_is_active()
Tomita Moeko (10):
vfio/igd: fix GTT stolen memory size calculation for gen 8+
vfio/igd: remove unsupported device ids
vfio/igd: align generation with i915 kernel driver
vfio/igd: canonicalize memory size calculations
vfio/igd: add Gemini Lake and Comet Lake device ids
vfio/igd: add Alder/Raptor/Rocket/Ice/Jasper Lake device ids
vfio/igd: add macro for declaring mirrored registers
vfio/igd: emulate GGC register in mmio bar0
vfio/igd: emulate BDSM in mmio bar0 for gen 6-10 devices
vfio/igd: add x-igd-gms option back to set DSM region size for guest
include/hw/vfio/vfio-common.h | 6 +-
include/hw/vfio/vfio-container-base.h | 1 +
include/migration/misc.h | 2 -
hw/vfio/common.c | 57 ++++----
hw/vfio/container-base.c | 12 +-
hw/vfio/container.c | 2 +-
hw/vfio/igd.c | 262 +++++++++++++++++++++-------------
migration/migration.c | 23 ++-
system/dirtylimit.c | 3 +-
9 files changed, 214 insertions(+), 154 deletions(-)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PULL 01/17] vfio/igd: fix GTT stolen memory size calculation for gen 8+
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 02/17] vfio/igd: remove unsupported device ids Cédric Le Goater
` (16 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Williamson, Tomita Moeko, Cédric Le Goater
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: 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
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 02/17] vfio/igd: remove unsupported device ids
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
2024-12-24 15:15 ` [PULL 01/17] vfio/igd: fix GTT stolen memory size calculation for gen 8+ Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 03/17] vfio/igd: align generation with i915 kernel driver Cédric Le Goater
` (15 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Tomita Moeko, Corvin Köhne,
Cédric Le Goater
From: Tomita Moeko <tomitamoeko@gmail.com>
Since e433f208973f ("vfio/igd: return an invalid generation for unknown
devices"), the default return of igd_gen() was changed to unsupported.
There is no need to filter out those unsupported devices.
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Corvin Köhne <c.koehne@beckhoff.com>
Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
Link: https://lore.kernel.org/r/20241206122749.9893-3-tomitamoeko@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/igd.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index 73ed1ec8e6af60ed58fe6546f750d07fc972193e..059ed56439f127c92cd9df33c6368a8792f07675 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -64,16 +64,6 @@ static int igd_gen(VFIOPCIDevice *vdev)
}
switch (vdev->device_id & 0xff00) {
- /* Old, untested, unavailable, unknown */
- case 0x0000:
- case 0x2500:
- case 0x2700:
- case 0x2900:
- case 0x2a00:
- case 0x2e00:
- case 0x3500:
- case 0xa000:
- return -1;
/* SandyBridge, IvyBridge, ValleyView, Haswell */
case 0x0100:
case 0x0400:
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 03/17] vfio/igd: align generation with i915 kernel driver
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
2024-12-24 15:15 ` [PULL 01/17] vfio/igd: fix GTT stolen memory size calculation for gen 8+ Cédric Le Goater
2024-12-24 15:15 ` [PULL 02/17] vfio/igd: remove unsupported device ids Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 04/17] vfio/igd: canonicalize memory size calculations Cédric Le Goater
` (14 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Tomita Moeko, Corvin Köhne,
Cédric Le Goater
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: 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
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 04/17] vfio/igd: canonicalize memory size calculations
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (2 preceding siblings ...)
2024-12-24 15:15 ` [PULL 03/17] vfio/igd: align generation with i915 kernel driver Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 05/17] vfio/igd: add Gemini Lake and Comet Lake device ids Cédric Le Goater
` (13 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Williamson, Tomita Moeko, Cédric Le Goater
From: Tomita Moeko <tomitamoeko@gmail.com>
Add helper functions igd_gtt_memory_size() and igd_stolen_size() for
calculating GTT stolen memory and Data stolen memory size in bytes,
and use macros to replace the hardware-related magic numbers for
better readability.
Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Link: https://lore.kernel.org/r/20241206122749.9893-5-tomitamoeko@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/igd.c | 101 ++++++++++++++++++++++++++++----------------------
1 file changed, 57 insertions(+), 44 deletions(-)
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index 09bd4e53837482540591546b3efcff818d576a12..e231865d72251b1fd1f39b6ac8da26f10a7ac7a1 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -107,6 +107,53 @@ typedef struct VFIOIGDQuirk {
#define IGD_BDSM 0x5c /* Base Data of Stolen Memory */
#define IGD_BDSM_GEN11 0xc0 /* Base Data of Stolen Memory of gen 11 and later */
+#define IGD_GMCH_GEN6_GMS_SHIFT 3 /* SNB_GMCH in i915 */
+#define IGD_GMCH_GEN6_GMS_MASK 0x1f
+#define IGD_GMCH_GEN6_GGMS_SHIFT 8
+#define IGD_GMCH_GEN6_GGMS_MASK 0x3
+#define IGD_GMCH_GEN8_GMS_SHIFT 8 /* BDW_GMCH in i915 */
+#define IGD_GMCH_GEN8_GMS_MASK 0xff
+#define IGD_GMCH_GEN8_GGMS_SHIFT 6
+#define IGD_GMCH_GEN8_GGMS_MASK 0x3
+
+static uint64_t igd_gtt_memory_size(int gen, uint16_t gmch)
+{
+ uint64_t ggms;
+
+ if (gen < 8) {
+ ggms = (gmch >> IGD_GMCH_GEN6_GGMS_SHIFT) & IGD_GMCH_GEN6_GGMS_MASK;
+ } else {
+ ggms = (gmch >> IGD_GMCH_GEN8_GGMS_SHIFT) & IGD_GMCH_GEN8_GGMS_MASK;
+ if (ggms != 0) {
+ ggms = 1 << ggms;
+ }
+ }
+
+ return ggms * MiB;
+}
+
+static uint64_t igd_stolen_memory_size(int gen, uint32_t gmch)
+{
+ uint64_t gms;
+
+ if (gen < 8) {
+ gms = (gmch >> IGD_GMCH_GEN6_GMS_SHIFT) & IGD_GMCH_GEN6_GMS_MASK;
+ } else {
+ gms = (gmch >> IGD_GMCH_GEN8_GMS_SHIFT) & IGD_GMCH_GEN8_GMS_MASK;
+ }
+
+ if (gen < 9) {
+ return gms * 32 * MiB;
+ } else {
+ if (gms < 0xf0) {
+ return gms * 32 * MiB;
+ } else {
+ return (gms - 0xf0 + 1) * 4 * MiB;
+ }
+ }
+
+ return 0;
+}
/*
* The rather short list of registers that we copy from the host devices.
@@ -255,17 +302,10 @@ static int vfio_pci_igd_lpc_init(VFIOPCIDevice *vdev,
static int vfio_igd_gtt_max(VFIOPCIDevice *vdev)
{
uint32_t gmch = vfio_pci_read_config(&vdev->pdev, IGD_GMCH, sizeof(gmch));
- int ggms, gen = igd_gen(vdev);
-
- gmch = vfio_pci_read_config(&vdev->pdev, IGD_GMCH, sizeof(gmch));
- ggms = (gmch >> (gen < 8 ? 8 : 6)) & 0x3;
- if (gen >= 8 && ggms != 0) {
- ggms = 1 << ggms;
- }
-
- ggms *= MiB;
+ int gen = igd_gen(vdev);
+ uint64_t ggms_size = igd_gtt_memory_size(gen, gmch);
- return (ggms / (4 * KiB)) * (gen < 8 ? 4 : 8);
+ return (ggms_size / (4 * KiB)) * (gen < 8 ? 4 : 8);
}
/*
@@ -472,30 +512,6 @@ void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next);
}
-static int igd_get_stolen_mb(int gen, uint32_t gmch)
-{
- int gms;
-
- if (gen < 8) {
- gms = (gmch >> 3) & 0x1f;
- } else {
- gms = (gmch >> 8) & 0xff;
- }
-
- if (gen < 9) {
- if (gms > 0x10) {
- error_report("Unsupported IGD GMS value 0x%x", gms);
- return 0;
- }
- return gms * 32;
- } else {
- if (gms < 0xf0)
- return gms * 32;
- else
- return (gms - 0xf0) * 4 + 4;
- }
-}
-
void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
{
g_autofree struct vfio_region_info *rom = NULL;
@@ -505,7 +521,8 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
VFIOQuirk *quirk;
VFIOIGDQuirk *igd;
PCIDevice *lpc_bridge;
- int i, ret, ggms_mb, gms_mb = 0, gen;
+ int i, ret, gen;
+ uint64_t ggms_size, gms_size;
uint64_t *bdsm_size;
uint32_t gmch;
uint16_t cmd_orig, cmd;
@@ -667,13 +684,8 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next);
- /* Determine the size of stolen memory needed for GTT */
- ggms_mb = (gmch >> (gen < 8 ? 8 : 6)) & 0x3;
- if (gen >= 8 && ggms_mb != 0) {
- ggms_mb = 1 << ggms_mb;
- }
-
- gms_mb = igd_get_stolen_mb(gen, gmch);
+ ggms_size = igd_gtt_memory_size(gen, gmch);
+ gms_size = igd_stolen_memory_size(gen, gmch);
/*
* Request reserved memory for stolen memory via fw_cfg. VM firmware
@@ -684,7 +696,7 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
* config offset 0x5C.
*/
bdsm_size = g_malloc(sizeof(*bdsm_size));
- *bdsm_size = cpu_to_le64((ggms_mb + gms_mb) * MiB);
+ *bdsm_size = cpu_to_le64(ggms_size + gms_size);
fw_cfg_add_file(fw_cfg_find(), "etc/igd-bdsm-size",
bdsm_size, sizeof(*bdsm_size));
@@ -735,5 +747,6 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
vdev->vbasedev.name);
}
- trace_vfio_pci_igd_bdsm_enabled(vdev->vbasedev.name, ggms_mb + gms_mb);
+ trace_vfio_pci_igd_bdsm_enabled(vdev->vbasedev.name,
+ (ggms_size + gms_size) / MiB);
}
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 05/17] vfio/igd: add Gemini Lake and Comet Lake device ids
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (3 preceding siblings ...)
2024-12-24 15:15 ` [PULL 04/17] vfio/igd: canonicalize memory size calculations Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 06/17] vfio/igd: add Alder/Raptor/Rocket/Ice/Jasper " Cédric Le Goater
` (12 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Tomita Moeko, Corvin Köhne,
Cédric Le Goater
From: Tomita Moeko <tomitamoeko@gmail.com>
Both Gemini Lake and Comet Lake are gen 9 devices. Many user reports
on internet shows legacy mode of igd passthrough works as qemu treats
them as gen 8 devices by default before e433f208973f ("vfio/igd:
return an invalid generation for unknown devices").
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-6-tomitamoeko@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/igd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index e231865d72251b1fd1f39b6ac8da26f10a7ac7a1..ed236f443a2a0ed525fb81c08b8f6dba8316186a 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -81,8 +81,10 @@ static int igd_gen(VFIOPCIDevice *vdev)
case 0x2200: /* Cherryview */
return 8;
case 0x1900: /* Skylake */
+ case 0x3100: /* Gemini Lake */
case 0x5900: /* Kaby Lake */
case 0x3e00: /* Coffee Lake */
+ case 0x9B00: /* Comet Lake */
return 9;
case 0x4500: /* Elkhart Lake */
return 11;
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 06/17] vfio/igd: add Alder/Raptor/Rocket/Ice/Jasper Lake device ids
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (4 preceding siblings ...)
2024-12-24 15:15 ` [PULL 05/17] vfio/igd: add Gemini Lake and Comet Lake device ids Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 07/17] vfio/igd: add macro for declaring mirrored registers Cédric Le Goater
` (11 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Tomita Moeko, Corvin Köhne,
Cédric Le Goater
From: Tomita Moeko <tomitamoeko@gmail.com>
All gen 11 and 12 igd devices have 64 bit BDSM register at 0xC0 in its
config space, add them to the list to support igd passthrough on Alder/
Raptor/Rocket/Ice/Jasper Lake platforms.
Tested legacy mode of igd passthrough works properly on both linux and
windows guests with AlderLake-S GT1 (8086:4680).
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-7-tomitamoeko@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/igd.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index ed236f443a2a0ed525fb81c08b8f6dba8316186a..49b65477767308cab3ce1f4e5b3bd77b90f42831 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -86,9 +86,14 @@ static int igd_gen(VFIOPCIDevice *vdev)
case 0x3e00: /* Coffee Lake */
case 0x9B00: /* Comet Lake */
return 9;
+ case 0x8A00: /* Ice Lake */
case 0x4500: /* Elkhart Lake */
+ case 0x4E00: /* Jasper Lake */
return 11;
case 0x9A00: /* Tiger Lake */
+ case 0x4C00: /* Rocket Lake */
+ case 0x4600: /* Alder Lake */
+ case 0xA700: /* Raptor Lake */
return 12;
}
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 07/17] vfio/igd: add macro for declaring mirrored registers
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (5 preceding siblings ...)
2024-12-24 15:15 ` [PULL 06/17] vfio/igd: add Alder/Raptor/Rocket/Ice/Jasper " Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 08/17] vfio/igd: emulate GGC register in mmio bar0 Cédric Le Goater
` (10 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Williamson, Tomita Moeko, Cédric Le Goater
From: Tomita Moeko <tomitamoeko@gmail.com>
igd devices have multipe registers mirroring mmio address and pci
config space, more than a single BDSM register. To support this,
the read/write functions are made common and a macro is defined to
simplify the declaration of MemoryRegionOps.
Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Link: https://lore.kernel.org/r/20241206122749.9893-8-tomitamoeko@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/igd.c | 60 ++++++++++++++++++++++++++++++---------------------
1 file changed, 36 insertions(+), 24 deletions(-)
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index 49b65477767308cab3ce1f4e5b3bd77b90f42831..18d159aa8ecde3bb384dd6d3bd90e2110434335b 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -421,16 +421,9 @@ static const MemoryRegionOps vfio_igd_index_quirk = {
.endianness = DEVICE_LITTLE_ENDIAN,
};
-#define IGD_BDSM_MMIO_OFFSET 0x1080C0
-
-static uint64_t vfio_igd_quirk_bdsm_read(void *opaque,
- hwaddr addr, unsigned size)
+static uint64_t vfio_igd_pci_config_read(VFIOPCIDevice *vdev, uint64_t offset,
+ unsigned size)
{
- VFIOPCIDevice *vdev = opaque;
- uint64_t offset;
-
- offset = IGD_BDSM_GEN11 + addr;
-
switch (size) {
case 1:
return pci_get_byte(vdev->pdev.config + offset);
@@ -441,21 +434,17 @@ static uint64_t vfio_igd_quirk_bdsm_read(void *opaque,
case 8:
return pci_get_quad(vdev->pdev.config + offset);
default:
- hw_error("igd: unsupported read size, %u bytes", size);
+ hw_error("igd: unsupported pci config read at %lx, size %u",
+ offset, size);
break;
}
return 0;
}
-static void vfio_igd_quirk_bdsm_write(void *opaque, hwaddr addr,
- uint64_t data, unsigned size)
+static void vfio_igd_pci_config_write(VFIOPCIDevice *vdev, uint64_t offset,
+ uint64_t data, unsigned size)
{
- VFIOPCIDevice *vdev = opaque;
- uint64_t offset;
-
- offset = IGD_BDSM_GEN11 + addr;
-
switch (size) {
case 1:
pci_set_byte(vdev->pdev.config + offset, data);
@@ -470,17 +459,39 @@ static void vfio_igd_quirk_bdsm_write(void *opaque, hwaddr addr,
pci_set_quad(vdev->pdev.config + offset, data);
break;
default:
- hw_error("igd: unsupported read size, %u bytes", size);
+ hw_error("igd: unsupported pci config write at %lx, size %u",
+ offset, size);
break;
}
}
-static const MemoryRegionOps vfio_igd_bdsm_quirk = {
- .read = vfio_igd_quirk_bdsm_read,
- .write = vfio_igd_quirk_bdsm_write,
- .endianness = DEVICE_LITTLE_ENDIAN,
+#define VFIO_IGD_QUIRK_MIRROR_REG(reg, name) \
+static uint64_t vfio_igd_quirk_read_##name(void *opaque, \
+ hwaddr addr, unsigned size) \
+{ \
+ VFIOPCIDevice *vdev = opaque; \
+ \
+ return vfio_igd_pci_config_read(vdev, reg + addr, size); \
+} \
+ \
+static void vfio_igd_quirk_write_##name(void *opaque, hwaddr addr, \
+ uint64_t data, unsigned size) \
+{ \
+ VFIOPCIDevice *vdev = opaque; \
+ \
+ vfio_igd_pci_config_write(vdev, reg + addr, data, size); \
+} \
+ \
+static const MemoryRegionOps vfio_igd_quirk_mirror_##name = { \
+ .read = vfio_igd_quirk_read_##name, \
+ .write = vfio_igd_quirk_write_##name, \
+ .endianness = DEVICE_LITTLE_ENDIAN, \
};
+VFIO_IGD_QUIRK_MIRROR_REG(IGD_BDSM_GEN11, bdsm)
+
+#define IGD_BDSM_MMIO_OFFSET 0x1080C0
+
void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
{
VFIOQuirk *quirk;
@@ -510,8 +521,9 @@ void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
quirk = vfio_quirk_alloc(1);
quirk->data = vdev;
- memory_region_init_io(&quirk->mem[0], OBJECT(vdev), &vfio_igd_bdsm_quirk,
- vdev, "vfio-igd-bdsm-quirk", 8);
+ memory_region_init_io(&quirk->mem[0], 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[0],
1);
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 08/17] vfio/igd: emulate GGC register in mmio bar0
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (6 preceding siblings ...)
2024-12-24 15:15 ` [PULL 07/17] vfio/igd: add macro for declaring mirrored registers Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 09/17] vfio/igd: emulate BDSM in mmio bar0 for gen 6-10 devices Cédric Le Goater
` (9 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Williamson, Tomita Moeko, Cédric Le Goater
From: Tomita Moeko <tomitamoeko@gmail.com>
The GGC register at 0x50 of pci config space is a mirror of the same
register at 0x108040 of mmio bar0 [1]. i915 driver also reads that
register from mmio bar0 instead of config space. As GGC is programmed
and emulated by qemu, the mmio address should also be emulated, in the
same way of BDSM register.
[1] 4.1.28, 12th Generation Intel Core Processors Datasheet Volume 2
https://www.intel.com/content/www/us/en/content-details/655259
Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Link: https://lore.kernel.org/r/20241206122749.9893-9-tomitamoeko@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/igd.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index 18d159aa8ecde3bb384dd6d3bd90e2110434335b..12e0553e830aab31980586ebf572070186ac38ad 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -488,8 +488,10 @@ static const MemoryRegionOps vfio_igd_quirk_mirror_##name = { \
.endianness = DEVICE_LITTLE_ENDIAN, \
};
+VFIO_IGD_QUIRK_MIRROR_REG(IGD_GMCH, ggc)
VFIO_IGD_QUIRK_MIRROR_REG(IGD_BDSM_GEN11, bdsm)
+#define IGD_GGC_MMIO_OFFSET 0x108040
#define IGD_BDSM_MMIO_OFFSET 0x1080C0
void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
@@ -518,14 +520,21 @@ void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
return;
}
- quirk = vfio_quirk_alloc(1);
+ quirk = vfio_quirk_alloc(2);
quirk->data = vdev;
memory_region_init_io(&quirk->mem[0], OBJECT(vdev),
+ &vfio_igd_quirk_mirror_ggc, vdev,
+ "vfio-igd-ggc-quirk", 2);
+ memory_region_add_subregion_overlap(vdev->bars[0].region.mem,
+ 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[0],
+ IGD_BDSM_MMIO_OFFSET, &quirk->mem[1],
1);
QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next);
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 09/17] vfio/igd: emulate BDSM in mmio bar0 for gen 6-10 devices
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (7 preceding siblings ...)
2024-12-24 15:15 ` [PULL 08/17] vfio/igd: emulate GGC register in mmio bar0 Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 10/17] vfio/igd: add x-igd-gms option back to set DSM region size for guest Cédric Le Goater
` (8 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Tomita Moeko, Corvin Köhne,
Cédric Le Goater
From: Tomita Moeko <tomitamoeko@gmail.com>
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>
---
hw/vfio/igd.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index 12e0553e830aab31980586ebf572070186ac38ad..73c06bbf64d85b8dbf1575dac34ef8b7e64a3490 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);
}
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 10/17] vfio/igd: add x-igd-gms option back to set DSM region size for guest
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (8 preceding siblings ...)
2024-12-24 15:15 ` [PULL 09/17] vfio/igd: emulate BDSM in mmio bar0 for gen 6-10 devices Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 11/17] vfio/container: Add dirty tracking started flag Cédric Le Goater
` (7 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Williamson, Tomita Moeko, Cédric Le Goater
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: 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
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 11/17] vfio/container: Add dirty tracking started flag
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (9 preceding siblings ...)
2024-12-24 15:15 ` [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 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 12/17] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic Cédric Le Goater
` (6 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Avihai Horon, Joao Martins,
Cédric Le Goater
From: Avihai Horon <avihaih@nvidia.com>
Add a flag to VFIOContainerBase that indicates whether dirty tracking
has been started for the container or not.
This will be used in the following patches to allow dirty page syncs
only if dirty tracking has been started.
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Tested-by: Joao Martins <joao.m.martins@oracle.com>
Link: https://lore.kernel.org/r/20241218134022.21264-2-avihaih@nvidia.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
include/hw/vfio/vfio-container-base.h | 1 +
hw/vfio/container-base.c | 12 +++++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/include/hw/vfio/vfio-container-base.h b/include/hw/vfio/vfio-container-base.h
index 62a8b60d87db263225147a21eff2ef6e21cb22df..4cff9943ab4861a25d07b5ebd1200509ebfab12d 100644
--- a/include/hw/vfio/vfio-container-base.h
+++ b/include/hw/vfio/vfio-container-base.h
@@ -44,6 +44,7 @@ typedef struct VFIOContainerBase {
unsigned long pgsizes;
unsigned int dma_max_mappings;
bool dirty_pages_supported;
+ bool dirty_pages_started; /* Protected by BQL */
QLIST_HEAD(, VFIOGuestIOMMU) giommu_list;
QLIST_HEAD(, VFIORamDiscardListener) vrdl_list;
QLIST_ENTRY(VFIOContainerBase) next;
diff --git a/hw/vfio/container-base.c b/hw/vfio/container-base.c
index 6f86c37d971ec38426dacd471bca837c0d0df806..749a3fd29dd6fc9143f14edf7e4ac6238315fcce 100644
--- a/hw/vfio/container-base.c
+++ b/hw/vfio/container-base.c
@@ -64,13 +64,23 @@ int vfio_container_set_dirty_page_tracking(VFIOContainerBase *bcontainer,
bool start, Error **errp)
{
VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
+ int ret;
if (!bcontainer->dirty_pages_supported) {
return 0;
}
g_assert(vioc->set_dirty_page_tracking);
- return vioc->set_dirty_page_tracking(bcontainer, start, errp);
+ if (bcontainer->dirty_pages_started == start) {
+ return 0;
+ }
+
+ ret = vioc->set_dirty_page_tracking(bcontainer, start, errp);
+ if (!ret) {
+ bcontainer->dirty_pages_started = start;
+ }
+
+ return ret;
}
int vfio_container_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 12/17] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (10 preceding siblings ...)
2024-12-24 15:15 ` [PULL 11/17] vfio/container: Add dirty tracking started flag Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 13/17] vfio/migration: Refactor vfio_devices_all_running_and_mig_active() logic Cédric Le Goater
` (5 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Avihai Horon, Joao Martins,
Cédric Le Goater
From: Avihai Horon <avihaih@nvidia.com>
During dirty page log sync, vfio_devices_all_dirty_tracking() is used to
check if dirty tracking has been started in order to avoid errors. The
current logic checks if migration is in ACTIVE or DEVICE states to
ensure dirty tracking has been started.
However, recently there has been an effort to simplify the migration
status API and reduce it to a single migration_is_running() function.
To accommodate this, refactor vfio_devices_all_dirty_tracking() logic so
it won't use migration_is_active() and migration_is_device(). Instead,
use internal VFIO dirty tracking flags.
As a side effect, now that migration status is no longer used to detect
dirty tracking status, VFIO log syncs are untied from migration. This
will make calc-dirty-rate more accurate as now it will also include VFIO
dirty pages.
While at it, as VFIODevice->dirty_tracking is now used to detect dirty
tracking status, add a comment that states how it's protected.
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Tested-by: Joao Martins <joao.m.martins@oracle.com>
Link: https://lore.kernel.org/r/20241218134022.21264-3-avihaih@nvidia.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
include/hw/vfio/vfio-common.h | 2 +-
hw/vfio/common.c | 17 ++++++++++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index d57111843dafbc215da8f9de43780227e572dd54..a9a68e3fd9a2a570856193cb290cc252b46093de 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -143,7 +143,7 @@ typedef struct VFIODevice {
OnOffAuto pre_copy_dirty_page_tracking;
OnOffAuto device_dirty_page_tracking;
bool dirty_pages_supported;
- bool dirty_tracking;
+ bool dirty_tracking; /* Protected by BQL */
bool iommu_dirty_tracking;
HostIOMMUDevice *hiod;
int devid;
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 598272f4dd2708f8241733f5a994d0ea135c4e39..fd24b7ced83d241445c0b3dbd014b125b41a0927 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -170,11 +170,26 @@ bool vfio_device_state_is_precopy(VFIODevice *vbasedev)
migration->device_state == VFIO_DEVICE_STATE_PRE_COPY_P2P;
}
+static bool vfio_devices_all_device_dirty_tracking_started(
+ const VFIOContainerBase *bcontainer)
+{
+ VFIODevice *vbasedev;
+
+ QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) {
+ if (!vbasedev->dirty_tracking) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
static bool vfio_devices_all_dirty_tracking(VFIOContainerBase *bcontainer)
{
VFIODevice *vbasedev;
- if (!migration_is_active() && !migration_is_device()) {
+ if (!(vfio_devices_all_device_dirty_tracking_started(bcontainer) ||
+ bcontainer->dirty_pages_started)) {
return false;
}
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 13/17] vfio/migration: Refactor vfio_devices_all_running_and_mig_active() logic
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (11 preceding siblings ...)
2024-12-24 15:15 ` [PULL 12/17] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 14/17] vfio/migration: Rename vfio_devices_all_dirty_tracking() Cédric Le Goater
` (4 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Avihai Horon, Joao Martins,
Cédric Le Goater
From: Avihai Horon <avihaih@nvidia.com>
During DMA unmap with vIOMMU, vfio_devices_all_running_and_mig_active()
is used to check whether a dirty page log sync of the unmapped pages is
required. Such log sync is needed during migration pre-copy phase, and
the current logic detects it by checking if migration is active and if
the VFIO devices are running.
However, recently there has been an effort to simplify the migration
status API and reduce it to a single migration_is_running() function.
To accommodate this, refactor vfio_devices_all_running_and_mig_active()
logic so it won't use migration_is_active(). Do it by simply checking if
dirty tracking has been started using internal VFIO flags.
This should be equivalent to the previous logic as during migration
dirty tracking is active and when the guest is stopped there shouldn't
be DMA unmaps coming from it.
As a side effect, now that migration status is no longer used, DMA unmap
log syncs are untied from migration. This will make calc-dirty-rate more
accurate as now it will also include VFIO dirty pages that were DMA
unmapped.
Also rename the function to properly reflect its new logic and extract
common code from vfio_devices_all_dirty_tracking().
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Tested-by: Joao Martins <joao.m.martins@oracle.com>
Link: https://lore.kernel.org/r/20241218134022.21264-4-avihaih@nvidia.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
include/hw/vfio/vfio-common.h | 4 ++--
hw/vfio/common.c | 40 +++++++----------------------------
hw/vfio/container.c | 2 +-
3 files changed, 11 insertions(+), 35 deletions(-)
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index a9a68e3fd9a2a570856193cb290cc252b46093de..0c60be5b15c70168f4f94ad7054d9bd750a162d3 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -296,8 +296,8 @@ bool vfio_migration_realize(VFIODevice *vbasedev, Error **errp);
void vfio_migration_exit(VFIODevice *vbasedev);
int vfio_bitmap_alloc(VFIOBitmap *vbmap, hwaddr size);
-bool
-vfio_devices_all_running_and_mig_active(const VFIOContainerBase *bcontainer);
+bool vfio_devices_all_dirty_tracking_started(
+ const VFIOContainerBase *bcontainer);
bool
vfio_devices_all_device_dirty_tracking(const VFIOContainerBase *bcontainer);
int vfio_devices_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index fd24b7ced83d241445c0b3dbd014b125b41a0927..9b5524377ce01a0a982157b314ad60add371bac6 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -184,12 +184,18 @@ static bool vfio_devices_all_device_dirty_tracking_started(
return true;
}
+bool vfio_devices_all_dirty_tracking_started(
+ const VFIOContainerBase *bcontainer)
+{
+ return vfio_devices_all_device_dirty_tracking_started(bcontainer) ||
+ bcontainer->dirty_pages_started;
+}
+
static bool vfio_devices_all_dirty_tracking(VFIOContainerBase *bcontainer)
{
VFIODevice *vbasedev;
- if (!(vfio_devices_all_device_dirty_tracking_started(bcontainer) ||
- bcontainer->dirty_pages_started)) {
+ if (!vfio_devices_all_dirty_tracking_started(bcontainer)) {
return false;
}
@@ -225,36 +231,6 @@ bool vfio_devices_all_device_dirty_tracking(const VFIOContainerBase *bcontainer)
return true;
}
-/*
- * Check if all VFIO devices are running and migration is active, which is
- * essentially equivalent to the migration being in pre-copy phase.
- */
-bool
-vfio_devices_all_running_and_mig_active(const VFIOContainerBase *bcontainer)
-{
- VFIODevice *vbasedev;
-
- if (!migration_is_active()) {
- return false;
- }
-
- QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) {
- VFIOMigration *migration = vbasedev->migration;
-
- if (!migration) {
- return false;
- }
-
- if (vfio_device_state_is_running(vbasedev) ||
- vfio_device_state_is_precopy(vbasedev)) {
- continue;
- } else {
- return false;
- }
- }
- return true;
-}
-
static bool vfio_listener_skipped_section(MemoryRegionSection *section)
{
return (!memory_region_is_ram(section->mr) &&
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index 78a3c2d55fcd0f53c9b679167ad8d1b557f72358..4ebb5268088d0a2006e0ed04afec0ee746ed2c1d 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -131,7 +131,7 @@ static int vfio_legacy_dma_unmap(const VFIOContainerBase *bcontainer,
int ret;
Error *local_err = NULL;
- if (iotlb && vfio_devices_all_running_and_mig_active(bcontainer)) {
+ if (iotlb && vfio_devices_all_dirty_tracking_started(bcontainer)) {
if (!vfio_devices_all_device_dirty_tracking(bcontainer) &&
bcontainer->dirty_pages_supported) {
return vfio_dma_unmap_bitmap(container, iova, size, iotlb);
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 14/17] vfio/migration: Rename vfio_devices_all_dirty_tracking()
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (12 preceding siblings ...)
2024-12-24 15:15 ` [PULL 13/17] vfio/migration: Refactor vfio_devices_all_running_and_mig_active() logic Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 15/17] system/dirtylimit: Don't use migration_is_active() Cédric Le Goater
` (3 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Avihai Horon, Joao Martins,
Cédric Le Goater
From: Avihai Horon <avihaih@nvidia.com>
vfio_devices_all_dirty_tracking() is used to check if dirty page log
sync is needed. However, besides checking the dirty page tracking
status, it also checks the pre_copy_dirty_page_tracking flag.
Rename it to vfio_devices_log_sync_needed() which reflects its purpose
more accurately and makes the code clearer as there are already several
helpers with similar names.
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Tested-by: Joao Martins <joao.m.martins@oracle.com>
Link: https://lore.kernel.org/r/20241218134022.21264-5-avihaih@nvidia.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 9b5524377ce01a0a982157b314ad60add371bac6..f7499a9b7447a7593198e1523c50858b70a8bd85 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -191,7 +191,7 @@ bool vfio_devices_all_dirty_tracking_started(
bcontainer->dirty_pages_started;
}
-static bool vfio_devices_all_dirty_tracking(VFIOContainerBase *bcontainer)
+static bool vfio_log_sync_needed(const VFIOContainerBase *bcontainer)
{
VFIODevice *vbasedev;
@@ -1364,7 +1364,7 @@ static void vfio_listener_log_sync(MemoryListener *listener,
return;
}
- if (vfio_devices_all_dirty_tracking(bcontainer)) {
+ if (vfio_log_sync_needed(bcontainer)) {
ret = vfio_sync_dirty_bitmap(bcontainer, section, &local_err);
if (ret) {
error_report_err(local_err);
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 15/17] system/dirtylimit: Don't use migration_is_active()
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (13 preceding siblings ...)
2024-12-24 15:15 ` [PULL 14/17] vfio/migration: Rename vfio_devices_all_dirty_tracking() Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 16/17] migration: Drop migration_is_device() Cédric Le Goater
` (2 subsequent siblings)
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Avihai Horon, Hyman Huang, Joao Martins,
Cédric Le Goater
From: Avihai Horon <avihaih@nvidia.com>
vcpu_dirty_rate_stat_collect() uses migration_is_active() to detect
whether migration is running or not, in order to get the correct dirty
rate period value.
However, recently there has been an effort to simplify the migration
status API and reduce it to a single migration_is_running() function.
To accommodate this, and since the same functionality can be achieved
with migration_is_running(), use it instead of migration_is_active().
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Hyman Huang <yong.huang@smartx.com>
Tested-by: Joao Martins <joao.m.martins@oracle.com>
Link: https://lore.kernel.org/r/20241218134022.21264-6-avihaih@nvidia.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
system/dirtylimit.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/system/dirtylimit.c b/system/dirtylimit.c
index d94b994bd81bd44b95f120a53ce83b6809e60297..7c071248bbf92389977dab8b7d4808c9f57af630 100644
--- a/system/dirtylimit.c
+++ b/system/dirtylimit.c
@@ -80,8 +80,7 @@ static void vcpu_dirty_rate_stat_collect(void)
int i = 0;
int64_t period = DIRTYLIMIT_CALC_TIME_MS;
- if (migrate_dirty_limit() &&
- migration_is_active()) {
+ if (migrate_dirty_limit() && migration_is_running()) {
period = migrate_vcpu_dirty_limit_period();
}
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 16/17] migration: Drop migration_is_device()
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (14 preceding siblings ...)
2024-12-24 15:15 ` [PULL 15/17] system/dirtylimit: Don't use migration_is_active() Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-24 15:15 ` [PULL 17/17] migration: Unexport migration_is_active() Cédric Le Goater
2024-12-25 13:31 ` [PULL 00/17] vfio queue Stefan Hajnoczi
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Avihai Horon, Cédric Le Goater, Peter Xu,
Joao Martins
From: Avihai Horon <avihaih@nvidia.com>
After being removed from VFIO, migration_is_device() no longer has any
users. Drop it.
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Acked-by: Peter Xu <peterx@redhat.com>
Tested-by: Joao Martins <joao.m.martins@oracle.com>
Link: https://lore.kernel.org/r/20241218134022.21264-7-avihaih@nvidia.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
include/migration/misc.h | 1 -
migration/migration.c | 7 -------
2 files changed, 8 deletions(-)
diff --git a/include/migration/misc.h b/include/migration/misc.h
index 804eb23c06077bdbf1ad9873b5efa5d7770043e8..ad1e25826aebefd9f21b638a9f4be7dbc50edb95 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -54,7 +54,6 @@ void migration_object_init(void);
void migration_shutdown(void);
bool migration_is_active(void);
-bool migration_is_device(void);
bool migration_is_running(void);
bool migration_thread_is_self(void);
diff --git a/migration/migration.c b/migration/migration.c
index 056a90daafe70325934a83ce14e9e9ad02f9d30a..3606d1e26302e52de22185ba2438df1972dc0430 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1645,13 +1645,6 @@ bool migration_is_active(void)
s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
}
-bool migration_is_device(void)
-{
- MigrationState *s = current_migration;
-
- return s->state == MIGRATION_STATUS_DEVICE;
-}
-
bool migration_thread_is_self(void)
{
MigrationState *s = current_migration;
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PULL 17/17] migration: Unexport migration_is_active()
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (15 preceding siblings ...)
2024-12-24 15:15 ` [PULL 16/17] migration: Drop migration_is_device() Cédric Le Goater
@ 2024-12-24 15:15 ` Cédric Le Goater
2024-12-25 13:31 ` [PULL 00/17] vfio queue Stefan Hajnoczi
17 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-24 15:15 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Williamson, Avihai Horon, Cédric Le Goater, Peter Xu,
Joao Martins
From: Avihai Horon <avihaih@nvidia.com>
After being removed from VFIO and dirty limit, migration_is_active() no
longer has any users outside the migration subsystem, and in fact, it's
only used in migration.c.
Unexport it and also relocate it so it can be made static.
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Acked-by: Peter Xu <peterx@redhat.com>
Tested-by: Joao Martins <joao.m.martins@oracle.com>
Link: https://lore.kernel.org/r/20241218134022.21264-8-avihaih@nvidia.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
include/migration/misc.h | 1 -
migration/migration.c | 16 ++++++++--------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/include/migration/misc.h b/include/migration/misc.h
index ad1e25826aebefd9f21b638a9f4be7dbc50edb95..c0e23fdac9d0c73a9b284b2e231990fb33464c03 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -53,7 +53,6 @@ void dump_vmstate_json_to_file(FILE *out_fp);
void migration_object_init(void);
void migration_shutdown(void);
-bool migration_is_active(void);
bool migration_is_running(void);
bool migration_thread_is_self(void);
diff --git a/migration/migration.c b/migration/migration.c
index 3606d1e26302e52de22185ba2438df1972dc0430..df61ca4e938457d5586caec08c27587b46631d0d 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1139,6 +1139,14 @@ bool migration_is_running(void)
}
}
+static bool migration_is_active(void)
+{
+ MigrationState *s = current_migration;
+
+ return (s->state == MIGRATION_STATUS_ACTIVE ||
+ s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
+}
+
static bool migrate_show_downtime(MigrationState *s)
{
return (s->state == MIGRATION_STATUS_COMPLETED) || migration_in_postcopy();
@@ -1637,14 +1645,6 @@ bool migration_in_bg_snapshot(void)
return migrate_background_snapshot() && migration_is_running();
}
-bool migration_is_active(void)
-{
- MigrationState *s = current_migration;
-
- return (s->state == MIGRATION_STATUS_ACTIVE ||
- s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
-}
-
bool migration_thread_is_self(void)
{
MigrationState *s = current_migration;
--
2.47.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PULL 00/17] vfio queue
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
` (16 preceding siblings ...)
2024-12-24 15:15 ` [PULL 17/17] migration: Unexport migration_is_active() Cédric Le Goater
@ 2024-12-25 13:31 ` Stefan Hajnoczi
2024-12-25 17:48 ` Cédric Le Goater
17 siblings, 1 reply; 22+ messages in thread
From: Stefan Hajnoczi @ 2024-12-25 13:31 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: qemu-devel, Alex Williamson, Cédric Le Goater
[-- Attachment #1: Type: text/plain, Size: 4039 bytes --]
Hi Cédric,
Please take a look at the following 32-bit CI failure:
i686-linux-gnu-gcc -m32 -Ilibqemu-x86_64-softmmu.a.p -I. -I.. -Itarget/i386 -I../target/i386 -Isubprojects/libvduse -I../subprojects/libvduse -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/capstone -I/usr/include/p11-kit-1 -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/spice-server -I/usr/include/spice-1 -I/usr/include/SDL2 -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/slirp -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/i386-linux-gnu -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/i386-linux-gnu/dbus-1.0/include -I/usr/include/vte-2.91 -I/usr/include/virgl -I/usr/include/cacard -I/usr/include/nss -I/usr/include/nspr -I/usr/include/PCSC -I/usr/include/libusb-1.0 -I/usr/include/pipewire-0.3 -I/usr/include/spa-0.2 -I/usr/include/fuse3 -I/usr/include/uuid -fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O2 -g -fstack-protector-strong -Wempty-body -Wendif-labels -Wexpansion-to-defined -Wformat-security -Wformat-y2k -Wignored-qualifiers -Wimplicit-fallthrough=2 -Winit-self -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wredundant-decls -Wshadow=local -Wstrict-prototypes -Wtype-limits -Wundef -Wvla -Wwrite-strings -Wno-missing-include-dirs -Wno-psabi -Wno-shift-negative-value -isystem /builds/qemu-project/qemu/linux-headers -isystem linux-headers -iquote . -iquote /builds/qemu-project/qemu -iquote /builds/qemu-project/qemu/include -iquote /builds/qemu-project/qemu/host/include/i386 -iquote /builds/qemu-project/qemu/host/include/generic -iquote /builds/qemu-project/qemu/tcg/i386 -msse2 -mfpmath=sse -D_GNU_SOURCE -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero -fzero-call-used-regs=used-gpr -fPIE -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -D__USE_LARGEFILE64 -DUSE_POSIX_ACLS=1 -pthread -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNCURSES_WIDECHAR=1 -D_REENTRANT -DSTRUCT_IOVEC_DEFINED -isystem../linux-headers -isystemlinux-headers -DCOMPILING_PER_TARGET '-DCONFIG_TARGET="x86_64-softmmu-config-target.h"' '-DCONFIG_DEVICES="x86_64-softmmu-config-devices.h"' -MD -MQ libqemu-x86_64-softmmu.a.p/hw_vfio_igd.c.o -MF libqemu-x86_64-softmmu.a.p/hw_vfio_igd.c.o.d -o libqemu-x86_64-softmmu.a.p/hw_vfio_igd.c.o -c ../hw/vfio/igd.c
../hw/vfio/igd.c: In function ‘vfio_igd_pci_config_read’:
../hw/vfio/igd.c:438:18: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
438 | hw_error("igd: unsupported pci config read at %lx, size %u",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
439 | offset, size);
| ~~~~~~
| |
| uint64_t {aka long long unsigned int}
../hw/vfio/igd.c: In function ‘vfio_igd_pci_config_write’:
../hw/vfio/igd.c:463:18: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
463 | hw_error("igd: unsupported pci config write at %lx, size %u",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
464 | offset, size);
| ~~~~~~
| |
| uint64_t {aka long long unsigned int}
cc1: all warnings being treated as errors
https://gitlab.com/qemu-project/qemu/-/jobs/8722428394#L6317
Once the issue has been resolved, please send a new revision of this
pull request. Thanks!
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PULL 00/17] vfio queue
2024-12-25 13:31 ` [PULL 00/17] vfio queue Stefan Hajnoczi
@ 2024-12-25 17:48 ` Cédric Le Goater
0 siblings, 0 replies; 22+ messages in thread
From: Cédric Le Goater @ 2024-12-25 17:48 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel, Alex Williamson
Hello Stefan,
On 12/25/24 14:31, Stefan Hajnoczi wrote:
> Hi Cédric,
> Please take a look at the following 32-bit CI failure:
Drat. I didn't check 32-bit ... Sorry about that.
I will resend.
Thanks,
C.
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2024-12-25 17:49 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-24 15:15 [PULL 00/17] vfio queue Cédric Le Goater
2024-12-24 15:15 ` [PULL 01/17] vfio/igd: fix GTT stolen memory size calculation for gen 8+ Cédric Le Goater
2024-12-24 15:15 ` [PULL 02/17] vfio/igd: remove unsupported device ids Cédric Le Goater
2024-12-24 15:15 ` [PULL 03/17] vfio/igd: align generation with i915 kernel driver Cédric Le Goater
2024-12-24 15:15 ` [PULL 04/17] vfio/igd: canonicalize memory size calculations Cédric Le Goater
2024-12-24 15:15 ` [PULL 05/17] vfio/igd: add Gemini Lake and Comet Lake device ids Cédric Le Goater
2024-12-24 15:15 ` [PULL 06/17] vfio/igd: add Alder/Raptor/Rocket/Ice/Jasper " Cédric Le Goater
2024-12-24 15:15 ` [PULL 07/17] vfio/igd: add macro for declaring mirrored registers Cédric Le Goater
2024-12-24 15:15 ` [PULL 08/17] vfio/igd: emulate GGC register in mmio bar0 Cédric Le Goater
2024-12-24 15:15 ` [PULL 09/17] vfio/igd: emulate BDSM in mmio bar0 for gen 6-10 devices Cédric Le Goater
2024-12-24 15:15 ` [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 15:15 ` [PULL 11/17] vfio/container: Add dirty tracking started flag Cédric Le Goater
2024-12-24 15:15 ` [PULL 12/17] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic Cédric Le Goater
2024-12-24 15:15 ` [PULL 13/17] vfio/migration: Refactor vfio_devices_all_running_and_mig_active() logic Cédric Le Goater
2024-12-24 15:15 ` [PULL 14/17] vfio/migration: Rename vfio_devices_all_dirty_tracking() Cédric Le Goater
2024-12-24 15:15 ` [PULL 15/17] system/dirtylimit: Don't use migration_is_active() Cédric Le Goater
2024-12-24 15:15 ` [PULL 16/17] migration: Drop migration_is_device() Cédric Le Goater
2024-12-24 15:15 ` [PULL 17/17] migration: Unexport migration_is_active() Cédric Le Goater
2024-12-25 13:31 ` [PULL 00/17] vfio queue Stefan Hajnoczi
2024-12-25 17:48 ` Cédric Le Goater
-- strict thread matches above, loose matches on Subject: below --
2024-01-08 7:32 Cédric Le Goater
2024-01-08 13:16 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.