public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/qemu] eln: * Thu Oct 08 2026 Miroslav Rezanina <mrezanin@redhat.com> - 11.1.0-1
@ 2026-10-15 7:30 Miroslav Rezanina
0 siblings, 0 replies; only message in thread
From: Miroslav Rezanina @ 2026-10-15 7:30 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/qemu
Branch : eln
Commit : 04a34e91c869c7331ad1f661605185e1df5a946c
Author : Miroslav Rezanina <mrezanin@redhat.com>
Date : 2026-10-15T09:30:18+02:00
Stats : +2219/-74926 in 502 file(s)
URL : https://src.fedoraproject.org/rpms/qemu/c/04a34e91c869c7331ad1f661605185e1df5a946c?branch=eln
Log:
* Thu Oct 08 2026 Miroslav Rezanina <mrezanin@redhat.com> - 11.1.0-1
- Rebase to QEMU 11.1.0
- Added rhel-10.4 machine types
- Resolves: RHEL-253076
(Handle rebase to QEMU 11.1.0 for RHEL 10.4)
- Resolves: RHEL-260114
(Add new -rhel10.4.0 machine type to qemu-kvm [x86_64])
- Resolves: RHEL-260116
(Add new -rhel10.4.0 machine type to qemu-kvm [aarch64])
- Resolves: RHEL-260115
(Add new -rhel10.4.0 machine type to qemu-kvm [s390x])
---
diff --git a/.gitignore b/.gitignore
index b212237..579fbf0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,3 +36,4 @@
/IORT.its_off
/IORT.smmuv3-dev
/IORT.smmuv3-legacy
+/qemu-11.1.0.tar.xz
diff --git a/0004-Initial-redhat-build.patch b/0004-Initial-redhat-build.patch
index b2d2860..f2f93c5 100644
--- a/0004-Initial-redhat-build.patch
+++ b/0004-Initial-redhat-build.patch
@@ -1,4 +1,4 @@
-From 8a5eef9fcb74b2fa82ac6122caf3c3d38a26b195 Mon Sep 17 00:00:00 2001
+From a5deb88330b73d6fbd819f71e9835587e1339cbd Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Wed, 26 May 2021 10:56:02 +0200
Subject: Initial redhat build
@@ -13,7 +13,7 @@ several issues are fixed in QEMU tree:
We disable make check due to issues with some of the tests.
-We are rebasing from qemu-kvm-10.0.0-12.el10.
+We are rebasing from qemu-kvm-10.1.0-28.el10.
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
@@ -41,6 +41,15 @@ Rebase notes (10.1.0 rc0):
- Conditional qemu-kvm-block-rbd requirement
- Flip ipxe roms and seavgabios arch condition
+Rebaes notes (11.1.0):
+- Removed new dtb files added upstream
+- Removed u-boot-sam460.bin
+- Removed linuxboot.bin and multiboot.bin files
+- Add python3-wheel dependency
+- Disable nitro acceleration
+- accel-qtest-<arch>.so renamed to accel-qtest.so
+- Package qemu-vnc man page
+
Merged patches (9.1.0):
- b206b8f7cb redhat: Remove the s390-netboot.img from the spec file
- 95605107f1 Require new dtrace package
@@ -53,12 +62,13 @@ Merged patches (10.0.0):
Merged patches (10.1.0 rc0):
- 72119e03ea distro: add an explicit valgrind-devel build dep
---
- .distro/Makefile | 101 ++
+ .distro/Makefile | 101 +
.distro/Makefile.common | 42 +
+ .distro/README.gitlab-ci | 5 +
.distro/README.tests | 39 +
.distro/modules-load.conf | 4 +
.distro/qemu-guest-agent.service | 1 -
- .distro/qemu-kvm.spec.template | 1795 +++++++++++++++++++++++
+ .distro/qemu-kvm.spec.template | 2454 +++++++++++++++++++++++
.distro/rpminspect.yaml | 6 +-
.distro/scripts/extract_build_cmd.py | 12 +
.distro/scripts/frh.py | 4 +-
@@ -69,9 +79,10 @@ Merged patches (10.1.0 rc0):
scripts/systemtap/conf.d/qemu_kvm.conf | 4 +
scripts/systemtap/script.d/qemu_kvm.stp | 1 +
ui/vnc-auth-sasl.c | 2 +-
- 16 files changed, 2057 insertions(+), 8 deletions(-)
+ 17 files changed, 2721 insertions(+), 8 deletions(-)
create mode 100644 .distro/Makefile
create mode 100644 .distro/Makefile.common
+ create mode 100644 .distro/README.gitlab-ci
create mode 100644 .distro/README.tests
create mode 100644 .distro/modules-load.conf
create mode 100644 .distro/qemu-kvm.spec.template
@@ -129,12 +140,12 @@ index 0000000000..ad913fc990
+3. Translate the trace record to readable format.
+ # /usr/share/qemu-kvm/simpletrace.py --no-header /usr/share/qemu-kvm/trace-events /tmp/trace.log
diff --git a/scripts/qemu-guest-agent/fsfreeze-hook b/scripts/qemu-guest-agent/fsfreeze-hook
-index c1feb6f5ce..d5d8d4daf8 100755
+index 76669f5caf..0d6777e899 100755
--- a/scripts/qemu-guest-agent/fsfreeze-hook
+++ b/scripts/qemu-guest-agent/fsfreeze-hook
-@@ -7,8 +7,8 @@
- # "freeze" argument before the filesystem is frozen. And for fsfreeze-thaw
- # request, it is issued with "thaw" argument after filesystem is thawed.
+@@ -8,8 +8,8 @@
+ # filesystem is frozen. And for fsfreeze-thaw requests, it is called with "thaw"
+ # as its argument after the filesystem is thawed.
-LOGFILE=/var/log/qga-fsfreeze-hook.log
-FSFREEZE_D=$(dirname -- "$0")/fsfreeze-hook.d
@@ -161,7 +172,7 @@ index 0000000000..c04abf9449
@@ -0,0 +1 @@
+probe qemu.kvm.simpletrace.handle_qmp_command,qemu.kvm.simpletrace.monitor_protocol_*,qemu.kvm.simpletrace.migrate_set_state {}
diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
-index 3f4cfc471d..09dafba18d 100644
+index 298c8f3769..96ec6394c0 100644
--- a/ui/vnc-auth-sasl.c
+++ b/ui/vnc-auth-sasl.c
@@ -42,7 +42,7 @@
@@ -174,5 +185,5 @@ index 3f4cfc471d..09dafba18d 100644
if (saslErr != SASL_OK) {
error_setg(errp, "Failed to initialize SASL auth: %s",
--
-2.39.3
+2.55.0
diff --git a/0005-Enable-disable-devices-for-RHEL.patch b/0005-Enable-disable-devices-for-RHEL.patch
index 222f261..d191499 100644
--- a/0005-Enable-disable-devices-for-RHEL.patch
+++ b/0005-Enable-disable-devices-for-RHEL.patch
@@ -1,4 +1,4 @@
-From 03cf16ca98c4ed835c4da8c4424bfac5a9ae3aa6 Mon Sep 17 00:00:00 2001
+From b371f7416fc402aa5b5e35da9c4f2229c6b64183 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Wed, 7 Dec 2022 03:05:48 -0500
Subject: Enable/disable devices for RHEL
@@ -33,6 +33,12 @@ Rebase notes (10.1.0 rc0):
- Improved riscv cpu chunk re-added
- Comment out unused code
+Rebase notes (11.0.0 rc0):
+- Updated arm cpu disabling chunk to new upstream code
+
+Rebase notes (11.1.0):
+- Enable WINDUMP config for x86_64
+
Merged commits (9.1.0):
- f24c7a1fee Disable FDC devices
- fe8c6cb1ce Disable vga-cirrus device
@@ -53,13 +59,23 @@ Merged commits (10.1.0 rc2):
Merged commits (10.1.0 rc3):
- f06f55a179 Enable uefi variable service for edk2
+
+Merged commits (11.0.0 rc0):
+- 627b1afca7 rh: enable CONFIG_USB_STORAGE_BOT
+- 5aa680dc73 vfio: Disable VFIO migration with MultiFD support
+- 1e80aae75d rh: configs: enable CONFIG_TDX for x86_64
+- 273b5c9f7a redhat: allow 5-level paging for TDX VMs
+
+Merged commits (11.1.0):
+- ef81334066 rh: aarch64-rh-devices.mak: Add CONFIG_TEGRA241_CMDQV
+- b41edad41b hw/tpm: default tpm-tis-device PPI to disabled
---
.distro/qemu-kvm.spec.template | 20 +--
- .../aarch64-softmmu/aarch64-rh-devices.mak | 49 ++++++++
+ .../aarch64-softmmu/aarch64-rh-devices.mak | 50 ++++++++
configs/devices/rh-virtio.mak | 10 ++
- .../riscv64-softmmu/riscv64-rh-devices.mak | 39 ++++++
+ .../riscv64-softmmu/riscv64-rh-devices.mak | 40 ++++++
.../s390x-softmmu/s390x-rh-devices.mak | 20 +++
- .../x86_64-softmmu/x86_64-rh-devices.mak | 118 ++++++++++++++++++
+ .../x86_64-softmmu/x86_64-rh-devices.mak | 121 ++++++++++++++++++
hw/arm/virt.c | 4 +
hw/cxl/meson.build | 3 +-
hw/ide/piix.c | 5 +-
@@ -67,18 +83,19 @@ Merged commits (10.1.0 rc3):
hw/net/e1000.c | 2 +
hw/net/rtl8139.c | 4 +
hw/usb/meson.build | 2 +-
- hw/virtio/meson.build | 6 +-
+ hw/vfio/pci.c | 3 +-
target/arm/arm-qmp-cmds.c | 2 +
target/arm/cpu.h | 2 +
target/arm/cpu64.c | 7 +-
- target/arm/tcg/cpu32.c | 2 +
+ target/arm/tcg/cpu32.c | 4 +-
target/arm/tcg/cpu64.c | 8 ++
target/arm/tcg/meson.build | 2 +-
target/i386/cpu.c | 20 +++
+ target/i386/kvm/tdx.c | 1 +
target/riscv/cpu.c | 6 +
target/s390x/cpu_models.c | 2 +-
tests/qtest/arm-cpu-features.c | 4 +
- 24 files changed, 323 insertions(+), 16 deletions(-)
+ 25 files changed, 327 insertions(+), 17 deletions(-)
create mode 100644 configs/devices/aarch64-softmmu/aarch64-rh-devices.mak
create mode 100644 configs/devices/rh-virtio.mak
create mode 100644 configs/devices/riscv64-softmmu/riscv64-rh-devices.mak
@@ -87,10 +104,10 @@ Merged commits (10.1.0 rc3):
diff --git a/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak b/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak
new file mode 100644
-index 0000000000..855278f70e
+index 0000000000..92d0b322d0
--- /dev/null
+++ b/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak
-@@ -0,0 +1,49 @@
+@@ -0,0 +1,50 @@
+include ../rh-virtio.mak
+
+CONFIG_ARM_GIC_KVM=y
@@ -112,6 +129,7 @@ index 0000000000..855278f70e
+CONFIG_USB=y
+CONFIG_USB_XHCI=y
+CONFIG_USB_XHCI_PCI=y
++CONFIG_USB_STORAGE_BOT=y
+CONFIG_USB_STORAGE_CORE=y
+CONFIG_USB_STORAGE_CLASSIC=y
+CONFIG_USB_HUB=y
@@ -158,10 +176,10 @@ index 0000000000..94ede1b5f6
+CONFIG_VIRTIO_SERIAL=y
diff --git a/configs/devices/riscv64-softmmu/riscv64-rh-devices.mak b/configs/devices/riscv64-softmmu/riscv64-rh-devices.mak
new file mode 100644
-index 0000000000..b5e55de916
+index 0000000000..5ac051f90b
--- /dev/null
+++ b/configs/devices/riscv64-softmmu/riscv64-rh-devices.mak
-@@ -0,0 +1,39 @@
+@@ -0,0 +1,40 @@
+include ../rh-virtio.mak
+
+CONFIG_RISCV_VIRT=y
@@ -179,6 +197,7 @@ index 0000000000..b5e55de916
+CONFIG_USB=y
+CONFIG_USB_XHCI=y
+CONFIG_USB_XHCI_PCI=y
++CONFIG_USB_STORAGE_BOT=y
+CONFIG_USB_STORAGE_CORE=y
+CONFIG_USB_STORAGE_CLASSIC=y
+CONFIG_USB_HUB=y
@@ -229,10 +248,10 @@ index 0000000000..834281d872
+CONFIG_IOMMUFD=y
diff --git a/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak
new file mode 100644
-index 0000000000..828cb8aa6f
+index 0000000000..13754fc44b
--- /dev/null
+++ b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak
-@@ -0,0 +1,118 @@
+@@ -0,0 +1,121 @@
+include ../rh-virtio.mak
+
+CONFIG_ACPI=y
@@ -309,11 +328,13 @@ index 0000000000..828cb8aa6f
+CONFIG_SEV=y
+CONFIG_SMBIOS=y
+CONFIG_SMBUS_EEPROM=y
++CONFIG_TDX=y
+CONFIG_TEST_DEVICES=y
+CONFIG_USB=y
+CONFIG_USB_EHCI=y
+CONFIG_USB_EHCI_PCI=y
+CONFIG_USB_SMARTCARD=y
++CONFIG_USB_STORAGE_BOT=y
+CONFIG_USB_STORAGE_CORE=y
+CONFIG_USB_STORAGE_CLASSIC=y
+CONFIG_USB_UHCI=y
@@ -351,32 +372,33 @@ index 0000000000..828cb8aa6f
+CONFIG_VHOST_USER_SND=y
+CONFIG_VHOST_USER_GPU=y
+CONFIG_UEFI_VARS=y
++CONFIG_WINDUMP=y
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index ef6be3660f..b525e00365 100644
+index 219597cabd..ea5317cc6f 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
-@@ -3183,6 +3183,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
- MachineClass *mc = MACHINE_CLASS(oc);
- HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
- static const char * const valid_cpu_types[] = {
+@@ -4129,6 +4129,7 @@ static GPtrArray *virt_get_valid_cpu_types(const MachineState *ms)
+ {
+ GPtrArray *vct = g_ptr_array_new_with_free_func(g_free);
+
+#if 0 /* Disabled for Red Hat Enterprise Linux */
- #ifdef CONFIG_TCG
- ARM_CPU_TYPE_NAME("cortex-a7"),
- ARM_CPU_TYPE_NAME("cortex-a15"),
-@@ -3198,8 +3199,11 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
- ARM_CPU_TYPE_NAME("neoverse-n2"),
- #endif /* TARGET_AARCH64 */
- #endif /* CONFIG_TCG */
+ if (tcg_enabled()) {
+ g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("cortex-a7")));
+ g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("cortex-a15")));
+@@ -4144,8 +4145,11 @@ static GPtrArray *virt_get_valid_cpu_types(const MachineState *ms)
+ g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("neoverse-v1")));
+ g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("neoverse-n2")));
+ }
+#endif /* disabled for RHEL */
- #ifdef TARGET_AARCH64
+ if (target_aarch64()) {
+#if 0 /* Disabled for Red Hat Enterprise Linux */
- ARM_CPU_TYPE_NAME("cortex-a53"),
+ g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("cortex-a53")));
+#endif /* disabled for RHEL */
- ARM_CPU_TYPE_NAME("cortex-a57"),
- #if defined(CONFIG_KVM) || defined(CONFIG_HVF)
- ARM_CPU_TYPE_NAME("host"),
+ g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("cortex-a57")));
+ if (kvm_enabled() || hvf_enabled() || whpx_enabled()) {
+ g_ptr_array_add(vct, g_strdup(ARM_CPU_TYPE_NAME("host")));
diff --git a/hw/cxl/meson.build b/hw/cxl/meson.build
-index 3e375f61a9..613adb3ebb 100644
+index 5f61273a68..660a4ac69c 100644
--- a/hw/cxl/meson.build
+++ b/hw/cxl/meson.build
@@ -6,7 +6,8 @@ system_ss.add(when: 'CONFIG_CXL',
@@ -386,8 +408,8 @@ index 3e375f61a9..613adb3ebb 100644
- 'switch-mailbox-cci.c',
+# Disabled for 8.2.0 rebase for RHEL 9.4.0
+# 'switch-mailbox-cci.c',
- ),
- if_false: files(
+ ))
+ stub_ss.add(files(
'cxl-host-stubs.c',
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index a0f2709c69..8c3962443b 100644
@@ -413,7 +435,7 @@ index a0f2709c69..8c3962443b 100644
static const TypeInfo piix4_ide_info = {
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
-index 71f5f976e9..794078ed84 100644
+index b09c3bce93..38add4a54a 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -950,6 +950,8 @@ static void i8042_class_initfn(ObjectClass *klass, const void *data)
@@ -426,7 +448,7 @@ index 71f5f976e9..794078ed84 100644
static const TypeInfo i8042_info = {
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
-index a80a7b0cdb..7eb5a3b19d 100644
+index 202ad40401..1a842520e5 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -1732,6 +1732,7 @@ static const E1000Info e1000_devices[] = {
@@ -446,7 +468,7 @@ index a80a7b0cdb..7eb5a3b19d 100644
static void e1000_register_types(void)
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
-index 324fb932aa..f4dd693abb 100644
+index 424af73a18..7d4f7ed173 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -57,6 +57,7 @@
@@ -457,7 +479,7 @@ index 324fb932aa..f4dd693abb 100644
#include "qemu/bswap.h"
#include "net/net.h"
#include "net/eth.h"
-@@ -3363,6 +3364,9 @@ static void pci_rtl8139_realize(PCIDevice *dev, Error **errp)
+@@ -3378,6 +3379,9 @@ static void pci_rtl8139_realize(PCIDevice *dev, Error **errp)
DeviceState *d = DEVICE(dev);
uint8_t *pci_conf;
@@ -468,10 +490,10 @@ index 324fb932aa..f4dd693abb 100644
pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */
/* TODO: start of capability list, but no capability
diff --git a/hw/usb/meson.build b/hw/usb/meson.build
-index 17360a5b5a..3c4fdfc31d 100644
+index ba55c28ef6..717f582e60 100644
--- a/hw/usb/meson.build
+++ b/hw/usb/meson.build
-@@ -53,7 +53,7 @@ system_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: files('dev-smartcard-reader
+@@ -54,7 +54,7 @@ system_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: files('dev-smartcard-reader
if cacard.found()
usbsmartcard_ss = ss.source_set()
usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD',
@@ -480,35 +502,28 @@ index 17360a5b5a..3c4fdfc31d 100644
hw_usb_modules += {'smartcard': usbsmartcard_ss}
endif
-diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
-index 3ea7b3cec8..3102d68bec 100644
---- a/hw/virtio/meson.build
-+++ b/hw/virtio/meson.build
-@@ -22,7 +22,8 @@ if have_vhost
- system_virtio_ss.add(files('vhost-user-base.c'))
-
- # MMIO Stubs
-- system_virtio_ss.add(files('vhost-user-device.c'))
-+# Disabled for 8.2.0 rebase for RHEL 9.4.0
-+# system_virtio_ss.add(files('vhost-user-device.c'))
- system_virtio_ss.add(when: 'CONFIG_VHOST_USER_GPIO', if_true: files('vhost-user-gpio.c'))
- system_virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c'))
- system_virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c'))
-@@ -30,7 +31,8 @@ if have_vhost
- system_virtio_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input.c'))
-
- # PCI Stubs
-- system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c'))
-+# Disabled for 8.2.0 rebase for RHEL 9.4.0
-+# system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c'))
- system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_GPIO'],
- if_true: files('vhost-user-gpio-pci.c'))
- system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_I2C'],
+diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
+index 428ab2f069..7a4b110cda 100644
+--- a/hw/vfio/pci.c
++++ b/hw/vfio/pci.c
+@@ -3892,10 +3892,11 @@ static const Property vfio_pci_properties[] = {
+ igd_legacy_mode, ON_OFF_AUTO_AUTO),
+ DEFINE_PROP_ON_OFF_AUTO("enable-migration", VFIOPCIDevice,
+ vbasedev.enable_migration, ON_OFF_AUTO_AUTO),
++ /* RHEL only. Disable VFIO migration with MultiFD support */
+ DEFINE_PROP("x-migration-multifd-transfer", VFIOPCIDevice,
+ vbasedev.migration_multifd_transfer,
+ vfio_pci_migration_multifd_transfer_prop, OnOffAuto,
+- .set_default = true, .defval.i = ON_OFF_AUTO_AUTO),
++ .set_default = true, .defval.i = ON_OFF_AUTO_OFF),
+ DEFINE_PROP_ON_OFF_AUTO("x-migration-load-config-after-iter", VFIOPCIDevice,
+ vbasedev.migration_load_config_after_iter,
+ ON_OFF_AUTO_AUTO),
diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c
-index d292c974c4..9bb68866e1 100644
+index 83ec95c290..6ec3a89b71 100644
--- a/target/arm/arm-qmp-cmds.c
+++ b/target/arm/arm-qmp-cmds.c
-@@ -225,6 +225,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
+@@ -204,6 +204,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
static void arm_cpu_add_definition(gpointer data, gpointer user_data)
{
ObjectClass *oc = data;
@@ -516,7 +531,7 @@ index d292c974c4..9bb68866e1 100644
CpuDefinitionInfoList **cpu_list = user_data;
CpuDefinitionInfo *info;
const char *typename;
-@@ -233,6 +234,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data)
+@@ -212,6 +213,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data)
info = g_malloc0(sizeof(*info));
info->name = cpu_model_from_type(typename);
info->q_typename = g_strdup(typename);
@@ -525,12 +540,12 @@ index d292c974c4..9bb68866e1 100644
QAPI_LIST_PREPEND(*cpu_list, info);
}
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
-index dc9b6dce4c..dc0da8b0ae 100644
+index c0492c8dfb..e2b2fae4e3 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
-@@ -34,6 +34,8 @@
- #include "target/arm/gtimer.h"
- #include "target/arm/cpu-sysregs.h"
+@@ -37,6 +37,8 @@
+ #include "hw/intc/arm_gicv5_types.h"
+ #include "target/arm/vector-type.h"
+#define RHEL_CPU_DEPRECATION "use 'host' / 'max'"
+
@@ -538,26 +553,26 @@ index dc9b6dce4c..dc0da8b0ae 100644
#define EXCP_SWI 2 /* software interrupt */
#define EXCP_PREFETCH_ABORT 3
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
-index 26cf7e6dfa..051d5d653b 100644
+index 2816735577..3675291bbf 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
-@@ -698,6 +698,7 @@ static void aarch64_a57_initfn(Object *obj)
- define_cortex_a72_a57_a53_cp_reginfo(cpu);
+@@ -691,6 +691,7 @@ static void aarch64_a57_initfn(Object *obj)
+ aarch64_aa32_a57_init(obj, false);
}
+#if 0 /* Disabled for Red Hat Enterprise Linux */
static void aarch64_a53_initfn(Object *obj)
{
ARMCPU *cpu = ARM_CPU(obj);
-@@ -759,6 +760,7 @@ static void aarch64_a53_initfn(Object *obj)
+@@ -752,6 +753,7 @@ static void aarch64_a53_initfn(Object *obj)
cpu->gic_pribits = 5;
define_cortex_a72_a57_a53_cp_reginfo(cpu);
}
+#endif
- static void aarch64_host_initfn(Object *obj)
- {
-@@ -797,8 +799,11 @@ static void aarch64_max_initfn(Object *obj)
+ #if defined(CONFIG_KVM)
+ static void kvm_arm_set_cpreg_mig_tolerances(ARMCPU *cpu)
+@@ -819,8 +821,11 @@ void aarch64_host_initfn(Object *obj)
}
static const ARMCPUInfo aarch64_cpus[] = {
@@ -567,28 +582,33 @@ index 26cf7e6dfa..051d5d653b 100644
+#if 0 /* Disabled for Red Hat Enterprise Linux */
{ .name = "cortex-a53", .initfn = aarch64_a53_initfn },
+#endif /* disabled for RHEL */
- { .name = "max", .initfn = aarch64_max_initfn },
- #if defined(CONFIG_KVM) || defined(CONFIG_HVF)
+ #if defined(CONFIG_KVM) || defined(CONFIG_HVF) || defined(CONFIG_WHPX)
{ .name = "host", .initfn = aarch64_host_initfn },
+ #endif
diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c
-index a2a23eae0d..c362759d65 100644
+index 8220d785f5..a1b3a0481d 100644
--- a/target/arm/tcg/cpu32.c
+++ b/target/arm/tcg/cpu32.c
-@@ -115,6 +115,7 @@ void aa32_max_features(ARMCPU *cpu)
- FIELD_DP32_IDREG(isar, ID_DFR1, HPMN0, 1); /* FEAT_HPMN0 */
- }
+@@ -18,9 +18,9 @@
+ #endif
+ #include "cpregs.h"
-+#if 0 /* Disabled for Red Hat Enterprise Linux */
+-
/* CPU models. These are not needed for the AArch64 linux-user build. */
#if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
++#if 0 /* Disabled for Red Hat Enterprise Linux */
-@@ -1084,3 +1085,4 @@ static void arm_tcg_cpu_register_types(void)
- type_init(arm_tcg_cpu_register_types)
+ static void arm926_initfn(Object *obj)
+ {
+@@ -746,5 +746,5 @@ static void arm_tcg_cpu_register_types(void)
+ }
- #endif /* !CONFIG_USER_ONLY || !TARGET_AARCH64 */
+ type_init(arm_tcg_cpu_register_types)
+-
+#endif /* disabled for RHEL */
+ #endif /* !CONFIG_USER_ONLY || !TARGET_AARCH64 */
diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c
-index 35cddbafa4..c7c464a0af 100644
+index 8a3ebf6321..3e3b241b6f 100644
--- a/target/arm/tcg/cpu64.c
+++ b/target/arm/tcg/cpu64.c
@@ -29,6 +29,7 @@
@@ -607,7 +627,7 @@ index 35cddbafa4..c7c464a0af 100644
static void cpu_max_get_sve_max_vq(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
-@@ -199,6 +201,7 @@ static void cpu_max_get_l0gptsz(Object *obj, Visitor *v, const char *name,
+@@ -200,6 +202,7 @@ static void cpu_max_get_l0gptsz(Object *obj, Visitor *v, const char *name,
static const Property arm_cpu_lpa2_property =
DEFINE_PROP_BOOL("lpa2", ARMCPU, prop_lpa2, true);
@@ -615,7 +635,7 @@ index 35cddbafa4..c7c464a0af 100644
static void aarch64_a55_initfn(Object *obj)
{
ARMCPU *cpu = ARM_CPU(obj);
-@@ -1080,6 +1083,7 @@ static void aarch64_neoverse_n2_initfn(Object *obj)
+@@ -1154,6 +1157,7 @@ static void aarch64_neoverse_n2_initfn(Object *obj)
aarch64_add_pauth_properties(obj);
aarch64_add_sve_properties(obj);
}
@@ -623,7 +643,7 @@ index 35cddbafa4..c7c464a0af 100644
/*
* -cpu max: a CPU with as many features enabled as our emulation supports.
-@@ -1310,6 +1314,7 @@ void aarch64_max_tcg_initfn(Object *obj)
+@@ -1445,6 +1449,7 @@ void aarch64_max_tcg_initfn(Object *obj)
qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property);
}
@@ -631,7 +651,7 @@ index 35cddbafa4..c7c464a0af 100644
static const ARMCPUInfo aarch64_cpus[] = {
{ .name = "cortex-a35", .initfn = aarch64_a35_initfn },
{ .name = "cortex-a55", .initfn = aarch64_a55_initfn },
-@@ -1321,14 +1326,17 @@ static const ARMCPUInfo aarch64_cpus[] = {
+@@ -1461,14 +1466,17 @@ static const ARMCPUInfo aarch64_cpus[] = {
{ .name = "neoverse-v1", .initfn = aarch64_neoverse_v1_initfn },
{ .name = "neoverse-n2", .initfn = aarch64_neoverse_n2_initfn },
};
@@ -650,23 +670,23 @@ index 35cddbafa4..c7c464a0af 100644
type_init(aarch64_cpu_register_types)
diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
-index 895facdc30..f1a9e01c51 100644
+index cbfac0036e..15d2c85d00 100644
--- a/target/arm/tcg/meson.build
+++ b/target/arm/tcg/meson.build
-@@ -53,7 +53,7 @@ arm_system_ss.add(files(
- 'psci.c',
+@@ -48,7 +48,7 @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
+ 'fp8_helper.c',
))
--arm_system_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('cpu-v7m.c'))
-+#arm_system_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('cpu-v7m.c'))
+-arm_common_system_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('cpu-v7m.c'))
++#arm_common_system_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('cpu-v7m.c'))
arm_user_ss.add(when: 'TARGET_AARCH64', if_false: files('cpu-v7m.c'))
arm_common_ss.add(zlib)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
-index 6d85149e6e..9c756a05f2 100644
+index 5805d33ab9..45c8f65856 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
-@@ -3163,6 +3163,7 @@ static const CPUCaches xeon_srf_cache_info = {
+@@ -3413,6 +3413,7 @@ static const CPUCaches xeon_cwf_cache_info = {
},
};
@@ -674,7 +694,7 @@ index 6d85149e6e..9c756a05f2 100644
static const CPUCaches yongfeng_cache_info = {
.l1d_cache = &(CPUCacheInfo) {
/* CPUID 0x4.0x0.EAX */
-@@ -3261,6 +3262,7 @@ static const CPUCaches yongfeng_cache_info = {
+@@ -3511,6 +3512,7 @@ static const CPUCaches yongfeng_cache_info = {
.share_level = CPU_TOPOLOGY_LEVEL_DIE,
},
};
@@ -682,7 +702,7 @@ index 6d85149e6e..9c756a05f2 100644
/* The following VMX features are not supported by KVM and are left out in the
* CPU definitions:
-@@ -3290,9 +3292,13 @@ static const CPUCaches yongfeng_cache_info = {
+@@ -3540,9 +3542,13 @@ static const CPUCaches yongfeng_cache_info = {
* PT in VMX operation
*/
@@ -696,7 +716,7 @@ index 6d85149e6e..9c756a05f2 100644
.level = 0xd,
.vendor = CPUID_VENDOR_AMD,
.family = 15,
-@@ -3311,6 +3317,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
+@@ -3561,6 +3567,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
.xlevel = 0x8000000A,
.model_id = "QEMU Virtual CPU version " QEMU_HW_VERSION,
},
@@ -704,7 +724,7 @@ index 6d85149e6e..9c756a05f2 100644
{
.name = "phenom",
.level = 5,
-@@ -3679,8 +3686,10 @@ static const X86CPUDefinition builtin_x86_defs[] = {
+@@ -3929,8 +3936,10 @@ static const X86CPUDefinition builtin_x86_defs[] = {
.xlevel = 0x80000008,
.model_id = "Intel Core 2 Duo P9xxx (Penryn Class Core 2)",
},
@@ -715,7 +735,7 @@ index 6d85149e6e..9c756a05f2 100644
.level = 11,
.vendor = CPUID_VENDOR_INTEL,
.family = 6,
-@@ -3758,6 +3767,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
+@@ -4008,6 +4017,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
},
{
.name = "Westmere",
@@ -723,7 +743,7 @@ index 6d85149e6e..9c756a05f2 100644
.level = 11,
.vendor = CPUID_VENDOR_INTEL,
.family = 6,
-@@ -3839,6 +3849,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
+@@ -4089,6 +4099,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
},
{
.name = "SandyBridge",
@@ -731,7 +751,7 @@ index 6d85149e6e..9c756a05f2 100644
.level = 0xd,
.vendor = CPUID_VENDOR_INTEL,
.family = 6,
-@@ -3925,6 +3936,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
+@@ -4175,6 +4186,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
},
{
.name = "IvyBridge",
@@ -739,7 +759,7 @@ index 6d85149e6e..9c756a05f2 100644
.level = 0xd,
.vendor = CPUID_VENDOR_INTEL,
.family = 6,
-@@ -5551,6 +5563,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
+@@ -6179,6 +6191,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
},
{
.name = "Denverton",
@@ -747,7 +767,7 @@ index 6d85149e6e..9c756a05f2 100644
.level = 21,
.vendor = CPUID_VENDOR_INTEL,
.family = 6,
-@@ -5661,6 +5674,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
+@@ -6289,6 +6302,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
},
{
.name = "Snowridge",
@@ -755,7 +775,7 @@ index 6d85149e6e..9c756a05f2 100644
.level = 27,
.vendor = CPUID_VENDOR_INTEL,
.family = 6,
-@@ -5842,6 +5856,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
+@@ -6470,6 +6484,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
.xlevel = 0x80000008,
.model_id = "Intel Xeon Phi Processor (Knights Mill)",
},
@@ -763,7 +783,7 @@ index 6d85149e6e..9c756a05f2 100644
{
.name = "Opteron_G1",
.level = 5,
-@@ -5909,8 +5924,10 @@ static const X86CPUDefinition builtin_x86_defs[] = {
+@@ -6537,8 +6552,10 @@ static const X86CPUDefinition builtin_x86_defs[] = {
.xlevel = 0x80000008,
.model_id = "AMD Opteron 23xx (Gen 3 Class Opteron)",
},
@@ -774,7 +794,7 @@ index 6d85149e6e..9c756a05f2 100644
.level = 0xd,
.vendor = CPUID_VENDOR_AMD,
.family = 21,
-@@ -5943,6 +5960,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
+@@ -6571,6 +6588,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
},
{
.name = "Opteron_G5",
@@ -782,7 +802,7 @@ index 6d85149e6e..9c756a05f2 100644
.level = 0xd,
.vendor = CPUID_VENDOR_AMD,
.family = 21,
-@@ -6420,6 +6438,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
+@@ -7068,6 +7086,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
{ /* end of list */ }
}
},
@@ -790,7 +810,7 @@ index 6d85149e6e..9c756a05f2 100644
{
.name = "YongFeng",
.level = 0x1F,
-@@ -6565,6 +6584,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
+@@ -7213,6 +7232,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
{ /* end of list */ }
}
},
@@ -798,11 +818,23 @@ index 6d85149e6e..9c756a05f2 100644
{
.name = "EPYC-Turin",
.level = 0xd,
+diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
+index 8294dbde3a..7322fc4113 100644
+--- a/target/i386/kvm/tdx.c
++++ b/target/i386/kvm/tdx.c
+@@ -817,6 +817,7 @@ static void tdx_cpu_instance_init(X86ConfidentialGuest *cg, CPUState *cpu)
+ }
+
+ object_property_set_bool(OBJECT(cpu), "pmu", false, &error_abort);
++ object_property_set_int(OBJECT(cpu), "host-phys-bits-limit", 0, &error_abort);
+
+ /* invtsc is fixed1 for TD guest */
+ object_property_set_bool(OBJECT(cpu), "invtsc", true, &error_abort);
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
-index d055ddf462..bca50a39be 100644
+index 5a82e6563b..1edd14f1c5 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
-@@ -2035,6 +2035,7 @@ static const PropertyInfo prop_marchid = {
+@@ -2217,6 +2217,7 @@ static const PropertyInfo prop_marchid = {
.set = prop_marchid_set,
};
@@ -810,7 +842,7 @@ index d055ddf462..bca50a39be 100644
/*
* RVA22U64 defines some 'named features' that are cache
* related: Za64rs, Zic64b, Ziccif, Ziccrse, Ziccamoa
-@@ -2143,12 +2144,15 @@ static RISCVCPUProfile RVA23S64 = {
+@@ -2325,12 +2326,15 @@ static RISCVCPUProfile RVA23S64 = {
RISCV_PROFILE_EXT_LIST_END
}
};
@@ -826,7 +858,7 @@ index d055ddf462..bca50a39be 100644
NULL,
};
-@@ -2993,6 +2997,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {
+@@ -3258,6 +3262,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {
.cfg.pmp_regions = 8
),
@@ -834,7 +866,7 @@ index d055ddf462..bca50a39be 100644
#if defined(TARGET_RISCV32) || \
(defined(TARGET_RISCV64) && !defined(CONFIG_USER_ONLY))
DEFINE_RISCV_CPU(TYPE_RISCV_CPU_BASE32, TYPE_RISCV_DYNAMIC_CPU,
-@@ -3287,6 +3292,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {
+@@ -3669,6 +3674,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {
DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA23U64, TYPE_RISCV_CPU_RV64I, RVA23U64),
DEFINE_PROFILE_CPU(TYPE_RISCV_CPU_RVA23S64, TYPE_RISCV_CPU_RV64I, RVA23S64),
#endif /* TARGET_RISCV64 */
@@ -843,7 +875,7 @@ index d055ddf462..bca50a39be 100644
DEFINE_TYPES(riscv_cpu_type_infos)
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
-index 954a7a99a9..fe29f5c5b7 100644
+index 2dd9aac807..6046b0e9a3 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -72,7 +72,6 @@ static S390CPUDef s390_cpu_defs[] = {
@@ -863,7 +895,7 @@ index 954a7a99a9..fe29f5c5b7 100644
CPUDEF_INIT(0x2827, 12, 2, 44, 0x08000000U, "zEC12.2", "IBM zEnterprise EC12 GA2"),
CPUDEF_INIT(0x2828, 12, 2, 44, 0x08000000U, "zBC12", "IBM zEnterprise BC12 GA1"),
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
-index eb8ddebffb..2d3304bb4a 100644
+index cb4d01fd46..4440065018 100644
--- a/tests/qtest/arm-cpu-features.c
+++ b/tests/qtest/arm-cpu-features.c
@@ -459,8 +459,10 @@ static void test_query_cpu_model_expansion(const void *data)
@@ -894,5 +926,5 @@ index eb8ddebffb..2d3304bb4a 100644
sve_tests_default(qts, "max");
pauth_tests_default(qts, "max");
--
-2.39.3
+2.55.0
diff --git a/0006-Machine-type-related-general-changes.patch b/0006-Machine-type-related-general-changes.patch
index 310fcfc..d21db73 100644
--- a/0006-Machine-type-related-general-changes.patch
+++ b/0006-Machine-type-related-general-changes.patch
@@ -1,4 +1,4 @@
-From dcaeeab5909a41372c9445e9f97282e8dd3d1d44 Mon Sep 17 00:00:00 2001
+From 08e555ba3f6656c9aaa82e8a8dea1f3c98cc24ec Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Fri, 11 Jan 2019 09:54:45 +0100
Subject: Machine type related general changes
@@ -34,10 +34,14 @@ Merged commits (10.0.0 rc0):
- 03502faf70 Add upstream compatibility bits (partial)
- f53dbf7532 remove stale compat definitions (partial)
- d93fcb3940 virtio-net: disable USO for all RHEL9 (partial)
+
+Merged commits (11.0.0 rc0):
+- 562a258382 scsi: save/load SCSI reservation state (downstream chunk
+ only)
---
hw/acpi/piix4.c | 2 +-
hw/arm/virt.c | 2 +-
- hw/core/machine.c | 145 +++++++++++++++++++++++++++++++++++
+ hw/core/machine.c | 146 +++++++++++++++++++++++++++++++++++
hw/i386/fw_cfg.c | 3 +-
hw/net/rtl8139.c | 4 +-
hw/riscv/virt.c | 4 +-
@@ -45,16 +49,16 @@ Merged commits (10.0.0 rc0):
hw/usb/hcd-xhci-pci.c | 54 +++++++++----
hw/usb/hcd-xhci-pci.h | 1 +
hw/virtio/virtio-mem.c | 3 +-
- include/hw/boards.h | 31 ++++++++
+ include/hw/core/boards.h | 31 ++++++++
include/hw/firmware/smbios.h | 4 +-
include/hw/i386/pc.h | 3 +
- 13 files changed, 277 insertions(+), 25 deletions(-)
+ 13 files changed, 278 insertions(+), 25 deletions(-)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
-index 7a18f18dda..2b3678b8c6 100644
+index 9b7f50c7af..10ab95d729 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
-@@ -245,7 +245,7 @@ static bool vmstate_test_migrate_acpi_index(void *opaque, int version_id)
+@@ -233,7 +233,7 @@ static bool vmstate_test_migrate_acpi_index(void *opaque, int version_id)
static const VMStateDescription vmstate_acpi = {
.name = "piix4_pm",
.version_id = 3,
@@ -64,10 +68,10 @@ index 7a18f18dda..2b3678b8c6 100644
.fields = (const VMStateField[]) {
VMSTATE_PCI_DEVICE(parent_obj, PIIX4PMState),
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index b525e00365..1800981317 100644
+index ea5317cc6f..5b9f1cbaef 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
-@@ -1755,7 +1755,7 @@ static void virt_build_smbios(VirtMachineState *vms)
+@@ -2370,7 +2370,7 @@ static void virt_build_smbios(VirtMachineState *vms)
product = "KVM Virtual Machine";
}
@@ -77,12 +81,12 @@ index b525e00365..1800981317 100644
/* build the array of physical mem area from base_memmap */
mem_array.address = vms->memmap[VIRT_MEM].base;
diff --git a/hw/core/machine.c b/hw/core/machine.c
-index bd47527479..2a1a42cebc 100644
+index 73b4d82b4a..fb5cd5ff96 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
-@@ -288,6 +288,151 @@ GlobalProperty hw_compat_2_6[] = {
+@@ -227,6 +227,152 @@ GlobalProperty hw_compat_4_1[] = {
};
- const size_t hw_compat_2_6_len = G_N_ELEMENTS(hw_compat_2_6);
+ const size_t hw_compat_4_1_len = G_N_ELEMENTS(hw_compat_4_1);
+/*
+ * RHEL only: machine types for previous major releases are deprecated
@@ -91,6 +95,7 @@ index bd47527479..2a1a42cebc 100644
+ "machine types for previous major releases are deprecated";
+
+GlobalProperty hw_compat_rhel_10_2[] = {
++ { "scsi-block", "migrate-pr", "off" },
+ /* hw_compat_rhel_10_2 from hw_compat_10_0 */
+ { "scsi-hd", "dpofua", "off" },
+ /* hw_compat_rhel_10_2 from hw_compat_10_0 */
@@ -233,7 +238,7 @@ index bd47527479..2a1a42cebc 100644
static char *machine_get_kernel(Object *obj, Error **errp)
diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c
-index 5c0bcd5f8a..07df7281d2 100644
+index d422302c1c..63c95b6e55 100644
--- a/hw/i386/fw_cfg.c
+++ b/hw/i386/fw_cfg.c
@@ -75,7 +75,8 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg,
@@ -247,10 +252,10 @@ index 5c0bcd5f8a..07df7281d2 100644
/* tell smbios about cpuid version and features */
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
-index f4dd693abb..ac3a7376ad 100644
+index 7d4f7ed173..2435612d29 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
-@@ -3173,7 +3173,7 @@ static int rtl8139_pre_save(void *opaque)
+@@ -3188,7 +3188,7 @@ static int rtl8139_pre_save(void *opaque)
static const VMStateDescription vmstate_rtl8139 = {
.name = "rtl8139",
@@ -259,7 +264,7 @@ index f4dd693abb..ac3a7376ad 100644
.minimum_version_id = 3,
.post_load = rtl8139_post_load,
.pre_save = rtl8139_pre_save,
-@@ -3254,7 +3254,9 @@ static const VMStateDescription vmstate_rtl8139 = {
+@@ -3269,7 +3269,9 @@ static const VMStateDescription vmstate_rtl8139 = {
VMSTATE_UINT32(tally_counters.TxMCol, RTL8139State),
VMSTATE_UINT64(tally_counters.RxOkPhy, RTL8139State),
VMSTATE_UINT64(tally_counters.RxOkBrd, RTL8139State),
@@ -270,10 +275,10 @@ index f4dd693abb..ac3a7376ad 100644
VMSTATE_UINT16(tally_counters.TxUndrn, RTL8139State),
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
-index 47e573f85a..ab5a9ec613 100644
+index 51bac47a91..0f944cbd04 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
-@@ -1402,7 +1402,7 @@ static void virt_build_smbios(RISCVVirtState *s)
+@@ -1173,7 +1173,7 @@ static void virt_build_smbios(RISCVVirtState *s)
product = "KVM Virtual Machine";
}
@@ -282,7 +287,7 @@ index 47e573f85a..ab5a9ec613 100644
if (riscv_is_32bit(&s->soc[0])) {
smbios_set_default_processor_family(0x200);
-@@ -1920,7 +1920,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
+@@ -1722,7 +1722,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
mc->desc = "RISC-V VirtIO board";
mc->init = virt_machine_init;
mc->max_cpus = VIRT_CPUS_MAX;
@@ -292,7 +297,7 @@ index 47e573f85a..ab5a9ec613 100644
mc->no_cdrom = 1;
mc->pci_allow_0_address = true;
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
-index 1ac063cfb4..03f7a00ed1 100644
+index 7d7141851b..7fd51f88bf 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -39,6 +39,10 @@ size_t usr_blobs_len;
@@ -306,7 +311,7 @@ index 1ac063cfb4..03f7a00ed1 100644
uint8_t *smbios_tables;
size_t smbios_tables_len;
unsigned smbios_table_max;
-@@ -627,7 +631,7 @@ static void smbios_build_type_1_table(void)
+@@ -635,7 +639,7 @@ static void smbios_build_type_1_table(void)
static void smbios_build_type_2_table(void)
{
@@ -315,7 +320,7 @@ index 1ac063cfb4..03f7a00ed1 100644
SMBIOS_TABLE_SET_STR(2, manufacturer_str, type2.manufacturer);
SMBIOS_TABLE_SET_STR(2, product_str, type2.product);
-@@ -1015,15 +1019,51 @@ void smbios_set_default_processor_family(uint16_t processor_family)
+@@ -1023,15 +1027,51 @@ void smbios_set_default_processor_family(uint16_t processor_family)
}
void smbios_set_defaults(const char *manufacturer, const char *product,
@@ -370,7 +375,7 @@ index 1ac063cfb4..03f7a00ed1 100644
SMBIOS_SET_DEFAULT(type3.manufacturer, manufacturer);
SMBIOS_SET_DEFAULT(type3.version, version);
diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c
-index b93c80b09d..f4a2f1a1de 100644
+index b124251ae3..3994642b01 100644
--- a/hw/usb/hcd-xhci-pci.c
+++ b/hw/usb/hcd-xhci-pci.c
@@ -120,6 +120,33 @@ static int xhci_pci_vmstate_post_load(void *opaque, int version_id)
@@ -447,9 +452,9 @@ index b93c80b09d..f4a2f1a1de 100644
+ }
+ }
if (s->msix != ON_OFF_AUTO_OFF) {
- /* TODO check for errors, and should fail when msix=on */
- msix_init(dev, s->xhci.numintrs,
-@@ -221,6 +245,8 @@ static const Property xhci_pci_properties[] = {
+ ret = msix_init(dev, s->xhci.numintrs,
+ &s->xhci.mem, 0, OFF_MSIX_TABLE,
+@@ -239,6 +263,8 @@ static const Property xhci_pci_properties[] = {
DEFINE_PROP_ON_OFF_AUTO("msix", XHCIPciState, msix, ON_OFF_AUTO_AUTO),
DEFINE_PROP_BOOL("conditional-intr-mapping", XHCIPciState,
conditional_intr_mapping, false),
@@ -459,7 +464,7 @@ index b93c80b09d..f4a2f1a1de 100644
static void xhci_class_init(ObjectClass *klass, const void *data)
diff --git a/hw/usb/hcd-xhci-pci.h b/hw/usb/hcd-xhci-pci.h
-index 5b61ae8455..3170db064b 100644
+index c9359f1bd9..639f33170b 100644
--- a/hw/usb/hcd-xhci-pci.h
+++ b/hw/usb/hcd-xhci-pci.h
@@ -41,6 +41,7 @@ typedef struct XHCIPciState {
@@ -471,11 +476,11 @@ index 5b61ae8455..3170db064b 100644
#endif
diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
-index c46f6f9c3e..1805597879 100644
+index 35e03ed759..7f5ab845e2 100644
--- a/hw/virtio/virtio-mem.c
+++ b/hw/virtio/virtio-mem.c
-@@ -1699,8 +1699,9 @@ static const Property virtio_mem_properties[] = {
- #endif
+@@ -1566,8 +1566,9 @@ static const Property virtio_mem_properties[] = {
+ TYPE_MEMORY_BACKEND, HostMemoryBackend *),
DEFINE_PROP_BOOL(VIRTIO_MEM_EARLY_MIGRATION_PROP, VirtIOMEM,
early_migration, true),
+ /* RHEL: default-enable "dynamic-memslots" (jira RHEL-24045) */
@@ -484,14 +489,14 @@ index c46f6f9c3e..1805597879 100644
+ dynamic_memslots, true),
};
- static uint64_t virtio_mem_rdm_get_min_granularity(const RamDiscardManager *rdm,
-diff --git a/include/hw/boards.h b/include/hw/boards.h
-index f94713e6e2..a434b21909 100644
---- a/include/hw/boards.h
-+++ b/include/hw/boards.h
-@@ -863,4 +863,35 @@ extern const size_t hw_compat_2_7_len;
- extern GlobalProperty hw_compat_2_6[];
- extern const size_t hw_compat_2_6_len;
+ static const Property virtio_mem_legacy_guests_properties[] = {
+diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h
+index 29c68931d8..855dc60f83 100644
+--- a/include/hw/core/boards.h
++++ b/include/hw/core/boards.h
+@@ -878,4 +878,35 @@ extern const size_t hw_compat_4_2_len;
+ extern GlobalProperty hw_compat_4_1[];
+ extern const size_t hw_compat_4_1_len;
+extern GlobalProperty hw_compat_rhel_10_2[];
+extern const size_t hw_compat_rhel_10_2_len;
@@ -526,7 +531,7 @@ index f94713e6e2..a434b21909 100644
+extern const char *rhel_old_machine_deprecation;
#endif
diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
-index f066ab7262..e805d25fbe 100644
+index 3ea732f4e6..6dc40c8578 100644
--- a/include/hw/firmware/smbios.h
+++ b/include/hw/firmware/smbios.h
@@ -331,7 +331,9 @@ void smbios_add_usr_blob_size(size_t size);
@@ -541,10 +546,10 @@ index f066ab7262..e805d25fbe 100644
uint8_t *smbios_get_table_legacy(size_t *length, Error **errp);
void smbios_get_tables(MachineState *ms,
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
-index 79b72c54dd..3b4ea24c20 100644
+index d4b6d3ed57..b6aa65f32e 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
-@@ -103,6 +103,9 @@ struct PCMachineClass {
+@@ -104,6 +104,9 @@ struct PCMachineClass {
bool smbios_defaults;
bool smbios_legacy_mode;
SmbiosEntryPointType default_smbios_ep_type;
@@ -555,5 +560,5 @@ index 79b72c54dd..3b4ea24c20 100644
/* RAM / address space compat: */
bool gigabyte_align;
--
-2.39.3
+2.55.0
diff --git a/0007-meson-temporarily-disable-Wunused-function.patch b/0007-meson-temporarily-disable-Wunused-function.patch
index c0313b5..178431b 100644
--- a/0007-meson-temporarily-disable-Wunused-function.patch
+++ b/0007-meson-temporarily-disable-Wunused-function.patch
@@ -1,4 +1,4 @@
-From 7eff7b32584a50d73053b4e3e007621b14ebf766 Mon Sep 17 00:00:00 2001
+From 900eb20e23ef790bd22bde0618ef1bb57a3fe7a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Wed, 3 Jul 2024 13:32:32 +0100
Subject: meson: temporarily disable -Wunused-function
@@ -20,10 +20,10 @@ Rebase notes (9.1.0)
1 file changed, 1 insertion(+)
diff --git a/meson.build b/meson.build
-index 50c774a195..0e0120a613 100644
+index 49a5baf5b5..e481abca6f 100644
--- a/meson.build
+++ b/meson.build
-@@ -757,6 +757,7 @@ warn_flags = [
+@@ -740,6 +740,7 @@ warn_flags = [
'-Wno-string-plus-int',
'-Wno-tautological-type-limit-compare',
'-Wno-typedef-redefinition',
@@ -32,5 +32,5 @@ index 50c774a195..0e0120a613 100644
if host_os != 'darwin'
--
-2.39.3
+2.55.0
diff --git a/0008-Remove-upstream-machine-types-for-aarch64-s390x-and-.patch b/0008-Remove-upstream-machine-types-for-aarch64-s390x-and-.patch
index 86d7669..766404d 100644
--- a/0008-Remove-upstream-machine-types-for-aarch64-s390x-and-.patch
+++ b/0008-Remove-upstream-machine-types-for-aarch64-s390x-and-.patch
@@ -1,4 +1,4 @@
-From fca16c8b4612edfa63d7882379897a9907dde738 Mon Sep 17 00:00:00 2001
+From da5c0a99153f7d02205d64e570730fbfa8c716e4 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Wed, 10 Jul 2024 02:25:51 -0400
Subject: Remove upstream machine types for aarch64, s390x and x86_64
@@ -23,27 +23,27 @@ Rebase notes (9.1.0):
4 files changed, 9 insertions(+)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index 1800981317..e6e98fef1c 100644
+index 5b9f1cbaef..81537a293f 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
-@@ -3459,6 +3459,7 @@ static void machvirt_machine_init(void)
+@@ -4445,6 +4445,7 @@ static void machvirt_machine_init(void)
}
type_init(machvirt_machine_init);
+#if 0 /* Disabled for Red Hat Enterprise Linux */
- static void virt_machine_10_1_options(MachineClass *mc)
+ static void virt_machine_11_1_options(MachineClass *mc)
{
}
-@@ -3634,3 +3635,4 @@ static void virt_machine_4_1_options(MachineClass *mc)
- mc->auto_enable_numa_with_memhp = false;
+@@ -4624,3 +4625,4 @@ static void virt_machine_5_0_options(MachineClass *mc)
+ mc->auto_enable_numa_with_memdev = false;
}
- DEFINE_VIRT_MACHINE(4, 1)
+ DEFINE_VIRT_MACHINE(5, 0)
+#endif /* disabled for RHEL */
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
-index c03324281b..acf010e20f 100644
+index 82457bdb16..d987d8bbff 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
-@@ -475,6 +475,7 @@ static void pc_i440fx_init(MachineState *machine)
+@@ -399,6 +399,7 @@ static void pc_i440fx_init(MachineState *machine)
#define DEFINE_I440FX_MACHINE_AS_LATEST(major, minor) \
DEFINE_PC_VER_MACHINE(pc_i440fx, "pc-i440fx", pc_i440fx_init, true, "pc", major, minor);
@@ -51,46 +51,46 @@ index c03324281b..acf010e20f 100644
static void pc_i440fx_machine_options(MachineClass *m)
{
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
-@@ -802,6 +803,7 @@ static void pc_i440fx_machine_2_6_options(MachineClass *m)
+@@ -652,6 +653,7 @@ static void pc_i440fx_machine_4_1_options(MachineClass *m)
}
- DEFINE_I440FX_MACHINE(2, 6);
+ DEFINE_I440FX_MACHINE(4, 1);
+#endif /* Disabled for Red Hat Enterprise Linux */
- #ifdef CONFIG_ISAPC
- static void isapc_machine_options(MachineClass *m)
+ #ifdef CONFIG_XEN
+ static void xenfv_machine_4_2_options(MachineClass *m)
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
-index b309b2b378..2203ffd67e 100644
+index 6c1e4eff5f..406af9ac21 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
-@@ -374,6 +374,7 @@ static void pc_q35_machine_options(MachineClass *m)
+@@ -383,6 +383,7 @@ static void pc_q35_machine_options(MachineClass *m)
pc_q35_compat_defaults, pc_q35_compat_defaults_len);
}
+#if 0 /* Disabled for Red Hat Enterprise Linux */
- static void pc_q35_machine_10_1_options(MachineClass *m)
+ static void pc_q35_machine_11_1_options(MachineClass *m)
{
pc_q35_machine_options(m);
-@@ -685,3 +686,4 @@ static void pc_q35_machine_2_6_options(MachineClass *m)
+@@ -603,3 +604,4 @@ static void pc_q35_machine_4_1_options(MachineClass *m)
}
- DEFINE_Q35_MACHINE(2, 6);
+ DEFINE_Q35_MACHINE(4, 1);
+#endif /* Disabled for Red Hat Enterprise Linux */
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
-index a79bd13275..2fca2bcf4d 100644
+index 25a9fa4955..6cde5b19db 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
-@@ -911,6 +911,7 @@ static const TypeInfo ccw_machine_info = {
+@@ -925,6 +925,7 @@ static const TypeInfo ccw_machine_info = {
DEFINE_CCW_MACHINE_IMPL(false, major, minor)
+#if 0 /* Disabled for Red Hat Enterprise Linux */
- static void ccw_machine_10_1_instance_options(MachineState *machine)
+ static void ccw_machine_11_1_instance_options(MachineState *machine)
{
}
-@@ -1167,6 +1168,8 @@ static void ccw_machine_4_2_class_options(MachineClass *mc)
+@@ -1200,6 +1201,8 @@ static void ccw_machine_5_1_class_options(MachineClass *mc)
}
- DEFINE_CCW_MACHINE(4, 2);
+ DEFINE_CCW_MACHINE(5, 1);
+#endif /* disabled for RHEL */
+
@@ -98,5 +98,5 @@ index a79bd13275..2fca2bcf4d 100644
{
type_register_static(&ccw_machine_info);
--
-2.39.3
+2.55.0
diff --git a/0009-Adapt-versioned-machine-type-macros-for-RHEL.patch b/0009-Adapt-versioned-machine-type-macros-for-RHEL.patch
index f0ccb30..c9c02fa 100644
--- a/0009-Adapt-versioned-machine-type-macros-for-RHEL.patch
+++ b/0009-Adapt-versioned-machine-type-macros-for-RHEL.patch
@@ -1,6 +1,6 @@
-From 0bc1a45f789d1aa6b75496739a77dbc77fc2492c Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 3 Jul 2024 15:27:03 +0100
+From a6a5dc15350b704a0e9b71a24f18a9135caf05b5 Mon Sep 17 00:00:00 2001
+From: Miroslav Rezanina <mrezanin@redhat.com>
+Date: Thu, 3 Sep 2026 09:17:09 +0200
Subject: Adapt versioned machine type macros for RHEL
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
@@ -28,19 +28,19 @@ Rebase changes (10.1.0 rc0):
.distro/qemu-kvm.spec.template | 1 +
.distro/scripts/process-patches.sh | 3 +++
docs/conf.py | 4 +--
- include/hw/boards.h | 39 ++++++++++++------------------
+ include/hw/core/boards.h | 39 ++++++++++++------------------
meson.build | 1 +
meson_options.txt | 2 ++
scripts/meson-buildoptions.sh | 2 ++
9 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/docs/conf.py b/docs/conf.py
-index f892a6e1da..0b8861e4bf 100644
+index 7e35d2158d..f03da50d67 100644
--- a/docs/conf.py
+++ b/docs/conf.py
-@@ -140,8 +140,8 @@
+@@ -138,8 +138,8 @@
# MACHINE_VER_DELETION_MAJOR & MACHINE_VER_DEPRECATION_MAJOR
- # defined in include/hw/boards.h and the introductory text in
+ # defined in include/hw/core/boards.h and the introductory text in
# docs/about/deprecated.rst
-ver_machine_deprecation_version = "%d.%d.0" % (major - 3, minor)
-ver_machine_deletion_version = "%d.%d.0" % (major - 6, minor)
@@ -49,11 +49,11 @@ index f892a6e1da..0b8861e4bf 100644
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
-diff --git a/include/hw/boards.h b/include/hw/boards.h
-index a434b21909..da2fc92ce8 100644
---- a/include/hw/boards.h
-+++ b/include/hw/boards.h
-@@ -577,16 +577,16 @@ struct MachineState {
+diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h
+index 855dc60f83..e0bdbcb241 100644
+--- a/include/hw/core/boards.h
++++ b/include/hw/core/boards.h
+@@ -620,16 +620,16 @@ struct MachineState {
* "{prefix}-{major}.{minor}.{micro}-{tag}"
*/
#define _MACHINE_VER_TYPE_NAME2(prefix, major, minor) \
@@ -74,7 +74,7 @@ index a434b21909..da2fc92ce8 100644
#define MACHINE_VER_TYPE_NAME(prefix, ...) \
_MACHINE_VER_PICK(__VA_ARGS__, \
-@@ -614,16 +614,16 @@ struct MachineState {
+@@ -657,16 +657,16 @@ struct MachineState {
* {prefix}_machine_{major}_{minor}_{micro}_{tag}_{sym}
*/
#define _MACHINE_VER_SYM2(sym, prefix, major, minor) \
@@ -95,7 +95,7 @@ index a434b21909..da2fc92ce8 100644
#define MACHINE_VER_SYM(sym, prefix, ...) \
_MACHINE_VER_PICK(__VA_ARGS__, \
-@@ -642,17 +642,16 @@ struct MachineState {
+@@ -685,17 +685,16 @@ struct MachineState {
* and ver_machine_deletion_version logic in docs/conf.py and
* the text in docs/about/deprecated.rst
*/
@@ -117,7 +117,7 @@ index a434b21909..da2fc92ce8 100644
#define _MACHINE_VER_IS_CURRENT_EXPIRED(cutoff, major, minor) \
(((QEMU_VERSION_MAJOR - major) > cutoff) || \
-@@ -683,12 +682,7 @@ struct MachineState {
+@@ -726,12 +725,7 @@ struct MachineState {
* If this ever changes the logic below will need modifying....
*/
#define _MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor) \
@@ -131,7 +131,7 @@ index a434b21909..da2fc92ce8 100644
#define _MACHINE_VER_IS_EXPIRED2(cutoff, major, minor) \
_MACHINE_VER_IS_EXPIRED_IMPL(cutoff, major, minor)
-@@ -750,10 +744,9 @@ struct MachineState {
+@@ -793,10 +787,9 @@ struct MachineState {
* This must be unconditionally used in the register
* method for all machine types which support versioning.
*
@@ -146,10 +146,10 @@ index a434b21909..da2fc92ce8 100644
#define MACHINE_VER_DELETION(...) \
do { \
diff --git a/meson.build b/meson.build
-index 0e0120a613..23494666d9 100644
+index e481abca6f..818bb0d874 100644
--- a/meson.build
+++ b/meson.build
-@@ -2636,6 +2636,7 @@ config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
+@@ -2565,6 +2565,7 @@ config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
@@ -158,7 +158,7 @@ index 0e0120a613..23494666d9 100644
config_host_data.set_quoted('CONFIG_HOST_DSOSUF', host_dsosuf)
config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device)
diff --git a/meson_options.txt b/meson_options.txt
-index fff1521e58..f45d7ded45 100644
+index a07cb47d35..7ec9f5eac3 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,6 +2,8 @@
@@ -171,7 +171,7 @@ index fff1521e58..f45d7ded45 100644
description: 'Suffix for QEMU data/modules/config directories (can be empty)')
option('docdir', type : 'string', value : 'share/doc',
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
-index 0ebe6bc52a..4146dbc88d 100644
+index c003985047..b57eec976a 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -75,6 +75,7 @@ meson_options_help() {
@@ -182,7 +182,7 @@ index 0ebe6bc52a..4146dbc88d 100644
printf "%s\n" ' --smbd=VALUE Path to smbd for slirp networking'
printf "%s\n" ' --sysconfdir=VALUE Sysconf data directory [etc]'
printf "%s\n" ' --tls-priority=VALUE Default TLS protocol/cipher priority string'
-@@ -465,6 +466,7 @@ _meson_option_parse() {
+@@ -469,6 +470,7 @@ _meson_option_parse() {
--disable-relocatable) printf "%s" -Drelocatable=false ;;
--enable-replication) printf "%s" -Dreplication=enabled ;;
--disable-replication) printf "%s" -Dreplication=disabled ;;
@@ -191,5 +191,5 @@ index 0ebe6bc52a..4146dbc88d 100644
--disable-rng-none) printf "%s" -Drng_none=false ;;
--rtsig-map=*) quote_sh "-Drtsig_map=$2" ;;
--
-2.39.3
+2.55.0
diff --git a/0010-Increase-deletion-schedule-to-4-releases.patch b/0010-Increase-deletion-schedule-to-4-releases.patch
index 51b1741..b3580f9 100644
--- a/0010-Increase-deletion-schedule-to-4-releases.patch
+++ b/0010-Increase-deletion-schedule-to-4-releases.patch
@@ -1,6 +1,6 @@
-From 7c4955a929940701a7613fe3db516adbcc97576b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 3 Jul 2024 18:45:58 +0100
+From 1a40962674649dae8dbb648b58e806e443af3073 Mon Sep 17 00:00:00 2001
+From: Miroslav Rezanina <mrezanin@redhat.com>
+Date: Wed, 26 Nov 2025 08:52:46 +0100
Subject: Increase deletion schedule to 4 releases
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
@@ -16,14 +16,14 @@ Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Rebase notes (9.1.0)
- New patch
---
- include/hw/boards.h | 2 +-
+ include/hw/core/boards.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
-diff --git a/include/hw/boards.h b/include/hw/boards.h
-index da2fc92ce8..aca254ea18 100644
---- a/include/hw/boards.h
-+++ b/include/hw/boards.h
-@@ -642,7 +642,7 @@ struct MachineState {
+diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h
+index e0bdbcb241..04b37a8631 100644
+--- a/include/hw/core/boards.h
++++ b/include/hw/core/boards.h
+@@ -685,7 +685,7 @@ struct MachineState {
* and ver_machine_deletion_version logic in docs/conf.py and
* the text in docs/about/deprecated.rst
*/
@@ -33,5 +33,5 @@ index da2fc92ce8..aca254ea18 100644
/*
--
-2.39.3
+2.55.0
diff --git a/0011-Add-downstream-aarch64-versioned-virt-machine-types.patch b/0011-Add-downstream-aarch64-versioned-virt-machine-types.patch
index ce712b7..7911d42 100644
--- a/0011-Add-downstream-aarch64-versioned-virt-machine-types.patch
+++ b/0011-Add-downstream-aarch64-versioned-virt-machine-types.patch
@@ -1,4 +1,4 @@
-From 59b7559dfa658e325e8c1e23f13f48cf6952ac2e Mon Sep 17 00:00:00 2001
+From a14382d952cecc2348ed597fd41aaebe6ee05d42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Wed, 3 Jul 2024 13:25:47 +0100
Subject: Add downstream aarch64 versioned 'virt' machine types
@@ -23,6 +23,9 @@ Rebase notes (10.0.0)
Rebase notes (10.1.0):
- Use rebase compat
+Rebase notes (11.0.0 rc0):
+- Changed default vcpu setting for aarch64 (upstream)
+
Merged patches (9.1.0):
- 043ad5ce97 Add upstream compatibility bits (partial)
@@ -34,18 +37,25 @@ Merged patches (10.0.0 rc0):
- 727307e5ed hw/arm/virt: Fix Manufacturer and Product Name in emulated SMBIOS mode
- d93fcb3940 virtio-net: disable USO for all RHEL9 (partial)
- 0440f3d003 arm: disable pauth for virt-rhel9* in RHEL10
+
+Merged patches (11.0.0 rc0):
+- a75749cb93 arm: create new rhel 10.2 specific virt machine type
+- 5ac559365c arm: create new rhel 9.8 specific virt machine type
+- 58cba97a71 hw/arm/virt: Use ACPI PCI hotplug by default from 10.2 onwards
+- fa0a758781 arm: fix oob access in compat handling
+- 7f40802e8d Revert "hw/arm/virt: Use ACPI PCI hotplug by default from 10.2 onwards"
---
- hw/arm/virt.c | 154 +++++++++++++++++++++++++++++++++++++-----
+ hw/arm/virt.c | 156 ++++++++++++++++++++++++++++++++++++++----
include/hw/arm/virt.h | 1 +
- 2 files changed, 137 insertions(+), 18 deletions(-)
+ 2 files changed, 145 insertions(+), 12 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index e6e98fef1c..d37d1bb3cf 100644
+index 81537a293f..9939db7e6f 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
-@@ -97,6 +97,32 @@ static GlobalProperty arm_virt_compat[] = {
- };
- static const size_t arm_virt_compat_len = G_N_ELEMENTS(arm_virt_compat);
+@@ -103,6 +103,32 @@ static GlobalProperty arm_virt_compat_defaults[] = {
+ static const size_t arm_virt_compat_defaults_len =
+ G_N_ELEMENTS(arm_virt_compat_defaults);
+/*
+ * RHEL9 kernels have pauth disabled while RHEL10 has it enabled,
@@ -76,18 +86,18 @@ index e6e98fef1c..d37d1bb3cf 100644
/*
* This cannot be called from the virt_machine_class_init() because
* TYPE_VIRT_MACHINE is abstract and mc->compat_props g_ptr_array_new()
-@@ -106,6 +132,8 @@ static void arm_virt_compat_set(MachineClass *mc)
+@@ -112,6 +138,8 @@ static void arm_virt_compat_default_set(MachineClass *mc)
{
- compat_props_add(mc->compat_props, arm_virt_compat,
- arm_virt_compat_len);
+ compat_props_add(mc->compat_props, arm_virt_compat_defaults,
+ arm_virt_compat_defaults_len);
+ compat_props_add(mc->compat_props, arm_rhel_compat,
+ arm_rhel_compat_len);
}
#define DEFINE_VIRT_MACHINE_IMPL(latest, ...) \
-@@ -116,10 +144,11 @@ static void arm_virt_compat_set(MachineClass *mc)
+@@ -122,10 +150,11 @@ static void arm_virt_compat_default_set(MachineClass *mc)
MachineClass *mc = MACHINE_CLASS(oc); \
- arm_virt_compat_set(mc); \
+ arm_virt_compat_default_set(mc); \
MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \
- mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Machine"; \
+ mc->desc = "RHEL " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Machine"; \
@@ -98,7 +108,7 @@ index e6e98fef1c..d37d1bb3cf 100644
} \
} \
static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = \
-@@ -135,10 +164,10 @@ static void arm_virt_compat_set(MachineClass *mc)
+@@ -142,10 +171,10 @@ static void arm_virt_compat_default_set(MachineClass *mc)
} \
type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__));
@@ -113,7 +123,7 @@ index e6e98fef1c..d37d1bb3cf 100644
/* Number of external interrupt lines to configure the GIC with */
-@@ -1746,16 +1775,26 @@ static void virt_build_smbios(VirtMachineState *vms)
+@@ -2361,16 +2390,26 @@ static void virt_build_smbios(VirtMachineState *vms)
{
MachineClass *mc = MACHINE_GET_CLASS(vms);
MachineState *ms = MACHINE(vms);
@@ -141,7 +151,7 @@ index e6e98fef1c..d37d1bb3cf 100644
/* build the array of physical mem area from base_memmap */
mem_array.address = vms->memmap[VIRT_MEM].base;
-@@ -2517,6 +2556,7 @@ static void machvirt_init(MachineState *machine)
+@@ -3264,6 +3303,7 @@ static void machvirt_init(MachineState *machine)
qemu_add_machine_init_done_notifier(&vms->machine_done);
}
@@ -149,15 +159,15 @@ index e6e98fef1c..d37d1bb3cf 100644
static bool virt_get_secure(Object *obj, Error **errp)
{
VirtMachineState *vms = VIRT_MACHINE(obj);
-@@ -2544,6 +2584,7 @@ static void virt_set_virt(Object *obj, bool value, Error **errp)
-
- vms->virt = value;
+@@ -3296,6 +3336,7 @@ static void virt_set_virt(Object *obj, bool value, Error **errp)
+ */
+ hvf_nested_virt_enable(value);
}
+#endif /* disabled for RHEL */
static bool virt_get_highmem(Object *obj, Error **errp)
{
-@@ -2559,6 +2600,7 @@ static void virt_set_highmem(Object *obj, bool value, Error **errp)
+@@ -3311,6 +3352,7 @@ static void virt_set_highmem(Object *obj, bool value, Error **errp)
vms->highmem = value;
}
@@ -165,7 +175,7 @@ index e6e98fef1c..d37d1bb3cf 100644
static bool virt_get_compact_highmem(Object *obj, Error **errp)
{
VirtMachineState *vms = VIRT_MACHINE(obj);
-@@ -2572,6 +2614,7 @@ static void virt_set_compact_highmem(Object *obj, bool value, Error **errp)
+@@ -3324,6 +3366,7 @@ static void virt_set_compact_highmem(Object *obj, bool value, Error **errp)
vms->highmem_compact = value;
}
@@ -173,15 +183,15 @@ index e6e98fef1c..d37d1bb3cf 100644
static bool virt_get_highmem_redists(Object *obj, Error **errp)
{
-@@ -2664,6 +2707,7 @@ static void virt_set_its(Object *obj, bool value, Error **errp)
- vms->its = value;
+@@ -3504,6 +3547,7 @@ static void virt_set_virtio_transports(Object *obj, Visitor *v,
+ vms->virtio_transports = transports;
}
+#if 0 /* Disabled for Red Hat Enterprise Linux */
static bool virt_get_dtb_randomness(Object *obj, Error **errp)
{
VirtMachineState *vms = VIRT_MACHINE(obj);
-@@ -2677,6 +2721,7 @@ static void virt_set_dtb_randomness(Object *obj, bool value, Error **errp)
+@@ -3517,6 +3561,7 @@ static void virt_set_dtb_randomness(Object *obj, bool value, Error **errp)
vms->dtb_randomness = value;
}
@@ -189,7 +199,7 @@ index e6e98fef1c..d37d1bb3cf 100644
static char *virt_get_oem_id(Object *obj, Error **errp)
{
-@@ -2760,6 +2805,7 @@ static void virt_set_ras(Object *obj, bool value, Error **errp)
+@@ -3600,6 +3645,7 @@ static void virt_set_ras(Object *obj, bool value, Error **errp)
vms->ras = value;
}
@@ -197,7 +207,7 @@ index e6e98fef1c..d37d1bb3cf 100644
static bool virt_get_mte(Object *obj, Error **errp)
{
VirtMachineState *vms = VIRT_MACHINE(obj);
-@@ -2773,6 +2819,7 @@ static void virt_set_mte(Object *obj, bool value, Error **errp)
+@@ -3613,6 +3659,7 @@ static void virt_set_mte(Object *obj, bool value, Error **errp)
vms->mte = value;
}
@@ -205,9 +215,18 @@ index e6e98fef1c..d37d1bb3cf 100644
static char *virt_get_gic_version(Object *obj, Error **errp)
{
-@@ -3213,16 +3260,16 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
- NULL
- };
+@@ -4121,7 +4168,7 @@ static bool get_kernel_irqchip_default(const MachineState *ms)
+
+ static const char *virt_get_default_cpu_type(const MachineState *ms)
+ {
+- return tcg_enabled() ? ARM_CPU_TYPE_NAME("cortex-a15")
++ return tcg_enabled() ? ARM_CPU_TYPE_NAME("cortex-a57")
+ : ARM_CPU_TYPE_NAME("max");
+ }
+
+@@ -4165,12 +4212,10 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
+ MachineClass *mc = MACHINE_CLASS(oc);
+ HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
+ mc->family = "virt-rhel-Z";
mc->init = machvirt_init;
@@ -218,30 +237,10 @@ index e6e98fef1c..d37d1bb3cf 100644
- mc->max_cpus = 512;
+ /* Maximum supported VCPU count for all virt-rhel* machines */
+ mc->max_cpus = 384;
-+#if 0 /* Disabled for Red Hat Enterprise Linux */
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_CALXEDA_XGMAC);
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_AMD_XGBE);
-- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM);
-+#endif
-+ machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
+ machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
machine_class_allow_dynamic_sysbus_dev(mc, TYPE_UEFI_VARS_SYSBUS);
- #ifdef CONFIG_TPM
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
-@@ -3234,11 +3281,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
- mc->minimum_page_bits = 12;
- mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids;
- mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
--#ifdef CONFIG_TCG
-- mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
--#else
-- mc->default_cpu_type = ARM_CPU_TYPE_NAME("max");
--#endif
-+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a57");
- mc->valid_cpu_types = valid_cpu_types;
- mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
- mc->kvm_type = virt_kvm_type;
-@@ -3263,6 +3306,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
+ machine_class_allow_dynamic_sysbus_dev(mc, TYPE_ARM_SMMUV3);
+@@ -4217,6 +4262,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
NULL, NULL);
object_class_property_set_description(oc, "acpi",
"Enable ACPI");
@@ -249,7 +248,7 @@ index e6e98fef1c..d37d1bb3cf 100644
object_class_property_add_bool(oc, "secure", virt_get_secure,
virt_set_secure);
object_class_property_set_description(oc, "secure",
-@@ -3275,6 +3319,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
+@@ -4229,6 +4275,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
"Set on/off to enable/disable emulating a "
"guest CPU which implements the ARM "
"Virtualization Extensions");
@@ -257,7 +256,7 @@ index e6e98fef1c..d37d1bb3cf 100644
object_class_property_add_bool(oc, "highmem", virt_get_highmem,
virt_set_highmem);
-@@ -3282,12 +3327,14 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
+@@ -4236,12 +4283,14 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
"Set on/off to enable/disable using "
"physical address space above 32 bits");
@@ -272,16 +271,7 @@ index e6e98fef1c..d37d1bb3cf 100644
object_class_property_add_bool(oc, "highmem-redists",
virt_get_highmem_redists,
-@@ -3323,7 +3370,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
- virt_set_gic_version);
- object_class_property_set_description(oc, "gic-version",
- "Set GIC version. "
-- "Valid values are 2, 3, 4, host and max");
-+ "Valid values are 2, 3, host and max");
-
- object_class_property_add_str(oc, "iommu", virt_get_iommu, virt_set_iommu);
- object_class_property_set_description(oc, "iommu",
-@@ -3343,11 +3390,13 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
+@@ -4304,11 +4353,13 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
"Set on/off to enable/disable reporting host memory errors "
"to a KVM guest using ACPI and guest external abort exceptions");
@@ -295,15 +285,15 @@ index e6e98fef1c..d37d1bb3cf 100644
object_class_property_add_bool(oc, "its", virt_get_its,
virt_set_its);
-@@ -3355,6 +3404,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
- "Set on/off to enable/disable "
- "ITS instantiation");
+@@ -4322,6 +4373,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
+ "Set MSI settings. "
+ "Valid values are auto, gicv2m, its and off");
+#if 0 /* disabled for RHEL */
object_class_property_add_bool(oc, "dtb-randomness",
virt_get_dtb_randomness,
virt_set_dtb_randomness);
-@@ -3367,6 +3417,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
+@@ -4334,6 +4386,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
virt_set_dtb_randomness);
object_class_property_set_description(oc, "dtb-kaslr-seed",
"Deprecated synonym of dtb-randomness");
@@ -311,30 +301,42 @@ index e6e98fef1c..d37d1bb3cf 100644
object_class_property_add_str(oc, "x-oem-id",
virt_get_oem_id,
-@@ -3636,3 +3687,70 @@ static void virt_machine_4_1_options(MachineClass *mc)
+@@ -4626,3 +4679,82 @@ static void virt_machine_5_0_options(MachineClass *mc)
}
- DEFINE_VIRT_MACHINE(4, 1)
+ DEFINE_VIRT_MACHINE(5, 0)
#endif /* disabled for RHEL */
+
++static void virt_rhel_machine_10_2_0_options(MachineClass *mc)
++{
++}
++DEFINE_VIRT_MACHINE_AS_LATEST(10, 2, 0)
++
+static void virt_rhel_machine_10_0_0_options(MachineClass *mc)
+{
+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
+
++ virt_rhel_machine_10_2_0_options(mc);
++
+ /* QEMU 9.1 and earlier have only a stage-1 SMMU, not a nested s1+2 one */
+ vmc->no_nested_smmu = true;
+ compat_props_add(mc->compat_props, hw_compat_rhel_10_2, hw_compat_rhel_10_2_len);
+ compat_props_add(mc->compat_props, hw_compat_rhel_10_1, hw_compat_rhel_10_1_len);
+}
-+DEFINE_VIRT_MACHINE_AS_LATEST(10, 0, 0)
++DEFINE_VIRT_MACHINE(10, 0, 0)
+
-+static void virt_rhel_machine_9_6_0_options(MachineClass *mc)
++static void virt_rhel_machine_9_8_0_options(MachineClass *mc)
+{
-+ virt_rhel_machine_10_0_0_options(mc);
-+
++ /* NB: remember to move these lines to the *latest* RHEL 9 machine */
+ compat_props_add(mc->compat_props, arm_rhel9_compat, arm_rhel9_compat_len);
-+ /* NB: remember to move this line to the *latest* RHEL 9 machine */
+ compat_props_add(mc->compat_props, hw_compat_rhel_9, hw_compat_rhel_9_len);
+}
++DEFINE_VIRT_MACHINE(9, 8, 0)
++
++static void virt_rhel_machine_9_6_0_options(MachineClass *mc)
++{
++ virt_rhel_machine_10_0_0_options(mc);
++ virt_rhel_machine_9_8_0_options(mc);
++}
+DEFINE_VIRT_MACHINE(9, 6, 0)
+
+static void virt_rhel_machine_9_4_0_options(MachineClass *mc)
@@ -383,17 +385,17 @@ index e6e98fef1c..d37d1bb3cf 100644
+}
+DEFINE_VIRT_MACHINE(9, 0, 0)
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
-index 365a28b082..94c79d6c6d 100644
+index 22e66d1a11..23b464fe04 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
-@@ -132,6 +132,7 @@ struct VirtMachineClass {
- bool no_tcg_lpa2;
- bool no_ns_el2_virt_timer_irq;
+@@ -157,6 +157,7 @@ struct VirtMachineClass {
bool no_nested_smmu;
+ /* HVF specific: support for kernel-irqchip=on introduced in QEMU 11.1 */
+ bool hvf_no_kernel_irqchip_default;
+ bool manufacturer_product_compat;
};
struct VirtMachineState {
--
-2.39.3
+2.55.0
diff --git a/0012-Add-downstream-s390x-versioned-s390-ccw-virtio-machi.patch b/0012-Add-downstream-s390x-versioned-s390-ccw-virtio-machi.patch
index 1f3a1b0..604b34d 100644
--- a/0012-Add-downstream-s390x-versioned-s390-ccw-virtio-machi.patch
+++ b/0012-Add-downstream-s390x-versioned-s390-ccw-virtio-machi.patch
@@ -1,4 +1,4 @@
-From 0976e78ca34a38fbc21c71c2f05e884c0264b62e Mon Sep 17 00:00:00 2001
+From e9be76fdec5c00ecd18ff297ffd17af758a6627f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Wed, 3 Jul 2024 13:44:36 +0100
Subject: Add downstream s390x versioned 's390-ccw-virtio' machine types
@@ -26,43 +26,30 @@ Merged patches (10.0.0 rc0):
- d27437e5ba redhat: Add QEMU 9.1 compat handling to the s390x machine types
- 926a9d0ca2 redhat: Add rhel9.6.0 and rhel10.0.0 machine types
- d93fcb3940 virtio-net: disable USO for all RHEL9 (partial)
+
+Merged patches (11.0.0 rc0):
+- 79a55b8fb1 redhat: Add new -rhel9.8.0 and -rhel10.2.0 machine types on s390x
---
- hw/s390x/s390-virtio-ccw.c | 106 +++++++++++++++++++++++++++++--
+ hw/s390x/s390-virtio-ccw.c | 104 +++++++++++++++++++++++++++++--
target/s390x/cpu_models.c | 11 ++++
target/s390x/cpu_models.h | 2 +
target/s390x/cpu_models_system.c | 2 +
- 4 files changed, 116 insertions(+), 5 deletions(-)
+ 4 files changed, 114 insertions(+), 5 deletions(-)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
-index 2fca2bcf4d..9be423858d 100644
+index 6cde5b19db..361d79c868 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
-@@ -716,6 +716,7 @@ static void s390_nmi(NMIState *n, int cpu_index, Error **errp)
- s390_cpu_restart(S390_CPU(cs));
- }
-
-+#if 0 /* Disabled for Red Hat Enterprise Linux */
- static ram_addr_t s390_fixup_ram_size(ram_addr_t sz)
- {
- /* same logic as in sclp.c */
-@@ -735,6 +736,7 @@ static ram_addr_t s390_fixup_ram_size(ram_addr_t sz)
- }
- return newsz;
- }
-+#endif /* disabled for RHEL */
-
- static inline bool machine_get_aes_key_wrap(Object *obj, Error **errp)
- {
-@@ -883,7 +885,7 @@ static const TypeInfo ccw_machine_info = {
- { \
- MachineClass *mc = MACHINE_CLASS(oc); \
+@@ -897,7 +897,7 @@ static const TypeInfo ccw_machine_info = {
+ compat_props_add(mc->compat_props, hw_compat_s390x, \
+ hw_compat_s390x_len); \
MACHINE_VER_SYM(class_options, ccw, __VA_ARGS__)(mc); \
- mc->desc = "Virtual s390x machine (version " MACHINE_VER_STR(__VA_ARGS__) ")"; \
+ mc->desc = "Virtual s390x machine (version rhel" MACHINE_VER_STR(__VA_ARGS__) ")"; \
mc->init = MACHINE_VER_SYM(mach_init, ccw, __VA_ARGS__); \
MACHINE_VER_DEPRECATION(__VA_ARGS__); \
if (latest) { \
-@@ -904,11 +906,11 @@ static const TypeInfo ccw_machine_info = {
+@@ -918,11 +918,11 @@ static const TypeInfo ccw_machine_info = {
} \
type_init(MACHINE_VER_SYM(register, ccw, __VA_ARGS__))
@@ -78,7 +65,7 @@ index 2fca2bcf4d..9be423858d 100644
#if 0 /* Disabled for Red Hat Enterprise Linux */
-@@ -1170,6 +1172,100 @@ DEFINE_CCW_MACHINE(4, 2);
+@@ -1203,6 +1203,100 @@ DEFINE_CCW_MACHINE(5, 1);
#endif /* disabled for RHEL */
@@ -180,7 +167,7 @@ index 2fca2bcf4d..9be423858d 100644
{
type_register_static(&ccw_machine_info);
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
-index fe29f5c5b7..2a7fc949a4 100644
+index 6046b0e9a3..975b00e4e4 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -47,6 +47,9 @@
@@ -193,7 +180,7 @@ index fe29f5c5b7..2a7fc949a4 100644
static S390CPUDef s390_cpu_defs[] = {
/*
* Linux requires at least z10 nowadays, and IBM only supports recent CPUs
-@@ -931,22 +934,30 @@ static void s390_host_cpu_model_class_init(ObjectClass *oc, const void *data)
+@@ -933,22 +936,30 @@ static void s390_host_cpu_model_class_init(ObjectClass *oc, const void *data)
static void s390_base_cpu_model_class_init(ObjectClass *oc, const void *data)
{
S390CPUClass *xcc = S390_CPU_CLASS(oc);
@@ -258,5 +245,5 @@ index 5b84604867..d715bdc870 100644
if (cpu_list_data->model) {
Object *obj;
--
-2.39.3
+2.55.0
diff --git a/0013-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch b/0013-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch
index 3e1945f..e95fd5f 100644
--- a/0013-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch
+++ b/0013-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch
@@ -1,4 +1,4 @@
-From f7424ca0a529f1f3a76a4044b535d1ecd7b5b114 Mon Sep 17 00:00:00 2001
+From 66491fdce58856357f5fe1c06585516174893374 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Wed, 3 Jul 2024 13:44:41 +0100
Subject: Add downstream x86_64 versioned 'pc' & 'q35' machine types
@@ -22,6 +22,9 @@ Rebase notes (10.0.0 rc0):
Rebase notes (10.1.0):
- Use rebase compat
+Rebase notes (11.1.0):
+- Do not use 9.8 compat call for 9.6 to prevent doubled call
+
Merged patches (9.1.0):
- 043ad5ce97 Add upstream compatibility bits (partial)
@@ -35,21 +38,30 @@ Merged patches (10.0.0 rc0):
- f53dbf7532 remove stale compat definitions (partial)
- 379e14ba88 pc: q35: Bump max_cpus to 4096 vcpus
- d93fcb3940 virtio-net: disable USO for all RHEL9 (partial)
+
+Merged patches (11.0.0 rc0):
+- 6bfa7c38 target/i386: add compatibility property for arch_capabilities
+- 9d76b452 target/i386: add compatibility property for pdcm feature
+- 298dd94492 x86: create new rhel 10.2 specific pc-q35 machine type
+- 77cd3055b0 x86: create new rhel 9.8 specific pc-q35 machine type
+- a04b03ae97 fix pc_rhel_10_2_compat_len
+- 552c6b5fb5 q35: increase default tseg size
---
hw/i386/fw_cfg.c | 2 +-
- hw/i386/pc.c | 70 ++++++++++++++++++++-
- hw/i386/pc_piix.c | 55 +++++++++++++++--
- hw/i386/pc_q35.c | 123 ++++++++++++++++++++++++++++++++++---
- include/hw/boards.h | 2 +
- include/hw/i386/pc.h | 21 +++++++
+ hw/i386/pc.c | 73 ++++++++++++++++++-
+ hw/i386/pc_piix.c | 55 +++++++++++++-
+ hw/i386/pc_q35.c | 146 ++++++++++++++++++++++++++++++++++---
+ hw/s390x/s390-virtio-ccw.c | 34 ++++++++-
+ include/hw/core/boards.h | 2 +
+ include/hw/i386/pc.h | 21 ++++++
target/i386/kvm/kvm-cpu.c | 1 +
- target/i386/kvm/kvm.c | 4 ++
- tests/qtest/meson.build | 2 +-
+ target/i386/kvm/kvm.c | 4 +
+ tests/qtest/meson.build | 1 +
tests/qtest/pvpanic-test.c | 5 +-
- 10 files changed, 267 insertions(+), 18 deletions(-)
+ 11 files changed, 324 insertions(+), 20 deletions(-)
diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c
-index 07df7281d2..8009f5f31f 100644
+index 63c95b6e55..c681384029 100644
--- a/hw/i386/fw_cfg.c
+++ b/hw/i386/fw_cfg.c
@@ -75,7 +75,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg,
@@ -62,10 +74,10 @@ index 07df7281d2..8009f5f31f 100644
}
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
-index 2f58e73d33..439abe8f46 100644
+index f064aa2b3e..4a6440aaf9 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
-@@ -273,6 +273,72 @@ const size_t pc_compat_2_6_len = G_N_ELEMENTS(pc_compat_2_6);
+@@ -192,6 +192,75 @@ const size_t pc_compat_4_1_len = G_N_ELEMENTS(pc_compat_4_1);
*/
#define PC_FW_DATA (0x20000 + 0x8000)
@@ -93,10 +105,13 @@ index 2f58e73d33..439abe8f46 100644
+
+GlobalProperty pc_rhel_10_2_compat[] = {
+ /* pc_rhel_10_2_compat from pc_compat_10_0 */
++ { "mch", "extended-tseg-mbytes", "16" },
+ { TYPE_X86_CPU, "x-consistent-cache", "false" },
+ { TYPE_X86_CPU, "x-vendor-cpuid-only-v2", "false" },
++ { TYPE_X86_CPU, "x-arch-cap-always-on", "true" },
++ { TYPE_X86_CPU, "x-pdcm-on-even-without-pmu", "true" },
+};
-+const size_t pc_rhel_10_2_compat_len = G_N_ELEMENTS(pc_compat_10_0);
++const size_t pc_rhel_10_2_compat_len = G_N_ELEMENTS(pc_rhel_10_2_compat);
+
+GlobalProperty pc_rhel_10_1_compat[] = {
+ /* pc_rhel_10_1_compat from pc_compat_9_1 */
@@ -138,15 +153,14 @@ index 2f58e73d33..439abe8f46 100644
GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled)
{
GSIState *s;
-@@ -1754,6 +1820,7 @@ static void pc_machine_class_init(ObjectClass *oc, const void *data)
+@@ -1697,13 +1766,15 @@ static void pc_machine_class_init(ObjectClass *oc, const void *data)
pcmc->kvmclock_create_always = true;
x86mc->apic_xrupt_override = true;
assert(!mc->get_hotplug_handler);
+ mc->async_pf_vmexit_disable = false;
mc->get_hotplug_handler = pc_get_hotplug_handler;
- mc->hotplug_allowed = pc_hotplug_allowed;
mc->auto_enable_numa_with_memhp = true;
-@@ -1761,7 +1828,8 @@ static void pc_machine_class_init(ObjectClass *oc, const void *data)
+ mc->auto_enable_numa_with_memdev = true;
mc->has_hotpluggable_cpus = true;
mc->default_boot_order = "cad";
mc->block_default_type = IF_IDE;
@@ -157,10 +171,10 @@ index 2f58e73d33..439abe8f46 100644
mc->wakeup = pc_machine_wakeup;
hc->pre_plug = pc_machine_device_pre_plug_cb;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
-index acf010e20f..d546c4a8a9 100644
+index d987d8bbff..9277700569 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
-@@ -53,6 +53,7 @@
+@@ -49,6 +49,7 @@
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "system/xen.h"
@@ -168,7 +182,7 @@ index acf010e20f..d546c4a8a9 100644
#ifdef CONFIG_XEN
#include <xen/hvm/hvm_info_table.h>
#include "hw/xen/xen_pt.h"
-@@ -469,11 +470,11 @@ static void pc_i440fx_init(MachineState *machine)
+@@ -393,11 +394,11 @@ static void pc_i440fx_init(MachineState *machine)
pc_init1(machine, TYPE_I440FX_PCI_DEVICE);
}
@@ -184,9 +198,9 @@ index acf010e20f..d546c4a8a9 100644
#if 0 /* Disabled for Red Hat Enterprise Linux */
static void pc_i440fx_machine_options(MachineClass *m)
-@@ -853,3 +854,49 @@ static void xenfv_machine_3_1_options(MachineClass *m)
- DEFINE_PC_MACHINE(xenfv, "xenfv-3.1", pc_xen_hvm_init,
- xenfv_machine_3_1_options);
+@@ -667,3 +668,49 @@ static void xenfv_machine_4_2_options(MachineClass *m)
+ DEFINE_PC_MACHINE(xenfv_4_2, "xenfv-4.2", pc_xen_hvm_init,
+ xenfv_machine_4_2_options);
#endif
+
+/* Red Hat Enterprise Linux machine types */
@@ -235,11 +249,11 @@ index acf010e20f..d546c4a8a9 100644
+}
+DEFINE_I440FX_MACHINE_AS_LATEST(10, 0, 0);
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
-index 2203ffd67e..e5d10c0335 100644
+index 406af9ac21..edfd2ab5ee 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
-@@ -340,11 +340,11 @@ static void pc_q35_init(MachineState *machine)
- #endif
+@@ -343,11 +343,11 @@ static void pc_q35_machine_set_wdat(Object *o, bool value, Error **errp)
+ pcms->wdat_enabled = value;
}
-#define DEFINE_Q35_MACHINE(major, minor) \
@@ -254,7 +268,7 @@ index 2203ffd67e..e5d10c0335 100644
#define DEFINE_Q35_MACHINE_BUGFIX(major, minor, micro) \
DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, NULL, major, minor, micro);
-@@ -355,21 +355,21 @@ static void pc_q35_machine_options(MachineClass *m)
+@@ -359,16 +359,15 @@ static void pc_q35_machine_options(MachineClass *m)
pcmc->pci_root_uid = 0;
pcmc->default_cpu_version = 1;
@@ -275,23 +289,35 @@ index 2203ffd67e..e5d10c0335 100644
machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
- machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
- machine_class_allow_dynamic_sysbus_dev(m, TYPE_UEFI_VARS_X64);
+@@ -379,6 +378,7 @@ static void pc_q35_machine_options(MachineClass *m)
+ object_class_property_set_description(oc, "wdat",
+ "Enable WDAT watchdog support. Default: off");
+
+ compat_props_add(m->compat_props, pc_rhel_compat, pc_rhel_compat_len);
compat_props_add(m->compat_props,
pc_q35_compat_defaults, pc_q35_compat_defaults_len);
}
-@@ -687,3 +687,108 @@ static void pc_q35_machine_2_6_options(MachineClass *m)
+@@ -605,3 +605,131 @@ static void pc_q35_machine_4_1_options(MachineClass *m)
- DEFINE_Q35_MACHINE(2, 6);
+ DEFINE_Q35_MACHINE(4, 1);
#endif /* Disabled for Red Hat Enterprise Linux */
+
+/* Red Hat Enterprise Linux machine types */
+
-+static void pc_q35_rhel_machine_10_0_0_options(MachineClass *m)
++static void pc_q35_rhel_machine_10_2_0_options(MachineClass *m)
+{
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
+ pc_q35_machine_options(m);
++ m->desc = "RHEL-10.2.0 PC (Q35 + ICH9, 2009)";
++ pcmc->smbios_stream_product = "RHEL";
++ pcmc->smbios_stream_version = "10.2.0";
++}
++DEFINE_Q35_MACHINE_AS_LATEST(10, 2, 0);
++
++static void pc_q35_rhel_machine_10_0_0_options(MachineClass *m)
++{
++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
++ pc_q35_rhel_machine_10_2_0_options(m);
+ m->desc = "RHEL-10.0.0 PC (Q35 + ICH9, 2009)";
+ pcmc->smbios_stream_product = "RHEL";
+ pcmc->smbios_stream_version = "10.0.0";
@@ -305,7 +331,20 @@ index 2203ffd67e..e5d10c0335 100644
+ compat_props_add(m->compat_props, pc_rhel_10_1_compat,
+ pc_rhel_10_1_compat_len);
+}
-+DEFINE_Q35_MACHINE_AS_LATEST(10, 0, 0);
++DEFINE_Q35_MACHINE(10, 0, 0);
++
++static void pc_q35_rhel_machine_9_8_0_options(MachineClass *m)
++{
++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
++ pc_q35_machine_options(m);
++ m->desc = "RHEL-9.8.0 PC (Q35 + ICH9, 2009)";
++ pcmc->smbios_stream_product = "RHEL";
++ pcmc->smbios_stream_version = "9.8.0";
++
++ /* NB: remember to move this line to the *latest* RHEL 9 machine */
++ compat_props_add(m->compat_props, hw_compat_rhel_9, hw_compat_rhel_9_len);
++}
++DEFINE_Q35_MACHINE(9, 8, 0);
+
+static void pc_q35_rhel_machine_9_6_0_options(MachineClass *m)
+{
@@ -315,7 +354,7 @@ index 2203ffd67e..e5d10c0335 100644
+ pcmc->smbios_stream_product = "RHEL";
+ pcmc->smbios_stream_version = "9.6.0";
+
-+ /* NB: remember to move this line to the *latest* RHEL 9 machine */
++ /* Direct copy from 9.8 machine type to prevent duplicate pc_q35_machine_options call */
+ compat_props_add(m->compat_props, hw_compat_rhel_9, hw_compat_rhel_9_len);
+}
+
@@ -390,26 +429,93 @@ index 2203ffd67e..e5d10c0335 100644
+}
+
+DEFINE_Q35_MACHINE(9, 0, 0);
-diff --git a/include/hw/boards.h b/include/hw/boards.h
-index aca254ea18..22c3abd51e 100644
---- a/include/hw/boards.h
-+++ b/include/hw/boards.h
-@@ -308,6 +308,8 @@ struct MachineClass {
+diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
+index 361d79c868..a3edbbd7e2 100644
+--- a/hw/s390x/s390-virtio-ccw.c
++++ b/hw/s390x/s390-virtio-ccw.c
+@@ -1203,8 +1203,18 @@ DEFINE_CCW_MACHINE(5, 1);
+
+ #endif /* disabled for RHEL */
+
++static void ccw_rhel_machine_10_2_0_instance_options(MachineState *machine)
++{
++}
++
++static void ccw_rhel_machine_10_2_0_class_options(MachineClass *mc)
++{
++}
++DEFINE_CCW_MACHINE_AS_LATEST(10, 2, 0);
++
+ static void ccw_rhel_machine_10_0_0_instance_options(MachineState *machine)
+ {
++ ccw_rhel_machine_10_2_0_instance_options(machine);
+ }
+
+ static void ccw_rhel_machine_10_0_0_class_options(MachineClass *mc)
+@@ -1214,12 +1224,28 @@ static void ccw_rhel_machine_10_0_0_class_options(MachineClass *mc)
+ { TYPE_S390_PCI_DEVICE, "relaxed-translation", "off", },
+ };
+
++ ccw_rhel_machine_10_2_0_class_options(mc);
++
+ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
+ compat_props_add(mc->compat_props, hw_compat_rhel_10_2, hw_compat_rhel_10_2_len);
+ compat_props_add(mc->compat_props, hw_compat_rhel_10_1, hw_compat_rhel_10_1_len);
+ s390mc->use_cpi = false;
+ }
+-DEFINE_CCW_MACHINE_AS_LATEST(10, 0, 0);
++DEFINE_CCW_MACHINE(10, 0, 0);
++
++static void ccw_rhel_machine_9_8_0_instance_options(MachineState *machine)
++{
++ ccw_rhel_machine_10_2_0_instance_options(machine);
++}
++
++static void ccw_rhel_machine_9_8_0_class_options(MachineClass *mc)
++{
++ ccw_rhel_machine_10_2_0_class_options(mc);
++
++ /* NB: remember to copy this line to the *latest* RHEL 9 machine */
++ compat_props_add(mc->compat_props, hw_compat_rhel_9, hw_compat_rhel_9_len);
++}
++DEFINE_CCW_MACHINE(9, 8, 0);
+
+ static void ccw_rhel_machine_9_6_0_instance_options(MachineState *machine)
+ {
+@@ -1228,9 +1254,11 @@ static void ccw_rhel_machine_9_6_0_instance_options(MachineState *machine)
+
+ static void ccw_rhel_machine_9_6_0_class_options(MachineClass *mc)
+ {
++ /*
++ * NB: -rhel9.6 was on a par with -rhel10.0, so we derive from that
++ * instead of deriving from the 9.8 machine type
++ */
+ ccw_rhel_machine_10_0_0_class_options(mc);
+-
+- /* NB: remember to move this line to the *latest* RHEL 9 machine */
+ compat_props_add(mc->compat_props, hw_compat_rhel_9, hw_compat_rhel_9_len);
+ }
+ DEFINE_CCW_MACHINE(9, 6, 0);
+diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h
+index 04b37a8631..bb8ed22942 100644
+--- a/include/hw/core/boards.h
++++ b/include/hw/core/boards.h
+@@ -314,6 +314,8 @@ struct MachineClass {
strList *allowed_dynamic_sysbus_devices;
bool auto_enable_numa_with_memhp;
bool auto_enable_numa_with_memdev;
+ /* RHEL only */
+ bool async_pf_vmexit_disable;
bool ignore_boot_device_suffixes;
- bool smbus_no_migration_support;
bool nvdimm_supported;
+ bool numa_mem_supported;
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
-index 3b4ea24c20..633df2fcf8 100644
+index b6aa65f32e..0264030a1d 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
-@@ -301,6 +301,27 @@ extern const size_t pc_compat_2_7_len;
- extern GlobalProperty pc_compat_2_6[];
- extern const size_t pc_compat_2_6_len;
+@@ -275,6 +275,27 @@ extern const size_t pc_compat_4_2_len;
+ extern GlobalProperty pc_compat_4_1[];
+ extern const size_t pc_compat_4_1_len;
+extern GlobalProperty pc_rhel_compat[];
+extern const size_t pc_rhel_compat_len;
@@ -436,10 +542,10 @@ index 3b4ea24c20..633df2fcf8 100644
static void pc_machine_##suffix##_class_init(ObjectClass *oc, \
const void *data) \
diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c
-index 89a7953659..74c0b036e3 100644
+index c34d9f15c7..fc50d638cc 100644
--- a/target/i386/kvm/kvm-cpu.c
+++ b/target/i386/kvm/kvm-cpu.c
-@@ -175,6 +175,7 @@ static PropValue kvm_default_props[] = {
+@@ -184,6 +184,7 @@ static PropValue kvm_default_props[] = {
{ "acpi", "off" },
{ "monitor", "off" },
{ "svm", "off" },
@@ -448,10 +554,10 @@ index 89a7953659..74c0b036e3 100644
};
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
-index 369626f8c8..0eb39d22d6 100644
+index 4272b6770c..8576f5c8a8 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
-@@ -4389,6 +4389,7 @@ static int kvm_get_msrs(X86CPU *cpu)
+@@ -4732,6 +4732,7 @@ static int kvm_get_msrs(X86CPU *cpu)
struct kvm_msr_entry *msrs = cpu->kvm_msr_buf->entries;
int ret, i;
uint64_t mtrr_top_bits;
@@ -459,7 +565,7 @@ index 369626f8c8..0eb39d22d6 100644
kvm_msr_buf_reset(cpu);
-@@ -4786,6 +4787,9 @@ static int kvm_get_msrs(X86CPU *cpu)
+@@ -5192,6 +5193,9 @@ static int kvm_get_msrs(X86CPU *cpu)
break;
case MSR_KVM_ASYNC_PF_EN:
env->async_pf_en_msr = msrs[i].data;
@@ -470,10 +576,10 @@ index 369626f8c8..0eb39d22d6 100644
case MSR_KVM_ASYNC_PF_INT:
env->async_pf_int_msr = msrs[i].data;
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
-index 669d07c06b..b96aa06084 100644
+index 56ff860e21..0768dc6e3e 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
-@@ -49,6 +49,7 @@ qtests_filter = \
+@@ -50,6 +50,7 @@ qtests_filter = \
(get_option('default_devices') and host_os != 'windows' ? ['test-filter-mirror'] : []) + \
(get_option('default_devices') and host_os != 'windows' ? ['test-filter-redirector'] : [])
@@ -481,14 +587,6 @@ index 669d07c06b..b96aa06084 100644
qtests_i386 = \
(slirp.found() ? ['pxe-test'] : []) + \
qtests_filter + \
-@@ -94,7 +95,6 @@ qtests_i386 = \
- (config_all_devices.has_key('CONFIG_SB16') ? ['fuzz-sb16-test'] : []) + \
- (config_all_devices.has_key('CONFIG_SDHCI_PCI') ? ['fuzz-sdcard-test'] : []) + \
- (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] : []) + \
-- (config_all_devices.has_key('CONFIG_VTD') ? ['intel-iommu-test'] : []) + \
- (host_os != 'windows' and \
- config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) + \
- (config_all_devices.has_key('CONFIG_PCIE_PORT') and \
diff --git a/tests/qtest/pvpanic-test.c b/tests/qtest/pvpanic-test.c
index 5606baf47b..094c56b0cd 100644
--- a/tests/qtest/pvpanic-test.c
@@ -513,5 +611,5 @@ index 5606baf47b..094c56b0cd 100644
val = qtest_inb(qts, 0x505);
g_assert_cmpuint(val, ==, PVPANIC_EVENTS);
--
-2.39.3
+2.55.0
diff --git a/0014-Disable-virtio-net-pci-romfile-loading-on-riscv64.patch b/0014-Disable-virtio-net-pci-romfile-loading-on-riscv64.patch
index 21b840f..dcc5328 100644
--- a/0014-Disable-virtio-net-pci-romfile-loading-on-riscv64.patch
+++ b/0014-Disable-virtio-net-pci-romfile-loading-on-riscv64.patch
@@ -1,4 +1,4 @@
-From 7bc17dffbc537e8546249c7c2d19e426ad50e61f Mon Sep 17 00:00:00 2001
+From e596cb29bea9a1401bb5c0c012efd322a625bc72 Mon Sep 17 00:00:00 2001
From: Andrea Bolognani <abologna@redhat.com>
Date: Tue, 10 Jun 2025 14:27:29 +0200
Subject: Disable virtio-net-pci romfile loading on riscv64
@@ -21,12 +21,12 @@ Patch-present-in-specfile: True
1 file changed, 15 insertions(+)
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
-index ab5a9ec613..3b187d6c98 100644
+index 0f944cbd04..b7bf348e9d 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
-@@ -59,6 +59,18 @@
- #include "hw/virtio/virtio-iommu.h"
- #include "hw/uefi/var-service-api.h"
+@@ -62,6 +62,18 @@
+
+ #include "aia.h"
+/*
+ * virtio-net-pci variant romfiles are not needed because edk2 does
@@ -43,7 +43,7 @@ index ab5a9ec613..3b187d6c98 100644
/* KVM AIA only supports APLIC MSI. APLIC Wired is always emulated by QEMU. */
static bool virt_use_kvm_aia_aplic_imsic(RISCVVirtAIAType aia_type)
{
-@@ -1978,6 +1990,9 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
+@@ -1780,6 +1792,9 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
NULL, NULL);
object_class_property_set_description(oc, "iommu-sys",
"Enable IOMMU platform device");
@@ -54,5 +54,5 @@ index ab5a9ec613..3b187d6c98 100644
static const TypeInfo virt_machine_typeinfo = {
--
-2.39.3
+2.55.0
diff --git a/0015-Revert-meson-temporarily-disable-Wunused-function.patch b/0015-Revert-meson-temporarily-disable-Wunused-function.patch
index e3bec6c..33ed8fe 100644
--- a/0015-Revert-meson-temporarily-disable-Wunused-function.patch
+++ b/0015-Revert-meson-temporarily-disable-Wunused-function.patch
@@ -1,4 +1,4 @@
-From d132184ec50656d9ed675801695a66f620fe0821 Mon Sep 17 00:00:00 2001
+From e940914f5666fe45c2836f0c5b8ea9c73944884c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Wed, 3 Jul 2024 13:47:04 +0100
Subject: Revert "meson: temporarily disable -Wunused-function"
@@ -16,10 +16,10 @@ Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
1 file changed, 1 deletion(-)
diff --git a/meson.build b/meson.build
-index 23494666d9..ef2e5be6e2 100644
+index 818bb0d874..16666f928b 100644
--- a/meson.build
+++ b/meson.build
-@@ -757,7 +757,6 @@ warn_flags = [
+@@ -740,7 +740,6 @@ warn_flags = [
'-Wno-string-plus-int',
'-Wno-tautological-type-limit-compare',
'-Wno-typedef-redefinition',
@@ -28,5 +28,5 @@ index 23494666d9..ef2e5be6e2 100644
if host_os != 'darwin'
--
-2.39.3
+2.55.0
diff --git a/0016-Enable-make-check.patch b/0016-Enable-make-check.patch
index 809be58..f00fe3e 100644
--- a/0016-Enable-make-check.patch
+++ b/0016-Enable-make-check.patch
@@ -1,4 +1,4 @@
-From 0f4d74ce6ff137291962909aaebc1dbf3dd27508 Mon Sep 17 00:00:00 2001
+From c5fe7e9d3e6133fdb8312cee959fc4cb4ae1519a Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Wed, 2 Sep 2020 09:39:41 +0200
Subject: Enable make check
@@ -22,42 +22,38 @@ Rebase notes (10.0.0):
Rebase notes (10.1.0 rc0):
- Comment out unused code
+
+Rebase notes (11.1.0):
+- Update cpu from Nehalem to Haswell for qemu-iotests
+
+Rebase notes (11.1.0):
+- Updating qemu-iotests disabling
+- Do not remove virtio-iommu.c from qtest
+
+Merged patches (11.0.0 rc0):
+- 010f0f3939 qtest: Do not run bios-tables-test on aarch64
---
- .distro/qemu-kvm.spec.template | 4 +--
- tests/functional/meson.build | 2 +-
- tests/functional/test_aarch64_tcg_plugins.py | 4 +--
- tests/qemu-iotests/meson.build | 34 ++++++++++----------
- tests/qemu-iotests/testenv.py | 3 ++
- tests/qtest/bios-tables-test.c | 10 ++++++
+ .distro/qemu-kvm.spec.template | 4 ++--
+ tests/functional/aarch64/test_tcg_plugins.py | 4 ++--
+ tests/functional/x86_64/meson.build | 1 -
+ tests/qemu-iotests/meson.build | 7 ++++---
+ tests/qemu-iotests/testenv.py | 3 +++
+ tests/qtest/bios-tables-test.c | 10 ++++++++++
tests/qtest/fuzz-e1000e-test.c | 2 +-
tests/qtest/fuzz-virtio-scsi-test.c | 2 +-
tests/qtest/intel-hda-test.c | 2 +-
- tests/qtest/libqos/meson.build | 2 +-
tests/qtest/lpc-ich9-test.c | 2 +-
tests/qtest/machine-none-test.c | 2 +-
- tests/qtest/meson.build | 1 -
+ tests/qtest/meson.build | 2 --
tests/qtest/pvpanic-test.c | 2 +-
- tests/qtest/riscv-csr-test.c | 4 +++
+ tests/qtest/riscv-csr-test.c | 4 ++++
tests/qtest/virtio-net-failover.c | 1 +
- 16 files changed, 47 insertions(+), 30 deletions(-)
+ 15 files changed, 32 insertions(+), 16 deletions(-)
-diff --git a/tests/functional/meson.build b/tests/functional/meson.build
-index 311c6f1806..c7f9051c90 100644
---- a/tests/functional/meson.build
-+++ b/tests/functional/meson.build
-@@ -319,7 +319,7 @@ tests_sparc64_system_thorough = [
-
- tests_x86_64_system_quick = [
- 'cpu_queries',
-- 'mem_addr_space',
-+# 'mem_addr_space',
- 'migration',
- 'pc_cpu_hotplug_props',
- 'virtio_version',
-diff --git a/tests/functional/test_aarch64_tcg_plugins.py b/tests/functional/test_aarch64_tcg_plugins.py
+diff --git a/tests/functional/aarch64/test_tcg_plugins.py b/tests/functional/aarch64/test_tcg_plugins.py
index cb7e9298fb..9efa826b01 100755
---- a/tests/functional/test_aarch64_tcg_plugins.py
-+++ b/tests/functional/test_aarch64_tcg_plugins.py
+--- a/tests/functional/aarch64/test_tcg_plugins.py
++++ b/tests/functional/aarch64/test_tcg_plugins.py
@@ -64,7 +64,7 @@ class PluginKernelNormal(PluginKernelBase):
def test_aarch64_virt_insn(self):
@@ -76,68 +72,67 @@ index cb7e9298fb..9efa826b01 100755
kernel_path = self.ASSET_KERNEL.fetch()
kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
'console=ttyAMA0')
+diff --git a/tests/functional/x86_64/meson.build b/tests/functional/x86_64/meson.build
+index 27b31f2e96..ce406e6ec2 100644
+--- a/tests/functional/x86_64/meson.build
++++ b/tests/functional/x86_64/meson.build
+@@ -13,7 +13,6 @@ tests_x86_64_system_quick = [
+ 'bad_vmstate',
+ 'cpu_model_versions',
+ 'cpu_queries',
+- 'mem_addr_space',
+ 'migration',
+ 'pc_cpu_hotplug_props',
+ 'virtio_version',
diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build
-index fad340ad59..3c0d5241f6 100644
+index 8857f25f29..d6919ece8b 100644
--- a/tests/qemu-iotests/meson.build
+++ b/tests/qemu-iotests/meson.build
-@@ -51,21 +51,21 @@ foreach format, speed: qemu_iotests_formats
+@@ -46,7 +46,8 @@ foreach driver, speed: qemu_iotests_drivers
+ check: true,
+ )
+
+- foreach item: rc.stdout().strip().split()
++# foreach item: rc.stdout().strip().split()
++ foreach item: []
+ seen += item
+ args = [qemu_iotests_check_cmd,
+ '-tap', '-' + driver, item,
+@@ -84,13 +85,13 @@ foreach driver, speed: qemu_iotests_drivers
check: true,
)
- foreach item: rc.stdout().strip().split()
-- args = [qemu_iotests_check_cmd,
-- '-tap', '-' + format, item,
-- '--source-dir', meson.current_source_dir(),
-- '--build-dir', meson.current_build_dir()]
-- # Some individual tests take as long as 45 seconds
-- # Bump the timeout to 3 minutes for some headroom
-- # on slow machines to minimize spurious failures
-- test('io-' + format + '-' + item,
-- python,
-- args: args,
-- depends: qemu_iotests_binaries,
-- env: qemu_iotests_env,
-- protocol: 'tap',
-- timeout: 180,
-- suite: suites)
-- endforeach
+# foreach item: rc.stdout().strip().split()
-+# args = [qemu_iotests_check_cmd,
-+# '-tap', '-' + format, item,
-+# '--source-dir', meson.current_source_dir(),
-+# '--build-dir', meson.current_build_dir()]
-+# # Some individual tests take as long as 45 seconds
-+# # Bump the timeout to 3 minutes for some headroom
-+# # on slow machines to minimize spurious failures
-+# test('io-' + format + '-' + item,
-+# python,
-+# args: args,
-+# depends: qemu_iotests_binaries,
-+# env: qemu_iotests_env,
-+# protocol: 'tap',
-+# timeout: 180,
-+# suite: suites)
-+# endforeach
- endforeach
++ foreach item: []
+ # Skip any tests already added from the 'auto' group
+ # as they're run in the 'quick' suite already
+ if item in seen
+ continue
+ endif
+-
+ args = [qemu_iotests_check_cmd,
+ '-tap', '-' + driver, item,
+ '--source-dir', meson.current_source_dir(),
diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
-index 6326e46b7b..bc849ae9cf 100644
+index 86bcdf7cfa..8b68ca5284 100644
--- a/tests/qemu-iotests/testenv.py
+++ b/tests/qemu-iotests/testenv.py
-@@ -252,6 +252,9 @@ def __init__(self, source_dir: str, build_dir: str,
+@@ -273,6 +273,9 @@ def __init__(self, source_dir: str, build_dir: str,
if self.qemu_prog.endswith(f'qemu-system-{suffix}'):
self.qemu_options += f' -machine {machine}'
+ if self.qemu_prog.endswith('qemu-system-x86_64'):
-+ self.qemu_options += ' -cpu Nehalem'
++ self.qemu_options += ' -cpu Haswell'
+
# QEMU_DEFAULT_MACHINE
self.qemu_default_machine = get_default_machine(self.qemu_prog)
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
-index e7e6926c81..386196edc8 100644
+index 5cc526510a..6b63d43ec5 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
-@@ -1755,6 +1755,7 @@ static void test_acpi_microvm_ioapic2_tcg(void)
+@@ -1776,6 +1776,7 @@ static void test_acpi_microvm_ioapic2_tcg(void)
free_test_data(&data);
}
@@ -145,7 +140,7 @@ index e7e6926c81..386196edc8 100644
static void test_acpi_riscv64_virt_tcg_numamem(void)
{
test_data data = {
-@@ -1780,6 +1781,7 @@ static void test_acpi_riscv64_virt_tcg_numamem(void)
+@@ -1801,6 +1802,7 @@ static void test_acpi_riscv64_virt_tcg_numamem(void)
&data);
free_test_data(&data);
}
@@ -153,7 +148,7 @@ index e7e6926c81..386196edc8 100644
static void test_acpi_aarch64_virt_tcg_numamem(void)
{
-@@ -1856,6 +1858,7 @@ static void test_acpi_aarch64_virt_tcg_acpi_spcr(void)
+@@ -1877,6 +1879,7 @@ static void test_acpi_aarch64_virt_tcg_acpi_spcr(void)
free_test_data(&data);
}
@@ -161,7 +156,7 @@ index e7e6926c81..386196edc8 100644
static void test_acpi_riscv64_virt_tcg_acpi_spcr(void)
{
test_data data = {
-@@ -1874,6 +1877,7 @@ static void test_acpi_riscv64_virt_tcg_acpi_spcr(void)
+@@ -1895,6 +1898,7 @@ static void test_acpi_riscv64_virt_tcg_acpi_spcr(void)
"-machine spcr=off", &data);
free_test_data(&data);
}
@@ -169,7 +164,7 @@ index e7e6926c81..386196edc8 100644
static void test_acpi_tcg_acpi_hmat(const char *machine, const char *arch)
{
-@@ -2171,6 +2175,7 @@ static void test_acpi_microvm_acpi_erst(void)
+@@ -2192,6 +2196,7 @@ static void test_acpi_microvm_acpi_erst(void)
}
#endif /* CONFIG_POSIX */
@@ -177,7 +172,7 @@ index e7e6926c81..386196edc8 100644
static void test_acpi_riscv64_virt_tcg(void)
{
test_data data = {
-@@ -2192,6 +2197,7 @@ static void test_acpi_riscv64_virt_tcg(void)
+@@ -2213,6 +2218,7 @@ static void test_acpi_riscv64_virt_tcg(void)
test_acpi_one("-cpu rva22s64 ", &data);
free_test_data(&data);
}
@@ -185,7 +180,7 @@ index e7e6926c81..386196edc8 100644
static void test_acpi_aarch64_virt_tcg(void)
{
-@@ -2526,6 +2532,7 @@ static void test_acpi_aarch64_virt_oem_fields(void)
+@@ -2699,6 +2705,7 @@ static void test_acpi_aarch64_virt_oem_fields(void)
g_free(args);
}
@@ -193,7 +188,7 @@ index e7e6926c81..386196edc8 100644
#define LOONGARCH64_INIT_TEST_DATA(data) \
test_data data = { \
.machine = "virt", \
-@@ -2594,6 +2601,7 @@ static void test_acpi_loongarch64_virt_oem_fields(void)
+@@ -2767,6 +2774,7 @@ static void test_acpi_loongarch64_virt_oem_fields(void)
free_test_data(&data);
g_free(args);
}
@@ -201,15 +196,15 @@ index e7e6926c81..386196edc8 100644
int main(int argc, char *argv[])
{
-@@ -2769,6 +2777,7 @@ int main(int argc, char *argv[])
- qtest_add_func("acpi/virt/viot", test_acpi_aarch64_virt_viot);
- }
+@@ -2956,6 +2964,7 @@ int main(int argc, char *argv[])
+ qtest_add_func("acpi/virt/gwdt-watchdog",
+ test_acpi_aarch64_virt_tcg_gtdt_wd);
}
+#if 0 /* Disabled for Red Hat Enterprise Linux */
} else if (strcmp(arch, "riscv64") == 0) {
if (has_tcg && qtest_has_device("virtio-blk-pci")) {
qtest_add_func("acpi/virt", test_acpi_riscv64_virt_tcg);
-@@ -2788,6 +2797,7 @@ int main(int argc, char *argv[])
+@@ -2975,6 +2984,7 @@ int main(int argc, char *argv[])
qtest_add_func("acpi/virt/oem-fields",
test_acpi_loongarch64_virt_oem_fields);
}
@@ -218,14 +213,14 @@ index e7e6926c81..386196edc8 100644
ret = g_test_run();
boot_sector_cleanup(disk);
diff --git a/tests/qtest/fuzz-e1000e-test.c b/tests/qtest/fuzz-e1000e-test.c
-index 5052883fb6..8242190170 100644
+index b66a2e2313..8242190170 100644
--- a/tests/qtest/fuzz-e1000e-test.c
+++ b/tests/qtest/fuzz-e1000e-test.c
@@ -17,7 +17,7 @@ static void test_lp1879531_eth_get_rss_ex_dst_addr(void)
{
QTestState *s;
-- s = qtest_init("-nographic -monitor none -serial none -M pc-q35-5.0");
+- s = qtest_init("-nographic -monitor none -serial none -M q35");
+ s = qtest_init("-nographic -monitor none -serial none -M pc-q35-rhel9.4.0");
qtest_outl(s, 0xcf8, 0x80001010);
@@ -256,50 +251,37 @@ index 663bb6c485..2efc43e3f7 100644
AUDIODEV
"-device intel-hda,id=" HDA_ID CODEC_DEVICES);
-diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
-index 1ddaf7b095..1cb403e90d 100644
---- a/tests/qtest/libqos/meson.build
-+++ b/tests/qtest/libqos/meson.build
-@@ -43,7 +43,7 @@ libqos_srcs = files(
- 'virtio-rng.c',
- 'virtio-scsi.c',
- 'virtio-serial.c',
-- 'virtio-iommu.c',
-+# 'virtio-iommu.c',
- 'virtio-gpio.c',
- 'virtio-scmi.c',
- 'generic-pcihost.c',
diff --git a/tests/qtest/lpc-ich9-test.c b/tests/qtest/lpc-ich9-test.c
-index 8ac95b89f7..0e118b76eb 100644
+index 460d459c70..0e118b76eb 100644
--- a/tests/qtest/lpc-ich9-test.c
+++ b/tests/qtest/lpc-ich9-test.c
@@ -15,7 +15,7 @@ static void test_lp1878642_pci_bus_get_irq_level_assert(void)
{
QTestState *s;
-- s = qtest_init("-M pc-q35-5.0 "
+- s = qtest_init("-M q35 "
+ s = qtest_init("-M pc-q35-rhel9.4.0 "
"-nographic -monitor none -serial none");
qtest_outl(s, 0xcf8, 0x8000f840); /* PMBASE */
diff --git a/tests/qtest/machine-none-test.c b/tests/qtest/machine-none-test.c
-index b6a87d27ed..423ba12159 100644
+index 3205df190f..b65cd583e5 100644
--- a/tests/qtest/machine-none-test.c
+++ b/tests/qtest/machine-none-test.c
-@@ -49,7 +49,7 @@ static struct arch2cpu cpus_map[] = {
+@@ -48,7 +48,7 @@ static struct arch2cpu cpus_map[] = {
{ "xtensa", "dc233c" },
{ "xtensaeb", "fsf" },
- { "hppa", "hppa" },
+ { "hppa", "pa-7300lc" },
- { "riscv64", "rv64" },
+ { "riscv64", "max" },
{ "riscv32", "rv32" },
{ "rx", "rx62n" },
{ "loongarch64", "la464"},
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
-index b96aa06084..ef44ffaf78 100644
+index 0768dc6e3e..cdb5e04072 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
-@@ -91,7 +91,6 @@ qtests_i386 = \
+@@ -94,7 +94,6 @@ qtests_i386 = \
(config_all_devices.has_key('CONFIG_LSI_SCSI_PCI') ? ['fuzz-lsi53c895a-test'] : []) + \
(config_all_devices.has_key('CONFIG_VIRTIO_SCSI') ? ['fuzz-virtio-scsi-test'] : []) + \
(config_all_devices.has_key('CONFIG_VIRTIO_BALLOON') ? ['virtio-balloon-test'] : []) + \
@@ -307,6 +289,14 @@ index b96aa06084..ef44ffaf78 100644
(config_all_devices.has_key('CONFIG_SB16') ? ['fuzz-sb16-test'] : []) + \
(config_all_devices.has_key('CONFIG_SDHCI_PCI') ? ['fuzz-sdcard-test'] : []) + \
(config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] : []) + \
+@@ -262,7 +261,6 @@ qtests_arm = \
+
+ # TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
+ qtests_aarch64 = \
+- (cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \
+ (config_all_accel.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? \
+ ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \
+ (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \
diff --git a/tests/qtest/pvpanic-test.c b/tests/qtest/pvpanic-test.c
index 094c56b0cd..338f94dcd9 100644
--- a/tests/qtest/pvpanic-test.c
@@ -321,7 +311,7 @@ index 094c56b0cd..338f94dcd9 100644
val = qtest_inb(qts, 0x505);
g_assert_cmpuint(val, ==, PVPANIC_EVENTS);
diff --git a/tests/qtest/riscv-csr-test.c b/tests/qtest/riscv-csr-test.c
-index ff5c29e6c6..cc3b08a976 100644
+index bb1b0ffed3..bfac002674 100644
--- a/tests/qtest/riscv-csr-test.c
+++ b/tests/qtest/riscv-csr-test.c
@@ -20,6 +20,7 @@
@@ -332,7 +322,7 @@ index ff5c29e6c6..cc3b08a976 100644
static void run_test_csr(void)
{
uint64_t res;
-@@ -45,12 +46,15 @@ static void run_test_csr(void)
+@@ -45,14 +46,17 @@ static void run_test_csr(void)
qtest_quit(qts);
}
@@ -343,7 +333,9 @@ index ff5c29e6c6..cc3b08a976 100644
g_test_init(&argc, &argv, NULL);
+#if 0 /* Disabled for Red Hat Enterprise Linux */
- qtest_add_func("/cpu/csr", run_test_csr);
+ if (qtest_has_machine("virt")) {
+ qtest_add_func("/cpu/csr", run_test_csr);
+ }
+#endif /* disabled for RHEL */
return g_test_run();
@@ -361,5 +353,5 @@ index 5baf81c3e6..aa87bf5698 100644
"-device pcie-root-port,id=root1,addr=0x2,bus=pcie.0,chassis=2 "
--
-2.39.3
+2.55.0
diff --git a/0017-Add-support-statement-to-help-output.patch b/0017-Add-support-statement-to-help-output.patch
new file mode 100644
index 0000000..de50819
--- /dev/null
+++ b/0017-Add-support-statement-to-help-output.patch
@@ -0,0 +1,46 @@
+From 9dfaee373c8be3b44865675734468e8662872ff9 Mon Sep 17 00:00:00 2001
+From: Eduardo Habkost <ehabkost@redhat.com>
+Date: Wed, 4 Dec 2013 18:53:17 +0100
+Subject: Add support statement to -help output
+
+Add support statement to -help output, reporting direct qemu-kvm usage
+as unsupported by Red Hat, and advising users to use libvirt instead.
+
+Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
+---
+ system/vl.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/system/vl.c b/system/vl.c
+index 061cbdf860..65969ffad9 100644
+--- a/system/vl.c
++++ b/system/vl.c
+@@ -881,9 +881,17 @@ static void version(void)
+ QEMU_COPYRIGHT "\n");
+ }
+
++static void print_rh_warning(void)
++{
++ printf("\nWARNING: Direct use of qemu-kvm from the command line is not supported by Red Hat.\n"
++ "WARNING: Use libvirt as the stable management interface.\n"
++ "WARNING: Some command line options listed here may not be available in future releases.\n\n");
++}
++
+ static void help(int exitcode)
+ {
+ version();
++ print_rh_warning();
+ printf("usage: %s [options] [disk_image]\n\n"
+ "'disk_image' is a raw hard disk image for IDE hard disk 0\n\n",
+ g_get_prgname());
+@@ -909,6 +917,7 @@ static void help(int exitcode)
+ "\n"
+ QEMU_HELP_BOTTOM "\n");
+
++ print_rh_warning();
+ exit(exitcode);
+ }
+
+--
+2.55.0
+
diff --git a/0017-vfio-cap-number-of-devices-that-can-be-assigned.patch b/0017-vfio-cap-number-of-devices-that-can-be-assigned.patch
deleted file mode 100644
index 03adb71..0000000
--- a/0017-vfio-cap-number-of-devices-that-can-be-assigned.patch
+++ /dev/null
@@ -1,140 +0,0 @@
-From 0f17fef61fc05f7617e47fcbc6a6c13efa5435d8 Mon Sep 17 00:00:00 2001
-From: Bandan Das <bsd@redhat.com>
-Date: Tue, 3 Dec 2013 20:05:13 +0100
-Subject: vfio: cap number of devices that can be assigned
-
-RH-Author: Bandan Das <bsd@redhat.com>
-Message-id: <1386101113-31560-3-git-send-email-bsd@redhat.com>
-Patchwork-id: 55984
-O-Subject: [PATCH RHEL7 qemu-kvm v2 2/2] vfio: cap number of devices that can be assigned
-Bugzilla: 678368
-RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
-RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
-RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
-
-Go through all groups to get count of total number of devices
-active to enforce limit
-
-Reasoning from Alex for the limit(32) - Assuming 3 slots per
-device, with 125 slots (number of memory slots for RHEL 7),
-we can support almost 40 devices and still have few slots left
-for other uses. Stepping down a bit, the number 32 arbitrarily
-matches the number of slots on a PCI bus and is also a nice power
-of two.
-
-Count of slots increased to 509 later so we could increase limit
-to 64 as some usecases require more than 32 devices.
-
-Signed-off-by: Bandan Das <bsd@redhat.com>
-
-Rebase changes (8.2.0):
-- Update to upstream changes
-
-Rebased notes (10.1.0)
-- Update to upstream changes
-- Introduced vfio_device_count()
----
- hw/vfio/container.c | 14 ++++++++++++++
- hw/vfio/pci.c | 21 +++++++++++++++++++++
- hw/vfio/pci.h | 1 +
- include/hw/vfio/vfio-device.h | 1 +
- 4 files changed, 37 insertions(+)
-
-diff --git a/hw/vfio/container.c b/hw/vfio/container.c
-index 3e13feaa74..b912b9396b 100644
---- a/hw/vfio/container.c
-+++ b/hw/vfio/container.c
-@@ -44,6 +44,20 @@ typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList;
- static VFIOGroupList vfio_group_list =
- QLIST_HEAD_INITIALIZER(vfio_group_list);
-
-+int vfio_device_count(void)
-+{
-+ int i = 0;
-+ VFIOGroup *group;
-+ VFIODevice *vbasedev_iter;
-+
-+ QLIST_FOREACH(group, &vfio_group_list, next) {
-+ QLIST_FOREACH(vbasedev_iter, &group->device_list, next) {
-+ i++;
-+ }
-+ }
-+ return i;
-+}
-+
- static int vfio_ram_block_discard_disable(VFIOContainer *container, bool state)
- {
- switch (container->iommu_type) {
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 07257d0fa0..48da233cb2 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -52,6 +52,9 @@
- /* Protected by BQL */
- static KVMRouteChange vfio_route_change;
-
-+/* RHEL only: Set once for the first assigned dev */
-+static uint16_t device_limit;
-+
- static void vfio_disable_interrupts(VFIOPCIDevice *vdev);
- static void vfio_mmap_set_enabled(VFIOPCIDevice *vdev, bool enabled);
- static void vfio_msi_disable_common(VFIOPCIDevice *vdev);
-@@ -3355,6 +3358,21 @@ static void vfio_pci_realize(PCIDevice *pdev, Error **errp)
- char uuid[UUID_STR_LEN];
- g_autofree char *name = NULL;
-
-+ if (device_limit && device_limit != vdev->assigned_device_limit) {
-+ error_setg(errp, "Assigned device limit has been redefined. "
-+ "Old:%d, New:%d",
-+ device_limit, vdev->assigned_device_limit);
-+ return;
-+ } else {
-+ device_limit = vdev->assigned_device_limit;
-+ }
-+
-+ if (vfio_device_count() >= vdev->assigned_device_limit) {
-+ error_setg(errp, "Maximum supported vfio devices (%d) "
-+ "already attached", vdev->assigned_device_limit);
-+ return;
-+ }
-+
- if (vbasedev->fd < 0 && !vbasedev->sysfsdev) {
- if (!(~vdev->host.domain || ~vdev->host.bus ||
- ~vdev->host.slot || ~vdev->host.function)) {
-@@ -3687,6 +3705,9 @@ static const Property vfio_pci_dev_properties[] = {
- DEFINE_PROP_BOOL("x-no-kvm-msix", VFIOPCIDevice, no_kvm_msix, false),
- DEFINE_PROP_BOOL("x-no-geforce-quirks", VFIOPCIDevice,
- no_geforce_quirks, false),
-+ /* RHEL only */
-+ DEFINE_PROP_UINT16("x-assigned-device-limit", VFIOPCIDevice,
-+ assigned_device_limit, 64),
- DEFINE_PROP_BOOL("x-no-kvm-ioeventfd", VFIOPCIDevice, no_kvm_ioeventfd,
- false),
- DEFINE_PROP_BOOL("x-no-vfio-ioeventfd", VFIOPCIDevice, no_vfio_ioeventfd,
-diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
-index 810a842f4a..81555d8774 100644
---- a/hw/vfio/pci.h
-+++ b/hw/vfio/pci.h
-@@ -145,6 +145,7 @@ struct VFIOPCIDevice {
- EventNotifier err_notifier;
- EventNotifier req_notifier;
- int (*resetfn)(struct VFIOPCIDevice *);
-+ uint16_t assigned_device_limit;
- uint32_t vendor_id;
- uint32_t device_id;
- uint32_t sub_vendor_id;
-diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h
-index 6e4d5ccdac..9290774299 100644
---- a/include/hw/vfio/vfio-device.h
-+++ b/include/hw/vfio/vfio-device.h
-@@ -140,6 +140,7 @@ struct VFIODeviceOps {
- #define strwriteerror(ret) \
- (ret < 0 ? strerror(-ret) : "short write")
-
-+int vfio_device_count(void);
- void vfio_device_irq_disable(VFIODevice *vbasedev, int index);
- void vfio_device_irq_unmask(VFIODevice *vbasedev, int index);
- void vfio_device_irq_mask(VFIODevice *vbasedev, int index);
---
-2.39.3
-
diff --git a/0018-Add-support-statement-to-help-output.patch b/0018-Add-support-statement-to-help-output.patch
deleted file mode 100644
index 884c4ce..0000000
--- a/0018-Add-support-statement-to-help-output.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 74a65ebea34ca36e3f510bc80274ce039df4e383 Mon Sep 17 00:00:00 2001
-From: Eduardo Habkost <ehabkost@redhat.com>
-Date: Wed, 4 Dec 2013 18:53:17 +0100
-Subject: Add support statement to -help output
-
-Add support statement to -help output, reporting direct qemu-kvm usage
-as unsupported by Red Hat, and advising users to use libvirt instead.
-
-Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
----
- system/vl.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/system/vl.c b/system/vl.c
-index 3b7057e6c6..d3e6158753 100644
---- a/system/vl.c
-+++ b/system/vl.c
-@@ -872,9 +872,17 @@ static void version(void)
- QEMU_COPYRIGHT "\n");
- }
-
-+static void print_rh_warning(void)
-+{
-+ printf("\nWARNING: Direct use of qemu-kvm from the command line is not supported by Red Hat.\n"
-+ "WARNING: Use libvirt as the stable management interface.\n"
-+ "WARNING: Some command line options listed here may not be available in future releases.\n\n");
-+}
-+
- static void help(int exitcode)
- {
- version();
-+ print_rh_warning();
- printf("usage: %s [options] [disk_image]\n\n"
- "'disk_image' is a raw hard disk image for IDE hard disk 0\n\n",
- g_get_prgname());
-@@ -900,6 +908,7 @@ static void help(int exitcode)
- "\n"
- QEMU_HELP_BOTTOM "\n");
-
-+ print_rh_warning();
- exit(exitcode);
- }
-
---
-2.39.3
-
diff --git a/0018-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch b/0018-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch
new file mode 100644
index 0000000..754ebbb
--- /dev/null
+++ b/0018-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch
@@ -0,0 +1,52 @@
+From 92f22109260e8d38f73c42a2a4a7ef0b30971342 Mon Sep 17 00:00:00 2001
+From: Miroslav Rezanina <mrezanin@redhat.com>
+Date: Wed, 8 Jul 2020 08:35:50 +0200
+Subject: Use qemu-kvm in documentation instead of qemu-system-<arch>
+
+We change the name and location of qemu-kvm binaries. Update documentation
+to reflect this change. Only architectures available in RHEL are updated.
+
+Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
+---
+ docs/defs.rst.inc | 4 ++--
+ qemu-options.hx | 10 +++++-----
+ 2 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/docs/defs.rst.inc b/docs/defs.rst.inc
+index 52d6454b93..d74dbdeca9 100644
+--- a/docs/defs.rst.inc
++++ b/docs/defs.rst.inc
+@@ -9,7 +9,7 @@
+ but the manpages will end up misrendered with following normal text
+ incorrectly in boldface.
+
+-.. |qemu_system| replace:: qemu-system-x86_64
+-.. |qemu_system_x86| replace:: qemu-system-x86_64
++.. |qemu_system| replace:: qemu-kvm
++.. |qemu_system_x86| replace:: qemu-kvm
+ .. |I2C| replace:: I\ :sup:`2`\ C
+ .. |I2S| replace:: I\ :sup:`2`\ S
+diff --git a/qemu-options.hx b/qemu-options.hx
+index 34970fffc9..73e5d1fe7f 100644
+--- a/qemu-options.hx
++++ b/qemu-options.hx
+@@ -4029,11 +4029,11 @@ SRST
+
+ ::
+
+- qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
+- -numa node,memdev=mem \
+- -chardev socket,id=chr0,path=/path/to/socket \
+- -netdev type=vhost-user,id=net0,chardev=chr0 \
+- -device virtio-net-pci,netdev=net0
++ qemu-kvm -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
++ -numa node,memdev=mem \
++ -chardev socket,id=chr0,path=/path/to/socket \
++ -netdev type=vhost-user,id=net0,chardev=chr0 \
++ -device virtio-net-pci,netdev=net0
+
+ ``-netdev vhost-vdpa[,vhostdev=/path/to/dev][,vhostfd=h]``
+ Establish a vhost-vdpa netdev.
+--
+2.55.0
+
diff --git a/0019-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch b/0019-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch
deleted file mode 100644
index a7371c5..0000000
--- a/0019-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 50b5abd584d9157677d694260a797be793fcf985 Mon Sep 17 00:00:00 2001
-From: Miroslav Rezanina <mrezanin@redhat.com>
-Date: Wed, 8 Jul 2020 08:35:50 +0200
-Subject: Use qemu-kvm in documentation instead of qemu-system-<arch>
-
-We change the name and location of qemu-kvm binaries. Update documentation
-to reflect this change. Only architectures available in RHEL are updated.
-
-Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
----
- docs/defs.rst.inc | 4 ++--
- qemu-options.hx | 10 +++++-----
- 2 files changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/docs/defs.rst.inc b/docs/defs.rst.inc
-index 52d6454b93..d74dbdeca9 100644
---- a/docs/defs.rst.inc
-+++ b/docs/defs.rst.inc
-@@ -9,7 +9,7 @@
- but the manpages will end up misrendered with following normal text
- incorrectly in boldface.
-
--.. |qemu_system| replace:: qemu-system-x86_64
--.. |qemu_system_x86| replace:: qemu-system-x86_64
-+.. |qemu_system| replace:: qemu-kvm
-+.. |qemu_system_x86| replace:: qemu-kvm
- .. |I2C| replace:: I\ :sup:`2`\ C
- .. |I2S| replace:: I\ :sup:`2`\ S
-diff --git a/qemu-options.hx b/qemu-options.hx
-index ab23f14d21..3837456a61 100644
---- a/qemu-options.hx
-+++ b/qemu-options.hx
-@@ -3858,11 +3858,11 @@ SRST
-
- ::
-
-- qemu -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
-- -numa node,memdev=mem \
-- -chardev socket,id=chr0,path=/path/to/socket \
-- -netdev type=vhost-user,id=net0,chardev=chr0 \
-- -device virtio-net-pci,netdev=net0
-+ qemu-kvm -m 512 -object memory-backend-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \
-+ -numa node,memdev=mem \
-+ -chardev socket,id=chr0,path=/path/to/socket \
-+ -netdev type=vhost-user,id=net0,chardev=chr0 \
-+ -device virtio-net-pci,netdev=net0
-
- ``-netdev vhost-vdpa[,vhostdev=/path/to/dev][,vhostfd=h]``
- Establish a vhost-vdpa netdev.
---
-2.39.3
-
diff --git a/0019-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch b/0019-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch
new file mode 100644
index 0000000..71d9371
--- /dev/null
+++ b/0019-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch
@@ -0,0 +1,58 @@
+From 7c659e11a0c01a94793ca292633fa316e0d03468 Mon Sep 17 00:00:00 2001
+From: Kevin Wolf <kwolf@redhat.com>
+Date: Fri, 20 Aug 2021 18:25:12 +0200
+Subject: qcow2: Deprecation warning when opening v2 images rw
+
+qcow2 v3 has been around for a long time (since QEMU 1.1/RHEL 7), so
+there is no real reason any more to use it. People still using it might
+do so unintentionally. Warn about it and suggest upgrading during the
+RHEL 9 timeframe so that the code can possibly be disabled in RHEL 10.
+
+The warning is restricted to read-write mode and the system emulator.
+The primary motivation for not having it in qemu-img is that 'qemu-img
+amend' for upgrades would warn otherwise. It also avoids having to make
+too many changes to the test suite.
+
+bdrv_uses_whitelist() is used as a proxy for deciding whether we are
+running in a tool or the system emulator. This is not entirely clean,
+but it's what is available and the same function qcow2_do_open() already
+uses it this way for another warning.
+
+Signed-off-by: Kevin Wolf <kwolf@redhat.com>
+---
+ block/qcow2.c | 6 ++++++
+ tests/qemu-iotests/common.filter | 1 +
+ 2 files changed, 7 insertions(+)
+
+diff --git a/block/qcow2.c b/block/qcow2.c
+index 7292dd036c..6ed3cdab67 100644
+--- a/block/qcow2.c
++++ b/block/qcow2.c
+@@ -1441,6 +1441,12 @@ qcow2_do_open(BlockDriverState *bs, QDict *options, int flags,
+ ret = -ENOTSUP;
+ goto fail;
+ }
++ if (header.version < 3 && !bdrv_is_read_only(bs) && bdrv_uses_whitelist()) {
++ warn_report_once("qcow2 v2 images are deprecated and may not be "
++ "supported in future versions. Please consider "
++ "upgrading the image with 'qemu-img amend "
++ "-o compat=v3'.");
++ }
+
+ s->qcow_version = header.version;
+
+diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
+index ce4213cb97..1b39328c9b 100644
+--- a/tests/qemu-iotests/common.filter
++++ b/tests/qemu-iotests/common.filter
+@@ -83,6 +83,7 @@ _filter_qemu()
+ {
+ gsed -e "s#\\(^\\|(qemu) \\)$(basename $QEMU_PROG):#\1QEMU_PROG:#" \
+ -e 's#^QEMU [0-9]\+\.[0-9]\+\.[0-9]\+ monitor#QEMU X.Y.Z monitor#' \
++ -e "/qcow2 v2 images are deprecated/d" \
+ -e $'s#\r##' # QEMU monitor uses \r\n line endings
+ }
+
+--
+2.55.0
+
diff --git a/0020-file-posix-Define-DM_MPATH_PROBE_PATHS.patch b/0020-file-posix-Define-DM_MPATH_PROBE_PATHS.patch
new file mode 100644
index 0000000..8a0fdc6
--- /dev/null
+++ b/0020-file-posix-Define-DM_MPATH_PROBE_PATHS.patch
@@ -0,0 +1,46 @@
+From e66fed0c0a160f68735e05dc30780ffe2beeee19 Mon Sep 17 00:00:00 2001
+From: Miroslav Rezanina <mrezanin@redhat.com>
+Date: Wed, 24 Sep 2025 06:42:20 +0200
+Subject: file-posix: Define DM_MPATH_PROBE_PATHS
+
+RH-Author: Kevin Wolf <kwolf@redhat.com>
+RH-MergeRequest: 370: file-posix: Fix multipath failover with SCSI passthrough
+RH-Jira: RHEL-65852
+RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
+RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
+RH-Commit: [1/2] 6680f4a3f15a768b1ca51aafea452c3d0886f12e (kmwolf/centos-qemu-kvm)
+
+While the kernel side isn't merged yet and we're still using old kernel
+headers, just define DM_MPATH_PROBE_PATHS manually.
+
+This is a downstream-only patch that can be removed after the next minor
+release.
+
+Signed-off-by: Kevin Wolf <kwolf@redhat.com>
+
+Patch-name: kvm-file-posix-Define-DM_MPATH_PROBE_PATHS.patch
+Patch-id: 41
+Patch-present-in-specfile: True
+---
+ block/file-posix.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/block/file-posix.c b/block/file-posix.c
+index 3c985da94f..076ee7e8b7 100644
+--- a/block/file-posix.c
++++ b/block/file-posix.c
+@@ -149,6 +149,11 @@
+ */
+ #define SG_IO_MAX_RETRIES 8
+
++/* TODO Remove this when the kernel side is merged */
++#if !defined(DM_MPATH_PROBE_PATHS) && defined(DM_GET_TARGET_VERSION)
++#define DM_MPATH_PROBE_PATHS _IO(DM_IOCTL, DM_GET_TARGET_VERSION_CMD + 1)
++#endif
++
+ typedef struct BDRVRawState {
+ int fd;
+ bool use_lock;
+--
+2.55.0
+
diff --git a/0020-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch b/0020-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch
deleted file mode 100644
index d264a5f..0000000
--- a/0020-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From f1ec21d5adafcd06563a6c5404c5d631f470ab0c Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Fri, 20 Aug 2021 18:25:12 +0200
-Subject: qcow2: Deprecation warning when opening v2 images rw
-
-qcow2 v3 has been around for a long time (since QEMU 1.1/RHEL 7), so
-there is no real reason any more to use it. People still using it might
-do so unintentionally. Warn about it and suggest upgrading during the
-RHEL 9 timeframe so that the code can possibly be disabled in RHEL 10.
-
-The warning is restricted to read-write mode and the system emulator.
-The primary motivation for not having it in qemu-img is that 'qemu-img
-amend' for upgrades would warn otherwise. It also avoids having to make
-too many changes to the test suite.
-
-bdrv_uses_whitelist() is used as a proxy for deciding whether we are
-running in a tool or the system emulator. This is not entirely clean,
-but it's what is available and the same function qcow2_do_open() already
-uses it this way for another warning.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/qcow2.c | 6 ++++++
- tests/qemu-iotests/common.filter | 1 +
- 2 files changed, 7 insertions(+)
-
-diff --git a/block/qcow2.c b/block/qcow2.c
-index 4aa9f9e068..6df65aab93 100644
---- a/block/qcow2.c
-+++ b/block/qcow2.c
-@@ -1358,6 +1358,12 @@ qcow2_do_open(BlockDriverState *bs, QDict *options, int flags,
- ret = -ENOTSUP;
- goto fail;
- }
-+ if (header.version < 3 && !bdrv_is_read_only(bs) && bdrv_uses_whitelist()) {
-+ warn_report_once("qcow2 v2 images are deprecated and may not be "
-+ "supported in future versions. Please consider "
-+ "upgrading the image with 'qemu-img amend "
-+ "-o compat=v3'.");
-+ }
-
- s->qcow_version = header.version;
-
-diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
-index 511a55b1e8..35c0fc0d20 100644
---- a/tests/qemu-iotests/common.filter
-+++ b/tests/qemu-iotests/common.filter
-@@ -83,6 +83,7 @@ _filter_qemu()
- {
- gsed -e "s#\\(^\\|(qemu) \\)$(basename $QEMU_PROG):#\1QEMU_PROG:#" \
- -e 's#^QEMU [0-9]\+\.[0-9]\+\.[0-9]\+ monitor#QEMU X.Y.Z monitor#' \
-+ -e "/qcow2 v2 images are deprecated/d" \
- -e $'s#\r##' # QEMU monitor uses \r\n line endings
- }
-
---
-2.39.3
-
diff --git a/0021-file-posix-Define-DM_MPATH_PROBE_PATHS.patch b/0021-file-posix-Define-DM_MPATH_PROBE_PATHS.patch
deleted file mode 100644
index e329fe0..0000000
--- a/0021-file-posix-Define-DM_MPATH_PROBE_PATHS.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 90041be5316257fc98eb62af1e8a927e53d2d612 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Tue, 29 Apr 2025 17:05:41 +0200
-Subject: file-posix: Define DM_MPATH_PROBE_PATHS
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 370: file-posix: Fix multipath failover with SCSI passthrough
-RH-Jira: RHEL-65852
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [1/2] 6680f4a3f15a768b1ca51aafea452c3d0886f12e (kmwolf/centos-qemu-kvm)
-
-While the kernel side isn't merged yet and we're still using old kernel
-headers, just define DM_MPATH_PROBE_PATHS manually.
-
-This is a downstream-only patch that can be removed after the next minor
-release.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-
-Patch-name: kvm-file-posix-Define-DM_MPATH_PROBE_PATHS.patch
-Patch-id: 41
-Patch-present-in-specfile: True
----
- block/file-posix.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/block/file-posix.c b/block/file-posix.c
-index 8c738674ce..cb2e94d7db 100644
---- a/block/file-posix.c
-+++ b/block/file-posix.c
-@@ -156,6 +156,11 @@
- */
- #define SG_IO_MAX_RETRIES 8
-
-+/* TODO Remove this when the kernel side is merged */
-+#if !defined(DM_MPATH_PROBE_PATHS) && defined(DM_GET_TARGET_VERSION)
-+#define DM_MPATH_PROBE_PATHS _IO(DM_IOCTL, DM_GET_TARGET_VERSION_CMD + 1)
-+#endif
-+
- typedef struct BDRVRawState {
- int fd;
- bool use_lock;
---
-2.39.3
-
diff --git a/0021-system-memory-Use-memmove-for-directly-accessible-re.patch b/0021-system-memory-Use-memmove-for-directly-accessible-re.patch
new file mode 100644
index 0000000..696c00c
--- /dev/null
+++ b/0021-system-memory-Use-memmove-for-directly-accessible-re.patch
@@ -0,0 +1,85 @@
+From 701e555f1677bfe42bc9bebf3cba6227b7f698ae Mon Sep 17 00:00:00 2001
+From: Gavin Shan <gshan@redhat.com>
+Date: Sat, 22 Aug 2026 11:26:51 +1000
+Subject: system/memory: Use memmove() for directly accessible regions
+
+RH-Author: Gavin Shan <gshan@redhat.com>
+RH-MergeRequest: 517: memory: Make ram device region directly accessible
+RH-Jira: RHEL-246035
+RH-Acked-by: Sebastian Ott <sebott@redhat.com>
+RH-Acked-by: Eric Auger <eric.auger@redhat.com>
+RH-Commit: [1/3] 4c7b4f5a6aa295707c18678d2c906bb3388a1969 (gwshan/qemu-centos10)
+
+JIRA: https://redhat.atlassian.net/browse/RHEL-246035
+
+Similar to what's done in commit 4a73aee88140 ("softmmu: Use memmove in
+flatview_write_continue"), there are more sites where the overlapping
+source and destination buffer are allowed for the directly accessible
+regions. Use memmove() in those sites, listed as below.
+
+ hw/remote/vfio-user-obj.c::vfu_object_mr_rw
+ include/system/memory.h::address_space_read
+ system/physmem.c::flatview_read_continue_step
+
+Signed-off-by: Gavin Shan <gshan@redhat.com>
+Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
+Reviewed-by: Peter Xu <peterx@redhat.com>
+Link: https://lore.kernel.org/r/20260728031731.286666-2-gshan@redhat.com
+Signed-off-by: Peter Xu <peterx@redhat.com>
+(cherry picked from commit d2d7e63da8e9a6ac4bb23e3ecc1de468530c9437)
+Signed-off-by: Gavin Shan <gshan@redhat.com>
+
+Patch-name: kvm-system-memory-Use-memmove-for-directly-accessible-re.patch
+Patch-id: 482
+Patch-present-in-specfile: True
+---
+ hw/remote/vfio-user-obj.c | 4 ++--
+ include/system/memory.h | 2 +-
+ system/physmem.c | 2 +-
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c
+index 87fa7b6572..ea50270628 100644
+--- a/hw/remote/vfio-user-obj.c
++++ b/hw/remote/vfio-user-obj.c
+@@ -375,9 +375,9 @@ static int vfu_object_mr_rw(MemoryRegion *mr, uint8_t *buf, hwaddr offset,
+ ram_ptr = memory_region_get_ram_ptr(mr);
+
+ if (is_write) {
+- memcpy((ram_ptr + offset), buf, size);
++ memmove((ram_ptr + offset), buf, size);
+ } else {
+- memcpy(buf, (ram_ptr + offset), size);
++ memmove(buf, (ram_ptr + offset), size);
+ }
+
+ return 0;
+diff --git a/include/system/memory.h b/include/system/memory.h
+index 2192fc9bdc..336d4e84a6 100644
+--- a/include/system/memory.h
++++ b/include/system/memory.h
+@@ -2741,7 +2741,7 @@ MemTxResult address_space_read(const AddressSpace *as, hwaddr addr,
+ mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
+ if (len == l && memory_access_is_direct(mr, false, attrs)) {
+ ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
+- memcpy(buf, ptr, len);
++ memmove(buf, ptr, len);
+ } else {
+ result = flatview_read_continue(fv, addr, attrs, buf, len,
+ addr1, l, mr);
+diff --git a/system/physmem.c b/system/physmem.c
+index c21ea92915..2c42e365cb 100644
+--- a/system/physmem.c
++++ b/system/physmem.c
+@@ -3363,7 +3363,7 @@ static MemTxResult flatview_read_continue_step(MemTxAttrs attrs, uint8_t *buf,
+ uint8_t *ram_ptr = qemu_ram_ptr_length(mr->ram_block, mr_addr, l,
+ false, false);
+
+- memcpy(buf, ram_ptr, *l);
++ memmove(buf, ram_ptr, *l);
+
+ return MEMTX_OK;
+ }
+--
+2.55.0
+
diff --git a/0022-system-memory-Use-qemu_ram_move-for-directly-accessi.patch b/0022-system-memory-Use-qemu_ram_move-for-directly-accessi.patch
new file mode 100644
index 0000000..3b5797e
--- /dev/null
+++ b/0022-system-memory-Use-qemu_ram_move-for-directly-accessi.patch
@@ -0,0 +1,261 @@
+From 3f8238112d9d91edd980f5ff27aa826b73789ff6 Mon Sep 17 00:00:00 2001
+From: Gavin Shan <gshan@redhat.com>
+Date: Tue, 28 Jul 2026 13:17:30 +1000
+Subject: system/memory: Use qemu_ram_move() for directly accessible regions
+
+RH-Author: Gavin Shan <gshan@redhat.com>
+RH-MergeRequest: 517: memory: Make ram device region directly accessible
+RH-Jira: RHEL-246035
+RH-Acked-by: Sebastian Ott <sebott@redhat.com>
+RH-Acked-by: Eric Auger <eric.auger@redhat.com>
+RH-Commit: [2/3] e4245fe1ea4ed269832f153ea4772f7848472ba0 (gwshan/qemu-centos10)
+
+All ram device regions were turned to be indirectly accessible by commit
+4a2e242bbb ("memory: Don't use memcpy for ram_device regions"). This leads
+to guest hang on attempt to build 'cuda-samples' as reported by Julia. The
+guest is started by the following command lines, with GH100 GPU card passed
+from the host.
+
+ host$ lspci | grep GH100
+ 0009:01:00.0 3D controller: NVIDIA Corporation GH100 [GH200 120GB / 480GB] (rev a1)
+ host$ /home/sandbox/gavin/qemu.main/build/qemu-system-aarch64 \
+ -machine virt,gic-version=host,ras=on,highmem-mmio-size=4T \
+ -accel kvm -cpu host -smp cpus=48 -m size=8G \
+ -drive file=/home/gavin/sandbox/images/disk.qcow2,if=none,id=d0 \
+ -device virtio-blk-pci,id=vb0,bus=pcie.0,drive=d0,num-queues=4 \
+ -device vfio-pci-nohotplug,host=0009:01:00.0,bus=pcie.1.0
+ :
+ guest$ cd cuda-samples/build
+ guest$ make -j 20 clean
+ guest$ make -j 20
+ :
+ [ 54%] Linking CUDA executable graphMemoryNodes
+ [ 54%] Built target graphMemoryNodes
+ <no more output afterwards, guest becomes frozen here>
+
+ guest$ qemu-system-aarch64: virtio: bogus descriptor or out of resources
+ [ 555.814025] virtio_blk virtio0: [vda] new size: 268435456 512-byte logical blocks (137 GB/128 GiB)
+
+When the GPU's driver (NVidia open driver) is loaded on guest bootup,
+the memory blocks residing in the PCI BAR#4 of the GH100 GPU card can
+be presented to the guest through memory hot-add. The page cache can
+then be allocated from the hot added memory blocks when cuda-samples
+is being built. Afterwards, the page cache is sent to QEMU's virtio-blk
+device as part of the DMA request, the bounce buffer has to be used to
+accomodate the request as the corresponding memory region (MemoryRegion)
+is an indirectly accessible ram device region in qemu. However, the max
+bounce bufer size is only 4096 bytes by default and that is exhausted
+quickly, leading to a reset on the virtio-blk device and frozen guest
+eventually.
+
+ QEMU
+ ====
+ virtio_blk_handle_output
+ virtio_blk_handle_vq
+ virtio_blk_get_request
+ virtqueue_pop
+ virtqueue_split_pop
+ virtqueue_map_desc
+ address_space_map
+ memory_access_is_direct # Return false
+ memory_region_supports_direct_access
+
+ (qemu) info mtree
+ memory-region: pci_bridge_pci
+ 0000000000000000-ffffffffffffffff (prio 0, container): pci_bridge_pci
+ 0000042000000000-0000043fffffffff (prio 1, i/o): 0009:01:00.0 base BAR 4
+ 0000042000000000-0000043fffffffff (prio 0, i/o): 0009:01:00.0 BAR 4
+ 0000042000000000-000004379fffffff (prio 0, ramd): 0009:01:00.0 BAR 4 mmaps[0]
+
+This adds qemu_ram_move() where the aligned and small-sized accesses are
+handled by qatomics, and fall back to memmove() otherwise. The memove()
+for the directly accessible regions is replaced by qemu_ram_move() so that
+the issue covered by commit 4a2e242bbb (MMIO access instructions were
+optimized to SSE instructions) is fixed. This makes 'ram_device_mem_ops'
+redundant, paving the way to revert that commit to make the ram device
+region directly accessible again in the next patch.
+
+Besides, this also fixes the issue of the unexpected frozen reception on
+e1000 NIC in the scenario of DPDK due to the wrong Rx queue full indication
+caused by the following memcpy(), which is turned to 3 consective 'strb'
+instructions to the same location by glibc-2.24+ for aarch64. With this
+applied, the syntax of one-byte store is strictly ensured by a one-byte
+qatomic set.
+
+ QEMU
+ ====
+ e1000_receive_iov
+ pci_dma_write
+ pci_dma_rw
+ dma_memory_rw
+ dma_memory_rw_relaxed
+ address_space_rw
+ address_space_write
+ flatview_write
+ flatview_write_continue
+ flatview_write_continue_step
+ memcpy # 3 consective 'strb' instructions
+
+Reported-by: Julia Graham <jugraham@redhat.com>
+Reported-by: Liu Gang <liugang24219@sangfor.com.cn>
+Reported-by: Ding Hui <dinghui@sangfor.com.cn>
+Suggested-by: Michael S. Tsirkin <mst@redhat.com>
+Suggested-by: Peter Xu <peterx@redhat.com>
+Suggested-by: Richard Henderson <richard.henderson@linaro.org>
+Suggested-by: Peter Maydell <peter.maydell@linaro.org>
+Signed-off-by: Gavin Shan <gshan@redhat.com>
+Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
+Link: https://lore.kernel.org/r/20260728031731.286666-3-gshan@redhat.com
+[peterx: remove src==dst check, fix doc, enhance comments, per PeterM, add R-b]
+Signed-off-by: Peter Xu <peterx@redhat.com>
+---
+ hw/remote/vfio-user-obj.c | 4 ++--
+ include/system/memory.h | 35 +++++++++++++++++++++++++++-
+ system/physmem.c | 48 +++++++++++++++++++++++++++++++++++++--
+ 3 files changed, 82 insertions(+), 5 deletions(-)
+
+diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c
+index ea50270628..a0498d218f 100644
+--- a/hw/remote/vfio-user-obj.c
++++ b/hw/remote/vfio-user-obj.c
+@@ -375,9 +375,9 @@ static int vfu_object_mr_rw(MemoryRegion *mr, uint8_t *buf, hwaddr offset,
+ ram_ptr = memory_region_get_ram_ptr(mr);
+
+ if (is_write) {
+- memmove((ram_ptr + offset), buf, size);
++ qemu_ram_move((ram_ptr + offset), buf, size);
+ } else {
+- memmove(buf, (ram_ptr + offset), size);
++ qemu_ram_move(buf, (ram_ptr + offset), size);
+ }
+
+ return 0;
+diff --git a/include/system/memory.h b/include/system/memory.h
+index 336d4e84a6..4de5bf2577 100644
+--- a/include/system/memory.h
++++ b/include/system/memory.h
+@@ -2668,6 +2668,39 @@ void address_space_register_map_client(AddressSpace *as, QEMUBH *bh);
+ void address_space_unregister_map_client(AddressSpace *as, QEMUBH *bh);
+
+ /* Internal functions, part of the implementation of address_space_read. */
++
++/**
++ * qemu_ram_move: move data from or to ramblock
++ *
++ * @dst: destination where the data is moved to
++ * @src: source where the data is moved from
++ * @n: length of data to be moved
++ *
++ * Move @n bytes from @src to @dst, the memory areas may overlap. This
++ * provides the same semantics as memmove(), plus an additional stronger
++ * guarantee: if @n is 1, 2 or 4 or 8 bytes, and @src and @dst are both
++ * naturally aligned for that access size, then both the load and the store
++ * will be done as a single atomic access (with the semantics of
++ * qatomic_read() and qatomic_set()).
++ *
++ * This is the underlying function that we use to implement accesses by
++ * a guest vCPU or a device DMA operation to a ram block. The atomic
++ * guarantee is needed for two major cases: (A) When the ram block is
++ * backed by a PCI BAR passed through from a host device (and so it might
++ * be hardware registers that must be accessed exactly once at the right
++ * width); (B) When an emulated device updates a data structure shared in
++ * guest memory with guest software (e.g. a network device's set of tx and
++ * rx descriptor blocks), if a write to memory is accidentally performed
++ * multiple times then it can break the guest code when it busy polls the
++ * guest memory.
++ *
++ * We don't attempt to perform the exact access when it would be unaligned
++ * because this can't be done on all host architectures. Although this is
++ * strictly speaking not doing what would happen on real hardware, we don't
++ * think there are going to be situations where that matters in practice.
++ */
++void qemu_ram_move(void *dst, const void *src, size_t n);
++
+ MemTxResult address_space_read_full(const AddressSpace *as, hwaddr addr,
+ MemTxAttrs attrs, void *buf, hwaddr len);
+ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
+@@ -2741,7 +2774,7 @@ MemTxResult address_space_read(const AddressSpace *as, hwaddr addr,
+ mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
+ if (len == l && memory_access_is_direct(mr, false, attrs)) {
+ ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
+- memmove(buf, ptr, len);
++ qemu_ram_move(buf, ptr, len);
+ } else {
+ result = flatview_read_continue(fv, addr, attrs, buf, len,
+ addr1, l, mr);
+diff --git a/system/physmem.c b/system/physmem.c
+index 2c42e365cb..2f37cbeb07 100644
+--- a/system/physmem.c
++++ b/system/physmem.c
+@@ -3158,6 +3158,50 @@ void memory_region_flush_rom_device(MemoryRegion *mr, hwaddr addr, hwaddr size)
+ invalidate_and_set_dirty(mr, addr, size);
+ }
+
++void qemu_ram_move(void *dst, const void *src, size_t n)
++{
++ uintptr_t test, len;
++
++ if (n == 0) {
++ return;
++ }
++
++ /*
++ * Calculate "the lowest set bit" over @src, @dst and @n, result put
++ * into @len (which guarantees a power-of-two). With that and the
++ * later check (len!=n), it makes sure that we will only do the atomic
++ * ops when:
++ *
++ * (1) @n is a power-of-two
++ * (2) @src and @dst addresses are both aligned to @n
++ */
++ test = (uintptr_t)src | (uintptr_t)dst | n;
++ len = test & -test;
++
++ /* Overlapping buffers, unaligned or oversized access */
++ if (n > 8 || len != n) {
++ memmove(dst, src, n);
++ return;
++ }
++
++ switch (len) {
++ case 1:
++ qatomic_set((uint8_t *)dst, qatomic_read((uint8_t *)src));
++ break;
++ case 2:
++ qatomic_set((uint16_t *)dst, qatomic_read((uint16_t *)src));
++ break;
++ case 4:
++ qatomic_set((uint32_t *)dst, qatomic_read((uint32_t *)src));
++ break;
++ case 8:
++ qatomic_set((uint64_t *)dst, qatomic_read((uint64_t *)src));
++ break;
++ default:
++ g_assert_not_reached();
++ }
++}
++
+ int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr)
+ {
+ unsigned access_size_max = mr->ops->valid.max_access_size;
+@@ -3270,7 +3314,7 @@ static MemTxResult flatview_write_continue_step(MemTxAttrs attrs,
+ uint8_t *ram_ptr = qemu_ram_ptr_length(mr->ram_block, mr_addr, l,
+ false, true);
+
+- memmove(ram_ptr, buf, *l);
++ qemu_ram_move(ram_ptr, buf, *l);
+ invalidate_and_set_dirty(mr, mr_addr, *l);
+
+ return MEMTX_OK;
+@@ -3363,7 +3407,7 @@ static MemTxResult flatview_read_continue_step(MemTxAttrs attrs, uint8_t *buf,
+ uint8_t *ram_ptr = qemu_ram_ptr_length(mr->ram_block, mr_addr, l,
+ false, false);
+
+- memmove(buf, ram_ptr, *l);
++ qemu_ram_move(buf, ram_ptr, *l);
+
+ return MEMTX_OK;
+ }
+--
+2.55.0
+
diff --git a/0023-system-memory-Make-ram-device-region-directly-access.patch b/0023-system-memory-Make-ram-device-region-directly-access.patch
new file mode 100644
index 0000000..77e21ad
--- /dev/null
+++ b/0023-system-memory-Make-ram-device-region-directly-access.patch
@@ -0,0 +1,131 @@
+From 179c60c1c1cad5e6c8cd629abf659b1e9956d617 Mon Sep 17 00:00:00 2001
+From: Gavin Shan <gshan@redhat.com>
+Date: Tue, 28 Jul 2026 13:17:31 +1000
+Subject: system/memory: Make ram device region directly accessible
+
+RH-Author: Gavin Shan <gshan@redhat.com>
+RH-MergeRequest: 517: memory: Make ram device region directly accessible
+RH-Jira: RHEL-246035
+RH-Acked-by: Sebastian Ott <sebott@redhat.com>
+RH-Acked-by: Eric Auger <eric.auger@redhat.com>
+RH-Commit: [3/3] 853127b4ff1b8b834c958791d1d6f78dde4d0e0e (gwshan/qemu-centos10)
+
+This basically reverts 4a2e242bbb30 ("memory: Don't use memcpy for
+ram_device regions") to make ram device region directly accessible
+again. With this, the bounce buffer is bypassed in address_space_map()
+when a ram device region is involved, potentially avoid to overrun
+the (small) bounce buffer.
+
+Reported-by: Julia Graham <jugraham@redhat.com>
+Suggested-by: Michael S. Tsirkin <mst@redhat.com>
+Suggested-by: Peter Xu <peterx@redhat.com>
+Suggested-by: Richard Henderson <richard.henderson@linaro.org>
+Suggested-by: Peter Maydell <peter.maydell@linaro.org>
+Signed-off-by: Gavin Shan <gshan@redhat.com>
+Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
+Link: https://lore.kernel.org/r/20260728031731.286666-4-gshan@redhat.com
+Signed-off-by: Peter Xu <peterx@redhat.com>
+---
+ include/system/memory.h | 11 ++---------
+ system/memory.c | 41 +----------------------------------------
+ system/trace-events | 2 --
+ 3 files changed, 3 insertions(+), 51 deletions(-)
+
+diff --git a/include/system/memory.h b/include/system/memory.h
+index 4de5bf2577..1dc761058f 100644
+--- a/include/system/memory.h
++++ b/include/system/memory.h
+@@ -2718,15 +2718,8 @@ static inline bool memory_region_supports_direct_access(const MemoryRegion *mr)
+ if (memory_region_is_romd(mr)) {
+ return true;
+ }
+- if (!memory_region_is_ram(mr)) {
+- return false;
+- }
+- /*
+- * RAM DEVICE regions can be accessed directly using memcpy, but it might
+- * be MMIO and access using mempy can be wrong (e.g., using instructions not
+- * intended for MMIO access). So we treat this as IO.
+- */
+- return !memory_region_is_ram_device(mr);
++
++ return memory_region_is_ram(mr);
+ }
+
+ static inline bool memory_access_is_direct(const MemoryRegion *mr,
+diff --git a/system/memory.c b/system/memory.c
+index 5fc36708ec..da710bbade 100644
+--- a/system/memory.c
++++ b/system/memory.c
+@@ -1364,43 +1364,6 @@ const MemoryRegionOps unassigned_mem_ops = {
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ };
+
+-static uint64_t memory_region_ram_device_read(void *opaque,
+- hwaddr addr, unsigned size)
+-{
+- MemoryRegion *mr = opaque;
+- uint64_t data = ldn_he_p(mr->ram_block->host + addr, size);
+-
+- trace_memory_region_ram_device_read(get_cpu_index(), mr, addr, data, size);
+-
+- return data;
+-}
+-
+-static void memory_region_ram_device_write(void *opaque, hwaddr addr,
+- uint64_t data, unsigned size)
+-{
+- MemoryRegion *mr = opaque;
+-
+- trace_memory_region_ram_device_write(get_cpu_index(), mr, addr, data, size);
+-
+- stn_he_p(mr->ram_block->host + addr, size, data);
+-}
+-
+-static const MemoryRegionOps ram_device_mem_ops = {
+- .read = memory_region_ram_device_read,
+- .write = memory_region_ram_device_write,
+- .endianness = HOST_BIG_ENDIAN ? DEVICE_BIG_ENDIAN : DEVICE_LITTLE_ENDIAN,
+- .valid = {
+- .min_access_size = 1,
+- .max_access_size = 8,
+- .unaligned = true,
+- },
+- .impl = {
+- .min_access_size = 1,
+- .max_access_size = 8,
+- .unaligned = true,
+- },
+-};
+-
+ bool memory_region_access_valid(MemoryRegion *mr,
+ hwaddr addr,
+ unsigned size,
+@@ -1692,10 +1655,8 @@ void memory_region_init_ram_device_ptr(MemoryRegion *mr, Object *owner,
+ const char *name, uint64_t size,
+ void *ptr)
+ {
+- memory_region_init_io(mr, owner, &ram_device_mem_ops, mr, name, size);
+- mr->ram = true;
++ memory_region_init_ram_ptr(mr, owner, name, size, ptr);
+ mr->ram_device = true;
+- memory_region_set_ram_ptr(mr, size, ptr);
+ }
+
+ void memory_region_init_alias(MemoryRegion *mr, Object *owner,
+diff --git a/system/trace-events b/system/trace-events
+index 51b4a4679a..d483b31419 100644
+--- a/system/trace-events
++++ b/system/trace-events
+@@ -20,8 +20,6 @@ memory_region_ops_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, u
+ memory_region_ops_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size, const char *name) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u name '%s'"
+ memory_region_subpage_read(int cpu_index, void *mr, uint64_t offset, uint64_t value, unsigned size) "cpu %d mr %p offset 0x%"PRIx64" value 0x%"PRIx64" size %u"
+ memory_region_subpage_write(int cpu_index, void *mr, uint64_t offset, uint64_t value, unsigned size) "cpu %d mr %p offset 0x%"PRIx64" value 0x%"PRIx64" size %u"
+-memory_region_ram_device_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u"
+-memory_region_ram_device_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u"
+ memory_region_sync_dirty(const char *mr, const char *listener, int global) "mr '%s' listener '%s' synced (global=%d)"
+ flatview_new(void *view, void *root) "%p (root %p)"
+ flatview_destroy(void *view, void *root) "%p (root %p)"
+--
+2.55.0
+
diff --git a/0024-qga-Change-effective-user-group-ID-in-guest-ssh-comm.patch b/0024-qga-Change-effective-user-group-ID-in-guest-ssh-comm.patch
new file mode 100644
index 0000000..57b7c84
--- /dev/null
+++ b/0024-qga-Change-effective-user-group-ID-in-guest-ssh-comm.patch
@@ -0,0 +1,202 @@
+From 573f2bc749882d99a002db58556566b6f4e6c1ed Mon Sep 17 00:00:00 2001
+From: Kostiantyn Kostiuk <kkostiuk@redhat.com>
+Date: Mon, 10 Aug 2026 17:28:18 +0300
+Subject: qga: Change effective user/group ID in guest-ssh-* commands
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+RH-Author: Jon Maloy <jmaloy@redhat.com>
+RH-MergeRequest: 520: qga: Change effective user/group ID in guest-ssh-* commands
+RH-Jira: RHEL-212576
+RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
+RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
+RH-Commit: [1/1] ada4b7e56ddb006a476e8debf7ea5296e2725b1e (jmaloy/jmaloy-qemu-kvm-2)
+
+JIRA: https://issues.redhat.com/browse/RHEL-212576
+CVE: CVE-2026-12080
+Conflicts: none
+
+commit 7e5c85f7f2a84dc695e70a63d0737ef481cef1a6
+Author: Kostiantyn Kostiuk <kkostiuk@redhat.com>
+Date: Mon Aug 10 17:28:18 2026 +0300
+
+ qga: Change effective user/group ID in guest-ssh-* commands
+
+ Before this commit, when qmp_guest_ssh_add_authorized_keys adds an
+ SSH key for an existing local user, the agent (running as root) decides
+ whether to create the user's .ssh directory with a symlink-following
+ directory test, and then writes and chowns the authorized_keys file.
+ A local unprivileged user who owns their home directory can pre-stage
+ their .ssh directory (or the authorized_keys file) as a symbolic link
+ so that, when the host or operator triggers a key add for that user,
+ the root agent follows the link and transfers ownership of an arbitrary
+ root-owned file or directory to the unprivileged user, who can then rewrite
+ it to obtain root.
+
+ Fixes: CVE-2026-12080
+ Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/3929
+
+ v1: https://patchew.org/QEMU/20260709105707.91209-1-kkostiuk@redhat.com/
+ v2 -> v1:
+ Change effective user/group ID instead of checking for symlinks and
+ changing ownership of the file.
+
+ v2: https://patchew.org/QEMU/20260810104659.82320-1-kkostiuk@redhat.com
+ v3 -> v2:
+ Deduplicate code.
+ Fail daemon when can't rollback effective user/group ID.
+
+ v3: https://patchew.org/QEMU/20260810140641.161728-1-kkostiuk@redhat.com/
+ v4 -> v3:
+ Added comment about assert in rollback_effective_info
+ Fix memory leak in rollback_effective_info
+
+ Reported-by: Valentino Paulon <valentino.paulon88@gmail.com>
+ Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
+ Link: https://lore.kernel.org/qemu-devel/20260810142818.170418-1-kkostiuk@redhat.com
+ Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
+
+Signed-off-by: Jon Maloy <jmaloy@redhat.com>
+---
+ qga/commands-posix-ssh.c | 71 ++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 71 insertions(+)
+
+diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c
+index 661972e34e..aa3411049f 100644
+--- a/qga/commands-posix-ssh.c
++++ b/qga/commands-posix-ssh.c
+@@ -8,11 +8,34 @@
+ #include <glib/gstdio.h>
+ #include <locale.h>
+ #include <pwd.h>
++#include <grp.h>
+
+ #include "commands-common-ssh.h"
+ #include "qapi/error.h"
+ #include "qga-qapi-commands.h"
+
++typedef struct EffectiveUserInfo {
++ uid_t uid;
++ gid_t gid;
++} EffectiveUserInfo;
++
++typedef EffectiveUserInfo *PEffectiveUserInfo;
++
++static void rollback_effective_info(PEffectiveUserInfo info)
++{
++ if (info) {
++ /* There is nothing to do in case when rollback to original user/group IDs
++ * fails. In that case, the process will be terminated by the kernel
++ * and systemd should restart the daemon again.
++ */
++ assert(seteuid(info->uid) == 0);
++ assert(setegid(info->gid) == 0);
++ g_free(info);
++ }
++}
++
++G_DEFINE_AUTO_CLEANUP_FREE_FUNC(PEffectiveUserInfo, rollback_effective_info, NULL);
++
+ #ifdef QGA_BUILD_UNIT_TEST
+ static struct passwd *
+ test_get_passwd_entry(const gchar *user_name, GError **error)
+@@ -112,6 +135,36 @@ write_authkeys(const char *path, const GStrv keys,
+ return true;
+ }
+
++static PEffectiveUserInfo set_privileges_to_user(const struct passwd *p, Error **errp)
++{
++ g_auto(PEffectiveUserInfo) info = g_new0(EffectiveUserInfo, 1);
++
++ info->uid = geteuid();
++ info->gid = getegid();
++
++#ifndef QGA_BUILD_UNIT_TEST
++ /* The initgroups requires CAP_SETGID. During build time unit tests, we can't do this. */
++ if (initgroups(p->pw_name, p->pw_gid) == -1) {
++ error_setg_errno(errp, errno, "failed to set group for user '%s'",
++ p->pw_name);
++ return NULL;
++ }
++#endif
++
++ if (setegid(p->pw_gid) == -1) {
++ error_setg_errno(errp, errno, "failed to set effective group ID for user '%s'",
++ p->pw_name);
++ return NULL;
++ }
++ if (seteuid(p->pw_uid) == -1) {
++ error_setg_errno(errp, errno, "failed to set effective user ID for user '%s'",
++ p->pw_name);
++ return NULL;
++ }
++
++ return g_steal_pointer(&info);
++}
++
+ void
+ qmp_guest_ssh_add_authorized_keys(const char *username, strList *keys,
+ bool has_reset, bool reset,
+@@ -123,6 +176,7 @@ qmp_guest_ssh_add_authorized_keys(const char *username, strList *keys,
+ g_auto(GStrv) authkeys = NULL;
+ strList *k;
+ size_t nkeys, nauthkeys;
++ g_auto(PEffectiveUserInfo) effective_user_info = NULL;
+
+ reset = has_reset && reset;
+
+@@ -135,6 +189,11 @@ qmp_guest_ssh_add_authorized_keys(const char *username, strList *keys,
+ return;
+ }
+
++ effective_user_info = set_privileges_to_user(p, errp);
++ if (effective_user_info == NULL) {
++ return;
++ }
++
+ ssh_path = g_build_filename(p->pw_dir, ".ssh", NULL);
+ authkeys_path = g_build_filename(ssh_path, "authorized_keys", NULL);
+
+@@ -172,6 +231,7 @@ qmp_guest_ssh_remove_authorized_keys(const char *username, strList *keys,
+ g_auto(GStrv) authkeys = NULL;
+ GStrv a;
+ size_t nkeys = 0;
++ g_auto(PEffectiveUserInfo) effective_user_info = NULL;
+
+ if (!check_openssh_pub_keys(keys, NULL, errp)) {
+ return;
+@@ -182,6 +242,11 @@ qmp_guest_ssh_remove_authorized_keys(const char *username, strList *keys,
+ return;
+ }
+
++ effective_user_info = set_privileges_to_user(p, errp);
++ if (effective_user_info == NULL) {
++ return;
++ }
++
+ authkeys_path = g_build_filename(p->pw_dir, ".ssh",
+ "authorized_keys", NULL);
+ if (!g_file_test(authkeys_path, G_FILE_TEST_EXISTS)) {
+@@ -219,12 +284,18 @@ qmp_guest_ssh_get_authorized_keys(const char *username, Error **errp)
+ g_auto(GStrv) authkeys = NULL;
+ g_autoptr(GuestAuthorizedKeys) ret = NULL;
+ int i;
++ g_auto(PEffectiveUserInfo) effective_user_info = NULL;
+
+ p = get_passwd_entry(username, errp);
+ if (p == NULL) {
+ return NULL;
+ }
+
++ effective_user_info = set_privileges_to_user(p, errp);
++ if (effective_user_info == NULL) {
++ return NULL;
++ }
++
+ authkeys_path = g_build_filename(p->pw_dir, ".ssh",
+ "authorized_keys", NULL);
+ authkeys = read_authkeys(authkeys_path, errp);
+--
+2.55.0
+
diff --git a/0026-Add-new-compat-handling.patch b/0026-Add-new-compat-handling.patch
new file mode 100644
index 0000000..a945d2e
--- /dev/null
+++ b/0026-Add-new-compat-handling.patch
@@ -0,0 +1,142 @@
+From ff404093052572c8c2a591bade1d98510d381c9f Mon Sep 17 00:00:00 2001
+From: Miroslav Rezanina <mrezanin@redhat.com>
+Date: Wed, 7 Jan 2026 08:27:32 +0100
+Subject: Add new compat handling
+
+Adding upstream compatibility handling for downstream machine types.
+
+Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
+---
+ hw/arm/virt.c | 1 +
+ hw/core/machine.c | 40 +++++++++++++++++++++++++++++++++++++-
+ hw/i386/pc_piix.c | 2 ++
+ hw/i386/pc_q35.c | 2 ++
+ hw/s390x/s390-virtio-ccw.c | 1 +
+ include/hw/core/boards.h | 3 +++
+ 6 files changed, 48 insertions(+), 1 deletion(-)
+
+diff --git a/hw/arm/virt.c b/hw/arm/virt.c
+index 9939db7e6f..5290ff34bc 100644
+--- a/hw/arm/virt.c
++++ b/hw/arm/virt.c
+@@ -4682,6 +4682,7 @@ DEFINE_VIRT_MACHINE(5, 0)
+
+ static void virt_rhel_machine_10_2_0_options(MachineClass *mc)
+ {
++ compat_props_add(mc->compat_props, hw_compat_rhel_10_3, hw_compat_rhel_10_3_len);
+ }
+ DEFINE_VIRT_MACHINE_AS_LATEST(10, 2, 0)
+
+diff --git a/hw/core/machine.c b/hw/core/machine.c
+index fb5cd5ff96..3f9efc0f74 100644
+--- a/hw/core/machine.c
++++ b/hw/core/machine.c
+@@ -233,6 +233,44 @@ const size_t hw_compat_4_1_len = G_N_ELEMENTS(hw_compat_4_1);
+ const char *rhel_old_machine_deprecation =
+ "machine types for previous major releases are deprecated";
+
++GlobalProperty hw_compat_rhel_10_3[] = {
++ /* hw_compat_rhel_10_3 from hw_compat_11_0 */
++ { "virtio-mmio", VIRTIO_QUEUE_SIZE_OVERRIDE, "1024" },
++ /* hw_compat_rhel_10_3 from hw_compat_11_0 */
++ { "chardev-vc", "encoding", "cp437" },
++ /* hw_compat_rhel_10_3 from hw_compat_11_0 */
++ { "tpm-crb", "cap-chunk", "off" },
++ /* hw_compat_rhel_10_3 from hw_compat_11_0 */
++ { "tpm-crb", "x-allow-chunk-migration", "off" },
++ /* hw_compat_rhel_10_3 from hw_compat_11_0 */
++ { "tpm-tis-device", "ppi", "off" },
++ /* hw_compat_rhel_10_3 from hw_compat_11_0 */
++ { TYPE_ARM_SMMUV3, "ats", "off" },
++ /* hw_compat_rhel_10_3 from hw_compat_11_0 */
++ { TYPE_ARM_SMMUV3, "ril", "on" },
++ /* hw_compat_rhel_10_3 from hw_compat_11_0 */
++ { TYPE_ARM_SMMUV3, "ssidsize", "0" },
++ /* hw_compat_rhel_10_3 from hw_compat_11_0 */
++ { TYPE_ARM_SMMUV3, "oas", "44" },
++ /* hw_compat_rhel_10_3 from hw_compat_11_0 */
++ { "migration", "switchover-ack-legacy", "on" },
++ /* hw_compat_rhel_10_3 from hw_compat_10_2 */
++ { "scsi-block", "migrate-pr", "off" },
++ /* hw_compat_rhel_10_3 from hw_compat_10_2 */
++ { "isa-cirrus-vga", "global-vmstate", "true" },
++ /* hw_compat_rhel_10_3 from hw_compat_10_1 */
++ { TYPE_ACPI_GED, "x-has-hest-addr", "false" },
++ /* hw_compat_rhel_10_3 from hw_compat_10_1 */
++ { TYPE_VIRTIO_NET, "host_tunnel", "off" },
++ /* hw_compat_rhel_10_3 from hw_compat_10_1 */
++ { TYPE_VIRTIO_NET, "host_tunnel_csum", "off" },
++ /* hw_compat_rhel_10_3 from hw_compat_10_1 */
++ { TYPE_VIRTIO_NET, "guest_tunnel", "off" },
++ /* hw_compat_rhel_10_3 from hw_compat_10_1 */
++ { TYPE_VIRTIO_NET, "guest_tunnel_csum", "off" },
++};
++const size_t hw_compat_rhel_10_3_len = G_N_ELEMENTS(hw_compat_rhel_10_3);
++
+ GlobalProperty hw_compat_rhel_10_2[] = {
+ { "scsi-block", "migrate-pr", "off" },
+ /* hw_compat_rhel_10_2 from hw_compat_10_0 */
+@@ -244,7 +282,7 @@ GlobalProperty hw_compat_rhel_10_2[] = {
+ /* hw_compat_rhel_10_2 from hw_compat_10_0 */
+ { "vfio-pci-nohotplug", "use-legacy-x86-rom", "true" },
+ };
+-const size_t hw_compat_rhel_10_2_len = G_N_ELEMENTS(hw_compat_10_0);
++const size_t hw_compat_rhel_10_2_len = G_N_ELEMENTS(hw_compat_rhel_10_2);
+
+ GlobalProperty hw_compat_rhel_10_1[] = {
+ /* hw_compat_rhel_10_1 from hw_compat_9_1 */
+diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
+index 9277700569..279b5b73d9 100644
+--- a/hw/i386/pc_piix.c
++++ b/hw/i386/pc_piix.c
+@@ -704,6 +704,8 @@ static void pc_i440fx_rhel_machine_10_0_0_options(MachineClass *m)
+ m->desc = "RHEL 10.0.0 PC (i440FX + PIIX, 1996)";
+ m->deprecation_reason = rhel_old_machine_deprecation;
+
++ compat_props_add(m->compat_props, hw_compat_rhel_10_3,
++ hw_compat_rhel_10_3_len);
+ compat_props_add(m->compat_props, hw_compat_rhel_10_2,
+ hw_compat_rhel_10_2_len);
+ compat_props_add(m->compat_props, hw_compat_rhel_10_1,
+diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
+index edfd2ab5ee..7d77f1b675 100644
+--- a/hw/i386/pc_q35.c
++++ b/hw/i386/pc_q35.c
+@@ -615,6 +615,8 @@ static void pc_q35_rhel_machine_10_2_0_options(MachineClass *m)
+ m->desc = "RHEL-10.2.0 PC (Q35 + ICH9, 2009)";
+ pcmc->smbios_stream_product = "RHEL";
+ pcmc->smbios_stream_version = "10.2.0";
++ compat_props_add(m->compat_props, hw_compat_rhel_10_3,
++ hw_compat_rhel_10_3_len);
+ }
+ DEFINE_Q35_MACHINE_AS_LATEST(10, 2, 0);
+
+diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
+index a3edbbd7e2..2799cd9e4a 100644
+--- a/hw/s390x/s390-virtio-ccw.c
++++ b/hw/s390x/s390-virtio-ccw.c
+@@ -1209,6 +1209,7 @@ static void ccw_rhel_machine_10_2_0_instance_options(MachineState *machine)
+
+ static void ccw_rhel_machine_10_2_0_class_options(MachineClass *mc)
+ {
++ compat_props_add(mc->compat_props, hw_compat_rhel_10_3, hw_compat_rhel_10_3_len);
+ }
+ DEFINE_CCW_MACHINE_AS_LATEST(10, 2, 0);
+
+diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h
+index bb8ed22942..3dba2e5f89 100644
+--- a/include/hw/core/boards.h
++++ b/include/hw/core/boards.h
+@@ -873,6 +873,9 @@ extern const size_t hw_compat_4_2_len;
+ extern GlobalProperty hw_compat_4_1[];
+ extern const size_t hw_compat_4_1_len;
+
++extern GlobalProperty hw_compat_rhel_10_3[];
++extern const size_t hw_compat_rhel_10_3_len;
++
+ extern GlobalProperty hw_compat_rhel_10_2[];
+ extern const size_t hw_compat_rhel_10_2_len;
+
+--
+2.55.0
+
diff --git a/0027-hw-arm-virt-allow-to-dynamically-apply-kvm-psci-vers.patch b/0027-hw-arm-virt-allow-to-dynamically-apply-kvm-psci-vers.patch
new file mode 100644
index 0000000..ff4b412
--- /dev/null
+++ b/0027-hw-arm-virt-allow-to-dynamically-apply-kvm-psci-vers.patch
@@ -0,0 +1,64 @@
+From 813721fa11590531d8e7a8ddd9fa09204c04dcfe Mon Sep 17 00:00:00 2001
+From: Sebastian Ott <sebott@redhat.com>
+Date: Thu, 2 Apr 2026 06:41:48 -0400
+Subject: hw/arm/virt: allow to dynamically apply kvm-psci-version property
+
+RH-Author: Sebastian Ott <sebott@redhat.com>
+RH-MergeRequest: 543: Draft: hw/arm/virt: ensure machine type compatibility
+RH-Commit: [1/2] 5557d81ed627a7133eecefe8e909f4056d5301d2
+
+Setting kvm-psci-version via machine types is tricky when the machine
+is used in a context without kvm - e.g. via qtests. Allow to set that
+property dynamically in machvirt_init().
+
+This will be used in machine type compat code to keep PSCI version at
+1.1 .
+
+Signed-off-by: Sebastian Ott <sebott@redhat.com>
+---
+ hw/arm/virt.c | 9 +++++++++
+ include/hw/arm/virt.h | 1 +
+ 2 files changed, 10 insertions(+)
+
+diff --git a/hw/arm/virt.c b/hw/arm/virt.c
+index 5290ff34bc..08c9452680 100644
+--- a/hw/arm/virt.c
++++ b/hw/arm/virt.c
+@@ -96,6 +96,7 @@
+ #include "hw/cxl/cxl_host.h"
+ #include "qemu/guest-random.h"
+ #include "hw/watchdog/sbsa_gwdt.h"
++#include <linux/psci.h>
+
+ static GlobalProperty arm_virt_compat_defaults[] = {
+ { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "48" },
+@@ -3102,6 +3103,14 @@ static void machvirt_init(MachineState *machine)
+ object_property_set_bool(cpuobj, "kvm-steal-time", false, NULL);
+ }
+
++ if (vmc->psci_version &&
++ object_property_find(cpuobj, "kvm-psci-version")) {
++ g_autofree char *str = g_strdup_printf("%d.%d",
++ (int) PSCI_VERSION_MAJOR(vmc->psci_version),
++ (int) PSCI_VERSION_MINOR(vmc->psci_version));
++ object_property_set_str(cpuobj, "kvm-psci-version", str, NULL);
++ }
++
+ if (vmc->no_tcg_lpa2 && object_property_find(cpuobj, "lpa2")) {
+ object_property_set_bool(cpuobj, "lpa2", false, NULL);
+ }
+diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
+index 23b464fe04..5c11bf9977 100644
+--- a/include/hw/arm/virt.h
++++ b/include/hw/arm/virt.h
+@@ -145,6 +145,7 @@ typedef enum VirtGICType {
+
+ struct VirtMachineClass {
+ MachineClass parent;
++ uint32_t psci_version;
+ bool no_tcg_its;
+ bool no_highmem_compact;
+ bool no_kvm_steal_time;
+--
+2.55.0
+
diff --git a/0028-hw-arm-virt-ensure-machine-type-compatibility.patch b/0028-hw-arm-virt-ensure-machine-type-compatibility.patch
new file mode 100644
index 0000000..cf07272
--- /dev/null
+++ b/0028-hw-arm-virt-ensure-machine-type-compatibility.patch
@@ -0,0 +1,36 @@
+From 978e6c89b17bb9b62611a0c48ba205694310412d Mon Sep 17 00:00:00 2001
+From: Sebastian Ott <sebott@redhat.com>
+Date: Thu, 2 Apr 2026 06:45:51 -0400
+Subject: hw/arm/virt: ensure machine type compatibility
+
+RH-Author: Sebastian Ott <sebott@redhat.com>
+RH-MergeRequest: 543: Draft: hw/arm/virt: ensure machine type compatibility
+RH-Commit: [2/2] b850f3939ff55246dc3c150838f2a7ccd88d52e8
+
+Keep PSCI at version 1.1 for machine types < virt-rhel10.4.0 . A new default
+PSCI version will be introduced to RHEL 10.4 kernels via upstream commit:
+8be82d536a9f KVM: arm64: Add support for PSCI v1.2 and v1.3
+
+Signed-off-by: Sebastian Ott <sebott@redhat.com>
+---
+ hw/arm/virt.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/hw/arm/virt.c b/hw/arm/virt.c
+index 08c9452680..26eaadd572 100644
+--- a/hw/arm/virt.c
++++ b/hw/arm/virt.c
+@@ -4691,6 +4691,10 @@ DEFINE_VIRT_MACHINE(5, 0)
+
+ static void virt_rhel_machine_10_2_0_options(MachineClass *mc)
+ {
++ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
++
++ /* KVM uses the newest psci version per default. Keep it stable downstream. */
++ vmc->psci_version = PSCI_VERSION(1, 1);
+ compat_props_add(mc->compat_props, hw_compat_rhel_10_3, hw_compat_rhel_10_3_len);
+ }
+ DEFINE_VIRT_MACHINE_AS_LATEST(10, 2, 0)
+--
+2.55.0
+
diff --git a/0029-Disable-new-devices.patch b/0029-Disable-new-devices.patch
new file mode 100644
index 0000000..2269792
--- /dev/null
+++ b/0029-Disable-new-devices.patch
@@ -0,0 +1,114 @@
+From 625eb498efb40016e9864a1c9a98f66f78705b84 Mon Sep 17 00:00:00 2001
+From: Miroslav Rezanina <mrezanin@redhat.com>
+Date: Tue, 15 Sep 2026 11:30:46 +0200
+Subject: Disable new devices
+
+1) There's new ps-mem device in 11.1.0. We do not want to support this
+device so we disable it. We need to remove it by patching code as
+this device is added automatically when using VIRT_ARM config.
+
+2) We do not want use GICv5 downstream as it's used for TCG
+only. Disabling it.
+
+Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
+---
+ hw/arm/Kconfig | 1 -
+ hw/i386/Kconfig | 2 --
+ target/arm/helper.c | 4 +++-
+ target/arm/tcg/meson.build | 1 -
+ tests/qtest/e820-test.c | 9 +++++----
+ 5 files changed, 8 insertions(+), 9 deletions(-)
+
+diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
+index 82e0bc2e70..fd2cc0f976 100644
+--- a/hw/arm/Kconfig
++++ b/hw/arm/Kconfig
+@@ -10,7 +10,6 @@ config ARM_VIRT
+ imply NVDIMM
+ imply IOMMUFD
+ select ARM_GIC
+- select ARM_GICV5 if TCG
+ select ACPI
+ select ARM_SMMUV3
+ select GPIO_KEY
+diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
+index e27d8816e5..12473acaa7 100644
+--- a/hw/i386/Kconfig
++++ b/hw/i386/Kconfig
+@@ -84,7 +84,6 @@ config I440FX
+ select PCI_I440FX
+ select PIIX
+ select DIMM
+- select SP_MEM
+ select SMBIOS
+ select SMBIOS_LEGACY
+ select FW_CFG_DMA
+@@ -114,7 +113,6 @@ config Q35
+ select LPC_ICH9
+ select AHCI_ICH9
+ select DIMM
+- select SP_MEM
+ select SMBIOS
+ select FW_CFG_DMA
+
+diff --git a/target/arm/helper.c b/target/arm/helper.c
+index af45234ad2..7962a41d46 100644
+--- a/target/arm/helper.c
++++ b/target/arm/helper.c
+@@ -6355,7 +6355,9 @@ void register_cp_regs_for_features(ARMCPU *cpu)
+ if (tcg_enabled()) {
+ define_tlb_insn_regs(cpu);
+ define_at_insn_regs(cpu);
+- define_gicv5_cpuif_regs(cpu);
++#if 0 /* Disabled for RHEL */
++ define_gicv5_cpuif_regs(cpu);
++#endif
+ }
+ #endif
+
+diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
+index 15d2c85d00..7de930c39c 100644
+--- a/target/arm/tcg/meson.build
++++ b/target/arm/tcg/meson.build
+@@ -86,7 +86,6 @@ arm_common_user_system_ss.add(when: 'TARGET_AARCH64', if_true: files(
+
+ arm_common_system_ss.add(files(
+ 'cpregs-at.c',
+- 'gicv5-cpuif.c',
+ 'psci.c',
+ 'tlb_helper.c',
+ 'tlb-insns.c',
+diff --git a/tests/qtest/e820-test.c b/tests/qtest/e820-test.c
+index aafa3c1aa2..5b9869beaf 100644
+--- a/tests/qtest/e820-test.c
++++ b/tests/qtest/e820-test.c
+@@ -85,7 +85,7 @@ static void test_e820_basic(void)
+ pc_fw_cfg_uninit(fw_cfg);
+ qtest_quit(s);
+ }
+-
++#if 0 /* Not supported in RHEL */
+ static void test_e820_sp_mem(void)
+ {
+ struct e820_entry table[E820_MAX_ENTRIES];
+@@ -117,13 +117,14 @@ static void test_e820_sp_mem(void)
+ pc_fw_cfg_uninit(fw_cfg);
+ qtest_quit(s);
+ }
+-
++#endif
+ int main(int argc, char **argv)
+ {
+ g_test_init(&argc, &argv, NULL);
+
+ qtest_add_func("e820/basic", test_e820_basic);
+- qtest_add_func("e820/sp-mem", test_e820_sp_mem);
+-
++#if 0 /* Not supported in RHEL */
++ qtest_add_func("e820/sp-mem", test_e820_sp_mem);
++#endif
+ return g_test_run();
+ }
+--
+2.55.0
+
diff --git a/0030-x86-chain-pc-q35-rhel9.8.0-into-the-RHEL-10-compat-l.patch b/0030-x86-chain-pc-q35-rhel9.8.0-into-the-RHEL-10-compat-l.patch
new file mode 100644
index 0000000..7277f20
--- /dev/null
+++ b/0030-x86-chain-pc-q35-rhel9.8.0-into-the-RHEL-10-compat-l.patch
@@ -0,0 +1,45 @@
+From 6fba61837241b5cb6e197ac6c072559f7aee86e3 Mon Sep 17 00:00:00 2001
+From: Igor Mammedov <imammedo@redhat.com>
+Date: Tue, 6 Oct 2026 14:05:51 +0200
+Subject: x86: chain pc-q35-rhel9.8.0 into the RHEL 10 compat line
+
+pc-q35-rhel9.8.0 is the latest RHEL 9 q35 machine type and, like
+pc-q35-rhel10.2.0, is based on QEMU 10.1.0. Unlike the other RHEL 9 q35
+machine types (9.6.0 and older chain into pc_q35_rhel_machine_10_0_0),
+it is a standalone lineage calling pc_q35_machine_options() directly and
+therefore chains none of the hw_compat_rhel_10_* arrays.
+
+Commit f82e011fad3c ("Add new compat handling") added hw_compat_rhel_10_3
+(which restores the QEMU 10.1.0 -> 11.1.0 default changes) only to
+pc_q35_rhel_machine_10_2_0_options(). As a result, after the QEMU 11.1.0
+rebase pc-q35-rhel9.8.0 silently switched to the new 11.1.0 defaults
+(e.g. virtio-net host_tunnel/guest_tunnel), diverging from what RHEL 9.8
+(qemu-kvm-10.1.0-17.el9_8) shipped and breaking cross-version migration.
+
+Chain pc_q35_rhel_machine_9_8_0_options() into
+pc_q35_rhel_machine_10_2_0_options() so it inherits hw_compat_rhel_10_3
+(and any future 10.1.0-era compat added to the RHEL 10.2 anchor), while
+keeping its own RHEL 9 hw_compat_rhel_9.
+
+Fixes: f82e011fad3c ("Add new compat handling")
+Signed-off-by: Igor Mammedov <imammedo@redhat.com>
+---
+ hw/i386/pc_q35.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
+index 7d77f1b675..e101c9d0ae 100644
+--- a/hw/i386/pc_q35.c
++++ b/hw/i386/pc_q35.c
+@@ -642,7 +642,7 @@ DEFINE_Q35_MACHINE(10, 0, 0);
+ static void pc_q35_rhel_machine_9_8_0_options(MachineClass *m)
+ {
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
+- pc_q35_machine_options(m);
++ pc_q35_rhel_machine_10_2_0_options(m);
+ m->desc = "RHEL-9.8.0 PC (Q35 + ICH9, 2009)";
+ pcmc->smbios_stream_product = "RHEL";
+ pcmc->smbios_stream_version = "9.8.0";
+--
+2.55.0
+
diff --git a/0031-x86-pin-x-migrate-error-code-false-on-pre-10.4-RHEL-.patch b/0031-x86-pin-x-migrate-error-code-false-on-pre-10.4-RHEL-.patch
new file mode 100644
index 0000000..abf1f6c
--- /dev/null
+++ b/0031-x86-pin-x-migrate-error-code-false-on-pre-10.4-RHEL-.patch
@@ -0,0 +1,88 @@
+From 725ab9c12decbaf70dc94ca776ccd724ea8ea50c Mon Sep 17 00:00:00 2001
+From: Igor Mammedov <imammedo@redhat.com>
+Date: Tue, 6 Oct 2026 14:07:17 +0200
+Subject: x86: pin x-migrate-error-code=false on pre-10.4 RHEL machine types
+
+The x-migrate-error-code x86-cpu property was introduced in QEMU v11.0.0 [1],
+with a default of "true". It adds the new "cpu/error_code" migration subsection.
+
+flip it to False for older than 10.4 RHEL machine types, to avoid breaking
+migration.
+
+Add pc_rhel_10_3_compat pinning x-migrate-error-code=false and apply it
+to every pre-11.0 RHEL x86 machine type:
+ - pc-q35-rhel10.2.0 (and the 10.0.0/9.8.0/9.6.0/9.4.0/9.2.0/9.0.0 chain)
+ - pc-i440fx-rhel10.0.0
+A newly introduced pc-q35-rhel10.4.0 machine type does not inherit it and
+keeps the fixed "true" default.
+pc-q35-rhel9.8.0 and pc-q35-rhel9.6.0 get the override via the RHEL 10
+options chain.
+
+Signed-off-by: Igor Mammedov <imammedo@redhat.com>
+---
+ hw/i386/pc.c | 6 ++++++
+ hw/i386/pc_piix.c | 2 ++
+ hw/i386/pc_q35.c | 2 ++
+ include/hw/i386/pc.h | 3 +++
+ 4 files changed, 13 insertions(+)
+
+diff --git a/hw/i386/pc.c b/hw/i386/pc.c
+index 4a6440aaf9..caea5a9059 100644
+--- a/hw/i386/pc.c
++++ b/hw/i386/pc.c
+@@ -214,6 +214,12 @@ GlobalProperty pc_rhel_compat[] = {
+ };
+ const size_t pc_rhel_compat_len = G_N_ELEMENTS(pc_rhel_compat);
+
++GlobalProperty pc_rhel_10_3_compat[] = {
++ /* pc_rhel_10_3_compat from pc_compat_10_1 */
++ { TYPE_X86_CPU, "x-migrate-error-code", "false" },
++};
++const size_t pc_rhel_10_3_compat_len = G_N_ELEMENTS(pc_rhel_10_3_compat);
++
+ GlobalProperty pc_rhel_10_2_compat[] = {
+ /* pc_rhel_10_2_compat from pc_compat_10_0 */
+ { "mch", "extended-tseg-mbytes", "16" },
+diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
+index 279b5b73d9..de496c87cb 100644
+--- a/hw/i386/pc_piix.c
++++ b/hw/i386/pc_piix.c
+@@ -706,6 +706,8 @@ static void pc_i440fx_rhel_machine_10_0_0_options(MachineClass *m)
+
+ compat_props_add(m->compat_props, hw_compat_rhel_10_3,
+ hw_compat_rhel_10_3_len);
++ compat_props_add(m->compat_props, pc_rhel_10_3_compat,
++ pc_rhel_10_3_compat_len);
+ compat_props_add(m->compat_props, hw_compat_rhel_10_2,
+ hw_compat_rhel_10_2_len);
+ compat_props_add(m->compat_props, hw_compat_rhel_10_1,
+diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
+index e101c9d0ae..893e92fbaa 100644
+--- a/hw/i386/pc_q35.c
++++ b/hw/i386/pc_q35.c
+@@ -617,6 +617,8 @@ static void pc_q35_rhel_machine_10_2_0_options(MachineClass *m)
+ pcmc->smbios_stream_version = "10.2.0";
+ compat_props_add(m->compat_props, hw_compat_rhel_10_3,
+ hw_compat_rhel_10_3_len);
++ compat_props_add(m->compat_props, pc_rhel_10_3_compat,
++ pc_rhel_10_3_compat_len);
+ }
+ DEFINE_Q35_MACHINE_AS_LATEST(10, 2, 0);
+
+diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
+index 0264030a1d..bcaefe9bf8 100644
+--- a/include/hw/i386/pc.h
++++ b/include/hw/i386/pc.h
+@@ -278,6 +278,9 @@ extern const size_t pc_compat_4_1_len;
+ extern GlobalProperty pc_rhel_compat[];
+ extern const size_t pc_rhel_compat_len;
+
++extern GlobalProperty pc_rhel_10_3_compat[];
++extern const size_t pc_rhel_10_3_compat_len;
++
+ extern GlobalProperty pc_rhel_10_2_compat[];
+ extern const size_t pc_rhel_10_2_compat_len;
+
+--
+2.55.0
+
diff --git a/0032-hw-arm-virt-add-new-machine-type-virt-rhel10.4.0.patch b/0032-hw-arm-virt-add-new-machine-type-virt-rhel10.4.0.patch
new file mode 100644
index 0000000..613f60a
--- /dev/null
+++ b/0032-hw-arm-virt-add-new-machine-type-virt-rhel10.4.0.patch
@@ -0,0 +1,49 @@
+From e886eade77116b41d86c960d76d327f6524997af Mon Sep 17 00:00:00 2001
+From: Sebastian Ott <sebott@redhat.com>
+Date: Mon, 5 Oct 2026 12:49:02 +0200
+Subject: hw/arm/virt: add new machine type virt-rhel10.4.0
+
+RH-Author: Sebastian Ott <sebott@redhat.com>
+RH-MergeRequest: 571: new q35/virt machine types for RHEL10.4
+RH-Jira: RHEL-260114 RHEL-260116
+RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
+RH-Commit: [29/30] 7ff7dfc03b
+
+Add a new virt machine type for RHEL10.4 and make it the default.
+
+Signed-off-by: Sebastian Ott <sebott@redhat.com>
+---
+ hw/arm/virt.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/hw/arm/virt.c b/hw/arm/virt.c
+index 26eaadd572..009cf69926 100644
+--- a/hw/arm/virt.c
++++ b/hw/arm/virt.c
+@@ -4689,15 +4689,22 @@ static void virt_machine_5_0_options(MachineClass *mc)
+ DEFINE_VIRT_MACHINE(5, 0)
+ #endif /* disabled for RHEL */
+
++static void virt_rhel_machine_10_4_0_options(MachineClass *mc)
++{
++}
++DEFINE_VIRT_MACHINE_AS_LATEST(10, 4, 0)
++
+ static void virt_rhel_machine_10_2_0_options(MachineClass *mc)
+ {
+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
+
++ virt_rhel_machine_10_4_0_options(mc);
++
+ /* KVM uses the newest psci version per default. Keep it stable downstream. */
+ vmc->psci_version = PSCI_VERSION(1, 1);
+ compat_props_add(mc->compat_props, hw_compat_rhel_10_3, hw_compat_rhel_10_3_len);
+ }
+-DEFINE_VIRT_MACHINE_AS_LATEST(10, 2, 0)
++DEFINE_VIRT_MACHINE(10, 2, 0)
+
+ static void virt_rhel_machine_10_0_0_options(MachineClass *mc)
+ {
+--
+2.55.0
+
diff --git a/0033-s390x-add-new-machine-type-s390-ccw-virtio-rhel10.4..patch b/0033-s390x-add-new-machine-type-s390-ccw-virtio-rhel10.4..patch
new file mode 100644
index 0000000..14e554b
--- /dev/null
+++ b/0033-s390x-add-new-machine-type-s390-ccw-virtio-rhel10.4..patch
@@ -0,0 +1,59 @@
+From 73f6d8b6b590ea8514599d22ca793686df62ece6 Mon Sep 17 00:00:00 2001
+From: Cornelia Huck <cohuck@redhat.com>
+Date: Wed, 7 Oct 2026 11:13:16 +0200
+Subject: s390x: add new machine type s390-ccw-virtio-rhel10.4.0
+
+RH-Author: Cornelia Huck <cohuck@redhat.com>
+RH-MergeRequest: 572: add new s390-virtio-ccw machine type for RHEL 10.4
+RH-Jira: RHEL-260115
+RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
+RH-Commit: [29/29] d7e8bbf6e1 (cohuck/qemu-kvm)
+
+Add a new s390x machine type for RHEL 10.4.
+
+Signed-off-by: Cornelia Huck <cohuck@redhat.com>
+---
+ hw/s390x/s390-virtio-ccw.c | 19 ++++++++++++++++++-
+ 1 file changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
+index 2799cd9e4a..46f92b5600 100644
+--- a/hw/s390x/s390-virtio-ccw.c
++++ b/hw/s390x/s390-virtio-ccw.c
+@@ -1203,15 +1203,32 @@ DEFINE_CCW_MACHINE(5, 1);
+
+ #endif /* disabled for RHEL */
+
++static void ccw_rhel_machine_10_4_0_instance_options(MachineState *machine)
++{
++}
++
++static void ccw_rhel_machine_10_4_0_class_options(MachineClass *mc)
++{
++}
++DEFINE_CCW_MACHINE_AS_LATEST(10, 4, 0);
++
+ static void ccw_rhel_machine_10_2_0_instance_options(MachineState *machine)
+ {
++ ccw_rhel_machine_10_4_0_instance_options(machine);
+ }
+
+ static void ccw_rhel_machine_10_2_0_class_options(MachineClass *mc)
+ {
++ /*
++ * We do not need any virtio-pci compat props here, as virtio-pci devices
++ * are disabled for s390x in RHEL.
++ */
++
++ ccw_rhel_machine_10_4_0_class_options(mc);
++
+ compat_props_add(mc->compat_props, hw_compat_rhel_10_3, hw_compat_rhel_10_3_len);
+ }
+-DEFINE_CCW_MACHINE_AS_LATEST(10, 2, 0);
++DEFINE_CCW_MACHINE(10, 2, 0);
+
+ static void ccw_rhel_machine_10_0_0_instance_options(MachineState *machine)
+ {
+--
+2.55.0
+
diff --git a/0034-q35-add-new-machine-type-pc-q35-rhel10.4.0.patch b/0034-q35-add-new-machine-type-pc-q35-rhel10.4.0.patch
new file mode 100644
index 0000000..26b14e8
--- /dev/null
+++ b/0034-q35-add-new-machine-type-pc-q35-rhel10.4.0.patch
@@ -0,0 +1,56 @@
+From 1f61b3bca1ddc65327a98f664cf1350fc9eea218 Mon Sep 17 00:00:00 2001
+From: Sebastian Ott <sebott@redhat.com>
+Date: Mon, 5 Oct 2026 18:14:03 +0200
+Subject: q35: add new machine type pc-q35-rhel10.4.0
+
+RH-Author: Sebastian Ott <sebott@redhat.com>
+RH-MergeRequest: 571: new q35/virt machine types for RHEL10.4
+RH-Jira: RHEL-260114 RHEL-260116
+RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
+RH-Commit: [30/30] ce3531ef88
+
+Add a new q35 machine type for RHEL10.4.
+
+Signed-off-by: Sebastian Ott <sebott@redhat.com>
+---
+ hw/i386/pc_q35.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
+index 893e92fbaa..b32ff8102b 100644
+--- a/hw/i386/pc_q35.c
++++ b/hw/i386/pc_q35.c
+@@ -608,10 +608,20 @@ DEFINE_Q35_MACHINE(4, 1);
+
+ /* Red Hat Enterprise Linux machine types */
+
+-static void pc_q35_rhel_machine_10_2_0_options(MachineClass *m)
++static void pc_q35_rhel_machine_10_4_0_options(MachineClass *m)
+ {
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
+ pc_q35_machine_options(m);
++ m->desc = "RHEL-10.4.0 PC (Q35 + ICH9, 2009)";
++ pcmc->smbios_stream_product = "RHEL";
++ pcmc->smbios_stream_version = "10.4.0";
++}
++DEFINE_Q35_MACHINE_AS_LATEST(10, 4, 0);
++
++static void pc_q35_rhel_machine_10_2_0_options(MachineClass *m)
++{
++ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
++ pc_q35_rhel_machine_10_4_0_options(m);
+ m->desc = "RHEL-10.2.0 PC (Q35 + ICH9, 2009)";
+ pcmc->smbios_stream_product = "RHEL";
+ pcmc->smbios_stream_version = "10.2.0";
+@@ -620,7 +630,7 @@ static void pc_q35_rhel_machine_10_2_0_options(MachineClass *m)
+ compat_props_add(m->compat_props, pc_rhel_10_3_compat,
+ pc_rhel_10_3_compat_len);
+ }
+-DEFINE_Q35_MACHINE_AS_LATEST(10, 2, 0);
++DEFINE_Q35_MACHINE(10, 2, 0);
+
+ static void pc_q35_rhel_machine_10_0_0_options(MachineClass *m)
+ {
+--
+2.55.0
+
diff --git a/README.rst b/README.rst
deleted file mode 100644
index 15f93e6..0000000
--- a/README.rst
+++ /dev/null
@@ -1,19 +0,0 @@
-===================
-qemu-kvm development
-===================
-
-qemu-kvm is maintained in a `source tree`_ rather than directly in dist-git.
-This provides way to develope using regular source code structure and provides
-way to generate SRPM and build using koji service. In addition, local build using
-CentOS 9 Stream specific configuration.
-
-Developers deliver all changes to source-git using merge request. Only maintainers
-will be pushing changes sent to source-git to dist-git.
-
-Each release in dist-git is tagged in the source repository so you can easily
-check out the source tree for a build. The tags are in the format
-name-version-release, but note release doesn't contain the dist tag since the
-source can be built in different build roots (Fedora, CentOS, etc.)
-
-.. _source tree: https://gitlab.com/redhat/centos-stream/src/qemu-kvm
-
diff --git a/kvm-Fix-the-typo-of-vfio-pci-device-s-enable-migration-o.patch b/kvm-Fix-the-typo-of-vfio-pci-device-s-enable-migration-o.patch
deleted file mode 100644
index 2416ca0..0000000
--- a/kvm-Fix-the-typo-of-vfio-pci-device-s-enable-migration-o.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 0509eb94d2f166cfd3a24aa5fd14e1af76af8dea Mon Sep 17 00:00:00 2001
-From: Yanghang Liu <yanghliu@redhat.com>
-Date: Mon, 24 Nov 2025 23:02:37 +0800
-Subject: [PATCH 4/4] Fix the typo of vfio-pci device's enable-migration option
-
-RH-Author: YangHang Liu <None>
-RH-MergeRequest: 428: RHEL10: Fix the typo of vfio-pci device's enable-migration option
-RH-Jira: RHEL-130704
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/1] bcf8b2089f687d02b5f0a48dd1e3dfc4664946e0 (yanghliu/qemu-kvm)
-
-Signed-off-by: Yanghang Liu <yanghliu@redhat.com>
-Reported-by: Mario Casquero <mcasquer@redhat.com>
-Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-(cherry picked from commit 5f9ac963735598c1efbdce9c4a09f0a64e13d613)
-Signed-off-by: Yanghang Liu <yanghliu@redhat.com>
----
- hw/vfio/pci.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 83ecffb535..7c057ee2f9 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -3847,7 +3847,7 @@ static void vfio_pci_dev_class_init(ObjectClass *klass, const void *data)
- "(DEBUG)");
- object_class_property_set_description(klass, /* 5.2, 8.0 non-experimetal */
- "enable-migration",
-- "Enale device migration. Also requires a host VFIO PCI "
-+ "Enable device migration. Also requires a host VFIO PCI "
- "variant or mdev driver with migration support enabled");
- object_class_property_set_description(klass, /* 8.1 */
- "vf-token",
---
-2.47.3
-
diff --git a/kvm-MAINTAINERS-Add-maintainers-for-mshv-accelerator.patch b/kvm-MAINTAINERS-Add-maintainers-for-mshv-accelerator.patch
deleted file mode 100644
index 0db0143..0000000
--- a/kvm-MAINTAINERS-Add-maintainers-for-mshv-accelerator.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 5807bd68ad5c038a57ffb2f665f732dfc51d8868 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:47 +0200
-Subject: [PATCH 30/32] MAINTAINERS: Add maintainers for mshv accelerator
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [28/30] 0178a9a61285bd708b5f589888c36b74efd4a4bf
-
-Adding Magnus Kulke and Wei Liu to the maintainers file for the
-respective folders/files.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-28-magnuskulke@linux.microsoft.com
-[Rename "MAHV CPUs" to mention x86. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 1872bd9f2dad5113b0c27d352ec49683e0953c7f)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- MAINTAINERS | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
-
-diff --git a/MAINTAINERS b/MAINTAINERS
-index a07086ed76..d4696f00d7 100644
---- a/MAINTAINERS
-+++ b/MAINTAINERS
-@@ -546,6 +546,21 @@ F: target/i386/whpx/
- F: accel/stubs/whpx-stub.c
- F: include/system/whpx.h
-
-+MSHV
-+M: Magnus Kulke <magnus.kulke@linux.microsoft.com>
-+R: Wei Liu <wei.liu@kernel.org>
-+S: Supported
-+F: accel/mshv/
-+F: include/system/mshv.h
-+F: include/hw/hyperv/hvgdk*.h
-+F: include/hw/hyperv/hvhdk*.h
-+
-+X86 MSHV CPUs
-+M: Magnus Kulke <magnus.kulke@linux.microsoft.com>
-+R: Wei Liu <wei.liu@kernel.org>
-+S: Supported
-+F: target/i386/mshv/
-+
- X86 Instruction Emulator
- M: Cameron Esfahani <dirty@apple.com>
- M: Roman Bolshakov <rbolshakov@ddn.com>
---
-2.47.3
-
diff --git a/kvm-Revert-hw-arm-virt-Use-ACPI-PCI-hotplug-by-default-f.patch b/kvm-Revert-hw-arm-virt-Use-ACPI-PCI-hotplug-by-default-f.patch
deleted file mode 100644
index cd7c009..0000000
--- a/kvm-Revert-hw-arm-virt-Use-ACPI-PCI-hotplug-by-default-f.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-From eee1f8abab9cbcb64ab690737f1a8db293d87c05 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Wed, 11 Feb 2026 09:57:37 -0500
-Subject: [PATCH 7/7] Revert "hw/arm/virt: Use ACPI PCI hotplug by default from
- 10.2 onwards"
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 465: Revert "hw/arm/virt: Use ACPI PCI hotplug by default from 10.2 onwards"
-RH-Jira: RHEL-134989 RHEL-146584
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Commit: [1/1] e22612dc81813762f8d7f4bc9f75df0b9f2135e0 (eauger1/centos-qemu-kvm)
-
-JIRA: https://issues.redhat.com/browse/RHEL-134989
-JIRA: https://issues.redhat.com/browse/RHEL-146584
-UPSTREAM: RHEL-only
-
-This reverts commit 58cba97a715fa3f506234e718191fcc34286f333.
-
-Conflicts: small contextual conflict when reverting changes in
-hw/arm/virt.c due to subsequent fix by commit
-fa0a758781fc ("arm: fix oob access in compat handling")
-
-Unfortunately the change of the default for the PCI hotplug method
-introduced some regressions that cannot be fixed in 10.2 cycle. An
-example is hotplugging a virtio-net-pci device with page-per-vq=true.
-This induces an increase in the BAR size which is larger than the
-default size the FW accomodates. At the moment we do not have any
-workaround for those devices with large BARs, ie. we noticed
-pcie-root-port pref64-reserve does not work as on x86 and we do not
-have any way to opt-in for legacy PCIe hotplug at libvirt
-level. So let's revert the change until we get all those stuff
-properly fixed.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/virt.c | 10 ----------
- 1 file changed, 10 deletions(-)
-
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index 1cfb386f64..752dc08720 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -95,16 +95,9 @@
-
- static GlobalProperty arm_virt_compat[] = {
- { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "48" },
-- { TYPE_ACPI_GED, "acpi-pci-hotplug-with-bridge-support", "on" },
- };
- static const size_t arm_virt_compat_len = G_N_ELEMENTS(arm_virt_compat);
-
--GlobalProperty arm_acpi_pci_hp_disabled_compat[] = {
-- { TYPE_ACPI_GED, "acpi-pci-hotplug-with-bridge-support", "off" },
--};
--static const size_t arm_acpi_pci_hp_disabled_compat_len =
-- G_N_ELEMENTS(arm_acpi_pci_hp_disabled_compat);
--
- /*
- * RHEL9 kernels have pauth disabled while RHEL10 has it enabled,
- * since qemu will setup the VM with pauth when KVM supports it we
-@@ -112,7 +105,6 @@ static const size_t arm_acpi_pci_hp_disabled_compat_len =
- */
- GlobalProperty arm_rhel9_compat[] = {
- {TYPE_ARM_CPU, "pauth", "off", .optional = true},
-- {TYPE_ACPI_GED, "acpi-pci-hotplug-with-bridge-support", "off" },
- };
- const size_t arm_rhel9_compat_len = G_N_ELEMENTS(arm_rhel9_compat);
-
-@@ -3768,8 +3760,6 @@ static void virt_rhel_machine_10_0_0_options(MachineClass *mc)
-
- /* QEMU 9.1 and earlier have only a stage-1 SMMU, not a nested s1+2 one */
- vmc->no_nested_smmu = true;
-- compat_props_add(mc->compat_props, arm_acpi_pci_hp_disabled_compat,
-- arm_acpi_pci_hp_disabled_compat_len);
- compat_props_add(mc->compat_props, hw_compat_rhel_10_2, hw_compat_rhel_10_2_len);
- compat_props_add(mc->compat_props, hw_compat_rhel_10_1, hw_compat_rhel_10_1_len);
- }
---
-2.47.3
-
diff --git a/kvm-Revert-target-arm-Reinstate-bogus-AArch32-DBGDTRTX-r.patch b/kvm-Revert-target-arm-Reinstate-bogus-AArch32-DBGDTRTX-r.patch
deleted file mode 100644
index 5aa59f1..0000000
--- a/kvm-Revert-target-arm-Reinstate-bogus-AArch32-DBGDTRTX-r.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From 9526072fb84b844d3de49d2727ca9650f4fa4d4c Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Mon, 20 Apr 2026 16:03:57 +0200
-Subject: [PATCH 016/116] Revert "target/arm: Reinstate bogus AArch32 DBGDTRTX
- register for migration compat"
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [16/16] 60be5ef3f6fe516b480e578cd610618d180a9655 (eauger1/centos-qemu-kvm)
-
-This reverts commit 4f2b82f60431 ("target/arm: Reinstate bogus AArch32
-DBGDTRTX register for migration compat). We don't need that commit
-anymore as the AArch32 DBGDTRTX register is declared to
-be safe to ignore in the incoming migration stream.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Sebastian Ott <sebott@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Message-id: 20260420140552.104369-8-eric.auger@redhat.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 202126dcb9d6261c38e629799265defeb3260d25)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/debug_helper.c | 29 -----------------------------
- 1 file changed, 29 deletions(-)
-
-diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
-index 579516e154..aee06d4d42 100644
---- a/target/arm/debug_helper.c
-+++ b/target/arm/debug_helper.c
-@@ -940,13 +940,6 @@ static void dbgclaimclr_write(CPUARMState *env, const ARMCPRegInfo *ri,
- env->cp15.dbgclaim &= ~(value & 0xFF);
- }
-
--static CPAccessResult access_bogus(CPUARMState *env, const ARMCPRegInfo *ri,
-- bool isread)
--{
-- /* Always UNDEF, as if this cpreg didn't exist */
-- return CP_ACCESS_UNDEFINED;
--}
--
- static const ARMCPRegInfo debug_cp_reginfo[] = {
- /*
- * DBGDRAR, DBGDSAR: always RAZ since we don't implement memory mapped
-@@ -1009,28 +1002,6 @@ static const ARMCPRegInfo debug_cp_reginfo[] = {
- .opc0 = 2, .opc1 = 3, .crn = 0, .crm = 4, .opc2 = 0,
- .access = PL0_RW, .accessfn = access_tdcc,
- .type = ARM_CP_CONST, .resetvalue = 0 },
-- /*
-- * This is not a real AArch32 register. We used to incorrectly expose
-- * this due to a QEMU bug; to avoid breaking migration compatibility we
-- * need to continue to provide it so that we don't fail the inbound
-- * migration when it tells us about a sysreg that we don't have.
-- * We set an always-fails .accessfn, which means that the guest doesn't
-- * actually see this register (it will always UNDEF, identically to if
-- * there were no cpreg definition for it other than that we won't print
-- * a LOG_UNIMP message about it), and we set the ARM_CP_NO_GDB flag so the
-- * gdbstub won't see it either.
-- * (We can't just set .access = 0, because add_cpreg_to_hashtable()
-- * helpfully ignores cpregs which aren't accessible to the highest
-- * implemented EL.)
-- *
-- * TODO: implement a system for being able to describe "this register
-- * can be ignored if it appears in the inbound stream"; then we can
-- * remove this temporary hack.
-- */
-- { .name = "BOGUS_DBGDTR_EL0", .state = ARM_CP_STATE_AA32,
-- .cp = 14, .opc1 = 3, .crn = 0, .crm = 5, .opc2 = 0,
-- .access = PL0_RW, .accessfn = access_bogus,
-- .type = ARM_CP_CONST | ARM_CP_NO_GDB, .resetvalue = 0 },
- /*
- * OSECCR_EL1 provides a mechanism for an operating system
- * to access the contents of EDECCR. EDECCR is not implemented though,
---
-2.52.0
-
diff --git a/kvm-accel-Add-Meson-and-config-support-for-MSHV-accelera.patch b/kvm-accel-Add-Meson-and-config-support-for-MSHV-accelera.patch
deleted file mode 100644
index 3c906b7..0000000
--- a/kvm-accel-Add-Meson-and-config-support-for-MSHV-accelera.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From 502e461dabe1eecc22f6a7d22755b8407ee74683 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:21 +0200
-Subject: [PATCH 03/32] accel: Add Meson and config support for MSHV
- accelerator
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/30] 04ab9685b09f4d837715bf624d87566f472cb6c2
-
-Introduce a Meson feature option and default-config entry to allow
-building QEMU with MSHV (Microsoft Hypervisor) acceleration support.
-
-This is the first step toward implementing an MSHV backend in QEMU.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-2-magnuskulke@linux.microsoft.com
-[Add error for unavailable accelerator. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 37e12da5df8eb74042f11e9e7bec8a50b8090adb)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- accel/Kconfig | 3 +++
- meson.build | 13 +++++++++++++
- meson_options.txt | 2 ++
- scripts/meson-buildoptions.sh | 3 +++
- 4 files changed, 21 insertions(+)
-
-diff --git a/accel/Kconfig b/accel/Kconfig
-index 4263cab722..a60f114923 100644
---- a/accel/Kconfig
-+++ b/accel/Kconfig
-@@ -13,6 +13,9 @@ config TCG
- config KVM
- bool
-
-+config MSHV
-+ bool
-+
- config XEN
- bool
- select FSDEV_9P if VIRTFS
-diff --git a/meson.build b/meson.build
-index ef2e5be6e2..96254f8075 100644
---- a/meson.build
-+++ b/meson.build
-@@ -334,6 +334,7 @@ elif cpu == 'x86_64'
- 'CONFIG_HVF': ['x86_64-softmmu'],
- 'CONFIG_NVMM': ['i386-softmmu', 'x86_64-softmmu'],
- 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
-+ 'CONFIG_MSHV': ['x86_64-softmmu'],
- }
- endif
-
-@@ -884,6 +885,14 @@ accelerators = []
- if get_option('kvm').allowed() and host_os == 'linux'
- accelerators += 'CONFIG_KVM'
- endif
-+
-+if get_option('mshv').allowed() and host_os == 'linux'
-+ if get_option('mshv').enabled() and host_machine.cpu() != 'x86_64'
-+ error('mshv accelerator requires x64_64 host')
-+ endif
-+ accelerators += 'CONFIG_MSHV'
-+endif
-+
- if get_option('whpx').allowed() and host_os == 'windows'
- if get_option('whpx').enabled() and host_machine.cpu() != 'x86_64'
- error('WHPX requires 64-bit host')
-@@ -953,6 +962,9 @@ endif
- if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
- error('WHPX not available on this platform')
- endif
-+if 'CONFIG_MSHV' not in accelerators and get_option('mshv').enabled()
-+ error('mshv not available on this platform')
-+endif
-
- xen = not_found
- if get_option('xen').enabled() or (get_option('xen').auto() and have_system)
-@@ -4821,6 +4833,7 @@ if have_system
- summary_info += {'HVF support': config_all_accel.has_key('CONFIG_HVF')}
- summary_info += {'WHPX support': config_all_accel.has_key('CONFIG_WHPX')}
- summary_info += {'NVMM support': config_all_accel.has_key('CONFIG_NVMM')}
-+ summary_info += {'MSHV support': config_all_accel.has_key('CONFIG_MSHV')}
- summary_info += {'Xen support': xen.found()}
- if xen.found()
- summary_info += {'xen ctrl version': xen.version()}
-diff --git a/meson_options.txt b/meson_options.txt
-index f45d7ded45..2267dee8a0 100644
---- a/meson_options.txt
-+++ b/meson_options.txt
-@@ -73,6 +73,8 @@ option('malloc', type : 'combo', choices : ['system', 'tcmalloc', 'jemalloc'],
-
- option('kvm', type: 'feature', value: 'auto',
- description: 'KVM acceleration support')
-+option('mshv', type: 'feature', value: 'auto',
-+ description: 'MSHV acceleration support')
- option('whpx', type: 'feature', value: 'auto',
- description: 'WHPX acceleration support')
- option('hvf', type: 'feature', value: 'auto',
-diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
-index 4146dbc88d..9aff126c28 100644
---- a/scripts/meson-buildoptions.sh
-+++ b/scripts/meson-buildoptions.sh
-@@ -155,6 +155,7 @@ meson_options_help() {
- printf "%s\n" ' membarrier membarrier system call (for Linux 4.14+ or Windows'
- printf "%s\n" ' modules modules support (non Windows)'
- printf "%s\n" ' mpath Multipath persistent reservation passthrough'
-+ printf "%s\n" ' mshv MSHV acceleration support'
- printf "%s\n" ' multiprocess Out of process device emulation support'
- printf "%s\n" ' netmap netmap network backend support'
- printf "%s\n" ' nettle nettle cryptography support'
-@@ -409,6 +410,8 @@ _meson_option_parse() {
- --disable-modules) printf "%s" -Dmodules=disabled ;;
- --enable-mpath) printf "%s" -Dmpath=enabled ;;
- --disable-mpath) printf "%s" -Dmpath=disabled ;;
-+ --enable-mshv) printf "%s" -Dmshv=enabled ;;
-+ --disable-mshv) printf "%s" -Dmshv=disabled ;;
- --enable-multiprocess) printf "%s" -Dmultiprocess=enabled ;;
- --disable-multiprocess) printf "%s" -Dmultiprocess=disabled ;;
- --enable-netmap) printf "%s" -Dnetmap=enabled ;;
---
-2.47.3
-
diff --git a/kvm-accel-mshv-Add-accelerator-skeleton.patch b/kvm-accel-mshv-Add-accelerator-skeleton.patch
deleted file mode 100644
index e14da46..0000000
--- a/kvm-accel-mshv-Add-accelerator-skeleton.patch
+++ /dev/null
@@ -1,291 +0,0 @@
-From a491ddf980ed1c8a54ba06db007d770817554b91 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Thu, 2 Oct 2025 18:25:02 +0200
-Subject: [PATCH 09/32] accel/mshv: Add accelerator skeleton
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [7/30] 2bf55db3c9fbc6ce5964090f192be3699ae2ea00
-
-Introduce the initial scaffold for the MSHV (Microsoft Hypervisor)
-accelerator backend. This includes the basic directory structure and
-stub implementations needed to integrate with QEMU's accelerator
-framework.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-8-magnuskulke@linux.microsoft.com
-[Move include of linux/mshv.h in the per-target section; create
- include/system/mshv_int.h. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit d0d2918f968c55628e17e2733b799fcefb50f16b)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- accel/meson.build | 1 +
- accel/mshv/meson.build | 6 ++
- accel/mshv/mshv-all.c | 144 ++++++++++++++++++++++++++++++++++++++
- include/system/mshv.h | 12 ++++
- include/system/mshv_int.h | 41 +++++++++++
- 5 files changed, 204 insertions(+)
- create mode 100644 accel/mshv/meson.build
- create mode 100644 accel/mshv/mshv-all.c
- create mode 100644 include/system/mshv_int.h
-
-diff --git a/accel/meson.build b/accel/meson.build
-index 6349efe682..983dfd0bd5 100644
---- a/accel/meson.build
-+++ b/accel/meson.build
-@@ -10,6 +10,7 @@ if have_system
- subdir('kvm')
- subdir('xen')
- subdir('stubs')
-+ subdir('mshv')
- endif
-
- # qtest
-diff --git a/accel/mshv/meson.build b/accel/mshv/meson.build
-new file mode 100644
-index 0000000000..4c03ac7921
---- /dev/null
-+++ b/accel/mshv/meson.build
-@@ -0,0 +1,6 @@
-+mshv_ss = ss.source_set()
-+mshv_ss.add(if_true: files(
-+ 'mshv-all.c'
-+))
-+
-+specific_ss.add_all(when: 'CONFIG_MSHV', if_true: mshv_ss)
-diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
-new file mode 100644
-index 0000000000..ae12f0f58b
---- /dev/null
-+++ b/accel/mshv/mshv-all.c
-@@ -0,0 +1,144 @@
-+/*
-+ * QEMU MSHV support
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * Authors:
-+ * Ziqiao Zhou <ziqiaozhou@microsoft.com>
-+ * Magnus Kulke <magnuskulke@microsoft.com>
-+ * Jinank Jain <jinankjain@microsoft.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ *
-+ */
-+
-+#include "qemu/osdep.h"
-+#include "qapi/error.h"
-+#include "qemu/error-report.h"
-+#include "qemu/event_notifier.h"
-+#include "qemu/module.h"
-+#include "qemu/main-loop.h"
-+#include "hw/boards.h"
-+
-+#include "hw/hyperv/hvhdk.h"
-+#include "hw/hyperv/hvhdk_mini.h"
-+#include "hw/hyperv/hvgdk.h"
-+#include "linux/mshv.h"
-+
-+#include "qemu/accel.h"
-+#include "qemu/guest-random.h"
-+#include "accel/accel-ops.h"
-+#include "accel/accel-cpu-ops.h"
-+#include "system/cpus.h"
-+#include "system/runstate.h"
-+#include "system/accel-blocker.h"
-+#include "system/address-spaces.h"
-+#include "system/mshv.h"
-+#include "system/mshv_int.h"
-+#include "system/reset.h"
-+#include "trace.h"
-+#include <err.h>
-+#include <stdint.h>
-+#include <sys/ioctl.h>
-+
-+#define TYPE_MSHV_ACCEL ACCEL_CLASS_NAME("mshv")
-+
-+DECLARE_INSTANCE_CHECKER(MshvState, MSHV_STATE, TYPE_MSHV_ACCEL)
-+
-+bool mshv_allowed;
-+
-+MshvState *mshv_state;
-+
-+static int mshv_init(AccelState *as, MachineState *ms)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+static void mshv_start_vcpu_thread(CPUState *cpu)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+static void mshv_cpu_synchronize_post_init(CPUState *cpu)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+static void mshv_cpu_synchronize_post_reset(CPUState *cpu)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+static void mshv_cpu_synchronize_pre_loadvm(CPUState *cpu)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+static void mshv_cpu_synchronize(CPUState *cpu)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+static bool mshv_cpus_are_resettable(void)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+static void mshv_accel_class_init(ObjectClass *oc, const void *data)
-+{
-+ AccelClass *ac = ACCEL_CLASS(oc);
-+
-+ ac->name = "MSHV";
-+ ac->init_machine = mshv_init;
-+ ac->allowed = &mshv_allowed;
-+}
-+
-+static void mshv_accel_instance_init(Object *obj)
-+{
-+ MshvState *s = MSHV_STATE(obj);
-+
-+ s->vm = 0;
-+}
-+
-+static const TypeInfo mshv_accel_type = {
-+ .name = TYPE_MSHV_ACCEL,
-+ .parent = TYPE_ACCEL,
-+ .instance_init = mshv_accel_instance_init,
-+ .class_init = mshv_accel_class_init,
-+ .instance_size = sizeof(MshvState),
-+};
-+
-+static void mshv_accel_ops_class_init(ObjectClass *oc, const void *data)
-+{
-+ AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
-+
-+ ops->create_vcpu_thread = mshv_start_vcpu_thread;
-+ ops->synchronize_post_init = mshv_cpu_synchronize_post_init;
-+ ops->synchronize_post_reset = mshv_cpu_synchronize_post_reset;
-+ ops->synchronize_state = mshv_cpu_synchronize;
-+ ops->synchronize_pre_loadvm = mshv_cpu_synchronize_pre_loadvm;
-+ ops->cpus_are_resettable = mshv_cpus_are_resettable;
-+ ops->handle_interrupt = generic_handle_interrupt;
-+}
-+
-+static const TypeInfo mshv_accel_ops_type = {
-+ .name = ACCEL_OPS_NAME("mshv"),
-+ .parent = TYPE_ACCEL_OPS,
-+ .class_init = mshv_accel_ops_class_init,
-+ .abstract = true,
-+};
-+
-+static void mshv_type_init(void)
-+{
-+ type_register_static(&mshv_accel_type);
-+ type_register_static(&mshv_accel_ops_type);
-+}
-+
-+type_init(mshv_type_init);
-diff --git a/include/system/mshv.h b/include/system/mshv.h
-index 2a504ed81f..434ea9682e 100644
---- a/include/system/mshv.h
-+++ b/include/system/mshv.h
-@@ -14,8 +14,17 @@
- #ifndef QEMU_MSHV_H
- #define QEMU_MSHV_H
-
-+#include "qemu/osdep.h"
-+#include "qemu/accel.h"
-+#include "hw/hyperv/hyperv-proto.h"
-+#include "hw/hyperv/hvhdk.h"
-+#include "qapi/qapi-types-common.h"
-+#include "system/memory.h"
-+#include "accel/accel-ops.h"
-+
- #ifdef COMPILING_PER_TARGET
- #ifdef CONFIG_MSHV
-+#include <linux/mshv.h>
- #define CONFIG_MSHV_IS_POSSIBLE
- #endif
- #else
-@@ -30,6 +39,9 @@ extern bool mshv_allowed;
- #endif
- #define mshv_msi_via_irqfd_enabled() false
-
-+typedef struct MshvState MshvState;
-+extern MshvState *mshv_state;
-+
- /* interrupt */
- int mshv_irqchip_add_msi_route(int vector, PCIDevice *dev);
- int mshv_irqchip_update_msi_route(int virq, MSIMessage msg, PCIDevice *dev);
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-new file mode 100644
-index 0000000000..132491b599
---- /dev/null
-+++ b/include/system/mshv_int.h
-@@ -0,0 +1,41 @@
-+/*
-+ * QEMU MSHV support
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * Authors: Ziqiao Zhou <ziqiaozhou@microsoft.com>
-+ * Magnus Kulke <magnuskulke@microsoft.com>
-+ * Jinank Jain <jinankjain@microsoft.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ *
-+ */
-+
-+#ifndef QEMU_MSHV_INT_H
-+#define QEMU_MSHV_INT_H
-+
-+struct AccelCPUState {
-+ int cpufd;
-+ bool dirty;
-+};
-+
-+typedef struct MshvMemoryListener {
-+ MemoryListener listener;
-+ int as_id;
-+} MshvMemoryListener;
-+
-+typedef struct MshvAddressSpace {
-+ MshvMemoryListener *ml;
-+ AddressSpace *as;
-+} MshvAddressSpace;
-+
-+struct MshvState {
-+ AccelState parent_obj;
-+ int vm;
-+ MshvMemoryListener memory_listener;
-+ /* number of listeners */
-+ int nr_as;
-+ MshvAddressSpace *as;
-+};
-+
-+#endif
---
-2.47.3
-
diff --git a/kvm-accel-mshv-Add-vCPU-creation-and-execution-loop.patch b/kvm-accel-mshv-Add-vCPU-creation-and-execution-loop.patch
deleted file mode 100644
index a74a8cb..0000000
--- a/kvm-accel-mshv-Add-vCPU-creation-and-execution-loop.patch
+++ /dev/null
@@ -1,417 +0,0 @@
-From da65137c39b3662f0288b5149b14c82d2cfa4000 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:30 +0200
-Subject: [PATCH 13/32] accel/mshv: Add vCPU creation and execution loop
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [11/30] e235ebda329666192a3bf95fb4fee018f5f5f10e
-
-Create MSHV vCPUs using MSHV_CREATE_VP and initialize their state.
-Register the MSHV CPU execution loop loop with the QEMU accelerator
-framework to enable guest code execution.
-
-The target/i386 functionality is still mostly stubbed out and will be
-populated in a later commit in this series.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-11-magnuskulke@linux.microsoft.com
-[Fix g_free/g_clear_pointer confusion; rename qemu_wait_io_event;
- mshv.h/mshv_int.h split. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 4dc5d4257259764b6fcd035870517fc4140d8962)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- accel/mshv/mshv-all.c | 186 +++++++++++++++++++++++++++++++++---
- accel/mshv/trace-events | 2 +
- include/system/mshv.h | 2 +-
- include/system/mshv_int.h | 20 ++++
- target/i386/mshv/mshv-cpu.c | 63 ++++++++++++
- 5 files changed, 260 insertions(+), 13 deletions(-)
-
-diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
-index 653195c57c..e02421d79d 100644
---- a/accel/mshv/mshv-all.c
-+++ b/accel/mshv/mshv-all.c
-@@ -393,6 +393,24 @@ int mshv_hvcall(int fd, const struct mshv_root_hvcall *args)
- return ret;
- }
-
-+static int mshv_init_vcpu(CPUState *cpu)
-+{
-+ int vm_fd = mshv_state->vm;
-+ uint8_t vp_index = cpu->cpu_index;
-+ int ret;
-+
-+ mshv_arch_init_vcpu(cpu);
-+ cpu->accel = g_new0(AccelCPUState, 1);
-+
-+ ret = mshv_create_vcpu(vm_fd, vp_index, &cpu->accel->cpufd);
-+ if (ret < 0) {
-+ return -1;
-+ }
-+
-+ cpu->accel->dirty = true;
-+
-+ return 0;
-+}
-
- static int mshv_init(AccelState *as, MachineState *ms)
- {
-@@ -415,6 +433,8 @@ static int mshv_init(AccelState *as, MachineState *ms)
- return -1;
- }
-
-+ mshv_init_mmio_emu();
-+
- mshv_init_msicontrol();
-
- ret = create_vm(mshv_fd, &vm_fd);
-@@ -444,40 +464,182 @@ static int mshv_init(AccelState *as, MachineState *ms)
- return 0;
- }
-
-+static int mshv_destroy_vcpu(CPUState *cpu)
-+{
-+ int cpu_fd = mshv_vcpufd(cpu);
-+ int vm_fd = mshv_state->vm;
-+
-+ mshv_remove_vcpu(vm_fd, cpu_fd);
-+ mshv_vcpufd(cpu) = 0;
-+
-+ mshv_arch_destroy_vcpu(cpu);
-+ g_clear_pointer(&cpu->accel, g_free);
-+ return 0;
-+}
-+
-+static int mshv_cpu_exec(CPUState *cpu)
-+{
-+ hv_message mshv_msg;
-+ enum MshvVmExit exit_reason;
-+ int ret = 0;
-+
-+ bql_unlock();
-+ cpu_exec_start(cpu);
-+
-+ do {
-+ if (cpu->accel->dirty) {
-+ ret = mshv_arch_put_registers(cpu);
-+ if (ret) {
-+ error_report("Failed to put registers after init: %s",
-+ strerror(-ret));
-+ ret = -1;
-+ break;
-+ }
-+ cpu->accel->dirty = false;
-+ }
-+
-+ ret = mshv_run_vcpu(mshv_state->vm, cpu, &mshv_msg, &exit_reason);
-+ if (ret < 0) {
-+ error_report("Failed to run on vcpu %d", cpu->cpu_index);
-+ abort();
-+ }
-+
-+ switch (exit_reason) {
-+ case MshvVmExitIgnore:
-+ break;
-+ default:
-+ ret = EXCP_INTERRUPT;
-+ break;
-+ }
-+ } while (ret == 0);
-+
-+ cpu_exec_end(cpu);
-+ bql_lock();
-+
-+ if (ret < 0) {
-+ cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
-+ vm_stop(RUN_STATE_INTERNAL_ERROR);
-+ }
-+
-+ return ret;
-+}
-+
-+static void *mshv_vcpu_thread(void *arg)
-+{
-+ CPUState *cpu = arg;
-+ int ret;
-+
-+ rcu_register_thread();
-+
-+ bql_lock();
-+ qemu_thread_get_self(cpu->thread);
-+ cpu->thread_id = qemu_get_thread_id();
-+ current_cpu = cpu;
-+ ret = mshv_init_vcpu(cpu);
-+ if (ret < 0) {
-+ error_report("Failed to init vcpu %d", cpu->cpu_index);
-+ goto cleanup;
-+ }
-+
-+ /* signal CPU creation */
-+ cpu_thread_signal_created(cpu);
-+ qemu_guest_random_seed_thread_part2(cpu->random_seed);
-+
-+ do {
-+ qemu_process_cpu_events(cpu);
-+ if (cpu_can_run(cpu)) {
-+ mshv_cpu_exec(cpu);
-+ }
-+ } while (!cpu->unplug || cpu_can_run(cpu));
-+
-+ mshv_destroy_vcpu(cpu);
-+cleanup:
-+ cpu_thread_signal_destroyed(cpu);
-+ bql_unlock();
-+ rcu_unregister_thread();
-+ return NULL;
-+}
-+
- static void mshv_start_vcpu_thread(CPUState *cpu)
- {
-- error_report("unimplemented");
-- abort();
-+ char thread_name[VCPU_THREAD_NAME_SIZE];
-+
-+ cpu->thread = g_malloc0(sizeof(QemuThread));
-+ cpu->halt_cond = g_malloc0(sizeof(QemuCond));
-+
-+ qemu_cond_init(cpu->halt_cond);
-+
-+ trace_mshv_start_vcpu_thread(thread_name, cpu->cpu_index);
-+ qemu_thread_create(cpu->thread, thread_name, mshv_vcpu_thread, cpu,
-+ QEMU_THREAD_JOINABLE);
-+}
-+
-+static void do_mshv_cpu_synchronize_post_init(CPUState *cpu,
-+ run_on_cpu_data arg)
-+{
-+ int ret = mshv_arch_put_registers(cpu);
-+ if (ret < 0) {
-+ error_report("Failed to put registers after init: %s", strerror(-ret));
-+ abort();
-+ }
-+
-+ cpu->accel->dirty = false;
- }
-
- static void mshv_cpu_synchronize_post_init(CPUState *cpu)
- {
-- error_report("unimplemented");
-- abort();
-+ run_on_cpu(cpu, do_mshv_cpu_synchronize_post_init, RUN_ON_CPU_NULL);
- }
-
- static void mshv_cpu_synchronize_post_reset(CPUState *cpu)
- {
-- error_report("unimplemented");
-- abort();
-+ int ret = mshv_arch_put_registers(cpu);
-+ if (ret) {
-+ error_report("Failed to put registers after reset: %s",
-+ strerror(-ret));
-+ cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
-+ vm_stop(RUN_STATE_INTERNAL_ERROR);
-+ }
-+ cpu->accel->dirty = false;
-+}
-+
-+static void do_mshv_cpu_synchronize_pre_loadvm(CPUState *cpu,
-+ run_on_cpu_data arg)
-+{
-+ cpu->accel->dirty = true;
- }
-
- static void mshv_cpu_synchronize_pre_loadvm(CPUState *cpu)
- {
-- error_report("unimplemented");
-- abort();
-+ run_on_cpu(cpu, do_mshv_cpu_synchronize_pre_loadvm, RUN_ON_CPU_NULL);
-+}
-+
-+static void do_mshv_cpu_synchronize(CPUState *cpu, run_on_cpu_data arg)
-+{
-+ if (!cpu->accel->dirty) {
-+ int ret = mshv_load_regs(cpu);
-+ if (ret < 0) {
-+ error_report("Failed to load registers for vcpu %d",
-+ cpu->cpu_index);
-+
-+ cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
-+ vm_stop(RUN_STATE_INTERNAL_ERROR);
-+ }
-+
-+ cpu->accel->dirty = true;
-+ }
- }
-
- static void mshv_cpu_synchronize(CPUState *cpu)
- {
-- error_report("unimplemented");
-- abort();
-+ if (!cpu->accel->dirty) {
-+ run_on_cpu(cpu, do_mshv_cpu_synchronize, RUN_ON_CPU_NULL);
-+ }
- }
-
- static bool mshv_cpus_are_resettable(void)
- {
-- error_report("unimplemented");
-- abort();
-+ return false;
- }
-
- static void mshv_accel_class_init(ObjectClass *oc, const void *data)
-diff --git a/accel/mshv/trace-events b/accel/mshv/trace-events
-index 6130c4abf8..a4dffeb24a 100644
---- a/accel/mshv/trace-events
-+++ b/accel/mshv/trace-events
-@@ -3,6 +3,8 @@
- #
- # SPDX-License-Identifier: GPL-2.0-or-later
-
-+mshv_start_vcpu_thread(const char* thread, uint32_t cpu) "thread=%s cpu_index=%d"
-+
- mshv_set_memory(bool add, uint64_t gpa, uint64_t size, uint64_t user_addr, bool readonly, int ret) "add=%d gpa=0x%" PRIx64 " size=0x%" PRIx64 " user=0x%" PRIx64 " readonly=%d result=%d"
- mshv_mem_ioeventfd_add(uint64_t addr, uint32_t size, uint32_t data) "addr=0x%" PRIx64 " size=%d data=0x%x"
- mshv_mem_ioeventfd_del(uint64_t addr, uint32_t size, uint32_t data) "addr=0x%" PRIx64 " size=%d data=0x%x"
-diff --git a/include/system/mshv.h b/include/system/mshv.h
-index 1011e81df4..bbc42f4dc3 100644
---- a/include/system/mshv.h
-+++ b/include/system/mshv.h
-@@ -41,7 +41,7 @@ extern bool mshv_allowed;
- #define mshv_msi_via_irqfd_enabled() mshv_enabled()
- #else /* CONFIG_MSHV_IS_POSSIBLE */
- #define mshv_enabled() false
--#define mshv_msi_via_irqfd_enabled() false
-+#define mshv_msi_via_irqfd_enabled() mshv_enabled()
- #endif
-
- typedef struct MshvState MshvState;
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-index b36124a0ea..fb80f69772 100644
---- a/include/system/mshv_int.h
-+++ b/include/system/mshv_int.h
-@@ -14,6 +14,8 @@
- #ifndef QEMU_MSHV_INT_H
- #define QEMU_MSHV_INT_H
-
-+typedef struct hyperv_message hv_message;
-+
- struct AccelCPUState {
- int cpufd;
- bool dirty;
-@@ -44,6 +46,24 @@ typedef struct MshvMsiControl {
- GHashTable *gsi_routes;
- } MshvMsiControl;
-
-+#define mshv_vcpufd(cpu) (cpu->accel->cpufd)
-+
-+/* cpu */
-+typedef enum MshvVmExit {
-+ MshvVmExitIgnore = 0,
-+ MshvVmExitShutdown = 1,
-+ MshvVmExitSpecial = 2,
-+} MshvVmExit;
-+
-+void mshv_init_mmio_emu(void);
-+int mshv_create_vcpu(int vm_fd, uint8_t vp_index, int *cpu_fd);
-+void mshv_remove_vcpu(int vm_fd, int cpu_fd);
-+int mshv_run_vcpu(int vm_fd, CPUState *cpu, hv_message *msg, MshvVmExit *exit);
-+int mshv_load_regs(CPUState *cpu);
-+int mshv_store_regs(CPUState *cpu);
-+int mshv_arch_put_registers(const CPUState *cpu);
-+void mshv_arch_init_vcpu(CPUState *cpu);
-+void mshv_arch_destroy_vcpu(CPUState *cpu);
- void mshv_arch_amend_proc_features(
- union hv_partition_synthetic_processor_features *features);
- int mshv_arch_post_init_vm(int vm_fd);
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index de0c26bc6c..02d71ebc14 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -22,15 +22,78 @@
- #include "hw/hyperv/hvgdk_mini.h"
- #include "hw/hyperv/hvhdk_mini.h"
-
-+#include "cpu.h"
-+#include "emulate/x86_decode.h"
-+#include "emulate/x86_emu.h"
-+#include "emulate/x86_flags.h"
-+
- #include "trace-accel_mshv.h"
- #include "trace.h"
-
-+int mshv_store_regs(CPUState *cpu)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+int mshv_load_regs(CPUState *cpu)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+int mshv_arch_put_registers(const CPUState *cpu)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
- void mshv_arch_amend_proc_features(
- union hv_partition_synthetic_processor_features *features)
- {
- features->access_guest_idle_reg = 1;
- }
-
-+int mshv_run_vcpu(int vm_fd, CPUState *cpu, hv_message *msg, MshvVmExit *exit)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+void mshv_remove_vcpu(int vm_fd, int cpu_fd)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+int mshv_create_vcpu(int vm_fd, uint8_t vp_index, int *cpu_fd)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+void mshv_init_mmio_emu(void)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-+void mshv_arch_init_vcpu(CPUState *cpu)
-+{
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+
-+ env->emu_mmio_buf = g_new(char, 4096);
-+}
-+
-+void mshv_arch_destroy_vcpu(CPUState *cpu)
-+{
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+
-+ g_clear_pointer(&env->emu_mmio_buf, g_free);
-+}
-+
- /*
- * Default Microsoft Hypervisor behavior for unimplemented MSR is to send a
- * fault to the guest if it tries to access it. It is possible to override
---
-2.47.3
-
diff --git a/kvm-accel-mshv-Add-vCPU-signal-handling.patch b/kvm-accel-mshv-Add-vCPU-signal-handling.patch
deleted file mode 100644
index 918e2b4..0000000
--- a/kvm-accel-mshv-Add-vCPU-signal-handling.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 38112aed4e07ec8f43b552f887bc2077e443ba4b Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:31 +0200
-Subject: [PATCH 14/32] accel/mshv: Add vCPU signal handling
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [12/30] c3c9c5d9ad4d335a12c9d54499e4a2902b523441
-
-Implement signal handling for MSHV vCPUs to support asynchronous
-interrupts from the main thread.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-12-magnuskulke@linux.microsoft.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 575df4df54e060661db45e6f80293b29ea8901c1)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- accel/mshv/mshv-all.c | 30 ++++++++++++++++++++++++++++++
- 1 file changed, 30 insertions(+)
-
-diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
-index e02421d79d..fa1f8f35bd 100644
---- a/accel/mshv/mshv-all.c
-+++ b/accel/mshv/mshv-all.c
-@@ -524,6 +524,35 @@ static int mshv_cpu_exec(CPUState *cpu)
- return ret;
- }
-
-+/*
-+ * The signal handler is triggered when QEMU's main thread receives a SIG_IPI
-+ * (SIGUSR1). This signal causes the current CPU thread to be kicked, forcing a
-+ * VM exit on the CPU. The VM exit generates an exit reason that breaks the loop
-+ * (see mshv_cpu_exec). If the exit is due to a Ctrl+A+x command, the system
-+ * will shut down. For other cases, the system will continue running.
-+ */
-+static void sa_ipi_handler(int sig)
-+{
-+ /* TODO: call IOCTL to set_immediate_exit, once implemented. */
-+
-+ qemu_cpu_kick_self();
-+}
-+
-+static void init_signal(CPUState *cpu)
-+{
-+ /* init cpu signals */
-+ struct sigaction sigact;
-+ sigset_t set;
-+
-+ memset(&sigact, 0, sizeof(sigact));
-+ sigact.sa_handler = sa_ipi_handler;
-+ sigaction(SIG_IPI, &sigact, NULL);
-+
-+ pthread_sigmask(SIG_BLOCK, NULL, &set);
-+ sigdelset(&set, SIG_IPI);
-+ pthread_sigmask(SIG_SETMASK, &set, NULL);
-+}
-+
- static void *mshv_vcpu_thread(void *arg)
- {
- CPUState *cpu = arg;
-@@ -540,6 +569,7 @@ static void *mshv_vcpu_thread(void *arg)
- error_report("Failed to init vcpu %d", cpu->cpu_index);
- goto cleanup;
- }
-+ init_signal(cpu);
-
- /* signal CPU creation */
- cpu_thread_signal_created(cpu);
---
-2.47.3
-
diff --git a/kvm-accel-mshv-Handle-overlapping-mem-mappings.patch b/kvm-accel-mshv-Handle-overlapping-mem-mappings.patch
deleted file mode 100644
index 92181b5..0000000
--- a/kvm-accel-mshv-Handle-overlapping-mem-mappings.patch
+++ /dev/null
@@ -1,695 +0,0 @@
-From c6e4e7657d407507a5e8cc6daadc6f309e8a42e9 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:43 +0200
-Subject: [PATCH 26/32] accel/mshv: Handle overlapping mem mappings
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [24/30] abe9045eadeabccae811682dccd8679f41c32cc0
-
-QEMU maps certain regions into the guest multiple times, as seen in the
-trace below. Currently the MSHV kernel driver will reject those
-mappings. To workaround this, a record is kept (a static global list of
-"slots", inspired by what the HVF accelerator has implemented). An
-overlapping region is not registered at the hypervisor, and marked as
-mapped=false. If there is an UNMAPPED_GPA exit, we can look for a slot
-that is unmapped and would cover the GPA. In this case we map out the
-conflicting slot and map in the requested region.
-
-mshv_set_phys_mem add=1 name=pc.bios
-mshv_map_memory => u_a=7ffff4e00000 gpa=00fffc0000 size=00040000
-mshv_set_phys_mem add=1 name=ioapic
-mshv_set_phys_mem add=1 name=hpet
-mshv_set_phys_mem add=0 name=pc.ram
-mshv_unmap_memory u_a=7fff67e00000 gpa=0000000000 size=80000000
-mshv_set_phys_mem add=1 name=pc.ram
-mshv_map_memory u_a=7fff67e00000 gpa=0000000000 size=000c0000
-mshv_set_phys_mem add=1 name=pc.rom
-mshv_map_memory u_a=7ffff4c00000 gpa=00000c0000 size=00020000
-mshv_set_phys_mem add=1 name=pc.bios
-mshv_remap_attempt => u_a=7ffff4e20000 gpa=00000e0000 size=00020000
-
-The mapping table is guarded by a mutex for concurrent modification and
-RCU mechanisms for concurrent reads. Writes occur rarely, but we'll have
-to verify whether an unmapped region exist for each UNMAPPED_GPA exit,
-which happens frequently.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-24-magnuskulke@linux.microsoft.com
-[Fix format strings for trace-events; mshv.h/mshv_int.h split. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit efc4093358511a58846a409b965213aa1bb9f31a)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- accel/mshv/mem.c | 406 +++++++++++++++++++++++++++++++++---
- accel/mshv/mshv-all.c | 2 +
- accel/mshv/trace-events | 5 +
- include/system/mshv_int.h | 22 +-
- target/i386/mshv/mshv-cpu.c | 43 ++++
- 5 files changed, 448 insertions(+), 30 deletions(-)
-
-diff --git a/accel/mshv/mem.c b/accel/mshv/mem.c
-index e55c38d4db..0e2164af3e 100644
---- a/accel/mshv/mem.c
-+++ b/accel/mshv/mem.c
-@@ -11,7 +11,9 @@
- */
-
- #include "qemu/osdep.h"
-+#include "qemu/lockable.h"
- #include "qemu/error-report.h"
-+#include "qemu/rcu.h"
- #include "linux/mshv.h"
- #include "system/address-spaces.h"
- #include "system/mshv.h"
-@@ -20,6 +22,137 @@
- #include <sys/ioctl.h>
- #include "trace.h"
-
-+typedef struct SlotsRCUReclaim {
-+ struct rcu_head rcu;
-+ GList *old_head;
-+ MshvMemorySlot *removed_slot;
-+} SlotsRCUReclaim;
-+
-+static void rcu_reclaim_slotlist(struct rcu_head *rcu)
-+{
-+ SlotsRCUReclaim *r = container_of(rcu, SlotsRCUReclaim, rcu);
-+ g_list_free(r->old_head);
-+ g_free(r->removed_slot);
-+ g_free(r);
-+}
-+
-+static void publish_slots(GList *new_head, GList *old_head,
-+ MshvMemorySlot *removed_slot)
-+{
-+ MshvMemorySlotManager *manager = &mshv_state->msm;
-+
-+ assert(manager);
-+ qatomic_store_release(&manager->slots, new_head);
-+
-+ SlotsRCUReclaim *r = g_new(SlotsRCUReclaim, 1);
-+ r->old_head = old_head;
-+ r->removed_slot = removed_slot;
-+
-+ call_rcu1(&r->rcu, rcu_reclaim_slotlist);
-+}
-+
-+/* Needs to be called with mshv_state->msm.mutex held */
-+static int remove_slot(MshvMemorySlot *slot)
-+{
-+ GList *old_head, *new_head;
-+ MshvMemorySlotManager *manager = &mshv_state->msm;
-+
-+ assert(manager);
-+ old_head = qatomic_load_acquire(&manager->slots);
-+
-+ if (!g_list_find(old_head, slot)) {
-+ error_report("slot requested for removal not found");
-+ return -1;
-+ }
-+
-+ new_head = g_list_copy(old_head);
-+ new_head = g_list_remove(new_head, slot);
-+ manager->n_slots--;
-+
-+ publish_slots(new_head, old_head, slot);
-+
-+ return 0;
-+}
-+
-+/* Needs to be called with mshv_state->msm.mutex held */
-+static MshvMemorySlot *append_slot(uint64_t gpa, uint64_t userspace_addr,
-+ uint64_t size, bool readonly)
-+{
-+ GList *old_head, *new_head;
-+ MshvMemorySlot *slot;
-+ MshvMemorySlotManager *manager = &mshv_state->msm;
-+
-+ assert(manager);
-+
-+ old_head = qatomic_load_acquire(&manager->slots);
-+
-+ if (manager->n_slots >= MSHV_MAX_MEM_SLOTS) {
-+ error_report("no free memory slots available");
-+ return NULL;
-+ }
-+
-+ slot = g_new0(MshvMemorySlot, 1);
-+ slot->guest_phys_addr = gpa;
-+ slot->userspace_addr = userspace_addr;
-+ slot->memory_size = size;
-+ slot->readonly = readonly;
-+
-+ new_head = g_list_copy(old_head);
-+ new_head = g_list_append(new_head, slot);
-+ manager->n_slots++;
-+
-+ publish_slots(new_head, old_head, NULL);
-+
-+ return slot;
-+}
-+
-+static int slot_overlaps(const MshvMemorySlot *slot1,
-+ const MshvMemorySlot *slot2)
-+{
-+ uint64_t start_1 = slot1->userspace_addr,
-+ start_2 = slot2->userspace_addr;
-+ size_t len_1 = slot1->memory_size,
-+ len_2 = slot2->memory_size;
-+
-+ if (slot1 == slot2) {
-+ return -1;
-+ }
-+
-+ return ranges_overlap(start_1, len_1, start_2, len_2) ? 0 : -1;
-+}
-+
-+static bool is_mapped(MshvMemorySlot *slot)
-+{
-+ /* Subsequent reads of mapped field see a fully-initialized slot */
-+ return qatomic_load_acquire(&slot->mapped);
-+}
-+
-+/*
-+ * Find slot that is:
-+ * - overlapping in userspace
-+ * - currently mapped in the guest
-+ *
-+ * Needs to be called with mshv_state->msm.mutex or RCU read lock held.
-+ */
-+static MshvMemorySlot *find_overlap_mem_slot(GList *head, MshvMemorySlot *slot)
-+{
-+ GList *found;
-+ MshvMemorySlot *overlap_slot;
-+
-+ found = g_list_find_custom(head, slot, (GCompareFunc) slot_overlaps);
-+
-+ if (!found) {
-+ return NULL;
-+ }
-+
-+ overlap_slot = found->data;
-+ if (!overlap_slot || !is_mapped(overlap_slot)) {
-+ return NULL;
-+ }
-+
-+ return overlap_slot;
-+}
-+
- static int set_guest_memory(int vm_fd,
- const struct mshv_user_mem_region *region)
- {
-@@ -27,38 +160,169 @@ static int set_guest_memory(int vm_fd,
-
- ret = ioctl(vm_fd, MSHV_SET_GUEST_MEMORY, region);
- if (ret < 0) {
-- error_report("failed to set guest memory");
-- return -errno;
-+ error_report("failed to set guest memory: %s", strerror(errno));
-+ return -1;
- }
-
- return 0;
- }
-
--static int map_or_unmap(int vm_fd, const MshvMemoryRegion *mr, bool map)
-+static int map_or_unmap(int vm_fd, const MshvMemorySlot *slot, bool map)
- {
- struct mshv_user_mem_region region = {0};
-
-- region.guest_pfn = mr->guest_phys_addr >> MSHV_PAGE_SHIFT;
-- region.size = mr->memory_size;
-- region.userspace_addr = mr->userspace_addr;
-+ region.guest_pfn = slot->guest_phys_addr >> MSHV_PAGE_SHIFT;
-+ region.size = slot->memory_size;
-+ region.userspace_addr = slot->userspace_addr;
-
- if (!map) {
- region.flags |= (1 << MSHV_SET_MEM_BIT_UNMAP);
-- trace_mshv_unmap_memory(mr->userspace_addr, mr->guest_phys_addr,
-- mr->memory_size);
-+ trace_mshv_unmap_memory(slot->userspace_addr, slot->guest_phys_addr,
-+ slot->memory_size);
- return set_guest_memory(vm_fd, ®ion);
- }
-
- region.flags = BIT(MSHV_SET_MEM_BIT_EXECUTABLE);
-- if (!mr->readonly) {
-+ if (!slot->readonly) {
- region.flags |= BIT(MSHV_SET_MEM_BIT_WRITABLE);
- }
-
-- trace_mshv_map_memory(mr->userspace_addr, mr->guest_phys_addr,
-- mr->memory_size);
-+ trace_mshv_map_memory(slot->userspace_addr, slot->guest_phys_addr,
-+ slot->memory_size);
- return set_guest_memory(vm_fd, ®ion);
- }
-
-+static int slot_matches_region(const MshvMemorySlot *slot1,
-+ const MshvMemorySlot *slot2)
-+{
-+ return (slot1->guest_phys_addr == slot2->guest_phys_addr &&
-+ slot1->userspace_addr == slot2->userspace_addr &&
-+ slot1->memory_size == slot2->memory_size) ? 0 : -1;
-+}
-+
-+/* Needs to be called with mshv_state->msm.mutex held */
-+static MshvMemorySlot *find_mem_slot_by_region(uint64_t gpa, uint64_t size,
-+ uint64_t userspace_addr)
-+{
-+ MshvMemorySlot ref_slot = {
-+ .guest_phys_addr = gpa,
-+ .userspace_addr = userspace_addr,
-+ .memory_size = size,
-+ };
-+ GList *found;
-+ MshvMemorySlotManager *manager = &mshv_state->msm;
-+
-+ assert(manager);
-+ found = g_list_find_custom(manager->slots, &ref_slot,
-+ (GCompareFunc) slot_matches_region);
-+
-+ return found ? found->data : NULL;
-+}
-+
-+static int slot_covers_gpa(const MshvMemorySlot *slot, uint64_t *gpa_p)
-+{
-+ uint64_t gpa_offset, gpa = *gpa_p;
-+
-+ gpa_offset = gpa - slot->guest_phys_addr;
-+ return (slot->guest_phys_addr <= gpa && gpa_offset < slot->memory_size)
-+ ? 0 : -1;
-+}
-+
-+/* Needs to be called with mshv_state->msm.mutex or RCU read lock held */
-+static MshvMemorySlot *find_mem_slot_by_gpa(GList *head, uint64_t gpa)
-+{
-+ GList *found;
-+ MshvMemorySlot *slot;
-+
-+ trace_mshv_find_slot_by_gpa(gpa);
-+
-+ found = g_list_find_custom(head, &gpa, (GCompareFunc) slot_covers_gpa);
-+ if (found) {
-+ slot = found->data;
-+ trace_mshv_found_slot(slot->userspace_addr, slot->guest_phys_addr,
-+ slot->memory_size);
-+ return slot;
-+ }
-+
-+ return NULL;
-+}
-+
-+/* Needs to be called with mshv_state->msm.mutex held */
-+static void set_mapped(MshvMemorySlot *slot, bool mapped)
-+{
-+ /* prior writes to mapped field becomes visible before readers see slot */
-+ qatomic_store_release(&slot->mapped, mapped);
-+}
-+
-+MshvRemapResult mshv_remap_overlap_region(int vm_fd, uint64_t gpa)
-+{
-+ MshvMemorySlot *gpa_slot, *overlap_slot;
-+ GList *head;
-+ int ret;
-+ MshvMemorySlotManager *manager = &mshv_state->msm;
-+
-+ /* fast path, called often by unmapped_gpa vm exit */
-+ WITH_RCU_READ_LOCK_GUARD() {
-+ assert(manager);
-+ head = qatomic_load_acquire(&manager->slots);
-+ /* return early if no slot is found */
-+ gpa_slot = find_mem_slot_by_gpa(head, gpa);
-+ if (gpa_slot == NULL) {
-+ return MshvRemapNoMapping;
-+ }
-+
-+ /* return early if no overlapping slot is found */
-+ overlap_slot = find_overlap_mem_slot(head, gpa_slot);
-+ if (overlap_slot == NULL) {
-+ return MshvRemapNoOverlap;
-+ }
-+ }
-+
-+ /*
-+ * We'll modify the mapping list, so we need to upgrade to mutex and
-+ * recheck.
-+ */
-+ assert(manager);
-+ QEMU_LOCK_GUARD(&manager->mutex);
-+
-+ /* return early if no slot is found */
-+ gpa_slot = find_mem_slot_by_gpa(manager->slots, gpa);
-+ if (gpa_slot == NULL) {
-+ return MshvRemapNoMapping;
-+ }
-+
-+ /* return early if no overlapping slot is found */
-+ overlap_slot = find_overlap_mem_slot(manager->slots, gpa_slot);
-+ if (overlap_slot == NULL) {
-+ return MshvRemapNoOverlap;
-+ }
-+
-+ /* unmap overlapping slot */
-+ ret = map_or_unmap(vm_fd, overlap_slot, false);
-+ if (ret < 0) {
-+ error_report("failed to unmap overlap region");
-+ abort();
-+ }
-+ set_mapped(overlap_slot, false);
-+ warn_report("mapped out userspace_addr=0x%016lx gpa=0x%010lx size=0x%lx",
-+ overlap_slot->userspace_addr,
-+ overlap_slot->guest_phys_addr,
-+ overlap_slot->memory_size);
-+
-+ /* map region for gpa */
-+ ret = map_or_unmap(vm_fd, gpa_slot, true);
-+ if (ret < 0) {
-+ error_report("failed to map new region");
-+ abort();
-+ }
-+ set_mapped(gpa_slot, true);
-+ warn_report("mapped in userspace_addr=0x%016lx gpa=0x%010lx size=0x%lx",
-+ gpa_slot->userspace_addr, gpa_slot->guest_phys_addr,
-+ gpa_slot->memory_size);
-+
-+ return MshvRemapOk;
-+}
-+
- static int handle_unmapped_mmio_region_read(uint64_t gpa, uint64_t size,
- uint8_t *data)
- {
-@@ -124,20 +388,97 @@ int mshv_guest_mem_write(uint64_t gpa, const uint8_t *data, uintptr_t size,
- return -1;
- }
-
--static int set_memory(const MshvMemoryRegion *mshv_mr, bool add)
-+static int tracked_unmap(int vm_fd, uint64_t gpa, uint64_t size,
-+ uint64_t userspace_addr)
- {
-- int ret = 0;
-+ int ret;
-+ MshvMemorySlot *slot;
-+ MshvMemorySlotManager *manager = &mshv_state->msm;
-+
-+ assert(manager);
-+
-+ QEMU_LOCK_GUARD(&manager->mutex);
-+
-+ slot = find_mem_slot_by_region(gpa, size, userspace_addr);
-+ if (!slot) {
-+ trace_mshv_skip_unset_mem(userspace_addr, gpa, size);
-+ /* no work to do */
-+ return 0;
-+ }
-+
-+ if (!is_mapped(slot)) {
-+ /* remove slot, no need to unmap */
-+ return remove_slot(slot);
-+ }
-
-- if (!mshv_mr) {
-- error_report("Invalid mshv_mr");
-+ ret = map_or_unmap(vm_fd, slot, false);
-+ if (ret < 0) {
-+ error_report("failed to unmap memory region");
-+ return ret;
-+ }
-+ return remove_slot(slot);
-+}
-+
-+static int tracked_map(int vm_fd, uint64_t gpa, uint64_t size, bool readonly,
-+ uint64_t userspace_addr)
-+{
-+ MshvMemorySlot *slot, *overlap_slot;
-+ int ret;
-+ MshvMemorySlotManager *manager = &mshv_state->msm;
-+
-+ assert(manager);
-+
-+ QEMU_LOCK_GUARD(&manager->mutex);
-+
-+ slot = find_mem_slot_by_region(gpa, size, userspace_addr);
-+ if (slot) {
-+ error_report("memory region already mapped at gpa=0x%lx, "
-+ "userspace_addr=0x%lx, size=0x%lx",
-+ slot->guest_phys_addr, slot->userspace_addr,
-+ slot->memory_size);
- return -1;
- }
-
-- trace_mshv_set_memory(add, mshv_mr->guest_phys_addr,
-- mshv_mr->memory_size,
-- mshv_mr->userspace_addr, mshv_mr->readonly,
-- ret);
-- return map_or_unmap(mshv_state->vm, mshv_mr, add);
-+ slot = append_slot(gpa, userspace_addr, size, readonly);
-+
-+ overlap_slot = find_overlap_mem_slot(manager->slots, slot);
-+ if (overlap_slot) {
-+ trace_mshv_remap_attempt(slot->userspace_addr,
-+ slot->guest_phys_addr,
-+ slot->memory_size);
-+ warn_report("attempt to map region [0x%lx-0x%lx], while "
-+ "[0x%lx-0x%lx] is already mapped in the guest",
-+ userspace_addr, userspace_addr + size - 1,
-+ overlap_slot->userspace_addr,
-+ overlap_slot->userspace_addr +
-+ overlap_slot->memory_size - 1);
-+
-+ /* do not register mem slot in hv, but record for later swap-in */
-+ set_mapped(slot, false);
-+
-+ return 0;
-+ }
-+
-+ ret = map_or_unmap(vm_fd, slot, true);
-+ if (ret < 0) {
-+ error_report("failed to map memory region");
-+ return -1;
-+ }
-+ set_mapped(slot, true);
-+
-+ return 0;
-+}
-+
-+static int set_memory(uint64_t gpa, uint64_t size, bool readonly,
-+ uint64_t userspace_addr, bool add)
-+{
-+ int vm_fd = mshv_state->vm;
-+
-+ if (add) {
-+ return tracked_map(vm_fd, gpa, size, readonly, userspace_addr);
-+ }
-+
-+ return tracked_unmap(vm_fd, gpa, size, userspace_addr);
- }
-
- /*
-@@ -173,7 +514,9 @@ void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
- bool writable = !area->readonly && !area->rom_device;
- hwaddr start_addr, mr_offset, size;
- void *ram;
-- MshvMemoryRegion mshv_mr = {0};
-+
-+ size = align_section(section, &start_addr);
-+ trace_mshv_set_phys_mem(add, section->mr->name, start_addr);
-
- size = align_section(section, &start_addr);
- trace_mshv_set_phys_mem(add, section->mr->name, start_addr);
-@@ -200,14 +543,21 @@ void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
-
- ram = memory_region_get_ram_ptr(area) + mr_offset;
-
-- mshv_mr.guest_phys_addr = start_addr;
-- mshv_mr.memory_size = size;
-- mshv_mr.readonly = !writable;
-- mshv_mr.userspace_addr = (uint64_t)ram;
--
-- ret = set_memory(&mshv_mr, add);
-+ ret = set_memory(start_addr, size, !writable, (uint64_t)ram, add);
- if (ret < 0) {
-- error_report("Failed to set memory region");
-+ error_report("failed to set memory region");
- abort();
- }
- }
-+
-+void mshv_init_memory_slot_manager(MshvState *mshv_state)
-+{
-+ MshvMemorySlotManager *manager;
-+
-+ assert(mshv_state);
-+ manager = &mshv_state->msm;
-+
-+ manager->n_slots = 0;
-+ manager->slots = NULL;
-+ qemu_mutex_init(&manager->mutex);
-+}
-diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
-index fa1f8f35bd..5edfcbad9d 100644
---- a/accel/mshv/mshv-all.c
-+++ b/accel/mshv/mshv-all.c
-@@ -437,6 +437,8 @@ static int mshv_init(AccelState *as, MachineState *ms)
-
- mshv_init_msicontrol();
-
-+ mshv_init_memory_slot_manager(s);
-+
- ret = create_vm(mshv_fd, &vm_fd);
- if (ret < 0) {
- close(mshv_fd);
-diff --git a/accel/mshv/trace-events b/accel/mshv/trace-events
-index a4dffeb24a..36f0d59b38 100644
---- a/accel/mshv/trace-events
-+++ b/accel/mshv/trace-events
-@@ -26,3 +26,8 @@ mshv_map_memory(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%
- mshv_unmap_memory(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%08" PRIx64
- mshv_set_phys_mem(bool add, const char *name, uint64_t gpa) "\tadd=%d name=%s gpa=0x%010" PRIx64
- mshv_handle_mmio(uint64_t gva, uint64_t gpa, uint64_t size, uint8_t access_type) "\tgva=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%" PRIx64 " access_type=%d"
-+
-+mshv_found_slot(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%08" PRIx64
-+mshv_skip_unset_mem(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%08" PRIx64
-+mshv_remap_attempt(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%08" PRIx64
-+mshv_find_slot_by_gpa(uint64_t gpa) "\tgpa=0x%010" PRIx64
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-index b29d39911d..6350c69e9d 100644
---- a/include/system/mshv_int.h
-+++ b/include/system/mshv_int.h
-@@ -16,6 +16,8 @@
-
- #define MSHV_MSR_ENTRIES_COUNT 64
-
-+#define MSHV_MAX_MEM_SLOTS 32
-+
- typedef struct hyperv_message hv_message;
-
- struct AccelCPUState {
-@@ -33,6 +35,12 @@ typedef struct MshvAddressSpace {
- AddressSpace *as;
- } MshvAddressSpace;
-
-+typedef struct MshvMemorySlotManager {
-+ size_t n_slots;
-+ GList *slots;
-+ QemuMutex mutex;
-+} MshvMemorySlotManager;
-+
- struct MshvState {
- AccelState parent_obj;
- int vm;
-@@ -41,6 +49,7 @@ struct MshvState {
- int nr_as;
- MshvAddressSpace *as;
- int fd;
-+ MshvMemorySlotManager msm;
- };
-
- typedef struct MshvMsiControl {
-@@ -71,6 +80,12 @@ typedef enum MshvVmExit {
- MshvVmExitSpecial = 2,
- } MshvVmExit;
-
-+typedef enum MshvRemapResult {
-+ MshvRemapOk = 0,
-+ MshvRemapNoMapping = 1,
-+ MshvRemapNoOverlap = 2,
-+} MshvRemapResult;
-+
- void mshv_init_mmio_emu(void);
- int mshv_create_vcpu(int vm_fd, uint8_t vp_index, int *cpu_fd);
- void mshv_remove_vcpu(int vm_fd, int cpu_fd);
-@@ -94,19 +109,22 @@ int mshv_hvcall(int fd, const struct mshv_root_hvcall *args);
- #endif
-
- /* memory */
--typedef struct MshvMemoryRegion {
-+typedef struct MshvMemorySlot {
- uint64_t guest_phys_addr;
- uint64_t memory_size;
- uint64_t userspace_addr;
- bool readonly;
--} MshvMemoryRegion;
-+ bool mapped;
-+} MshvMemorySlot;
-
-+MshvRemapResult mshv_remap_overlap_region(int vm_fd, uint64_t gpa);
- int mshv_guest_mem_read(uint64_t gpa, uint8_t *data, uintptr_t size,
- bool is_secure_mode, bool instruction_fetch);
- int mshv_guest_mem_write(uint64_t gpa, const uint8_t *data, uintptr_t size,
- bool is_secure_mode);
- void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
- bool add);
-+void mshv_init_memory_slot_manager(MshvState *mshv_state);
-
- /* msr */
- typedef struct MshvMsrEntry {
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 7edc032cea..de87142bff 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -1170,6 +1170,43 @@ static int handle_mmio(CPUState *cpu, const struct hyperv_message *msg,
- return 0;
- }
-
-+static int handle_unmapped_mem(int vm_fd, CPUState *cpu,
-+ const struct hyperv_message *msg,
-+ MshvVmExit *exit_reason)
-+{
-+ struct hv_x64_memory_intercept_message info = { 0 };
-+ uint64_t gpa;
-+ int ret;
-+ enum MshvRemapResult remap_result;
-+
-+ ret = set_memory_info(msg, &info);
-+ if (ret < 0) {
-+ error_report("failed to convert message to memory info");
-+ return -1;
-+ }
-+
-+ gpa = info.guest_physical_address;
-+
-+ /* attempt to remap the region, in case of overlapping userspace mappings */
-+ remap_result = mshv_remap_overlap_region(vm_fd, gpa);
-+ *exit_reason = MshvVmExitIgnore;
-+
-+ switch (remap_result) {
-+ case MshvRemapNoMapping:
-+ /* if we didn't find a mapping, it is probably mmio */
-+ return handle_mmio(cpu, msg, exit_reason);
-+ case MshvRemapOk:
-+ break;
-+ case MshvRemapNoOverlap:
-+ /* This should not happen, but we are forgiving it */
-+ warn_report("found no overlap for unmapped region");
-+ *exit_reason = MshvVmExitSpecial;
-+ break;
-+ }
-+
-+ return 0;
-+}
-+
- static int set_ioport_info(const struct hyperv_message *msg,
- hv_x64_io_port_intercept_message *info)
- {
-@@ -1507,6 +1544,12 @@ int mshv_run_vcpu(int vm_fd, CPUState *cpu, hv_message *msg, MshvVmExit *exit)
- case HVMSG_UNRECOVERABLE_EXCEPTION:
- return MshvVmExitShutdown;
- case HVMSG_UNMAPPED_GPA:
-+ ret = handle_unmapped_mem(vm_fd, cpu, msg, &exit_reason);
-+ if (ret < 0) {
-+ error_report("failed to handle unmapped memory");
-+ return -1;
-+ }
-+ return exit_reason;
- case HVMSG_GPA_INTERCEPT:
- ret = handle_mmio(cpu, msg, &exit_reason);
- if (ret < 0) {
---
-2.47.3
-
diff --git a/kvm-accel-mshv-Initialize-VM-partition.patch b/kvm-accel-mshv-Initialize-VM-partition.patch
deleted file mode 100644
index da24863..0000000
--- a/kvm-accel-mshv-Initialize-VM-partition.patch
+++ /dev/null
@@ -1,1302 +0,0 @@
-From f2010418608cbbfe00095d628d74006d69e83138 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Thu, 2 Oct 2025 18:28:16 +0200
-Subject: [PATCH 11/32] accel/mshv: Initialize VM partition
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [9/30] 7ef17e116fd86fc05b94f7f1e9bbbd4ae1299fa5
-
-Create the MSHV virtual machine by opening a partition and issuing
-the necessary ioctl to initialize it. This sets up the basic VM
-structure and initial configuration used by MSHV to manage guest state.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-10-magnuskulke@linux.microsoft.com
-[Add stubs; fix format strings for trace-events; make mshv_hvcall
- available only in per-target files; mshv.h/mshv_int.h split. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit c5f23bccde416aab52fe14dec6f6716a85f0cd04)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- accel/mshv/irq.c | 399 +++++++++++++++++++++++++++++++++++
- accel/mshv/mem.c | 129 ++++++++++-
- accel/mshv/meson.build | 1 +
- accel/mshv/mshv-all.c | 326 ++++++++++++++++++++++++++++
- accel/mshv/trace-events | 26 +++
- accel/mshv/trace.h | 14 ++
- accel/stubs/meson.build | 1 +
- accel/stubs/mshv-stub.c | 44 ++++
- hw/intc/apic.c | 8 +
- include/system/mshv.h | 11 +-
- include/system/mshv_int.h | 25 +++
- meson.build | 1 +
- target/i386/mshv/meson.build | 1 +
- target/i386/mshv/mshv-cpu.c | 72 +++++++
- 14 files changed, 1054 insertions(+), 4 deletions(-)
- create mode 100644 accel/mshv/irq.c
- create mode 100644 accel/mshv/trace-events
- create mode 100644 accel/mshv/trace.h
- create mode 100644 accel/stubs/mshv-stub.c
- create mode 100644 target/i386/mshv/mshv-cpu.c
-
-diff --git a/accel/mshv/irq.c b/accel/mshv/irq.c
-new file mode 100644
-index 0000000000..adf8f337d9
---- /dev/null
-+++ b/accel/mshv/irq.c
-@@ -0,0 +1,399 @@
-+/*
-+ * QEMU MSHV support
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * Authors: Ziqiao Zhou <ziqiaozhou@microsoft.com>
-+ * Magnus Kulke <magnuskulke@microsoft.com>
-+ * Stanislav Kinsburskii <skinsburskii@microsoft.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#include "linux/mshv.h"
-+#include "qemu/osdep.h"
-+#include "qemu/error-report.h"
-+#include "hw/hyperv/hvhdk_mini.h"
-+#include "hw/hyperv/hvgdk_mini.h"
-+#include "hw/intc/ioapic.h"
-+#include "hw/pci/msi.h"
-+#include "system/mshv.h"
-+#include "system/mshv_int.h"
-+#include "trace.h"
-+#include <stdint.h>
-+#include <sys/ioctl.h>
-+
-+#define MSHV_IRQFD_RESAMPLE_FLAG (1 << MSHV_IRQFD_BIT_RESAMPLE)
-+#define MSHV_IRQFD_BIT_DEASSIGN_FLAG (1 << MSHV_IRQFD_BIT_DEASSIGN)
-+
-+static MshvMsiControl *msi_control;
-+static QemuMutex msi_control_mutex;
-+
-+void mshv_init_msicontrol(void)
-+{
-+ qemu_mutex_init(&msi_control_mutex);
-+ msi_control = g_new0(MshvMsiControl, 1);
-+ msi_control->gsi_routes = g_hash_table_new(g_direct_hash, g_direct_equal);
-+ msi_control->updated = false;
-+}
-+
-+static int set_msi_routing(uint32_t gsi, uint64_t addr, uint32_t data)
-+{
-+ struct mshv_user_irq_entry *entry;
-+ uint32_t high_addr = addr >> 32;
-+ uint32_t low_addr = addr & 0xFFFFFFFF;
-+ GHashTable *gsi_routes;
-+
-+ trace_mshv_set_msi_routing(gsi, addr, data);
-+
-+ if (gsi >= MSHV_MAX_MSI_ROUTES) {
-+ error_report("gsi >= MSHV_MAX_MSI_ROUTES");
-+ return -1;
-+ }
-+
-+ assert(msi_control);
-+
-+ WITH_QEMU_LOCK_GUARD(&msi_control_mutex) {
-+ gsi_routes = msi_control->gsi_routes;
-+ entry = g_hash_table_lookup(gsi_routes, GINT_TO_POINTER(gsi));
-+
-+ if (entry
-+ && entry->address_hi == high_addr
-+ && entry->address_lo == low_addr
-+ && entry->data == data)
-+ {
-+ /* nothing to update */
-+ return 0;
-+ }
-+
-+ /* free old entry */
-+ g_free(entry);
-+
-+ /* create new entry */
-+ entry = g_new0(struct mshv_user_irq_entry, 1);
-+ entry->gsi = gsi;
-+ entry->address_hi = high_addr;
-+ entry->address_lo = low_addr;
-+ entry->data = data;
-+
-+ g_hash_table_insert(gsi_routes, GINT_TO_POINTER(gsi), entry);
-+ msi_control->updated = true;
-+ }
-+
-+ return 0;
-+}
-+
-+static int add_msi_routing(uint64_t addr, uint32_t data)
-+{
-+ struct mshv_user_irq_entry *route_entry;
-+ uint32_t high_addr = addr >> 32;
-+ uint32_t low_addr = addr & 0xFFFFFFFF;
-+ int gsi;
-+ GHashTable *gsi_routes;
-+
-+ trace_mshv_add_msi_routing(addr, data);
-+
-+ assert(msi_control);
-+
-+ WITH_QEMU_LOCK_GUARD(&msi_control_mutex) {
-+ /* find an empty slot */
-+ gsi = 0;
-+ gsi_routes = msi_control->gsi_routes;
-+ while (gsi < MSHV_MAX_MSI_ROUTES) {
-+ route_entry = g_hash_table_lookup(gsi_routes, GINT_TO_POINTER(gsi));
-+ if (!route_entry) {
-+ break;
-+ }
-+ gsi++;
-+ }
-+ if (gsi >= MSHV_MAX_MSI_ROUTES) {
-+ error_report("No empty gsi slot available");
-+ return -1;
-+ }
-+
-+ /* create new entry */
-+ route_entry = g_new0(struct mshv_user_irq_entry, 1);
-+ route_entry->gsi = gsi;
-+ route_entry->address_hi = high_addr;
-+ route_entry->address_lo = low_addr;
-+ route_entry->data = data;
-+
-+ g_hash_table_insert(gsi_routes, GINT_TO_POINTER(gsi), route_entry);
-+ msi_control->updated = true;
-+ }
-+
-+ return gsi;
-+}
-+
-+static int commit_msi_routing_table(int vm_fd)
-+{
-+ guint len;
-+ int i, ret;
-+ size_t table_size;
-+ struct mshv_user_irq_table *table;
-+ GHashTableIter iter;
-+ gpointer key, value;
-+
-+ assert(msi_control);
-+
-+ WITH_QEMU_LOCK_GUARD(&msi_control_mutex) {
-+ if (!msi_control->updated) {
-+ /* nothing to update */
-+ return 0;
-+ }
-+
-+ /* Calculate the size of the table */
-+ len = g_hash_table_size(msi_control->gsi_routes);
-+ table_size = sizeof(struct mshv_user_irq_table)
-+ + len * sizeof(struct mshv_user_irq_entry);
-+ table = g_malloc0(table_size);
-+
-+ g_hash_table_iter_init(&iter, msi_control->gsi_routes);
-+ i = 0;
-+ while (g_hash_table_iter_next(&iter, &key, &value)) {
-+ struct mshv_user_irq_entry *entry = value;
-+ table->entries[i] = *entry;
-+ i++;
-+ }
-+ table->nr = i;
-+
-+ trace_mshv_commit_msi_routing_table(vm_fd, len);
-+
-+ ret = ioctl(vm_fd, MSHV_SET_MSI_ROUTING, table);
-+ g_free(table);
-+ if (ret < 0) {
-+ error_report("Failed to commit msi routing table");
-+ return -1;
-+ }
-+ msi_control->updated = false;
-+ }
-+ return 0;
-+}
-+
-+static int remove_msi_routing(uint32_t gsi)
-+{
-+ struct mshv_user_irq_entry *route_entry;
-+ GHashTable *gsi_routes;
-+
-+ trace_mshv_remove_msi_routing(gsi);
-+
-+ if (gsi >= MSHV_MAX_MSI_ROUTES) {
-+ error_report("Invalid GSI: %u", gsi);
-+ return -1;
-+ }
-+
-+ assert(msi_control);
-+
-+ WITH_QEMU_LOCK_GUARD(&msi_control_mutex) {
-+ gsi_routes = msi_control->gsi_routes;
-+ route_entry = g_hash_table_lookup(gsi_routes, GINT_TO_POINTER(gsi));
-+ if (route_entry) {
-+ g_hash_table_remove(gsi_routes, GINT_TO_POINTER(gsi));
-+ g_free(route_entry);
-+ msi_control->updated = true;
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+/* Pass an eventfd which is to be used for injecting interrupts from userland */
-+static int irqfd(int vm_fd, int fd, int resample_fd, uint32_t gsi,
-+ uint32_t flags)
-+{
-+ int ret;
-+ struct mshv_user_irqfd arg = {
-+ .fd = fd,
-+ .resamplefd = resample_fd,
-+ .gsi = gsi,
-+ .flags = flags,
-+ };
-+
-+ ret = ioctl(vm_fd, MSHV_IRQFD, &arg);
-+ if (ret < 0) {
-+ error_report("Failed to set irqfd: gsi=%u, fd=%d", gsi, fd);
-+ return -1;
-+ }
-+ return ret;
-+}
-+
-+static int register_irqfd(int vm_fd, int event_fd, uint32_t gsi)
-+{
-+ int ret;
-+
-+ trace_mshv_register_irqfd(vm_fd, event_fd, gsi);
-+
-+ ret = irqfd(vm_fd, event_fd, 0, gsi, 0);
-+ if (ret < 0) {
-+ error_report("Failed to register irqfd: gsi=%u", gsi);
-+ return -1;
-+ }
-+ return 0;
-+}
-+
-+static int register_irqfd_with_resample(int vm_fd, int event_fd,
-+ int resample_fd, uint32_t gsi)
-+{
-+ int ret;
-+ uint32_t flags = MSHV_IRQFD_RESAMPLE_FLAG;
-+
-+ ret = irqfd(vm_fd, event_fd, resample_fd, gsi, flags);
-+ if (ret < 0) {
-+ error_report("Failed to register irqfd with resample: gsi=%u", gsi);
-+ return -errno;
-+ }
-+ return 0;
-+}
-+
-+static int unregister_irqfd(int vm_fd, int event_fd, uint32_t gsi)
-+{
-+ int ret;
-+ uint32_t flags = MSHV_IRQFD_BIT_DEASSIGN_FLAG;
-+
-+ ret = irqfd(vm_fd, event_fd, 0, gsi, flags);
-+ if (ret < 0) {
-+ error_report("Failed to unregister irqfd: gsi=%u", gsi);
-+ return -errno;
-+ }
-+ return 0;
-+}
-+
-+static int irqchip_update_irqfd_notifier_gsi(const EventNotifier *event,
-+ const EventNotifier *resample,
-+ int virq, bool add)
-+{
-+ int fd = event_notifier_get_fd(event);
-+ int rfd = resample ? event_notifier_get_fd(resample) : -1;
-+ int vm_fd = mshv_state->vm;
-+
-+ trace_mshv_irqchip_update_irqfd_notifier_gsi(fd, rfd, virq, add);
-+
-+ if (!add) {
-+ return unregister_irqfd(vm_fd, fd, virq);
-+ }
-+
-+ if (rfd > 0) {
-+ return register_irqfd_with_resample(vm_fd, fd, rfd, virq);
-+ }
-+
-+ return register_irqfd(vm_fd, fd, virq);
-+}
-+
-+
-+int mshv_irqchip_add_msi_route(int vector, PCIDevice *dev)
-+{
-+ MSIMessage msg = { 0, 0 };
-+ int virq = 0;
-+
-+ if (pci_available && dev) {
-+ msg = pci_get_msi_message(dev, vector);
-+ virq = add_msi_routing(msg.address, le32_to_cpu(msg.data));
-+ }
-+
-+ return virq;
-+}
-+
-+void mshv_irqchip_release_virq(int virq)
-+{
-+ remove_msi_routing(virq);
-+}
-+
-+int mshv_irqchip_update_msi_route(int virq, MSIMessage msg, PCIDevice *dev)
-+{
-+ int ret;
-+
-+ ret = set_msi_routing(virq, msg.address, le32_to_cpu(msg.data));
-+ if (ret < 0) {
-+ error_report("Failed to set msi routing");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+int mshv_request_interrupt(MshvState *mshv_state, uint32_t interrupt_type, uint32_t vector,
-+ uint32_t vp_index, bool logical_dest_mode,
-+ bool level_triggered)
-+{
-+ int ret;
-+ int vm_fd = mshv_state->vm;
-+
-+ if (vector == 0) {
-+ warn_report("Ignoring request for interrupt vector 0");
-+ return 0;
-+ }
-+
-+ union hv_interrupt_control control = {
-+ .interrupt_type = interrupt_type,
-+ .level_triggered = level_triggered,
-+ .logical_dest_mode = logical_dest_mode,
-+ .rsvd = 0,
-+ };
-+
-+ struct hv_input_assert_virtual_interrupt arg = {0};
-+ arg.control = control;
-+ arg.dest_addr = (uint64_t)vp_index;
-+ arg.vector = vector;
-+
-+ struct mshv_root_hvcall args = {0};
-+ args.code = HVCALL_ASSERT_VIRTUAL_INTERRUPT;
-+ args.in_sz = sizeof(arg);
-+ args.in_ptr = (uint64_t)&arg;
-+
-+ ret = mshv_hvcall(vm_fd, &args);
-+ if (ret < 0) {
-+ error_report("Failed to request interrupt");
-+ return -errno;
-+ }
-+ return 0;
-+}
-+
-+void mshv_irqchip_commit_routes(void)
-+{
-+ int ret;
-+ int vm_fd = mshv_state->vm;
-+
-+ ret = commit_msi_routing_table(vm_fd);
-+ if (ret < 0) {
-+ error_report("Failed to commit msi routing table");
-+ abort();
-+ }
-+}
-+
-+int mshv_irqchip_add_irqfd_notifier_gsi(const EventNotifier *event,
-+ const EventNotifier *resample,
-+ int virq)
-+{
-+ return irqchip_update_irqfd_notifier_gsi(event, resample, virq, true);
-+}
-+
-+int mshv_irqchip_remove_irqfd_notifier_gsi(const EventNotifier *event,
-+ int virq)
-+{
-+ return irqchip_update_irqfd_notifier_gsi(event, NULL, virq, false);
-+}
-+
-+int mshv_reserve_ioapic_msi_routes(int vm_fd)
-+{
-+ int ret, gsi;
-+
-+ /*
-+ * Reserve GSI 0-23 for IOAPIC pins, to avoid conflicts of legacy
-+ * peripherals with MSI-X devices
-+ */
-+ for (gsi = 0; gsi < IOAPIC_NUM_PINS; gsi++) {
-+ ret = add_msi_routing(0, 0);
-+ if (ret < 0) {
-+ error_report("Failed to reserve GSI %d", gsi);
-+ return -1;
-+ }
-+ }
-+
-+ ret = commit_msi_routing_table(vm_fd);
-+ if (ret < 0) {
-+ error_report("Failed to commit reserved IOAPIC MSI routes");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-diff --git a/accel/mshv/mem.c b/accel/mshv/mem.c
-index 9889918c31..a0a40eb333 100644
---- a/accel/mshv/mem.c
-+++ b/accel/mshv/mem.c
-@@ -12,14 +12,137 @@
-
- #include "qemu/osdep.h"
- #include "qemu/error-report.h"
-+#include "linux/mshv.h"
- #include "system/address-spaces.h"
- #include "system/mshv.h"
- #include "system/mshv_int.h"
-+#include "exec/memattrs.h"
-+#include <sys/ioctl.h>
-+#include "trace.h"
-+
-+static int set_guest_memory(int vm_fd,
-+ const struct mshv_user_mem_region *region)
-+{
-+ int ret;
-+
-+ ret = ioctl(vm_fd, MSHV_SET_GUEST_MEMORY, region);
-+ if (ret < 0) {
-+ error_report("failed to set guest memory");
-+ return -errno;
-+ }
-+
-+ return 0;
-+}
-+
-+static int map_or_unmap(int vm_fd, const MshvMemoryRegion *mr, bool map)
-+{
-+ struct mshv_user_mem_region region = {0};
-+
-+ region.guest_pfn = mr->guest_phys_addr >> MSHV_PAGE_SHIFT;
-+ region.size = mr->memory_size;
-+ region.userspace_addr = mr->userspace_addr;
-+
-+ if (!map) {
-+ region.flags |= (1 << MSHV_SET_MEM_BIT_UNMAP);
-+ trace_mshv_unmap_memory(mr->userspace_addr, mr->guest_phys_addr,
-+ mr->memory_size);
-+ return set_guest_memory(vm_fd, ®ion);
-+ }
-+
-+ region.flags = BIT(MSHV_SET_MEM_BIT_EXECUTABLE);
-+ if (!mr->readonly) {
-+ region.flags |= BIT(MSHV_SET_MEM_BIT_WRITABLE);
-+ }
-+
-+ trace_mshv_map_memory(mr->userspace_addr, mr->guest_phys_addr,
-+ mr->memory_size);
-+ return set_guest_memory(vm_fd, ®ion);
-+}
-+
-+static int set_memory(const MshvMemoryRegion *mshv_mr, bool add)
-+{
-+ int ret = 0;
-+
-+ if (!mshv_mr) {
-+ error_report("Invalid mshv_mr");
-+ return -1;
-+ }
-+
-+ trace_mshv_set_memory(add, mshv_mr->guest_phys_addr,
-+ mshv_mr->memory_size,
-+ mshv_mr->userspace_addr, mshv_mr->readonly,
-+ ret);
-+ return map_or_unmap(mshv_state->vm, mshv_mr, add);
-+}
-+
-+/*
-+ * Calculate and align the start address and the size of the section.
-+ * Return the size. If the size is 0, the aligned section is empty.
-+ */
-+static hwaddr align_section(MemoryRegionSection *section, hwaddr *start)
-+{
-+ hwaddr size = int128_get64(section->size);
-+ hwaddr delta, aligned;
-+
-+ /*
-+ * works in page size chunks, but the function may be called
-+ * with sub-page size and unaligned start address. Pad the start
-+ * address to next and truncate size to previous page boundary.
-+ */
-+ aligned = ROUND_UP(section->offset_within_address_space,
-+ qemu_real_host_page_size());
-+ delta = aligned - section->offset_within_address_space;
-+ *start = aligned;
-+ if (delta > size) {
-+ return 0;
-+ }
-+
-+ return (size - delta) & qemu_real_host_page_mask();
-+}
-
- void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
- bool add)
- {
-- error_report("unimplemented");
-- abort();
--}
-+ int ret = 0;
-+ MemoryRegion *area = section->mr;
-+ bool writable = !area->readonly && !area->rom_device;
-+ hwaddr start_addr, mr_offset, size;
-+ void *ram;
-+ MshvMemoryRegion mshv_mr = {0};
-+
-+ size = align_section(section, &start_addr);
-+ trace_mshv_set_phys_mem(add, section->mr->name, start_addr);
-+
-+ /*
-+ * If the memory device is a writable non-ram area, we do not
-+ * want to map it into the guest memory. If it is not a ROM device,
-+ * we want to remove mshv memory mapping, so accesses will trap.
-+ */
-+ if (!memory_region_is_ram(area)) {
-+ if (writable) {
-+ return;
-+ } else if (!area->romd_mode) {
-+ add = false;
-+ }
-+ }
-+
-+ if (!size) {
-+ return;
-+ }
-
-+ mr_offset = section->offset_within_region + start_addr -
-+ section->offset_within_address_space;
-+
-+ ram = memory_region_get_ram_ptr(area) + mr_offset;
-+
-+ mshv_mr.guest_phys_addr = start_addr;
-+ mshv_mr.memory_size = size;
-+ mshv_mr.readonly = !writable;
-+ mshv_mr.userspace_addr = (uint64_t)ram;
-+
-+ ret = set_memory(&mshv_mr, add);
-+ if (ret < 0) {
-+ error_report("Failed to set memory region");
-+ abort();
-+ }
-+}
-diff --git a/accel/mshv/meson.build b/accel/mshv/meson.build
-index 8a6beb3fb1..f88fc8678c 100644
---- a/accel/mshv/meson.build
-+++ b/accel/mshv/meson.build
-@@ -1,5 +1,6 @@
- mshv_ss = ss.source_set()
- mshv_ss.add(if_true: files(
-+ 'irq.c',
- 'mem.c',
- 'mshv-all.c'
- ))
-diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
-index a684a36677..653195c57c 100644
---- a/accel/mshv/mshv-all.c
-+++ b/accel/mshv/mshv-all.c
-@@ -7,6 +7,7 @@
- * Ziqiao Zhou <ziqiaozhou@microsoft.com>
- * Magnus Kulke <magnuskulke@microsoft.com>
- * Jinank Jain <jinankjain@microsoft.com>
-+ * Wei Liu <liuwe@microsoft.com>
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- *
-@@ -23,6 +24,7 @@
- #include "hw/hyperv/hvhdk.h"
- #include "hw/hyperv/hvhdk_mini.h"
- #include "hw/hyperv/hvgdk.h"
-+#include "hw/hyperv/hvgdk_mini.h"
- #include "linux/mshv.h"
-
- #include "qemu/accel.h"
-@@ -49,6 +51,175 @@ bool mshv_allowed;
-
- MshvState *mshv_state;
-
-+static int init_mshv(int *mshv_fd)
-+{
-+ int fd = open("/dev/mshv", O_RDWR | O_CLOEXEC);
-+ if (fd < 0) {
-+ error_report("Failed to open /dev/mshv: %s", strerror(errno));
-+ return -1;
-+ }
-+ *mshv_fd = fd;
-+ return 0;
-+}
-+
-+/* freeze 1 to pause, 0 to resume */
-+static int set_time_freeze(int vm_fd, int freeze)
-+{
-+ int ret;
-+ struct hv_input_set_partition_property in = {0};
-+ in.property_code = HV_PARTITION_PROPERTY_TIME_FREEZE;
-+ in.property_value = freeze;
-+
-+ struct mshv_root_hvcall args = {0};
-+ args.code = HVCALL_SET_PARTITION_PROPERTY;
-+ args.in_sz = sizeof(in);
-+ args.in_ptr = (uint64_t)∈
-+
-+ ret = mshv_hvcall(vm_fd, &args);
-+ if (ret < 0) {
-+ error_report("Failed to set time freeze");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int pause_vm(int vm_fd)
-+{
-+ int ret;
-+
-+ ret = set_time_freeze(vm_fd, 1);
-+ if (ret < 0) {
-+ error_report("Failed to pause partition: %s", strerror(errno));
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int resume_vm(int vm_fd)
-+{
-+ int ret;
-+
-+ ret = set_time_freeze(vm_fd, 0);
-+ if (ret < 0) {
-+ error_report("Failed to resume partition: %s", strerror(errno));
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int create_partition(int mshv_fd, int *vm_fd)
-+{
-+ int ret;
-+ struct mshv_create_partition args = {0};
-+
-+ /* Initialize pt_flags with the desired features */
-+ uint64_t pt_flags = (1ULL << MSHV_PT_BIT_LAPIC) |
-+ (1ULL << MSHV_PT_BIT_X2APIC) |
-+ (1ULL << MSHV_PT_BIT_GPA_SUPER_PAGES);
-+
-+ /* Set default isolation type */
-+ uint64_t pt_isolation = MSHV_PT_ISOLATION_NONE;
-+
-+ args.pt_flags = pt_flags;
-+ args.pt_isolation = pt_isolation;
-+
-+ ret = ioctl(mshv_fd, MSHV_CREATE_PARTITION, &args);
-+ if (ret < 0) {
-+ error_report("Failed to create partition: %s", strerror(errno));
-+ return -1;
-+ }
-+
-+ *vm_fd = ret;
-+ return 0;
-+}
-+
-+static int set_synthetic_proc_features(int vm_fd)
-+{
-+ int ret;
-+ struct hv_input_set_partition_property in = {0};
-+ union hv_partition_synthetic_processor_features features = {0};
-+
-+ /* Access the bitfield and set the desired features */
-+ features.hypervisor_present = 1;
-+ features.hv1 = 1;
-+ features.access_partition_reference_counter = 1;
-+ features.access_synic_regs = 1;
-+ features.access_synthetic_timer_regs = 1;
-+ features.access_partition_reference_tsc = 1;
-+ features.access_frequency_regs = 1;
-+ features.access_intr_ctrl_regs = 1;
-+ features.access_vp_index = 1;
-+ features.access_hypercall_regs = 1;
-+ features.tb_flush_hypercalls = 1;
-+ features.synthetic_cluster_ipi = 1;
-+ features.direct_synthetic_timers = 1;
-+
-+ mshv_arch_amend_proc_features(&features);
-+
-+ in.property_code = HV_PARTITION_PROPERTY_SYNTHETIC_PROC_FEATURES;
-+ in.property_value = features.as_uint64[0];
-+
-+ struct mshv_root_hvcall args = {0};
-+ args.code = HVCALL_SET_PARTITION_PROPERTY;
-+ args.in_sz = sizeof(in);
-+ args.in_ptr = (uint64_t)∈
-+
-+ trace_mshv_hvcall_args("synthetic_proc_features", args.code, args.in_sz);
-+
-+ ret = mshv_hvcall(vm_fd, &args);
-+ if (ret < 0) {
-+ error_report("Failed to set synthethic proc features");
-+ return -errno;
-+ }
-+ return 0;
-+}
-+
-+static int initialize_vm(int vm_fd)
-+{
-+ int ret = ioctl(vm_fd, MSHV_INITIALIZE_PARTITION);
-+ if (ret < 0) {
-+ error_report("Failed to initialize partition: %s", strerror(errno));
-+ return -1;
-+ }
-+ return 0;
-+}
-+
-+static int create_vm(int mshv_fd, int *vm_fd)
-+{
-+ int ret = create_partition(mshv_fd, vm_fd);
-+ if (ret < 0) {
-+ return -1;
-+ }
-+
-+ ret = set_synthetic_proc_features(*vm_fd);
-+ if (ret < 0) {
-+ return -1;
-+ }
-+
-+ ret = initialize_vm(*vm_fd);
-+ if (ret < 0) {
-+ return -1;
-+ }
-+
-+ ret = mshv_reserve_ioapic_msi_routes(*vm_fd);
-+ if (ret < 0) {
-+ return -1;
-+ }
-+
-+ ret = mshv_arch_post_init_vm(*vm_fd);
-+ if (ret < 0) {
-+ return -1;
-+ }
-+
-+ /* Always create a frozen partition */
-+ pause_vm(*vm_fd);
-+
-+ return 0;
-+}
-+
- static void mem_region_add(MemoryListener *listener,
- MemoryRegionSection *section)
- {
-@@ -67,11 +238,124 @@ static void mem_region_del(MemoryListener *listener,
- memory_region_unref(section->mr);
- }
-
-+typedef enum {
-+ DATAMATCH_NONE,
-+ DATAMATCH_U32,
-+ DATAMATCH_U64,
-+} DatamatchTag;
-+
-+typedef struct {
-+ DatamatchTag tag;
-+ union {
-+ uint32_t u32;
-+ uint64_t u64;
-+ } value;
-+} Datamatch;
-+
-+/* flags: determine whether to de/assign */
-+static int ioeventfd(int vm_fd, int event_fd, uint64_t addr, Datamatch dm,
-+ uint32_t flags)
-+{
-+ struct mshv_user_ioeventfd args = {0};
-+ args.fd = event_fd;
-+ args.addr = addr;
-+ args.flags = flags;
-+
-+ if (dm.tag == DATAMATCH_NONE) {
-+ args.datamatch = 0;
-+ } else {
-+ flags |= BIT(MSHV_IOEVENTFD_BIT_DATAMATCH);
-+ args.flags = flags;
-+ if (dm.tag == DATAMATCH_U64) {
-+ args.len = sizeof(uint64_t);
-+ args.datamatch = dm.value.u64;
-+ } else {
-+ args.len = sizeof(uint32_t);
-+ args.datamatch = dm.value.u32;
-+ }
-+ }
-+
-+ return ioctl(vm_fd, MSHV_IOEVENTFD, &args);
-+}
-+
-+static int unregister_ioevent(int vm_fd, int event_fd, uint64_t mmio_addr)
-+{
-+ uint32_t flags = 0;
-+ Datamatch dm = {0};
-+
-+ flags |= BIT(MSHV_IOEVENTFD_BIT_DEASSIGN);
-+ dm.tag = DATAMATCH_NONE;
-+
-+ return ioeventfd(vm_fd, event_fd, mmio_addr, dm, flags);
-+}
-+
-+static int register_ioevent(int vm_fd, int event_fd, uint64_t mmio_addr,
-+ uint64_t val, bool is_64bit, bool is_datamatch)
-+{
-+ uint32_t flags = 0;
-+ Datamatch dm = {0};
-+
-+ if (!is_datamatch) {
-+ dm.tag = DATAMATCH_NONE;
-+ } else if (is_64bit) {
-+ dm.tag = DATAMATCH_U64;
-+ dm.value.u64 = val;
-+ } else {
-+ dm.tag = DATAMATCH_U32;
-+ dm.value.u32 = val;
-+ }
-+
-+ return ioeventfd(vm_fd, event_fd, mmio_addr, dm, flags);
-+}
-+
-+static void mem_ioeventfd_add(MemoryListener *listener,
-+ MemoryRegionSection *section,
-+ bool match_data, uint64_t data,
-+ EventNotifier *e)
-+{
-+ int fd = event_notifier_get_fd(e);
-+ int ret;
-+ bool is_64 = int128_get64(section->size) == 8;
-+ uint64_t addr = section->offset_within_address_space;
-+
-+ trace_mshv_mem_ioeventfd_add(addr, int128_get64(section->size), data);
-+
-+ ret = register_ioevent(mshv_state->vm, fd, addr, data, is_64, match_data);
-+
-+ if (ret < 0) {
-+ error_report("Failed to register ioeventfd: %s (%d)", strerror(-ret),
-+ -ret);
-+ abort();
-+ }
-+}
-+
-+static void mem_ioeventfd_del(MemoryListener *listener,
-+ MemoryRegionSection *section,
-+ bool match_data, uint64_t data,
-+ EventNotifier *e)
-+{
-+ int fd = event_notifier_get_fd(e);
-+ int ret;
-+ uint64_t addr = section->offset_within_address_space;
-+
-+ trace_mshv_mem_ioeventfd_del(section->offset_within_address_space,
-+ int128_get64(section->size), data);
-+
-+ ret = unregister_ioevent(mshv_state->vm, fd, addr);
-+ if (ret < 0) {
-+ error_report("Failed to unregister ioeventfd: %s (%d)", strerror(-ret),
-+ -ret);
-+ abort();
-+ }
-+}
-+
- static MemoryListener mshv_memory_listener = {
- .name = "mshv",
- .priority = MEMORY_LISTENER_PRIORITY_ACCEL,
- .region_add = mem_region_add,
- .region_del = mem_region_del,
-+ .eventfd_add = mem_ioeventfd_add,
-+ .eventfd_del = mem_ioeventfd_del,
- };
-
- static MemoryListener mshv_io_listener = {
-@@ -97,15 +381,57 @@ static void register_mshv_memory_listener(MshvState *s, MshvMemoryListener *mml,
- }
- }
-
-+int mshv_hvcall(int fd, const struct mshv_root_hvcall *args)
-+{
-+ int ret = 0;
-+
-+ ret = ioctl(fd, MSHV_ROOT_HVCALL, args);
-+ if (ret < 0) {
-+ error_report("Failed to perform hvcall: %s", strerror(errno));
-+ return -1;
-+ }
-+ return ret;
-+}
-+
-+
- static int mshv_init(AccelState *as, MachineState *ms)
- {
- MshvState *s;
-+ int mshv_fd, vm_fd, ret;
-+
-+ if (mshv_state) {
-+ warn_report("MSHV accelerator already initialized");
-+ return 0;
-+ }
-+
- s = MSHV_STATE(as);
-
- accel_blocker_init();
-
- s->vm = 0;
-
-+ ret = init_mshv(&mshv_fd);
-+ if (ret < 0) {
-+ return -1;
-+ }
-+
-+ mshv_init_msicontrol();
-+
-+ ret = create_vm(mshv_fd, &vm_fd);
-+ if (ret < 0) {
-+ close(mshv_fd);
-+ return -1;
-+ }
-+
-+ ret = resume_vm(vm_fd);
-+ if (ret < 0) {
-+ close(mshv_fd);
-+ close(vm_fd);
-+ return -1;
-+ }
-+
-+ s->vm = vm_fd;
-+ s->fd = mshv_fd;
- s->nr_as = 1;
- s->as = g_new0(MshvAddressSpace, s->nr_as);
-
-diff --git a/accel/mshv/trace-events b/accel/mshv/trace-events
-new file mode 100644
-index 0000000000..6130c4abf8
---- /dev/null
-+++ b/accel/mshv/trace-events
-@@ -0,0 +1,26 @@
-+# Authors: Ziqiao Zhou <ziqiaozhou@microsoft.com>
-+# Magnus Kulke <magnuskulke@microsoft.com>
-+#
-+# SPDX-License-Identifier: GPL-2.0-or-later
-+
-+mshv_set_memory(bool add, uint64_t gpa, uint64_t size, uint64_t user_addr, bool readonly, int ret) "add=%d gpa=0x%" PRIx64 " size=0x%" PRIx64 " user=0x%" PRIx64 " readonly=%d result=%d"
-+mshv_mem_ioeventfd_add(uint64_t addr, uint32_t size, uint32_t data) "addr=0x%" PRIx64 " size=%d data=0x%x"
-+mshv_mem_ioeventfd_del(uint64_t addr, uint32_t size, uint32_t data) "addr=0x%" PRIx64 " size=%d data=0x%x"
-+
-+mshv_hvcall_args(const char* hvcall, uint16_t code, uint16_t in_sz) "built args for '%s' code: %d in_sz: %d"
-+
-+mshv_handle_interrupt(uint32_t cpu, int mask) "cpu_index=%d mask=0x%x"
-+mshv_set_msi_routing(uint32_t gsi, uint64_t addr, uint32_t data) "gsi=%d addr=0x%" PRIx64 " data=0x%x"
-+mshv_remove_msi_routing(uint32_t gsi) "gsi=%d"
-+mshv_add_msi_routing(uint64_t addr, uint32_t data) "addr=0x%" PRIx64 " data=0x%x"
-+mshv_commit_msi_routing_table(int vm_fd, int len) "vm_fd=%d table_size=%d"
-+mshv_register_irqfd(int vm_fd, int event_fd, uint32_t gsi) "vm_fd=%d event_fd=%d gsi=%d"
-+mshv_irqchip_update_irqfd_notifier_gsi(int event_fd, int resample_fd, int virq, bool add) "event_fd=%d resample_fd=%d virq=%d add=%d"
-+
-+mshv_insn_fetch(uint64_t addr, size_t size) "gpa=0x%" PRIx64 " size=%zu"
-+mshv_mem_write(uint64_t addr, size_t size) "\tgpa=0x%" PRIx64 " size=%zu"
-+mshv_mem_read(uint64_t addr, size_t size) "\tgpa=0x%" PRIx64 " size=%zu"
-+mshv_map_memory(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%08" PRIx64
-+mshv_unmap_memory(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%08" PRIx64
-+mshv_set_phys_mem(bool add, const char *name, uint64_t gpa) "\tadd=%d name=%s gpa=0x%010" PRIx64
-+mshv_handle_mmio(uint64_t gva, uint64_t gpa, uint64_t size, uint8_t access_type) "\tgva=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%" PRIx64 " access_type=%d"
-diff --git a/accel/mshv/trace.h b/accel/mshv/trace.h
-new file mode 100644
-index 0000000000..0dca48f917
---- /dev/null
-+++ b/accel/mshv/trace.h
-@@ -0,0 +1,14 @@
-+/*
-+ * QEMU MSHV support
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * Authors:
-+ * Ziqiao Zhou <ziqiaozhou@microsoft.com>
-+ * Magnus Kulke <magnuskulke@microsoft.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ *
-+ */
-+
-+#include "trace/trace-accel_mshv.h"
-diff --git a/accel/stubs/meson.build b/accel/stubs/meson.build
-index 9dfc4f9dda..48eccd1b86 100644
---- a/accel/stubs/meson.build
-+++ b/accel/stubs/meson.build
-@@ -5,5 +5,6 @@ system_stubs_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
- system_stubs_ss.add(when: 'CONFIG_HVF', if_false: files('hvf-stub.c'))
- system_stubs_ss.add(when: 'CONFIG_NVMM', if_false: files('nvmm-stub.c'))
- system_stubs_ss.add(when: 'CONFIG_WHPX', if_false: files('whpx-stub.c'))
-+system_stubs_ss.add(when: 'CONFIG_MSHV', if_false: files('mshv-stub.c'))
-
- specific_ss.add_all(when: ['CONFIG_SYSTEM_ONLY'], if_true: system_stubs_ss)
-diff --git a/accel/stubs/mshv-stub.c b/accel/stubs/mshv-stub.c
-new file mode 100644
-index 0000000000..e499b199d9
---- /dev/null
-+++ b/accel/stubs/mshv-stub.c
-@@ -0,0 +1,44 @@
-+/*
-+ * QEMU MSHV stub
-+ *
-+ * Copyright Red Hat, Inc. 2025
-+ *
-+ * Author: Paolo Bonzini <pbonzini@redhat.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#include "qemu/osdep.h"
-+#include "hw/pci/msi.h"
-+#include "system/mshv.h"
-+
-+bool mshv_allowed;
-+
-+int mshv_irqchip_add_msi_route(int vector, PCIDevice *dev)
-+{
-+ return -ENOSYS;
-+}
-+
-+void mshv_irqchip_release_virq(int virq)
-+{
-+}
-+
-+int mshv_irqchip_update_msi_route(int virq, MSIMessage msg, PCIDevice *dev)
-+{
-+ return -ENOSYS;
-+}
-+
-+void mshv_irqchip_commit_routes(void)
-+{
-+}
-+
-+int mshv_irqchip_add_irqfd_notifier_gsi(const EventNotifier *n,
-+ const EventNotifier *rn, int virq)
-+{
-+ return -ENOSYS;
-+}
-+
-+int mshv_irqchip_remove_irqfd_notifier_gsi(const EventNotifier *n, int virq)
-+{
-+ return -ENOSYS;
-+}
-diff --git a/hw/intc/apic.c b/hw/intc/apic.c
-index bcb103560c..6d7859640c 100644
---- a/hw/intc/apic.c
-+++ b/hw/intc/apic.c
-@@ -27,6 +27,7 @@
- #include "hw/pci/msi.h"
- #include "qemu/host-utils.h"
- #include "system/kvm.h"
-+#include "system/mshv.h"
- #include "trace.h"
- #include "hw/i386/apic-msidef.h"
- #include "qapi/error.h"
-@@ -932,6 +933,13 @@ static void apic_send_msi(MSIMessage *msi)
- uint8_t trigger_mode = (data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;
- uint8_t delivery = (data >> MSI_DATA_DELIVERY_MODE_SHIFT) & 0x7;
- /* XXX: Ignore redirection hint. */
-+#ifdef CONFIG_MSHV
-+ if (mshv_enabled()) {
-+ mshv_request_interrupt(mshv_state, delivery, vector, dest,
-+ dest_mode, trigger_mode);
-+ return;
-+ }
-+#endif
- apic_deliver_irq(dest, dest_mode, delivery, vector, trigger_mode);
- }
-
-diff --git a/include/system/mshv.h b/include/system/mshv.h
-index 434ea9682e..1011e81df4 100644
---- a/include/system/mshv.h
-+++ b/include/system/mshv.h
-@@ -31,18 +31,27 @@
- #define CONFIG_MSHV_IS_POSSIBLE
- #endif
-
-+#define MSHV_MAX_MSI_ROUTES 4096
-+
-+#define MSHV_PAGE_SHIFT 12
-+
- #ifdef CONFIG_MSHV_IS_POSSIBLE
- extern bool mshv_allowed;
- #define mshv_enabled() (mshv_allowed)
-+#define mshv_msi_via_irqfd_enabled() mshv_enabled()
- #else /* CONFIG_MSHV_IS_POSSIBLE */
- #define mshv_enabled() false
--#endif
- #define mshv_msi_via_irqfd_enabled() false
-+#endif
-
- typedef struct MshvState MshvState;
- extern MshvState *mshv_state;
-
- /* interrupt */
-+int mshv_request_interrupt(MshvState *mshv_state, uint32_t interrupt_type, uint32_t vector,
-+ uint32_t vp_index, bool logical_destination_mode,
-+ bool level_triggered);
-+
- int mshv_irqchip_add_msi_route(int vector, PCIDevice *dev);
- int mshv_irqchip_update_msi_route(int virq, MSIMessage msg, PCIDevice *dev);
- void mshv_irqchip_commit_routes(void);
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-index cfa177ff72..b36124a0ea 100644
---- a/include/system/mshv_int.h
-+++ b/include/system/mshv_int.h
-@@ -36,10 +36,35 @@ struct MshvState {
- /* number of listeners */
- int nr_as;
- MshvAddressSpace *as;
-+ int fd;
- };
-
-+typedef struct MshvMsiControl {
-+ bool updated;
-+ GHashTable *gsi_routes;
-+} MshvMsiControl;
-+
-+void mshv_arch_amend_proc_features(
-+ union hv_partition_synthetic_processor_features *features);
-+int mshv_arch_post_init_vm(int vm_fd);
-+
-+#if defined COMPILING_PER_TARGET && defined CONFIG_MSHV_IS_POSSIBLE
-+int mshv_hvcall(int fd, const struct mshv_root_hvcall *args);
-+#endif
-+
- /* memory */
-+typedef struct MshvMemoryRegion {
-+ uint64_t guest_phys_addr;
-+ uint64_t memory_size;
-+ uint64_t userspace_addr;
-+ bool readonly;
-+} MshvMemoryRegion;
-+
- void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
- bool add);
-
-+/* interrupt */
-+void mshv_init_msicontrol(void);
-+int mshv_reserve_ioapic_msi_routes(int vm_fd);
-+
- #endif
-diff --git a/meson.build b/meson.build
-index 96254f8075..f7b21c818d 100644
---- a/meson.build
-+++ b/meson.build
-@@ -3667,6 +3667,7 @@ if have_system
- trace_events_subdirs += [
- 'accel/hvf',
- 'accel/kvm',
-+ 'accel/mshv',
- 'audio',
- 'backends',
- 'backends/tpm',
-diff --git a/target/i386/mshv/meson.build b/target/i386/mshv/meson.build
-index 8ddaa7c11d..647e5dafb7 100644
---- a/target/i386/mshv/meson.build
-+++ b/target/i386/mshv/meson.build
-@@ -1,6 +1,7 @@
- i386_mshv_ss = ss.source_set()
-
- i386_mshv_ss.add(files(
-+ 'mshv-cpu.c',
- 'x86.c',
- ))
-
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-new file mode 100644
-index 0000000000..de0c26bc6c
---- /dev/null
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -0,0 +1,72 @@
-+/*
-+ * QEMU MSHV support
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * Authors: Ziqiao Zhou <ziqiaozhou@microsoft.com>
-+ * Magnus Kulke <magnuskulke@microsoft.com>
-+ * Jinank Jain <jinankjain@microsoft.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#include "qemu/osdep.h"
-+#include "qemu/error-report.h"
-+#include "qemu/typedefs.h"
-+
-+#include "system/mshv.h"
-+#include "system/mshv_int.h"
-+#include "system/address-spaces.h"
-+#include "linux/mshv.h"
-+#include "hw/hyperv/hvgdk.h"
-+#include "hw/hyperv/hvgdk_mini.h"
-+#include "hw/hyperv/hvhdk_mini.h"
-+
-+#include "trace-accel_mshv.h"
-+#include "trace.h"
-+
-+void mshv_arch_amend_proc_features(
-+ union hv_partition_synthetic_processor_features *features)
-+{
-+ features->access_guest_idle_reg = 1;
-+}
-+
-+/*
-+ * Default Microsoft Hypervisor behavior for unimplemented MSR is to send a
-+ * fault to the guest if it tries to access it. It is possible to override
-+ * this behavior with a more suitable option i.e., ignore writes from the guest
-+ * and return zero in attempt to read unimplemented.
-+ */
-+static int set_unimplemented_msr_action(int vm_fd)
-+{
-+ struct hv_input_set_partition_property in = {0};
-+ struct mshv_root_hvcall args = {0};
-+
-+ in.property_code = HV_PARTITION_PROPERTY_UNIMPLEMENTED_MSR_ACTION;
-+ in.property_value = HV_UNIMPLEMENTED_MSR_ACTION_IGNORE_WRITE_READ_ZERO;
-+
-+ args.code = HVCALL_SET_PARTITION_PROPERTY;
-+ args.in_sz = sizeof(in);
-+ args.in_ptr = (uint64_t)∈
-+
-+ trace_mshv_hvcall_args("unimplemented_msr_action", args.code, args.in_sz);
-+
-+ int ret = mshv_hvcall(vm_fd, &args);
-+ if (ret < 0) {
-+ error_report("Failed to set unimplemented MSR action");
-+ return -1;
-+ }
-+ return 0;
-+}
-+
-+int mshv_arch_post_init_vm(int vm_fd)
-+{
-+ int ret;
-+
-+ ret = set_unimplemented_msr_action(vm_fd);
-+ if (ret < 0) {
-+ error_report("Failed to set unimplemented MSR action");
-+ }
-+
-+ return ret;
-+}
---
-2.47.3
-
diff --git a/kvm-accel-mshv-Register-memory-region-listeners.patch b/kvm-accel-mshv-Register-memory-region-listeners.patch
deleted file mode 100644
index 044407a..0000000
--- a/kvm-accel-mshv-Register-memory-region-listeners.patch
+++ /dev/null
@@ -1,172 +0,0 @@
-From 1c84d5e352e60196218f657292e7f26226ab9647 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:28 +0200
-Subject: [PATCH 10/32] accel/mshv: Register memory region listeners
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [8/30] ecd0d05d8f04c400ad1d9c428f89b23b12889968
-
-Add memory listener hooks for the MSHV accelerator to track guest
-memory regions. This enables the backend to respond to region
-additions, removals and will be used to manage guest memory mappings
-inside the hypervisor.
-
-Actually registering physical memory in the hypervisor is still stubbed
-out.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-9-magnuskulke@linux.microsoft.com
-[mshv.h/mshv_int.h split. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 5006ea1344d134356a9b2e1afd521cf8df0c6a85)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- accel/mshv/mem.c | 25 +++++++++++++++
- accel/mshv/meson.build | 1 +
- accel/mshv/mshv-all.c | 67 +++++++++++++++++++++++++++++++++++++--
- include/system/mshv_int.h | 4 +++
- 4 files changed, 95 insertions(+), 2 deletions(-)
- create mode 100644 accel/mshv/mem.c
-
-diff --git a/accel/mshv/mem.c b/accel/mshv/mem.c
-new file mode 100644
-index 0000000000..9889918c31
---- /dev/null
-+++ b/accel/mshv/mem.c
-@@ -0,0 +1,25 @@
-+/*
-+ * QEMU MSHV support
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * Authors:
-+ * Magnus Kulke <magnuskulke@microsoft.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ *
-+ */
-+
-+#include "qemu/osdep.h"
-+#include "qemu/error-report.h"
-+#include "system/address-spaces.h"
-+#include "system/mshv.h"
-+#include "system/mshv_int.h"
-+
-+void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
-+ bool add)
-+{
-+ error_report("unimplemented");
-+ abort();
-+}
-+
-diff --git a/accel/mshv/meson.build b/accel/mshv/meson.build
-index 4c03ac7921..8a6beb3fb1 100644
---- a/accel/mshv/meson.build
-+++ b/accel/mshv/meson.build
-@@ -1,5 +1,6 @@
- mshv_ss = ss.source_set()
- mshv_ss.add(if_true: files(
-+ 'mem.c',
- 'mshv-all.c'
- ))
-
-diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
-index ae12f0f58b..a684a36677 100644
---- a/accel/mshv/mshv-all.c
-+++ b/accel/mshv/mshv-all.c
-@@ -49,10 +49,73 @@ bool mshv_allowed;
-
- MshvState *mshv_state;
-
-+static void mem_region_add(MemoryListener *listener,
-+ MemoryRegionSection *section)
-+{
-+ MshvMemoryListener *mml;
-+ mml = container_of(listener, MshvMemoryListener, listener);
-+ memory_region_ref(section->mr);
-+ mshv_set_phys_mem(mml, section, true);
-+}
-+
-+static void mem_region_del(MemoryListener *listener,
-+ MemoryRegionSection *section)
-+{
-+ MshvMemoryListener *mml;
-+ mml = container_of(listener, MshvMemoryListener, listener);
-+ mshv_set_phys_mem(mml, section, false);
-+ memory_region_unref(section->mr);
-+}
-+
-+static MemoryListener mshv_memory_listener = {
-+ .name = "mshv",
-+ .priority = MEMORY_LISTENER_PRIORITY_ACCEL,
-+ .region_add = mem_region_add,
-+ .region_del = mem_region_del,
-+};
-+
-+static MemoryListener mshv_io_listener = {
-+ .name = "mshv", .priority = MEMORY_LISTENER_PRIORITY_DEV_BACKEND,
-+ /* MSHV does not support PIO eventfd */
-+};
-+
-+static void register_mshv_memory_listener(MshvState *s, MshvMemoryListener *mml,
-+ AddressSpace *as, int as_id,
-+ const char *name)
-+{
-+ int i;
-+
-+ mml->listener = mshv_memory_listener;
-+ mml->listener.name = name;
-+ memory_listener_register(&mml->listener, as);
-+ for (i = 0; i < s->nr_as; ++i) {
-+ if (!s->as[i].as) {
-+ s->as[i].as = as;
-+ s->as[i].ml = mml;
-+ break;
-+ }
-+ }
-+}
-+
- static int mshv_init(AccelState *as, MachineState *ms)
- {
-- error_report("unimplemented");
-- abort();
-+ MshvState *s;
-+ s = MSHV_STATE(as);
-+
-+ accel_blocker_init();
-+
-+ s->vm = 0;
-+
-+ s->nr_as = 1;
-+ s->as = g_new0(MshvAddressSpace, s->nr_as);
-+
-+ mshv_state = s;
-+
-+ register_mshv_memory_listener(s, &s->memory_listener, &address_space_memory,
-+ 0, "mshv-memory");
-+ memory_listener_register(&mshv_io_listener, &address_space_io);
-+
-+ return 0;
- }
-
- static void mshv_start_vcpu_thread(CPUState *cpu)
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-index 132491b599..cfa177ff72 100644
---- a/include/system/mshv_int.h
-+++ b/include/system/mshv_int.h
-@@ -38,4 +38,8 @@ struct MshvState {
- MshvAddressSpace *as;
- };
-
-+/* memory */
-+void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
-+ bool add);
-+
- #endif
---
-2.47.3
-
diff --git a/kvm-accel-mshv-Remove-remap-overlapping-mappings-code.patch b/kvm-accel-mshv-Remove-remap-overlapping-mappings-code.patch
deleted file mode 100644
index 82f7d01..0000000
--- a/kvm-accel-mshv-Remove-remap-overlapping-mappings-code.patch
+++ /dev/null
@@ -1,690 +0,0 @@
-From 0d484fe45aee9a7481d543ac2a0453a30872ffbb Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 13 Jan 2026 16:37:08 +0100
-Subject: [PATCH 1/9] accel/mshv: Remove remap overlapping mappings code
-
-RH-Author: Magnus Kulke <None>
-RH-MergeRequest: 490: accel/mshv: backport required patches for mshv guests
-RH-Jira: RHEL-178767
-RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/2] 959df35b4cd77cf85f7a8a67d438ad71135525e9 (mkulke/qemu-kvm)
-
-This change removes userland code that worked around a restriction
-in the mshv driver in the 6.18 kernel: regions from userland
-couldn't be mapped to multiple regions in the kernel. We maintained a
-shadow mapping table in qemu and used a heuristic to swap in a requested
-region in case of UNMAPPED_GPA exits.
-
-However, this heuristic wasn't reliable in all cases, since HyperV
-behaviour is not 100% reliable across versions. HyperV itself doesn't
-prohibit to map regions at multiple places into the guest, so the
-restriction has been removed in the mshv driver.
-
-Hence we can remove the remapping code. Effectively this will mandate a
-6.19 kernel, if the workload attempt to map e.g. BIOS to multiple
-reagions. I still think it's the right call to remove this logic:
-
-- The workaround only seems to work reliably with a certain revision
- of HyperV as a nested hypervisor.
-- We expect Direct Virtualization (L1VH) to be the main platform for
- the mshv accelerator, which also requires a 6.19 kernel
-
-This reverts commit efc4093358511a58846a409b965213aa1bb9f31a.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Acked-by: Wei Liu (Microsoft) <wei.liu@kernel.org>
-Tested-by: Mohamed Mediouni <mohamed@unpredictable.fr>
-Link: https://lore.kernel.org/r/20260113153708.448968-1-magnuskulke@linux.microsoft.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 626e5dc999353d2c4a89febd46301bfec6daa3a7)
----
- accel/mshv/mem.c | 406 +++---------------------------------
- accel/mshv/mshv-all.c | 2 -
- accel/mshv/trace-events | 5 -
- include/system/mshv_int.h | 22 +-
- target/i386/mshv/mshv-cpu.c | 43 ----
- 5 files changed, 30 insertions(+), 448 deletions(-)
-
-diff --git a/accel/mshv/mem.c b/accel/mshv/mem.c
-index 0e2164af3e..e55c38d4db 100644
---- a/accel/mshv/mem.c
-+++ b/accel/mshv/mem.c
-@@ -11,9 +11,7 @@
- */
-
- #include "qemu/osdep.h"
--#include "qemu/lockable.h"
- #include "qemu/error-report.h"
--#include "qemu/rcu.h"
- #include "linux/mshv.h"
- #include "system/address-spaces.h"
- #include "system/mshv.h"
-@@ -22,137 +20,6 @@
- #include <sys/ioctl.h>
- #include "trace.h"
-
--typedef struct SlotsRCUReclaim {
-- struct rcu_head rcu;
-- GList *old_head;
-- MshvMemorySlot *removed_slot;
--} SlotsRCUReclaim;
--
--static void rcu_reclaim_slotlist(struct rcu_head *rcu)
--{
-- SlotsRCUReclaim *r = container_of(rcu, SlotsRCUReclaim, rcu);
-- g_list_free(r->old_head);
-- g_free(r->removed_slot);
-- g_free(r);
--}
--
--static void publish_slots(GList *new_head, GList *old_head,
-- MshvMemorySlot *removed_slot)
--{
-- MshvMemorySlotManager *manager = &mshv_state->msm;
--
-- assert(manager);
-- qatomic_store_release(&manager->slots, new_head);
--
-- SlotsRCUReclaim *r = g_new(SlotsRCUReclaim, 1);
-- r->old_head = old_head;
-- r->removed_slot = removed_slot;
--
-- call_rcu1(&r->rcu, rcu_reclaim_slotlist);
--}
--
--/* Needs to be called with mshv_state->msm.mutex held */
--static int remove_slot(MshvMemorySlot *slot)
--{
-- GList *old_head, *new_head;
-- MshvMemorySlotManager *manager = &mshv_state->msm;
--
-- assert(manager);
-- old_head = qatomic_load_acquire(&manager->slots);
--
-- if (!g_list_find(old_head, slot)) {
-- error_report("slot requested for removal not found");
-- return -1;
-- }
--
-- new_head = g_list_copy(old_head);
-- new_head = g_list_remove(new_head, slot);
-- manager->n_slots--;
--
-- publish_slots(new_head, old_head, slot);
--
-- return 0;
--}
--
--/* Needs to be called with mshv_state->msm.mutex held */
--static MshvMemorySlot *append_slot(uint64_t gpa, uint64_t userspace_addr,
-- uint64_t size, bool readonly)
--{
-- GList *old_head, *new_head;
-- MshvMemorySlot *slot;
-- MshvMemorySlotManager *manager = &mshv_state->msm;
--
-- assert(manager);
--
-- old_head = qatomic_load_acquire(&manager->slots);
--
-- if (manager->n_slots >= MSHV_MAX_MEM_SLOTS) {
-- error_report("no free memory slots available");
-- return NULL;
-- }
--
-- slot = g_new0(MshvMemorySlot, 1);
-- slot->guest_phys_addr = gpa;
-- slot->userspace_addr = userspace_addr;
-- slot->memory_size = size;
-- slot->readonly = readonly;
--
-- new_head = g_list_copy(old_head);
-- new_head = g_list_append(new_head, slot);
-- manager->n_slots++;
--
-- publish_slots(new_head, old_head, NULL);
--
-- return slot;
--}
--
--static int slot_overlaps(const MshvMemorySlot *slot1,
-- const MshvMemorySlot *slot2)
--{
-- uint64_t start_1 = slot1->userspace_addr,
-- start_2 = slot2->userspace_addr;
-- size_t len_1 = slot1->memory_size,
-- len_2 = slot2->memory_size;
--
-- if (slot1 == slot2) {
-- return -1;
-- }
--
-- return ranges_overlap(start_1, len_1, start_2, len_2) ? 0 : -1;
--}
--
--static bool is_mapped(MshvMemorySlot *slot)
--{
-- /* Subsequent reads of mapped field see a fully-initialized slot */
-- return qatomic_load_acquire(&slot->mapped);
--}
--
--/*
-- * Find slot that is:
-- * - overlapping in userspace
-- * - currently mapped in the guest
-- *
-- * Needs to be called with mshv_state->msm.mutex or RCU read lock held.
-- */
--static MshvMemorySlot *find_overlap_mem_slot(GList *head, MshvMemorySlot *slot)
--{
-- GList *found;
-- MshvMemorySlot *overlap_slot;
--
-- found = g_list_find_custom(head, slot, (GCompareFunc) slot_overlaps);
--
-- if (!found) {
-- return NULL;
-- }
--
-- overlap_slot = found->data;
-- if (!overlap_slot || !is_mapped(overlap_slot)) {
-- return NULL;
-- }
--
-- return overlap_slot;
--}
--
- static int set_guest_memory(int vm_fd,
- const struct mshv_user_mem_region *region)
- {
-@@ -160,169 +27,38 @@ static int set_guest_memory(int vm_fd,
-
- ret = ioctl(vm_fd, MSHV_SET_GUEST_MEMORY, region);
- if (ret < 0) {
-- error_report("failed to set guest memory: %s", strerror(errno));
-- return -1;
-+ error_report("failed to set guest memory");
-+ return -errno;
- }
-
- return 0;
- }
-
--static int map_or_unmap(int vm_fd, const MshvMemorySlot *slot, bool map)
-+static int map_or_unmap(int vm_fd, const MshvMemoryRegion *mr, bool map)
- {
- struct mshv_user_mem_region region = {0};
-
-- region.guest_pfn = slot->guest_phys_addr >> MSHV_PAGE_SHIFT;
-- region.size = slot->memory_size;
-- region.userspace_addr = slot->userspace_addr;
-+ region.guest_pfn = mr->guest_phys_addr >> MSHV_PAGE_SHIFT;
-+ region.size = mr->memory_size;
-+ region.userspace_addr = mr->userspace_addr;
-
- if (!map) {
- region.flags |= (1 << MSHV_SET_MEM_BIT_UNMAP);
-- trace_mshv_unmap_memory(slot->userspace_addr, slot->guest_phys_addr,
-- slot->memory_size);
-+ trace_mshv_unmap_memory(mr->userspace_addr, mr->guest_phys_addr,
-+ mr->memory_size);
- return set_guest_memory(vm_fd, ®ion);
- }
-
- region.flags = BIT(MSHV_SET_MEM_BIT_EXECUTABLE);
-- if (!slot->readonly) {
-+ if (!mr->readonly) {
- region.flags |= BIT(MSHV_SET_MEM_BIT_WRITABLE);
- }
-
-- trace_mshv_map_memory(slot->userspace_addr, slot->guest_phys_addr,
-- slot->memory_size);
-+ trace_mshv_map_memory(mr->userspace_addr, mr->guest_phys_addr,
-+ mr->memory_size);
- return set_guest_memory(vm_fd, ®ion);
- }
-
--static int slot_matches_region(const MshvMemorySlot *slot1,
-- const MshvMemorySlot *slot2)
--{
-- return (slot1->guest_phys_addr == slot2->guest_phys_addr &&
-- slot1->userspace_addr == slot2->userspace_addr &&
-- slot1->memory_size == slot2->memory_size) ? 0 : -1;
--}
--
--/* Needs to be called with mshv_state->msm.mutex held */
--static MshvMemorySlot *find_mem_slot_by_region(uint64_t gpa, uint64_t size,
-- uint64_t userspace_addr)
--{
-- MshvMemorySlot ref_slot = {
-- .guest_phys_addr = gpa,
-- .userspace_addr = userspace_addr,
-- .memory_size = size,
-- };
-- GList *found;
-- MshvMemorySlotManager *manager = &mshv_state->msm;
--
-- assert(manager);
-- found = g_list_find_custom(manager->slots, &ref_slot,
-- (GCompareFunc) slot_matches_region);
--
-- return found ? found->data : NULL;
--}
--
--static int slot_covers_gpa(const MshvMemorySlot *slot, uint64_t *gpa_p)
--{
-- uint64_t gpa_offset, gpa = *gpa_p;
--
-- gpa_offset = gpa - slot->guest_phys_addr;
-- return (slot->guest_phys_addr <= gpa && gpa_offset < slot->memory_size)
-- ? 0 : -1;
--}
--
--/* Needs to be called with mshv_state->msm.mutex or RCU read lock held */
--static MshvMemorySlot *find_mem_slot_by_gpa(GList *head, uint64_t gpa)
--{
-- GList *found;
-- MshvMemorySlot *slot;
--
-- trace_mshv_find_slot_by_gpa(gpa);
--
-- found = g_list_find_custom(head, &gpa, (GCompareFunc) slot_covers_gpa);
-- if (found) {
-- slot = found->data;
-- trace_mshv_found_slot(slot->userspace_addr, slot->guest_phys_addr,
-- slot->memory_size);
-- return slot;
-- }
--
-- return NULL;
--}
--
--/* Needs to be called with mshv_state->msm.mutex held */
--static void set_mapped(MshvMemorySlot *slot, bool mapped)
--{
-- /* prior writes to mapped field becomes visible before readers see slot */
-- qatomic_store_release(&slot->mapped, mapped);
--}
--
--MshvRemapResult mshv_remap_overlap_region(int vm_fd, uint64_t gpa)
--{
-- MshvMemorySlot *gpa_slot, *overlap_slot;
-- GList *head;
-- int ret;
-- MshvMemorySlotManager *manager = &mshv_state->msm;
--
-- /* fast path, called often by unmapped_gpa vm exit */
-- WITH_RCU_READ_LOCK_GUARD() {
-- assert(manager);
-- head = qatomic_load_acquire(&manager->slots);
-- /* return early if no slot is found */
-- gpa_slot = find_mem_slot_by_gpa(head, gpa);
-- if (gpa_slot == NULL) {
-- return MshvRemapNoMapping;
-- }
--
-- /* return early if no overlapping slot is found */
-- overlap_slot = find_overlap_mem_slot(head, gpa_slot);
-- if (overlap_slot == NULL) {
-- return MshvRemapNoOverlap;
-- }
-- }
--
-- /*
-- * We'll modify the mapping list, so we need to upgrade to mutex and
-- * recheck.
-- */
-- assert(manager);
-- QEMU_LOCK_GUARD(&manager->mutex);
--
-- /* return early if no slot is found */
-- gpa_slot = find_mem_slot_by_gpa(manager->slots, gpa);
-- if (gpa_slot == NULL) {
-- return MshvRemapNoMapping;
-- }
--
-- /* return early if no overlapping slot is found */
-- overlap_slot = find_overlap_mem_slot(manager->slots, gpa_slot);
-- if (overlap_slot == NULL) {
-- return MshvRemapNoOverlap;
-- }
--
-- /* unmap overlapping slot */
-- ret = map_or_unmap(vm_fd, overlap_slot, false);
-- if (ret < 0) {
-- error_report("failed to unmap overlap region");
-- abort();
-- }
-- set_mapped(overlap_slot, false);
-- warn_report("mapped out userspace_addr=0x%016lx gpa=0x%010lx size=0x%lx",
-- overlap_slot->userspace_addr,
-- overlap_slot->guest_phys_addr,
-- overlap_slot->memory_size);
--
-- /* map region for gpa */
-- ret = map_or_unmap(vm_fd, gpa_slot, true);
-- if (ret < 0) {
-- error_report("failed to map new region");
-- abort();
-- }
-- set_mapped(gpa_slot, true);
-- warn_report("mapped in userspace_addr=0x%016lx gpa=0x%010lx size=0x%lx",
-- gpa_slot->userspace_addr, gpa_slot->guest_phys_addr,
-- gpa_slot->memory_size);
--
-- return MshvRemapOk;
--}
--
- static int handle_unmapped_mmio_region_read(uint64_t gpa, uint64_t size,
- uint8_t *data)
- {
-@@ -388,97 +124,20 @@ int mshv_guest_mem_write(uint64_t gpa, const uint8_t *data, uintptr_t size,
- return -1;
- }
-
--static int tracked_unmap(int vm_fd, uint64_t gpa, uint64_t size,
-- uint64_t userspace_addr)
-+static int set_memory(const MshvMemoryRegion *mshv_mr, bool add)
- {
-- int ret;
-- MshvMemorySlot *slot;
-- MshvMemorySlotManager *manager = &mshv_state->msm;
--
-- assert(manager);
--
-- QEMU_LOCK_GUARD(&manager->mutex);
--
-- slot = find_mem_slot_by_region(gpa, size, userspace_addr);
-- if (!slot) {
-- trace_mshv_skip_unset_mem(userspace_addr, gpa, size);
-- /* no work to do */
-- return 0;
-- }
--
-- if (!is_mapped(slot)) {
-- /* remove slot, no need to unmap */
-- return remove_slot(slot);
-- }
--
-- ret = map_or_unmap(vm_fd, slot, false);
-- if (ret < 0) {
-- error_report("failed to unmap memory region");
-- return ret;
-- }
-- return remove_slot(slot);
--}
--
--static int tracked_map(int vm_fd, uint64_t gpa, uint64_t size, bool readonly,
-- uint64_t userspace_addr)
--{
-- MshvMemorySlot *slot, *overlap_slot;
-- int ret;
-- MshvMemorySlotManager *manager = &mshv_state->msm;
--
-- assert(manager);
--
-- QEMU_LOCK_GUARD(&manager->mutex);
-+ int ret = 0;
-
-- slot = find_mem_slot_by_region(gpa, size, userspace_addr);
-- if (slot) {
-- error_report("memory region already mapped at gpa=0x%lx, "
-- "userspace_addr=0x%lx, size=0x%lx",
-- slot->guest_phys_addr, slot->userspace_addr,
-- slot->memory_size);
-+ if (!mshv_mr) {
-+ error_report("Invalid mshv_mr");
- return -1;
- }
-
-- slot = append_slot(gpa, userspace_addr, size, readonly);
--
-- overlap_slot = find_overlap_mem_slot(manager->slots, slot);
-- if (overlap_slot) {
-- trace_mshv_remap_attempt(slot->userspace_addr,
-- slot->guest_phys_addr,
-- slot->memory_size);
-- warn_report("attempt to map region [0x%lx-0x%lx], while "
-- "[0x%lx-0x%lx] is already mapped in the guest",
-- userspace_addr, userspace_addr + size - 1,
-- overlap_slot->userspace_addr,
-- overlap_slot->userspace_addr +
-- overlap_slot->memory_size - 1);
--
-- /* do not register mem slot in hv, but record for later swap-in */
-- set_mapped(slot, false);
--
-- return 0;
-- }
--
-- ret = map_or_unmap(vm_fd, slot, true);
-- if (ret < 0) {
-- error_report("failed to map memory region");
-- return -1;
-- }
-- set_mapped(slot, true);
--
-- return 0;
--}
--
--static int set_memory(uint64_t gpa, uint64_t size, bool readonly,
-- uint64_t userspace_addr, bool add)
--{
-- int vm_fd = mshv_state->vm;
--
-- if (add) {
-- return tracked_map(vm_fd, gpa, size, readonly, userspace_addr);
-- }
--
-- return tracked_unmap(vm_fd, gpa, size, userspace_addr);
-+ trace_mshv_set_memory(add, mshv_mr->guest_phys_addr,
-+ mshv_mr->memory_size,
-+ mshv_mr->userspace_addr, mshv_mr->readonly,
-+ ret);
-+ return map_or_unmap(mshv_state->vm, mshv_mr, add);
- }
-
- /*
-@@ -514,9 +173,7 @@ void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
- bool writable = !area->readonly && !area->rom_device;
- hwaddr start_addr, mr_offset, size;
- void *ram;
--
-- size = align_section(section, &start_addr);
-- trace_mshv_set_phys_mem(add, section->mr->name, start_addr);
-+ MshvMemoryRegion mshv_mr = {0};
-
- size = align_section(section, &start_addr);
- trace_mshv_set_phys_mem(add, section->mr->name, start_addr);
-@@ -543,21 +200,14 @@ void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
-
- ram = memory_region_get_ram_ptr(area) + mr_offset;
-
-- ret = set_memory(start_addr, size, !writable, (uint64_t)ram, add);
-+ mshv_mr.guest_phys_addr = start_addr;
-+ mshv_mr.memory_size = size;
-+ mshv_mr.readonly = !writable;
-+ mshv_mr.userspace_addr = (uint64_t)ram;
-+
-+ ret = set_memory(&mshv_mr, add);
- if (ret < 0) {
-- error_report("failed to set memory region");
-+ error_report("Failed to set memory region");
- abort();
- }
- }
--
--void mshv_init_memory_slot_manager(MshvState *mshv_state)
--{
-- MshvMemorySlotManager *manager;
--
-- assert(mshv_state);
-- manager = &mshv_state->msm;
--
-- manager->n_slots = 0;
-- manager->slots = NULL;
-- qemu_mutex_init(&manager->mutex);
--}
-diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
-index 80428d130d..88b66f2992 100644
---- a/accel/mshv/mshv-all.c
-+++ b/accel/mshv/mshv-all.c
-@@ -437,8 +437,6 @@ static int mshv_init(AccelState *as, MachineState *ms)
-
- mshv_init_msicontrol();
-
-- mshv_init_memory_slot_manager(s);
--
- ret = create_vm(mshv_fd, &vm_fd);
- if (ret < 0) {
- close(mshv_fd);
-diff --git a/accel/mshv/trace-events b/accel/mshv/trace-events
-index 36f0d59b38..a4dffeb24a 100644
---- a/accel/mshv/trace-events
-+++ b/accel/mshv/trace-events
-@@ -26,8 +26,3 @@ mshv_map_memory(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%
- mshv_unmap_memory(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%08" PRIx64
- mshv_set_phys_mem(bool add, const char *name, uint64_t gpa) "\tadd=%d name=%s gpa=0x%010" PRIx64
- mshv_handle_mmio(uint64_t gva, uint64_t gpa, uint64_t size, uint8_t access_type) "\tgva=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%" PRIx64 " access_type=%d"
--
--mshv_found_slot(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%08" PRIx64
--mshv_skip_unset_mem(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%08" PRIx64
--mshv_remap_attempt(uint64_t userspace_addr, uint64_t gpa, uint64_t size) "\tu_a=0x%" PRIx64 " gpa=0x%010" PRIx64 " size=0x%08" PRIx64
--mshv_find_slot_by_gpa(uint64_t gpa) "\tgpa=0x%010" PRIx64
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-index 490563c1ab..ad4d001c3c 100644
---- a/include/system/mshv_int.h
-+++ b/include/system/mshv_int.h
-@@ -16,8 +16,6 @@
-
- #define MSHV_MSR_ENTRIES_COUNT 64
-
--#define MSHV_MAX_MEM_SLOTS 32
--
- typedef struct hyperv_message hv_message;
-
- typedef struct MshvHvCallArgs {
-@@ -42,12 +40,6 @@ typedef struct MshvAddressSpace {
- AddressSpace *as;
- } MshvAddressSpace;
-
--typedef struct MshvMemorySlotManager {
-- size_t n_slots;
-- GList *slots;
-- QemuMutex mutex;
--} MshvMemorySlotManager;
--
- struct MshvState {
- AccelState parent_obj;
- int vm;
-@@ -56,7 +48,6 @@ struct MshvState {
- int nr_as;
- MshvAddressSpace *as;
- int fd;
-- MshvMemorySlotManager msm;
- };
-
- typedef struct MshvMsiControl {
-@@ -87,12 +78,6 @@ typedef enum MshvVmExit {
- MshvVmExitSpecial = 2,
- } MshvVmExit;
-
--typedef enum MshvRemapResult {
-- MshvRemapOk = 0,
-- MshvRemapNoMapping = 1,
-- MshvRemapNoOverlap = 2,
--} MshvRemapResult;
--
- void mshv_init_mmio_emu(void);
- int mshv_create_vcpu(int vm_fd, uint8_t vp_index, int *cpu_fd);
- void mshv_remove_vcpu(int vm_fd, int cpu_fd);
-@@ -116,22 +101,19 @@ int mshv_hvcall(int fd, const struct mshv_root_hvcall *args);
- #endif
-
- /* memory */
--typedef struct MshvMemorySlot {
-+typedef struct MshvMemoryRegion {
- uint64_t guest_phys_addr;
- uint64_t memory_size;
- uint64_t userspace_addr;
- bool readonly;
-- bool mapped;
--} MshvMemorySlot;
-+} MshvMemoryRegion;
-
--MshvRemapResult mshv_remap_overlap_region(int vm_fd, uint64_t gpa);
- int mshv_guest_mem_read(uint64_t gpa, uint8_t *data, uintptr_t size,
- bool is_secure_mode, bool instruction_fetch);
- int mshv_guest_mem_write(uint64_t gpa, const uint8_t *data, uintptr_t size,
- bool is_secure_mode);
- void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
- bool add);
--void mshv_init_memory_slot_manager(MshvState *mshv_state);
-
- /* msr */
- typedef struct MshvMsrEntry {
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 1c3db02188..c577e284b4 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -1168,43 +1168,6 @@ static int handle_mmio(CPUState *cpu, const struct hyperv_message *msg,
- return 0;
- }
-
--static int handle_unmapped_mem(int vm_fd, CPUState *cpu,
-- const struct hyperv_message *msg,
-- MshvVmExit *exit_reason)
--{
-- struct hv_x64_memory_intercept_message info = { 0 };
-- uint64_t gpa;
-- int ret;
-- enum MshvRemapResult remap_result;
--
-- ret = set_memory_info(msg, &info);
-- if (ret < 0) {
-- error_report("failed to convert message to memory info");
-- return -1;
-- }
--
-- gpa = info.guest_physical_address;
--
-- /* attempt to remap the region, in case of overlapping userspace mappings */
-- remap_result = mshv_remap_overlap_region(vm_fd, gpa);
-- *exit_reason = MshvVmExitIgnore;
--
-- switch (remap_result) {
-- case MshvRemapNoMapping:
-- /* if we didn't find a mapping, it is probably mmio */
-- return handle_mmio(cpu, msg, exit_reason);
-- case MshvRemapOk:
-- break;
-- case MshvRemapNoOverlap:
-- /* This should not happen, but we are forgiving it */
-- warn_report("found no overlap for unmapped region");
-- *exit_reason = MshvVmExitSpecial;
-- break;
-- }
--
-- return 0;
--}
--
- static int set_ioport_info(const struct hyperv_message *msg,
- hv_x64_io_port_intercept_message *info)
- {
-@@ -1546,12 +1509,6 @@ int mshv_run_vcpu(int vm_fd, CPUState *cpu, hv_message *msg, MshvVmExit *exit)
- case HVMSG_UNRECOVERABLE_EXCEPTION:
- return MshvVmExitShutdown;
- case HVMSG_UNMAPPED_GPA:
-- ret = handle_unmapped_mem(vm_fd, cpu, msg, &exit_reason);
-- if (ret < 0) {
-- error_report("failed to handle unmapped memory");
-- return -1;
-- }
-- return exit_reason;
- case HVMSG_GPA_INTERCEPT:
- ret = handle_mmio(cpu, msg, &exit_reason);
- if (ret < 0) {
---
-2.52.0
-
diff --git a/kvm-accel-mshv-implement-cpu_thread_is_idle-hook.patch b/kvm-accel-mshv-implement-cpu_thread_is_idle-hook.patch
deleted file mode 100644
index ba3fba3..0000000
--- a/kvm-accel-mshv-implement-cpu_thread_is_idle-hook.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From 2a298912b20e7d47ce5ac68c8524ab286d6ecf6f Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 21 Apr 2026 05:21:54 +0000
-Subject: [PATCH 2/9] accel/mshv: implement cpu_thread_is_idle() hook
-
-RH-Author: Magnus Kulke <None>
-RH-MergeRequest: 490: accel/mshv: backport required patches for mshv guests
-RH-Jira: RHEL-178767
-RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/2] 3be517f22c0af3dccc6bc33ab2fee541a6802b6a (mkulke/qemu-kvm)
-
-In MSHV the hypervisor APIC is always used, so we to implement this hook
-to make sure the AP's vcpu thread is not blocked waiting for an INIT SIPI
-by the BSP. Without this change soft reboots with -smp cpus>=2 will
-hang.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
-Link: https://lore.kernel.org/r/20260421-mshv_accel_arm64_supp-v3-9-469f544778ba@linux.microsoft.com
-[Make comment not x86 specific. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit dbfb680772d5184544f7c0a8bba96bec229c96e6)
----
- accel/mshv/mshv-all.c | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
-diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
-index 88b66f2992..d7df89dbd2 100644
---- a/accel/mshv/mshv-all.c
-+++ b/accel/mshv/mshv-all.c
-@@ -699,11 +699,23 @@ static const TypeInfo mshv_accel_type = {
- .instance_size = sizeof(MshvState),
- };
-
-+/*
-+ * MSHV manages secondary processors in the hypervisor. SIPI for x86 and
-+ * PSCI for Arm are handled internally. Halted vCPUs must still enter
-+ * mshv_cpu_exec() so that MSHV_RUN_VP is called and the hypervisor will
-+ * wake APs.
-+ */
-+static bool mshv_vcpu_thread_is_idle(CPUState *cpu)
-+{
-+ return false;
-+}
-+
- static void mshv_accel_ops_class_init(ObjectClass *oc, const void *data)
- {
- AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
-
- ops->create_vcpu_thread = mshv_start_vcpu_thread;
-+ ops->cpu_thread_is_idle = mshv_vcpu_thread_is_idle;
- ops->synchronize_post_init = mshv_cpu_synchronize_post_init;
- ops->synchronize_post_reset = mshv_cpu_synchronize_post_reset;
- ops->synchronize_state = mshv_cpu_synchronize;
---
-2.52.0
-
diff --git a/kvm-accel-mshv-initialize-thread-name.patch b/kvm-accel-mshv-initialize-thread-name.patch
deleted file mode 100644
index 71554c0..0000000
--- a/kvm-accel-mshv-initialize-thread-name.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From f102098ed05c9157f2cffb4ffef8324c4f83f005 Mon Sep 17 00:00:00 2001
-From: Paolo Bonzini <pbonzini@redhat.com>
-Date: Wed, 22 Oct 2025 14:52:48 +0200
-Subject: [PATCH 31/32] accel/mshv: initialize thread name
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [29/30] 3e7286070c5ce162001fd407ebb1fa3920e300fa
-
-The initialization was dropped when the code was copied from existing
-accelerators. Coverity knows (CID 1641400). Fix it.
-
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 2cd3c1d35a06a62b25afa80c5baf381ce4b56805)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- accel/mshv/mshv-all.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
-index 45174f7c4e..80428d130d 100644
---- a/accel/mshv/mshv-all.c
-+++ b/accel/mshv/mshv-all.c
-@@ -596,6 +596,9 @@ static void mshv_start_vcpu_thread(CPUState *cpu)
- {
- char thread_name[VCPU_THREAD_NAME_SIZE];
-
-+ snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/MSHV",
-+ cpu->cpu_index);
-+
- cpu->thread = g_malloc0(sizeof(QemuThread));
- cpu->halt_cond = g_malloc0(sizeof(QemuCond));
-
---
-2.47.3
-
diff --git a/kvm-accel-mshv-use-return-value-of-handle_pio_str_read.patch b/kvm-accel-mshv-use-return-value-of-handle_pio_str_read.patch
deleted file mode 100644
index 02b98ee..0000000
--- a/kvm-accel-mshv-use-return-value-of-handle_pio_str_read.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 257a0cba46705253cb708f8b74ceb736b80c2c27 Mon Sep 17 00:00:00 2001
-From: Paolo Bonzini <pbonzini@redhat.com>
-Date: Wed, 22 Oct 2025 14:54:30 +0200
-Subject: [PATCH 32/32] accel/mshv: use return value of handle_pio_str_read
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [30/30] 60404a4d9211cf711fd4581d9f586510c3897bd4
-
-Coverity complains because we assign to ret here but
-then never read it again before we overwrite it with
-the call to set_x64_registers().
-
-Analyzed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 1557adc82698416bc68033765cfffb0a0b91c6bf)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- target/i386/mshv/mshv-cpu.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 1f7b9cb37e..1c3db02188 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -1489,6 +1489,10 @@ static int handle_pio_str(CPUState *cpu, hv_x64_io_port_intercept_message *info)
- reg_values[0] = info->rsi;
- } else {
- ret = handle_pio_str_read(cpu, info, repeat, port, direction_flag);
-+ if (ret < 0) {
-+ error_report("Failed to handle pio str read");
-+ return -1;
-+ }
- reg_names[0] = HV_X64_REGISTER_RDI;
- reg_values[0] = info->rdi;
- }
---
-2.47.3
-
diff --git a/kvm-arm-create-new-rhel-10.2-specific-virt-machine-type.patch b/kvm-arm-create-new-rhel-10.2-specific-virt-machine-type.patch
deleted file mode 100644
index 1d7b92c..0000000
--- a/kvm-arm-create-new-rhel-10.2-specific-virt-machine-type.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 1e99cb806fb7d6a341bf8f7c238aa7261af7dbd0 Mon Sep 17 00:00:00 2001
-From: Sebastian Ott <sebott@redhat.com>
-Date: Wed, 29 Oct 2025 15:53:41 +0100
-Subject: [PATCH 06/10] arm: create new rhel 10.2 specific virt machine type
-
-RH-Author: Sebastian Ott <sebott@redhat.com>
-RH-MergeRequest: 416: x86, arm: create new rhel 9.8, 10.2 specific machine types
-RH-Jira: RHEL-105826 RHEL-105828
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Commit: [1/4] 829eed93aefddcc4684ddacff3cd6ff3f991f442 (seott1/cos-qemu-kvm)
-
-Signed-off-by: Sebastian Ott <sebott@redhat.com>
----
- hw/arm/virt.c | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index d37d1bb3cf..e68979d2c5 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -3688,16 +3688,23 @@ static void virt_machine_4_1_options(MachineClass *mc)
- DEFINE_VIRT_MACHINE(4, 1)
- #endif /* disabled for RHEL */
-
-+static void virt_rhel_machine_10_2_0_options(MachineClass *mc)
-+{
-+}
-+DEFINE_VIRT_MACHINE_AS_LATEST(10, 2, 0)
-+
- static void virt_rhel_machine_10_0_0_options(MachineClass *mc)
- {
- VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
-
-+ virt_rhel_machine_10_2_0_options(mc);
-+
- /* QEMU 9.1 and earlier have only a stage-1 SMMU, not a nested s1+2 one */
- vmc->no_nested_smmu = true;
- compat_props_add(mc->compat_props, hw_compat_rhel_10_2, hw_compat_rhel_10_2_len);
- compat_props_add(mc->compat_props, hw_compat_rhel_10_1, hw_compat_rhel_10_1_len);
- }
--DEFINE_VIRT_MACHINE_AS_LATEST(10, 0, 0)
-+DEFINE_VIRT_MACHINE(10, 0, 0)
-
- static void virt_rhel_machine_9_6_0_options(MachineClass *mc)
- {
---
-2.47.3
-
diff --git a/kvm-arm-create-new-rhel-9.8-specific-virt-machine-type.patch b/kvm-arm-create-new-rhel-9.8-specific-virt-machine-type.patch
deleted file mode 100644
index 2327e80..0000000
--- a/kvm-arm-create-new-rhel-9.8-specific-virt-machine-type.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From c6b6b0d2969f8baf5f09bc1d4953df5e7445820c Mon Sep 17 00:00:00 2001
-From: Sebastian Ott <sebott@redhat.com>
-Date: Wed, 29 Oct 2025 16:05:12 +0100
-Subject: [PATCH 07/10] arm: create new rhel 9.8 specific virt machine type
-
-RH-Author: Sebastian Ott <sebott@redhat.com>
-RH-MergeRequest: 416: x86, arm: create new rhel 9.8, 10.2 specific machine types
-RH-Jira: RHEL-105826 RHEL-105828
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Commit: [2/4] fb3fc4decafd0c6e94ef31c0120b843512089573 (seott1/cos-qemu-kvm)
-
-Signed-off-by: Sebastian Ott <sebott@redhat.com>
----
- hw/arm/virt.c | 13 +++++++++----
- 1 file changed, 9 insertions(+), 4 deletions(-)
-
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index e68979d2c5..dcdd53043e 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -3706,14 +3706,19 @@ static void virt_rhel_machine_10_0_0_options(MachineClass *mc)
- }
- DEFINE_VIRT_MACHINE(10, 0, 0)
-
--static void virt_rhel_machine_9_6_0_options(MachineClass *mc)
-+static void virt_rhel_machine_9_8_0_options(MachineClass *mc)
- {
-- virt_rhel_machine_10_0_0_options(mc);
--
-+ /* NB: remember to move these lines to the *latest* RHEL 9 machine */
- compat_props_add(mc->compat_props, arm_rhel9_compat, arm_rhel9_compat_len);
-- /* NB: remember to move this line to the *latest* RHEL 9 machine */
- compat_props_add(mc->compat_props, hw_compat_rhel_9, hw_compat_rhel_9_len);
- }
-+DEFINE_VIRT_MACHINE(9, 8, 0)
-+
-+static void virt_rhel_machine_9_6_0_options(MachineClass *mc)
-+{
-+ virt_rhel_machine_10_0_0_options(mc);
-+ virt_rhel_machine_9_8_0_options(mc);
-+}
- DEFINE_VIRT_MACHINE(9, 6, 0)
-
- static void virt_rhel_machine_9_4_0_options(MachineClass *mc)
---
-2.47.3
-
diff --git a/kvm-arm-fix-oob-access-in-compat-handling.patch b/kvm-arm-fix-oob-access-in-compat-handling.patch
deleted file mode 100644
index f27f68b..0000000
--- a/kvm-arm-fix-oob-access-in-compat-handling.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From c2c080f94d9107273650ebdaf50ca78e8cb2f866 Mon Sep 17 00:00:00 2001
-From: Sebastian Ott <sebott@redhat.com>
-Date: Tue, 25 Nov 2025 09:19:30 +0100
-Subject: [PATCH 2/2] arm: fix oob access in compat handling
-
-RH-Author: Sebastian Ott <sebott@redhat.com>
-RH-MergeRequest: 430: arm: fix oob access in compat handling
-RH-Jira: RHEL-130478
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
-RH-Commit: [1/1] 5d6ab0821b0ffce732862969f275aa50f6917bf1 (seott1/cos-qemu-kvm)
-
-Upstream: RHEL only
-Fixes: 58cba97a "hw/arm/virt: Use ACPI PCI hotplug by default from 10.2 onwards"
-
-Due to incorrect length information arm_acpi_pci_hp_disabled_compat[]
-was accessed out of bounds. This led to the weird side effect that the
-1st member of arm_rhel9_compat[] was applied to the virt-rhel10.0
-machine type causing migration failures. Fix the length.
-
-Signed-off-by: Sebastian Ott <sebott@redhat.com>
----
- hw/arm/virt.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index e8e64fe7fe..1cfb386f64 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -102,7 +102,8 @@ static const size_t arm_virt_compat_len = G_N_ELEMENTS(arm_virt_compat);
- GlobalProperty arm_acpi_pci_hp_disabled_compat[] = {
- { TYPE_ACPI_GED, "acpi-pci-hotplug-with-bridge-support", "off" },
- };
--static const size_t arm_acpi_pci_hp_disabled_compat_len = G_N_ELEMENTS(arm_virt_compat);
-+static const size_t arm_acpi_pci_hp_disabled_compat_len =
-+ G_N_ELEMENTS(arm_acpi_pci_hp_disabled_compat);
-
- /*
- * RHEL9 kernels have pauth disabled while RHEL10 has it enabled,
---
-2.47.3
-
diff --git a/kvm-arm-kvm-report-registers-we-failed-to-set.patch b/kvm-arm-kvm-report-registers-we-failed-to-set.patch
deleted file mode 100644
index 9f956e9..0000000
--- a/kvm-arm-kvm-report-registers-we-failed-to-set.patch
+++ /dev/null
@@ -1,154 +0,0 @@
-From d635b553683b9a057d7a1a4b7e3348c88dcab6d6 Mon Sep 17 00:00:00 2001
-From: Cornelia Huck <cohuck@redhat.com>
-Date: Thu, 11 Sep 2025 17:41:59 +0200
-Subject: [PATCH 1/4] arm/kvm: report registers we failed to set
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 410: arm/kvm: report registers we failed to set
-RH-Jira: RHEL-119368
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Donald Dutile <None>
-RH-Commit: [1/1] 82b4496284ff0a4dd2dd0eae7bb1cf114dded61e (eauger1/centos-qemu-kvm)
-
-If we fail migration because of a mismatch of some registers between
-source and destination, the error message is not very informative:
-
-qemu-system-aarch64: error while loading state for instance 0x0 ofdevice 'cpu'
-qemu-system-aarch64: Failed to put registers after init: Invalid argument
-
-At least try to give the user a hint which registers had a problem,
-even if they cannot really do anything about it right now.
-
-Sample output:
-
-Could not set register op0:3 op1:0 crn:0 crm:0 op2:0 to c00fac31 (is 413fd0c1)
-
-We could be even more helpful once we support writable ID registers,
-at which point the user might actually be able to configure something
-that is migratable.
-
-Suggested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Sebastian Ott <sebott@redhat.com>
-Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-Message-id: 20250911154159.158046-1-cohuck@redhat.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 19f6dcfe6b8b2a3523362812fc696ab83050d316)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/kvm.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 86 insertions(+)
-
-diff --git a/target/arm/kvm.c b/target/arm/kvm.c
-index 6672344855..c1ec6654ca 100644
---- a/target/arm/kvm.c
-+++ b/target/arm/kvm.c
-@@ -900,6 +900,58 @@ bool write_kvmstate_to_list(ARMCPU *cpu)
- return ok;
- }
-
-+/* pretty-print a KVM register */
-+#define CP_REG_ARM64_SYSREG_OP(_reg, _op) \
-+ ((uint8_t)((_reg & CP_REG_ARM64_SYSREG_ ## _op ## _MASK) >> \
-+ CP_REG_ARM64_SYSREG_ ## _op ## _SHIFT))
-+
-+static gchar *kvm_print_sve_register_name(uint64_t regidx)
-+{
-+ uint16_t sve_reg = regidx & 0x000000000000ffff;
-+
-+ if (regidx == KVM_REG_ARM64_SVE_VLS) {
-+ return g_strdup_printf("SVE VLS");
-+ }
-+ /* zreg, preg, ffr */
-+ switch (sve_reg & 0xfc00) {
-+ case 0:
-+ return g_strdup_printf("SVE zreg n:%d slice:%d",
-+ (sve_reg & 0x03e0) >> 5, sve_reg & 0x001f);
-+ case 0x04:
-+ return g_strdup_printf("SVE preg n:%d slice:%d",
-+ (sve_reg & 0x01e0) >> 5, sve_reg & 0x001f);
-+ case 0x06:
-+ return g_strdup_printf("SVE ffr slice:%d", sve_reg & 0x001f);
-+ default:
-+ return g_strdup_printf("SVE ???");
-+ }
-+}
-+
-+static gchar *kvm_print_register_name(uint64_t regidx)
-+{
-+ switch ((regidx & KVM_REG_ARM_COPROC_MASK)) {
-+ case KVM_REG_ARM_CORE:
-+ return g_strdup_printf("core reg %"PRIx64, regidx);
-+ case KVM_REG_ARM_DEMUX:
-+ return g_strdup_printf("demuxed reg %"PRIx64, regidx);
-+ case KVM_REG_ARM64_SYSREG:
-+ return g_strdup_printf("op0:%d op1:%d crn:%d crm:%d op2:%d",
-+ CP_REG_ARM64_SYSREG_OP(regidx, OP0),
-+ CP_REG_ARM64_SYSREG_OP(regidx, OP1),
-+ CP_REG_ARM64_SYSREG_OP(regidx, CRN),
-+ CP_REG_ARM64_SYSREG_OP(regidx, CRM),
-+ CP_REG_ARM64_SYSREG_OP(regidx, OP2));
-+ case KVM_REG_ARM_FW:
-+ return g_strdup_printf("fw reg %d", (int)(regidx & 0xffff));
-+ case KVM_REG_ARM64_SVE:
-+ return kvm_print_sve_register_name(regidx);
-+ case KVM_REG_ARM_FW_FEAT_BMAP:
-+ return g_strdup_printf("fw feat reg %d", (int)(regidx & 0xffff));
-+ default:
-+ return g_strdup_printf("%"PRIx64, regidx);
-+ }
-+}
-+
- bool write_list_to_kvmstate(ARMCPU *cpu, int level)
- {
- CPUState *cs = CPU(cpu);
-@@ -927,11 +979,45 @@ bool write_list_to_kvmstate(ARMCPU *cpu, int level)
- g_assert_not_reached();
- }
- if (ret) {
-+ gchar *reg_str = kvm_print_register_name(regidx);
-+
- /* We might fail for "unknown register" and also for
- * "you tried to set a register which is constant with
- * a different value from what it actually contains".
- */
- ok = false;
-+ switch (ret) {
-+ case -ENOENT:
-+ error_report("Could not set register %s: unknown to KVM",
-+ reg_str);
-+ break;
-+ case -EINVAL:
-+ if ((regidx & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U32) {
-+ if (!kvm_get_one_reg(cs, regidx, &v32)) {
-+ error_report("Could not set register %s to %x (is %x)",
-+ reg_str, (uint32_t)cpu->cpreg_values[i],
-+ v32);
-+ } else {
-+ error_report("Could not set register %s to %x",
-+ reg_str, (uint32_t)cpu->cpreg_values[i]);
-+ }
-+ } else /* U64 */ {
-+ uint64_t v64;
-+
-+ if (!kvm_get_one_reg(cs, regidx, &v64)) {
-+ error_report("Could not set register %s to %"PRIx64" (is %"PRIx64")",
-+ reg_str, cpu->cpreg_values[i], v64);
-+ } else {
-+ error_report("Could not set register %s to %"PRIx64,
-+ reg_str, cpu->cpreg_values[i]);
-+ }
-+ }
-+ break;
-+ default:
-+ error_report("Could not set register %s: %s",
-+ reg_str, strerror(-ret));
-+ }
-+ g_free(reg_str);
- }
- }
- return ok;
---
-2.47.3
-
diff --git a/kvm-async-access-bottom-half-flags-with-qatomic_read.patch b/kvm-async-access-bottom-half-flags-with-qatomic_read.patch
deleted file mode 100644
index efb742e..0000000
--- a/kvm-async-access-bottom-half-flags-with-qatomic_read.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 649398182d4897325f37cee57f81ae9f22272d66 Mon Sep 17 00:00:00 2001
-From: Paolo Bonzini <pbonzini@redhat.com>
-Date: Mon, 13 Oct 2025 18:24:54 +0200
-Subject: [PATCH 31/52] async: access bottom half flags with qatomic_read
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [24/45] c2367e9cbd60ef60a2a2a61cda56c31f4bd9a00b (kmwolf/centos-qemu-kvm)
-
-Running test-aio-multithread under TSAN reveals data races on bh->flags.
-Because bottom halves may be scheduled or canceled asynchronously,
-without taking a lock, adjust aio_compute_bh_timeout() and aio_ctx_check()
-to use a relaxed read to access the flags.
-
-Use an acquire load to ensure that anything that was written prior to
-qemu_bh_schedule() is visible.
-
-Closes: https://gitlab.com/qemu-project/qemu/-/issues/2749
-Closes: https://gitlab.com/qemu-project/qemu/-/issues/851
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 5142397c79330aab9bef3230991c8ac0c251110f)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- util/async.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/util/async.c b/util/async.c
-index 2719c629ae..a736d2cd0d 100644
---- a/util/async.c
-+++ b/util/async.c
-@@ -256,8 +256,9 @@ static int64_t aio_compute_bh_timeout(BHList *head, int timeout)
- QEMUBH *bh;
-
- QSLIST_FOREACH_RCU(bh, head, next) {
-- if ((bh->flags & (BH_SCHEDULED | BH_DELETED)) == BH_SCHEDULED) {
-- if (bh->flags & BH_IDLE) {
-+ int flags = qatomic_load_acquire(&bh->flags);
-+ if ((flags & (BH_SCHEDULED | BH_DELETED)) == BH_SCHEDULED) {
-+ if (flags & BH_IDLE) {
- /* idle bottom halves will be polled at least
- * every 10ms */
- timeout = 10000000;
-@@ -335,14 +336,16 @@ aio_ctx_check(GSource *source)
- aio_notify_accept(ctx);
-
- QSLIST_FOREACH_RCU(bh, &ctx->bh_list, next) {
-- if ((bh->flags & (BH_SCHEDULED | BH_DELETED)) == BH_SCHEDULED) {
-+ int flags = qatomic_load_acquire(&bh->flags);
-+ if ((flags & (BH_SCHEDULED | BH_DELETED)) == BH_SCHEDULED) {
- return true;
- }
- }
-
- QSIMPLEQ_FOREACH(s, &ctx->bh_slice_list, next) {
- QSLIST_FOREACH_RCU(bh, &s->bh_list, next) {
-- if ((bh->flags & (BH_SCHEDULED | BH_DELETED)) == BH_SCHEDULED) {
-+ int flags = qatomic_load_acquire(&bh->flags);
-+ if ((flags & (BH_SCHEDULED | BH_DELETED)) == BH_SCHEDULED) {
- return true;
- }
- }
---
-2.52.0
-
diff --git a/kvm-backends-iommufd-Add-get_pasid_info-callback.patch b/kvm-backends-iommufd-Add-get_pasid_info-callback.patch
deleted file mode 100644
index c53a898..0000000
--- a/kvm-backends-iommufd-Add-get_pasid_info-callback.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-From e614aef2ad181cc80c1688ebbf568d5eed193e37 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 041/111] backends/iommufd: Add get_pasid_info() callback
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [41/111] 3c436702f4ac6d8819ba999b7503a98efb770fec (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-The get_pasid_info callback retrieves PASID capability information
-when the HostIOMMUDevice backend supports it. Currently, only the
-Linux IOMMUFD backend provides this information.
-
-This will be used by a subsequent patch to synthesize a PASID
-capability for vfio-pci devices behind a vIOMMU that supports PASID.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Message-id: 20260126104342.253965-34-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 22afd9d865cb05d93c92c8fca7a23e1eb879e889)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- backends/iommufd.c | 17 +++++++++++++++++
- include/system/host_iommu_device.h | 17 +++++++++++++++++
- 2 files changed, 34 insertions(+)
-
-diff --git a/backends/iommufd.c b/backends/iommufd.c
-index 6381f9664b..f1707eadc6 100644
---- a/backends/iommufd.c
-+++ b/backends/iommufd.c
-@@ -538,11 +538,28 @@ static int hiod_iommufd_get_cap(HostIOMMUDevice *hiod, int cap, Error **errp)
- }
- }
-
-+static bool hiod_iommufd_get_pasid_info(HostIOMMUDevice *hiod,
-+ PasidInfo *pasid_info)
-+{
-+ HostIOMMUDeviceCaps *caps = &hiod->caps;
-+
-+ if (!caps->max_pasid_log2) {
-+ return false;
-+ }
-+
-+ g_assert(pasid_info);
-+ pasid_info->exec_perm = (caps->hw_caps & IOMMU_HW_CAP_PCI_PASID_EXEC);
-+ pasid_info->priv_mod = (caps->hw_caps & IOMMU_HW_CAP_PCI_PASID_PRIV);
-+ pasid_info->max_pasid_log2 = caps->max_pasid_log2;
-+ return true;
-+}
-+
- static void hiod_iommufd_class_init(ObjectClass *oc, const void *data)
- {
- HostIOMMUDeviceClass *hioc = HOST_IOMMU_DEVICE_CLASS(oc);
-
- hioc->get_cap = hiod_iommufd_get_cap;
-+ hioc->get_pasid_info = hiod_iommufd_get_pasid_info;
- };
-
- static const TypeInfo types[] = {
-diff --git a/include/system/host_iommu_device.h b/include/system/host_iommu_device.h
-index bfb2b60478..f000301583 100644
---- a/include/system/host_iommu_device.h
-+++ b/include/system/host_iommu_device.h
-@@ -59,6 +59,12 @@ struct HostIOMMUDevice {
- #endif
- };
-
-+typedef struct PasidInfo {
-+ bool exec_perm;
-+ bool priv_mod;
-+ uint8_t max_pasid_log2;
-+} PasidInfo;
-+
- /**
- * struct HostIOMMUDeviceClass - The base class for all host IOMMU devices.
- *
-@@ -116,6 +122,17 @@ struct HostIOMMUDeviceClass {
- * @hiod: handle to the host IOMMU device
- */
- uint64_t (*get_page_size_mask)(HostIOMMUDevice *hiod);
-+ /**
-+ * @get_pasid_info: Return the PASID information associated with the
-+ * @hiod Host IOMMU device.
-+ *
-+ * @hiod: handle to the host IOMMU device
-+ *
-+ * @pasid_info: If success, returns the PASID related information.
-+ *
-+ * Returns: true on success, false on failure.
-+ */
-+ bool (*get_pasid_info)(HostIOMMUDevice *hiod, PasidInfo *pasid_info);
- };
-
- /*
---
-2.52.0
-
diff --git a/kvm-backends-iommufd-Introduce-iommufd_backend_alloc_hw_.patch b/kvm-backends-iommufd-Introduce-iommufd_backend_alloc_hw_.patch
deleted file mode 100644
index 6eee724..0000000
--- a/kvm-backends-iommufd-Introduce-iommufd_backend_alloc_hw_.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-From b024184da63ed552873ceb7f5aebfffe11d4cf52 Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:24 +0100
-Subject: [PATCH 081/111] backends/iommufd: Introduce
- iommufd_backend_alloc_hw_queue
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [81/111] 3db17914eedcce25ddbd6f008e73fc3c0270e450 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Conflicts: contextual conflict in backends/trace-events since
-we don't have igvm trace points
-
-Add a helper to allocate an iommufd backed HW queue for a vIOMMU.
-
-While at it, define a struct IOMMUFDHWqueue for use by vendor
-implementations.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-4-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 41dae463f487a5d94822a069043b7675405d0365)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- backends/iommufd.c | 31 +++++++++++++++++++++++++++++++
- backends/trace-events | 1 +
- include/system/iommufd.h | 11 +++++++++++
- 3 files changed, 43 insertions(+)
-
-diff --git a/backends/iommufd.c b/backends/iommufd.c
-index 621b6115cb..0e11d2722a 100644
---- a/backends/iommufd.c
-+++ b/backends/iommufd.c
-@@ -545,6 +545,37 @@ bool iommufd_backend_alloc_veventq(IOMMUFDBackend *be, uint32_t viommu_id,
- return true;
- }
-
-+bool iommufd_backend_alloc_hw_queue(IOMMUFDBackend *be, uint32_t viommu_id,
-+ uint32_t queue_type, uint32_t index,
-+ uint64_t addr, uint64_t length,
-+ uint32_t *out_hw_queue_id, Error **errp)
-+{
-+ int ret;
-+ struct iommu_hw_queue_alloc alloc_hw_queue = {
-+ .size = sizeof(alloc_hw_queue),
-+ .flags = 0,
-+ .viommu_id = viommu_id,
-+ .type = queue_type,
-+ .index = index,
-+ .nesting_parent_iova = addr,
-+ .length = length,
-+ };
-+
-+ ret = ioctl(be->fd, IOMMU_HW_QUEUE_ALLOC, &alloc_hw_queue);
-+
-+ trace_iommufd_backend_alloc_hw_queue(be->fd, viommu_id, queue_type,
-+ index, addr, length,
-+ alloc_hw_queue.out_hw_queue_id, ret);
-+ if (ret) {
-+ error_setg_errno(errp, errno, "IOMMU_HW_QUEUE_ALLOC failed");
-+ return false;
-+ }
-+
-+ g_assert(out_hw_queue_id);
-+ *out_hw_queue_id = alloc_hw_queue.out_hw_queue_id;
-+ return true;
-+}
-+
- bool host_iommu_device_iommufd_attach_hwpt(HostIOMMUDeviceIOMMUFD *hiodi,
- uint32_t hwpt_id, Error **errp)
- {
-diff --git a/backends/trace-events b/backends/trace-events
-index 934cdd8107..a88996488d 100644
---- a/backends/trace-events
-+++ b/backends/trace-events
-@@ -24,3 +24,4 @@ iommufd_backend_invalidate_cache(int iommufd, uint32_t id, uint32_t data_type, u
- iommufd_backend_alloc_viommu(int iommufd, uint32_t dev_id, uint32_t type, uint32_t hwpt_id, uint64_t data_ptr, uint32_t data_len, uint32_t viommu_id, int ret) " iommufd=%d type=%u dev_id=%u hwpt_id=%u data_ptr=0x%"PRIx64" data_len=0x%x viommu_id=%u (%d)"
- iommufd_backend_alloc_vdev(int iommufd, uint32_t dev_id, uint32_t viommu_id, uint64_t virt_id, uint32_t vdev_id, int ret) " iommufd=%d dev_id=%u viommu_id=%u virt_id=0x%"PRIx64" vdev_id=%u (%d)"
- iommufd_viommu_alloc_eventq(int iommufd, uint32_t viommu_id, uint32_t type, uint32_t veventq_id, uint32_t veventq_fd, int ret) " iommufd=%d viommu_id=%u type=%u veventq_id=%u veventq_fd=%u (%d)"
-+iommufd_backend_alloc_hw_queue(int iommufd, uint32_t viommu_id, uint32_t queue_type, uint32_t index, uint64_t addr, uint64_t size, uint32_t queue_id, int ret) " iommufd=%d viommu_id=%u queue_type=%u index=%u addr=0x%"PRIx64" size=0x%"PRIx64" queue_id=%u (%d)"
-diff --git a/include/system/iommufd.h b/include/system/iommufd.h
-index 783d125ee4..a538a13b80 100644
---- a/include/system/iommufd.h
-+++ b/include/system/iommufd.h
-@@ -65,6 +65,12 @@ typedef struct IOMMUFDVeventq {
- bool event_start; /* True after first valid event; cleared on overflow */
- } IOMMUFDVeventq;
-
-+/* HW queue object for a vIOMMU-specific HW-accelerated queue */
-+typedef struct IOMMUFDHWqueue {
-+ IOMMUFDViommu *viommu;
-+ uint32_t hw_queue_id;
-+} IOMMUFDHWqueue;
-+
- bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp);
- void iommufd_backend_disconnect(IOMMUFDBackend *be);
-
-@@ -101,6 +107,11 @@ bool iommufd_backend_alloc_veventq(IOMMUFDBackend *be, uint32_t viommu_id,
- uint32_t *out_veventq_id,
- uint32_t *out_veventq_fd, Error **errp);
-
-+bool iommufd_backend_alloc_hw_queue(IOMMUFDBackend *be, uint32_t viommu_id,
-+ uint32_t queue_type, uint32_t index,
-+ uint64_t addr, uint64_t length,
-+ uint32_t *out_hw_queue_id, Error **errp);
-+
- bool iommufd_backend_set_dirty_tracking(IOMMUFDBackend *be, uint32_t hwpt_id,
- bool start, Error **errp);
- bool iommufd_backend_get_dirty_bitmap(IOMMUFDBackend *be, uint32_t hwpt_id,
---
-2.52.0
-
diff --git a/kvm-backends-iommufd-Introduce-iommufd_backend_alloc_vde.patch b/kvm-backends-iommufd-Introduce-iommufd_backend_alloc_vde.patch
deleted file mode 100644
index 931d93d..0000000
--- a/kvm-backends-iommufd-Introduce-iommufd_backend_alloc_vde.patch
+++ /dev/null
@@ -1,122 +0,0 @@
-From 1ef487fbeab465ec6ed4d4f4286b465e7e797c24 Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 002/111] backends/iommufd: Introduce
- iommufd_backend_alloc_vdev
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [2/111] b063cc8959bb43f4c3112b4ec19329c5dcb1e556 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Add a helper to allocate an iommufd device's virtual device (in the user
-space) per a viommu instance.
-
-While at it, introduce a struct IOMMUFDVdev for later use by vendor
-IOMMU implementations.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Message-id: 20260126104342.253965-3-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit cd438bf9bdf75cc7251ffb968ea59e640fe096e6)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- backends/iommufd.c | 27 +++++++++++++++++++++++++++
- backends/trace-events | 1 +
- include/system/iommufd.h | 12 ++++++++++++
- 3 files changed, 40 insertions(+)
-
-diff --git a/backends/iommufd.c b/backends/iommufd.c
-index 3d4a4ae736..e68a2c934f 100644
---- a/backends/iommufd.c
-+++ b/backends/iommufd.c
-@@ -472,6 +472,33 @@ bool iommufd_backend_alloc_viommu(IOMMUFDBackend *be, uint32_t dev_id,
- return true;
- }
-
-+bool iommufd_backend_alloc_vdev(IOMMUFDBackend *be, uint32_t dev_id,
-+ uint32_t viommu_id, uint64_t virt_id,
-+ uint32_t *out_vdev_id, Error **errp)
-+{
-+ int ret;
-+ struct iommu_vdevice_alloc alloc_vdev = {
-+ .size = sizeof(alloc_vdev),
-+ .viommu_id = viommu_id,
-+ .dev_id = dev_id,
-+ .virt_id = virt_id,
-+ };
-+
-+ ret = ioctl(be->fd, IOMMU_VDEVICE_ALLOC, &alloc_vdev);
-+
-+ trace_iommufd_backend_alloc_vdev(be->fd, dev_id, viommu_id, virt_id,
-+ alloc_vdev.out_vdevice_id, ret);
-+
-+ if (ret) {
-+ error_setg_errno(errp, errno, "IOMMU_VDEVICE_ALLOC failed");
-+ return false;
-+ }
-+
-+ g_assert(out_vdev_id);
-+ *out_vdev_id = alloc_vdev.out_vdevice_id;
-+ return true;
-+}
-+
- bool host_iommu_device_iommufd_attach_hwpt(HostIOMMUDeviceIOMMUFD *idev,
- uint32_t hwpt_id, Error **errp)
- {
-diff --git a/backends/trace-events b/backends/trace-events
-index 01c2d9bde9..8408dc8701 100644
---- a/backends/trace-events
-+++ b/backends/trace-events
-@@ -22,3 +22,4 @@ iommufd_backend_set_dirty(int iommufd, uint32_t hwpt_id, bool start, int ret) "
- iommufd_backend_get_dirty_bitmap(int iommufd, uint32_t hwpt_id, uint64_t iova, uint64_t size, uint64_t page_size, int ret) " iommufd=%d hwpt=%u iova=0x%"PRIx64" size=0x%"PRIx64" page_size=0x%"PRIx64" (%d)"
- iommufd_backend_invalidate_cache(int iommufd, uint32_t id, uint32_t data_type, uint32_t entry_len, uint32_t entry_num, uint32_t done_num, uint64_t data_ptr, int ret) " iommufd=%d id=%u data_type=%u entry_len=%u entry_num=%u done_num=%u data_ptr=0x%"PRIx64" (%d)"
- iommufd_backend_alloc_viommu(int iommufd, uint32_t dev_id, uint32_t type, uint32_t hwpt_id, uint32_t viommu_id, int ret) " iommufd=%d type=%u dev_id=%u hwpt_id=%u viommu_id=%u (%d)"
-+iommufd_backend_alloc_vdev(int iommufd, uint32_t dev_id, uint32_t viommu_id, uint64_t virt_id, uint32_t vdev_id, int ret) " iommufd=%d dev_id=%u viommu_id=%u virt_id=0x%"PRIx64" vdev_id=%u (%d)"
-diff --git a/include/system/iommufd.h b/include/system/iommufd.h
-index 11b8413c3f..41e216c677 100644
---- a/include/system/iommufd.h
-+++ b/include/system/iommufd.h
-@@ -48,6 +48,14 @@ typedef struct IOMMUFDViommu {
- uint32_t viommu_id; /* virtual IOMMU ID of allocated object */
- } IOMMUFDViommu;
-
-+/*
-+ * Virtual device object for a physical device bind to a vIOMMU.
-+ */
-+typedef struct IOMMUFDVdev {
-+ uint32_t vdevice_id; /* object handle for vDevice */
-+ uint32_t virt_id; /* virtual device ID */
-+} IOMMUFDVdev;
-+
- bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp);
- void iommufd_backend_disconnect(IOMMUFDBackend *be);
-
-@@ -73,6 +81,10 @@ bool iommufd_backend_alloc_viommu(IOMMUFDBackend *be, uint32_t dev_id,
- uint32_t viommu_type, uint32_t hwpt_id,
- uint32_t *out_hwpt, Error **errp);
-
-+bool iommufd_backend_alloc_vdev(IOMMUFDBackend *be, uint32_t dev_id,
-+ uint32_t viommu_id, uint64_t virt_id,
-+ uint32_t *out_vdev_id, Error **errp);
-+
- bool iommufd_backend_set_dirty_tracking(IOMMUFDBackend *be, uint32_t hwpt_id,
- bool start, Error **errp);
- bool iommufd_backend_get_dirty_bitmap(IOMMUFDBackend *be, uint32_t hwpt_id,
---
-2.52.0
-
diff --git a/kvm-backends-iommufd-Introduce-iommufd_backend_alloc_vev.patch b/kvm-backends-iommufd-Introduce-iommufd_backend_alloc_vev.patch
deleted file mode 100644
index efff3d1..0000000
--- a/kvm-backends-iommufd-Introduce-iommufd_backend_alloc_vev.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-From 30da7f8af7c6d1e240cab27117e4b06143bab4c4 Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Fri, 6 Mar 2026 09:01:11 +0000
-Subject: [PATCH 050/111] backends/iommufd: Introduce
- iommufd_backend_alloc_veventq
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [50/111] ed7d1d76b95dcbd4df9bab81ed7c660b2eda094c (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73796
-
-Conflicts: contextual in backends/trace-events because we don't
- have IGM trace points downstream
-
-Add a new helper for IOMMU_VEVENTQ_ALLOC ioctl to allocate a virtual event
-queue (vEVENTQ) for a vIOMMU object.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260226084456.112142-2-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 0885cd5504dfdbd531a1fc0e3e421d3c9934b03a)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- backends/iommufd.c | 31 +++++++++++++++++++++++++++++++
- backends/trace-events | 1 +
- include/system/iommufd.h | 14 ++++++++++++++
- 3 files changed, 46 insertions(+)
-
-diff --git a/backends/iommufd.c b/backends/iommufd.c
-index f1707eadc6..5b919e4be9 100644
---- a/backends/iommufd.c
-+++ b/backends/iommufd.c
-@@ -503,6 +503,37 @@ bool iommufd_backend_alloc_vdev(IOMMUFDBackend *be, uint32_t dev_id,
- return true;
- }
-
-+bool iommufd_backend_alloc_veventq(IOMMUFDBackend *be, uint32_t viommu_id,
-+ uint32_t type, uint32_t depth,
-+ uint32_t *out_veventq_id,
-+ uint32_t *out_veventq_fd, Error **errp)
-+{
-+ int ret;
-+ struct iommu_veventq_alloc alloc_veventq = {
-+ .size = sizeof(alloc_veventq),
-+ .flags = 0,
-+ .type = type,
-+ .veventq_depth = depth,
-+ .viommu_id = viommu_id,
-+ };
-+
-+ ret = ioctl(be->fd, IOMMU_VEVENTQ_ALLOC, &alloc_veventq);
-+
-+ trace_iommufd_viommu_alloc_eventq(be->fd, viommu_id, type,
-+ alloc_veventq.out_veventq_id,
-+ alloc_veventq.out_veventq_fd, ret);
-+ if (ret) {
-+ error_setg_errno(errp, errno, "IOMMU_VEVENTQ_ALLOC failed");
-+ return false;
-+ }
-+
-+ g_assert(out_veventq_id);
-+ g_assert(out_veventq_fd);
-+ *out_veventq_id = alloc_veventq.out_veventq_id;
-+ *out_veventq_fd = alloc_veventq.out_veventq_fd;
-+ return true;
-+}
-+
- bool host_iommu_device_iommufd_attach_hwpt(HostIOMMUDeviceIOMMUFD *idev,
- uint32_t hwpt_id, Error **errp)
- {
-diff --git a/backends/trace-events b/backends/trace-events
-index 8408dc8701..5afa7a40be 100644
---- a/backends/trace-events
-+++ b/backends/trace-events
-@@ -23,3 +23,4 @@ iommufd_backend_get_dirty_bitmap(int iommufd, uint32_t hwpt_id, uint64_t iova, u
- iommufd_backend_invalidate_cache(int iommufd, uint32_t id, uint32_t data_type, uint32_t entry_len, uint32_t entry_num, uint32_t done_num, uint64_t data_ptr, int ret) " iommufd=%d id=%u data_type=%u entry_len=%u entry_num=%u done_num=%u data_ptr=0x%"PRIx64" (%d)"
- iommufd_backend_alloc_viommu(int iommufd, uint32_t dev_id, uint32_t type, uint32_t hwpt_id, uint32_t viommu_id, int ret) " iommufd=%d type=%u dev_id=%u hwpt_id=%u viommu_id=%u (%d)"
- iommufd_backend_alloc_vdev(int iommufd, uint32_t dev_id, uint32_t viommu_id, uint64_t virt_id, uint32_t vdev_id, int ret) " iommufd=%d dev_id=%u viommu_id=%u virt_id=0x%"PRIx64" vdev_id=%u (%d)"
-+iommufd_viommu_alloc_eventq(int iommufd, uint32_t viommu_id, uint32_t type, uint32_t veventq_id, uint32_t veventq_fd, int ret) " iommufd=%d viommu_id=%u type=%u veventq_id=%u veventq_fd=%u (%d)"
-diff --git a/include/system/iommufd.h b/include/system/iommufd.h
-index aa78bf1e1d..25da754434 100644
---- a/include/system/iommufd.h
-+++ b/include/system/iommufd.h
-@@ -56,6 +56,15 @@ typedef struct IOMMUFDVdev {
- uint32_t virt_id; /* virtual device ID */
- } IOMMUFDVdev;
-
-+/* Virtual event queue interface for a vIOMMU */
-+typedef struct IOMMUFDVeventq {
-+ IOMMUFDViommu *viommu;
-+ uint32_t veventq_id;
-+ uint32_t veventq_fd;
-+ uint32_t last_event_seq; /* Sequence number of last processed event */
-+ bool event_start; /* True after first valid event; cleared on overflow */
-+} IOMMUFDVeventq;
-+
- bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp);
- void iommufd_backend_disconnect(IOMMUFDBackend *be);
-
-@@ -86,6 +95,11 @@ bool iommufd_backend_alloc_vdev(IOMMUFDBackend *be, uint32_t dev_id,
- uint32_t viommu_id, uint64_t virt_id,
- uint32_t *out_vdev_id, Error **errp);
-
-+bool iommufd_backend_alloc_veventq(IOMMUFDBackend *be, uint32_t viommu_id,
-+ uint32_t type, uint32_t depth,
-+ uint32_t *out_veventq_id,
-+ uint32_t *out_veventq_fd, Error **errp);
-+
- bool iommufd_backend_set_dirty_tracking(IOMMUFDBackend *be, uint32_t hwpt_id,
- bool start, Error **errp);
- bool iommufd_backend_get_dirty_bitmap(IOMMUFDBackend *be, uint32_t hwpt_id,
---
-2.52.0
-
diff --git a/kvm-backends-iommufd-Introduce-iommufd_backend_alloc_vio.patch b/kvm-backends-iommufd-Introduce-iommufd_backend_alloc_vio.patch
deleted file mode 100644
index f941198..0000000
--- a/kvm-backends-iommufd-Introduce-iommufd_backend_alloc_vio.patch
+++ /dev/null
@@ -1,122 +0,0 @@
-From ce364f92071b60f7cb4a04b69f6f6a9c7c0257fa Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 001/111] backends/iommufd: Introduce
- iommufd_backend_alloc_viommu
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [1/111] a18282a27ab9339bc218c7c776ac0524f9573669 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Add a helper to allocate a viommu object.
-
-Also introduce a struct IOMMUFDViommu that can be used later by vendor
-IOMMU implementations.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Message-id: 20260126104342.253965-2-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit f2d31df0d92546a86e8cdbf51436db6aae8c167a)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- backends/iommufd.c | 26 ++++++++++++++++++++++++++
- backends/trace-events | 1 +
- include/system/iommufd.h | 14 ++++++++++++++
- 3 files changed, 41 insertions(+)
-
-diff --git a/backends/iommufd.c b/backends/iommufd.c
-index fdfb7c9d67..3d4a4ae736 100644
---- a/backends/iommufd.c
-+++ b/backends/iommufd.c
-@@ -446,6 +446,32 @@ bool iommufd_backend_invalidate_cache(IOMMUFDBackend *be, uint32_t id,
- return !ret;
- }
-
-+bool iommufd_backend_alloc_viommu(IOMMUFDBackend *be, uint32_t dev_id,
-+ uint32_t viommu_type, uint32_t hwpt_id,
-+ uint32_t *out_viommu_id, Error **errp)
-+{
-+ int ret;
-+ struct iommu_viommu_alloc alloc_viommu = {
-+ .size = sizeof(alloc_viommu),
-+ .type = viommu_type,
-+ .dev_id = dev_id,
-+ .hwpt_id = hwpt_id,
-+ };
-+
-+ ret = ioctl(be->fd, IOMMU_VIOMMU_ALLOC, &alloc_viommu);
-+
-+ trace_iommufd_backend_alloc_viommu(be->fd, dev_id, viommu_type, hwpt_id,
-+ alloc_viommu.out_viommu_id, ret);
-+ if (ret) {
-+ error_setg_errno(errp, errno, "IOMMU_VIOMMU_ALLOC failed");
-+ return false;
-+ }
-+
-+ g_assert(out_viommu_id);
-+ *out_viommu_id = alloc_viommu.out_viommu_id;
-+ return true;
-+}
-+
- bool host_iommu_device_iommufd_attach_hwpt(HostIOMMUDeviceIOMMUFD *idev,
- uint32_t hwpt_id, Error **errp)
- {
-diff --git a/backends/trace-events b/backends/trace-events
-index 56132d3fd2..01c2d9bde9 100644
---- a/backends/trace-events
-+++ b/backends/trace-events
-@@ -21,3 +21,4 @@ iommufd_backend_free_id(int iommufd, uint32_t id, int ret) " iommufd=%d id=%d (%
- iommufd_backend_set_dirty(int iommufd, uint32_t hwpt_id, bool start, int ret) " iommufd=%d hwpt=%u enable=%d (%d)"
- iommufd_backend_get_dirty_bitmap(int iommufd, uint32_t hwpt_id, uint64_t iova, uint64_t size, uint64_t page_size, int ret) " iommufd=%d hwpt=%u iova=0x%"PRIx64" size=0x%"PRIx64" page_size=0x%"PRIx64" (%d)"
- iommufd_backend_invalidate_cache(int iommufd, uint32_t id, uint32_t data_type, uint32_t entry_len, uint32_t entry_num, uint32_t done_num, uint64_t data_ptr, int ret) " iommufd=%d id=%u data_type=%u entry_len=%u entry_num=%u done_num=%u data_ptr=0x%"PRIx64" (%d)"
-+iommufd_backend_alloc_viommu(int iommufd, uint32_t dev_id, uint32_t type, uint32_t hwpt_id, uint32_t viommu_id, int ret) " iommufd=%d type=%u dev_id=%u hwpt_id=%u viommu_id=%u (%d)"
-diff --git a/include/system/iommufd.h b/include/system/iommufd.h
-index a659f36a20..11b8413c3f 100644
---- a/include/system/iommufd.h
-+++ b/include/system/iommufd.h
-@@ -38,6 +38,16 @@ struct IOMMUFDBackend {
- /*< public >*/
- };
-
-+/*
-+ * Virtual IOMMU object that represents physical IOMMU's virtualization
-+ * support
-+ */
-+typedef struct IOMMUFDViommu {
-+ IOMMUFDBackend *iommufd;
-+ uint32_t s2_hwpt_id; /* ID of stage 2 HWPT */
-+ uint32_t viommu_id; /* virtual IOMMU ID of allocated object */
-+} IOMMUFDViommu;
-+
- bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp);
- void iommufd_backend_disconnect(IOMMUFDBackend *be);
-
-@@ -59,6 +69,10 @@ bool iommufd_backend_alloc_hwpt(IOMMUFDBackend *be, uint32_t dev_id,
- uint32_t data_type, uint32_t data_len,
- void *data_ptr, uint32_t *out_hwpt,
- Error **errp);
-+bool iommufd_backend_alloc_viommu(IOMMUFDBackend *be, uint32_t dev_id,
-+ uint32_t viommu_type, uint32_t hwpt_id,
-+ uint32_t *out_hwpt, Error **errp);
-+
- bool iommufd_backend_set_dirty_tracking(IOMMUFDBackend *be, uint32_t hwpt_id,
- bool start, Error **errp);
- bool iommufd_backend_get_dirty_bitmap(IOMMUFDBackend *be, uint32_t hwpt_id,
---
-2.52.0
-
diff --git a/kvm-backends-iommufd-Introduce-iommufd_backend_viommu_mm.patch b/kvm-backends-iommufd-Introduce-iommufd_backend_viommu_mm.patch
deleted file mode 100644
index 0420ed5..0000000
--- a/kvm-backends-iommufd-Introduce-iommufd_backend_viommu_mm.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From 53ba4b1a6de094a4881eba56b55c34055330a04d Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:25 +0100
-Subject: [PATCH 082/111] backends/iommufd: Introduce
- iommufd_backend_viommu_mmap
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [82/111] 699aec712a9be27abecdb2a37f14b7b8968bae49 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Conflicts: contextual conflict in backends/trace-events since
-we don't have igvm trace points
-
-Add a backend helper to mmap hardware MMIO regions exposed via iommufd for
-a vIOMMU instance. This allows user space to access HW-accelerated MMIO
-pages provided by the vIOMMU.
-
-The caller is responsible for unmapping the returned region.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-5-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit b391e41e53b5268d0943c4f2276749a9448496b3)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- backends/iommufd.c | 22 ++++++++++++++++++++++
- backends/trace-events | 1 +
- include/system/iommufd.h | 4 ++++
- 3 files changed, 27 insertions(+)
-
-diff --git a/backends/iommufd.c b/backends/iommufd.c
-index 0e11d2722a..e457173da5 100644
---- a/backends/iommufd.c
-+++ b/backends/iommufd.c
-@@ -576,6 +576,28 @@ bool iommufd_backend_alloc_hw_queue(IOMMUFDBackend *be, uint32_t viommu_id,
- return true;
- }
-
-+/*
-+ * Helper to mmap HW MMIO regions exposed via iommufd for a vIOMMU instance.
-+ * The caller is responsible for unmapping the mapped region.
-+ */
-+bool iommufd_backend_viommu_mmap(IOMMUFDBackend *be, uint32_t viommu_id,
-+ uint64_t size, off_t offset, void **out_ptr,
-+ Error **errp)
-+{
-+ g_assert(viommu_id);
-+ g_assert(out_ptr);
-+
-+ *out_ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, be->fd,
-+ offset);
-+ trace_iommufd_backend_viommu_mmap(be->fd, viommu_id, size, offset);
-+ if (*out_ptr == MAP_FAILED) {
-+ error_setg_errno(errp, errno, "IOMMUFD vIOMMU mmap failed");
-+ return false;
-+ }
-+
-+ return true;
-+}
-+
- bool host_iommu_device_iommufd_attach_hwpt(HostIOMMUDeviceIOMMUFD *hiodi,
- uint32_t hwpt_id, Error **errp)
- {
-diff --git a/backends/trace-events b/backends/trace-events
-index a88996488d..eae799c882 100644
---- a/backends/trace-events
-+++ b/backends/trace-events
-@@ -25,3 +25,4 @@ iommufd_backend_alloc_viommu(int iommufd, uint32_t dev_id, uint32_t type, uint32
- iommufd_backend_alloc_vdev(int iommufd, uint32_t dev_id, uint32_t viommu_id, uint64_t virt_id, uint32_t vdev_id, int ret) " iommufd=%d dev_id=%u viommu_id=%u virt_id=0x%"PRIx64" vdev_id=%u (%d)"
- iommufd_viommu_alloc_eventq(int iommufd, uint32_t viommu_id, uint32_t type, uint32_t veventq_id, uint32_t veventq_fd, int ret) " iommufd=%d viommu_id=%u type=%u veventq_id=%u veventq_fd=%u (%d)"
- iommufd_backend_alloc_hw_queue(int iommufd, uint32_t viommu_id, uint32_t queue_type, uint32_t index, uint64_t addr, uint64_t size, uint32_t queue_id, int ret) " iommufd=%d viommu_id=%u queue_type=%u index=%u addr=0x%"PRIx64" size=0x%"PRIx64" queue_id=%u (%d)"
-+iommufd_backend_viommu_mmap(int iommufd, uint32_t viommu_id, uint64_t size, uint64_t offset) " iommufd=%d viommu_id=%u size=0x%"PRIx64" offset=0x%"PRIx64
-diff --git a/include/system/iommufd.h b/include/system/iommufd.h
-index a538a13b80..2abb7c9605 100644
---- a/include/system/iommufd.h
-+++ b/include/system/iommufd.h
-@@ -112,6 +112,10 @@ bool iommufd_backend_alloc_hw_queue(IOMMUFDBackend *be, uint32_t viommu_id,
- uint64_t addr, uint64_t length,
- uint32_t *out_hw_queue_id, Error **errp);
-
-+bool iommufd_backend_viommu_mmap(IOMMUFDBackend *be, uint32_t viommu_id,
-+ uint64_t size, off_t offset, void **out_ptr,
-+ Error **errp);
-+
- bool iommufd_backend_set_dirty_tracking(IOMMUFDBackend *be, uint32_t hwpt_id,
- bool start, Error **errp);
- bool iommufd_backend_get_dirty_bitmap(IOMMUFDBackend *be, uint32_t hwpt_id,
---
-2.52.0
-
diff --git a/kvm-backends-iommufd-Retrieve-PASID-width-from-iommufd_b.patch b/kvm-backends-iommufd-Retrieve-PASID-width-from-iommufd_b.patch
deleted file mode 100644
index 80f815c..0000000
--- a/kvm-backends-iommufd-Retrieve-PASID-width-from-iommufd_b.patch
+++ /dev/null
@@ -1,167 +0,0 @@
-From 3a3d4951c65f26ec8215ea06a5283673bef8e499 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 040/111] backends/iommufd: Retrieve PASID width from
- iommufd_backend_get_device_info()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [40/111] e6c94449414ec82230d03c39d255e1ceff69bbea (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Conflicts: contextual conflict in hw/vfio/iommufd.c
-Add caps local variable and pass it in iommufd_backend_get_device_info()
-This is due to the fact we don't have
-68d3a2a24d7c ("Workaround for ERRATA_772415_SPR17")
-
-Retrieve PASID width from iommufd_backend_get_device_info() and store it
-in HostIOMMUDeviceCaps for later use.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Message-id: 20260126104342.253965-33-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 550beca3d7b0159681a09d63dfce19ac31509f9f)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- backends/iommufd.c | 6 +++++-
- hw/arm/smmuv3-accel.c | 3 ++-
- hw/vfio/iommufd.c | 8 ++++++--
- include/system/host_iommu_device.h | 3 +++
- include/system/iommufd.h | 3 ++-
- 5 files changed, 18 insertions(+), 5 deletions(-)
-
-diff --git a/backends/iommufd.c b/backends/iommufd.c
-index e68a2c934f..6381f9664b 100644
---- a/backends/iommufd.c
-+++ b/backends/iommufd.c
-@@ -388,7 +388,8 @@ bool iommufd_backend_get_dirty_bitmap(IOMMUFDBackend *be,
-
- bool iommufd_backend_get_device_info(IOMMUFDBackend *be, uint32_t devid,
- uint32_t *type, void *data, uint32_t len,
-- uint64_t *caps, Error **errp)
-+ uint64_t *caps, uint8_t *max_pasid_log2,
-+ Error **errp)
- {
- struct iommu_hw_info info = {
- .size = sizeof(info),
-@@ -407,6 +408,9 @@ bool iommufd_backend_get_device_info(IOMMUFDBackend *be, uint32_t devid,
- g_assert(caps);
- *caps = info.out_capabilities;
-
-+ if (max_pasid_log2) {
-+ *max_pasid_log2 = info.out_max_pasid_log2;
-+ }
- return true;
- }
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index ea420afeb7..342944da23 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -121,7 +121,8 @@ smmuv3_accel_hw_compatible(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- uint64_t caps;
-
- if (!iommufd_backend_get_device_info(idev->iommufd, idev->devid, &data_type,
-- &info, sizeof(info), &caps, errp)) {
-+ &info, sizeof(info), &caps, NULL,
-+ errp)) {
- return false;
- }
-
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index bb5775aa71..67acdfa183 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -308,6 +308,7 @@ static bool iommufd_cdev_autodomains_get(VFIODevice *vbasedev,
- VFIOContainer *bcontainer = VFIO_IOMMU(container);
- uint32_t type, flags = 0;
- uint64_t hw_caps;
-+ VendorCaps caps;
- VFIOIOASHwpt *hwpt;
- uint32_t hwpt_id;
- int ret;
-@@ -353,7 +354,8 @@ static bool iommufd_cdev_autodomains_get(VFIODevice *vbasedev,
- * instead.
- */
- if (!iommufd_backend_get_device_info(vbasedev->iommufd, vbasedev->devid,
-- &type, NULL, 0, &hw_caps, errp)) {
-+ &type, &caps, sizeof(caps), &hw_caps,
-+ NULL, errp)) {
- return false;
- }
-
-@@ -880,19 +882,21 @@ static bool hiod_iommufd_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
- HostIOMMUDeviceCaps *caps = &hiod->caps;
- VendorCaps *vendor_caps = &caps->vendor_caps;
- enum iommu_hw_info_type type;
-+ uint8_t max_pasid_log2;
- uint64_t hw_caps;
-
- hiod->agent = opaque;
-
- if (!iommufd_backend_get_device_info(vdev->iommufd, vdev->devid, &type,
- vendor_caps, sizeof(*vendor_caps),
-- &hw_caps, errp)) {
-+ &hw_caps, &max_pasid_log2, errp)) {
- return false;
- }
-
- hiod->name = g_strdup(vdev->name);
- caps->type = type;
- caps->hw_caps = hw_caps;
-+ caps->max_pasid_log2 = max_pasid_log2;
-
- idev = HOST_IOMMU_DEVICE_IOMMUFD(hiod);
- idev->iommufd = vdev->iommufd;
-diff --git a/include/system/host_iommu_device.h b/include/system/host_iommu_device.h
-index ab849a4a82..bfb2b60478 100644
---- a/include/system/host_iommu_device.h
-+++ b/include/system/host_iommu_device.h
-@@ -30,6 +30,8 @@ typedef union VendorCaps {
- * @hw_caps: host platform IOMMU capabilities (e.g. on IOMMUFD this represents
- * the @out_capabilities value returned from IOMMU_GET_HW_INFO ioctl)
- *
-+ * @max_pasid_log2: width of PASIDs supported by host IOMMU device
-+ *
- * @vendor_caps: host platform IOMMU vendor specific capabilities (e.g. on
- * IOMMUFD this represents a user-space buffer filled by kernel
- * with host IOMMU @type specific hardware information data)
-@@ -37,6 +39,7 @@ typedef union VendorCaps {
- typedef struct HostIOMMUDeviceCaps {
- uint32_t type;
- uint64_t hw_caps;
-+ uint8_t max_pasid_log2;
- VendorCaps vendor_caps;
- } HostIOMMUDeviceCaps;
- #endif
-diff --git a/include/system/iommufd.h b/include/system/iommufd.h
-index 41e216c677..aa78bf1e1d 100644
---- a/include/system/iommufd.h
-+++ b/include/system/iommufd.h
-@@ -71,7 +71,8 @@ int iommufd_backend_unmap_dma(IOMMUFDBackend *be, uint32_t ioas_id,
- hwaddr iova, uint64_t size);
- bool iommufd_backend_get_device_info(IOMMUFDBackend *be, uint32_t devid,
- uint32_t *type, void *data, uint32_t len,
-- uint64_t *caps, Error **errp);
-+ uint64_t *caps, uint8_t *max_pasid_log2,
-+ Error **errp);
- bool iommufd_backend_alloc_hwpt(IOMMUFDBackend *be, uint32_t dev_id,
- uint32_t pt_id, uint32_t flags,
- uint32_t data_type, uint32_t data_len,
---
-2.52.0
-
diff --git a/kvm-backends-iommufd-Update-iommufd_backend_alloc_viommu.patch b/kvm-backends-iommufd-Update-iommufd_backend_alloc_viommu.patch
deleted file mode 100644
index bef4305..0000000
--- a/kvm-backends-iommufd-Update-iommufd_backend_alloc_viommu.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-From 7916e88667364d8845de78f481c2f611e5cc0eb0 Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:23 +0100
-Subject: [PATCH 080/111] backends/iommufd: Update iommufd_backend_alloc_viommu
- to allow user ptr
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [80/111] 6068eed2afc6aa74d12fec8e2bf154f86dfd8671 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-The updated IOMMUFD VIOMMU_ALLOC uAPI allows userspace to provide a data
-buffer when creating a vIOMMU (e.g. for Tegra241 CMDQV). Extend
-iommufd_backend_alloc_viommu() to pass a user pointer and size to the
-kernel.
-
-Update the caller accordingly.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-3-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit d2f3b3156dbdcdf3b2136e3450014317bdd9f864)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- backends/iommufd.c | 4 ++++
- backends/trace-events | 2 +-
- hw/arm/smmuv3-accel.c | 4 ++--
- include/system/iommufd.h | 1 +
- 4 files changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/backends/iommufd.c b/backends/iommufd.c
-index b328f89699..621b6115cb 100644
---- a/backends/iommufd.c
-+++ b/backends/iommufd.c
-@@ -459,6 +459,7 @@ bool iommufd_backend_invalidate_cache(IOMMUFDBackend *be, uint32_t id,
-
- bool iommufd_backend_alloc_viommu(IOMMUFDBackend *be, uint32_t dev_id,
- uint32_t viommu_type, uint32_t hwpt_id,
-+ void *data_ptr, uint32_t data_len,
- uint32_t *out_viommu_id, Error **errp)
- {
- int ret;
-@@ -467,11 +468,14 @@ bool iommufd_backend_alloc_viommu(IOMMUFDBackend *be, uint32_t dev_id,
- .type = viommu_type,
- .dev_id = dev_id,
- .hwpt_id = hwpt_id,
-+ .data_len = data_len,
-+ .data_uptr = (uintptr_t)data_ptr,
- };
-
- ret = ioctl(be->fd, IOMMU_VIOMMU_ALLOC, &alloc_viommu);
-
- trace_iommufd_backend_alloc_viommu(be->fd, dev_id, viommu_type, hwpt_id,
-+ (uintptr_t)data_ptr, data_len,
- alloc_viommu.out_viommu_id, ret);
- if (ret) {
- error_setg_errno(errp, errno, "IOMMU_VIOMMU_ALLOC failed");
-diff --git a/backends/trace-events b/backends/trace-events
-index 5afa7a40be..934cdd8107 100644
---- a/backends/trace-events
-+++ b/backends/trace-events
-@@ -21,6 +21,6 @@ iommufd_backend_free_id(int iommufd, uint32_t id, int ret) " iommufd=%d id=%d (%
- iommufd_backend_set_dirty(int iommufd, uint32_t hwpt_id, bool start, int ret) " iommufd=%d hwpt=%u enable=%d (%d)"
- iommufd_backend_get_dirty_bitmap(int iommufd, uint32_t hwpt_id, uint64_t iova, uint64_t size, uint64_t page_size, int ret) " iommufd=%d hwpt=%u iova=0x%"PRIx64" size=0x%"PRIx64" page_size=0x%"PRIx64" (%d)"
- iommufd_backend_invalidate_cache(int iommufd, uint32_t id, uint32_t data_type, uint32_t entry_len, uint32_t entry_num, uint32_t done_num, uint64_t data_ptr, int ret) " iommufd=%d id=%u data_type=%u entry_len=%u entry_num=%u done_num=%u data_ptr=0x%"PRIx64" (%d)"
--iommufd_backend_alloc_viommu(int iommufd, uint32_t dev_id, uint32_t type, uint32_t hwpt_id, uint32_t viommu_id, int ret) " iommufd=%d type=%u dev_id=%u hwpt_id=%u viommu_id=%u (%d)"
-+iommufd_backend_alloc_viommu(int iommufd, uint32_t dev_id, uint32_t type, uint32_t hwpt_id, uint64_t data_ptr, uint32_t data_len, uint32_t viommu_id, int ret) " iommufd=%d type=%u dev_id=%u hwpt_id=%u data_ptr=0x%"PRIx64" data_len=0x%x viommu_id=%u (%d)"
- iommufd_backend_alloc_vdev(int iommufd, uint32_t dev_id, uint32_t viommu_id, uint64_t virt_id, uint32_t vdev_id, int ret) " iommufd=%d dev_id=%u viommu_id=%u virt_id=0x%"PRIx64" vdev_id=%u (%d)"
- iommufd_viommu_alloc_eventq(int iommufd, uint32_t viommu_id, uint32_t type, uint32_t veventq_id, uint32_t veventq_fd, int ret) " iommufd=%d viommu_id=%u type=%u veventq_id=%u veventq_fd=%u (%d)"
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 163d3e7279..4cef487679 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -582,8 +582,8 @@ smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *hiodi,
- IOMMUFDViommu *viommu;
-
- if (!iommufd_backend_alloc_viommu(hiodi->iommufd, hiodi->devid,
-- IOMMU_VIOMMU_TYPE_ARM_SMMUV3,
-- s2_hwpt_id, &viommu_id, errp)) {
-+ IOMMU_VIOMMU_TYPE_ARM_SMMUV3, s2_hwpt_id,
-+ NULL, 0, &viommu_id, errp)) {
- return false;
- }
-
-diff --git a/include/system/iommufd.h b/include/system/iommufd.h
-index e45f4a5e87..783d125ee4 100644
---- a/include/system/iommufd.h
-+++ b/include/system/iommufd.h
-@@ -89,6 +89,7 @@ bool iommufd_backend_alloc_hwpt(IOMMUFDBackend *be, uint32_t dev_id,
- Error **errp);
- bool iommufd_backend_alloc_viommu(IOMMUFDBackend *be, uint32_t dev_id,
- uint32_t viommu_type, uint32_t hwpt_id,
-+ void *data_ptr, uint32_t data_len,
- uint32_t *out_hwpt, Error **errp);
-
- bool iommufd_backend_alloc_vdev(IOMMUFDBackend *be, uint32_t dev_id,
---
-2.52.0
-
diff --git a/kvm-backends-iommufd-Update-iommufd_backend_get_device_i.patch b/kvm-backends-iommufd-Update-iommufd_backend_get_device_i.patch
deleted file mode 100644
index 3333b16..0000000
--- a/kvm-backends-iommufd-Update-iommufd_backend_get_device_i.patch
+++ /dev/null
@@ -1,106 +0,0 @@
-From 22efc23db4a5d1773170bc1f898a55d979bd0b00 Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:22 +0100
-Subject: [PATCH 078/111] backends/iommufd: Update
- iommufd_backend_get_device_info
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [78/111] 3ca7bb7a3544994a178876f3b15738112945a525 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-The updated IOMMUFD uAPI introduces the ability for userspace to request
-a specific hardware info data type via IOMMU_GET_HW_INFO. Update
-iommufd_backend_get_device_info() to set IOMMU_HW_INFO_FLAG_INPUT_TYPE
-when a non-zero type is supplied, and adjust all callers to pass a type
-value explicitly initialised to zero (IOMMU_HW_INFO_TYPE_DEFAULT) when
-no specific type is requested.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-2-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 3e79b45e0478de367745aa1f5d3b0a4573c69ab0)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- backends/iommufd.c | 7 +++++++
- hw/arm/smmuv3-accel.c | 2 +-
- hw/vfio/iommufd.c | 4 ++--
- 3 files changed, 10 insertions(+), 3 deletions(-)
-
-diff --git a/backends/iommufd.c b/backends/iommufd.c
-index 5b919e4be9..416e193751 100644
---- a/backends/iommufd.c
-+++ b/backends/iommufd.c
-@@ -386,16 +386,23 @@ bool iommufd_backend_get_dirty_bitmap(IOMMUFDBackend *be,
- return true;
- }
-
-+/*
-+ * @type can carry a desired HW info type defined in the uapi headers. If caller
-+ * doesn't have one, indicating it wants the default type, then @type should be
-+ * zeroed (i.e. IOMMU_HW_INFO_TYPE_DEFAULT).
-+ */
- bool iommufd_backend_get_device_info(IOMMUFDBackend *be, uint32_t devid,
- uint32_t *type, void *data, uint32_t len,
- uint64_t *caps, uint8_t *max_pasid_log2,
- Error **errp)
- {
- struct iommu_hw_info info = {
-+ .flags = (*type) ? IOMMU_HW_INFO_FLAG_INPUT_TYPE : 0,
- .size = sizeof(info),
- .dev_id = devid,
- .data_len = len,
- .data_uptr = (uintptr_t)data,
-+ .in_data_type = *type,
- };
-
- if (ioctl(be->fd, IOMMU_GET_HW_INFO, &info)) {
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 0b01848292..f97129388f 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -176,7 +176,7 @@ smmuv3_accel_hw_compatible(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- Error **errp)
- {
- struct iommu_hw_info_arm_smmuv3 info;
-- uint32_t data_type;
-+ uint32_t data_type = IOMMU_HW_INFO_TYPE_DEFAULT;
- uint64_t caps;
-
- if (!iommufd_backend_get_device_info(idev->iommufd, idev->devid, &data_type,
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index 7e0287f814..93703a0036 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -307,7 +307,7 @@ static bool iommufd_cdev_autodomains_get(VFIODevice *vbasedev,
- IOMMUFDBackend *iommufd = vbasedev->iommufd;
- VFIOContainer *bcontainer = VFIO_IOMMU(container);
- bool viommu_nesting, viommu_nesting_dirty;
-- uint32_t type, flags = 0;
-+ uint32_t type = IOMMU_HW_INFO_TYPE_DEFAULT, flags = 0;
- uint64_t hw_caps;
- VendorCaps caps;
- VFIOIOASHwpt *hwpt;
-@@ -897,7 +897,7 @@ static bool hiod_iommufd_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
- HostIOMMUDeviceIOMMUFD *idev;
- HostIOMMUDeviceCaps *caps = &hiod->caps;
- VendorCaps *vendor_caps = &caps->vendor_caps;
-- enum iommu_hw_info_type type;
-+ uint32_t type = IOMMU_HW_INFO_TYPE_DEFAULT;
- uint8_t max_pasid_log2;
- uint64_t hw_caps;
-
---
-2.52.0
-
diff --git a/kvm-bios-tables-test-Allow-for-smmuv3-test-data.patch b/kvm-bios-tables-test-Allow-for-smmuv3-test-data.patch
deleted file mode 100644
index 72136a7..0000000
--- a/kvm-bios-tables-test-Allow-for-smmuv3-test-data.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From b4eeed1e8633df76598de0fe6ca5df4be359222c Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 29 Aug 2025 09:25:31 +0100
-Subject: [PATCH 13/16] bios-tables-test: Allow for smmuv3 test data.
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 423: hw/arm/virt: Add support for user creatable SMMUv3 device
-RH-Jira: RHEL-73800
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Donald Dutile <None>
-RH-Commit: [9/11] cf98e2e7589b794775c1d9c4f564e3cd536b886e (eauger1/centos-qemu-kvm)
-
-The tests to be added exercise both legacy(iommu=smmuv3) and new
--device arm-smmuv3,.. cases.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Donald Dutile <ddutile@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Message-id: 20250829082543.7680-10-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit c69520c13d6ea45a69a7a49361806fa05b19046d)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev | 0
- tests/data/acpi/aarch64/virt/DSDT.smmuv3-legacy | 0
- tests/data/acpi/aarch64/virt/IORT.smmuv3-dev | 0
- tests/data/acpi/aarch64/virt/IORT.smmuv3-legacy | 0
- tests/qtest/bios-tables-test-allowed-diff.h | 4 ++++
- 5 files changed, 4 insertions(+)
- create mode 100644 tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev
- create mode 100644 tests/data/acpi/aarch64/virt/DSDT.smmuv3-legacy
- create mode 100644 tests/data/acpi/aarch64/virt/IORT.smmuv3-dev
- create mode 100644 tests/data/acpi/aarch64/virt/IORT.smmuv3-legacy
-
-diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
-index dfb8523c8b..2e3e3ccdce 100644
---- a/tests/qtest/bios-tables-test-allowed-diff.h
-+++ b/tests/qtest/bios-tables-test-allowed-diff.h
-@@ -1 +1,5 @@
- /* List of comma-separated changed AML files to ignore */
-+"tests/data/acpi/aarch64/virt/DSDT.smmuv3-legacy",
-+"tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev",
-+"tests/data/acpi/aarch64/virt/IORT.smmuv3-legacy",
-+"tests/data/acpi/aarch64/virt/IORT.smmuv3-dev",
---
-2.47.3
-
diff --git a/kvm-blkdebug-Add-delay-ns-option.patch b/kvm-blkdebug-Add-delay-ns-option.patch
deleted file mode 100644
index aa9a1cc..0000000
--- a/kvm-blkdebug-Add-delay-ns-option.patch
+++ /dev/null
@@ -1,121 +0,0 @@
-From 6386e658adc798b2af7400a53941523d21dd581d Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Tue, 21 Apr 2026 18:11:26 +0200
-Subject: [PATCH 01/52] blkdebug: Add 'delay-ns' option
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 503: ide: Fix deadlock between TRIM and drain
-RH-Jira: RHEL-121686
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [1/7] b6ade079279909f3b38a03fc710c1f0ebd475915 (kmwolf/centos-qemu-kvm)
-
-Sometimes reproducing a problem for debugging involves slow I/O, so
-let's add something to blkdebug to make I/O slow when we need it. This
-can be used either together with an error so that the request fails
-after the delay, or with errno=0, which allows the request to succeed
-after the delay.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260421161132.99878-2-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit d5e4090177ad382e01084a1594a1a60a69f4c1cd)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/blkdebug.c | 15 ++++++++++++++-
- qapi/block-core.json | 4 ++++
- 2 files changed, 18 insertions(+), 1 deletion(-)
-
-diff --git a/block/blkdebug.c b/block/blkdebug.c
-index c54aee0c84..8954fc2977 100644
---- a/block/blkdebug.c
-+++ b/block/blkdebug.c
-@@ -95,6 +95,7 @@ typedef struct BlkdebugRule {
- int immediately;
- int once;
- int64_t offset;
-+ int64_t delay_ns;
- } inject;
- struct {
- int new_state;
-@@ -144,6 +145,10 @@ static QemuOptsList inject_error_opts = {
- .name = "immediately",
- .type = QEMU_OPT_BOOL,
- },
-+ {
-+ .name = "delay-ns",
-+ .type = QEMU_OPT_NUMBER,
-+ },
- { /* end of list */ }
- },
- };
-@@ -216,6 +221,8 @@ static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
- rule->options.inject.once = qemu_opt_get_bool(opts, "once", 0);
- rule->options.inject.immediately =
- qemu_opt_get_bool(opts, "immediately", 0);
-+ rule->options.inject.delay_ns =
-+ qemu_opt_get_number(opts, "delay-ns", 0);
- sector = qemu_opt_get_number(opts, "sector", -1);
- rule->options.inject.offset =
- sector == -1 ? -1 : sector * BDRV_SECTOR_SIZE;
-@@ -594,6 +601,7 @@ static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset,
- BlkdebugRule *rule = NULL;
- int error;
- bool immediately;
-+ int64_t delay_ns;
-
- qemu_mutex_lock(&s->lock);
- QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {
-@@ -608,13 +616,14 @@ static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset,
- }
- }
-
-- if (!rule || !rule->options.inject.error) {
-+ if (!rule) {
- qemu_mutex_unlock(&s->lock);
- return 0;
- }
-
- immediately = rule->options.inject.immediately;
- error = rule->options.inject.error;
-+ delay_ns = rule->options.inject.delay_ns;
-
- if (rule->options.inject.once) {
- QSIMPLEQ_REMOVE(&s->active_rules, rule, BlkdebugRule, active_next);
-@@ -622,6 +631,10 @@ static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset,
- }
-
- qemu_mutex_unlock(&s->lock);
-+
-+ if (delay_ns) {
-+ qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, delay_ns);
-+ }
- if (!immediately) {
- aio_co_schedule(qemu_get_current_aio_context(), qemu_coroutine_self());
- qemu_coroutine_yield();
-diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 0236936139..6cf8c1b9c8 100644
---- a/qapi/block-core.json
-+++ b/qapi/block-core.json
-@@ -3909,6 +3909,9 @@
- #
- # @errno: error identifier (errno) to be returned; defaults to EIO
- #
-+# @delay-ns: request delay before completion in nanoseconds
-+# (default: 0, since: 11.1)
-+#
- # @sector: specifies the sector index which has to be affected in
- # order to actually trigger the event; defaults to "any sector"
- #
-@@ -3924,6 +3927,7 @@
- '*state': 'int',
- '*iotype': 'BlkdebugIOType',
- '*errno': 'int',
-+ '*delay-ns': 'int',
- '*sector': 'int',
- '*once': 'bool',
- '*immediately': 'bool' } }
---
-2.52.0
-
diff --git a/kvm-block-Add-blk_co_start-end_request-and-BDRV_REQ_NO_Q.patch b/kvm-block-Add-blk_co_start-end_request-and-BDRV_REQ_NO_Q.patch
deleted file mode 100644
index 86647e0..0000000
--- a/kvm-block-Add-blk_co_start-end_request-and-BDRV_REQ_NO_Q.patch
+++ /dev/null
@@ -1,203 +0,0 @@
-From c452d113b1d71de097e3b87f7d40d6865731b275 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Tue, 21 Apr 2026 18:11:27 +0200
-Subject: [PATCH 02/52] block: Add blk_co_start/end_request() and
- BDRV_REQ_NO_QUEUE
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 503: ide: Fix deadlock between TRIM and drain
-RH-Jira: RHEL-121686
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [2/7] 4053fabc93d73e2c7143763fa2676c7be7ad249d (kmwolf/centos-qemu-kvm)
-
-If a device uses blk_inc/dec_in_flight() in order to build macro
-operations that involve multiple requests for the block layer and that
-need to be completed as a unit before the BlockBackend can be considered
-drained, it sets the stage for a deadlock: When a drain is requested,
-the inner request at the BlockBackend level will be queued in
-blk_wait_while_drained() and wait until the drained section ends, but at
-the same time, drain_begin can only return if the whole macro operation
-at the device level has completed.
-
-Introduce a new interface to allow implementing the logic correctly:
-Instead of queueing individual requests, blk_co_start_request() calls
-blk_wait_while_drained() once at the beginning. The individual requests
-must then set BDRV_REQ_NO_QUEUE to avoid being queued and running into
-the deadlock; being wrapped in blk_co_start/end_request() makes sure
-that drain_begin waits for them and they don't sneak in when the
-BlockBackend is supposed to already be quiescent.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260421161132.99878-3-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 34a67637767d3ed1ac813c44effe827bbfba5996)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/block-backend.c | 38 +++++++++++++++++++++++--------
- include/block/block-common.h | 11 ++++++++-
- include/system/block-backend-io.h | 2 ++
- 3 files changed, 41 insertions(+), 10 deletions(-)
-
-diff --git a/block/block-backend.c b/block/block-backend.c
-index d6df369188..a0f4c841da 100644
---- a/block/block-backend.c
-+++ b/block/block-backend.c
-@@ -82,6 +82,7 @@ struct BlockBackend {
- QemuMutex queued_requests_lock; /* protects queued_requests */
- CoQueue queued_requests;
- bool disable_request_queuing; /* atomic */
-+ int start_request_count; /* atomic */
-
- VMChangeStateEntry *vmsh;
- bool force_allow_inactivate;
-@@ -1306,10 +1307,16 @@ bool blk_in_drain(BlockBackend *blk)
- }
-
- /* To be called between exactly one pair of blk_inc/dec_in_flight() */
--static void coroutine_fn blk_wait_while_drained(BlockBackend *blk)
-+static void coroutine_fn blk_wait_while_drained(BlockBackend *blk,
-+ BdrvRequestFlags flags)
- {
- assert(blk->in_flight > 0);
-
-+ if (flags & BDRV_REQ_NO_QUEUE) {
-+ assert(qatomic_read(&blk->start_request_count));
-+ return;
-+ }
-+
- if (qatomic_read(&blk->quiesce_counter) &&
- !qatomic_read(&blk->disable_request_queuing)) {
- /*
-@@ -1335,7 +1342,7 @@ blk_co_do_preadv_part(BlockBackend *blk, int64_t offset, int64_t bytes,
- BlockDriverState *bs;
- IO_CODE();
-
-- blk_wait_while_drained(blk);
-+ blk_wait_while_drained(blk, flags);
- GRAPH_RDLOCK_GUARD();
-
- /* Call blk_bs() only after waiting, the graph may have changed */
-@@ -1410,7 +1417,7 @@ blk_co_do_pwritev_part(BlockBackend *blk, int64_t offset, int64_t bytes,
- BlockDriverState *bs;
- IO_CODE();
-
-- blk_wait_while_drained(blk);
-+ blk_wait_while_drained(blk, flags);
- GRAPH_RDLOCK_GUARD();
-
- /* Call blk_bs() only after waiting, the graph may have changed */
-@@ -1523,6 +1530,19 @@ void blk_dec_in_flight(BlockBackend *blk)
- aio_wait_kick();
- }
-
-+void coroutine_fn blk_co_start_request(BlockBackend *blk)
-+{
-+ blk_inc_in_flight(blk);
-+ blk_wait_while_drained(blk, 0);
-+ qatomic_inc(&blk->start_request_count);
-+}
-+
-+void blk_end_request(BlockBackend *blk)
-+{
-+ qatomic_dec(&blk->start_request_count);
-+ blk_dec_in_flight(blk);
-+}
-+
- static void error_callback_bh(void *opaque)
- {
- struct BlockBackendAIOCB *acb = opaque;
-@@ -1741,7 +1761,7 @@ blk_co_do_ioctl(BlockBackend *blk, unsigned long int req, void *buf)
- {
- IO_CODE();
-
-- blk_wait_while_drained(blk);
-+ blk_wait_while_drained(blk, 0);
- GRAPH_RDLOCK_GUARD();
-
- if (!blk_co_is_available(blk)) {
-@@ -1788,7 +1808,7 @@ blk_co_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes)
- int ret;
- IO_CODE();
-
-- blk_wait_while_drained(blk);
-+ blk_wait_while_drained(blk, 0);
- GRAPH_RDLOCK_GUARD();
-
- ret = blk_check_byte_request(blk, offset, bytes);
-@@ -1834,7 +1854,7 @@ int coroutine_fn blk_co_pdiscard(BlockBackend *blk, int64_t offset,
- static int coroutine_fn blk_co_do_flush(BlockBackend *blk)
- {
- IO_CODE();
-- blk_wait_while_drained(blk);
-+ blk_wait_while_drained(blk, 0);
- GRAPH_RDLOCK_GUARD();
-
- if (!blk_co_is_available(blk)) {
-@@ -2009,7 +2029,7 @@ int coroutine_fn blk_co_zone_report(BlockBackend *blk, int64_t offset,
- IO_CODE();
-
- blk_inc_in_flight(blk); /* increase before waiting */
-- blk_wait_while_drained(blk);
-+ blk_wait_while_drained(blk, 0);
- GRAPH_RDLOCK_GUARD();
- if (!blk_is_available(blk)) {
- blk_dec_in_flight(blk);
-@@ -2034,7 +2054,7 @@ int coroutine_fn blk_co_zone_mgmt(BlockBackend *blk, BlockZoneOp op,
- IO_CODE();
-
- blk_inc_in_flight(blk);
-- blk_wait_while_drained(blk);
-+ blk_wait_while_drained(blk, 0);
- GRAPH_RDLOCK_GUARD();
-
- ret = blk_check_byte_request(blk, offset, len);
-@@ -2058,7 +2078,7 @@ int coroutine_fn blk_co_zone_append(BlockBackend *blk, int64_t *offset,
- IO_CODE();
-
- blk_inc_in_flight(blk);
-- blk_wait_while_drained(blk);
-+ blk_wait_while_drained(blk, flags);
- GRAPH_RDLOCK_GUARD();
- if (!blk_is_available(blk)) {
- blk_dec_in_flight(blk);
-diff --git a/include/block/block-common.h b/include/block/block-common.h
-index c8c626daea..895ea17541 100644
---- a/include/block/block-common.h
-+++ b/include/block/block-common.h
-@@ -215,8 +215,17 @@ typedef enum {
- */
- BDRV_REQ_NO_WAIT = 0x400,
-
-+ /*
-+ * Used between blk_co_start_request() and blk_end_request() to avoid
-+ * that the request waits in a drained BlockBackend until the drained
-+ * section ends. Waiting would cause a deadlock because drain waits for
-+ * blk_end_request() to be called, but the request never completes
-+ * because it waits for the drain to end.
-+ */
-+ BDRV_REQ_NO_QUEUE = 0x800,
-+
- /* Mask of valid flags */
-- BDRV_REQ_MASK = 0x7ff,
-+ BDRV_REQ_MASK = 0xfff,
- } BdrvRequestFlags;
-
- #define BDRV_O_NO_SHARE 0x0001 /* don't share permissions */
-diff --git a/include/system/block-backend-io.h b/include/system/block-backend-io.h
-index ba8dfcc7d0..59841e04a8 100644
---- a/include/system/block-backend-io.h
-+++ b/include/system/block-backend-io.h
-@@ -71,6 +71,8 @@ BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned long int req, void *buf,
-
- void blk_inc_in_flight(BlockBackend *blk);
- void blk_dec_in_flight(BlockBackend *blk);
-+void coroutine_fn blk_co_start_request(BlockBackend *blk);
-+void blk_end_request(BlockBackend *blk);
-
- bool coroutine_fn GRAPH_RDLOCK blk_co_is_inserted(BlockBackend *blk);
- bool co_wrapper_mixed_bdrv_rdlock blk_is_inserted(BlockBackend *blk);
---
-2.52.0
-
diff --git a/kvm-block-Add-flags-parameter-to-blk_-_pdiscard.patch b/kvm-block-Add-flags-parameter-to-blk_-_pdiscard.patch
deleted file mode 100644
index f69bc48..0000000
--- a/kvm-block-Add-flags-parameter-to-blk_-_pdiscard.patch
+++ /dev/null
@@ -1,174 +0,0 @@
-From 9a2d6f97d94f24ad7bfc83aea06d3324cbd46424 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Tue, 21 Apr 2026 18:11:28 +0200
-Subject: [PATCH 03/52] block: Add flags parameter to blk_*_pdiscard()
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 503: ide: Fix deadlock between TRIM and drain
-RH-Jira: RHEL-121686
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [3/7] 40ce25b1169cccc9c655eeb59827f8bf7daf75f4 (kmwolf/centos-qemu-kvm)
-
-All existing callers pass 0, but we need a way to pass BDRV_REQ_NO_QUEUE
-for discard requests.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260421161132.99878-4-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 53074ba0330ae8831abbae2521c012e1d9072ed3)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/block-backend.c | 11 ++++++-----
- block/export/virtio-blk-handler.c | 2 +-
- block/mirror.c | 4 ++--
- include/system/block-backend-io.h | 4 ++--
- nbd/server.c | 2 +-
- qemu-io-cmds.c | 2 +-
- tests/unit/test-block-iothread.c | 4 ++--
- 7 files changed, 15 insertions(+), 14 deletions(-)
-
-diff --git a/block/block-backend.c b/block/block-backend.c
-index a0f4c841da..d97b26b743 100644
---- a/block/block-backend.c
-+++ b/block/block-backend.c
-@@ -1803,12 +1803,13 @@ BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned long int req, void *buf,
-
- /* To be called between exactly one pair of blk_inc/dec_in_flight() */
- static int coroutine_fn
--blk_co_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes)
-+blk_co_do_pdiscard(BlockBackend *blk, int64_t offset, int64_t bytes,
-+ BdrvRequestFlags flags)
- {
- int ret;
- IO_CODE();
-
-- blk_wait_while_drained(blk, 0);
-+ blk_wait_while_drained(blk, flags);
- GRAPH_RDLOCK_GUARD();
-
- ret = blk_check_byte_request(blk, offset, bytes);
-@@ -1824,7 +1825,7 @@ static void coroutine_fn blk_aio_pdiscard_entry(void *opaque)
- BlkAioEmAIOCB *acb = opaque;
- BlkRwCo *rwco = &acb->rwco;
-
-- rwco->ret = blk_co_do_pdiscard(rwco->blk, rwco->offset, acb->bytes);
-+ rwco->ret = blk_co_do_pdiscard(rwco->blk, rwco->offset, acb->bytes, 0);
- blk_aio_complete(acb);
- }
-
-@@ -1838,13 +1839,13 @@ BlockAIOCB *blk_aio_pdiscard(BlockBackend *blk,
- }
-
- int coroutine_fn blk_co_pdiscard(BlockBackend *blk, int64_t offset,
-- int64_t bytes)
-+ int64_t bytes, BdrvRequestFlags flags)
- {
- int ret;
- IO_OR_GS_CODE();
-
- blk_inc_in_flight(blk);
-- ret = blk_co_do_pdiscard(blk, offset, bytes);
-+ ret = blk_co_do_pdiscard(blk, offset, bytes, flags);
- blk_dec_in_flight(blk);
-
- return ret;
-diff --git a/block/export/virtio-blk-handler.c b/block/export/virtio-blk-handler.c
-index bc1cec6757..b82baae553 100644
---- a/block/export/virtio-blk-handler.c
-+++ b/block/export/virtio-blk-handler.c
-@@ -121,7 +121,7 @@ virtio_blk_discard_write_zeroes(VirtioBlkHandler *handler, struct iovec *iov,
- }
-
- if (blk_co_pdiscard(blk, sector << VIRTIO_BLK_SECTOR_BITS,
-- bytes) == 0) {
-+ bytes, 0) == 0) {
- return VIRTIO_BLK_S_OK;
- }
- }
-diff --git a/block/mirror.c b/block/mirror.c
-index f01be99b55..c87f1e205b 100644
---- a/block/mirror.c
-+++ b/block/mirror.c
-@@ -454,7 +454,7 @@ static void coroutine_fn mirror_co_discard(void *opaque)
- *op->bytes_handled = op->bytes;
- op->is_in_flight = true;
-
-- ret = blk_co_pdiscard(op->s->target, op->offset, op->bytes);
-+ ret = blk_co_pdiscard(op->s->target, op->offset, op->bytes, 0);
- mirror_write_complete(op, ret);
- }
-
-@@ -1527,7 +1527,7 @@ do_sync_target_write(MirrorBlockJob *job, MirrorMethod method,
- zero_bitmap_end - zero_bitmap_offset);
- }
- assert(!qiov);
-- ret = blk_co_pdiscard(job->target, offset, bytes);
-+ ret = blk_co_pdiscard(job->target, offset, bytes, 0);
- break;
-
- default:
-diff --git a/include/system/block-backend-io.h b/include/system/block-backend-io.h
-index 59841e04a8..91c48299b7 100644
---- a/include/system/block-backend-io.h
-+++ b/include/system/block-backend-io.h
-@@ -217,9 +217,9 @@ int co_wrapper_mixed blk_zone_append(BlockBackend *blk, int64_t *offset,
- BdrvRequestFlags flags);
-
- int co_wrapper_mixed blk_pdiscard(BlockBackend *blk, int64_t offset,
-- int64_t bytes);
-+ int64_t bytes, BdrvRequestFlags flags);
- int coroutine_fn blk_co_pdiscard(BlockBackend *blk, int64_t offset,
-- int64_t bytes);
-+ int64_t bytes, BdrvRequestFlags flags);
-
- int co_wrapper_mixed blk_flush(BlockBackend *blk);
- int coroutine_fn blk_co_flush(BlockBackend *blk);
-diff --git a/nbd/server.c b/nbd/server.c
-index acec0487a8..bd103a8840 100644
---- a/nbd/server.c
-+++ b/nbd/server.c
-@@ -2984,7 +2984,7 @@ static coroutine_fn int nbd_handle_request(NBDClient *client,
- "flush failed", errp);
-
- case NBD_CMD_TRIM:
-- ret = blk_co_pdiscard(exp->common.blk, request->from, request->len);
-+ ret = blk_co_pdiscard(exp->common.blk, request->from, request->len, 0);
- if (ret >= 0 && request->flags & NBD_CMD_FLAG_FUA) {
- ret = blk_co_flush(exp->common.blk);
- }
-diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
-index 13e0330162..f6d077908f 100644
---- a/qemu-io-cmds.c
-+++ b/qemu-io-cmds.c
-@@ -2201,7 +2201,7 @@ static int discard_f(BlockBackend *blk, int argc, char **argv)
- }
-
- clock_gettime(CLOCK_MONOTONIC, &t1);
-- ret = blk_pdiscard(blk, offset, bytes);
-+ ret = blk_pdiscard(blk, offset, bytes, 0);
- clock_gettime(CLOCK_MONOTONIC, &t2);
-
- if (ret < 0) {
-diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c
-index e26b3be593..5273ff235a 100644
---- a/tests/unit/test-block-iothread.c
-+++ b/tests/unit/test-block-iothread.c
-@@ -270,11 +270,11 @@ static void test_sync_op_blk_pdiscard(BlockBackend *blk)
- int ret;
-
- /* Early success: UNMAP not supported */
-- ret = blk_pdiscard(blk, 0, 512);
-+ ret = blk_pdiscard(blk, 0, 512, 0);
- g_assert_cmpint(ret, ==, 0);
-
- /* Early error: Negative offset */
-- ret = blk_pdiscard(blk, -2, 512);
-+ ret = blk_pdiscard(blk, -2, 512, 0);
- g_assert_cmpint(ret, ==, -EIO);
- }
-
---
-2.52.0
-
diff --git a/kvm-block-Add-more-defaults-to-DEFAULT_BLOCK_CONF.patch b/kvm-block-Add-more-defaults-to-DEFAULT_BLOCK_CONF.patch
deleted file mode 100644
index 7cf51a8..0000000
--- a/kvm-block-Add-more-defaults-to-DEFAULT_BLOCK_CONF.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 748bbe57c3467eae94de533fb4099e89b8f52cc9 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Fri, 10 Apr 2026 17:23:14 +0200
-Subject: [PATCH 43/52] block: Add more defaults to DEFAULT_BLOCK_CONF
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [36/45] 47d0e6be200b5f5a481d43a1304c3e0f5ce6b973 (kmwolf/centos-qemu-kvm)
-
-discard_granularity was missing from this, which means that SCSI disks
-created with -drive if=scsi would default to 0 (i.e. disabling discards)
-instead of -1, which makes scsi-hd automatically pick a granularity and
-is the default of the corresponding qdev property for -device scsi-hd.
-
-This was broken in QEMU 9.0 with commit 3089637.
-
-Also set other fields whose default isn't an obvious 0. These are not
-actual bug fixes because ON_OFF_AUTO_AUTO in fact happens to be 0, but
-it's better not to rely on the order of enums.
-
-Cc: qemu-stable@nongnu.org
-Fixes: 308963746169 ('scsi: Don't ignore most usb-storage properties')
-Reported-by: Lexi Winter <ivy@FreeBSD.org>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260410152314.86412-3-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit f27aea1896338f4dd085a0e2cb2ab3797c5fe3e9)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- include/hw/block/block.h | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/include/hw/block/block.h b/include/hw/block/block.h
-index 7da643faff..9225e75925 100644
---- a/include/hw/block/block.h
-+++ b/include/hw/block/block.h
-@@ -53,7 +53,12 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
-
- #define DEFAULT_BLOCK_CONF (BlockConf) { \
- .bootindex = -1, \
-+ .backend_defaults = ON_OFF_AUTO_AUTO, \
-+ .discard_granularity = -1, \
-+ .wce = ON_OFF_AUTO_AUTO, \
- .share_rw = false, \
-+ .account_invalid = ON_OFF_AUTO_AUTO, \
-+ .account_failed = ON_OFF_AUTO_AUTO, \
- .rerror = BLOCKDEV_ON_ERROR_AUTO, \
- .werror = BLOCKDEV_ON_ERROR_AUTO, \
- }
---
-2.52.0
-
diff --git a/kvm-block-Create-DEFAULT_BLOCK_CONF-macro.patch b/kvm-block-Create-DEFAULT_BLOCK_CONF-macro.patch
deleted file mode 100644
index 5bdab59..0000000
--- a/kvm-block-Create-DEFAULT_BLOCK_CONF-macro.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From d3c16be7233df4e4103cb048f392d4cb1ffa6e53 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Fri, 10 Apr 2026 17:23:13 +0200
-Subject: [PATCH 42/52] block: Create DEFAULT_BLOCK_CONF macro
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [35/45] 8794cac427709a1462918bad08b4f135911b3c1b (kmwolf/centos-qemu-kvm)
-
-The property default values from include/hw/block/block.h were
-duplicated in scsi_bus_legacy_handle_cmdline(), allowing them to go out
-of sync easily. There doesn't seem a good way to avoid the duplication,
-but moving them next to each other in the header file should help to
-avoid this problem in the future.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260410152314.86412-2-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit a1310cc6281d22ac948f4aa198dcc55d58fc039d)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- hw/scsi/scsi-bus.c | 7 +------
- include/hw/block/block.h | 7 +++++++
- 2 files changed, 8 insertions(+), 6 deletions(-)
-
-diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
-index 878ccf62c9..88373d957f 100644
---- a/hw/scsi/scsi-bus.c
-+++ b/hw/scsi/scsi-bus.c
-@@ -485,12 +485,7 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus)
- Location loc;
- DriveInfo *dinfo;
- int unit;
-- BlockConf conf = {
-- .bootindex = -1,
-- .share_rw = false,
-- .rerror = BLOCKDEV_ON_ERROR_AUTO,
-- .werror = BLOCKDEV_ON_ERROR_AUTO,
-- };
-+ BlockConf conf = DEFAULT_BLOCK_CONF;
-
- loc_push_none(&loc);
- for (unit = 0; unit <= bus->info->max_target; unit++) {
-diff --git a/include/hw/block/block.h b/include/hw/block/block.h
-index b4d914624e..7da643faff 100644
---- a/include/hw/block/block.h
-+++ b/include/hw/block/block.h
-@@ -51,6 +51,13 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
- return exp;
- }
-
-+#define DEFAULT_BLOCK_CONF (BlockConf) { \
-+ .bootindex = -1, \
-+ .share_rw = false, \
-+ .rerror = BLOCKDEV_ON_ERROR_AUTO, \
-+ .werror = BLOCKDEV_ON_ERROR_AUTO, \
-+}
-+
- #define DEFINE_BLOCK_PROPERTIES_BASE(_state, _conf) \
- DEFINE_PROP_ON_OFF_AUTO("backend_defaults", _state, \
- _conf.backend_defaults, ON_OFF_AUTO_AUTO), \
---
-2.52.0
-
diff --git a/kvm-block-Expose-block-limits-for-images-in-QMP.patch b/kvm-block-Expose-block-limits-for-images-in-QMP.patch
deleted file mode 100644
index 4c67a90..0000000
--- a/kvm-block-Expose-block-limits-for-images-in-QMP.patch
+++ /dev/null
@@ -1,255 +0,0 @@
-From c8b07a9c5c6926a63c2db56c3de8046b2160417d Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Fri, 24 Oct 2025 14:30:38 +0200
-Subject: [PATCH 3/6] block: Expose block limits for images in QMP
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 439: block: Expose block limits in monitor and qemu-img info
-RH-Jira: RHEL-110003
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/4] a2d45f05abd5bedbad2f10ae4dc7a5cce909a2fe (kmwolf/centos-qemu-kvm)
-
-This information can be useful both for debugging and for management
-tools trying to configure guest devices with the optimal limits
-(possibly across multiple hosts). There is no reason not to make it
-available, so just add it to BlockNodeInfo.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
-Message-ID: <20251024123041.51254-3-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit d2634e18286a5772f04cc724e64f8b16a2124587)
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/qapi.c | 34 ++++++++++++++--
- qapi/block-core.json | 66 ++++++++++++++++++++++++++++++++
- tests/qemu-iotests/184 | 5 ++-
- tests/qemu-iotests/184.out | 8 ----
- tests/qemu-iotests/common.filter | 3 +-
- 5 files changed, 102 insertions(+), 14 deletions(-)
-
-diff --git a/block/qapi.c b/block/qapi.c
-index 12fbf8d1b7..54521d0a68 100644
---- a/block/qapi.c
-+++ b/block/qapi.c
-@@ -235,7 +235,8 @@ int bdrv_query_snapshot_info_list(BlockDriverState *bs,
- * in @info, setting @errp on error.
- */
- static void GRAPH_RDLOCK
--bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, Error **errp)
-+bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, bool limits,
-+ Error **errp)
- {
- int64_t size;
- const char *backing_filename;
-@@ -269,6 +270,33 @@ bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, Error **errp)
- info->dirty_flag = bdi.is_dirty;
- info->has_dirty_flag = true;
- }
-+
-+ if (limits) {
-+ info->limits = g_new(BlockLimitsInfo, 1);
-+ *info->limits = (BlockLimitsInfo) {
-+ .request_alignment = bs->bl.request_alignment,
-+ .has_max_discard = bs->bl.max_pdiscard != 0,
-+ .max_discard = bs->bl.max_pdiscard,
-+ .has_discard_alignment = bs->bl.pdiscard_alignment != 0,
-+ .discard_alignment = bs->bl.pdiscard_alignment,
-+ .has_max_write_zeroes = bs->bl.max_pwrite_zeroes != 0,
-+ .max_write_zeroes = bs->bl.max_pwrite_zeroes,
-+ .has_write_zeroes_alignment = bs->bl.pwrite_zeroes_alignment != 0,
-+ .write_zeroes_alignment = bs->bl.pwrite_zeroes_alignment,
-+ .has_opt_transfer = bs->bl.opt_transfer != 0,
-+ .opt_transfer = bs->bl.opt_transfer,
-+ .has_max_transfer = bs->bl.max_transfer != 0,
-+ .max_transfer = bs->bl.max_transfer,
-+ .has_max_hw_transfer = bs->bl.max_hw_transfer != 0,
-+ .max_hw_transfer = bs->bl.max_hw_transfer,
-+ .max_iov = bs->bl.max_iov,
-+ .has_max_hw_iov = bs->bl.max_hw_iov != 0,
-+ .max_hw_iov = bs->bl.max_hw_iov,
-+ .min_mem_alignment = bs->bl.min_mem_alignment,
-+ .opt_mem_alignment = bs->bl.opt_mem_alignment,
-+ };
-+ }
-+
- info->format_specific = bdrv_get_specific_info(bs, &err);
- if (err) {
- error_propagate(errp, err);
-@@ -343,7 +371,7 @@ void bdrv_query_image_info(BlockDriverState *bs,
- ImageInfo *info;
-
- info = g_new0(ImageInfo, 1);
-- bdrv_do_query_node_info(bs, qapi_ImageInfo_base(info), errp);
-+ bdrv_do_query_node_info(bs, qapi_ImageInfo_base(info), true, errp);
- if (*errp) {
- goto fail;
- }
-@@ -397,7 +425,7 @@ void bdrv_query_block_graph_info(BlockDriverState *bs,
- BdrvChild *c;
-
- info = g_new0(BlockGraphInfo, 1);
-- bdrv_do_query_node_info(bs, qapi_BlockGraphInfo_base(info), errp);
-+ bdrv_do_query_node_info(bs, qapi_BlockGraphInfo_base(info), false, errp);
- if (*errp) {
- goto fail;
- }
-diff --git a/qapi/block-core.json b/qapi/block-core.json
-index dc6eb4ae23..2c037183f0 100644
---- a/qapi/block-core.json
-+++ b/qapi/block-core.json
-@@ -275,6 +275,69 @@
- 'file': 'ImageInfoSpecificFileWrapper'
- } }
-
-+##
-+# @BlockLimitsInfo:
-+#
-+# @request-alignment: Alignment requirement, in bytes, for
-+# offset/length of I/O requests.
-+#
-+# @max-discard: Maximum number of bytes that can be discarded at once.
-+# If not present, there is no specific maximum.
-+#
-+# @discard-alignment: Optimal alignment for discard requests in bytes.
-+# Note that this doesn't have to be a power of two. If not
-+# present, discards don't have a alignment requirement different
-+# from @request-alignment.
-+#
-+# @max-write-zeroes: Maximum number of bytes that can be zeroed out at
-+# once. If not present, there is no specific maximum.
-+#
-+# @write-zeroes-alignment: Optimal alignment for write zeroes requests
-+# in bytes. Note that this doesn't have to be a power of two. If
-+# not present, write_zeroes doesn't have a alignment requirement
-+# different from @request-alignment.
-+#
-+# @opt-transfer: Optimal transfer length in bytes. If not present,
-+# there is no preferred size.
-+#
-+# @max-transfer: Maximal transfer length in bytes. If not present,
-+# there is no specific maximum.
-+#
-+# @max-hw-transfer: Maximal hardware transfer length in bytes.
-+# Applies whenever transfers to the device bypass the kernel I/O
-+# scheduler, for example with SG_IO. If not present, there is no
-+# specific maximum.
-+#
-+# @max-iov: Maximum number of scatter/gather elements
-+#
-+# @max-hw-iov: Maximum number of scatter/gather elements allowed by
-+# the hardware. Applies whenever transfers to the device bypass
-+# the kernel I/O scheduler, for example with SG_IO. If not
-+# present, the hardware limits is unknown and @max-iov is always
-+# used.
-+#
-+# @min-mem-alignment: Minimal required memory alignment in bytes for
-+# zero-copy I/O to succeed. For unaligned requests, a bounce
-+# buffer will be used.
-+#
-+# @opt-mem-alignment: Optimal memory alignment in bytes. This is the
-+# alignment used for any buffer allocations QEMU performs
-+# internally.
-+##
-+{ 'struct': 'BlockLimitsInfo',
-+ 'data': { 'request-alignment': 'uint32',
-+ '*max-discard': 'uint64',
-+ '*discard-alignment': 'uint32',
-+ '*max-write-zeroes': 'uint64',
-+ '*write-zeroes-alignment': 'uint32',
-+ '*opt-transfer': 'uint32',
-+ '*max-transfer': 'uint32',
-+ '*max-hw-transfer': 'uint32',
-+ 'max-iov': 'int',
-+ '*max-hw-iov': 'int',
-+ 'min-mem-alignment': 'size',
-+ 'opt-mem-alignment': 'size' } }
-+
- ##
- # @BlockNodeInfo:
- #
-@@ -304,6 +367,8 @@
- #
- # @snapshots: list of VM snapshots
- #
-+# @limits: block limits that are used for I/O on the node (Since 10.2)
-+#
- # @format-specific: structure supplying additional format-specific
- # information (since 1.7)
- #
-@@ -315,6 +380,7 @@
- '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
- '*backing-filename': 'str', '*full-backing-filename': 'str',
- '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
-+ '*limits': 'BlockLimitsInfo',
- '*format-specific': 'ImageInfoSpecific' } }
-
- ##
-diff --git a/tests/qemu-iotests/184 b/tests/qemu-iotests/184
-index e4cbcd8634..6d0afe9d38 100755
---- a/tests/qemu-iotests/184
-+++ b/tests/qemu-iotests/184
-@@ -45,8 +45,9 @@ do_run_qemu()
-
- run_qemu()
- {
-- do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
-- | _filter_qemu_io | _filter_generated_node_ids
-+ do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp \
-+ | _filter_qemu_io | _filter_generated_node_ids \
-+ | _filter_img_info
- }
-
- test_throttle=$($QEMU_IMG --help|grep throttle)
-diff --git a/tests/qemu-iotests/184.out b/tests/qemu-iotests/184.out
-index ef99bb2e9a..52692b6b3b 100644
---- a/tests/qemu-iotests/184.out
-+++ b/tests/qemu-iotests/184.out
-@@ -41,12 +41,6 @@ Testing:
- },
- "iops_wr": 0,
- "ro": false,
-- "children": [
-- {
-- "node-name": "disk0",
-- "child": "file"
-- }
-- ],
- "node-name": "throttle0",
- "backing_file_depth": 1,
- "drv": "throttle",
-@@ -75,8 +69,6 @@ Testing:
- },
- "iops_wr": 0,
- "ro": false,
-- "children": [
-- ],
- "node-name": "disk0",
- "backing_file_depth": 0,
- "drv": "null-co",
-diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
-index 35c0fc0d20..cd8b506dba 100644
---- a/tests/qemu-iotests/common.filter
-+++ b/tests/qemu-iotests/common.filter
-@@ -230,6 +230,7 @@ _filter_img_info()
- discard=0
- regex_json_spec_start='^ *"format-specific": \{'
- regex_json_child_start='^ *"children": \['
-+ regex_json_limit_start='^ *"limits": \{'
- gsed -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
- -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
- -e "s#$TEST_DIR#TEST_DIR#g" \
-@@ -262,7 +263,7 @@ _filter_img_info()
- discard=1
- elif [[ $line =~ "Child node '/" ]]; then
- discard=1
-- elif [[ $line =~ $regex_json_spec_start ]]; then
-+ elif [[ $line =~ $regex_json_spec_start || $line =~ $regex_json_limit_start ]]; then
- discard=2
- regex_json_end="^${line%%[^ ]*}\\},? *$"
- elif [[ $line =~ $regex_json_child_start ]]; then
---
-2.47.3
-
diff --git a/kvm-block-Fix-BDS-use-after-free-during-shutdown.patch b/kvm-block-Fix-BDS-use-after-free-during-shutdown.patch
deleted file mode 100644
index 0bc5baf..0000000
--- a/kvm-block-Fix-BDS-use-after-free-during-shutdown.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From 8f3dbb64c2217e7c46df964311f210c6a3c9e8be Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Mon, 15 Dec 2025 16:07:14 +0100
-Subject: [PATCH] block: Fix BDS use after free during shutdown
-
-RH-Author: Thomas Huth <thuth@redhat.com>
-RH-MergeRequest: 446: Fix crash that happens when powering-off a guest during migration
-RH-Jira: RHEL-108142
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/1] af2687210d89fef5c4229a84371236c2b9bbdf5b (thuth/qemu-kvm-cs)
-
-JIRA: https://issues.redhat.com/browse/RHEL-108142
-
-During shutdown, blockdev_close_all_bdrv_states() drops any block node
-references that are still owned by the monitor (i.e. the user). However,
-in doing so, it forgot to also remove the node from monitor_bdrv_states
-(which qmp_blockdev_del() correctly does), which means that later calls
-of bdrv_first()/bdrv_next() will still return the (now stale) pointer to
-the node.
-
-Usually there is no such call after this point, but in some cases it can
-happen. In the reported case, there was an ongoing migration, and the
-migration thread wasn't shut down yet: migration_shutdown() called by
-qemu_cleanup() doesn't actually wait for the migration to be shut down,
-but may just move it to MIGRATION_STATUS_CANCELLING. The next time
-migration_iteration_finish() runs, it sees the status and tries to
-re-activate all block devices that migration may have previously
-inactivated. This is where bdrv_first()/bdrv_next() get called and the
-access to the already freed node happens.
-
-It is debatable if migration_shutdown() should really return before
-migration has settled, but leaving a dangling pointer in the list of
-monitor-owned block nodes is clearly a bug either way and fixing it
-solves the immediate problem, so fix it.
-
-Reported-by: Thomas Huth <thuth@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20251215150714.130214-1-kwolf@redhat.com>
-Reviewed-by: Thomas Huth <thuth@redhat.com>
-Tested-by: Thomas Huth <thuth@redhat.com>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 307bc43095b8ab1765fd66c26003d5da06681c05)
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- blockdev.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/blockdev.c b/blockdev.c
-index b451fee6e1..76c8dd0573 100644
---- a/blockdev.c
-+++ b/blockdev.c
-@@ -685,6 +685,7 @@ void blockdev_close_all_bdrv_states(void)
-
- GLOBAL_STATE_CODE();
- QTAILQ_FOREACH_SAFE(bs, &monitor_bdrv_states, monitor_list, next_bs) {
-+ QTAILQ_REMOVE(&monitor_bdrv_states, bs, monitor_list);
- bdrv_unref(bs);
- }
- }
---
-2.47.3
-
diff --git a/kvm-block-Fix-crash-after-setting-latency-historygram-wi.patch b/kvm-block-Fix-crash-after-setting-latency-historygram-wi.patch
deleted file mode 100644
index 69e1ab5..0000000
--- a/kvm-block-Fix-crash-after-setting-latency-historygram-wi.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From a694d76d085f091f21d5062c4c0328db7b5eb188 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Tue, 31 Mar 2026 12:26:08 +0200
-Subject: [PATCH 52/52] block: Fix crash after setting latency historygram with
- single bin
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [45/45] c604a01f5c30539af7097ee14f49dfdb22a83b2d (kmwolf/centos-qemu-kvm)
-
-Passing an empty list of boundaries to block-latency-histogram-set sets
-up a state that leads to a NULL pointer dereference when the next
-request should be accounted for. This is not a useful configuration, so
-just error out if the user tries to set it.
-
-The crash can easily be reproduced with the following script:
-
- qmp() {
- cat <<EOF
- {'execute':'qmp_capabilities'}
- {'execute':'block-latency-histogram-set',
- 'arguments': {'id':'ide0','boundaries':[]}}
- {'execute':'cont'}
- EOF
- }
-
- qmp | ./qemu-system-x86_64 -S -qmp stdio \
- -drive if=none,format=raw,file=null-co:// \
- -device ide-hd,drive=none0,id=ide0
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260331102608.60882-1-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit a55402d5c3a8c63c801de86896f86c9abeda0ca8)
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/accounting.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/block/accounting.c b/block/accounting.c
-index 5cf51f029b..f00fe99740 100644
---- a/block/accounting.c
-+++ b/block/accounting.c
-@@ -185,6 +185,15 @@ int block_latency_histogram_set(BlockAcctStats *stats, enum BlockAcctType type,
- prev = entry->value;
- }
-
-+ /*
-+ * block_latency_histogram_account() assumes that it can always access
-+ * hist->boundaries[0], so require at least one boundary. A histogram with
-+ * a single bin is useless anyway.
-+ */
-+ if (new_nbins <= 1) {
-+ return -EINVAL;
-+ }
-+
- hist->nbins = new_nbins;
- g_free(hist->boundaries);
- hist->boundaries = g_new(uint64_t, hist->nbins - 1);
---
-2.52.0
-
diff --git a/kvm-block-Improve-comments-in-BlockLimits.patch b/kvm-block-Improve-comments-in-BlockLimits.patch
deleted file mode 100644
index 1e2aeda..0000000
--- a/kvm-block-Improve-comments-in-BlockLimits.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From e5745092ebc473f359cb2eef67ff375a1e942a74 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Fri, 24 Oct 2025 14:30:37 +0200
-Subject: [PATCH 2/6] block: Improve comments in BlockLimits
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 439: block: Expose block limits in monitor and qemu-img info
-RH-Jira: RHEL-110003
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/4] 06c55e52ff339d2bc4559b109b0a6dd625caa7f0 (kmwolf/centos-qemu-kvm)
-
-Patches to expose the limits in QAPI have made clear that the existing
-documentation of BlockLimits could be improved: The meaning of
-min_mem_alignment and opt_mem_alignment could be clearer, and talking
-about better alignment values isn't helpful when we only detect these
-values and never choose them.
-
-Make the changes in the BlockLimits documentation now, so that the
-patches exposing the fields in QAPI can use descriptions consistent with
-it.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20251024123041.51254-2-kwolf@redhat.com>
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 46dd683d56b1328cb2bc923914bfd7ac590064f7)
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- include/block/block_int-common.h | 30 +++++++++++++++++-------------
- 1 file changed, 17 insertions(+), 13 deletions(-)
-
-diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
-index 034c0634c8..5206f32d53 100644
---- a/include/block/block_int-common.h
-+++ b/include/block/block_int-common.h
-@@ -817,10 +817,10 @@ typedef struct BlockLimits {
- int64_t max_pdiscard;
-
- /*
-- * Optimal alignment for discard requests in bytes. A power of 2
-- * is best but not mandatory. Must be a multiple of
-- * bl.request_alignment, and must be less than max_pdiscard if
-- * that is set. May be 0 if bl.request_alignment is good enough
-+ * Optimal alignment for discard requests in bytes. Note that this doesn't
-+ * have to be a power of two. Must be a multiple of bl.request_alignment,
-+ * and must be less than max_pdiscard if that is set. May be 0 if
-+ * bl.request_alignment is good enough.
- */
- uint32_t pdiscard_alignment;
-
-@@ -831,11 +831,10 @@ typedef struct BlockLimits {
- int64_t max_pwrite_zeroes;
-
- /*
-- * Optimal alignment for write zeroes requests in bytes. A power
-- * of 2 is best but not mandatory. Must be a multiple of
-- * bl.request_alignment, and must be less than max_pwrite_zeroes
-- * if that is set. May be 0 if bl.request_alignment is good
-- * enough
-+ * Optimal alignment for write zeroes requests in bytes. Note that this
-+ * doesn't have to be a power of two. Must be a multiple of
-+ * bl.request_alignment, and must be less than max_pwrite_zeroes if that is
-+ * set. May be 0 if bl.request_alignment is good enough.
- */
- uint32_t pwrite_zeroes_alignment;
-
-@@ -863,18 +862,23 @@ typedef struct BlockLimits {
- uint64_t max_hw_transfer;
-
- /*
-- * Maximal number of scatter/gather elements allowed by the hardware.
-+ * Maximum number of scatter/gather elements allowed by the hardware.
- * Applies whenever transfers to the device bypass the kernel I/O
- * scheduler, for example with SG_IO. If larger than max_iov
- * or if zero, blk_get_max_hw_iov will fall back to max_iov.
- */
- int max_hw_iov;
-
--
-- /* memory alignment, in bytes so that no bounce buffer is needed */
-+ /*
-+ * Minimal required memory alignment in bytes for zero-copy I/O to succeed.
-+ * For unaligned requests, a bounce buffer will be used.
-+ */
- size_t min_mem_alignment;
-
-- /* memory alignment, in bytes, for bounce buffer */
-+ /*
-+ * Optimal memory alignment in bytes. This is the alignment used for any
-+ * buffer allocations QEMU performs internally.
-+ */
- size_t opt_mem_alignment;
-
- /* maximum number of iovec elements */
---
-2.47.3
-
diff --git a/kvm-block-Never-drop-BLOCK_IO_ERROR-with-action-stop-for.patch b/kvm-block-Never-drop-BLOCK_IO_ERROR-with-action-stop-for.patch
deleted file mode 100644
index ecd825d..0000000
--- a/kvm-block-Never-drop-BLOCK_IO_ERROR-with-action-stop-for.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From 2704bca029bc3c7a3e430d3af8b7696d7d2b1e37 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Wed, 4 Mar 2026 13:28:00 +0100
-Subject: [PATCH 2/2] block: Never drop BLOCK_IO_ERROR with action=stop for
- rate limiting
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 472: block: Never drop BLOCK_IO_ERROR with action=stop for rate limiting
-RH-Jira: RHEL-144004
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [1/1] 96b29a65a4a49fb159970892124e5b4bbdcdfeb7 (kmwolf/centos-qemu-kvm)
-
-Commit 2155d2dd introduced rate limiting for BLOCK_IO_ERROR to emit an
-event only once a second. This makes sense for cases in which the guest
-keeps running and can submit more requests that would possibly also fail
-because there is a problem with the backend.
-
-However, if the error policy is configured so that the VM is stopped on
-errors, this is both unnecessary because stopping the VM means that the
-guest can't issue more requests and in fact harmful because stopping the
-VM is an important state change that management tools need to keep track
-of even if it happens more than once in a given second. If an event is
-dropped, the management tool would see a VM randomly going to paused
-state without an associated error, so it has a hard time deciding how to
-handle the situation.
-
-This patch disables rate limiting for action=stop by not relying on the
-event type alone any more in monitor_qapi_event_queue_no_reenter(), but
-checking action for BLOCK_IO_ERROR, too. If the error is reported to the
-guest or ignored, the rate limiting stays in place.
-
-Fixes: 2155d2dd7f73 ('block-backend: per-device throttling of BLOCK_IO_ERROR reports')
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260304122800.51923-1-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 544ddbb6373d61292a0e2dc269809cd6bd5edec6)
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- monitor/monitor.c | 21 ++++++++++++++++++++-
- qapi/block-core.json | 2 +-
- 2 files changed, 21 insertions(+), 2 deletions(-)
-
-diff --git a/monitor/monitor.c b/monitor/monitor.c
-index c5a5d30877..ae7cf64de0 100644
---- a/monitor/monitor.c
-+++ b/monitor/monitor.c
-@@ -363,14 +363,33 @@ monitor_qapi_event_queue_no_reenter(QAPIEvent event, QDict *qdict)
- {
- MonitorQAPIEventConf *evconf;
- MonitorQAPIEventState *evstate;
-+ bool throttled;
-
- assert(event < QAPI_EVENT__MAX);
- evconf = &monitor_qapi_event_conf[event];
- trace_monitor_protocol_event_queue(event, qdict, evconf->rate);
-+ throttled = evconf->rate;
-+
-+ /*
-+ * Rate limit BLOCK_IO_ERROR only for action != "stop".
-+ *
-+ * If the VM is stopped after an I/O error, this is important information
-+ * for the management tool to keep track of the state of QEMU and we can't
-+ * merge any events. At the same time, stopping the VM means that the guest
-+ * can't send additional requests and the number of events is already
-+ * limited, so we can do without rate limiting.
-+ */
-+ if (event == QAPI_EVENT_BLOCK_IO_ERROR) {
-+ QDict *data = qobject_to(QDict, qdict_get(qdict, "data"));
-+ const char *action = qdict_get_str(data, "action");
-+ if (!strcmp(action, "stop")) {
-+ throttled = false;
-+ }
-+ }
-
- QEMU_LOCK_GUARD(&monitor_lock);
-
-- if (!evconf->rate) {
-+ if (!throttled) {
- /* Unthrottled event */
- monitor_qapi_event_emit(event, qdict);
- } else {
-diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 2c037183f0..0236936139 100644
---- a/qapi/block-core.json
-+++ b/qapi/block-core.json
-@@ -5783,7 +5783,7 @@
- # .. note:: If action is "stop", a `STOP` event will eventually follow
- # the `BLOCK_IO_ERROR` event.
- #
--# .. note:: This event is rate-limited.
-+# .. note:: This event is rate-limited, except if action is "stop".
- #
- # Since: 0.13
- #
---
-2.47.3
-
diff --git a/kvm-block-backend-Fix-race-when-resuming-queued-requests.patch b/kvm-block-backend-Fix-race-when-resuming-queued-requests.patch
deleted file mode 100644
index a9d881b..0000000
--- a/kvm-block-backend-Fix-race-when-resuming-queued-requests.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From 1393ba1b8f4ee2b7ec9dcb12317ec2d53c7d793e Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Wed, 19 Nov 2025 18:27:20 +0100
-Subject: [PATCH 01/32] block-backend: Fix race when resuming queued requests
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 432: block-backend: Fix race when resuming queued requests [c10s]
-RH-Jira: RHEL-129540
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Commit: [1/1] fa7ead79ae44d89054ed574deb3fbd196536fef3 (kmwolf/centos-qemu-kvm)
-
-When new requests arrive at a BlockBackend that is currently drained,
-these requests are queued until the drain section ends.
-
-There is a race window between blk_root_drained_end() waking up a queued
-request in an iothread from the main thread and blk_wait_while_drained()
-actually being woken up in the iothread and calling blk_inc_in_flight().
-If the BlockBackend is drained again during this window, drain won't
-wait for this request and it will sneak in when the BlockBackend is
-already supposed to be quiesced. This causes assertion failures in
-bdrv_drain_all_begin() and can have other unintended consequences.
-
-Fix this by increasing the in_flight counter immediately when scheduling
-the request to be resumed so that the next drain will wait for it to
-complete.
-
-Cc: qemu-stable@nongnu.org
-Reported-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20251119172720.135424-1-kwolf@redhat.com>
-Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
-Tested-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
-Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 8eeaa706ba73251063cb80d87ae838d2d5b08e9a)
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/block-backend.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/block/block-backend.c b/block/block-backend.c
-index f8d6ba65c1..d6df369188 100644
---- a/block/block-backend.c
-+++ b/block/block-backend.c
-@@ -1318,9 +1318,9 @@ static void coroutine_fn blk_wait_while_drained(BlockBackend *blk)
- * section.
- */
- qemu_mutex_lock(&blk->queued_requests_lock);
-+ /* blk_root_drained_end() has the corresponding blk_inc_in_flight() */
- blk_dec_in_flight(blk);
- qemu_co_queue_wait(&blk->queued_requests, &blk->queued_requests_lock);
-- blk_inc_in_flight(blk);
- qemu_mutex_unlock(&blk->queued_requests_lock);
- }
- }
-@@ -2767,9 +2767,11 @@ static void blk_root_drained_end(BdrvChild *child)
- blk->dev_ops->drained_end(blk->dev_opaque);
- }
- qemu_mutex_lock(&blk->queued_requests_lock);
-- while (qemu_co_enter_next(&blk->queued_requests,
-- &blk->queued_requests_lock)) {
-+ while (!qemu_co_queue_empty(&blk->queued_requests)) {
- /* Resume all queued requests */
-+ blk_inc_in_flight(blk);
-+ qemu_co_enter_next(&blk->queued_requests,
-+ &blk->queued_requests_lock);
- }
- qemu_mutex_unlock(&blk->queued_requests_lock);
- }
---
-2.47.3
-
diff --git a/kvm-block-curl-fix-concurrent-completion-handling.patch b/kvm-block-curl-fix-concurrent-completion-handling.patch
deleted file mode 100644
index 6f70497..0000000
--- a/kvm-block-curl-fix-concurrent-completion-handling.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 974fa918950f21b9ee6134af75c551fbc9a61905 Mon Sep 17 00:00:00 2001
-From: Antoine Damhet <adamhet@scaleway.com>
-Date: Thu, 12 Feb 2026 17:27:24 +0100
-Subject: [PATCH 12/52] block/curl: fix concurrent completion handling
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [5/45] c2be04a98f68f562b5cf702572acf31a361934ed (kmwolf/centos-qemu-kvm)
-
-curl_multi_check_completion would bail upon the first completed
-transfer even if more completion messages were available thus leaving
-some in flight IOs stuck.
-
-Rework a bit the loop to make the iterations clearer and drop the breaks.
-
-The original hang can be somewhat reproduced with the following command:
-
-$ qemu-img convert -p -m 16 -O qcow2 -c --image-opts \
- 'file.driver=https,file.url=https://scaleway.testdebit.info/10G.iso,file.readahead=1M' \
- /tmp/test.qcow2
-
-Fixes: 1f2cead32443 ("curl: Ensure all informationals are checked for completion")
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Antoine Damhet <adamhet@scaleway.com>
-Message-ID: <20260212162730.440855-2-adamhet@scaleway.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 6f7b0a23a6ea0cc72ad222ab37936248d99d4256)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/curl.c | 11 ++---------
- 1 file changed, 2 insertions(+), 9 deletions(-)
-
-diff --git a/block/curl.c b/block/curl.c
-index 96498aac1d..dabd2a905e 100644
---- a/block/curl.c
-+++ b/block/curl.c
-@@ -324,17 +324,11 @@ curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len, CURLAIOCB *acb)
- static void curl_multi_check_completion(BDRVCURLState *s)
- {
- int msgs_in_queue;
-+ CURLMsg *msg;
-
- /* Try to find done transfers, so we can free the easy
- * handle again. */
-- for (;;) {
-- CURLMsg *msg;
-- msg = curl_multi_info_read(s->multi, &msgs_in_queue);
--
-- /* Quit when there are no more completions */
-- if (!msg)
-- break;
--
-+ while ((msg = curl_multi_info_read(s->multi, &msgs_in_queue))) {
- if (msg->msg == CURLMSG_DONE) {
- int i;
- CURLState *state = NULL;
-@@ -397,7 +391,6 @@ static void curl_multi_check_completion(BDRVCURLState *s)
- }
-
- curl_clean_state(state);
-- break;
- }
- }
- }
---
-2.52.0
-
diff --git a/kvm-block-curl-fix-curl-internal-handles-handling.patch b/kvm-block-curl-fix-curl-internal-handles-handling.patch
deleted file mode 100644
index 73aa175..0000000
--- a/kvm-block-curl-fix-curl-internal-handles-handling.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From e61f10f2711f4fee1c4ef0611b89d85cf3141f26 Mon Sep 17 00:00:00 2001
-From: Michael Tokarev <mjt@tls.msk.ru>
-Date: Sun, 24 Aug 2025 03:05:32 +0300
-Subject: [PATCH 09/52] block/curl: fix curl internal handles handling
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/45] adce90f28e968783f18a66f44e42f8023b46b0e1 (kmwolf/centos-qemu-kvm)
-
-block/curl.c uses CURLMOPT_SOCKETFUNCTION to register a socket callback.
-According to the documentation, this callback is called not just with
-application-created sockets but also with internal curl sockets, - and
-for such sockets, user data pointer is not set by the application, so
-the result qemu crashing.
-
-Pass BDRVCURLState directly to the callback function as user pointer,
-instead of relying on CURLINFO_PRIVATE.
-
-This problem started happening with update of libcurl from 8.9 to 8.10 --
-apparently with this change curl started using private handles more.
-
-(CURLINFO_PRIVATE is used in one more place, in curl_multi_check_completion() -
-it might need a similar fix too)
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3081
-Cc: qemu-stable@qemu.org
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-(cherry picked from commit 606978500c3d18fb89a49844f253097b17f757de)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/curl.c | 7 ++-----
- 1 file changed, 2 insertions(+), 5 deletions(-)
-
-diff --git a/block/curl.c b/block/curl.c
-index d69bcdff79..74ec62d9d8 100644
---- a/block/curl.c
-+++ b/block/curl.c
-@@ -162,13 +162,9 @@ static int curl_timer_cb(CURLM *multi, long timeout_ms, void *opaque)
- static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
- void *userp, void *sp)
- {
-- BDRVCURLState *s;
-- CURLState *state = NULL;
-+ BDRVCURLState *s = userp;
- CURLSocket *socket;
-
-- curl_easy_getinfo(curl, CURLINFO_PRIVATE, (char **)&state);
-- s = state->s;
--
- socket = g_hash_table_lookup(s->sockets, GINT_TO_POINTER(fd));
- if (!socket) {
- socket = g_new0(CURLSocket, 1);
-@@ -619,6 +615,7 @@ static void curl_attach_aio_context(BlockDriverState *bs,
- assert(!s->multi);
- s->multi = curl_multi_init();
- s->aio_context = new_context;
-+ curl_multi_setopt(s->multi, CURLMOPT_SOCKETDATA, s);
- curl_multi_setopt(s->multi, CURLMOPT_SOCKETFUNCTION, curl_sock_cb);
- curl_multi_setopt(s->multi, CURLMOPT_TIMERDATA, s);
- curl_multi_setopt(s->multi, CURLMOPT_TIMERFUNCTION, curl_timer_cb);
---
-2.52.0
-
diff --git a/kvm-block-curl-free-s-password-in-cleanup-paths.patch b/kvm-block-curl-free-s-password-in-cleanup-paths.patch
deleted file mode 100644
index 6037434..0000000
--- a/kvm-block-curl-free-s-password-in-cleanup-paths.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 36b96d00d6e51e02eca8bd2b4a11536376187f54 Mon Sep 17 00:00:00 2001
-From: GuoHan Zhao <zhaoguohan@kylinos.cn>
-Date: Fri, 20 Mar 2026 14:30:16 +0800
-Subject: [PATCH 13/52] block/curl: free s->password in cleanup paths
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [6/45] 8c30ddfca7d21b63120d66714cf653bd39cdb611 (kmwolf/centos-qemu-kvm)
-
-When password-secret is used, curl_open() resolves it with
-qcrypto_secret_lookup_as_utf8() and stores the returned buffer in
-s->password.
-
-Unlike s->proxypassword, s->password is not freed either in the open
-failure path or in curl_close(), so the resolved secret leaks once it
-has been allocated.
-
-Free s->password in both cleanup paths.
-
-Fixes: 1bff96064290 ('curl: add support for HTTP authentication parameters')
-Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
-Message-ID: <20260320063016.262954-1-zhaoguohan_salmon@163.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 51fc8443c122fedf4d4891bbc3a1ff25dd8bacdf)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/curl.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/block/curl.c b/block/curl.c
-index dabd2a905e..aabb602d9b 100644
---- a/block/curl.c
-+++ b/block/curl.c
-@@ -876,6 +876,7 @@ out_noclean:
- g_free(s->cookie);
- g_free(s->url);
- g_free(s->username);
-+ g_free(s->password);
- g_free(s->proxyusername);
- g_free(s->proxypassword);
- if (s->sockets) {
-@@ -987,6 +988,7 @@ static void curl_close(BlockDriverState *bs)
- g_free(s->cookie);
- g_free(s->url);
- g_free(s->username);
-+ g_free(s->password);
- g_free(s->proxyusername);
- g_free(s->proxypassword);
- }
---
-2.52.0
-
diff --git a/kvm-block-curl.c-Fix-CURLOPT_VERBOSE-parameter-type.patch b/kvm-block-curl.c-Fix-CURLOPT_VERBOSE-parameter-type.patch
deleted file mode 100644
index 8a6fa17..0000000
--- a/kvm-block-curl.c-Fix-CURLOPT_VERBOSE-parameter-type.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From e3921ea32fdc43a74a639e215a861e464ec3da80 Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones" <rjones@redhat.com>
-Date: Mon, 13 Oct 2025 13:41:19 +0100
-Subject: [PATCH 11/52] block/curl.c: Fix CURLOPT_VERBOSE parameter type
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [4/45] 7adffe8d6de2464ed632918f3d8b4200ada1f2a0 (kmwolf/centos-qemu-kvm)
-
-In commit ed26056d90 ("block/curl.c: Use explicit long constants in
-curl_easy_setopt calls") we missed a further call that takes a long
-parameter.
-
-Reported-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
-Message-ID: <20251013124127.604401-1-rjones@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit ad97769e9dcf4dbdaae6d859176e5f37fd6a7c66)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/curl.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/block/curl.c b/block/curl.c
-index bbe891dafb..96498aac1d 100644
---- a/block/curl.c
-+++ b/block/curl.c
-@@ -538,7 +538,7 @@ static int curl_init_state(BDRVCURLState *s, CURLState *state)
- #endif
-
- #ifdef DEBUG_VERBOSE
-- if (curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1)) {
-+ if (curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1L)) {
- goto err;
- }
- #endif
---
-2.52.0
-
diff --git a/kvm-block-curl.c-Use-explicit-long-constants-in-curl_eas.patch b/kvm-block-curl.c-Use-explicit-long-constants-in-curl_eas.patch
deleted file mode 100644
index fa22b55..0000000
--- a/kvm-block-curl.c-Use-explicit-long-constants-in-curl_eas.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From a03e26bc3b51997e4584fe95c4da0feba85c076a Mon Sep 17 00:00:00 2001
-From: "Richard W.M. Jones" <rjones@redhat.com>
-Date: Thu, 9 Oct 2025 15:08:31 +0100
-Subject: [PATCH 10/52] block/curl.c: Use explicit long constants in
- curl_easy_setopt calls
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [3/45] 4e4b4f2c1704cc17a27ebca3c1a70bfc8dcd1ebd (kmwolf/centos-qemu-kvm)
-
-curl_easy_setopt takes a variable argument that depends on what
-CURLOPT you are setting. Some require a long constant. Passing a
-plain int constant is potentially wrong on some platforms.
-
-With warnings enabled, multiple warnings like this were printed:
-
-../block/curl.c: In function ‘curl_init_state’:
-../block/curl.c:474:13: warning: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Wattribute-warning]
- 474 | curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) ||
- | ^
-
-Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
-Signed-off-by: Chenxi Mao <maochenxi@bosc.ac.cn>
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Reviewed-by: Thomas Huth <thuth@redhat.com>
-Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-Message-ID: <20251009141026.4042021-2-rjones@redhat.com>
-(cherry picked from commit ed26056d90ddff21351f3efd2cb47fea4f0e1d45)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/curl.c | 10 +++++-----
- contrib/elf2dmp/download.c | 4 ++--
- 2 files changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/block/curl.c b/block/curl.c
-index 74ec62d9d8..bbe891dafb 100644
---- a/block/curl.c
-+++ b/block/curl.c
-@@ -485,11 +485,11 @@ static int curl_init_state(BDRVCURLState *s, CURLState *state)
- (void *)curl_read_cb) ||
- curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state) ||
- curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state) ||
-- curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) ||
-- curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1) ||
-- curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1) ||
-+ curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1L) ||
-+ curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1L) ||
-+ curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1L) ||
- curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg) ||
-- curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1)) {
-+ curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1L)) {
- goto err;
- }
- if (s->username) {
-@@ -814,7 +814,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
- }
-
- s->accept_range = false;
-- if (curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1) ||
-+ if (curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1L) ||
- curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION, curl_header_cb) ||
- curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s)) {
- pstrcpy(state->errmsg, CURL_ERROR_SIZE,
-diff --git a/contrib/elf2dmp/download.c b/contrib/elf2dmp/download.c
-index 21306b3fd4..fa8da0f9a2 100644
---- a/contrib/elf2dmp/download.c
-+++ b/contrib/elf2dmp/download.c
-@@ -27,8 +27,8 @@ bool download_url(const char *name, const char *url)
- if (curl_easy_setopt(curl, CURLOPT_URL, url) != CURLE_OK
- || curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL) != CURLE_OK
- || curl_easy_setopt(curl, CURLOPT_WRITEDATA, file) != CURLE_OK
-- || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1) != CURLE_OK
-- || curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0) != CURLE_OK
-+ || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L) != CURLE_OK
-+ || curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L) != CURLE_OK
- || curl_easy_perform(curl) != CURLE_OK) {
- unlink(name);
- fclose(file);
---
-2.52.0
-
diff --git a/kvm-block-enable-stats-intervals-for-storage-devices.patch b/kvm-block-enable-stats-intervals-for-storage-devices.patch
deleted file mode 100644
index 1acf3e0..0000000
--- a/kvm-block-enable-stats-intervals-for-storage-devices.patch
+++ /dev/null
@@ -1,456 +0,0 @@
-From c1b736d645d79363123941613db8a79a59c27298 Mon Sep 17 00:00:00 2001
-From: Chandan Somani <csomani@redhat.com>
-Date: Fri, 3 Oct 2025 14:59:26 -0700
-Subject: [PATCH 1/2] block: enable stats-intervals for storage devices
-
-RH-Author: Chandan Somani <None>
-RH-MergeRequest: 467: block: enable stats-intervals for storage devices
-RH-Jira: RHEL-114231
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
-RH-Commit: [1/2] 0ca781da8e25bf5d2baf3dcd9f2687b4d21b8613 (csomani1/qemu-kvm)
-
-This patch allows stats-intervals to be used for storage
-devices with the -device option. It accepts a list of interval
-lengths in JSON format.
-
-It configures and collects the stats in the BlockBackend layer
-through the storage device that consumes the BlockBackend.
-
-Signed-off-by: Chandan Somani <csomani@redhat.com>
-Message-ID: <20251003220039.1336663-1-csomani@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/accounting.c | 17 +++++++++++++++--
- blockdev.c | 3 ++-
- hw/block/block.c | 7 +++++--
- include/block/accounting.h | 5 +++--
- include/hw/block/block.h | 7 ++++++-
- tests/qemu-iotests/172.out | 38 ++++++++++++++++++++++++++++++++++++++
- 6 files changed, 69 insertions(+), 8 deletions(-)
-
-diff --git a/block/accounting.c b/block/accounting.c
-index 3e46159569..0933c61f3a 100644
---- a/block/accounting.c
-+++ b/block/accounting.c
-@@ -28,6 +28,7 @@
- #include "block/block_int.h"
- #include "qemu/timer.h"
- #include "system/qtest.h"
-+#include "qapi/error.h"
-
- static QEMUClockType clock_type = QEMU_CLOCK_REALTIME;
- static const int qtest_latency_ns = NANOSECONDS_PER_SECOND / 1000;
-@@ -56,13 +57,25 @@ static bool bool_from_onoffauto(OnOffAuto val, bool def)
- }
- }
-
--void block_acct_setup(BlockAcctStats *stats, enum OnOffAuto account_invalid,
-- enum OnOffAuto account_failed)
-+bool block_acct_setup(BlockAcctStats *stats, enum OnOffAuto account_invalid,
-+ enum OnOffAuto account_failed, uint32_t *stats_intervals,
-+ uint32_t num_stats_intervals, Error **errp)
- {
- stats->account_invalid = bool_from_onoffauto(account_invalid,
- stats->account_invalid);
- stats->account_failed = bool_from_onoffauto(account_failed,
- stats->account_failed);
-+ if (stats_intervals) {
-+ for (int i = 0; i < num_stats_intervals; i++) {
-+ if (stats_intervals[i] <= 0) {
-+ error_setg(errp, "Invalid interval length: %u", stats_intervals[i]);
-+ return false;
-+ }
-+ block_acct_add_interval(stats, stats_intervals[i]);
-+ }
-+ g_free(stats_intervals);
-+ }
-+ return true;
- }
-
- void block_acct_cleanup(BlockAcctStats *stats)
-diff --git a/blockdev.c b/blockdev.c
-index 76c8dd0573..6e86c6262f 100644
---- a/blockdev.c
-+++ b/blockdev.c
-@@ -617,7 +617,8 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
-
- bs->detect_zeroes = detect_zeroes;
-
-- block_acct_setup(blk_get_stats(blk), account_invalid, account_failed);
-+ block_acct_setup(blk_get_stats(blk), account_invalid, account_failed,
-+ NULL, 0, NULL);
-
- if (!parse_stats_intervals(blk_get_stats(blk), interval_list, errp)) {
- blk_unref(blk);
-diff --git a/hw/block/block.c b/hw/block/block.c
-index 2e10611d95..f187fa025d 100644
---- a/hw/block/block.c
-+++ b/hw/block/block.c
-@@ -249,8 +249,11 @@ bool blkconf_apply_backend_options(BlockConf *conf, bool readonly,
- blk_set_enable_write_cache(blk, wce);
- blk_set_on_error(blk, rerror, werror);
-
-- block_acct_setup(blk_get_stats(blk), conf->account_invalid,
-- conf->account_failed);
-+ if (!block_acct_setup(blk_get_stats(blk), conf->account_invalid,
-+ conf->account_failed, conf->stats_intervals,
-+ conf->num_stats_intervals, errp)) {
-+ return false;
-+ }
- return true;
- }
-
-diff --git a/include/block/accounting.h b/include/block/accounting.h
-index a59e39f49d..b1cf417b57 100644
---- a/include/block/accounting.h
-+++ b/include/block/accounting.h
-@@ -101,8 +101,9 @@ typedef struct BlockAcctCookie {
- } BlockAcctCookie;
-
- void block_acct_init(BlockAcctStats *stats);
--void block_acct_setup(BlockAcctStats *stats, enum OnOffAuto account_invalid,
-- enum OnOffAuto account_failed);
-+bool block_acct_setup(BlockAcctStats *stats, enum OnOffAuto account_invalid,
-+ enum OnOffAuto account_failed, uint32_t *stats_intervals,
-+ uint32_t num_stats_intervals, Error **errp);
- void block_acct_cleanup(BlockAcctStats *stats);
- void block_acct_add_interval(BlockAcctStats *stats, unsigned interval_length);
- BlockAcctTimedStats *block_acct_interval_next(BlockAcctStats *stats,
-diff --git a/include/hw/block/block.h b/include/hw/block/block.h
-index de3946a5f1..b4d914624e 100644
---- a/include/hw/block/block.h
-+++ b/include/hw/block/block.h
-@@ -34,6 +34,8 @@ typedef struct BlockConf {
- OnOffAuto account_invalid, account_failed;
- BlockdevOnError rerror;
- BlockdevOnError werror;
-+ uint32_t num_stats_intervals;
-+ uint32_t *stats_intervals;
- } BlockConf;
-
- static inline unsigned int get_physical_block_exp(BlockConf *conf)
-@@ -66,7 +68,10 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
- DEFINE_PROP_ON_OFF_AUTO("account-invalid", _state, \
- _conf.account_invalid, ON_OFF_AUTO_AUTO), \
- DEFINE_PROP_ON_OFF_AUTO("account-failed", _state, \
-- _conf.account_failed, ON_OFF_AUTO_AUTO)
-+ _conf.account_failed, ON_OFF_AUTO_AUTO), \
-+ DEFINE_PROP_ARRAY("stats-intervals", _state, \
-+ _conf.num_stats_intervals, _conf.stats_intervals, \
-+ qdev_prop_uint32, uint32_t)
-
- #define DEFINE_BLOCK_PROPERTIES(_state, _conf) \
- DEFINE_PROP_DRIVE("drive", _state, _conf.blk), \
-diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out
-index 146fc72388..a023cd407d 100644
---- a/tests/qemu-iotests/172.out
-+++ b/tests/qemu-iotests/172.out
-@@ -30,6 +30,7 @@ Testing:
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "288"
-
-
-@@ -59,6 +60,7 @@ Testing: -fda TEST_DIR/t.qcow2
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N]
-@@ -95,6 +97,7 @@ Testing: -fdb TEST_DIR/t.qcow2
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- dev: floppy, id ""
- unit = 0 (0x0)
-@@ -109,6 +112,7 @@ Testing: -fdb TEST_DIR/t.qcow2
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "288"
- floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N]
-@@ -149,6 +153,7 @@ Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- dev: floppy, id ""
- unit = 0 (0x0)
-@@ -163,6 +168,7 @@ Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N]
-@@ -204,6 +210,7 @@ Testing: -fdb
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "288"
- dev: floppy, id ""
- unit = 0 (0x0)
-@@ -218,6 +225,7 @@ Testing: -fdb
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "288"
-
-
-@@ -247,6 +255,7 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N]
-@@ -283,6 +292,7 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2,index=1
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- dev: floppy, id ""
- unit = 0 (0x0)
-@@ -297,6 +307,7 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2,index=1
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "288"
- floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N]
-@@ -337,6 +348,7 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=floppy,file=TEST_DIR/t
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- dev: floppy, id ""
- unit = 0 (0x0)
-@@ -351,6 +363,7 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=floppy,file=TEST_DIR/t
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N]
-@@ -395,6 +408,7 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N]
-@@ -431,6 +445,7 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,unit=1
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N]
-@@ -467,6 +482,7 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qco
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- dev: floppy, id ""
- unit = 0 (0x0)
-@@ -481,6 +497,7 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qco
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N]
-@@ -531,6 +548,7 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- dev: floppy, id ""
- unit = 0 (0x0)
-@@ -545,6 +563,7 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N]
-@@ -586,6 +605,7 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- dev: floppy, id ""
- unit = 0 (0x0)
-@@ -600,6 +620,7 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N]
-@@ -641,6 +662,7 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- dev: floppy, id ""
- unit = 1 (0x1)
-@@ -655,6 +677,7 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N]
-@@ -696,6 +719,7 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- dev: floppy, id ""
- unit = 1 (0x1)
-@@ -710,6 +734,7 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N]
-@@ -760,6 +785,7 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.q
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- dev: floppy, id ""
- unit = 0 (0x0)
-@@ -774,6 +800,7 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.q
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N]
-@@ -815,6 +842,7 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.q
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- dev: floppy, id ""
- unit = 0 (0x0)
-@@ -829,6 +857,7 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.q
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N]
-@@ -876,6 +905,7 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -global floppy.drive=none0 -device
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N]
-@@ -942,6 +972,7 @@ Testing: -device floppy
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "288"
-
- Testing: -device floppy,drive-type=120
-@@ -968,6 +999,7 @@ Testing: -device floppy,drive-type=120
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "120"
-
- Testing: -device floppy,drive-type=144
-@@ -994,6 +1026,7 @@ Testing: -device floppy,drive-type=144
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
-
- Testing: -device floppy,drive-type=288
-@@ -1020,6 +1053,7 @@ Testing: -device floppy,drive-type=288
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "288"
-
-
-@@ -1049,6 +1083,7 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,drive-t
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "120"
- none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N]
-@@ -1085,6 +1120,7 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,drive-t
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "288"
- none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N]
-@@ -1124,6 +1160,7 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,logical
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N]
-@@ -1160,6 +1197,7 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,physica
- share-rw = false
- account-invalid = "auto"
- account-failed = "auto"
-+ stats-intervals = <null>
- drive-type = "144"
- none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N]
---
-2.47.3
-
diff --git a/kvm-block-fix-luks-amend-when-run-in-coroutine.patch b/kvm-block-fix-luks-amend-when-run-in-coroutine.patch
deleted file mode 100644
index 9b3645b..0000000
--- a/kvm-block-fix-luks-amend-when-run-in-coroutine.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From fa0ed7060fac1b81af1f4b4390ad3f4ddbd03270 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Fri, 19 Sep 2025 12:22:13 +0100
-Subject: [PATCH 17/52] block: fix luks 'amend' when run in coroutine
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [10/45] 3dedc21108a95bebdc893820adfb19c2b88189cc (kmwolf/centos-qemu-kvm)
-
-Launch QEMU with
-
- $ qemu-img create \
- --object secret,id=sec0,data=123456 \
- -f luks -o key-secret=sec0 demo.luks 1g
-
- $ qemu-system-x86_64 \
- --object secret,id=sec0,data=123456 \
- -blockdev driver=luks,key-secret=sec0,file.filename=demo.luks,file.driver=file,node-name=luks
-
-Then in QMP shell attempt
-
- x-blockdev-amend job-id=fish node-name=luks options={'state':'active','new-secret':'sec0','driver':'luks'}
-
-It will result in an assertion
-
- #0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
- #1 0x00007fad18b73f63 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:89
- #2 0x00007fad18b19f3e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
- #3 0x00007fad18b016d0 in __GI_abort () at abort.c:77
- #4 0x00007fad18b01639 in __assert_fail_base
- (fmt=<optimized out>, assertion=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>) at assert.c:118
- #5 0x00007fad18b120af in __assert_fail (assertion=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>)
- at assert.c:127
- #6 0x000055ff74fdbd46 in bdrv_graph_rdlock_main_loop () at ../block/graph-lock.c:260
- #7 0x000055ff7548521b in graph_lockable_auto_lock_mainloop (x=<optimized out>)
- at /usr/src/debug/qemu-9.2.4-1.fc42.x86_64/include/block/graph-lock.h:266
- #8 block_crypto_read_func (block=<optimized out>, offset=4096, buf=0x55ffb6d66ef0 "", buflen=256000, opaque=0x55ffb5edcc30, errp=0x55ffb6f00700)
- at ../block/crypto.c:71
- #9 0x000055ff75439f8b in qcrypto_block_luks_load_key
- (block=block@entry=0x55ffb5edbe90, slot_idx=slot_idx@entry=0, password=password@entry=0x55ffb67dc260 "123456", masterkey=masterkey@entry=0x55ffb5fb0c40 "", readfunc=readfunc@entry=0x55ff754851e0 <block_crypto_read_func>, opaque=opaque@entry=0x55ffb5edcc30, errp=0x55ffb6f00700)
- at ../crypto/block-luks.c:927
- #10 0x000055ff7543b90f in qcrypto_block_luks_find_key
- (block=<optimized out>, password=<optimized out>, masterkey=<optimized out>, readfunc=<optimized out>, opaque=<optimized out>, errp=<optimized out>) at ../crypto/block-luks.c:1045
- #11 qcrypto_block_luks_amend_add_keyslot
- (block=0x55ffb5edbe90, readfunc=0x55ff754851e0 <block_crypto_read_func>, writefunc=0x55ff75485100 <block_crypto_write_func>, opaque=0x55ffb5edcc3, opts_luks=0x7fad1715aef8, force=<optimized out>, errp=0x55ffb6f00700) at ../crypto/block-luks.c:1673
- #12 qcrypto_block_luks_amend_options
- (block=0x55ffb5edbe90, readfunc=0x55ff754851e0 <block_crypto_read_func>, writefunc=0x55ff75485100 <block_crypto_write_func>, opaque=0x55ffb5edcc30, options=0x7fad1715aef0, force=<optimized out>, errp=0x55ffb6f00700) at ../crypto/block-luks.c:1865
- #13 0x000055ff75485b95 in block_crypto_amend_options_generic_luks
- (bs=<optimized out>, amend_options=<optimized out>, force=<optimized out>, errp=<optimized out>) at ../block/crypto.c:949
- #14 0x000055ff75485c28 in block_crypto_co_amend_luks (bs=<optimized out>, opts=<optimized out>, force=<optimized out>, errp=<optimized out>)
- at ../block/crypto.c:1008
- #15 0x000055ff754778e5 in blockdev_amend_run (job=0x55ffb6f00640, errp=0x55ffb6f00700) at ../block/amend.c:52
- #16 0x000055ff75468b90 in job_co_entry (opaque=0x55ffb6f00640) at ../job.c:1106
- #17 0x000055ff755a0fc2 in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at ../util/coroutine-ucontext.c:175
-
-This changes the read/write callbacks to not assert that they
-are run in mainloop context if already in a coroutine.
-
-This is also reproduced by qemu-iotests cases 295 and 296.
-
-Fixes: 1f051dcbdf2e4b6f518db731c84e304b2b9d15ce
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-Message-ID: <20250919112213.1530079-1-berrange@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit c86488abaf017ed3f5a636c3247cd640a93d3b08)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/crypto.c | 30 ++++++++++++++++++++++--------
- 1 file changed, 22 insertions(+), 8 deletions(-)
-
-diff --git a/block/crypto.c b/block/crypto.c
-index 17b4749a1e..7c37b23e36 100644
---- a/block/crypto.c
-+++ b/block/crypto.c
-@@ -67,11 +67,18 @@ static int block_crypto_read_func(QCryptoBlock *block,
- BlockCrypto *crypto = bs->opaque;
- ssize_t ret;
-
-- GLOBAL_STATE_CODE();
-- GRAPH_RDLOCK_GUARD_MAINLOOP();
-+ if (qemu_in_coroutine()) {
-+ GRAPH_RDLOCK_GUARD();
-
-- ret = bdrv_pread(crypto->header ? crypto->header : bs->file,
-- offset, buflen, buf, 0);
-+ ret = bdrv_co_pread(crypto->header ? crypto->header : bs->file,
-+ offset, buflen, buf, 0);
-+ } else {
-+ GLOBAL_STATE_CODE();
-+ GRAPH_RDLOCK_GUARD_MAINLOOP();
-+
-+ ret = bdrv_pread(crypto->header ? crypto->header : bs->file,
-+ offset, buflen, buf, 0);
-+ }
- if (ret < 0) {
- error_setg_errno(errp, -ret, "Could not read encryption header");
- return ret;
-@@ -90,11 +97,18 @@ static int block_crypto_write_func(QCryptoBlock *block,
- BlockCrypto *crypto = bs->opaque;
- ssize_t ret;
-
-- GLOBAL_STATE_CODE();
-- GRAPH_RDLOCK_GUARD_MAINLOOP();
-+ if (qemu_in_coroutine()) {
-+ GRAPH_RDLOCK_GUARD();
-
-- ret = bdrv_pwrite(crypto->header ? crypto->header : bs->file,
-- offset, buflen, buf, 0);
-+ ret = bdrv_co_pwrite(crypto->header ? crypto->header : bs->file,
-+ offset, buflen, buf, 0);
-+ } else {
-+ GLOBAL_STATE_CODE();
-+ GRAPH_RDLOCK_GUARD_MAINLOOP();
-+
-+ ret = bdrv_pwrite(crypto->header ? crypto->header : bs->file,
-+ offset, buflen, buf, 0);
-+ }
- if (ret < 0) {
- error_setg_errno(errp, -ret, "Could not write encryption header");
- return ret;
---
-2.52.0
-
diff --git a/kvm-block-graph-lock-fix-missed-wakeup-in-bdrv_graph_co_.patch b/kvm-block-graph-lock-fix-missed-wakeup-in-bdrv_graph_co_.patch
deleted file mode 100644
index 72c1f9c..0000000
--- a/kvm-block-graph-lock-fix-missed-wakeup-in-bdrv_graph_co_.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-From 319a9f69ecdd6bbe003503eb66aa4c30ffef3d40 Mon Sep 17 00:00:00 2001
-From: "Denis V. Lunev" <den@openvz.org>
-Date: Fri, 24 Apr 2026 12:39:16 +0200
-Subject: [PATCH 08/52] block/graph-lock: fix missed wakeup in
- bdrv_graph_co_rdunlock()
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/45] 03368780c08d1ee94cf412e6739c41c927259f9e (kmwolf/centos-qemu-kvm)
-
-tests/qemu-iotests/tests/iothreads-create reproduces the hang on
-master under `stress-ng --cpu $(nproc) --timeout 0`. The iotest's
-vm.run_job() times out and qemu stays permanently stuck in
-ppoll(timeout=-1) inside bdrv_graph_wrlock_drained -> blk_remove_bs
-during qemu_cleanup(). The timing window is narrow on modern
-bare-metal hardware and much wider in a VM guest; downstream trees
-that still use plain bdrv_graph_wrlock() in blk_remove_bs() hit it
-on the first iteration under the same stress.
-
-bdrv_graph_wrlock() zeroes has_writer around its AIO_WAIT_WHILE loop
-so that callbacks dispatched by aio_poll() can still take the read
-lock on the fast path. The rdunlock side, however, only kicks a
-waiting writer when has_writer is observed set; a reader that drops
-its lock inside the polling window silently returns and nothing ever
-wakes the writer:
-
- main thread iothread0 coroutine
- ----------- -------------------
- bdrv_graph_wrlock: rdlock held, reader_count=1
- bdrv_drain_all_begin_nopoll
- has_writer = 0
- AIO_WAIT_WHILE_UNLOCKED(
- NULL, reader_count >= 1):
- num_waiters++
- smp_mb
- aio_poll(main_ctx, true) --> bdrv_graph_co_rdunlock:
- (ppoll, blocked) reader_count-- -> 0
- smp_mb
- read has_writer = 0
- skip aio_wait_kick()
- return
-
-reader_count is now 0 and num_waiters is still 1, but no BH, fd or
-timer on the main AioContext will fire -- the only entity that could
-kick just decided it did not have to. Main stays in ppoll() holding
-BQL, so RCU, VCPUs and any iothread path that needs BQL stall behind
-it. The hang is final; no timeout, no forward progress, no recovery
-as there is no other source of wake up inside qemu_cleanup().
-
-bdrv_drain_all_begin() does not close the race on its own: it
-quiesces in-flight I/O, but graph readers also include non-I/O
-coroutines (block-job cleanup, virtio-scsi polling) that drain does
-not evict. The bdrv_graph_wrlock_drained() wrapper narrows the
-window but does not eliminate it; every plain bdrv_graph_wrlock()
-site is exposed on the same basis.
-
-Drop the has_writer check in bdrv_graph_co_rdunlock() and call
-aio_wait_kick() unconditionally. The helper itself loads num_waiters
-atomically and only schedules a dummy BH when a waiter exists, so the
-change is a no-op on the no-writer path and closes the missed-wakeup
-on the writer path.
-
-Signed-off-by: Denis V. Lunev <den@openvz.org>
-Cc: Kevin Wolf <kwolf@redhat.com>
-Cc: Hanna Reitz <hreitz@redhat.com>
-Cc: Stefan Hajnoczi <stefanha@redhat.com>
-Cc: Fiona Ebner <f.ebner@proxmox.com>
-Message-ID: <20260424103917.248668-2-den@openvz.org>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit e3082ab3b38538ebdbc5cd62b4c476b673c5e515)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/graph-lock.c | 12 +++++-------
- 1 file changed, 5 insertions(+), 7 deletions(-)
-
-diff --git a/block/graph-lock.c b/block/graph-lock.c
-index b7319473a1..f2501d75fb 100644
---- a/block/graph-lock.c
-+++ b/block/graph-lock.c
-@@ -278,14 +278,12 @@ void coroutine_fn bdrv_graph_co_rdunlock(void)
- smp_mb();
-
- /*
-- * has_writer == 0: this means reader will read reader_count decreased
-- * has_writer == 1: we don't know if writer read reader_count old or
-- * new. Therefore, kick again so on next iteration
-- * writer will for sure read the updated value.
-+ * Always kick: bdrv_graph_wrlock() zeroes has_writer while polling (to
-+ * let callbacks take the reader lock via the fast path), so we cannot
-+ * rely on has_writer to detect a waiting writer. aio_wait_kick() is a
-+ * no-op when no one is waiting, so it is cheap in the common case.
- */
-- if (qatomic_read(&has_writer)) {
-- aio_wait_kick();
-- }
-+ aio_wait_kick();
- }
-
- void bdrv_graph_rdlock_main_loop(void)
---
-2.52.0
-
diff --git a/kvm-block-io-Take-reqs_lock-for-tracked_requests.patch b/kvm-block-io-Take-reqs_lock-for-tracked_requests.patch
deleted file mode 100644
index d5a053a..0000000
--- a/kvm-block-io-Take-reqs_lock-for-tracked_requests.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From c2e109dd6504a8fb06fddf3b5e86956a4699bdef Mon Sep 17 00:00:00 2001
-From: Hanna Czenczek <hreitz@redhat.com>
-Date: Mon, 10 Nov 2025 16:48:45 +0100
-Subject: [PATCH 03/19] block/io: Take reqs_lock for tracked_requests
-
-RH-Author: Hanna Czenczek <hreitz@redhat.com>
-RH-MergeRequest: 454: Multithreading fixes for rbd, curl, qcow2
-RH-Jira: RHEL-79118
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [3/5] 91512b6569546b6e82eca0034608fb5c7b426916 (hreitz/qemu-kvm-c-9-s)
-
-bdrv_co_get_self_request() does not take a lock around iterating through
-bs->tracked_requests. With multiqueue, it may thus iterate over a list
-that is in the process of being modified, producing an assertion
-failure:
-
-../block/file-posix.c:3702: raw_do_pwrite_zeroes: Assertion `req' failed.
-
-[0] abort() at /lib64/libc.so.6
-[1] __assert_fail_base.cold() at /lib64/libc.so.6
-[2] raw_do_pwrite_zeroes() at ../block/file-posix.c:3702
-[3] bdrv_co_do_pwrite_zeroes() at ../block/io.c:1910
-[4] bdrv_aligned_pwritev() at ../block/io.c:2109
-[5] bdrv_co_do_zero_pwritev() at ../block/io.c:2192
-[6] bdrv_co_pwritev_part() at ../block/io.c:2292
-[7] bdrv_co_pwritev() at ../block/io.c:2225
-[8] handle_alloc_space() at ../block/qcow2.c:2573
-[9] qcow2_co_pwritev_task() at ../block/qcow2.c:2625
-
-Fix this by taking reqs_lock.
-
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-Message-ID: <20251110154854.151484-11-hreitz@redhat.com>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 9b9ee60c07f52009f9bb659f54c42afae95c1d94)
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
----
- block/io.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/block/io.c b/block/io.c
-index 9bd8ba8431..37df1e0253 100644
---- a/block/io.c
-+++ b/block/io.c
-@@ -721,11 +721,14 @@ BdrvTrackedRequest *coroutine_fn bdrv_co_get_self_request(BlockDriverState *bs)
- Coroutine *self = qemu_coroutine_self();
- IO_CODE();
-
-+ qemu_mutex_lock(&bs->reqs_lock);
- QLIST_FOREACH(req, &bs->tracked_requests, list) {
- if (req->co == self) {
-+ qemu_mutex_unlock(&bs->reqs_lock);
- return req;
- }
- }
-+ qemu_mutex_unlock(&bs->reqs_lock);
-
- return NULL;
- }
---
-2.47.3
-
diff --git a/kvm-block-io-fallback-to-bounce-buffer-if-BLKZEROOUT-is-.patch b/kvm-block-io-fallback-to-bounce-buffer-if-BLKZEROOUT-is-.patch
deleted file mode 100644
index a78b853..0000000
--- a/kvm-block-io-fallback-to-bounce-buffer-if-BLKZEROOUT-is-.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From dfe7857ca3612b7c52b052735c8d1a96ecf1102d Mon Sep 17 00:00:00 2001
-From: Fiona Ebner <f.ebner@proxmox.com>
-Date: Sat, 13 Jun 2026 23:03:34 +0300
-Subject: [PATCH 33/52] block/io: fallback to bounce buffer if BLKZEROOUT is
- not supported because of alignment
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [26/45] 7a8351c003c1383c23e94f06617911b691cb7ec5 (kmwolf/centos-qemu-kvm)
-
-Commit 5634622bcb ("file-posix: allow BLKZEROOUT with -t writeback")
-enables the BLKZEROOUT ioctl when using 'writeback' cache, regressing
-certain 'qemu-img convert' invocations, because of a pre-existing
-issue. Namely, the BLKZEROOUT ioctl might fail with errno EINVAL when
-the request is shorter than the block size of the block device.
-Fallback to the bounce buffer, similar to when the ioctl is not
-supported at all, rather than treating such an error as fatal.
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3257
-Resolves: https://bugzilla.proxmox.com/show_bug.cgi?id=7197
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
-Message-ID: <20260105143416.737482-1-f.ebner@proxmox.com>
-[Added TODO comment describing a larger fix that could be implemented in
-the future.
---Stefan]
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-(cherry picked from commit b4e28c304bc58325f8f712cb25e5d700826caa25)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-
-Message-ID: <20260613200411.1808021-51-mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/io.c | 13 ++++++++++++-
- 1 file changed, 12 insertions(+), 1 deletion(-)
-
-diff --git a/block/io.c b/block/io.c
-index 37df1e0253..84de5ab420 100644
---- a/block/io.c
-+++ b/block/io.c
-@@ -1920,7 +1920,18 @@ bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int64_t bytes,
- assert(!bs->supported_zero_flags);
- }
-
-- if (ret == -ENOTSUP && !(flags & BDRV_REQ_NO_FALLBACK)) {
-+ /*
-+ * TODO The ret == -EINVAL && num < alignment case is a workaround for
-+ * when request_alignment is 1 on files with cache=writeback. The Linux
-+ * ioctl(BLKZEROOUT) requires block alignment and will fail with
-+ * EINVAL. The block layer should align the request to
-+ * write_zeroes_alignment instead of trying the syscall, failing, and
-+ * falling back to a bounce buffer. Doing that is not easy so for now
-+ * we use a bounce buffer:
-+ * https://lore.kernel.org/qemu-devel/20260109120837.2772961-1-f.ebner@proxmox.com/
-+ */
-+ if ((ret == -ENOTSUP || (ret == -EINVAL && num < alignment)) &&
-+ !(flags & BDRV_REQ_NO_FALLBACK)) {
- /* Fall back to bounce buffer if write zeroes is unsupported */
- BdrvRequestFlags write_flags = flags & ~BDRV_REQ_ZERO_WRITE;
-
---
-2.52.0
-
diff --git a/kvm-block-io_uring-avoid-potentially-getting-stuck-after.patch b/kvm-block-io_uring-avoid-potentially-getting-stuck-after.patch
deleted file mode 100644
index 918862f..0000000
--- a/kvm-block-io_uring-avoid-potentially-getting-stuck-after.patch
+++ /dev/null
@@ -1,167 +0,0 @@
-From 4ad89aa6a9efcbc0420e332acab2dd06e55be2fa Mon Sep 17 00:00:00 2001
-From: Fiona Ebner <f.ebner@proxmox.com>
-Date: Tue, 25 Nov 2025 14:31:03 +0100
-Subject: [PATCH 3/4] block/io_uring: avoid potentially getting stuck after
- resubmit at the end of ioq_submit()
-
-RH-Author: Hanna Czenczek <hreitz@redhat.com>
-RH-MergeRequest: 479: linux-aio/io-uring: Resubmit tails of short requests
-RH-Jira: RHEL-158224
-RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [3/4] fd599da3ffcd6b37ceff35587ae9dbc1698b0f57 (hreitz/qemu-kvm-c-9-s)
-
-Note that this issue seems already fixed as a consequence of the large
-io_uring rework with 047dabef97 ("block/io_uring: use aio_add_sqe()")
-in current master, so this is purely for QEMU stable branches.
-
-At the end of ioq_submit(), there is an opportunistic call to
-luring_process_completions(). This is the single caller of
-luring_process_completions() that doesn't use the
-luring_process_completions_and_submit() wrapper.
-
-Other callers use the wrapper, because luring_process_completions()
-might require a subsequent call to ioq_submit() after resubmitting a
-request. As noted for luring_resubmit():
-
-> Resubmit a request by appending it to submit_queue. The caller must ensure
-> that ioq_submit() is called later so that submit_queue requests are started.
-
-So the caller at the end of ioq_submit() violates the contract and can
-in fact be problematic if no other requests come in later. In such a
-case, the request intended to be resubmitted will never be actually be
-submitted via io_uring_submit().
-
-A reproducer exposing this issue is [0], which is based on user
-reports from [1]. Another reproducer is iotest 109 with '-i io_uring'.
-
-I had the most success to trigger the issue with [0] when using a
-BTRFS RAID 1 storage. With tmpfs, it can take quite a few iterations,
-but also triggers eventually on my machine. With iotest 109 with '-i
-io_uring' the issue triggers reliably on my ext4 file system.
-
-Have ioq_submit() submit any resubmitted requests after calling
-luring_process_completions(). The return value from io_uring_submit()
-is checked to be non-negative before the opportunistic processing of
-completions and going for the new resubmit logic, to ensure that a
-failure of io_uring_submit() is not missed. Also note that the return
-value already was not necessarily the total number of submissions,
-since the loop might've been iterated more than once even before the
-current change.
-
-Only trigger the resubmission logic if it is actually necessary to
-avoid changing behavior more than necessary. For example iotest 109
-would produce more 'mirror ready' events if always resubmitting after
-luring_process_completions() at the end of ioq_submit().
-
-Note iotest 109 still does not pass as is when run with '-i io_uring',
-because of two offset values for BLOCK_JOB_COMPLETED events being zero
-instead of non-zero as in the expected output. Note that the two
-affected test cases are expected failures and still fail, so they just
-fail "faster". The test cases are actually not triggering the resubmit
-logic, so the reason seems to be different ordering of requests and
-completions of the current aio=io_uring implementation versus
-aio=threads.
-
-[0]:
-
-> #!/bin/bash -e
-> #file=/mnt/btrfs/disk.raw
-> file=/tmp/disk.raw
-> filesize=256
-> readsize=512
-> rm -f $file
-> truncate -s $filesize $file
-> ./qemu-system-x86_64 --trace '*uring*' --qmp stdio \
-> --blockdev raw,node-name=node0,file.driver=file,file.cache.direct=off,file.filename=$file,file.aio=io_uring \
-> <<EOF
-> {"execute": "qmp_capabilities"}
-> {"execute": "human-monitor-command", "arguments": { "command-line": "qemu-io node0 \"read 0 $readsize \"" }}
-> {"execute": "quit"}
-> EOF
-
-[1]: https://forum.proxmox.com/threads/170045/
-
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-(cherry picked from commit 2bb0153cd806b8f6b4f82b353bd0113cd1c488a5)
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
----
- block/io_uring.c | 16 +++++++++++++---
- 1 file changed, 13 insertions(+), 3 deletions(-)
-
-diff --git a/block/io_uring.c b/block/io_uring.c
-index dd4f304910..5dbafc8f7b 100644
---- a/block/io_uring.c
-+++ b/block/io_uring.c
-@@ -120,11 +120,14 @@ static void luring_resubmit_short_read(LuringState *s, LuringAIOCB *luringcb,
- * event loop. When there are no events left to complete the BH is being
- * canceled.
- *
-+ * Returns whether ioq_submit() must be called again afterwards since requests
-+ * were resubmitted via luring_resubmit().
- */
--static void luring_process_completions(LuringState *s)
-+static bool luring_process_completions(LuringState *s)
- {
- struct io_uring_cqe *cqes;
- int total_bytes;
-+ bool resubmit = false;
-
- defer_call_begin();
-
-@@ -182,6 +185,7 @@ static void luring_process_completions(LuringState *s)
- */
- if (ret == -EINTR || ret == -EAGAIN) {
- luring_resubmit(s, luringcb);
-+ resubmit = true;
- continue;
- }
- } else if (!luringcb->qiov) {
-@@ -194,6 +198,7 @@ static void luring_process_completions(LuringState *s)
- if (luringcb->is_read) {
- if (ret > 0) {
- luring_resubmit_short_read(s, luringcb, ret);
-+ resubmit = true;
- continue;
- } else {
- /* Pad with zeroes */
-@@ -224,6 +229,8 @@ end:
- qemu_bh_cancel(s->completion_bh);
-
- defer_call_end();
-+
-+ return resubmit;
- }
-
- static int ioq_submit(LuringState *s)
-@@ -231,6 +238,7 @@ static int ioq_submit(LuringState *s)
- int ret = 0;
- LuringAIOCB *luringcb, *luringcb_next;
-
-+resubmit:
- while (s->io_q.in_queue > 0) {
- /*
- * Try to fetch sqes from the ring for requests waiting in
-@@ -260,12 +268,14 @@ static int ioq_submit(LuringState *s)
- }
- s->io_q.blocked = (s->io_q.in_queue > 0);
-
-- if (s->io_q.in_flight) {
-+ if (ret >= 0 && s->io_q.in_flight) {
- /*
- * We can try to complete something just right away if there are
- * still requests in-flight.
- */
-- luring_process_completions(s);
-+ if (luring_process_completions(s)) {
-+ goto resubmit;
-+ }
- }
- return ret;
- }
---
-2.47.3
-
diff --git a/kvm-block-linux-aio-bound-ioq_submit-recursion-depth.patch b/kvm-block-linux-aio-bound-ioq_submit-recursion-depth.patch
deleted file mode 100644
index 8051503..0000000
--- a/kvm-block-linux-aio-bound-ioq_submit-recursion-depth.patch
+++ /dev/null
@@ -1,140 +0,0 @@
-From 9a6c4bad7f575826796a4c690a0fa6bbcda1f5ad Mon Sep 17 00:00:00 2001
-From: "Denis V. Lunev" <den@openvz.org>
-Date: Sat, 13 Jun 2026 23:03:08 +0300
-Subject: [PATCH 32/52] block/linux-aio: bound ioq_submit() recursion depth
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [25/45] 04545c714dacb2571f169b3da3c7cf493dea31bd (kmwolf/centos-qemu-kvm)
-
-qemu_laio_process_completions() wraps its body in defer_call_begin /
-defer_call_end. Inside the section, completion callbacks wake coroutines
-that queue new aiocbs; laio_do_submit() defers laio_deferred_fn. At the
-bottom of qemu_laio_process_completions() the defer_call_end() fires
-laio_deferred_fn, which calls ioq_submit(), closing the cycle:
-
- ioq_submit
- -> io_submit(2) // some sync completions
- -> qemu_laio_process_completions // defer_call_begin
- -> aio_co_wake // resumes coroutine
- -> laio_do_submit
- -> defer_call(laio_deferred_fn, s) // enqueued
- -> defer_call_end // nesting drops to 0
- -> laio_deferred_fn
- -> ioq_submit // +1 stack frame, loop
-
-When io_submit(2) returns asynchronously (O_DIRECT) the cycle
-terminates in one extra frame: the fresh aiocb is still in flight, no
-completion is drained, no coroutine wakes, no new submission queues.
-When submissions complete synchronously (non-O_DIRECT, or per-descriptor
-drivers such as vmdk) each level enqueues more work for the next
-defer_call_end() to drain, so recursion grows without bound and QEMU
-crashes with SIGSEGV on the thread guard page.
-
-The cycle was closed by two performance commits, each correct in
-isolation:
-
- 076682885d ("block/linux-aio: convert to blk_io_plug_call() API")
- -- introduced laio_deferred_fn and wired
- laio_do_submit -> defer_call(laio_deferred_fn, s).
-
- 84d61e5f36 ("virtio: use defer_call() in virtio_irqfd_notify()")
- -- added defer_call_begin/end around qemu_laio_process_completions
- so virtio-irqfd notifications batch across a completion pass.
-
-The supported aio=native + cache=none pairing keeps submissions
-asynchronous, so the cycle stays bounded; nothing in the code enforces
-that contract. Observed in production as a SIGSEGV during a backup job
-configured with --cached + aio=native; reproducible on upstream with
-qemu-io against vmdk.
-
-Cap ioq_submit() recursion with a counter on LaioQueue, which is only
-accessed from the AioContext home thread. On overflow, return without
-submitting. The pending work is drained by s->completion_bh, which
-qemu_laio_process_completions() has already scheduled on entry -- no
-work is lost; one event-loop round-trip of latency is paid only when
-the bound is hit, which cannot happen on a supported configuration.
-
-Signed-off-by: Denis V. Lunev <den@openvz.org>
-CC: Kevin Wolf <kwolf@redhat.com>
-CC: Hanna Reitz <hreitz@redhat.com>
-CC: Stefan Hajnoczi <stefanha@redhat.com>
-CC: Paolo Bonzini <pbonzini@redhat.com>
-Message-ID: <20260520142503.251959-2-den@openvz.org>
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-(cherry picked from commit 6864bec553b2e37699739615e604fc3c7bae0e1d)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-
-Message-ID: <20260613200411.1808021-25-mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/linux-aio.c | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/block/linux-aio.c b/block/linux-aio.c
-index 84397de54c..37de9b564b 100644
---- a/block/linux-aio.c
-+++ b/block/linux-aio.c
-@@ -36,6 +36,19 @@
- /* Maximum number of requests in a batch. (default value) */
- #define DEFAULT_MAX_BATCH 32
-
-+/*
-+ * Bound on how deep ioq_submit() may recurse on a single LaioQueue via the
-+ * ioq_submit -> qemu_laio_process_completions -> defer_call_end ->
-+ * laio_deferred_fn -> ioq_submit cycle. The cycle terminates naturally
-+ * when io_submit(2) returns asynchronously (O_DIRECT), but can grow
-+ * without bound when submissions complete synchronously. On overflow
-+ * the caller returns without submitting; the outermost
-+ * qemu_laio_process_completions() has already scheduled s->completion_bh
-+ * (via qemu_bh_schedule() at the top of that function), which resumes
-+ * submission from the next event-loop dispatch.
-+ */
-+#define IOQ_SUBMIT_MAX_DEPTH 8
-+
- struct qemu_laiocb {
- Coroutine *co;
- LinuxAioState *ctx;
-@@ -61,6 +74,7 @@ typedef struct {
- unsigned int in_queue;
- unsigned int in_flight;
- bool blocked;
-+ unsigned int submit_depth;
- QSIMPLEQ_HEAD(, qemu_laiocb) pending;
- } LaioQueue;
-
-@@ -331,6 +345,7 @@ static void ioq_init(LaioQueue *io_q)
- io_q->in_queue = 0;
- io_q->in_flight = 0;
- io_q->blocked = false;
-+ io_q->submit_depth = 0;
- }
-
- static void ioq_submit(LinuxAioState *s)
-@@ -340,6 +355,11 @@ static void ioq_submit(LinuxAioState *s)
- QEMU_UNINITIALIZED struct iocb *iocbs[MAX_EVENTS];
- QSIMPLEQ_HEAD(, qemu_laiocb) completed;
-
-+ if (s->io_q.submit_depth >= IOQ_SUBMIT_MAX_DEPTH) {
-+ return;
-+ }
-+ s->io_q.submit_depth++;
-+
- do {
- if (s->io_q.in_flight >= MAX_EVENTS) {
- break;
-@@ -385,6 +405,8 @@ static void ioq_submit(LinuxAioState *s)
- * pended requests will be submitted from there.
- */
- }
-+
-+ s->io_q.submit_depth--;
- }
-
- static uint64_t laio_max_batch(LinuxAioState *s, uint64_t dev_max_batch)
---
-2.52.0
-
diff --git a/kvm-block-mirror-check-range-when-setting-zero-bitmap-fo.patch b/kvm-block-mirror-check-range-when-setting-zero-bitmap-fo.patch
deleted file mode 100644
index 6663d1b..0000000
--- a/kvm-block-mirror-check-range-when-setting-zero-bitmap-fo.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 86b2caec2f830d34a03f4f55028a525bcf11d515 Mon Sep 17 00:00:00 2001
-From: Fiona Ebner <f.ebner@proxmox.com>
-Date: Mon, 12 Jan 2026 16:23:51 +0100
-Subject: [PATCH 44/52] block/mirror: check range when setting zero bitmap for
- sync write
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [37/45] 858e42b5e327560c28e10a151d4e46a9cf273363 (kmwolf/centos-qemu-kvm)
-
-Some Proxmox users reported an occasional assertion failure [0][1] in
-busy VMs when using drive mirror with active mode. In particular, the
-failure may occur for zero writes shorter than the job granularity:
-
-> #0 0x00007b421154b507 in abort ()
-> #1 0x00007b421154b420 in ?? ()
-> #2 0x0000641c582e061f in bitmap_set (map=0x7b4204014e00, start=14, nr=-1)
-> #3 0x0000641c58062824 in do_sync_target_write (job=0x641c7e73d1e0,
-> method=MIRROR_METHOD_ZERO, offset=852480, bytes=4096, qiov=0x0, flags=0)
-> #4 0x0000641c58062250 in bdrv_mirror_top_do_write (bs=0x641c7e62e1f0,
- method=MIRROR_METHOD_ZERO, copy_to_target=true, offset=852480,
- bytes=4096, qiov=0x0, flags=0)
-> #5 0x0000641c58061f31 in bdrv_mirror_top_pwrite_zeroes (bs=0x641c7e62e1f0,
- offset=852480, bytes=4096, flags=0)
-
-The range for the dirty bitmap described by dirty_bitmap_offset and
-dirty_bitmap_end is narrower than the original range and in fact,
-dirty_bitmap_end might be smaller than dirty_bitmap_offset. There
-already is a check for 'dirty_bitmap_offset < dirty_bitmap_end' before
-resetting the dirty bitmap. Add such a check for setting the zero
-bitmap too, which uses the same narrower range.
-
-[0]: https://forum.proxmox.com/threads/177981/
-[1]: https://bugzilla.proxmox.com/show_bug.cgi?id=7222
-
-Cc: qemu-stable@nongnu.org
-Fixes: 7e277545b9 ("mirror: Skip writing zeroes when target is already zero")
-Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
-Message-ID: <20260112152544.261923-1-f.ebner@proxmox.com>
-Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-(cherry picked from commit 4a7b1bd18d2e1a6b3796e177ae5df9b198264a0b)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/mirror.c | 9 ++++++---
- 1 file changed, 6 insertions(+), 3 deletions(-)
-
-diff --git a/block/mirror.c b/block/mirror.c
-index c87f1e205b..d22f168ff0 100644
---- a/block/mirror.c
-+++ b/block/mirror.c
-@@ -1515,9 +1515,12 @@ do_sync_target_write(MirrorBlockJob *job, MirrorMethod method,
- assert(!qiov);
- ret = blk_co_pwrite_zeroes(job->target, offset, bytes, flags);
- if (job->zero_bitmap && ret >= 0) {
-- bitmap_set(job->zero_bitmap, dirty_bitmap_offset / job->granularity,
-- (dirty_bitmap_end - dirty_bitmap_offset) /
-- job->granularity);
-+ if (dirty_bitmap_offset < dirty_bitmap_end) {
-+ bitmap_set(job->zero_bitmap,
-+ dirty_bitmap_offset / job->granularity,
-+ (dirty_bitmap_end - dirty_bitmap_offset) /
-+ job->granularity);
-+ }
- }
- break;
-
---
-2.52.0
-
diff --git a/kvm-block-mirror-fix-assertion-failure-upon-duplicate-co.patch b/kvm-block-mirror-fix-assertion-failure-upon-duplicate-co.patch
deleted file mode 100644
index ab63b65..0000000
--- a/kvm-block-mirror-fix-assertion-failure-upon-duplicate-co.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 65523fcaa292ec714b66fa2b91ce8f50cd27ab64 Mon Sep 17 00:00:00 2001
-From: Fiona Ebner <f.ebner@proxmox.com>
-Date: Wed, 11 Mar 2026 15:54:25 +0100
-Subject: [PATCH 46/52] block/mirror: fix assertion failure upon duplicate
- complete for job using 'replaces'
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [39/45] 31abb5c45002235fdabe5cebfb7bee05e1b3c653 (kmwolf/centos-qemu-kvm)
-
-If s->replace_blocker was already set by an earlier invocation of
-mirror_complete(), then there will be an assertion failure when
-error_setg() is called for it a second time. The bdrv_op_block_all()
-and bdrv_ref() operations should only be done a single time too.
-
-Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
-Message-Id: <20260311145717.668492-2-f.ebner@proxmox.com>
-Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-(cherry picked from commit 9ac85f4cc7995217db8f736733b990d6addcb036)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/mirror.c | 28 +++++++++++++++-------------
- 1 file changed, 15 insertions(+), 13 deletions(-)
-
-diff --git a/block/mirror.c b/block/mirror.c
-index d22f168ff0..089856f4a8 100644
---- a/block/mirror.c
-+++ b/block/mirror.c
-@@ -1276,23 +1276,25 @@ static void mirror_complete(Job *job, Error **errp)
- return;
- }
-
-- /* block all operations on to_replace bs */
-- if (s->replaces) {
-- s->to_replace = bdrv_find_node(s->replaces);
-- if (!s->to_replace) {
-- error_setg(errp, "Node name '%s' not found", s->replaces);
-- return;
-+ if (!s->should_complete) {
-+ /* block all operations on to_replace bs */
-+ if (s->replaces) {
-+ s->to_replace = bdrv_find_node(s->replaces);
-+ if (!s->to_replace) {
-+ error_setg(errp, "Node name '%s' not found", s->replaces);
-+ return;
-+ }
-+
-+ /* TODO Translate this into child freeze system. */
-+ error_setg(&s->replace_blocker,
-+ "block device is in use by block-job-complete");
-+ bdrv_op_block_all(s->to_replace, s->replace_blocker);
-+ bdrv_ref(s->to_replace);
- }
-
-- /* TODO Translate this into child freeze system. */
-- error_setg(&s->replace_blocker,
-- "block device is in use by block-job-complete");
-- bdrv_op_block_all(s->to_replace, s->replace_blocker);
-- bdrv_ref(s->to_replace);
-+ s->should_complete = true;
- }
-
-- s->should_complete = true;
--
- /* If the job is paused, it will be re-entered when it is resumed */
- WITH_JOB_LOCK_GUARD() {
- if (!job->paused) {
---
-2.52.0
-
diff --git a/kvm-block-remove-detached-header-option-from-opts-after-.patch b/kvm-block-remove-detached-header-option-from-opts-after-.patch
deleted file mode 100644
index b8c449b..0000000
--- a/kvm-block-remove-detached-header-option-from-opts-after-.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 3984b109d0b4e1a86c46d3b79641b08043e5d64a Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Fri, 19 Sep 2025 11:38:10 +0100
-Subject: [PATCH 16/52] block: remove 'detached-header' option from opts after
- use
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [9/45] 383bd840869b184dfe4588f930e2d924f6faec39 (kmwolf/centos-qemu-kvm)
-
-The code for creating LUKS devices references a 'detached-header'
-option in the QemuOpts data, but does not consume (remove) the
-option.
-
-Thus when the code later tries to convert the remaining unused
-QemuOpts into a QCryptoBlockCreateOptions struct, an error is
-reported by the QAPI code that 'detached-header' is not a valid
-field.
-
-This fixes a regression caused by
-
- commit e818c01ae6e7c54c7019baaf307be59d99ce80b9
- Author: Daniel P. Berrangé <berrange@redhat.com>
- Date: Mon Feb 19 15:12:59 2024 +0000
-
- qapi: drop unused QCryptoBlockCreateOptionsLUKS.detached-header
-
-which identified that the QAPI field was unused, but failed to
-realize the QemuOpts -> QCryptoBlockCreateOptions conversion
-was seeing the left-over 'detached-header' option which had not
-been removed from QemuOpts.
-
-This problem was identified by the 'luks-detached-header' I/O
-test, but unfortunately I/O tests are not run regularly for the
-LUKS format.
-
-Fixes: e818c01ae6e7c54c7019baaf307be59d99ce80b9
-Reported-by: Thomas Huth <thuth@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-Message-ID: <20250919103810.1513109-1-berrange@redhat.com>
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 6eda39a87f4fda78befa4085e3644e4440afc1dd)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/crypto.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/block/crypto.c b/block/crypto.c
-index d4226cc68a..17b4749a1e 100644
---- a/block/crypto.c
-+++ b/block/crypto.c
-@@ -792,7 +792,7 @@ block_crypto_co_create_opts_luks(BlockDriver *drv, const char *filename,
- char *buf = NULL;
- int64_t size;
- bool detached_hdr =
-- qemu_opt_get_bool(opts, "detached-header", false);
-+ qemu_opt_get_bool_del(opts, "detached-header", false);
- unsigned int cflags = 0;
- int ret;
- Error *local_err = NULL;
---
-2.52.0
-
diff --git a/kvm-block-throttle-groups-fix-deadlock-with-iolimits-and.patch b/kvm-block-throttle-groups-fix-deadlock-with-iolimits-and.patch
deleted file mode 100644
index db0a441..0000000
--- a/kvm-block-throttle-groups-fix-deadlock-with-iolimits-and.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-From 1c6a0b9352bf6eda335bd661869a46bc56d0c2fc Mon Sep 17 00:00:00 2001
-From: Dmitry Guryanov <dmitry.guryanov@gmail.com>
-Date: Mon, 8 Dec 2025 11:55:28 +0300
-Subject: [PATCH 20/52] block/throttle-groups: fix deadlock with iolimits and
- muliple iothreads
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [13/45] b36053836c5ced989f7b2495dbe170a36ad190c5 (kmwolf/centos-qemu-kvm)
-
-Details: https://gitlab.com/qemu-project/qemu/-/issues/3144
-
-The function schedule_next_request is called with tg->lock held and
-it may call throttle_group_co_restart_queue, which takes
-tgm->throttled_reqs_lock, qemu_co_mutex_lock may leave current
-coroutine if other iothread has taken the lock. If the next
-coroutine will call throttle_group_co_io_limits_intercept - it
-will try to take the mutex tg->lock which will never be released.
-
-Here is the backtrace of the iothread:
-Thread 30 (Thread 0x7f8aad1fd6c0 (LWP 24240) "IO iothread2"):
- #0 futex_wait (futex_word=0x5611adb7d828, expected=2, private=0) at ../sysdeps/nptl/futex-internal.h:146
- #1 __GI___lll_lock_wait (futex=futex@entry=0x5611adb7d828, private=0) at lowlevellock.c:49
- #2 0x00007f8ab5a97501 in lll_mutex_lock_optimized (mutex=0x5611adb7d828) at pthread_mutex_lock.c:48
- #3 ___pthread_mutex_lock (mutex=0x5611adb7d828) at pthread_mutex_lock.c:93
- #4 0x00005611823f5482 in qemu_mutex_lock_impl (mutex=0x5611adb7d828, file=0x56118289daca "../block/throttle-groups.c", line=372) at ../util/qemu-thread-posix.c:94
- #5 0x00005611822b0b39 in throttle_group_co_io_limits_intercept (tgm=0x5611af1bb4d8, bytes=4096, direction=THROTTLE_READ) at ../block/throttle-groups.c:372
- #6 0x00005611822473b1 in blk_co_do_preadv_part (blk=0x5611af1bb490, offset=15972311040, bytes=4096, qiov=0x7f8aa4000f98, qiov_offset=0, flags=BDRV_REQ_REGISTERED_BUF) at ../block/block-backend.c:1354
- #7 0x0000561182247fa0 in blk_aio_read_entry (opaque=0x7f8aa4005910) at ../block/block-backend.c:1619
- #8 0x000056118241952e in coroutine_trampoline (i0=-1543497424, i1=32650) at ../util/coroutine-ucontext.c:175
- #9 0x00007f8ab5a56f70 in ?? () at ../sysdeps/unix/sysv/linux/x86_64/__start_context.S:66 from target:/lib64/libc.so.6
- #10 0x00007f8aad1ef190 in ?? ()
- #11 0x0000000000000000 in ?? ()
-
-The lock is taken in line 386:
-(gdb) p tg.lock
-$1 = {lock = {__data = {__lock = 2, __count = 0, __owner = 24240, __nusers = 1, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}},
- __size = "\002\000\000\000\000\000\000\000\260^\000\000\001", '\000' <repeats 26 times>, __align = 2}, file = 0x56118289daca "../block/throttle-groups.c",
- line = 386, initialized = true}
-
-The solution is to use tg->lock to protect both ThreadGroup fields and
-ThrottleGroupMember.throttled_reqs. It doesn't seem to be possible
-to use separate locks because we need to first manipulate ThrottleGroup
-fields, then schedule next coroutine using throttled_reqs and after than
-update token field from ThrottleGroup depending on the throttled_reqs
-state.
-
-Signed-off-by: Dmitry Guryanov <dmitry.guryanov@gmail.com>
-Message-ID: <20251208085528.890098-1-dmitry.guryanov@gmail.com>
-Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit d4816177654d59e26ce212c436513f01842eb410)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/throttle-groups.c | 21 ++++++---------------
- include/block/throttle-groups.h | 3 +--
- 2 files changed, 7 insertions(+), 17 deletions(-)
-
-diff --git a/block/throttle-groups.c b/block/throttle-groups.c
-index 66fdce9a90..5329ff1fdb 100644
---- a/block/throttle-groups.c
-+++ b/block/throttle-groups.c
-@@ -295,19 +295,15 @@ static bool throttle_group_schedule_timer(ThrottleGroupMember *tgm,
- /* Start the next pending I/O request for a ThrottleGroupMember. Return whether
- * any request was actually pending.
- *
-+ * This assumes that tg->lock is held.
-+ *
- * @tgm: the current ThrottleGroupMember
- * @direction: the ThrottleDirection
- */
- static bool coroutine_fn throttle_group_co_restart_queue(ThrottleGroupMember *tgm,
- ThrottleDirection direction)
- {
-- bool ret;
--
-- qemu_co_mutex_lock(&tgm->throttled_reqs_lock);
-- ret = qemu_co_queue_next(&tgm->throttled_reqs[direction]);
-- qemu_co_mutex_unlock(&tgm->throttled_reqs_lock);
--
-- return ret;
-+ return qemu_co_queue_next(&tgm->throttled_reqs[direction]);
- }
-
- /* Look for the next pending I/O request and schedule it.
-@@ -378,12 +374,8 @@ void coroutine_fn throttle_group_co_io_limits_intercept(ThrottleGroupMember *tgm
- /* Wait if there's a timer set or queued requests of this type */
- if (must_wait || tgm->pending_reqs[direction]) {
- tgm->pending_reqs[direction]++;
-- qemu_mutex_unlock(&tg->lock);
-- qemu_co_mutex_lock(&tgm->throttled_reqs_lock);
- qemu_co_queue_wait(&tgm->throttled_reqs[direction],
-- &tgm->throttled_reqs_lock);
-- qemu_co_mutex_unlock(&tgm->throttled_reqs_lock);
-- qemu_mutex_lock(&tg->lock);
-+ &tg->lock);
- tgm->pending_reqs[direction]--;
- }
-
-@@ -410,15 +402,15 @@ static void coroutine_fn throttle_group_restart_queue_entry(void *opaque)
- ThrottleDirection direction = data->direction;
- bool empty_queue;
-
-+ qemu_mutex_lock(&tg->lock);
- empty_queue = !throttle_group_co_restart_queue(tgm, direction);
-
- /* If the request queue was empty then we have to take care of
- * scheduling the next one */
- if (empty_queue) {
-- qemu_mutex_lock(&tg->lock);
- schedule_next_request(tgm, direction);
-- qemu_mutex_unlock(&tg->lock);
- }
-+ qemu_mutex_unlock(&tg->lock);
-
- g_free(data);
-
-@@ -569,7 +561,6 @@ void throttle_group_register_tgm(ThrottleGroupMember *tgm,
- read_timer_cb,
- write_timer_cb,
- tgm);
-- qemu_co_mutex_init(&tgm->throttled_reqs_lock);
- }
-
- /* Unregister a ThrottleGroupMember from its group, removing it from the list,
-diff --git a/include/block/throttle-groups.h b/include/block/throttle-groups.h
-index 2355e8d9de..7dfc81f7b5 100644
---- a/include/block/throttle-groups.h
-+++ b/include/block/throttle-groups.h
-@@ -35,8 +35,7 @@
-
- typedef struct ThrottleGroupMember {
- AioContext *aio_context;
-- /* throttled_reqs_lock protects the CoQueues for throttled requests. */
-- CoMutex throttled_reqs_lock;
-+ /* Protected by ThrottleGroup.lock */
- CoQueue throttled_reqs[THROTTLE_MAX];
-
- /* Nonzero if the I/O limits are currently being ignored; generally
---
-2.52.0
-
diff --git a/kvm-block-use-pwrite_zeroes_alignment-when-writing-first.patch b/kvm-block-use-pwrite_zeroes_alignment-when-writing-first.patch
deleted file mode 100644
index b121dfd..0000000
--- a/kvm-block-use-pwrite_zeroes_alignment-when-writing-first.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From ca326a462336a694d317d03793b5f741125633b7 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Tue, 7 Oct 2025 10:16:59 -0400
-Subject: [PATCH 35/52] block: use pwrite_zeroes_alignment when writing first
- sector
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [28/45] aff37a9c095009b900cbf2d02ca378e21ec365aa (kmwolf/centos-qemu-kvm)
-
-Since commit 5634622bcb33 ("file-posix: allow BLKZEROOUT with -t
-writeback"), qemu-img create errors out on a Linux loop block device
-with a 4 KB sector size:
-
- # dd if=/dev/zero of=blockfile bs=1M count=1024
- # losetup --sector-size 4096 /dev/loop0 blockfile
- # qemu-img create -f raw /dev/loop0 1G
- Formatting '/dev/loop0', fmt=raw size=1073741824
- qemu-img: /dev/loop0: Failed to clear the new image's first sector: Invalid argument
-
-Use the pwrite_zeroes_alignment block limit to avoid misaligned
-fallocate(2) or ioctl(BLKZEROOUT) in the block/file-posix.c block
-driver.
-
-Cc: qemu-stable@nongnu.org
-Fixes: 5634622bcb33 ("file-posix: allow BLKZEROOUT with -t writeback")
-Reported-by: Jean-Louis Dupond <jean-louis@dupond.be>
-Buglink: https://gitlab.com/qemu-project/qemu/-/issues/3127
-Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Message-ID: <20251007141700.71891-3-stefanha@redhat.com>
-Tested-by: Fiona Ebner <f.ebner@proxmox.com>
-Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit d704a13d2c025779bc91d04e127427347ddcf3b3)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block.c | 3 ++-
- block/block-backend.c | 11 +++++++++++
- include/system/block-backend-io.h | 1 +
- 3 files changed, 14 insertions(+), 1 deletion(-)
-
-diff --git a/block.c b/block.c
-index 8848e9a7ed..be77e03904 100644
---- a/block.c
-+++ b/block.c
-@@ -606,12 +606,13 @@ create_file_fallback_zero_first_sector(BlockBackend *blk,
- int64_t current_size,
- Error **errp)
- {
-+ uint32_t alignment = blk_get_pwrite_zeroes_alignment(blk);
- int64_t bytes_to_clear;
- int ret;
-
- GLOBAL_STATE_CODE();
-
-- bytes_to_clear = MIN(current_size, BDRV_SECTOR_SIZE);
-+ bytes_to_clear = MIN(current_size, MAX(BDRV_SECTOR_SIZE, alignment));
- if (bytes_to_clear) {
- ret = blk_co_pwrite_zeroes(blk, 0, bytes_to_clear, BDRV_REQ_MAY_UNMAP);
- if (ret < 0) {
-diff --git a/block/block-backend.c b/block/block-backend.c
-index d97b26b743..850f2ecec2 100644
---- a/block/block-backend.c
-+++ b/block/block-backend.c
-@@ -2326,6 +2326,17 @@ uint32_t blk_get_request_alignment(BlockBackend *blk)
- return bs ? bs->bl.request_alignment : BDRV_SECTOR_SIZE;
- }
-
-+/* Returns the optimal write zeroes alignment, in bytes; guaranteed nonzero */
-+uint32_t blk_get_pwrite_zeroes_alignment(BlockBackend *blk)
-+{
-+ BlockDriverState *bs = blk_bs(blk);
-+ IO_CODE();
-+ if (!bs) {
-+ return BDRV_SECTOR_SIZE;
-+ }
-+ return bs->bl.pwrite_zeroes_alignment ?: bs->bl.request_alignment;
-+}
-+
- /* Returns the maximum hardware transfer length, in bytes; guaranteed nonzero */
- uint64_t blk_get_max_hw_transfer(BlockBackend *blk)
- {
-diff --git a/include/system/block-backend-io.h b/include/system/block-backend-io.h
-index 91c48299b7..fd84723d9d 100644
---- a/include/system/block-backend-io.h
-+++ b/include/system/block-backend-io.h
-@@ -118,6 +118,7 @@ BlockAIOCB *blk_abort_aio_request(BlockBackend *blk,
- void *opaque, int ret);
-
- uint32_t blk_get_request_alignment(BlockBackend *blk);
-+uint32_t blk_get_pwrite_zeroes_alignment(BlockBackend *blk);
- uint32_t blk_get_max_transfer(BlockBackend *blk);
- uint64_t blk_get_max_hw_transfer(BlockBackend *blk);
-
---
-2.52.0
-
diff --git a/kvm-block-vmdk-fix-OOB-read-in-vmdk_read_extent.patch b/kvm-block-vmdk-fix-OOB-read-in-vmdk_read_extent.patch
deleted file mode 100644
index 76f36f1..0000000
--- a/kvm-block-vmdk-fix-OOB-read-in-vmdk_read_extent.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 9aac9cce4de8006a02800a3a20caaf11e87fc767 Mon Sep 17 00:00:00 2001
-From: "Halil Oktay (oblivionsage)" <cookieandcream560@gmail.com>
-Date: Tue, 10 Feb 2026 13:33:25 +0100
-Subject: [PATCH 19/52] block/vmdk: fix OOB read in vmdk_read_extent()
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [12/45] 6af02246586e3e7a9a71a23df28a7ffb55110ead (kmwolf/centos-qemu-kvm)
-
-Bounds check for marker.size doesn't account for the 12-byte marker
-header, allowing zlib to read past the allocated buffer.
-
-Move the check inside the has_marker block and subtract the marker size.
-
-Fixes: CVE-2026-2243
-Reported-by: Halil Oktay (oblivionsage) <cookieandcream560@gmail.com>
-Signed-off-by: Halil Oktay (oblivionsage) <cookieandcream560@gmail.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit cfda94eddb6c9c49b66461c950b22845a46a75c9)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/vmdk.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/block/vmdk.c b/block/vmdk.c
-index 7b98debc2b..7176435fc5 100644
---- a/block/vmdk.c
-+++ b/block/vmdk.c
-@@ -1951,10 +1951,10 @@ vmdk_read_extent(VmdkExtent *extent, int64_t cluster_offset,
- marker = (VmdkGrainMarker *)cluster_buf;
- compressed_data = marker->data;
- data_len = le32_to_cpu(marker->size);
-- }
-- if (!data_len || data_len > buf_bytes) {
-- ret = -EINVAL;
-- goto out;
-+ if (!data_len || data_len > buf_bytes - sizeof(VmdkGrainMarker)) {
-+ ret = -EINVAL;
-+ goto out;
-+ }
- }
- ret = uncompress(uncomp_buf, &buf_len, compressed_data, data_len);
- if (ret != Z_OK) {
---
-2.52.0
-
diff --git a/kvm-commit-Drain-nodes-across-all-of-bdrv_commit.patch b/kvm-commit-Drain-nodes-across-all-of-bdrv_commit.patch
deleted file mode 100644
index 8af4c58..0000000
--- a/kvm-commit-Drain-nodes-across-all-of-bdrv_commit.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-From 43fe4a491f9843019d780bfc41db44e86602f184 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Mon, 27 Apr 2026 19:05:17 +0200
-Subject: [PATCH 47/52] commit: Drain nodes across all of bdrv_commit()
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [40/45] 29cfac9b1a72bf5d4b4497eb4096bc05d41e146e (kmwolf/centos-qemu-kvm)
-
-The whole implementation of bdrv_commit() is only correct if no new
-writes come in while it's running: It has only a single loop checking
-the allocation status for each block and finally calls bdrv_make_empty()
-without checking if that throws away any new changes.
-
-We already have to drain while taking the graph write lock. Just extend
-the drained section to all of bdrv_commit() to make sure that we don't
-get any inconsistencies.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260427170520.101242-2-kwolf@redhat.com>
-Reviewed-by: Denis V. Lunev <den@openvz.org>
-Tested-by: Denis V. Lunev <den@openvz.org>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit f0d9ccd46cf8fc576ab7d514f10f766546cdbc14)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/commit.c | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/block/commit.c b/block/commit.c
-index 0d9e1a16d7..c5e3ef03a2 100644
---- a/block/commit.c
-+++ b/block/commit.c
-@@ -518,6 +518,7 @@ int bdrv_commit(BlockDriverState *bs)
- if (!drv)
- return -ENOMEDIUM;
-
-+ bdrv_drain_all_begin();
- bdrv_graph_rdlock_main_loop();
-
- backing_file_bs = bdrv_cow_bs(bs);
-@@ -549,6 +550,10 @@ int bdrv_commit(BlockDriverState *bs)
- BLK_PERM_ALL);
- backing = blk_new(ctx, BLK_PERM_WRITE | BLK_PERM_RESIZE, BLK_PERM_ALL);
-
-+ /* We drained all nodes, but still make requests through BlockBackends */
-+ blk_set_disable_request_queuing(src, true);
-+ blk_set_disable_request_queuing(backing, true);
-+
- ret = blk_insert_bs(src, bs, &local_err);
- if (ret < 0) {
- error_report_err(local_err);
-@@ -565,7 +570,7 @@ int bdrv_commit(BlockDriverState *bs)
-
- bdrv_graph_rdunlock_main_loop();
-
-- bdrv_graph_wrlock_drained();
-+ bdrv_graph_wrlock();
- bdrv_set_backing_hd(commit_top_bs, backing_file_bs, &error_abort);
- bdrv_set_backing_hd(bs, commit_top_bs, &error_abort);
- bdrv_graph_wrunlock();
-@@ -647,7 +652,7 @@ ro_cleanup:
- blk_unref(backing);
-
- bdrv_graph_rdunlock_main_loop();
-- bdrv_graph_wrlock_drained();
-+ bdrv_graph_wrlock();
- if (bdrv_cow_bs(bs) != backing_file_bs) {
- bdrv_set_backing_hd(bs, backing_file_bs, &error_abort);
- }
-@@ -663,6 +668,7 @@ ro_cleanup:
-
- out:
- bdrv_graph_rdunlock_main_loop();
-+ bdrv_drain_all_end();
-
- return ret;
- }
---
-2.52.0
-
diff --git a/kvm-crypto-add-missing-free-of-certs-array.patch b/kvm-crypto-add-missing-free-of-certs-array.patch
deleted file mode 100644
index 79c932b..0000000
--- a/kvm-crypto-add-missing-free-of-certs-array.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 7b2ba3acaf2863de479f1672373a8f2eb03e9a5d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 18:06:54 +0000
-Subject: [PATCH 09/30] crypto: add missing free of certs array
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [8/27] 07f334a66ed05d4bf66fa39741811e753add604e (berrange/centos-src-qemu)
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 0de19c148a1d1ffda8f18b342adb6133237279e4)
----
- crypto/tlscredsx509.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 847fd4d9fa..75c70af522 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -550,6 +550,7 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
- for (i = 0; i < ncerts; i++) {
- gnutls_x509_crt_deinit(certs[i]);
- }
-+ g_free(certs);
- for (i = 0; i < ncacerts; i++) {
- gnutls_x509_crt_deinit(cacerts[i]);
- }
---
-2.52.0
-
diff --git a/kvm-crypto-allow-client-server-cert-chains.patch b/kvm-crypto-allow-client-server-cert-chains.patch
deleted file mode 100644
index 138f0d6..0000000
--- a/kvm-crypto-allow-client-server-cert-chains.patch
+++ /dev/null
@@ -1,393 +0,0 @@
-From be0e49b1012e5e30fbdabd4a6cee3e9ed4e94ef9 Mon Sep 17 00:00:00 2001
-From: matoro <matoro@users.noreply.github.com>
-Date: Mon, 13 Feb 2023 13:00:49 -0500
-Subject: [PATCH 05/30] crypto: allow client/server cert chains
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [4/27] 1ac4f7afc0600ca8c9d629477557de13ab1db7de (berrange/centos-src-qemu)
-
-The existing implementation assumes that client/server certificates are
-single individual certificates. If using publicly-issued certificates,
-or internal CAs that use an intermediate issuer, this is unlikely to be
-the case, and they will instead be certificate chains. While this can
-be worked around by moving the intermediate certificates to the CA
-certificate, which DOES currently support multiple certificates, this
-instead allows the issued certificate chains to be used as-is, without
-requiring the overhead of shuffling certificates around.
-
-Corresponding libvirt change is available here:
-https://gitlab.com/libvirt/libvirt/-/merge_requests/222
-
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Signed-off-by: matoro <matoro_mailinglist_qemu@matoro.tk>
-[DB: adapted for code conflicts with multi-CA patch]
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 87d6282e53a2db1915ea715cf9ee0634f6fb1c70)
----
- crypto/tlscredsx509.c | 157 ++++++++++++--------------
- tests/unit/test-crypto-tlscredsx509.c | 77 +++++++++++++
- 2 files changed, 147 insertions(+), 87 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 2eccd71b3c..86fdfce886 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -317,7 +317,8 @@ qcrypto_tls_creds_check_cert(QCryptoTLSCredsX509 *creds,
-
- static int
- qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
-- gnutls_x509_crt_t cert,
-+ gnutls_x509_crt_t *certs,
-+ unsigned int ncerts,
- gnutls_x509_crt_t *cacerts,
- unsigned int ncacerts,
- const char *cacertFile,
-@@ -325,9 +326,32 @@ qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
- bool isCA,
- Error **errp)
- {
-- gnutls_x509_crt_t cert_to_check = cert;
-+ gnutls_x509_crt_t cert_to_check = certs[ncerts - 1];
- int retval = 0;
-- gnutls_datum_t dn = {};
-+ gnutls_datum_t dn = {}, dnissuer = {};
-+
-+ for (int i = 0; i < (ncerts - 1); i++) {
-+ if (!gnutls_x509_crt_check_issuer(certs[i], certs[i + 1])) {
-+ retval = gnutls_x509_crt_get_dn2(certs[i], &dn);
-+ if (retval < 0) {
-+ error_setg(errp, "Unable to fetch cert DN: %s",
-+ gnutls_strerror(retval));
-+ return -1;
-+ }
-+ retval = gnutls_x509_crt_get_dn2(certs[i + 1], &dnissuer);
-+ if (retval < 0) {
-+ g_free(dn.data);
-+ error_setg(errp, "Unable to fetch cert DN: %s",
-+ gnutls_strerror(retval));
-+ return -1;
-+ }
-+ error_setg(errp, "Cert '%s' does not match issuer of cert '%s'",
-+ dnissuer.data, dn.data);
-+ g_free(dn.data);
-+ g_free(dnissuer.data);
-+ return -1;
-+ }
-+ }
-
- for (;;) {
- gnutls_x509_crt_t cert_issuer = NULL;
-@@ -373,7 +397,8 @@ qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
- }
-
- static int
--qcrypto_tls_creds_check_cert_pair(gnutls_x509_crt_t cert,
-+qcrypto_tls_creds_check_cert_pair(gnutls_x509_crt_t *certs,
-+ size_t ncerts,
- const char *certFile,
- gnutls_x509_crt_t *cacerts,
- size_t ncacerts,
-@@ -383,7 +408,7 @@ qcrypto_tls_creds_check_cert_pair(gnutls_x509_crt_t cert,
- {
- unsigned int status;
-
-- if (gnutls_x509_crt_list_verify(&cert, 1,
-+ if (gnutls_x509_crt_list_verify(certs, ncerts,
- cacerts, ncacerts,
- NULL, 0,
- 0, &status) < 0) {
-@@ -425,66 +450,14 @@ qcrypto_tls_creds_check_cert_pair(gnutls_x509_crt_t cert,
- }
-
-
--static gnutls_x509_crt_t
--qcrypto_tls_creds_load_cert(QCryptoTLSCredsX509 *creds,
-- const char *certFile,
-- bool isServer,
-- Error **errp)
--{
-- gnutls_datum_t data;
-- gnutls_x509_crt_t cert = NULL;
-- g_autofree char *buf = NULL;
-- gsize buflen;
-- GError *gerr = NULL;
-- int ret = -1;
-- int err;
--
-- trace_qcrypto_tls_creds_x509_load_cert(creds, isServer, certFile);
--
-- err = gnutls_x509_crt_init(&cert);
-- if (err < 0) {
-- error_setg(errp, "Unable to initialize certificate: %s",
-- gnutls_strerror(err));
-- goto cleanup;
-- }
--
-- if (!g_file_get_contents(certFile, &buf, &buflen, &gerr)) {
-- error_setg(errp, "Cannot load CA cert list %s: %s",
-- certFile, gerr->message);
-- g_error_free(gerr);
-- goto cleanup;
-- }
--
-- data.data = (unsigned char *)buf;
-- data.size = strlen(buf);
--
-- err = gnutls_x509_crt_import(cert, &data, GNUTLS_X509_FMT_PEM);
-- if (err < 0) {
-- error_setg(errp, isServer ?
-- "Unable to import server certificate %s: %s" :
-- "Unable to import client certificate %s: %s",
-- certFile,
-- gnutls_strerror(err));
-- goto cleanup;
-- }
--
-- ret = 0;
--
-- cleanup:
-- if (ret != 0) {
-- gnutls_x509_crt_deinit(cert);
-- cert = NULL;
-- }
-- return cert;
--}
--
--
- static int
--qcrypto_tls_creds_load_ca_cert_list(QCryptoTLSCredsX509 *creds,
-- const char *certFile,
-- gnutls_x509_crt_t **certs,
-- unsigned int *ncerts,
-- Error **errp)
-+qcrypto_tls_creds_load_cert_list(QCryptoTLSCredsX509 *creds,
-+ const char *certFile,
-+ gnutls_x509_crt_t **certs,
-+ unsigned int *ncerts,
-+ bool isServer,
-+ bool isCA,
-+ Error **errp)
- {
- gnutls_datum_t data;
- g_autofree char *buf = NULL;
-@@ -507,7 +480,9 @@ qcrypto_tls_creds_load_ca_cert_list(QCryptoTLSCredsX509 *creds,
- if (gnutls_x509_crt_list_import2(certs, ncerts, &data,
- GNUTLS_X509_FMT_PEM, 0) < 0) {
- error_setg(errp,
-- "Unable to import CA certificate list %s",
-+ isCA ? "Unable to import CA certificate list %s" :
-+ (isServer ? "Unable to import server certificate %s" :
-+ "Unable to import client certificate %s"),
- certFile);
- return -1;
- }
-@@ -523,7 +498,8 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
- const char *certFile,
- Error **errp)
- {
-- gnutls_x509_crt_t cert = NULL;
-+ gnutls_x509_crt_t *certs = NULL;
-+ unsigned int ncerts = 0;
- gnutls_x509_crt_t *cacerts = NULL;
- unsigned int ncacerts = 0;
- size_t i;
-@@ -531,41 +507,48 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
-
- if (certFile &&
- access(certFile, R_OK) == 0) {
-- cert = qcrypto_tls_creds_load_cert(creds,
-- certFile, isServer,
-- errp);
-- if (!cert) {
-+ if (qcrypto_tls_creds_load_cert_list(creds,
-+ certFile,
-+ &certs,
-+ &ncerts,
-+ isServer,
-+ false,
-+ errp) < 0) {
- goto cleanup;
- }
- }
- if (access(cacertFile, R_OK) == 0) {
-- if (qcrypto_tls_creds_load_ca_cert_list(creds,
-- cacertFile,
-- &cacerts,
-- &ncacerts,
-- errp) < 0) {
-+ if (qcrypto_tls_creds_load_cert_list(creds,
-+ cacertFile,
-+ &cacerts,
-+ &ncacerts,
-+ isServer,
-+ true,
-+ errp) < 0) {
- goto cleanup;
- }
- }
-
-- if (cert &&
-- qcrypto_tls_creds_check_cert(creds,
-- cert, certFile, isServer,
-- false, errp) < 0) {
-- goto cleanup;
-+ for (i = 0; i < ncerts; i++) {
-+ if (qcrypto_tls_creds_check_cert(creds,
-+ certs[i], certFile,
-+ isServer, i != 0, errp) < 0) {
-+ goto cleanup;
-+ }
- }
-
-- if (cert &&
-- qcrypto_tls_creds_check_authority_chain(creds, cert,
-+ if (ncerts &&
-+ qcrypto_tls_creds_check_authority_chain(creds,
-+ certs, ncerts,
- cacerts, ncacerts,
- cacertFile, isServer,
- true, errp) < 0) {
- goto cleanup;
- }
-
-- if (cert && ncacerts &&
-- qcrypto_tls_creds_check_cert_pair(cert, certFile, cacerts,
-- ncacerts, cacertFile,
-+ if (ncerts && ncacerts &&
-+ qcrypto_tls_creds_check_cert_pair(certs, ncerts, certFile,
-+ cacerts, ncacerts, cacertFile,
- isServer, errp) < 0) {
- goto cleanup;
- }
-@@ -573,8 +556,8 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
- ret = 0;
-
- cleanup:
-- if (cert) {
-- gnutls_x509_crt_deinit(cert);
-+ for (i = 0; i < ncerts; i++) {
-+ gnutls_x509_crt_deinit(certs[i]);
- }
- for (i = 0; i < ncacerts; i++) {
- gnutls_x509_crt_deinit(cacerts[i]);
-diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c
-index d8bc3be491..a84df01e51 100644
---- a/tests/unit/test-crypto-tlscredsx509.c
-+++ b/tests/unit/test-crypto-tlscredsx509.c
-@@ -577,6 +577,12 @@ int main(int argc, char **argv)
- true, true, GNUTLS_KEY_KEY_CERT_SIGN,
- false, false, NULL, NULL,
- 0, 0);
-+ TLS_ROOT_REQ(someotherrootreq,
-+ "UK", "some other random CA", NULL, NULL, NULL, NULL,
-+ true, true, true,
-+ true, true, GNUTLS_KEY_KEY_CERT_SIGN,
-+ false, false, NULL, NULL,
-+ 0, 0);
- TLS_CERT_REQ(cacertlevel1areq, cacertrootreq,
- "UK", "qemu level 1a", NULL, NULL, NULL, NULL,
- true, true, true,
-@@ -623,6 +629,32 @@ int main(int argc, char **argv)
- cacertlevel2areq.crt,
- };
-
-+ gnutls_x509_crt_t cabundle[] = {
-+ someotherrootreq.crt,
-+ cacertrootreq.crt,
-+ };
-+
-+ gnutls_x509_crt_t servercertchain[] = {
-+ servercertlevel3areq.crt,
-+ cacertlevel2areq.crt,
-+ cacertlevel1areq.crt,
-+ };
-+
-+ gnutls_x509_crt_t servercertchain_incomplete[] = {
-+ servercertlevel3areq.crt,
-+ cacertlevel2areq.crt,
-+ };
-+
-+ gnutls_x509_crt_t servercertchain_unsorted[] = {
-+ servercertlevel3areq.crt,
-+ cacertlevel1areq.crt,
-+ cacertlevel2areq.crt,
-+ };
-+
-+ gnutls_x509_crt_t clientcertchain[] = {
-+ clientcertlevel2breq.crt,
-+ cacertlevel1breq.crt,
-+ };
-
- test_tls_write_cert_chain(WORKDIR "cacertchain-ctx.pem",
- certchain,
-@@ -662,6 +694,46 @@ int main(int argc, char **argv)
- WORKDIR "cacertchain-incomplete-ctx.pem",
- servercertlevel3areq.filename, true);
-
-+ test_tls_write_cert_chain(WORKDIR "servercertchain-ctx.pem",
-+ servercertchain,
-+ G_N_ELEMENTS(servercertchain));
-+
-+ TLS_TEST_REG(serverchain, true,
-+ cacertrootreq.filename,
-+ WORKDIR "servercertchain-ctx.pem", false);
-+
-+ test_tls_write_cert_chain(WORKDIR "cabundle-ctx.pem",
-+ cabundle,
-+ G_N_ELEMENTS(cabundle));
-+
-+ TLS_TEST_REG(multiplecaswithchain, true,
-+ WORKDIR "cabundle-ctx.pem",
-+ WORKDIR "servercertchain-ctx.pem", false);
-+
-+ test_tls_write_cert_chain(WORKDIR "servercertchain_incomplete-ctx.pem",
-+ servercertchain_incomplete,
-+ G_N_ELEMENTS(servercertchain_incomplete));
-+
-+ TLS_TEST_REG(incompleteserverchain, true,
-+ cacertrootreq.filename,
-+ WORKDIR "servercertchain_incomplete-ctx.pem", true);
-+
-+ test_tls_write_cert_chain(WORKDIR "servercertchain_unsorted-ctx.pem",
-+ servercertchain_unsorted,
-+ G_N_ELEMENTS(servercertchain_unsorted));
-+
-+ TLS_TEST_REG(unsortedserverchain, true,
-+ cacertrootreq.filename,
-+ WORKDIR "servercertchain_unsorted-ctx.pem", true);
-+
-+ test_tls_write_cert_chain(WORKDIR "clientcertchain-ctx.pem",
-+ clientcertchain,
-+ G_N_ELEMENTS(clientcertchain));
-+
-+ TLS_TEST_REG(clientchain, false,
-+ cacertrootreq.filename,
-+ WORKDIR "clientcertchain-ctx.pem", false);
-+
- /* Some missing certs - first two are fatal, the last
- * is ok
- */
-@@ -731,8 +803,13 @@ int main(int argc, char **argv)
- test_tls_discard_cert(&cacertlevel2areq);
- test_tls_discard_cert(&servercertlevel3areq);
- test_tls_discard_cert(&clientcertlevel2breq);
-+ test_tls_discard_cert(&someotherrootreq);
- unlink(WORKDIR "cacertchain-ctx.pem");
- unlink(WORKDIR "cacertchain-with-invalid-ctx.pem");
-+ unlink(WORKDIR "servercertchain-ctx.pem");
-+ unlink(WORKDIR "servercertchain_incomplete-ctx.pem");
-+ unlink(WORKDIR "servercertchain_unsorted-ctx.pem");
-+ unlink(WORKDIR "clientcertchain-ctx.pem");
-
- test_tls_cleanup(KEYFILE);
- rmdir(WORKDIR);
---
-2.52.0
-
diff --git a/kvm-crypto-avoid-loading-the-CA-certs-twice.patch b/kvm-crypto-avoid-loading-the-CA-certs-twice.patch
deleted file mode 100644
index 2a22215..0000000
--- a/kvm-crypto-avoid-loading-the-CA-certs-twice.patch
+++ /dev/null
@@ -1,301 +0,0 @@
-From c059aad1f8421066b0d7b3e48da8e75f7bad5de6 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 18:29:11 +0000
-Subject: [PATCH 24/30] crypto: avoid loading the CA certs twice
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [23/27] 0cc29b2a69da63e04bfc69700af804a277836e57 (berrange/centos-src-qemu)
-
-The x509 TLS credentials code will load the CA certs once to perform
-sanity chcking on the certs, then discard the certificate objects
-and let gnutls load them a second time.
-
-This introduces a new QCryptoTLSCredsX509Files struct which will
-hold the CA certificates loaded for sanity checking and pass them on
-to gnutls, avoiding the duplicated loading.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit aeac275c114b52151642488dfcc7894631256289)
----
- crypto/tlscredsx509.c | 141 ++++++++++++++++++++++++++----------------
- 1 file changed, 87 insertions(+), 54 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index e28fcdc6ff..911942a1a1 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -40,6 +40,35 @@ struct QCryptoTLSCredsX509 {
- #include <gnutls/x509.h>
-
-
-+typedef struct QCryptoTLSCredsX509Files QCryptoTLSCredsX509Files;
-+struct QCryptoTLSCredsX509Files {
-+ char *cacertpath;
-+ gnutls_x509_crt_t *cacerts;
-+ unsigned int ncacerts;
-+};
-+
-+static QCryptoTLSCredsX509Files *
-+qcrypto_tls_creds_x509_files_new(void)
-+{
-+ return g_new0(QCryptoTLSCredsX509Files, 1);
-+}
-+
-+
-+static void
-+qcrypto_tls_creds_x509_files_free(QCryptoTLSCredsX509Files *files)
-+{
-+ size_t i;
-+ for (i = 0; i < files->ncacerts; i++) {
-+ gnutls_x509_crt_deinit(files->cacerts[i]);
-+ }
-+ g_free(files->cacerts);
-+ g_free(files->cacertpath);
-+ g_free(files);
-+}
-+
-+G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoTLSCredsX509Files,
-+ qcrypto_tls_creds_x509_files_free);
-+
- static int
- qcrypto_tls_creds_check_cert_times(gnutls_x509_crt_t cert,
- const char *certFile,
-@@ -315,11 +344,9 @@ qcrypto_tls_creds_check_cert(QCryptoTLSCredsX509 *creds,
-
- static int
- qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
-+ QCryptoTLSCredsX509Files *files,
- gnutls_x509_crt_t *certs,
- unsigned int ncerts,
-- gnutls_x509_crt_t *cacerts,
-- unsigned int ncacerts,
-- const char *cacertFile,
- bool isServer,
- Error **errp)
- {
-@@ -360,13 +387,13 @@ qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
- * reached the root of trust.
- */
- return qcrypto_tls_creds_check_cert(
-- creds, cert_to_check, cacertFile,
-+ creds, cert_to_check, files->cacertpath,
- isServer, true, errp);
- }
-- for (int i = 0; i < ncacerts; i++) {
-+ for (int i = 0; i < files->ncacerts; i++) {
- if (gnutls_x509_crt_check_issuer(cert_to_check,
-- cacerts[i])) {
-- cert_issuer = cacerts[i];
-+ files->cacerts[i])) {
-+ cert_issuer = files->cacerts[i];
- break;
- }
- }
-@@ -374,7 +401,7 @@ qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
- break;
- }
-
-- if (qcrypto_tls_creds_check_cert(creds, cert_issuer, cacertFile,
-+ if (qcrypto_tls_creds_check_cert(creds, cert_issuer, files->cacertpath,
- isServer, true, errp) < 0) {
- return -1;
- }
-@@ -394,19 +421,17 @@ qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
- }
-
- static int
--qcrypto_tls_creds_check_cert_pair(gnutls_x509_crt_t *certs,
-+qcrypto_tls_creds_check_cert_pair(QCryptoTLSCredsX509Files *files,
-+ gnutls_x509_crt_t *certs,
- size_t ncerts,
- const char *certFile,
-- gnutls_x509_crt_t *cacerts,
-- size_t ncacerts,
-- const char *cacertFile,
- bool isServer,
- Error **errp)
- {
- unsigned int status;
-
- if (gnutls_x509_crt_list_verify(certs, ncerts,
-- cacerts, ncacerts,
-+ files->cacerts, files->ncacerts,
- NULL, 0,
- 0, &status) < 0) {
- error_setg(errp, isServer ?
-@@ -414,7 +439,7 @@ qcrypto_tls_creds_check_cert_pair(gnutls_x509_crt_t *certs,
- "CA certificate %s" :
- "Unable to verify client certificate %s against "
- "CA certificate %s",
-- certFile, cacertFile);
-+ certFile, files->cacertpath);
- return -1;
- }
-
-@@ -439,7 +464,7 @@ qcrypto_tls_creds_check_cert_pair(gnutls_x509_crt_t *certs,
-
- error_setg(errp,
- "Our own certificate %s failed validation against %s: %s",
-- certFile, cacertFile, reason);
-+ certFile, files->cacertpath, reason);
- return -1;
- }
-
-@@ -490,15 +515,13 @@ qcrypto_tls_creds_load_cert_list(QCryptoTLSCredsX509 *creds,
-
- static int
- qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
-+ QCryptoTLSCredsX509Files *files,
- bool isServer,
-- const char *cacertFile,
- const char *certFile,
- Error **errp)
- {
- gnutls_x509_crt_t *certs = NULL;
- unsigned int ncerts = 0;
-- gnutls_x509_crt_t *cacerts = NULL;
-- unsigned int ncacerts = 0;
- size_t i;
- int ret = -1;
-
-@@ -514,16 +537,6 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
- }
- }
-
-- if (qcrypto_tls_creds_load_cert_list(creds,
-- cacertFile,
-- &cacerts,
-- &ncacerts,
-- isServer,
-- true,
-- errp) < 0) {
-- goto cleanup;
-- }
--
- for (i = 0; i < ncerts; i++) {
- if (qcrypto_tls_creds_check_cert(creds,
- certs[i], certFile,
-@@ -533,17 +546,14 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
- }
-
- if (ncerts &&
-- qcrypto_tls_creds_check_authority_chain(creds,
-+ qcrypto_tls_creds_check_authority_chain(creds, files,
- certs, ncerts,
-- cacerts, ncacerts,
-- cacertFile, isServer,
-- errp) < 0) {
-+ isServer, errp) < 0) {
- goto cleanup;
- }
-
-- if (ncerts && ncacerts &&
-- qcrypto_tls_creds_check_cert_pair(certs, ncerts, certFile,
-- cacerts, ncacerts, cacertFile,
-+ if (ncerts &&
-+ qcrypto_tls_creds_check_cert_pair(files, certs, ncerts, certFile,
- isServer, errp) < 0) {
- goto cleanup;
- }
-@@ -555,21 +565,53 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
- gnutls_x509_crt_deinit(certs[i]);
- }
- g_free(certs);
-- for (i = 0; i < ncacerts; i++) {
-- gnutls_x509_crt_deinit(cacerts[i]);
-- }
-- g_free(cacerts);
-
- return ret;
- }
-
-
-+static int
-+qcrypto_tls_creds_x509_load_ca(QCryptoTLSCredsX509 *creds,
-+ QCryptoTLSCredsBox *box,
-+ QCryptoTLSCredsX509Files *files,
-+ bool isServer,
-+ Error **errp)
-+{
-+ int ret;
-+
-+ if (qcrypto_tls_creds_get_path(&creds->parent_obj,
-+ QCRYPTO_TLS_CREDS_X509_CA_CERT,
-+ true, &files->cacertpath, errp) < 0) {
-+ return -1;
-+ }
-+
-+ if (qcrypto_tls_creds_load_cert_list(creds,
-+ files->cacertpath,
-+ &files->cacerts,
-+ &files->ncacerts,
-+ isServer,
-+ true,
-+ errp) < 0) {
-+ return -1;
-+ }
-+
-+ ret = gnutls_certificate_set_x509_trust(box->data.cert,
-+ files->cacerts, files->ncacerts);
-+ if (ret < 0) {
-+ error_setg(errp, "Cannot set CA certificate '%s': %s",
-+ files->cacertpath, gnutls_strerror(ret));
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
- static int
- qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- Error **errp)
- {
- g_autoptr(QCryptoTLSCredsBox) box = NULL;
-- g_autofree char *cacert = NULL;
-+ g_autoptr(QCryptoTLSCredsX509Files) files = NULL;
- g_autofree char *cacrl = NULL;
- g_autofree char *cert = NULL;
- g_autofree char *key = NULL;
-@@ -598,9 +640,9 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- return -1;
- }
-
-- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
-- QCRYPTO_TLS_CREDS_X509_CA_CERT,
-- true, &cacert, errp) < 0) {
-+ files = qcrypto_tls_creds_x509_files_new();
-+
-+ if (qcrypto_tls_creds_x509_load_ca(creds, box, files, isServer, errp) < 0) {
- return -1;
- }
-
-@@ -631,17 +673,8 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- }
-
- if (creds->sanityCheck &&
-- qcrypto_tls_creds_x509_sanity_check(creds, isServer,
-- cacert, cert, errp) < 0) {
-- return -1;
-- }
--
-- ret = gnutls_certificate_set_x509_trust_file(box->data.cert,
-- cacert,
-- GNUTLS_X509_FMT_PEM);
-- if (ret < 0) {
-- error_setg(errp, "Cannot load CA certificate '%s': %s",
-- cacert, gnutls_strerror(ret));
-+ qcrypto_tls_creds_x509_sanity_check(creds, files, isServer,
-+ cert, errp) < 0) {
- return -1;
- }
-
---
-2.52.0
-
diff --git a/kvm-crypto-avoid-loading-the-identity-certs-twice.patch b/kvm-crypto-avoid-loading-the-identity-certs-twice.patch
deleted file mode 100644
index ae2097f..0000000
--- a/kvm-crypto-avoid-loading-the-identity-certs-twice.patch
+++ /dev/null
@@ -1,411 +0,0 @@
-From ee1965779d97630adb7535ad311ca78f02737c76 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 18:29:11 +0000
-Subject: [PATCH 25/30] crypto: avoid loading the identity certs twice
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [24/27] df186b3d0b905f000749c5ace21fde32e77b56bc (berrange/centos-src-qemu)
-
-The x509 TLS credentials code will load the identity certs once to
-perform sanity chcking on the certs, then discard the certificate
-objects and let gnutls load them a second time.
-
-This extends the previous QCryptoTLSCredsX509Files struct to also
-hold the identity certificates & key loaded for sanity checking
-and pass them on to gnutls, avoiding the duplicated loading.
-
-The unit tests need updating because we now correctly diagnose the
-error scenario where the cert PEM file exists, without its matching
-key PEM file. Previously that error was mistakenly ignored.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 8031b5fb1a6efb57df36d41917932516894ae641)
----
- crypto/tlscredsx509.c | 246 +++++++++++++++++---------
- tests/unit/test-crypto-tlscredsx509.c | 8 +-
- 2 files changed, 164 insertions(+), 90 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 911942a1a1..c016633d65 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -45,6 +45,12 @@ struct QCryptoTLSCredsX509Files {
- char *cacertpath;
- gnutls_x509_crt_t *cacerts;
- unsigned int ncacerts;
-+
-+ char *certpath;
-+ char *keypath;
-+ gnutls_x509_crt_t *certs;
-+ unsigned int ncerts;
-+ gnutls_x509_privkey_t key;
- };
-
- static QCryptoTLSCredsX509Files *
-@@ -63,6 +69,13 @@ qcrypto_tls_creds_x509_files_free(QCryptoTLSCredsX509Files *files)
- }
- g_free(files->cacerts);
- g_free(files->cacertpath);
-+ for (i = 0; i < files->ncerts; i++) {
-+ gnutls_x509_crt_deinit(files->certs[i]);
-+ }
-+ gnutls_x509_privkey_deinit(files->key);
-+ g_free(files->certs);
-+ g_free(files->certpath);
-+ g_free(files->keypath);
- g_free(files);
- }
-
-@@ -477,14 +490,13 @@ qcrypto_tls_creds_load_cert_list(QCryptoTLSCredsX509 *creds,
- const char *certFile,
- gnutls_x509_crt_t **certs,
- unsigned int *ncerts,
-- bool isServer,
-- bool isCA,
- Error **errp)
- {
- gnutls_datum_t data;
- g_autofree char *buf = NULL;
- gsize buflen;
- GError *gerr = NULL;
-+ int ret;
-
- *ncerts = 0;
- trace_qcrypto_tls_creds_x509_load_cert_list(creds, certFile);
-@@ -499,13 +511,60 @@ qcrypto_tls_creds_load_cert_list(QCryptoTLSCredsX509 *creds,
- data.data = (unsigned char *)buf;
- data.size = strlen(buf);
-
-- if (gnutls_x509_crt_list_import2(certs, ncerts, &data,
-- GNUTLS_X509_FMT_PEM, 0) < 0) {
-- error_setg(errp,
-- isCA ? "Unable to import CA certificate list %s" :
-- (isServer ? "Unable to import server certificate %s" :
-- "Unable to import client certificate %s"),
-- certFile);
-+ ret = gnutls_x509_crt_list_import2(certs, ncerts, &data,
-+ GNUTLS_X509_FMT_PEM, 0);
-+ if (ret < 0) {
-+ error_setg(errp, "Unable to import certificate %s: %s",
-+ certFile, gnutls_strerror(ret));
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+
-+static int
-+qcrypto_tls_creds_load_privkey(QCryptoTLSCredsX509 *creds,
-+ const char *keyFile,
-+ gnutls_x509_privkey_t *key,
-+ Error **errp)
-+{
-+ gnutls_datum_t data;
-+ g_autofree char *buf = NULL;
-+ g_autofree char *password = NULL;
-+ gsize buflen;
-+ GError *gerr = NULL;
-+ int ret;
-+
-+ ret = gnutls_x509_privkey_init(key);
-+ if (ret < 0) {
-+ error_setg(errp, "Unable to initialize private key: %s",
-+ gnutls_strerror(ret));
-+ return -1;
-+ }
-+
-+ if (!g_file_get_contents(keyFile, &buf, &buflen, &gerr)) {
-+ error_setg(errp, "Cannot load private key %s: %s",
-+ keyFile, gerr->message);
-+ g_error_free(gerr);
-+ return -1;
-+ }
-+
-+ data.data = (unsigned char *)buf;
-+ data.size = strlen(buf);
-+
-+ if (creds->passwordid) {
-+ password = qcrypto_secret_lookup_as_utf8(creds->passwordid,
-+ errp);
-+ if (!password) {
-+ return -1;
-+ }
-+ }
-+
-+ if (gnutls_x509_privkey_import2(*key, &data,
-+ GNUTLS_X509_FMT_PEM,
-+ password, 0) < 0) {
-+ error_setg(errp, "Unable to import private key %s", keyFile);
- return -1;
- }
-
-@@ -517,56 +576,34 @@ static int
- qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
- QCryptoTLSCredsX509Files *files,
- bool isServer,
-- const char *certFile,
- Error **errp)
- {
-- gnutls_x509_crt_t *certs = NULL;
-- unsigned int ncerts = 0;
- size_t i;
-- int ret = -1;
--
-- if (certFile) {
-- if (qcrypto_tls_creds_load_cert_list(creds,
-- certFile,
-- &certs,
-- &ncerts,
-- isServer,
-- false,
-- errp) < 0) {
-- goto cleanup;
-- }
-- }
-
-- for (i = 0; i < ncerts; i++) {
-+ for (i = 0; i < files->ncerts; i++) {
- if (qcrypto_tls_creds_check_cert(creds,
-- certs[i], certFile,
-+ files->certs[i], files->certpath,
- isServer, i != 0, errp) < 0) {
-- goto cleanup;
-+ return -1;
- }
- }
-
-- if (ncerts &&
-+ if (files->ncerts &&
- qcrypto_tls_creds_check_authority_chain(creds, files,
-- certs, ncerts,
-+ files->certs, files->ncerts,
- isServer, errp) < 0) {
-- goto cleanup;
-- }
--
-- if (ncerts &&
-- qcrypto_tls_creds_check_cert_pair(files, certs, ncerts, certFile,
-- isServer, errp) < 0) {
-- goto cleanup;
-+ return -1;
- }
-
-- ret = 0;
--
-- cleanup:
-- for (i = 0; i < ncerts; i++) {
-- gnutls_x509_crt_deinit(certs[i]);
-+ if (files->ncerts &&
-+ qcrypto_tls_creds_check_cert_pair(files,
-+ files->certs, files->ncerts,
-+ files->certpath, isServer,
-+ errp) < 0) {
-+ return -1;
- }
-- g_free(certs);
-
-- return ret;
-+ return 0;
- }
-
-
-@@ -589,8 +626,6 @@ qcrypto_tls_creds_x509_load_ca(QCryptoTLSCredsX509 *creds,
- files->cacertpath,
- &files->cacerts,
- &files->ncacerts,
-- isServer,
-- true,
- errp) < 0) {
- return -1;
- }
-@@ -606,6 +641,79 @@ qcrypto_tls_creds_x509_load_ca(QCryptoTLSCredsX509 *creds,
- return 0;
- }
-
-+
-+static int
-+qcrypto_tls_creds_x509_load_identity(QCryptoTLSCredsX509 *creds,
-+ QCryptoTLSCredsBox *box,
-+ QCryptoTLSCredsX509Files *files,
-+ bool isServer,
-+ Error **errp)
-+{
-+ int ret;
-+
-+ if (isServer) {
-+ if (qcrypto_tls_creds_get_path(&creds->parent_obj,
-+ QCRYPTO_TLS_CREDS_X509_SERVER_CERT,
-+ true, &files->certpath, errp) < 0 ||
-+ qcrypto_tls_creds_get_path(&creds->parent_obj,
-+ QCRYPTO_TLS_CREDS_X509_SERVER_KEY,
-+ true, &files->keypath, errp) < 0) {
-+ return -1;
-+ }
-+ } else {
-+ if (qcrypto_tls_creds_get_path(&creds->parent_obj,
-+ QCRYPTO_TLS_CREDS_X509_CLIENT_CERT,
-+ false, &files->certpath, errp) < 0 ||
-+ qcrypto_tls_creds_get_path(&creds->parent_obj,
-+ QCRYPTO_TLS_CREDS_X509_CLIENT_KEY,
-+ false, &files->keypath, errp) < 0) {
-+ return -1;
-+ }
-+ }
-+
-+ if (!files->certpath &&
-+ !files->keypath) {
-+ return 0;
-+ }
-+ if (files->certpath && !files->keypath) {
-+ error_setg(errp, "Cert '%s' without corresponding key",
-+ files->certpath);
-+ return -1;
-+ }
-+ if (!files->certpath && files->keypath) {
-+ error_setg(errp, "Key '%s' without corresponding cert",
-+ files->keypath);
-+ return -1;
-+ }
-+
-+ if (qcrypto_tls_creds_load_cert_list(creds,
-+ files->certpath,
-+ &files->certs,
-+ &files->ncerts,
-+ errp) < 0) {
-+ return -1;
-+ }
-+
-+ if (qcrypto_tls_creds_load_privkey(creds,
-+ files->keypath,
-+ &files->key,
-+ errp) < 0) {
-+ return -1;
-+ }
-+
-+ ret = gnutls_certificate_set_x509_key(box->data.cert,
-+ files->certs,
-+ files->ncerts,
-+ files->key);
-+ if (ret < 0) {
-+ error_setg(errp, "Cannot set certificate '%s' & key '%s': %s",
-+ files->certpath, files->keypath, gnutls_strerror(ret));
-+ return -1;
-+ }
-+ return 0;
-+}
-+
-+
- static int
- qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- Error **errp)
-@@ -613,8 +721,6 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- g_autoptr(QCryptoTLSCredsBox) box = NULL;
- g_autoptr(QCryptoTLSCredsX509Files) files = NULL;
- g_autofree char *cacrl = NULL;
-- g_autofree char *cert = NULL;
-- g_autofree char *key = NULL;
- g_autofree char *dhparams = NULL;
- bool isServer = (creds->parent_obj.endpoint ==
- QCRYPTO_TLS_CREDS_ENDPOINT_SERVER);
-@@ -646,59 +752,27 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- return -1;
- }
-
-+ if (qcrypto_tls_creds_x509_load_identity(creds, box, files,
-+ isServer, errp) < 0) {
-+ return -1;
-+ }
-+
- if (isServer) {
- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
- QCRYPTO_TLS_CREDS_X509_CA_CRL,
- false, &cacrl, errp) < 0 ||
-- qcrypto_tls_creds_get_path(&creds->parent_obj,
-- QCRYPTO_TLS_CREDS_X509_SERVER_CERT,
-- true, &cert, errp) < 0 ||
-- qcrypto_tls_creds_get_path(&creds->parent_obj,
-- QCRYPTO_TLS_CREDS_X509_SERVER_KEY,
-- true, &key, errp) < 0 ||
- qcrypto_tls_creds_get_path(&creds->parent_obj,
- QCRYPTO_TLS_CREDS_DH_PARAMS,
- false, &dhparams, errp) < 0) {
- return -1;
- }
-- } else {
-- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
-- QCRYPTO_TLS_CREDS_X509_CLIENT_CERT,
-- false, &cert, errp) < 0 ||
-- qcrypto_tls_creds_get_path(&creds->parent_obj,
-- QCRYPTO_TLS_CREDS_X509_CLIENT_KEY,
-- false, &key, errp) < 0) {
-- return -1;
-- }
- }
-
- if (creds->sanityCheck &&
-- qcrypto_tls_creds_x509_sanity_check(creds, files, isServer,
-- cert, errp) < 0) {
-+ qcrypto_tls_creds_x509_sanity_check(creds, files, isServer, errp) < 0) {
- return -1;
- }
-
-- if (cert != NULL && key != NULL) {
-- g_autofree char *password = NULL;
-- if (creds->passwordid) {
-- password = qcrypto_secret_lookup_as_utf8(creds->passwordid,
-- errp);
-- if (!password) {
-- return -1;
-- }
-- }
-- ret = gnutls_certificate_set_x509_key_file2(box->data.cert,
-- cert, key,
-- GNUTLS_X509_FMT_PEM,
-- password,
-- 0);
-- if (ret < 0) {
-- error_setg(errp, "Cannot load certificate '%s' & key '%s': %s",
-- cert, key, gnutls_strerror(ret));
-- return -1;
-- }
-- }
--
- if (cacrl != NULL) {
- ret = gnutls_certificate_set_x509_crl_file(box->data.cert,
- cacrl,
-diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c
-index f8e7f990c0..1277893673 100644
---- a/tests/unit/test-crypto-tlscredsx509.c
-+++ b/tests/unit/test-crypto-tlscredsx509.c
-@@ -94,16 +94,16 @@ static void test_tls_creds(const void *opaque)
- if (access(data->crt, R_OK) == 0) {
- g_assert(link(data->crt,
- CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_CERT) == 0);
-+ g_assert(link(KEYFILE,
-+ CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY) == 0);
- }
-- g_assert(link(KEYFILE,
-- CERT_DIR QCRYPTO_TLS_CREDS_X509_SERVER_KEY) == 0);
- } else {
- if (access(data->crt, R_OK) == 0) {
- g_assert(link(data->crt,
- CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_CERT) == 0);
-+ g_assert(link(KEYFILE,
-+ CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY) == 0);
- }
-- g_assert(link(KEYFILE,
-- CERT_DIR QCRYPTO_TLS_CREDS_X509_CLIENT_KEY) == 0);
- }
-
- creds = test_tls_creds_create(
---
-2.52.0
-
diff --git a/kvm-crypto-deprecate-use-of-external-dh-params.pem-file.patch b/kvm-crypto-deprecate-use-of-external-dh-params.pem-file.patch
deleted file mode 100644
index cb76a0d..0000000
--- a/kvm-crypto-deprecate-use-of-external-dh-params.pem-file.patch
+++ /dev/null
@@ -1,181 +0,0 @@
-From dc132cb5088a9aec3f5f407db606f759d457aee0 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 14:07:57 +0000
-Subject: [PATCH 23/30] crypto: deprecate use of external dh-params.pem file
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [22/27] 0acd294952dabab86a9b0525efc6d873c50dc9dd (berrange/centos-src-qemu)
-
-GNUTLS has deprecated use of externally provided diffie-hellman
-parameters. Since 3.6.0 it will automatically negotiate DH params
-in accordance with RFC7919.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit d58f9b20c71caec2a4ce271dadb5d6a6d9444875)
----
- crypto/tlscreds.c | 24 ++++++++----------------
- crypto/tlscredsanon.c | 6 ++++--
- crypto/tlscredspsk.c | 6 ++++--
- crypto/tlscredsx509.c | 4 +++-
- docs/about/deprecated.rst | 9 +++++++++
- docs/system/tls.rst | 12 +++++++-----
- 6 files changed, 35 insertions(+), 26 deletions(-)
-
-diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
-index 9912e3ffbf..3d25efe425 100644
---- a/crypto/tlscreds.c
-+++ b/crypto/tlscreds.c
-@@ -22,6 +22,7 @@
- #include "qapi/error.h"
- #include "qapi-types-crypto.h"
- #include "qemu/module.h"
-+#include "qemu/error-report.h"
- #include "tlscredspriv.h"
- #include "trace.h"
-
-@@ -38,22 +39,7 @@ qcrypto_tls_creds_get_dh_params_file(QCryptoTLSCreds *creds,
-
- trace_qcrypto_tls_creds_load_dh(creds, filename ? filename : "<generated>");
-
-- if (filename == NULL) {
-- ret = gnutls_dh_params_init(dh_params);
-- if (ret < 0) {
-- error_setg(errp, "Unable to initialize DH parameters: %s",
-- gnutls_strerror(ret));
-- return -1;
-- }
-- ret = gnutls_dh_params_generate2(*dh_params, DH_BITS);
-- if (ret < 0) {
-- gnutls_dh_params_deinit(*dh_params);
-- *dh_params = NULL;
-- error_setg(errp, "Unable to generate DH parameters: %s",
-- gnutls_strerror(ret));
-- return -1;
-- }
-- } else {
-+ if (filename != NULL) {
- GError *gerr = NULL;
- gchar *contents;
- gsize len;
-@@ -67,6 +53,10 @@ qcrypto_tls_creds_get_dh_params_file(QCryptoTLSCreds *creds,
- g_error_free(gerr);
- return -1;
- }
-+ warn_report_once("Use of an external DH parameters file '%s' is "
-+ "deprecated and will be removed in a future release",
-+ filename);
-+
- data.data = (unsigned char *)contents;
- data.size = len;
- ret = gnutls_dh_params_init(dh_params);
-@@ -87,6 +77,8 @@ qcrypto_tls_creds_get_dh_params_file(QCryptoTLSCreds *creds,
- filename, gnutls_strerror(ret));
- return -1;
- }
-+ } else {
-+ *dh_params = NULL;
- }
-
- return 0;
-diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c
-index 646574d6ae..1551382e1f 100644
---- a/crypto/tlscredsanon.c
-+++ b/crypto/tlscredsanon.c
-@@ -68,8 +68,10 @@ qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds,
- return -1;
- }
-
-- gnutls_anon_set_server_dh_params(box->data.anonserver,
-- box->dh_params);
-+ if (box->dh_params) {
-+ gnutls_anon_set_server_dh_params(box->data.anonserver,
-+ box->dh_params);
-+ }
- } else {
- ret = gnutls_anon_allocate_client_credentials(&box->data.anonclient);
- if (ret < 0) {
-diff --git a/crypto/tlscredspsk.c b/crypto/tlscredspsk.c
-index 8879c84ea7..e1b1e1a613 100644
---- a/crypto/tlscredspsk.c
-+++ b/crypto/tlscredspsk.c
-@@ -129,8 +129,10 @@ qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds,
- gnutls_strerror(ret));
- goto cleanup;
- }
-- gnutls_psk_set_server_dh_params(box->data.pskserver,
-- box->dh_params);
-+ if (box->dh_params) {
-+ gnutls_psk_set_server_dh_params(box->data.pskserver,
-+ box->dh_params);
-+ }
- } else {
- box = qcrypto_tls_creds_box_new_client(GNUTLS_CRD_PSK);
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 397ff4caa9..e28fcdc6ff 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -683,7 +683,9 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- errp) < 0) {
- return -1;
- }
-- gnutls_certificate_set_dh_params(box->data.cert, box->dh_params);
-+ if (box->dh_params) {
-+ gnutls_certificate_set_dh_params(box->data.cert, box->dh_params);
-+ }
- }
- creds->parent_obj.box = g_steal_pointer(&box);
-
-diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
-index fc422acc3e..1e9fa0272b 100644
---- a/docs/about/deprecated.rst
-+++ b/docs/about/deprecated.rst
-@@ -391,6 +391,15 @@ Options are:
- - move backing file to NVDIMM storage and keep ``pmem=on``
- (to have NVDIMM with persistence guaranties).
-
-+Using an external DH (Diffie-Hellman) parameters file (since 10.2)
-+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-+
-+Loading of external Diffie-Hellman parameters from a 'dh-params.pem'
-+file is deprecated and will be removed with no replacement in a
-+future release. Where no 'dh-params.pem' file is provided, the DH
-+parameters will be automatically negotiated in accordance with
-+RFC7919.
-+
- Device options
- --------------
-
-diff --git a/docs/system/tls.rst b/docs/system/tls.rst
-index a4f6781d62..44c4bf04e9 100644
---- a/docs/system/tls.rst
-+++ b/docs/system/tls.rst
-@@ -251,11 +251,13 @@ When specifying the object, the ``dir`` parameters specifies which
- directory contains the credential files. This directory is expected to
- contain files with the names mentioned previously, ``ca-cert.pem``,
- ``server-key.pem``, ``server-cert.pem``, ``client-key.pem`` and
--``client-cert.pem`` as appropriate. It is also possible to include a set
--of pre-generated Diffie-Hellman (DH) parameters in a file
--``dh-params.pem``, which can be created using the
--``certtool --generate-dh-params`` command. If omitted, QEMU will
--dynamically generate DH parameters when loading the credentials.
-+``client-cert.pem`` as appropriate.
-+
-+While it is possible to include a set of pre-generated Diffie-Hellman
-+(DH) parameters in a file ``dh-params.pem``, this facility is now
-+deprecated and will be removed in a future release. When omitted the
-+DH parameters will be automatically negotiated in accordance with
-+RFC7919.
-
- The ``endpoint`` parameter indicates whether the credentials will be
- used for a network client or server, and determines which PEM files are
---
-2.52.0
-
diff --git a/kvm-crypto-expand-logic-to-cope-with-multiple-certificat.patch b/kvm-crypto-expand-logic-to-cope-with-multiple-certificat.patch
deleted file mode 100644
index ab1d885..0000000
--- a/kvm-crypto-expand-logic-to-cope-with-multiple-certificat.patch
+++ /dev/null
@@ -1,311 +0,0 @@
-From 564096e87ba55e4c1b51946df4a9539c89001b97 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 20:46:28 +0000
-Subject: [PATCH 26/30] crypto: expand logic to cope with multiple certificate
- identities
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [25/27] 1ccbd1581743bec1d8c13444b2bff3b04a2bc26c (berrange/centos-src-qemu)
-
-Currently only a single set of certificates can be loaded for a
-server / client. Certificates are created using a particular
-key algorithm and in some scenarios it can be useful to support
-multiple algorithms in parallel. This requires the ability to
-load multiple sets of certificates.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit c497a51481cf725d86d3f302a6397c2cb446d0bb)
----
- crypto/tlscredsx509.c | 165 +++++++++++++++++++++++++++++-------------
- 1 file changed, 113 insertions(+), 52 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index c016633d65..ecffde67c5 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -40,17 +40,23 @@ struct QCryptoTLSCredsX509 {
- #include <gnutls/x509.h>
-
-
-+typedef struct QCryptoTLSCredsX509IdentFiles QCryptoTLSCredsX509IdentFiles;
-+struct QCryptoTLSCredsX509IdentFiles {
-+ char *certpath;
-+ char *keypath;
-+ gnutls_x509_crt_t *certs;
-+ unsigned int ncerts;
-+ gnutls_x509_privkey_t key;
-+};
-+
- typedef struct QCryptoTLSCredsX509Files QCryptoTLSCredsX509Files;
- struct QCryptoTLSCredsX509Files {
- char *cacertpath;
- gnutls_x509_crt_t *cacerts;
- unsigned int ncacerts;
-
-- char *certpath;
-- char *keypath;
-- gnutls_x509_crt_t *certs;
-- unsigned int ncerts;
-- gnutls_x509_privkey_t key;
-+ QCryptoTLSCredsX509IdentFiles **identities;
-+ size_t nidentities;
- };
-
- static QCryptoTLSCredsX509Files *
-@@ -61,14 +67,9 @@ qcrypto_tls_creds_x509_files_new(void)
-
-
- static void
--qcrypto_tls_creds_x509_files_free(QCryptoTLSCredsX509Files *files)
-+qcrypto_tls_creds_x509_ident_files_free(QCryptoTLSCredsX509IdentFiles *files)
- {
- size_t i;
-- for (i = 0; i < files->ncacerts; i++) {
-- gnutls_x509_crt_deinit(files->cacerts[i]);
-- }
-- g_free(files->cacerts);
-- g_free(files->cacertpath);
- for (i = 0; i < files->ncerts; i++) {
- gnutls_x509_crt_deinit(files->certs[i]);
- }
-@@ -79,6 +80,26 @@ qcrypto_tls_creds_x509_files_free(QCryptoTLSCredsX509Files *files)
- g_free(files);
- }
-
-+G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoTLSCredsX509IdentFiles,
-+ qcrypto_tls_creds_x509_ident_files_free);
-+
-+
-+static void
-+qcrypto_tls_creds_x509_files_free(QCryptoTLSCredsX509Files *files)
-+{
-+ size_t i;
-+ for (i = 0; i < files->ncacerts; i++) {
-+ gnutls_x509_crt_deinit(files->cacerts[i]);
-+ }
-+ g_free(files->cacerts);
-+ g_free(files->cacertpath);
-+ for (i = 0; i < files->nidentities; i++) {
-+ qcrypto_tls_creds_x509_ident_files_free(files->identities[i]);
-+ }
-+ g_free(files->identities);
-+ g_free(files);
-+}
-+
- G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoTLSCredsX509Files,
- qcrypto_tls_creds_x509_files_free);
-
-@@ -573,33 +594,32 @@ qcrypto_tls_creds_load_privkey(QCryptoTLSCredsX509 *creds,
-
-
- static int
--qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
-- QCryptoTLSCredsX509Files *files,
-- bool isServer,
-- Error **errp)
-+qcrypto_tls_creds_x509_sanity_check_identity(QCryptoTLSCredsX509 *creds,
-+ QCryptoTLSCredsX509Files *files,
-+ QCryptoTLSCredsX509IdentFiles *ifiles,
-+ bool isServer,
-+ Error **errp)
- {
- size_t i;
-
-- for (i = 0; i < files->ncerts; i++) {
-+ for (i = 0; i < ifiles->ncerts; i++) {
- if (qcrypto_tls_creds_check_cert(creds,
-- files->certs[i], files->certpath,
-+ ifiles->certs[i], ifiles->certpath,
- isServer, i != 0, errp) < 0) {
- return -1;
- }
- }
-
-- if (files->ncerts &&
-+ if (ifiles->ncerts &&
- qcrypto_tls_creds_check_authority_chain(creds, files,
-- files->certs, files->ncerts,
-+ ifiles->certs, ifiles->ncerts,
- isServer, errp) < 0) {
- return -1;
- }
-
-- if (files->ncerts &&
-- qcrypto_tls_creds_check_cert_pair(files,
-- files->certs, files->ncerts,
-- files->certpath, isServer,
-- errp) < 0) {
-+ if (ifiles->ncerts &&
-+ qcrypto_tls_creds_check_cert_pair(files, ifiles->certs, ifiles->ncerts,
-+ ifiles->certpath, isServer, errp) < 0) {
- return -1;
- }
-
-@@ -607,6 +627,26 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
- }
-
-
-+static int
-+qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
-+ QCryptoTLSCredsX509Files *files,
-+ bool isServer,
-+ Error **errp)
-+{
-+ size_t i;
-+ for (i = 0; i < files->nidentities; i++) {
-+ if (qcrypto_tls_creds_x509_sanity_check_identity(creds,
-+ files,
-+ files->identities[i],
-+ isServer,
-+ errp) < 0) {
-+ return -1;
-+ }
-+ }
-+ return 0;
-+}
-+
-+
- static int
- qcrypto_tls_creds_x509_load_ca(QCryptoTLSCredsX509 *creds,
- QCryptoTLSCredsBox *box,
-@@ -642,48 +682,38 @@ qcrypto_tls_creds_x509_load_ca(QCryptoTLSCredsX509 *creds,
- }
-
-
--static int
-+static QCryptoTLSCredsX509IdentFiles *
- qcrypto_tls_creds_x509_load_identity(QCryptoTLSCredsX509 *creds,
- QCryptoTLSCredsBox *box,
-- QCryptoTLSCredsX509Files *files,
-- bool isServer,
-+ const char *certbase,
-+ const char *keybase,
-+ bool isOptional,
- Error **errp)
- {
-+ g_autoptr(QCryptoTLSCredsX509IdentFiles) files =
-+ g_new0(QCryptoTLSCredsX509IdentFiles, 1);
- int ret;
-
-- if (isServer) {
-- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
-- QCRYPTO_TLS_CREDS_X509_SERVER_CERT,
-- true, &files->certpath, errp) < 0 ||
-- qcrypto_tls_creds_get_path(&creds->parent_obj,
-- QCRYPTO_TLS_CREDS_X509_SERVER_KEY,
-- true, &files->keypath, errp) < 0) {
-- return -1;
-- }
-- } else {
-- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
-- QCRYPTO_TLS_CREDS_X509_CLIENT_CERT,
-- false, &files->certpath, errp) < 0 ||
-- qcrypto_tls_creds_get_path(&creds->parent_obj,
-- QCRYPTO_TLS_CREDS_X509_CLIENT_KEY,
-- false, &files->keypath, errp) < 0) {
-- return -1;
-- }
-+ if (qcrypto_tls_creds_get_path(&creds->parent_obj, certbase,
-+ !isOptional, &files->certpath, errp) < 0 ||
-+ qcrypto_tls_creds_get_path(&creds->parent_obj, keybase,
-+ !isOptional, &files->keypath, errp) < 0) {
-+ return NULL;
- }
-
- if (!files->certpath &&
- !files->keypath) {
-- return 0;
-+ return NULL;
- }
- if (files->certpath && !files->keypath) {
- error_setg(errp, "Cert '%s' without corresponding key",
- files->certpath);
-- return -1;
-+ return NULL;
- }
- if (!files->certpath && files->keypath) {
- error_setg(errp, "Key '%s' without corresponding cert",
- files->keypath);
-- return -1;
-+ return NULL;
- }
-
- if (qcrypto_tls_creds_load_cert_list(creds,
-@@ -691,14 +721,14 @@ qcrypto_tls_creds_x509_load_identity(QCryptoTLSCredsX509 *creds,
- &files->certs,
- &files->ncerts,
- errp) < 0) {
-- return -1;
-+ return NULL;
- }
-
- if (qcrypto_tls_creds_load_privkey(creds,
- files->keypath,
- &files->key,
- errp) < 0) {
-- return -1;
-+ return NULL;
- }
-
- ret = gnutls_certificate_set_x509_key(box->data.cert,
-@@ -708,8 +738,39 @@ qcrypto_tls_creds_x509_load_identity(QCryptoTLSCredsX509 *creds,
- if (ret < 0) {
- error_setg(errp, "Cannot set certificate '%s' & key '%s': %s",
- files->certpath, files->keypath, gnutls_strerror(ret));
-+ return NULL;
-+ }
-+ return g_steal_pointer(&files);
-+}
-+
-+
-+static int
-+qcrypto_tls_creds_x509_load_identities(QCryptoTLSCredsX509 *creds,
-+ QCryptoTLSCredsBox *box,
-+ QCryptoTLSCredsX509Files *files,
-+ bool isServer,
-+ Error **errp)
-+{
-+ QCryptoTLSCredsX509IdentFiles *ifiles;
-+
-+ ifiles = qcrypto_tls_creds_x509_load_identity(
-+ creds, box,
-+ isServer ?
-+ QCRYPTO_TLS_CREDS_X509_SERVER_CERT :
-+ QCRYPTO_TLS_CREDS_X509_CLIENT_CERT,
-+ isServer ?
-+ QCRYPTO_TLS_CREDS_X509_SERVER_KEY :
-+ QCRYPTO_TLS_CREDS_X509_CLIENT_KEY,
-+ !isServer, errp);
-+ if (!ifiles) {
- return -1;
- }
-+
-+ files->identities = g_renew(QCryptoTLSCredsX509IdentFiles *,
-+ files->identities,
-+ files->nidentities + 1);
-+ files->identities[files->nidentities++] = ifiles;
-+
- return 0;
- }
-
-@@ -752,8 +813,8 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- return -1;
- }
-
-- if (qcrypto_tls_creds_x509_load_identity(creds, box, files,
-- isServer, errp) < 0) {
-+ if (qcrypto_tls_creds_x509_load_identities(creds, box, files,
-+ isServer, errp) < 0) {
- return -1;
- }
-
---
-2.52.0
-
diff --git a/kvm-crypto-fix-error-reporting-in-cert-chain-checks.patch b/kvm-crypto-fix-error-reporting-in-cert-chain-checks.patch
deleted file mode 100644
index f4a5a6a..0000000
--- a/kvm-crypto-fix-error-reporting-in-cert-chain-checks.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-From 8dce0e99c8ff3962696fcdb2b11bcb6b0db8a031 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 9 Jul 2025 08:36:22 +0100
-Subject: [PATCH 04/30] crypto: fix error reporting in cert chain checks
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [3/27] c5a1e343c28959e1e0e477016caaede8fe3d6fa6 (berrange/centos-src-qemu)
-
-The loop that checks the CA certificate chain can fail to report
-an error message if one of the certs in the chain has an issuer
-that is not present in the chain. In this case, the outer loop
-'while (checking_issuer)' will terminate after failing to find
-the issuer, and no error message will be reported.
-
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit c677657e99e080a174052074ae77ff37dbe91335)
----
- crypto/tlscredsx509.c | 33 ++++++++++++++++++---------
- tests/unit/test-crypto-tlscredsx509.c | 12 ++++++++++
- 2 files changed, 34 insertions(+), 11 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 4169ad9a75..2eccd71b3c 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -326,11 +326,11 @@ qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
- Error **errp)
- {
- gnutls_x509_crt_t cert_to_check = cert;
-- bool checking_issuer = true;
- int retval = 0;
-+ gnutls_datum_t dn = {};
-
-- while (checking_issuer) {
-- checking_issuer = false;
-+ for (;;) {
-+ gnutls_x509_crt_t cert_issuer = NULL;
-
- if (gnutls_x509_crt_check_issuer(cert_to_check,
- cert_to_check)) {
-@@ -345,19 +345,30 @@ qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
- for (int i = 0; i < ncacerts; i++) {
- if (gnutls_x509_crt_check_issuer(cert_to_check,
- cacerts[i])) {
-- retval = qcrypto_tls_creds_check_cert(
-- creds, cacerts[i], cacertFile,
-- isServer, isCA, errp);
-- if (retval < 0) {
-- return retval;
-- }
-- cert_to_check = cacerts[i];
-- checking_issuer = true;
-+ cert_issuer = cacerts[i];
- break;
- }
- }
-+ if (!cert_issuer) {
-+ break;
-+ }
-+
-+ if (qcrypto_tls_creds_check_cert(creds, cert_issuer, cacertFile,
-+ isServer, isCA, errp) < 0) {
-+ return -1;
-+ }
-+
-+ cert_to_check = cert_issuer;
- }
-
-+ retval = gnutls_x509_crt_get_dn2(cert_to_check, &dn);
-+ if (retval < 0) {
-+ error_setg(errp, "Unable to fetch cert DN: %s",
-+ gnutls_strerror(retval));
-+ return -1;
-+ }
-+ error_setg(errp, "Cert '%s' has no issuer in CA chain", dn.data);
-+ g_free(dn.data);
- return -1;
- }
-
-diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c
-index a7ea5f422d..d8bc3be491 100644
---- a/tests/unit/test-crypto-tlscredsx509.c
-+++ b/tests/unit/test-crypto-tlscredsx509.c
-@@ -640,6 +640,15 @@ int main(int argc, char **argv)
- certchain_with_invalid,
- G_N_ELEMENTS(certchain_with_invalid));
-
-+ gnutls_x509_crt_t certchain_incomplete[] = {
-+ cacertrootreq.crt,
-+ cacertlevel2areq.crt,
-+ };
-+
-+ test_tls_write_cert_chain(WORKDIR "cacertchain-incomplete-ctx.pem",
-+ certchain_incomplete,
-+ G_N_ELEMENTS(certchain_incomplete));
-+
- TLS_TEST_REG(chain1, true,
- WORKDIR "cacertchain-ctx.pem",
- servercertlevel3areq.filename, false);
-@@ -649,6 +658,9 @@ int main(int argc, char **argv)
- TLS_TEST_REG(certchainwithexpiredcert, false,
- WORKDIR "cacertchain-with-invalid-ctx.pem",
- clientcertlevel2breq.filename, false);
-+ TLS_TEST_REG(chainincomplete, true,
-+ WORKDIR "cacertchain-incomplete-ctx.pem",
-+ servercertlevel3areq.filename, true);
-
- /* Some missing certs - first two are fatal, the last
- * is ok
---
-2.52.0
-
diff --git a/kvm-crypto-fix-lifecycle-handling-of-gnutls-credentials-.patch b/kvm-crypto-fix-lifecycle-handling-of-gnutls-credentials-.patch
deleted file mode 100644
index 764723d..0000000
--- a/kvm-crypto-fix-lifecycle-handling-of-gnutls-credentials-.patch
+++ /dev/null
@@ -1,616 +0,0 @@
-From 451ca8b7609aa0b78a5be68396294976d6cd6795 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 09:50:02 +0000
-Subject: [PATCH 21/30] crypto: fix lifecycle handling of gnutls credentials
- objects
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [20/27] e751f6bc85af03e25ca1779d6650a9e21f9fa5a4 (berrange/centos-src-qemu)
-
-As described in the previous commit, the gnutls credentials need to
-be kept alive for as long as the gnutls session object exists. Convert
-the QCryptoTLSCreds objects to use QCryptoTLSCredsBox and holding the
-gnutls credential objects. When loading the credentials into a gnutls
-session, store a reference to the box into the QCryptoTLSSession object.
-
-This has the useful side effect that the QCryptoTLSSession code no
-longer needs to know about all the different credential types, it can
-use the generic pointer stored in the box.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 70f9fd8dbf7233bee497055a9b7825e3729ce853)
----
- crypto/tlscreds.c | 5 +--
- crypto/tlscredsanon.c | 48 +++++---------------------
- crypto/tlscredspriv.h | 20 ++---------
- crypto/tlscredspsk.c | 46 ++++++++-----------------
- crypto/tlscredsx509.c | 71 +++++++++++++-------------------------
- crypto/tlssession.c | 80 ++++++++++++++-----------------------------
- 6 files changed, 75 insertions(+), 195 deletions(-)
-
-diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
-index 0db9bf6eeb..9912e3ffbf 100644
---- a/crypto/tlscreds.c
-+++ b/crypto/tlscreds.c
-@@ -247,11 +247,8 @@ qcrypto_tls_creds_finalize(Object *obj)
- QCryptoTLSCreds *creds = QCRYPTO_TLS_CREDS(obj);
-
- #ifdef CONFIG_GNUTLS
-- if (creds->dh_params) {
-- gnutls_dh_params_deinit(creds->dh_params);
-- }
-+ qcrypto_tls_creds_box_unref(creds->box);
- #endif
--
- g_free(creds->dir);
- g_free(creds->priority);
- }
-diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c
-index 5c55b07b2f..0a728ccbf6 100644
---- a/crypto/tlscredsanon.c
-+++ b/crypto/tlscredsanon.c
-@@ -36,6 +36,7 @@ static int
- qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds,
- Error **errp)
- {
-+ g_autoptr(QCryptoTLSCredsBox) box = NULL;
- g_autofree char *dhparams = NULL;
- int ret;
-
-@@ -43,6 +44,8 @@ qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds,
- creds->parent_obj.dir ? creds->parent_obj.dir : "<nodir>");
-
- if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
-+ box = qcrypto_tls_creds_box_new_server(GNUTLS_CRD_ANON);
-+
- if (creds->parent_obj.dir &&
- qcrypto_tls_creds_get_path(&creds->parent_obj,
- QCRYPTO_TLS_CREDS_DH_PARAMS,
-@@ -50,7 +53,7 @@ qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds,
- return -1;
- }
-
-- ret = gnutls_anon_allocate_server_credentials(&creds->data.server);
-+ ret = gnutls_anon_allocate_server_credentials(&box->data.anonserver);
- if (ret < 0) {
- error_setg(errp, "Cannot allocate credentials: %s",
- gnutls_strerror(ret));
-@@ -58,42 +61,26 @@ qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds,
- }
-
- if (qcrypto_tls_creds_get_dh_params_file(&creds->parent_obj, dhparams,
-- &creds->parent_obj.dh_params,
-- errp) < 0) {
-+ &box->dh_params, errp) < 0) {
- return -1;
- }
-
-- gnutls_anon_set_server_dh_params(creds->data.server,
-- creds->parent_obj.dh_params);
-+ gnutls_anon_set_server_dh_params(box->data.anonserver,
-+ box->dh_params);
- } else {
-- ret = gnutls_anon_allocate_client_credentials(&creds->data.client);
-+ ret = gnutls_anon_allocate_client_credentials(&box->data.anonclient);
- if (ret < 0) {
- error_setg(errp, "Cannot allocate credentials: %s",
- gnutls_strerror(ret));
- return -1;
- }
- }
-+ creds->parent_obj.box = g_steal_pointer(&box);
-
- return 0;
- }
-
-
--static void
--qcrypto_tls_creds_anon_unload(QCryptoTLSCredsAnon *creds)
--{
-- if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT) {
-- if (creds->data.client) {
-- gnutls_anon_free_client_credentials(creds->data.client);
-- creds->data.client = NULL;
-- }
-- } else {
-- if (creds->data.server) {
-- gnutls_anon_free_server_credentials(creds->data.server);
-- creds->data.server = NULL;
-- }
-- }
--}
--
- #else /* ! CONFIG_GNUTLS */
-
-
-@@ -105,13 +92,6 @@ qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds G_GNUC_UNUSED,
- }
-
-
--static void
--qcrypto_tls_creds_anon_unload(QCryptoTLSCredsAnon *creds G_GNUC_UNUSED)
--{
-- /* nada */
--}
--
--
- #endif /* ! CONFIG_GNUTLS */
-
-
-@@ -124,15 +104,6 @@ qcrypto_tls_creds_anon_complete(UserCreatable *uc, Error **errp)
- }
-
-
--static void
--qcrypto_tls_creds_anon_finalize(Object *obj)
--{
-- QCryptoTLSCredsAnon *creds = QCRYPTO_TLS_CREDS_ANON(obj);
--
-- qcrypto_tls_creds_anon_unload(creds);
--}
--
--
- static void
- qcrypto_tls_creds_anon_class_init(ObjectClass *oc, const void *data)
- {
-@@ -148,7 +119,6 @@ static const TypeInfo qcrypto_tls_creds_anon_info = {
- .parent = TYPE_QCRYPTO_TLS_CREDS,
- .name = TYPE_QCRYPTO_TLS_CREDS_ANON,
- .instance_size = sizeof(QCryptoTLSCredsAnon),
-- .instance_finalize = qcrypto_tls_creds_anon_finalize,
- .class_size = sizeof(QCryptoTLSCredsAnonClass),
- .class_init = qcrypto_tls_creds_anon_class_init,
- .interfaces = (const InterfaceInfo[]) {
-diff --git a/crypto/tlscredspriv.h b/crypto/tlscredspriv.h
-index df9815a286..4e6dffa22f 100644
---- a/crypto/tlscredspriv.h
-+++ b/crypto/tlscredspriv.h
-@@ -22,6 +22,7 @@
- #define QCRYPTO_TLSCREDSPRIV_H
-
- #include "crypto/tlscreds.h"
-+#include "crypto/tlscredsbox.h"
-
- #ifdef CONFIG_GNUTLS
- #include <gnutls/gnutls.h>
-@@ -31,39 +32,22 @@ struct QCryptoTLSCreds {
- Object parent_obj;
- char *dir;
- QCryptoTLSCredsEndpoint endpoint;
--#ifdef CONFIG_GNUTLS
-- gnutls_dh_params_t dh_params;
--#endif
- bool verifyPeer;
- char *priority;
-+ QCryptoTLSCredsBox *box;
- };
-
- struct QCryptoTLSCredsAnon {
- QCryptoTLSCreds parent_obj;
--#ifdef CONFIG_GNUTLS
-- union {
-- gnutls_anon_server_credentials_t server;
-- gnutls_anon_client_credentials_t client;
-- } data;
--#endif
- };
-
- struct QCryptoTLSCredsPSK {
- QCryptoTLSCreds parent_obj;
- char *username;
--#ifdef CONFIG_GNUTLS
-- union {
-- gnutls_psk_server_credentials_t server;
-- gnutls_psk_client_credentials_t client;
-- } data;
--#endif
- };
-
- struct QCryptoTLSCredsX509 {
- QCryptoTLSCreds parent_obj;
--#ifdef CONFIG_GNUTLS
-- gnutls_certificate_credentials_t data;
--#endif
- bool sanityCheck;
- char *passwordid;
- };
-diff --git a/crypto/tlscredspsk.c b/crypto/tlscredspsk.c
-index 6c2feae077..5568f1ad0c 100644
---- a/crypto/tlscredspsk.c
-+++ b/crypto/tlscredspsk.c
-@@ -71,6 +71,7 @@ static int
- qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds,
- Error **errp)
- {
-+ g_autoptr(QCryptoTLSCredsBox) box = NULL;
- g_autofree char *pskfile = NULL;
- g_autofree char *dhparams = NULL;
- const char *username;
-@@ -87,6 +88,8 @@ qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds,
- }
-
- if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
-+ box = qcrypto_tls_creds_box_new_server(GNUTLS_CRD_PSK);
-+
- if (creds->username) {
- error_setg(errp, "username should not be set when endpoint=server");
- goto cleanup;
-@@ -101,7 +104,7 @@ qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds,
- goto cleanup;
- }
-
-- ret = gnutls_psk_allocate_server_credentials(&creds->data.server);
-+ ret = gnutls_psk_allocate_server_credentials(&box->data.pskserver);
- if (ret < 0) {
- error_setg(errp, "Cannot allocate credentials: %s",
- gnutls_strerror(ret));
-@@ -109,20 +112,23 @@ qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds,
- }
-
- if (qcrypto_tls_creds_get_dh_params_file(&creds->parent_obj, dhparams,
-- &creds->parent_obj.dh_params,
-+ &box->dh_params,
- errp) < 0) {
- goto cleanup;
- }
-
-- ret = gnutls_psk_set_server_credentials_file(creds->data.server, pskfile);
-+ ret = gnutls_psk_set_server_credentials_file(box->data.pskserver,
-+ pskfile);
- if (ret < 0) {
- error_setg(errp, "Cannot set PSK server credentials: %s",
- gnutls_strerror(ret));
- goto cleanup;
- }
-- gnutls_psk_set_server_dh_params(creds->data.server,
-- creds->parent_obj.dh_params);
-+ gnutls_psk_set_server_dh_params(box->data.pskserver,
-+ box->dh_params);
- } else {
-+ box = qcrypto_tls_creds_box_new_client(GNUTLS_CRD_PSK);
-+
- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
- QCRYPTO_TLS_CREDS_PSKFILE,
- true, &pskfile, errp) < 0) {
-@@ -138,14 +144,14 @@ qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds,
- goto cleanup;
- }
-
-- ret = gnutls_psk_allocate_client_credentials(&creds->data.client);
-+ ret = gnutls_psk_allocate_client_credentials(&box->data.pskclient);
- if (ret < 0) {
- error_setg(errp, "Cannot allocate credentials: %s",
- gnutls_strerror(ret));
- goto cleanup;
- }
-
-- ret = gnutls_psk_set_client_credentials(creds->data.client,
-+ ret = gnutls_psk_set_client_credentials(box->data.pskclient,
- username, &key, GNUTLS_PSK_KEY_HEX);
- if (ret < 0) {
- error_setg(errp, "Cannot set PSK client credentials: %s",
-@@ -153,6 +159,7 @@ qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds,
- goto cleanup;
- }
- }
-+ creds->parent_obj.box = g_steal_pointer(&box);
-
- rv = 0;
- cleanup:
-@@ -160,23 +167,6 @@ qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds,
- return rv;
- }
-
--
--static void
--qcrypto_tls_creds_psk_unload(QCryptoTLSCredsPSK *creds)
--{
-- if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT) {
-- if (creds->data.client) {
-- gnutls_psk_free_client_credentials(creds->data.client);
-- creds->data.client = NULL;
-- }
-- } else {
-- if (creds->data.server) {
-- gnutls_psk_free_server_credentials(creds->data.server);
-- creds->data.server = NULL;
-- }
-- }
--}
--
- #else /* ! CONFIG_GNUTLS */
-
-
-@@ -188,13 +178,6 @@ qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds G_GNUC_UNUSED,
- }
-
-
--static void
--qcrypto_tls_creds_psk_unload(QCryptoTLSCredsPSK *creds G_GNUC_UNUSED)
--{
-- /* nada */
--}
--
--
- #endif /* ! CONFIG_GNUTLS */
-
-
-@@ -212,7 +195,6 @@ qcrypto_tls_creds_psk_finalize(Object *obj)
- {
- QCryptoTLSCredsPSK *creds = QCRYPTO_TLS_CREDS_PSK(obj);
-
-- qcrypto_tls_creds_psk_unload(creds);
- g_free(creds->username);
- }
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index dd28faf872..388ddb7f0e 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -562,6 +562,7 @@ static int
- qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- Error **errp)
- {
-+ g_autoptr(QCryptoTLSCredsBox) box = NULL;
- g_autofree char *cacert = NULL;
- g_autofree char *cacrl = NULL;
- g_autofree char *cert = NULL;
-@@ -578,6 +579,19 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
-
- trace_qcrypto_tls_creds_x509_load(creds, creds->parent_obj.dir);
-
-+ if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
-+ box = qcrypto_tls_creds_box_new_server(GNUTLS_CRD_CERTIFICATE);
-+ } else {
-+ box = qcrypto_tls_creds_box_new_client(GNUTLS_CRD_CERTIFICATE);
-+ }
-+
-+ ret = gnutls_certificate_allocate_credentials(&box->data.cert);
-+ if (ret < 0) {
-+ error_setg(errp, "Cannot allocate credentials: '%s'",
-+ gnutls_strerror(ret));
-+ return -1;
-+ }
-+
- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
- QCRYPTO_TLS_CREDS_X509_CA_CERT,
- true, &cacert, errp) < 0) {
-@@ -616,14 +630,7 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- return -1;
- }
-
-- ret = gnutls_certificate_allocate_credentials(&creds->data);
-- if (ret < 0) {
-- error_setg(errp, "Cannot allocate credentials: '%s'",
-- gnutls_strerror(ret));
-- return -1;
-- }
--
-- ret = gnutls_certificate_set_x509_trust_file(creds->data,
-+ ret = gnutls_certificate_set_x509_trust_file(box->data.cert,
- cacert,
- GNUTLS_X509_FMT_PEM);
- if (ret < 0) {
-@@ -641,7 +648,7 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- return -1;
- }
- }
-- ret = gnutls_certificate_set_x509_key_file2(creds->data,
-+ ret = gnutls_certificate_set_x509_key_file2(box->data.cert,
- cert, key,
- GNUTLS_X509_FMT_PEM,
- password,
-@@ -654,7 +661,7 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- }
-
- if (cacrl != NULL) {
-- ret = gnutls_certificate_set_x509_crl_file(creds->data,
-+ ret = gnutls_certificate_set_x509_crl_file(box->data.cert,
- cacrl,
- GNUTLS_X509_FMT_PEM);
- if (ret < 0) {
-@@ -666,28 +673,18 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
-
- if (isServer) {
- if (qcrypto_tls_creds_get_dh_params_file(&creds->parent_obj, dhparams,
-- &creds->parent_obj.dh_params,
-+ &box->dh_params,
- errp) < 0) {
- return -1;
- }
-- gnutls_certificate_set_dh_params(creds->data,
-- creds->parent_obj.dh_params);
-+ gnutls_certificate_set_dh_params(box->data.cert, box->dh_params);
- }
-+ creds->parent_obj.box = g_steal_pointer(&box);
-
- return 0;
- }
-
-
--static void
--qcrypto_tls_creds_x509_unload(QCryptoTLSCredsX509 *creds)
--{
-- if (creds->data) {
-- gnutls_certificate_free_credentials(creds->data);
-- creds->data = NULL;
-- }
--}
--
--
- #else /* ! CONFIG_GNUTLS */
-
-
-@@ -699,13 +696,6 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds G_GNUC_UNUSED,
- }
-
-
--static void
--qcrypto_tls_creds_x509_unload(QCryptoTLSCredsX509 *creds G_GNUC_UNUSED)
--{
-- /* nada */
--}
--
--
- #endif /* ! CONFIG_GNUTLS */
-
-
-@@ -768,29 +758,17 @@ qcrypto_tls_creds_x509_reload(QCryptoTLSCreds *creds, Error **errp)
- {
- QCryptoTLSCredsX509 *x509_creds = QCRYPTO_TLS_CREDS_X509(creds);
- Error *local_err = NULL;
-- gnutls_certificate_credentials_t creds_data = x509_creds->data;
-- gnutls_dh_params_t creds_dh_params = creds->dh_params;
-+ QCryptoTLSCredsBox *creds_box = creds->box;
-
-- x509_creds->data = NULL;
-- creds->dh_params = NULL;
-+ creds->box = NULL;
- qcrypto_tls_creds_x509_load(x509_creds, &local_err);
- if (local_err) {
-- qcrypto_tls_creds_x509_unload(x509_creds);
-- if (creds->dh_params) {
-- gnutls_dh_params_deinit(creds->dh_params);
-- }
-- x509_creds->data = creds_data;
-- creds->dh_params = creds_dh_params;
-+ creds->box = creds_box;
- error_propagate(errp, local_err);
- return false;
- }
-
-- if (creds_data) {
-- gnutls_certificate_free_credentials(creds_data);
-- }
-- if (creds_dh_params) {
-- gnutls_dh_params_deinit(creds_dh_params);
-- }
-+ qcrypto_tls_creds_box_unref(creds_box);
- return true;
- }
-
-@@ -823,7 +801,6 @@ qcrypto_tls_creds_x509_finalize(Object *obj)
- QCryptoTLSCredsX509 *creds = QCRYPTO_TLS_CREDS_X509(obj);
-
- g_free(creds->passwordid);
-- qcrypto_tls_creds_x509_unload(creds);
- }
-
-
-diff --git a/crypto/tlssession.c b/crypto/tlssession.c
-index 827f557ff8..d585c51f77 100644
---- a/crypto/tlssession.c
-+++ b/crypto/tlssession.c
-@@ -38,6 +38,7 @@
-
- struct QCryptoTLSSession {
- QCryptoTLSCreds *creds;
-+ QCryptoTLSCredsBox *credsbox;
- gnutls_session_t handle;
- char *hostname;
- char *authzid;
-@@ -78,6 +79,7 @@ qcrypto_tls_session_free(QCryptoTLSSession *session)
- g_free(session->hostname);
- g_free(session->peername);
- g_free(session->authzid);
-+ qcrypto_tls_creds_box_unref(session->credsbox);
- object_unref(OBJECT(session->creds));
- qemu_mutex_destroy(&session->lock);
- g_free(session);
-@@ -206,63 +208,31 @@ qcrypto_tls_session_new(QCryptoTLSCreds *creds,
- goto error;
- }
-
-- if (object_dynamic_cast(OBJECT(creds),
-- TYPE_QCRYPTO_TLS_CREDS_ANON)) {
-- QCryptoTLSCredsAnon *acreds = QCRYPTO_TLS_CREDS_ANON(creds);
-- if (creds->endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
-- ret = gnutls_credentials_set(session->handle,
-- GNUTLS_CRD_ANON,
-- acreds->data.server);
-- } else {
-- ret = gnutls_credentials_set(session->handle,
-- GNUTLS_CRD_ANON,
-- acreds->data.client);
-- }
-- if (ret < 0) {
-- error_setg(errp, "Cannot set session credentials: %s",
-- gnutls_strerror(ret));
-- goto error;
-- }
-- } else if (object_dynamic_cast(OBJECT(creds),
-- TYPE_QCRYPTO_TLS_CREDS_PSK)) {
-- QCryptoTLSCredsPSK *pcreds = QCRYPTO_TLS_CREDS_PSK(creds);
-- if (creds->endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
-- ret = gnutls_credentials_set(session->handle,
-- GNUTLS_CRD_PSK,
-- pcreds->data.server);
-- } else {
-- ret = gnutls_credentials_set(session->handle,
-- GNUTLS_CRD_PSK,
-- pcreds->data.client);
-- }
-- if (ret < 0) {
-- error_setg(errp, "Cannot set session credentials: %s",
-- gnutls_strerror(ret));
-- goto error;
-- }
-- } else if (object_dynamic_cast(OBJECT(creds),
-- TYPE_QCRYPTO_TLS_CREDS_X509)) {
-- QCryptoTLSCredsX509 *tcreds = QCRYPTO_TLS_CREDS_X509(creds);
-+ ret = gnutls_credentials_set(session->handle,
-+ creds->box->type,
-+ creds->box->data.any);
-+ if (ret < 0) {
-+ error_setg(errp, "Cannot set session credentials: %s",
-+ gnutls_strerror(ret));
-+ goto error;
-+ }
-
-- ret = gnutls_credentials_set(session->handle,
-- GNUTLS_CRD_CERTIFICATE,
-- tcreds->data);
-- if (ret < 0) {
-- error_setg(errp, "Cannot set session credentials: %s",
-- gnutls_strerror(ret));
-- goto error;
-- }
-+ /*
-+ * creds->box->data.any must be kept alive for as long
-+ * as the gnutls_session_t is alive, so acquire a ref
-+ */
-+ qcrypto_tls_creds_box_ref(creds->box);
-+ session->credsbox = creds->box;
-
-- if (creds->endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
-- /* This requests, but does not enforce a client cert.
-- * The cert checking code later does enforcement */
-- gnutls_certificate_server_set_request(session->handle,
-- GNUTLS_CERT_REQUEST);
-- }
-- } else {
-- error_setg(errp, "Unsupported TLS credentials type %s",
-- object_get_typename(OBJECT(creds)));
-- goto error;
-+ if (object_dynamic_cast(OBJECT(creds),
-+ TYPE_QCRYPTO_TLS_CREDS_X509) &&
-+ creds->endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
-+ /*
-+ * This requests, but does not enforce a client cert.
-+ * The cert checking code later does enforcement
-+ */
-+ gnutls_certificate_server_set_request(session->handle,
-+ GNUTLS_CERT_REQUEST);
- }
-
- gnutls_transport_set_ptr(session->handle, session);
---
-2.52.0
-
diff --git a/kvm-crypto-introduce-a-wrapper-around-gnutls-credentials.patch b/kvm-crypto-introduce-a-wrapper-around-gnutls-credentials.patch
deleted file mode 100644
index 924aca9..0000000
--- a/kvm-crypto-introduce-a-wrapper-around-gnutls-credentials.patch
+++ /dev/null
@@ -1,237 +0,0 @@
-From 40b6edbdab73cce2107a809ce1d06c38e435d196 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 08:45:28 +0000
-Subject: [PATCH 20/30] crypto: introduce a wrapper around gnutls credentials
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [19/27] 2d07b49a224f7e86ed9d61a1f407e57fe222d859 (berrange/centos-src-qemu)
-
-The gnutls_credentials_set() method has a very suprising API contract
-that requires the caller to preserve the passed in credentials pointer
-for as long as the gnutls_session_t object is alive. QEMU is failing
-to ensure this happens.
-
-In QEMU the GNUTLS credentials object is owned by the QCryptoTLSCreds
-object instance while the GNUTLS session object is owned by the
-QCryptoTLSSession object instance. Their lifetimes are not guaranteed
-to be the same, though in most common usage the credentials will outlive
-the session. This is notably not the case, however, after the VNC server
-gained the ability to reload credentials on the fly with:
-
- commit 1f08e3415120637cad7f540d9ceb4dba3136dbdd
- Author: Zihao Chang <changzihao1@huawei.com>
- Date: Tue Mar 16 15:58:44 2021 +0800
-
- vnc: support reload x509 certificates for vnc
-
-If that is triggered while a VNC client is in the middle of performing
-a TLS handshake, we might hit a use-after-free.
-
-It is difficult to correct this problem because there's no way to deep-
-clone a GNUTLS credentials object, nor is it reference counted. Thus we
-introduce a QCryptoTLSCredsBox object whose only purpose is to add
-reference counting around the GNUTLS credentials object.
-
-The DH parameters set against a credentials object also have to be kept
-alive for as long as the credentials exist. So the box must also hold
-the DH parameters pointer.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 51e24d46e0181c42a1be498dea1cc0b473a8a76c)
----
- crypto/meson.build | 5 ++-
- crypto/tlscredsbox.c | 101 +++++++++++++++++++++++++++++++++++++++++++
- crypto/tlscredsbox.h | 50 +++++++++++++++++++++
- 3 files changed, 155 insertions(+), 1 deletion(-)
- create mode 100644 crypto/tlscredsbox.c
- create mode 100644 crypto/tlscredsbox.h
-
-diff --git a/crypto/meson.build b/crypto/meson.build
-index 735635de1f..1fc14b2a04 100644
---- a/crypto/meson.build
-+++ b/crypto/meson.build
-@@ -25,7 +25,10 @@ crypto_ss.add(files(
- ))
-
- if gnutls.found()
-- crypto_ss.add(files('x509-utils.c'))
-+ crypto_ss.add(files(
-+ 'tlscredsbox.c',
-+ 'x509-utils.c',
-+ ))
- endif
-
- if nettle.found()
-diff --git a/crypto/tlscredsbox.c b/crypto/tlscredsbox.c
-new file mode 100644
-index 0000000000..b8d9846af8
---- /dev/null
-+++ b/crypto/tlscredsbox.c
-@@ -0,0 +1,101 @@
-+/*
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ *
-+ * QEMU crypto TLS credential support
-+ *
-+ * Copyright (c) 2025 Red Hat, Inc.
-+ */
-+
-+#include "qemu/osdep.h"
-+#include "crypto/tlscredsbox.h"
-+#include "qemu/atomic.h"
-+
-+
-+static QCryptoTLSCredsBox *
-+qcrypto_tls_creds_box_new_impl(int type, bool server)
-+{
-+ QCryptoTLSCredsBox *credsbox = g_new0(QCryptoTLSCredsBox, 1);
-+ credsbox->ref = 1;
-+ credsbox->server = server;
-+ credsbox->type = type;
-+ return credsbox;
-+}
-+
-+
-+QCryptoTLSCredsBox *
-+qcrypto_tls_creds_box_new_server(int type)
-+{
-+ return qcrypto_tls_creds_box_new_impl(type, true);
-+}
-+
-+
-+QCryptoTLSCredsBox *
-+qcrypto_tls_creds_box_new_client(int type)
-+{
-+ return qcrypto_tls_creds_box_new_impl(type, false);
-+}
-+
-+static void qcrypto_tls_creds_box_free(QCryptoTLSCredsBox *credsbox)
-+{
-+ switch (credsbox->type) {
-+ case GNUTLS_CRD_CERTIFICATE:
-+ if (credsbox->data.cert) {
-+ gnutls_certificate_free_credentials(credsbox->data.cert);
-+ }
-+ break;
-+ case GNUTLS_CRD_PSK:
-+ if (credsbox->server) {
-+ if (credsbox->data.pskserver) {
-+ gnutls_psk_free_server_credentials(credsbox->data.pskserver);
-+ }
-+ } else {
-+ if (credsbox->data.pskclient) {
-+ gnutls_psk_free_client_credentials(credsbox->data.pskclient);
-+ }
-+ }
-+ break;
-+ case GNUTLS_CRD_ANON:
-+ if (credsbox->server) {
-+ if (credsbox->data.anonserver) {
-+ gnutls_anon_free_server_credentials(credsbox->data.anonserver);
-+ }
-+ } else {
-+ if (credsbox->data.anonclient) {
-+ gnutls_anon_free_client_credentials(credsbox->data.anonclient);
-+ }
-+ }
-+ break;
-+ default:
-+ g_assert_not_reached();
-+ }
-+
-+ if (credsbox->dh_params) {
-+ gnutls_dh_params_deinit(credsbox->dh_params);
-+ }
-+
-+ g_free(credsbox);
-+}
-+
-+
-+void qcrypto_tls_creds_box_ref(QCryptoTLSCredsBox *credsbox)
-+{
-+ uint32_t ref = qatomic_fetch_inc(&credsbox->ref);
-+ /* Assert waaay before the integer overflows */
-+ g_assert(ref < INT_MAX);
-+}
-+
-+
-+void qcrypto_tls_creds_box_unref(QCryptoTLSCredsBox *credsbox)
-+{
-+ if (!credsbox) {
-+ return;
-+ }
-+
-+ g_assert(credsbox->ref > 0);
-+
-+ if (qatomic_fetch_dec(&credsbox->ref) == 1) {
-+ qcrypto_tls_creds_box_free(credsbox);
-+ }
-+
-+}
-+
-diff --git a/crypto/tlscredsbox.h b/crypto/tlscredsbox.h
-new file mode 100644
-index 0000000000..eeb54d1eeb
---- /dev/null
-+++ b/crypto/tlscredsbox.h
-@@ -0,0 +1,50 @@
-+/*
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ *
-+ * QEMU crypto TLS credential support
-+ *
-+ * Copyright (c) 2025 Red Hat, Inc.
-+ */
-+
-+#ifndef QCRYPTO_TLSCREDS_BOX_H
-+#define QCRYPTO_TLSCREDS_BOX_H
-+
-+#include "qom/object.h"
-+
-+#ifdef CONFIG_GNUTLS
-+#include <gnutls/gnutls.h>
-+#endif
-+
-+typedef struct QCryptoTLSCredsBox QCryptoTLSCredsBox;
-+
-+struct QCryptoTLSCredsBox {
-+ uint32_t ref;
-+ bool server;
-+ int type;
-+ union {
-+ void *any;
-+#ifdef CONFIG_GNUTLS
-+ /*
-+ * All of these gnutls_XXXX_credentials_t types are
-+ * pointers, hence matching the 'any' field above
-+ */
-+ gnutls_anon_server_credentials_t anonserver;
-+ gnutls_anon_client_credentials_t anonclient;
-+ gnutls_psk_server_credentials_t pskserver;
-+ gnutls_psk_client_credentials_t pskclient;
-+ gnutls_certificate_credentials_t cert;
-+#endif
-+ } data;
-+#ifdef CONFIG_GNUTLS
-+ gnutls_dh_params_t dh_params;
-+#endif
-+};
-+
-+QCryptoTLSCredsBox *qcrypto_tls_creds_box_new_server(int type);
-+QCryptoTLSCredsBox *qcrypto_tls_creds_box_new_client(int type);
-+void qcrypto_tls_creds_box_ref(QCryptoTLSCredsBox *credsbox);
-+void qcrypto_tls_creds_box_unref(QCryptoTLSCredsBox *credsbox);
-+
-+G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoTLSCredsBox, qcrypto_tls_creds_box_unref);
-+
-+#endif /* QCRYPTO_TLSCREDS_BOX_H */
---
-2.52.0
-
diff --git a/kvm-crypto-introduce-method-for-reloading-TLS-creds.patch b/kvm-crypto-introduce-method-for-reloading-TLS-creds.patch
deleted file mode 100644
index 5acdb3f..0000000
--- a/kvm-crypto-introduce-method-for-reloading-TLS-creds.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 6f158b6a18e905dcd4d3c7e0451b97cbc0694b00 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 30 Jul 2025 14:31:49 +0100
-Subject: [PATCH 19/30] crypto: introduce method for reloading TLS creds
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [18/27] e4b17d44a26c5d77f4ff4d504e98d8c695fd9be7 (berrange/centos-src-qemu)
-
-This prevents direct access of the class members by the VNC
-display code.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit a5d2bf4a875cc83dd10bca2a294f2df9104d874d)
----
- crypto/tlscreds.c | 15 +++++++++++++++
- include/crypto/tlscreds.h | 13 +++++++++++++
- ui/vnc.c | 9 +--------
- 3 files changed, 29 insertions(+), 8 deletions(-)
-
-diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
-index c302b3cd72..0db9bf6eeb 100644
---- a/crypto/tlscreds.c
-+++ b/crypto/tlscreds.c
-@@ -283,6 +283,21 @@ char *qcrypto_tls_creds_get_priority(QCryptoTLSCreds *creds)
- }
-
-
-+bool qcrypto_tls_creds_reload(QCryptoTLSCreds *creds,
-+ Error **errp)
-+{
-+ QCryptoTLSCredsClass *credscls = QCRYPTO_TLS_CREDS_GET_CLASS(creds);
-+
-+ if (credscls->reload) {
-+ return credscls->reload(creds, errp);
-+ }
-+
-+ error_setg(errp, "%s does not support reloading credentials",
-+ object_get_typename(OBJECT(creds)));
-+ return false;
-+}
-+
-+
- static const TypeInfo qcrypto_tls_creds_info = {
- .parent = TYPE_OBJECT,
- .name = TYPE_QCRYPTO_TLS_CREDS,
-diff --git a/include/crypto/tlscreds.h b/include/crypto/tlscreds.h
-index afd1016088..bb9280ed1a 100644
---- a/include/crypto/tlscreds.h
-+++ b/include/crypto/tlscreds.h
-@@ -77,4 +77,17 @@ bool qcrypto_tls_creds_check_endpoint(QCryptoTLSCreds *creds,
- */
- char *qcrypto_tls_creds_get_priority(QCryptoTLSCreds *creds);
-
-+
-+/**
-+ * qcrypto_tls_creds_reload:
-+ * @creds: pointer to a TLS credentials object
-+ * @errp: pointer to a NULL-initialized error object
-+ *
-+ * Request a reload of the TLS credentials, if supported
-+ *
-+ * Returns: true on success, false on error or if not supported
-+ */
-+bool qcrypto_tls_creds_reload(QCryptoTLSCreds *creds,
-+ Error **errp);
-+
- #endif /* QCRYPTO_TLSCREDS_H */
-diff --git a/ui/vnc.c b/ui/vnc.c
-index 8ca77b2971..5e7197b7bf 100644
---- a/ui/vnc.c
-+++ b/ui/vnc.c
-@@ -578,7 +578,6 @@ VncInfo2List *qmp_query_vnc_servers(Error **errp)
- bool vnc_display_reload_certs(const char *id, Error **errp)
- {
- VncDisplay *vd = vnc_display_find(id);
-- QCryptoTLSCredsClass *creds = NULL;
-
- if (!vd) {
- error_setg(errp, "Can not find vnc display");
-@@ -590,13 +589,7 @@ bool vnc_display_reload_certs(const char *id, Error **errp)
- return false;
- }
-
-- creds = QCRYPTO_TLS_CREDS_GET_CLASS(OBJECT(vd->tlscreds));
-- if (creds->reload == NULL) {
-- error_setg(errp, "%s doesn't support to reload TLS credential",
-- object_get_typename(OBJECT(vd->tlscreds)));
-- return false;
-- }
-- if (!creds->reload(vd->tlscreds, errp)) {
-+ if (!qcrypto_tls_creds_reload(vd->tlscreds, errp)) {
- return false;
- }
-
---
-2.52.0
-
diff --git a/kvm-crypto-make-TLS-credentials-structs-private.patch b/kvm-crypto-make-TLS-credentials-structs-private.patch
deleted file mode 100644
index 2f5e770..0000000
--- a/kvm-crypto-make-TLS-credentials-structs-private.patch
+++ /dev/null
@@ -1,109 +0,0 @@
-From 9d646bf156d87b6b267b2e3bda3a9ddc90b76e55 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 15:24:25 +0000
-Subject: [PATCH 22/30] crypto: make TLS credentials structs private
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [21/27] dcbf85f9e9c241de0af69823bac7ac8d9d5a5580 (berrange/centos-src-qemu)
-
-Now that the TLS session code no longer needs to look at the TLS
-credential structs, they can be made private.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit fac244b0190bbffa7ff6811549ff1cea1ecbb3a1)
----
- crypto/tlscredsanon.c | 5 ++++-
- crypto/tlscredspriv.h | 15 ---------------
- crypto/tlscredspsk.c | 5 +++++
- crypto/tlscredsx509.c | 6 ++++++
- 4 files changed, 15 insertions(+), 16 deletions(-)
-
-diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c
-index 0a728ccbf6..646574d6ae 100644
---- a/crypto/tlscredsanon.c
-+++ b/crypto/tlscredsanon.c
-@@ -27,11 +27,14 @@
- #include "trace.h"
-
-
-+struct QCryptoTLSCredsAnon {
-+ QCryptoTLSCreds parent_obj;
-+};
-+
- #ifdef CONFIG_GNUTLS
-
- #include <gnutls/gnutls.h>
-
--
- static int
- qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds,
- Error **errp)
-diff --git a/crypto/tlscredspriv.h b/crypto/tlscredspriv.h
-index 4e6dffa22f..69dac02437 100644
---- a/crypto/tlscredspriv.h
-+++ b/crypto/tlscredspriv.h
-@@ -37,21 +37,6 @@ struct QCryptoTLSCreds {
- QCryptoTLSCredsBox *box;
- };
-
--struct QCryptoTLSCredsAnon {
-- QCryptoTLSCreds parent_obj;
--};
--
--struct QCryptoTLSCredsPSK {
-- QCryptoTLSCreds parent_obj;
-- char *username;
--};
--
--struct QCryptoTLSCredsX509 {
-- QCryptoTLSCreds parent_obj;
-- bool sanityCheck;
-- char *passwordid;
--};
--
- #ifdef CONFIG_GNUTLS
-
- int qcrypto_tls_creds_get_path(QCryptoTLSCreds *creds,
-diff --git a/crypto/tlscredspsk.c b/crypto/tlscredspsk.c
-index 5568f1ad0c..8879c84ea7 100644
---- a/crypto/tlscredspsk.c
-+++ b/crypto/tlscredspsk.c
-@@ -27,6 +27,11 @@
- #include "trace.h"
-
-
-+struct QCryptoTLSCredsPSK {
-+ QCryptoTLSCreds parent_obj;
-+ char *username;
-+};
-+
- #ifdef CONFIG_GNUTLS
-
- #include <gnutls/gnutls.h>
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 388ddb7f0e..397ff4caa9 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -28,6 +28,12 @@
- #include "trace.h"
-
-
-+struct QCryptoTLSCredsX509 {
-+ QCryptoTLSCreds parent_obj;
-+ bool sanityCheck;
-+ char *passwordid;
-+};
-+
- #ifdef CONFIG_GNUTLS
-
- #include <gnutls/gnutls.h>
---
-2.52.0
-
diff --git a/kvm-crypto-move-check-for-TLS-creds-dir-property.patch b/kvm-crypto-move-check-for-TLS-creds-dir-property.patch
deleted file mode 100644
index af0a96f..0000000
--- a/kvm-crypto-move-check-for-TLS-creds-dir-property.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From a9ee472ad318aa0d46ee2c98db43c885170b60de Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Thu, 16 Oct 2025 19:00:29 +0100
-Subject: [PATCH 12/30] crypto: move check for TLS creds 'dir' property
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [11/27] 0909498703770fb4b8b3e784a4f474e97e28bc85 (berrange/centos-src-qemu)
-
-The check for the 'dir' property is being repeated for every
-credential file to be loaded, but this results in incorrect
-logic for optional credentials. The 'dir' property is mandatory
-for PSK and x509 creds, even if some individual files are
-optional. Address this by separating the check for the 'dir'
-property.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 9d3343b00bee063f3cc7f5bee35c953fd4e7b6ee)
----
- crypto/tlscreds.c | 9 ---------
- crypto/tlscredsanon.c | 3 ++-
- crypto/tlscredspsk.c | 5 +++++
- crypto/tlscredsx509.c | 8 ++++++--
- 4 files changed, 13 insertions(+), 12 deletions(-)
-
-diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
-index 208a7e6d8f..65e97ddd11 100644
---- a/crypto/tlscreds.c
-+++ b/crypto/tlscreds.c
-@@ -102,15 +102,6 @@ qcrypto_tls_creds_get_path(QCryptoTLSCreds *creds,
- {
- int ret = -1;
-
-- if (!creds->dir) {
-- if (required) {
-- error_setg(errp, "Missing 'dir' property value");
-- return -1;
-- } else {
-- return 0;
-- }
-- }
--
- *cred = g_strdup_printf("%s/%s", creds->dir, filename);
-
- if (access(*cred, R_OK) < 0) {
-diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c
-index 44af9e6c9a..bc3351b5d6 100644
---- a/crypto/tlscredsanon.c
-+++ b/crypto/tlscredsanon.c
-@@ -43,7 +43,8 @@ qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds,
- creds->parent_obj.dir ? creds->parent_obj.dir : "<nodir>");
-
- if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
-- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
-+ if (creds->parent_obj.dir &&
-+ qcrypto_tls_creds_get_path(&creds->parent_obj,
- QCRYPTO_TLS_CREDS_DH_PARAMS,
- false, &dhparams, errp) < 0) {
- return -1;
-diff --git a/crypto/tlscredspsk.c b/crypto/tlscredspsk.c
-index 5b68a6b7ba..545d3e45db 100644
---- a/crypto/tlscredspsk.c
-+++ b/crypto/tlscredspsk.c
-@@ -81,6 +81,11 @@ qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds,
- trace_qcrypto_tls_creds_psk_load(creds,
- creds->parent_obj.dir ? creds->parent_obj.dir : "<nodir>");
-
-+ if (!creds->parent_obj.dir) {
-+ error_setg(errp, "Missing 'dir' property value");
-+ goto cleanup;
-+ }
-+
- if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
- if (creds->username) {
- error_setg(errp, "username should not be set when endpoint=server");
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 0acb17b6ec..8fe6cc8e93 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -567,8 +567,12 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- int ret;
- int rv = -1;
-
-- trace_qcrypto_tls_creds_x509_load(creds,
-- creds->parent_obj.dir ? creds->parent_obj.dir : "<nodir>");
-+ if (!creds->parent_obj.dir) {
-+ error_setg(errp, "Missing 'dir' property value");
-+ return -1;
-+ }
-+
-+ trace_qcrypto_tls_creds_x509_load(creds, creds->parent_obj.dir);
-
- if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
---
-2.52.0
-
diff --git a/kvm-crypto-move-release-of-DH-parameters-into-TLS-creds-.patch b/kvm-crypto-move-release-of-DH-parameters-into-TLS-creds-.patch
deleted file mode 100644
index 29ee9a1..0000000
--- a/kvm-crypto-move-release-of-DH-parameters-into-TLS-creds-.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-From 2dfd673dc59e20a6f4732295a9fc541168f87548 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 10:38:51 +0000
-Subject: [PATCH 15/30] crypto: move release of DH parameters into TLS creds
- parent
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [14/27] d0a354e1d3dfcf1f0af4a576b3d233ea1c537a50 (berrange/centos-src-qemu)
-
-The code for releasing DH parameters is common to all credential
-subclasses, and the unload function is only called from the
-finalizers, except for x509 reload, so can be moved into the
-parent with a little update of the reload method.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 11ea2bffda50b44610efeb355e8a261760c5e360)
----
- crypto/tlscreds.c | 6 ++++++
- crypto/tlscredsanon.c | 4 ----
- crypto/tlscredspsk.c | 4 ----
- crypto/tlscredsx509.c | 7 +++----
- 4 files changed, 9 insertions(+), 12 deletions(-)
-
-diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
-index 65e97ddd11..a9e0caf864 100644
---- a/crypto/tlscreds.c
-+++ b/crypto/tlscreds.c
-@@ -246,6 +246,12 @@ qcrypto_tls_creds_finalize(Object *obj)
- {
- QCryptoTLSCreds *creds = QCRYPTO_TLS_CREDS(obj);
-
-+#ifdef CONFIG_GNUTLS
-+ if (creds->dh_params) {
-+ gnutls_dh_params_deinit(creds->dh_params);
-+ }
-+#endif
-+
- g_free(creds->dir);
- g_free(creds->priority);
- }
-diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c
-index bc3351b5d6..1ddfe4eb31 100644
---- a/crypto/tlscredsanon.c
-+++ b/crypto/tlscredsanon.c
-@@ -92,10 +92,6 @@ qcrypto_tls_creds_anon_unload(QCryptoTLSCredsAnon *creds)
- creds->data.server = NULL;
- }
- }
-- if (creds->parent_obj.dh_params) {
-- gnutls_dh_params_deinit(creds->parent_obj.dh_params);
-- creds->parent_obj.dh_params = NULL;
-- }
- }
-
- #else /* ! CONFIG_GNUTLS */
-diff --git a/crypto/tlscredspsk.c b/crypto/tlscredspsk.c
-index 545d3e45db..bf4efe2114 100644
---- a/crypto/tlscredspsk.c
-+++ b/crypto/tlscredspsk.c
-@@ -175,10 +175,6 @@ qcrypto_tls_creds_psk_unload(QCryptoTLSCredsPSK *creds)
- creds->data.server = NULL;
- }
- }
-- if (creds->parent_obj.dh_params) {
-- gnutls_dh_params_deinit(creds->parent_obj.dh_params);
-- creds->parent_obj.dh_params = NULL;
-- }
- }
-
- #else /* ! CONFIG_GNUTLS */
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 2519f7690b..d93905ec77 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -684,10 +684,6 @@ qcrypto_tls_creds_x509_unload(QCryptoTLSCredsX509 *creds)
- gnutls_certificate_free_credentials(creds->data);
- creds->data = NULL;
- }
-- if (creds->parent_obj.dh_params) {
-- gnutls_dh_params_deinit(creds->parent_obj.dh_params);
-- creds->parent_obj.dh_params = NULL;
-- }
- }
-
-
-@@ -779,6 +775,9 @@ qcrypto_tls_creds_x509_reload(QCryptoTLSCreds *creds, Error **errp)
- qcrypto_tls_creds_x509_load(x509_creds, &local_err);
- if (local_err) {
- qcrypto_tls_creds_x509_unload(x509_creds);
-+ if (creds->dh_params) {
-+ gnutls_dh_params_deinit(creds->dh_params);
-+ }
- x509_creds->data = creds_data;
- creds->dh_params = creds_dh_params;
- error_propagate(errp, local_err);
---
-2.52.0
-
diff --git a/kvm-crypto-only-verify-CA-certs-in-chain-of-trust.patch b/kvm-crypto-only-verify-CA-certs-in-chain-of-trust.patch
deleted file mode 100644
index 653e598..0000000
--- a/kvm-crypto-only-verify-CA-certs-in-chain-of-trust.patch
+++ /dev/null
@@ -1,182 +0,0 @@
-From 6bbd4b0a03779dc90d53f3a3d44b563f73ddaf47 Mon Sep 17 00:00:00 2001
-From: Henry Kleynhans <hkleynhans@fb.com>
-Date: Wed, 22 Dec 2021 15:06:00 +0000
-Subject: [PATCH 02/30] crypto: only verify CA certs in chain of trust
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/27] 727ef11c82ee0e93595ba205ba1da4539365467c (berrange/centos-src-qemu)
-
-The CA file provided to qemu may contain CA certificates which do not
-form part of the chain of trust for the specific certificate we are
-sanity checking.
-
-This patch changes the sanity checking from validating every CA
-certificate to only checking the CA certificates which are part of the
-chain of trust (issuer chain). Other certificates are ignored.
-
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Signed-off-by: Henry Kleynhans <hkleynhans@fb.com>
-[DB: changed 'int' to 'bool' in 'checking_issuer' variable]
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 75216f239f663f66ea0358a6fc2354d39909c1e3)
----
- crypto/tlscredsx509.c | 57 ++++++++++++++++++++++++---
- tests/unit/test-crypto-tlscredsx509.c | 25 +++++++++++-
- 2 files changed, 75 insertions(+), 7 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index cd1f504471..3df2a33b0b 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -315,6 +315,51 @@ qcrypto_tls_creds_check_cert(QCryptoTLSCredsX509 *creds,
- return 0;
- }
-
-+static int
-+qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
-+ gnutls_x509_crt_t cert,
-+ gnutls_x509_crt_t *cacerts,
-+ unsigned int ncacerts,
-+ const char *cacertFile,
-+ bool isServer,
-+ bool isCA,
-+ Error **errp)
-+{
-+ gnutls_x509_crt_t *cert_to_check = &cert;
-+ bool checking_issuer = true;
-+ int retval = 0;
-+
-+ while (checking_issuer) {
-+ checking_issuer = false;
-+
-+ if (gnutls_x509_crt_check_issuer(*cert_to_check,
-+ *cert_to_check)) {
-+ /*
-+ * The cert is self-signed indicating we have
-+ * reached the root of trust.
-+ */
-+ return qcrypto_tls_creds_check_cert(
-+ creds, *cert_to_check, cacertFile,
-+ isServer, isCA, errp);
-+ }
-+ for (int i = 0; i < ncacerts; i++) {
-+ if (gnutls_x509_crt_check_issuer(*cert_to_check,
-+ cacerts[i])) {
-+ retval = qcrypto_tls_creds_check_cert(
-+ creds, cacerts[i], cacertFile,
-+ isServer, isCA, errp);
-+ if (retval < 0) {
-+ return retval;
-+ }
-+ cert_to_check = &cacerts[i];
-+ checking_issuer = true;
-+ break;
-+ }
-+ }
-+ }
-+
-+ return -1;
-+}
-
- static int
- qcrypto_tls_creds_check_cert_pair(gnutls_x509_crt_t cert,
-@@ -499,12 +544,12 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
- goto cleanup;
- }
-
-- for (i = 0; i < ncacerts; i++) {
-- if (qcrypto_tls_creds_check_cert(creds,
-- cacerts[i], cacertFile,
-- isServer, true, errp) < 0) {
-- goto cleanup;
-- }
-+ if (cert &&
-+ qcrypto_tls_creds_check_authority_chain(creds, cert,
-+ cacerts, ncacerts,
-+ cacertFile, isServer,
-+ true, errp) < 0) {
-+ goto cleanup;
- }
-
- if (cert && ncacerts &&
-diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c
-index 3c25d75ca1..a7ea5f422d 100644
---- a/tests/unit/test-crypto-tlscredsx509.c
-+++ b/tests/unit/test-crypto-tlscredsx509.c
-@@ -589,6 +589,12 @@ int main(int argc, char **argv)
- true, true, GNUTLS_KEY_KEY_CERT_SIGN,
- false, false, NULL, NULL,
- 0, 0);
-+ TLS_CERT_REQ(cacertlevel1creq_invalid, cacertrootreq,
-+ "UK", "qemu level 1c invalid", NULL, NULL, NULL, NULL,
-+ true, true, true,
-+ true, true, GNUTLS_KEY_KEY_CERT_SIGN,
-+ false, false, NULL, NULL,
-+ 360, 400);
- TLS_CERT_REQ(cacertlevel2areq, cacertlevel1areq,
- "UK", "qemu level 2a", NULL, NULL, NULL, NULL,
- true, true, true,
-@@ -617,16 +623,32 @@ int main(int argc, char **argv)
- cacertlevel2areq.crt,
- };
-
-+
- test_tls_write_cert_chain(WORKDIR "cacertchain-ctx.pem",
- certchain,
- G_N_ELEMENTS(certchain));
-
-+ gnutls_x509_crt_t certchain_with_invalid[] = {
-+ cacertrootreq.crt,
-+ cacertlevel1areq.crt,
-+ cacertlevel1breq.crt,
-+ cacertlevel1creq_invalid.crt,
-+ cacertlevel2areq.crt,
-+ };
-+
-+ test_tls_write_cert_chain(WORKDIR "cacertchain-with-invalid-ctx.pem",
-+ certchain_with_invalid,
-+ G_N_ELEMENTS(certchain_with_invalid));
-+
- TLS_TEST_REG(chain1, true,
- WORKDIR "cacertchain-ctx.pem",
- servercertlevel3areq.filename, false);
- TLS_TEST_REG(chain2, false,
- WORKDIR "cacertchain-ctx.pem",
- clientcertlevel2breq.filename, false);
-+ TLS_TEST_REG(certchainwithexpiredcert, false,
-+ WORKDIR "cacertchain-with-invalid-ctx.pem",
-+ clientcertlevel2breq.filename, false);
-
- /* Some missing certs - first two are fatal, the last
- * is ok
-@@ -640,7 +662,6 @@ int main(int argc, char **argv)
- TLS_TEST_REG(missingclient, false,
- cacert1req.filename,
- "clientcertdoesnotexist.pem", false);
--
- ret = g_test_run();
-
- test_tls_discard_cert(&cacertreq);
-@@ -694,10 +715,12 @@ int main(int argc, char **argv)
- test_tls_discard_cert(&cacertrootreq);
- test_tls_discard_cert(&cacertlevel1areq);
- test_tls_discard_cert(&cacertlevel1breq);
-+ test_tls_discard_cert(&cacertlevel1creq_invalid);
- test_tls_discard_cert(&cacertlevel2areq);
- test_tls_discard_cert(&servercertlevel3areq);
- test_tls_discard_cert(&clientcertlevel2breq);
- unlink(WORKDIR "cacertchain-ctx.pem");
-+ unlink(WORKDIR "cacertchain-with-invalid-ctx.pem");
-
- test_tls_cleanup(KEYFILE);
- rmdir(WORKDIR);
---
-2.52.0
-
diff --git a/kvm-crypto-reduce-duplication-in-handling-TLS-priority-s.patch b/kvm-crypto-reduce-duplication-in-handling-TLS-priority-s.patch
deleted file mode 100644
index 07aef03..0000000
--- a/kvm-crypto-reduce-duplication-in-handling-TLS-priority-s.patch
+++ /dev/null
@@ -1,224 +0,0 @@
-From d3d0436e2be1fa3635086114d4def84d8bbaafd0 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 10:06:12 +0000
-Subject: [PATCH 18/30] crypto: reduce duplication in handling TLS priority
- strings
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [17/27] b76640c8cffd64aa690959ba5c7f6bfcbfbed135 (berrange/centos-src-qemu)
-
-The logic for setting the TLS priority string on a session object has a
-significant amount of logic duplication across the different credential
-types. By recording the extra priority string suffix against the
-credential class, we can introduce a common method for building the
-priority string. The TLS session can now set the priority string without
-caring about the credential type.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit e82fccb4a37d84d75ebdbd78d15578a2321870d2)
----
- crypto/tlscreds.c | 15 ++++++++++
- crypto/tlscredsanon.c | 2 ++
- crypto/tlscredspsk.c | 2 ++
- crypto/tlssession.c | 60 ++++++---------------------------------
- include/crypto/tlscreds.h | 13 +++++++++
- 5 files changed, 41 insertions(+), 51 deletions(-)
-
-diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
-index a9e0caf864..c302b3cd72 100644
---- a/crypto/tlscreds.c
-+++ b/crypto/tlscreds.c
-@@ -268,6 +268,21 @@ bool qcrypto_tls_creds_check_endpoint(QCryptoTLSCreds *creds,
- return true;
- }
-
-+
-+char *qcrypto_tls_creds_get_priority(QCryptoTLSCreds *creds)
-+{
-+ QCryptoTLSCredsClass *tcc = QCRYPTO_TLS_CREDS_GET_CLASS(creds);
-+ const char *priorityBase =
-+ creds->priority ? creds->priority : CONFIG_TLS_PRIORITY;
-+
-+ if (tcc->prioritySuffix) {
-+ return g_strdup_printf("%s:%s", priorityBase, tcc->prioritySuffix);
-+ } else {
-+ return g_strdup(priorityBase);
-+ }
-+}
-+
-+
- static const TypeInfo qcrypto_tls_creds_info = {
- .parent = TYPE_OBJECT,
- .name = TYPE_QCRYPTO_TLS_CREDS,
-diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c
-index 1ddfe4eb31..5c55b07b2f 100644
---- a/crypto/tlscredsanon.c
-+++ b/crypto/tlscredsanon.c
-@@ -137,8 +137,10 @@ static void
- qcrypto_tls_creds_anon_class_init(ObjectClass *oc, const void *data)
- {
- UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
-+ QCryptoTLSCredsClass *tcc = QCRYPTO_TLS_CREDS_CLASS(oc);
-
- ucc->complete = qcrypto_tls_creds_anon_complete;
-+ tcc->prioritySuffix = "+ANON-DH";
- }
-
-
-diff --git a/crypto/tlscredspsk.c b/crypto/tlscredspsk.c
-index bf4efe2114..6c2feae077 100644
---- a/crypto/tlscredspsk.c
-+++ b/crypto/tlscredspsk.c
-@@ -240,8 +240,10 @@ static void
- qcrypto_tls_creds_psk_class_init(ObjectClass *oc, const void *data)
- {
- UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
-+ QCryptoTLSCredsClass *tcc = QCRYPTO_TLS_CREDS_CLASS(oc);
-
- ucc->complete = qcrypto_tls_creds_psk_complete;
-+ tcc->prioritySuffix = "+ECDHE-PSK:+DHE-PSK:+PSK";
-
- object_class_property_add_str(oc, "username",
- qcrypto_tls_creds_psk_prop_get_username,
-diff --git a/crypto/tlssession.c b/crypto/tlssession.c
-index 0f86d1393f..827f557ff8 100644
---- a/crypto/tlssession.c
-+++ b/crypto/tlssession.c
-@@ -155,9 +155,6 @@ qcrypto_tls_session_pull(void *opaque, void *buf, size_t len)
- }
- }
-
--#define TLS_PRIORITY_ADDITIONAL_ANON "+ANON-DH"
--#define TLS_PRIORITY_ADDITIONAL_PSK "+ECDHE-PSK:+DHE-PSK:+PSK"
--
- QCryptoTLSSession *
- qcrypto_tls_session_new(QCryptoTLSCreds *creds,
- const char *hostname,
-@@ -167,6 +164,7 @@ qcrypto_tls_session_new(QCryptoTLSCreds *creds,
- {
- QCryptoTLSSession *session;
- int ret;
-+ g_autofree char *prio = NULL;
-
- session = g_new0(QCryptoTLSSession, 1);
- trace_qcrypto_tls_session_new(
-@@ -200,28 +198,17 @@ qcrypto_tls_session_new(QCryptoTLSCreds *creds,
- goto error;
- }
-
-+ prio = qcrypto_tls_creds_get_priority(creds);
-+ ret = gnutls_priority_set_direct(session->handle, prio, NULL);
-+ if (ret < 0) {
-+ error_setg(errp, "Unable to set TLS session priority %s: %s",
-+ prio, gnutls_strerror(ret));
-+ goto error;
-+ }
-+
- if (object_dynamic_cast(OBJECT(creds),
- TYPE_QCRYPTO_TLS_CREDS_ANON)) {
- QCryptoTLSCredsAnon *acreds = QCRYPTO_TLS_CREDS_ANON(creds);
-- char *prio;
--
-- if (creds->priority != NULL) {
-- prio = g_strdup_printf("%s:%s",
-- creds->priority,
-- TLS_PRIORITY_ADDITIONAL_ANON);
-- } else {
-- prio = g_strdup(CONFIG_TLS_PRIORITY ":"
-- TLS_PRIORITY_ADDITIONAL_ANON);
-- }
--
-- ret = gnutls_priority_set_direct(session->handle, prio, NULL);
-- if (ret < 0) {
-- error_setg(errp, "Unable to set TLS session priority %s: %s",
-- prio, gnutls_strerror(ret));
-- g_free(prio);
-- goto error;
-- }
-- g_free(prio);
- if (creds->endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
- ret = gnutls_credentials_set(session->handle,
- GNUTLS_CRD_ANON,
-@@ -239,25 +226,6 @@ qcrypto_tls_session_new(QCryptoTLSCreds *creds,
- } else if (object_dynamic_cast(OBJECT(creds),
- TYPE_QCRYPTO_TLS_CREDS_PSK)) {
- QCryptoTLSCredsPSK *pcreds = QCRYPTO_TLS_CREDS_PSK(creds);
-- char *prio;
--
-- if (creds->priority != NULL) {
-- prio = g_strdup_printf("%s:%s",
-- creds->priority,
-- TLS_PRIORITY_ADDITIONAL_PSK);
-- } else {
-- prio = g_strdup(CONFIG_TLS_PRIORITY ":"
-- TLS_PRIORITY_ADDITIONAL_PSK);
-- }
--
-- ret = gnutls_priority_set_direct(session->handle, prio, NULL);
-- if (ret < 0) {
-- error_setg(errp, "Unable to set TLS session priority %s: %s",
-- prio, gnutls_strerror(ret));
-- g_free(prio);
-- goto error;
-- }
-- g_free(prio);
- if (creds->endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
- ret = gnutls_credentials_set(session->handle,
- GNUTLS_CRD_PSK,
-@@ -275,17 +243,7 @@ qcrypto_tls_session_new(QCryptoTLSCreds *creds,
- } else if (object_dynamic_cast(OBJECT(creds),
- TYPE_QCRYPTO_TLS_CREDS_X509)) {
- QCryptoTLSCredsX509 *tcreds = QCRYPTO_TLS_CREDS_X509(creds);
-- const char *prio = creds->priority;
-- if (!prio) {
-- prio = CONFIG_TLS_PRIORITY;
-- }
-
-- ret = gnutls_priority_set_direct(session->handle, prio, NULL);
-- if (ret < 0) {
-- error_setg(errp, "Cannot set default TLS session priority %s: %s",
-- prio, gnutls_strerror(ret));
-- goto error;
-- }
- ret = gnutls_credentials_set(session->handle,
- GNUTLS_CRD_CERTIFICATE,
- tcreds->data);
-diff --git a/include/crypto/tlscreds.h b/include/crypto/tlscreds.h
-index 2a8a857010..afd1016088 100644
---- a/include/crypto/tlscreds.h
-+++ b/include/crypto/tlscreds.h
-@@ -47,6 +47,7 @@ typedef bool (*CryptoTLSCredsReload)(QCryptoTLSCreds *, Error **);
- struct QCryptoTLSCredsClass {
- ObjectClass parent_class;
- CryptoTLSCredsReload reload;
-+ const char *prioritySuffix;
- };
-
- /**
-@@ -64,4 +65,16 @@ bool qcrypto_tls_creds_check_endpoint(QCryptoTLSCreds *creds,
- QCryptoTLSCredsEndpoint endpoint,
- Error **errp);
-
-+
-+/**
-+ * qcrypto_tls_creds_get_priority:
-+ * @creds: pointer to a TLS credentials object
-+ *
-+ * Get the TLS credentials priority string. The caller
-+ * must free the returned string when no longer required.
-+ *
-+ * Returns: a non-NULL priority string
-+ */
-+char *qcrypto_tls_creds_get_priority(QCryptoTLSCreds *creds);
-+
- #endif /* QCRYPTO_TLSCREDS_H */
---
-2.52.0
-
diff --git a/kvm-crypto-remove-duplication-loading-x509-CA-cert.patch b/kvm-crypto-remove-duplication-loading-x509-CA-cert.patch
deleted file mode 100644
index 57cd81b..0000000
--- a/kvm-crypto-remove-duplication-loading-x509-CA-cert.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From 6612e62737fd0df2427ae0d4c748d27d5c600855 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Thu, 16 Oct 2025 19:32:39 +0100
-Subject: [PATCH 17/30] crypto: remove duplication loading x509 CA cert
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [16/27] 8c736e80792e3be964b5db6061f180515108020d (berrange/centos-src-qemu)
-
-The CA cert is mandatory in both client and server scenarios.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit fb8a0b0bfc816fd26ba62d7cae22db890fdb5203)
----
- crypto/tlscredsx509.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 7271b549ee..dd28faf872 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -578,11 +578,14 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
-
- trace_qcrypto_tls_creds_x509_load(creds, creds->parent_obj.dir);
-
-+ if (qcrypto_tls_creds_get_path(&creds->parent_obj,
-+ QCRYPTO_TLS_CREDS_X509_CA_CERT,
-+ true, &cacert, errp) < 0) {
-+ return -1;
-+ }
-+
- if (isServer) {
- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
-- QCRYPTO_TLS_CREDS_X509_CA_CERT,
-- true, &cacert, errp) < 0 ||
-- qcrypto_tls_creds_get_path(&creds->parent_obj,
- QCRYPTO_TLS_CREDS_X509_CA_CRL,
- false, &cacrl, errp) < 0 ||
- qcrypto_tls_creds_get_path(&creds->parent_obj,
-@@ -598,9 +601,6 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- }
- } else {
- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
-- QCRYPTO_TLS_CREDS_X509_CA_CERT,
-- true, &cacert, errp) < 0 ||
-- qcrypto_tls_creds_get_path(&creds->parent_obj,
- QCRYPTO_TLS_CREDS_X509_CLIENT_CERT,
- false, &cert, errp) < 0 ||
- qcrypto_tls_creds_get_path(&creds->parent_obj,
---
-2.52.0
-
diff --git a/kvm-crypto-remove-extraneous-pointer-usage-in-gnutls-cer.patch b/kvm-crypto-remove-extraneous-pointer-usage-in-gnutls-cer.patch
deleted file mode 100644
index fef498a..0000000
--- a/kvm-crypto-remove-extraneous-pointer-usage-in-gnutls-cer.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 8b5d7a01770abb2a46bb6b50db185ae3af70546d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Fri, 11 Jul 2025 13:30:07 +0100
-Subject: [PATCH 03/30] crypto: remove extraneous pointer usage in gnutls certs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/27] bfb05b518dbff0a229b8fe58af4a38cd54b6cd8b (berrange/centos-src-qemu)
-
-The 'gnutls_x509_crt_t' type is already a pointer, not a struct,
-so the extra level of pointer indirection is not needed.
-
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 068e0379af39e5f02fc3e47f7638af194695c990)
----
- crypto/tlscredsx509.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 3df2a33b0b..4169ad9a75 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -325,25 +325,25 @@ qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
- bool isCA,
- Error **errp)
- {
-- gnutls_x509_crt_t *cert_to_check = &cert;
-+ gnutls_x509_crt_t cert_to_check = cert;
- bool checking_issuer = true;
- int retval = 0;
-
- while (checking_issuer) {
- checking_issuer = false;
-
-- if (gnutls_x509_crt_check_issuer(*cert_to_check,
-- *cert_to_check)) {
-+ if (gnutls_x509_crt_check_issuer(cert_to_check,
-+ cert_to_check)) {
- /*
- * The cert is self-signed indicating we have
- * reached the root of trust.
- */
- return qcrypto_tls_creds_check_cert(
-- creds, *cert_to_check, cacertFile,
-+ creds, cert_to_check, cacertFile,
- isServer, isCA, errp);
- }
- for (int i = 0; i < ncacerts; i++) {
-- if (gnutls_x509_crt_check_issuer(*cert_to_check,
-+ if (gnutls_x509_crt_check_issuer(cert_to_check,
- cacerts[i])) {
- retval = qcrypto_tls_creds_check_cert(
- creds, cacerts[i], cacertFile,
-@@ -351,7 +351,7 @@ qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
- if (retval < 0) {
- return retval;
- }
-- cert_to_check = &cacerts[i];
-+ cert_to_check = cacerts[i];
- checking_issuer = true;
- break;
- }
---
-2.52.0
-
diff --git a/kvm-crypto-remove-needless-indirection-via-parent_obj-fi.patch b/kvm-crypto-remove-needless-indirection-via-parent_obj-fi.patch
deleted file mode 100644
index c812458..0000000
--- a/kvm-crypto-remove-needless-indirection-via-parent_obj-fi.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 9d1e28cdfaa95f391cd378c9a1a93f8dddb95a5d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 10:26:23 +0000
-Subject: [PATCH 14/30] crypto: remove needless indirection via parent_obj
- field
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [13/27] e71a002d43dc2fe08a6ac565e21bb49719a3c1e6 (berrange/centos-src-qemu)
-
-The reload method already has a pointer to the parent object in
-the 'creds' parameter that is passed in, so indirect access via
-the subclass 'parent_obj' field is redundant.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 20ee3064186d3a1eedcac0a76cc8af0993e36714)
----
- crypto/tlscredsx509.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 6640159a5b..2519f7690b 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -772,15 +772,15 @@ qcrypto_tls_creds_x509_reload(QCryptoTLSCreds *creds, Error **errp)
- QCryptoTLSCredsX509 *x509_creds = QCRYPTO_TLS_CREDS_X509(creds);
- Error *local_err = NULL;
- gnutls_certificate_credentials_t creds_data = x509_creds->data;
-- gnutls_dh_params_t creds_dh_params = x509_creds->parent_obj.dh_params;
-+ gnutls_dh_params_t creds_dh_params = creds->dh_params;
-
- x509_creds->data = NULL;
-- x509_creds->parent_obj.dh_params = NULL;
-+ creds->dh_params = NULL;
- qcrypto_tls_creds_x509_load(x509_creds, &local_err);
- if (local_err) {
- qcrypto_tls_creds_x509_unload(x509_creds);
- x509_creds->data = creds_data;
-- x509_creds->parent_obj.dh_params = creds_dh_params;
-+ creds->dh_params = creds_dh_params;
- error_propagate(errp, local_err);
- return false;
- }
---
-2.52.0
-
diff --git a/kvm-crypto-remove-redundant-access-checks-before-loading.patch b/kvm-crypto-remove-redundant-access-checks-before-loading.patch
deleted file mode 100644
index 2d85510..0000000
--- a/kvm-crypto-remove-redundant-access-checks-before-loading.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From fe9e05cb05979c6c57f37711dae34c534824f72b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 14:12:47 +0000
-Subject: [PATCH 11/30] crypto: remove redundant access() checks before loading
- certs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [10/27] 9d5c3aaf23b4d74ef000ca6efc2e5062b067a5db (berrange/centos-src-qemu)
-
-The qcrypto_tls_creds_get_path method will perform an access()
-check on the file and return a NULL path if it fails. By the
-time we get to loading the cert files we know they must exist
-on disk and thus the second access() check is redundant.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 9fe991d0a490e18c64b02540b141ad8c3e2a477e)
----
- crypto/tlscredsx509.c | 22 ++++++++++------------
- 1 file changed, 10 insertions(+), 12 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 75c70af522..0acb17b6ec 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -496,8 +496,7 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
- size_t i;
- int ret = -1;
-
-- if (certFile &&
-- access(certFile, R_OK) == 0) {
-+ if (certFile) {
- if (qcrypto_tls_creds_load_cert_list(creds,
- certFile,
- &certs,
-@@ -508,16 +507,15 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
- goto cleanup;
- }
- }
-- if (access(cacertFile, R_OK) == 0) {
-- if (qcrypto_tls_creds_load_cert_list(creds,
-- cacertFile,
-- &cacerts,
-- &ncacerts,
-- isServer,
-- true,
-- errp) < 0) {
-- goto cleanup;
-- }
-+
-+ if (qcrypto_tls_creds_load_cert_list(creds,
-+ cacertFile,
-+ &cacerts,
-+ &ncacerts,
-+ isServer,
-+ true,
-+ errp) < 0) {
-+ goto cleanup;
- }
-
- for (i = 0; i < ncerts; i++) {
---
-2.52.0
-
diff --git a/kvm-crypto-remove-redundant-parameter-checking-CA-certs.patch b/kvm-crypto-remove-redundant-parameter-checking-CA-certs.patch
deleted file mode 100644
index ea5473d..0000000
--- a/kvm-crypto-remove-redundant-parameter-checking-CA-certs.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From 1f13d21759e1e2172473d23653b8b86c886fc3a1 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 19:54:08 +0000
-Subject: [PATCH 08/30] crypto: remove redundant parameter checking CA certs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [7/27] bb2ecd4d9c4db43aa97e7eab7b7eb1e868911fc6 (berrange/centos-src-qemu)
-
-The only caller of qcrypto_tls_creds_check_authority_chain always
-passes 'true' for the 'isCA' parameter. The point of this method
-is to check the CA chani, so no other value would ever make sense.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 3821a538f7ec0a7973fa7b751dcea65d0b9b3213)
----
- crypto/tlscredsx509.c | 7 +++----
- 1 file changed, 3 insertions(+), 4 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index db2b74bafa..847fd4d9fa 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -315,7 +315,6 @@ qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
- unsigned int ncacerts,
- const char *cacertFile,
- bool isServer,
-- bool isCA,
- Error **errp)
- {
- gnutls_x509_crt_t cert_to_check = certs[ncerts - 1];
-@@ -356,7 +355,7 @@ qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
- */
- return qcrypto_tls_creds_check_cert(
- creds, cert_to_check, cacertFile,
-- isServer, isCA, errp);
-+ isServer, true, errp);
- }
- for (int i = 0; i < ncacerts; i++) {
- if (gnutls_x509_crt_check_issuer(cert_to_check,
-@@ -370,7 +369,7 @@ qcrypto_tls_creds_check_authority_chain(QCryptoTLSCredsX509 *creds,
- }
-
- if (qcrypto_tls_creds_check_cert(creds, cert_issuer, cacertFile,
-- isServer, isCA, errp) < 0) {
-+ isServer, true, errp) < 0) {
- return -1;
- }
-
-@@ -534,7 +533,7 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
- certs, ncerts,
- cacerts, ncacerts,
- cacertFile, isServer,
-- true, errp) < 0) {
-+ errp) < 0) {
- goto cleanup;
- }
-
---
-2.52.0
-
diff --git a/kvm-crypto-replace-stat-with-access-for-credential-check.patch b/kvm-crypto-replace-stat-with-access-for-credential-check.patch
deleted file mode 100644
index 4efa3a9..0000000
--- a/kvm-crypto-replace-stat-with-access-for-credential-check.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 64e7e9680877199b86dfa042e581c624be48c21b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Fri, 1 Aug 2025 15:06:13 +0100
-Subject: [PATCH 10/30] crypto: replace stat() with access() for credential
- checks
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [9/27] d0106e01c1f312ed35cc405f5b992cfa5c912936 (berrange/centos-src-qemu)
-
-Readability of the credential files is what matters for our usage,
-so access() is more appropriate than stat().
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 2114ae9faaabe4ff1c455811bb38085324af17b7)
----
- crypto/tlscreds.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
-index 9e59594d67..208a7e6d8f 100644
---- a/crypto/tlscreds.c
-+++ b/crypto/tlscreds.c
-@@ -100,7 +100,6 @@ qcrypto_tls_creds_get_path(QCryptoTLSCreds *creds,
- char **cred,
- Error **errp)
- {
-- struct stat sb;
- int ret = -1;
-
- if (!creds->dir) {
-@@ -114,7 +113,7 @@ qcrypto_tls_creds_get_path(QCryptoTLSCreds *creds,
-
- *cred = g_strdup_printf("%s/%s", creds->dir, filename);
-
-- if (stat(*cred, &sb) < 0) {
-+ if (access(*cred, R_OK) < 0) {
- if (errno == ENOENT && !required) {
- ret = 0;
- } else {
---
-2.52.0
-
diff --git a/kvm-crypto-shorten-the-endpoint-server-check-in-TLS-cred.patch b/kvm-crypto-shorten-the-endpoint-server-check-in-TLS-cred.patch
deleted file mode 100644
index efba5ab..0000000
--- a/kvm-crypto-shorten-the-endpoint-server-check-in-TLS-cred.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From 3a16bbb0ea0c4cd197c32829557d828eab5d595f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 18:30:48 +0000
-Subject: [PATCH 16/30] crypto: shorten the endpoint == server check in TLS
- creds
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [15/27] 9f5752de2ccb5baf1c4641a9f2a15d948ce33d84 (berrange/centos-src-qemu)
-
-This eliminates a number of long lines aiding readability.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 7751083fa4ecd5ef31b83ed7c17dcf13f3e617f2)
----
- crypto/tlscredsx509.c | 11 ++++++-----
- 1 file changed, 6 insertions(+), 5 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index d93905ec77..7271b549ee 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -567,6 +567,8 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- g_autofree char *cert = NULL;
- g_autofree char *key = NULL;
- g_autofree char *dhparams = NULL;
-+ bool isServer = (creds->parent_obj.endpoint ==
-+ QCRYPTO_TLS_CREDS_ENDPOINT_SERVER);
- int ret;
-
- if (!creds->parent_obj.dir) {
-@@ -576,7 +578,7 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
-
- trace_qcrypto_tls_creds_x509_load(creds, creds->parent_obj.dir);
-
-- if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
-+ if (isServer) {
- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
- QCRYPTO_TLS_CREDS_X509_CA_CERT,
- true, &cacert, errp) < 0 ||
-@@ -609,9 +611,8 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- }
-
- if (creds->sanityCheck &&
-- qcrypto_tls_creds_x509_sanity_check(creds,
-- creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER,
-- cacert, cert, errp) < 0) {
-+ qcrypto_tls_creds_x509_sanity_check(creds, isServer,
-+ cacert, cert, errp) < 0) {
- return -1;
- }
-
-@@ -663,7 +664,7 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- }
- }
-
-- if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) {
-+ if (isServer) {
- if (qcrypto_tls_creds_get_dh_params_file(&creds->parent_obj, dhparams,
- &creds->parent_obj.dh_params,
- errp) < 0) {
---
-2.52.0
-
diff --git a/kvm-crypto-stop-requiring-key-encipherment-usage-in-x509.patch b/kvm-crypto-stop-requiring-key-encipherment-usage-in-x509.patch
deleted file mode 100644
index 16ebd0b..0000000
--- a/kvm-crypto-stop-requiring-key-encipherment-usage-in-x509.patch
+++ /dev/null
@@ -1,388 +0,0 @@
-From d71e346168e4860d1747ffd6e83b3c28f9a4d1d1 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Tue, 1 Jul 2025 18:33:21 +0100
-Subject: [PATCH 06/30] crypto: stop requiring "key encipherment" usage in x509
- certs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [5/27] cc1e25c476d8394363ebac42ac355068dde90b55 (berrange/centos-src-qemu)
-
-This usage flag was deprecated by RFC8813, such that it is
-forbidden to be present for certs using ECDSA/ECDH algorithms,
-and in TLS 1.3 is conceptually obsolete.
-
-As such many valid certs will no longer have this key usage
-flag set, and QEMU should not be rejecting them, as this
-prevents use of otherwise valid & desirable algorithms.
-
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 3995fc238e0599e0417ba958ffc5c7a609e82a7f)
----
- crypto/tlscredsx509.c | 10 +-------
- docs/system/tls.rst | 13 +++-------
- tests/unit/crypto-tls-x509-helpers.h | 6 ++---
- tests/unit/test-crypto-tlscredsx509.c | 36 +++++++++++++--------------
- tests/unit/test-crypto-tlssession.c | 14 +++++------
- tests/unit/test-io-channel-tls.c | 4 +--
- 6 files changed, 34 insertions(+), 49 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 86fdfce886..db2b74bafa 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -144,7 +144,7 @@ qcrypto_tls_creds_check_cert_key_usage(QCryptoTLSCredsX509 *creds,
- if (status < 0) {
- if (status == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) {
- usage = isCA ? GNUTLS_KEY_KEY_CERT_SIGN :
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT;
-+ GNUTLS_KEY_DIGITAL_SIGNATURE;
- } else {
- error_setg(errp,
- "Unable to query certificate %s key usage: %s",
-@@ -171,14 +171,6 @@ qcrypto_tls_creds_check_cert_key_usage(QCryptoTLSCredsX509 *creds,
- return -1;
- }
- }
-- if (!(usage & GNUTLS_KEY_KEY_ENCIPHERMENT)) {
-- if (critical) {
-- error_setg(errp,
-- "Certificate %s usage does not permit key "
-- "encipherment", certFile);
-- return -1;
-- }
-- }
- }
-
- return 0;
-diff --git a/docs/system/tls.rst b/docs/system/tls.rst
-index e284c82801..a4f6781d62 100644
---- a/docs/system/tls.rst
-+++ b/docs/system/tls.rst
-@@ -118,7 +118,6 @@ information for each server, and use it to issue server certificates.
- ip_address = 2620:0:cafe::87
- ip_address = 2001:24::92
- tls_www_server
-- encryption_key
- signing_key
- EOF
- # certtool --generate-privkey > server-hostNNN-key.pem
-@@ -134,9 +133,8 @@ the subject alt name extension data. The ``tls_www_server`` keyword is
- the key purpose extension to indicate this certificate is intended for
- usage in a web server. Although QEMU network services are not in fact
- HTTP servers (except for VNC websockets), setting this key purpose is
--still recommended. The ``encryption_key`` and ``signing_key`` keyword is
--the key usage extension to indicate this certificate is intended for
--usage in the data session.
-+still recommended. The ``signing_key`` keyword is the key usage extension
-+to indicate this certificate is intended for usage in the data session.
-
- The ``server-hostNNN-key.pem`` and ``server-hostNNN-cert.pem`` files
- should now be securely copied to the server for which they were
-@@ -171,7 +169,6 @@ certificates.
- organization = Name of your organization
- cn = hostNNN.foo.example.com
- tls_www_client
-- encryption_key
- signing_key
- EOF
- # certtool --generate-privkey > client-hostNNN-key.pem
-@@ -187,9 +184,8 @@ the ``dns_name`` and ``ip_address`` fields are not included. The
- ``tls_www_client`` keyword is the key purpose extension to indicate this
- certificate is intended for usage in a web client. Although QEMU network
- clients are not in fact HTTP clients, setting this key purpose is still
--recommended. The ``encryption_key`` and ``signing_key`` keyword is the
--key usage extension to indicate this certificate is intended for usage
--in the data session.
-+recommended. The ``signing_key`` keyword is the key usage extension to
-+indicate this certificate is intended for usage in the data session.
-
- The ``client-hostNNN-key.pem`` and ``client-hostNNN-cert.pem`` files
- should now be securely copied to the client for which they were
-@@ -222,7 +218,6 @@ client and server instructions in one.
- ip_address = 2001:24::92
- tls_www_server
- tls_www_client
-- encryption_key
- signing_key
- EOF
- # certtool --generate-privkey > both-hostNNN-key.pem
-diff --git a/tests/unit/crypto-tls-x509-helpers.h b/tests/unit/crypto-tls-x509-helpers.h
-index 2a0f7c04fd..7e9a508ad6 100644
---- a/tests/unit/crypto-tls-x509-helpers.h
-+++ b/tests/unit/crypto-tls-x509-helpers.h
-@@ -148,8 +148,7 @@ void test_tls_cleanup(const char *keyfile);
- .basicConstraintsIsCA = false, \
- .keyUsageEnable = true, \
- .keyUsageCritical = true, \
-- .keyUsageValue = \
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT, \
-+ .keyUsageValue = GNUTLS_KEY_DIGITAL_SIGNATURE, \
- .keyPurposeEnable = true, \
- .keyPurposeCritical = true, \
- .keyPurposeOID1 = GNUTLS_KP_TLS_WWW_CLIENT, \
-@@ -168,8 +167,7 @@ void test_tls_cleanup(const char *keyfile);
- .basicConstraintsIsCA = false, \
- .keyUsageEnable = true, \
- .keyUsageCritical = true, \
-- .keyUsageValue = \
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT, \
-+ .keyUsageValue = GNUTLS_KEY_DIGITAL_SIGNATURE, \
- .keyPurposeEnable = true, \
- .keyPurposeCritical = true, \
- .keyPurposeOID1 = GNUTLS_KP_TLS_WWW_SERVER, \
-diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c
-index a84df01e51..f8e7f990c0 100644
---- a/tests/unit/test-crypto-tlscredsx509.c
-+++ b/tests/unit/test-crypto-tlscredsx509.c
-@@ -166,14 +166,14 @@ int main(int argc, char **argv)
- "UK", "qemu.org", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
- TLS_CERT_REQ(clientcertreq, cacertreq,
- "UK", "qemu", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_CLIENT, NULL,
- 0, 0);
-
-@@ -196,7 +196,7 @@ int main(int argc, char **argv)
- "UK", "qemu.org", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
-
-@@ -211,7 +211,7 @@ int main(int argc, char **argv)
- "UK", "qemu.org", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
-
-@@ -226,7 +226,7 @@ int main(int argc, char **argv)
- "UK", "qemu.org", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
-
-@@ -250,7 +250,7 @@ int main(int argc, char **argv)
- "UK", "qemu.org", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
- /* no-basic */
-@@ -264,7 +264,7 @@ int main(int argc, char **argv)
- "UK", "qemu.org", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
- /* Key usage:dig-sig:critical */
-@@ -278,7 +278,7 @@ int main(int argc, char **argv)
- "UK", "qemu.org", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
-
-@@ -303,7 +303,7 @@ int main(int argc, char **argv)
- "UK", "qemu", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT |
-+ GNUTLS_KEY_DIGITAL_SIGNATURE |
- GNUTLS_KEY_KEY_CERT_SIGN,
- false, false, NULL, NULL,
- 0, 0);
-@@ -406,7 +406,7 @@ int main(int argc, char **argv)
- "UK", "qemu", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT |
-+ GNUTLS_KEY_DIGITAL_SIGNATURE |
- GNUTLS_KEY_KEY_CERT_SIGN,
- false, false, NULL, NULL,
- 0, 0);
-@@ -508,21 +508,21 @@ int main(int argc, char **argv)
- "UK", "qemu.org", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
- TLS_CERT_REQ(servercertexp1req, cacertreq,
- "UK", "qemu", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, -1);
- TLS_CERT_REQ(clientcertexp1req, cacertreq,
- "UK", "qemu", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_CLIENT, NULL,
- 0, -1);
-
-@@ -546,21 +546,21 @@ int main(int argc, char **argv)
- "UK", "qemu", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
- TLS_CERT_REQ(servercertnew1req, cacertreq,
- "UK", "qemu", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 1, 2);
- TLS_CERT_REQ(clientcertnew1req, cacertreq,
- "UK", "qemu", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_CLIENT, NULL,
- 1, 2);
-
-@@ -611,14 +611,14 @@ int main(int argc, char **argv)
- "UK", "qemu.org", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
- TLS_CERT_REQ(clientcertlevel2breq, cacertlevel1breq,
- "UK", "qemu client level 2b", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_CLIENT, NULL,
- 0, 0);
-
-diff --git a/tests/unit/test-crypto-tlssession.c b/tests/unit/test-crypto-tlssession.c
-index 554054e934..e8b2e0201c 100644
---- a/tests/unit/test-crypto-tlssession.c
-+++ b/tests/unit/test-crypto-tlssession.c
-@@ -472,14 +472,14 @@ int main(int argc, char **argv)
- "UK", "qemu.org", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
- TLS_CERT_REQ(clientcertreq, cacertreq,
- "UK", "qemu", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_CLIENT, NULL,
- 0, 0);
-
-@@ -487,7 +487,7 @@ int main(int argc, char **argv)
- "UK", "qemu", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_CLIENT, NULL,
- 0, 0);
-
-@@ -506,7 +506,7 @@ int main(int argc, char **argv)
- "192.168.122.1", "fec0::dead:beaf",
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
- /* This intentionally doesn't replicate */
-@@ -515,7 +515,7 @@ int main(int argc, char **argv)
- "192.168.122.1", "fec0::dead:beaf",
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
-
-@@ -619,14 +619,14 @@ int main(int argc, char **argv)
- "UK", "qemu.org", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
- TLS_CERT_REQ(clientcertlevel2breq, cacertlevel1breq,
- "UK", "qemu client level 2b", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_CLIENT, NULL,
- 0, 0);
-
-diff --git a/tests/unit/test-io-channel-tls.c b/tests/unit/test-io-channel-tls.c
-index 6f282ad45d..4e4034af67 100644
---- a/tests/unit/test-io-channel-tls.c
-+++ b/tests/unit/test-io-channel-tls.c
-@@ -302,14 +302,14 @@ int main(int argc, char **argv)
- "UK", "qemu.org", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_SERVER, NULL,
- 0, 0);
- TLS_CERT_REQ(clientcertreq, cacertreq,
- "UK", "qemu", NULL, NULL, NULL, NULL,
- true, true, false,
- true, true,
-- GNUTLS_KEY_DIGITAL_SIGNATURE | GNUTLS_KEY_KEY_ENCIPHERMENT,
-+ GNUTLS_KEY_DIGITAL_SIGNATURE,
- true, true, GNUTLS_KP_TLS_WWW_CLIENT, NULL,
- 0, 0);
-
---
-2.52.0
-
diff --git a/kvm-crypto-support-upto-5-parallel-certificate-identitie.patch b/kvm-crypto-support-upto-5-parallel-certificate-identitie.patch
deleted file mode 100644
index 63024d6..0000000
--- a/kvm-crypto-support-upto-5-parallel-certificate-identitie.patch
+++ /dev/null
@@ -1,302 +0,0 @@
-From dc29f175c13ecc1fe9eb5e5102c1571c7729c4b0 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 20:56:38 +0000
-Subject: [PATCH 27/30] crypto: support upto 5 parallel certificate identities
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [26/27] c7ee3d7b77f5a2e618c71d96b8b227f1aaaaf97d (berrange/centos-src-qemu)
-
-The default (required) identity is stored in server-cert.pem /
-client-cert.pem and server-key.pem / client-key.pem.
-
-The 4 extra (optional) identities are stored in server-cert-$N.pem /
-client-cert-$N.pem and server-key-$N.pem / client-key-$N.pem. The
-numbering starts at 0 and the first missing cert/key pair will
-terminate the loading process.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 211fc7e416d5661a8f6bd3cc8de7d1a68e07426c)
----
- crypto/tlscreds.c | 10 +++++-
- crypto/tlscredspriv.h | 3 ++
- crypto/tlscredsx509.c | 68 ++++++++++++++++++++++++++++-------
- crypto/tlssession.c | 1 +
- crypto/trace-events | 1 +
- docs/system/tls.rst | 54 ++++++++++++++++++++++++++--
- include/crypto/tlscredsx509.h | 6 ++++
- 7 files changed, 127 insertions(+), 16 deletions(-)
-
-diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
-index 3d25efe425..fb09e295a6 100644
---- a/crypto/tlscreds.c
-+++ b/crypto/tlscreds.c
-@@ -85,6 +85,14 @@ qcrypto_tls_creds_get_dh_params_file(QCryptoTLSCreds *creds,
- }
-
-
-+char *
-+qcrypto_tls_creds_build_path(QCryptoTLSCreds *creds,
-+ const char *filename)
-+{
-+ return g_strdup_printf("%s/%s", creds->dir, filename);
-+}
-+
-+
- int
- qcrypto_tls_creds_get_path(QCryptoTLSCreds *creds,
- const char *filename,
-@@ -94,7 +102,7 @@ qcrypto_tls_creds_get_path(QCryptoTLSCreds *creds,
- {
- int ret = -1;
-
-- *cred = g_strdup_printf("%s/%s", creds->dir, filename);
-+ *cred = qcrypto_tls_creds_build_path(creds, filename);
-
- if (access(*cred, R_OK) < 0) {
- if (errno == ENOENT && !required) {
-diff --git a/crypto/tlscredspriv.h b/crypto/tlscredspriv.h
-index 69dac02437..8f2d096c7f 100644
---- a/crypto/tlscredspriv.h
-+++ b/crypto/tlscredspriv.h
-@@ -39,6 +39,9 @@ struct QCryptoTLSCreds {
-
- #ifdef CONFIG_GNUTLS
-
-+char *qcrypto_tls_creds_build_path(QCryptoTLSCreds *creds,
-+ const char *filename);
-+
- int qcrypto_tls_creds_get_path(QCryptoTLSCreds *creds,
- const char *filename,
- bool required,
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index ecffde67c5..b8d0cd2f18 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -687,7 +687,6 @@ qcrypto_tls_creds_x509_load_identity(QCryptoTLSCredsX509 *creds,
- QCryptoTLSCredsBox *box,
- const char *certbase,
- const char *keybase,
-- bool isOptional,
- Error **errp)
- {
- g_autoptr(QCryptoTLSCredsX509IdentFiles) files =
-@@ -695,9 +694,9 @@ qcrypto_tls_creds_x509_load_identity(QCryptoTLSCredsX509 *creds,
- int ret;
-
- if (qcrypto_tls_creds_get_path(&creds->parent_obj, certbase,
-- !isOptional, &files->certpath, errp) < 0 ||
-+ false, &files->certpath, errp) < 0 ||
- qcrypto_tls_creds_get_path(&creds->parent_obj, keybase,
-- !isOptional, &files->keypath, errp) < 0) {
-+ false, &files->keypath, errp) < 0) {
- return NULL;
- }
-
-@@ -706,13 +705,17 @@ qcrypto_tls_creds_x509_load_identity(QCryptoTLSCredsX509 *creds,
- return NULL;
- }
- if (files->certpath && !files->keypath) {
-- error_setg(errp, "Cert '%s' without corresponding key",
-- files->certpath);
-+ g_autofree char *keypath =
-+ qcrypto_tls_creds_build_path(&creds->parent_obj, keybase);
-+ error_setg(errp, "Cert '%s' without corresponding key '%s'",
-+ files->certpath, keypath);
- return NULL;
- }
- if (!files->certpath && files->keypath) {
-- error_setg(errp, "Key '%s' without corresponding cert",
-- files->keypath);
-+ g_autofree char *certpath =
-+ qcrypto_tls_creds_build_path(&creds->parent_obj, certbase);
-+ error_setg(errp, "Key '%s' without corresponding cert '%s'",
-+ files->keypath, certpath);
- return NULL;
- }
-
-@@ -751,7 +754,9 @@ qcrypto_tls_creds_x509_load_identities(QCryptoTLSCredsX509 *creds,
- bool isServer,
- Error **errp)
- {
-+ ERRP_GUARD();
- QCryptoTLSCredsX509IdentFiles *ifiles;
-+ size_t i;
-
- ifiles = qcrypto_tls_creds_x509_load_identity(
- creds, box,
-@@ -761,15 +766,52 @@ qcrypto_tls_creds_x509_load_identities(QCryptoTLSCredsX509 *creds,
- isServer ?
- QCRYPTO_TLS_CREDS_X509_SERVER_KEY :
- QCRYPTO_TLS_CREDS_X509_CLIENT_KEY,
-- !isServer, errp);
-- if (!ifiles) {
-+ errp);
-+ if (!ifiles && *errp) {
- return -1;
- }
-
-- files->identities = g_renew(QCryptoTLSCredsX509IdentFiles *,
-- files->identities,
-- files->nidentities + 1);
-- files->identities[files->nidentities++] = ifiles;
-+ if (ifiles) {
-+ files->identities = g_renew(QCryptoTLSCredsX509IdentFiles *,
-+ files->identities,
-+ files->nidentities + 1);
-+ files->identities[files->nidentities++] = ifiles;
-+ }
-+
-+ for (i = 0; i < QCRYPTO_TLS_CREDS_X509_IDENTITY_MAX; i++) {
-+ g_autofree char *cert = g_strdup_printf(
-+ isServer ?
-+ QCRYPTO_TLS_CREDS_X509_SERVER_CERT_N :
-+ QCRYPTO_TLS_CREDS_X509_CLIENT_CERT_N, i);
-+ g_autofree char *key = g_strdup_printf(
-+ isServer ?
-+ QCRYPTO_TLS_CREDS_X509_SERVER_KEY_N :
-+ QCRYPTO_TLS_CREDS_X509_CLIENT_KEY_N, i);
-+
-+ ifiles = qcrypto_tls_creds_x509_load_identity(creds, box,
-+ cert, key, errp);
-+ if (!ifiles && *errp) {
-+ return -1;
-+ }
-+ if (!ifiles) {
-+ break;
-+ }
-+
-+ files->identities = g_renew(QCryptoTLSCredsX509IdentFiles *,
-+ files->identities,
-+ files->nidentities + 1);
-+ files->identities[files->nidentities++] = ifiles;
-+ }
-+
-+ if (files->nidentities == 0 && isServer) {
-+ g_autofree char *certpath = qcrypto_tls_creds_build_path(
-+ &creds->parent_obj, QCRYPTO_TLS_CREDS_X509_SERVER_CERT);
-+ g_autofree char *keypath = qcrypto_tls_creds_build_path(
-+ &creds->parent_obj, QCRYPTO_TLS_CREDS_X509_SERVER_KEY);
-+ error_setg(errp, "Missing server cert '%s' & key '%s'",
-+ certpath, keypath);
-+ return -1;
-+ }
-
- return 0;
- }
-diff --git a/crypto/tlssession.c b/crypto/tlssession.c
-index d585c51f77..4676ee6d43 100644
---- a/crypto/tlssession.c
-+++ b/crypto/tlssession.c
-@@ -345,6 +345,7 @@ qcrypto_tls_session_check_certificate(QCryptoTLSSession *session,
- goto error;
- }
- session->peername = (char *)g_steal_pointer(&dname.data);
-+ trace_qcrypto_tls_session_check_x509_dn(session, session->peername);
- if (session->authzid) {
- bool allow;
-
-diff --git a/crypto/trace-events b/crypto/trace-events
-index d0e33427fa..771f9b8a6e 100644
---- a/crypto/trace-events
-+++ b/crypto/trace-events
-@@ -21,6 +21,7 @@ qcrypto_tls_creds_x509_load_cert_list(void *creds, const char *file) "TLS creds
- # tlssession.c
- qcrypto_tls_session_new(void *session, void *creds, const char *hostname, const char *authzid, int endpoint) "TLS session new session=%p creds=%p hostname=%s authzid=%s endpoint=%d"
- qcrypto_tls_session_check_creds(void *session, const char *status) "TLS session check creds session=%p status=%s"
-+qcrypto_tls_session_check_x509_dn(void *session, const char *dname) "TLS session check x509 distinguished name session=%p dname=%s"
- qcrypto_tls_session_parameters(void *session, int threadSafety, int protocol, int cipher) "TLS session parameters session=%p threadSafety=%d protocol=%d cipher=%d"
- qcrypto_tls_session_bug1717_workaround(void *session) "TLS session bug1717 workaround session=%p"
-
-diff --git a/docs/system/tls.rst b/docs/system/tls.rst
-index 44c4bf04e9..7cec4ac3df 100644
---- a/docs/system/tls.rst
-+++ b/docs/system/tls.rst
-@@ -36,8 +36,58 @@ server and exposing it directly to remote browser clients. In such a
- case it might be useful to use a commercial CA to avoid needing to
- install custom CA certs in the web browsers.
-
--The recommendation is for the server to keep its certificates in either
--``/etc/pki/qemu`` or for unprivileged users in ``$HOME/.pki/qemu``.
-+.. _tls_cert_file_naming:
-+
-+Certificate file naming
-+~~~~~~~~~~~~~~~~~~~~~~~
-+
-+In a simple setup, where all QEMU instances on a machine share the
-+same TLS configuration, it is suggested that QEMU certificates be
-+kept in either ``/etc/pki/qemu`` or, for unprivileged users, in
-+``$HOME/.pki/qemu``. Where different QEMU subsystems require
-+different certificate configurations, sub-dirs of these locations
-+may be chosen.
-+
-+The default file names that QEMU will traditionally load are:
-+
-+* ``ca-cert.pem`` - mandatory; for both client and server configurations
-+* ``ca-crl.pem`` - optional; for server configurations only
-+* ``server-cert.pem`` - mandatory; for server configurations only
-+* ``server-key.pem`` - mandatory; for server configurations only
-+* ``client-cert.pem`` - optional; for client configurations only
-+* ``client-key.pem`` - optional; for client configurations only
-+* ``dh-params.pem`` - optional; for server configurations only
-+
-+Since QEMU 10.2.0, there is support for loading upto four additional
-+identities:
-+
-+* ``server-cert-[IDX].pem`` - optional; for server configurations only
-+* ``server-key-[IDX].pem`` - optional; for server configurations only
-+* ``client-cert-[IDX].pem`` - optional; for client configurations only
-+* ``client-key-[IDX].pem`` - optional; for client configurations only
-+
-+where ``-[IDX]`` is one of the digits 0-3. Loading will terminate at
-+the first absent index. The index based certificate files may be used
-+as a replacement for, or in addition to, the traditional non-index
-+based certificate files. The traditional certificate files will be
-+loaded first, if present, then the index based certificates. Where
-+multiple certificates are compatible with a TLS session, the first
-+loaded certificate will preferred. IOW file naming can influence
-+which certificates are used for a session.
-+
-+The use of multiple sets of certificates is intended to allow an
-+incremental transition to certificates using different crytographic
-+algorithms. This allows a newly deployed QEMU to introduce use of
-+stronger cryptographic algorithms that will be preferred when talking
-+to other newly deployed QEMU instances, while retaining compatbility
-+with certificates issued to a historically deployed QEMU. This is
-+notably useful to support live migration from an old QEMU deployed
-+on older operating system releases, which may support fewer crypto
-+algorithm choices than the current OS.
-+
-+The certificate creation commands below will be illustrated using
-+the traditional naming scheme, but their args can be substituted
-+to use the indexed naming in the obvious manner.
-
- .. _tls_005fgenerate_005fca:
-
-diff --git a/include/crypto/tlscredsx509.h b/include/crypto/tlscredsx509.h
-index c4daba21a6..61b7f73573 100644
---- a/include/crypto/tlscredsx509.h
-+++ b/include/crypto/tlscredsx509.h
-@@ -37,7 +37,13 @@ typedef struct QCryptoTLSCredsX509Class QCryptoTLSCredsX509Class;
- #define QCRYPTO_TLS_CREDS_X509_SERVER_CERT "server-cert.pem"
- #define QCRYPTO_TLS_CREDS_X509_CLIENT_KEY "client-key.pem"
- #define QCRYPTO_TLS_CREDS_X509_CLIENT_CERT "client-cert.pem"
-+#define QCRYPTO_TLS_CREDS_X509_SERVER_KEY_N "server-key-%zu.pem"
-+#define QCRYPTO_TLS_CREDS_X509_SERVER_CERT_N "server-cert-%zu.pem"
-+#define QCRYPTO_TLS_CREDS_X509_CLIENT_KEY_N "client-key-%zu.pem"
-+#define QCRYPTO_TLS_CREDS_X509_CLIENT_CERT_N "client-cert-%zu.pem"
-
-+/* Max number of additional cert/key pairs (ie _N constants) */
-+#define QCRYPTO_TLS_CREDS_X509_IDENTITY_MAX 4
-
- /**
- * QCryptoTLSCredsX509:
---
-2.52.0
-
diff --git a/kvm-crypto-switch-to-newer-gnutls-API-for-distinguished-.patch b/kvm-crypto-switch-to-newer-gnutls-API-for-distinguished-.patch
deleted file mode 100644
index 0c16032..0000000
--- a/kvm-crypto-switch-to-newer-gnutls-API-for-distinguished-.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 93221ea271bab2f38135964dd900d008876240d6 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Fri, 11 Jul 2025 13:21:34 +0100
-Subject: [PATCH 07/30] crypto: switch to newer gnutls API for distinguished
- name
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [6/27] 4f10cd401207fb9894821834e0e0bcf6f7765fb2 (berrange/centos-src-qemu)
-
-The new API automatically allocates the right amount of memory
-to hold the distinguished name, avoiding the need to loop and
-realloc.
-
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 3b3257b00fd256b8704db13373f4fa9c8bc40342)
----
- crypto/tlssession.c | 12 +++---------
- 1 file changed, 3 insertions(+), 9 deletions(-)
-
-diff --git a/crypto/tlssession.c b/crypto/tlssession.c
-index 86d407a142..0f86d1393f 100644
---- a/crypto/tlssession.c
-+++ b/crypto/tlssession.c
-@@ -409,20 +409,14 @@ qcrypto_tls_session_check_certificate(QCryptoTLSSession *session,
- }
-
- if (i == 0) {
-- size_t dnameSize = 1024;
-- session->peername = g_malloc(dnameSize);
-- requery:
-- ret = gnutls_x509_crt_get_dn(cert, session->peername, &dnameSize);
-+ gnutls_datum_t dname = {};
-+ ret = gnutls_x509_crt_get_dn2(cert, &dname);
- if (ret < 0) {
-- if (ret == GNUTLS_E_SHORT_MEMORY_BUFFER) {
-- session->peername = g_realloc(session->peername,
-- dnameSize);
-- goto requery;
-- }
- error_setg(errp, "Cannot get client distinguished name: %s",
- gnutls_strerror(ret));
- goto error;
- }
-+ session->peername = (char *)g_steal_pointer(&dname.data);
- if (session->authzid) {
- bool allow;
-
---
-2.52.0
-
diff --git a/kvm-crypto-use-g_autofree-when-loading-x509-credentials.patch b/kvm-crypto-use-g_autofree-when-loading-x509-credentials.patch
deleted file mode 100644
index babf453..0000000
--- a/kvm-crypto-use-g_autofree-when-loading-x509-credentials.patch
+++ /dev/null
@@ -1,148 +0,0 @@
-From 71d3a28a7d2dea5c97960461bc1837b3c2066698 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Wed, 29 Oct 2025 14:53:34 +0000
-Subject: [PATCH 13/30] crypto: use g_autofree when loading x509 credentials
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [12/27] da77db1e761b364312d4f6f58491b5ea1fd9a4e2 (berrange/centos-src-qemu)
-
-This allows removal of goto jumps during loading of the credentials
-and will simplify the diff in following commits.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 916501aa0720bf78b7dbf39b2548f2d4c4e46987)
----
- crypto/tlscredsx509.c | 38 ++++++++++++++++----------------------
- 1 file changed, 16 insertions(+), 22 deletions(-)
-
-diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
-index 8fe6cc8e93..6640159a5b 100644
---- a/crypto/tlscredsx509.c
-+++ b/crypto/tlscredsx509.c
-@@ -562,10 +562,12 @@ static int
- qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- Error **errp)
- {
-- char *cacert = NULL, *cacrl = NULL, *cert = NULL,
-- *key = NULL, *dhparams = NULL;
-+ g_autofree char *cacert = NULL;
-+ g_autofree char *cacrl = NULL;
-+ g_autofree char *cert = NULL;
-+ g_autofree char *key = NULL;
-+ g_autofree char *dhparams = NULL;
- int ret;
-- int rv = -1;
-
- if (!creds->parent_obj.dir) {
- error_setg(errp, "Missing 'dir' property value");
-@@ -590,7 +592,7 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- qcrypto_tls_creds_get_path(&creds->parent_obj,
- QCRYPTO_TLS_CREDS_DH_PARAMS,
- false, &dhparams, errp) < 0) {
-- goto cleanup;
-+ return -1;
- }
- } else {
- if (qcrypto_tls_creds_get_path(&creds->parent_obj,
-@@ -602,7 +604,7 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- qcrypto_tls_creds_get_path(&creds->parent_obj,
- QCRYPTO_TLS_CREDS_X509_CLIENT_KEY,
- false, &key, errp) < 0) {
-- goto cleanup;
-+ return -1;
- }
- }
-
-@@ -610,14 +612,14 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- qcrypto_tls_creds_x509_sanity_check(creds,
- creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER,
- cacert, cert, errp) < 0) {
-- goto cleanup;
-+ return -1;
- }
-
- ret = gnutls_certificate_allocate_credentials(&creds->data);
- if (ret < 0) {
- error_setg(errp, "Cannot allocate credentials: '%s'",
- gnutls_strerror(ret));
-- goto cleanup;
-+ return -1;
- }
-
- ret = gnutls_certificate_set_x509_trust_file(creds->data,
-@@ -626,16 +628,16 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- if (ret < 0) {
- error_setg(errp, "Cannot load CA certificate '%s': %s",
- cacert, gnutls_strerror(ret));
-- goto cleanup;
-+ return -1;
- }
-
- if (cert != NULL && key != NULL) {
-- char *password = NULL;
-+ g_autofree char *password = NULL;
- if (creds->passwordid) {
- password = qcrypto_secret_lookup_as_utf8(creds->passwordid,
- errp);
- if (!password) {
-- goto cleanup;
-+ return -1;
- }
- }
- ret = gnutls_certificate_set_x509_key_file2(creds->data,
-@@ -643,11 +645,10 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- GNUTLS_X509_FMT_PEM,
- password,
- 0);
-- g_free(password);
- if (ret < 0) {
- error_setg(errp, "Cannot load certificate '%s' & key '%s': %s",
- cert, key, gnutls_strerror(ret));
-- goto cleanup;
-+ return -1;
- }
- }
-
-@@ -658,7 +659,7 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- if (ret < 0) {
- error_setg(errp, "Cannot load CRL '%s': %s",
- cacrl, gnutls_strerror(ret));
-- goto cleanup;
-+ return -1;
- }
- }
-
-@@ -666,20 +667,13 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds,
- if (qcrypto_tls_creds_get_dh_params_file(&creds->parent_obj, dhparams,
- &creds->parent_obj.dh_params,
- errp) < 0) {
-- goto cleanup;
-+ return -1;
- }
- gnutls_certificate_set_dh_params(creds->data,
- creds->parent_obj.dh_params);
- }
-
-- rv = 0;
-- cleanup:
-- g_free(cacert);
-- g_free(cacrl);
-- g_free(cert);
-- g_free(key);
-- g_free(dhparams);
-- return rv;
-+ return 0;
- }
-
-
---
-2.52.0
-
diff --git a/kvm-curl-Fix-coroutine-waking.patch b/kvm-curl-Fix-coroutine-waking.patch
deleted file mode 100644
index 5dbf7ce..0000000
--- a/kvm-curl-Fix-coroutine-waking.patch
+++ /dev/null
@@ -1,172 +0,0 @@
-From 14d1e6aa70f97aa75c8f3f78e3c730e286e3b683 Mon Sep 17 00:00:00 2001
-From: Hanna Czenczek <hreitz@redhat.com>
-Date: Mon, 10 Nov 2025 16:48:40 +0100
-Subject: [PATCH 02/19] curl: Fix coroutine waking
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Hanna Czenczek <hreitz@redhat.com>
-RH-MergeRequest: 454: Multithreading fixes for rbd, curl, qcow2
-RH-Jira: RHEL-79118
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/5] 20268ed1de88de45a7525d01dbb64899b8c4e443 (hreitz/qemu-kvm-c-9-s)
-
-If we wake a coroutine from a different context, we must ensure that it
-will yield exactly once (now or later), awaiting that wake.
-
-curl’s current .ret == -EINPROGRESS loop may lead to the coroutine not
-yielding if the request finishes before the loop gets run. To fix it,
-we must drop the loop and yield exactly once, if we need to yield.
-
-Finding out that latter part ("if we need to yield") makes it a bit
-complicated: Requests may be served from a cache internal to the curl
-block driver, or fail before being submitted. In these cases, we must
-not yield. However, if we find a matching but still ongoing request in
-the cache, we will have to await that, i.e. still yield.
-
-To address this, move the yield inside of the respective functions:
-- Inside of curl_find_buf() when awaiting ongoing concurrent requests,
-- Inside of curl_setup_preadv() when having created a new request.
-
-Rename curl_setup_preadv() to curl_do_preadv() to reflect this.
-
-(Can be reproduced with multiqueue by adding a usleep(100000) before the
-`while (acb.ret == -EINPROGRESS)` loop.)
-
-Also, add a comment why aio_co_wake() is safe regardless of whether the
-coroutine and curl_multi_check_completion() run in the same context.
-
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-Message-ID: <20251110154854.151484-6-hreitz@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 53d5c7ffac7bd4e0d12174432ebb2b3e88614b15)
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
----
- block/curl.c | 45 +++++++++++++++++++++++++++++++--------------
- 1 file changed, 31 insertions(+), 14 deletions(-)
-
-diff --git a/block/curl.c b/block/curl.c
-index 5467678024..d69bcdff79 100644
---- a/block/curl.c
-+++ b/block/curl.c
-@@ -262,8 +262,8 @@ read_end:
- }
-
- /* Called with s->mutex held. */
--static bool curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len,
-- CURLAIOCB *acb)
-+static bool coroutine_fn
-+curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len, CURLAIOCB *acb)
- {
- int i;
- uint64_t end = start + len;
-@@ -311,6 +311,10 @@ static bool curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len,
- for (j=0; j<CURL_NUM_ACB; j++) {
- if (!state->acb[j]) {
- state->acb[j] = acb;
-+ /* Await ongoing request */
-+ qemu_mutex_unlock(&s->mutex);
-+ qemu_coroutine_yield();
-+ qemu_mutex_lock(&s->mutex);
- return true;
- }
- }
-@@ -382,6 +386,16 @@ static void curl_multi_check_completion(BDRVCURLState *s)
- acb->ret = error ? -EIO : 0;
- state->acb[i] = NULL;
- qemu_mutex_unlock(&s->mutex);
-+ /*
-+ * Current AioContext is the BDS context, which may or may not
-+ * be the request (coroutine) context.
-+ * - If it is, the coroutine must have yielded or the FD handler
-+ * (curl_multi_do()/curl_multi_timeout_do()) could not have
-+ * been called and we would not be here
-+ * - If it is not, it doesn't matter whether it has already
-+ * yielded or not; it will be scheduled once it does yield
-+ * So aio_co_wake() is safe to call.
-+ */
- aio_co_wake(acb->co);
- qemu_mutex_lock(&s->mutex);
- }
-@@ -882,7 +896,7 @@ out_noclean:
- return -EINVAL;
- }
-
--static void coroutine_fn curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb)
-+static void coroutine_fn curl_do_preadv(BlockDriverState *bs, CURLAIOCB *acb)
- {
- CURLState *state;
- int running;
-@@ -894,10 +908,13 @@ static void coroutine_fn curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb)
-
- qemu_mutex_lock(&s->mutex);
-
-- // In case we have the requested data already (e.g. read-ahead),
-- // we can just call the callback and be done.
-+ /*
-+ * In case we have the requested data already (e.g. read-ahead),
-+ * we can just call the callback and be done. This may have to
-+ * await an ongoing request, in which case it itself will yield.
-+ */
- if (curl_find_buf(s, start, acb->bytes, acb)) {
-- goto out;
-+ goto dont_yield;
- }
-
- // No cache found, so let's start a new request
-@@ -912,7 +929,7 @@ static void coroutine_fn curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb)
- if (curl_init_state(s, state) < 0) {
- curl_clean_state(state);
- acb->ret = -EIO;
-- goto out;
-+ goto dont_yield;
- }
-
- acb->start = 0;
-@@ -927,7 +944,7 @@ static void coroutine_fn curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb)
- if (state->buf_len && state->orig_buf == NULL) {
- curl_clean_state(state);
- acb->ret = -ENOMEM;
-- goto out;
-+ goto dont_yield;
- }
- state->acb[0] = acb;
-
-@@ -939,13 +956,16 @@ static void coroutine_fn curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb)
- acb->ret = -EIO;
-
- curl_clean_state(state);
-- goto out;
-+ goto dont_yield;
- }
-
- /* Tell curl it needs to kick things off */
- curl_multi_socket_action(s->multi, CURL_SOCKET_TIMEOUT, 0, &running);
-+ qemu_mutex_unlock(&s->mutex);
-+ qemu_coroutine_yield();
-+ return;
-
--out:
-+dont_yield:
- qemu_mutex_unlock(&s->mutex);
- }
-
-@@ -961,10 +981,7 @@ static int coroutine_fn curl_co_preadv(BlockDriverState *bs,
- .bytes = bytes
- };
-
-- curl_setup_preadv(bs, &acb);
-- while (acb.ret == -EINPROGRESS) {
-- qemu_coroutine_yield();
-- }
-+ curl_do_preadv(bs, &acb);
- return acb.ret;
- }
-
---
-2.47.3
-
diff --git a/kvm-docs-Add-mshv-to-documentation.patch b/kvm-docs-Add-mshv-to-documentation.patch
deleted file mode 100644
index 5de3b56..0000000
--- a/kvm-docs-Add-mshv-to-documentation.patch
+++ /dev/null
@@ -1,143 +0,0 @@
-From a42a299252fd1c53600387a81924adee6fa761f6 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:46 +0200
-Subject: [PATCH 29/32] docs: Add mshv to documentation
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [27/30] 6450fc04dede6796c6a6383904792da34fb11de1
-
-Added mshv to the list of accelerators in doc text.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-27-magnuskulke@linux.microsoft.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 3af71a1a6a7a497df7d3026239d6136b56e3d5ab)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- docs/about/build-platforms.rst | 2 +-
- docs/devel/codebase.rst | 2 +-
- docs/glossary.rst | 7 +++----
- docs/system/introduction.rst | 3 +++
- qemu-options.hx | 16 ++++++++--------
- 5 files changed, 16 insertions(+), 14 deletions(-)
-
-diff --git a/docs/about/build-platforms.rst b/docs/about/build-platforms.rst
-index 8671c3be9c..06ba0ddc9a 100644
---- a/docs/about/build-platforms.rst
-+++ b/docs/about/build-platforms.rst
-@@ -55,7 +55,7 @@ Those hosts are officially supported, with various accelerators:
- * - SPARC
- - tcg
- * - x86
-- - hvf (64 bit only), kvm, nvmm, tcg, whpx (64 bit only), xen
-+ - hvf (64 bit only), mshv (64 bit only), kvm, nvmm, tcg, whpx (64 bit only), xen
-
- Other host architectures are not supported. It is possible to build QEMU system
- emulation on an unsupported host architecture using the configure
-diff --git a/docs/devel/codebase.rst b/docs/devel/codebase.rst
-index 2a3143787a..69d8827117 100644
---- a/docs/devel/codebase.rst
-+++ b/docs/devel/codebase.rst
-@@ -48,7 +48,7 @@ yet, so sometimes the source code is all you have.
- * `accel <https://gitlab.com/qemu-project/qemu/-/tree/master/accel>`_:
- Infrastructure and architecture agnostic code related to the various
- `accelerators <Accelerators>` supported by QEMU
-- (TCG, KVM, hvf, whpx, xen, nvmm).
-+ (TCG, KVM, hvf, whpx, xen, nvmm, mshv).
- Contains interfaces for operations that will be implemented per
- `target <https://gitlab.com/qemu-project/qemu/-/tree/master/target>`_.
- * `audio <https://gitlab.com/qemu-project/qemu/-/tree/master/audio>`_:
-diff --git a/docs/glossary.rst b/docs/glossary.rst
-index 4fa044bfb6..2857731bc4 100644
---- a/docs/glossary.rst
-+++ b/docs/glossary.rst
-@@ -12,7 +12,7 @@ Accelerator
-
- A specific API used to accelerate execution of guest instructions. It can be
- hardware-based, through a virtualization API provided by the host OS (kvm, hvf,
--whpx, ...), or software-based (tcg). See this description of `supported
-+whpx, mshv, ...), or software-based (tcg). See this description of `supported
- accelerators<Accelerators>`.
-
- Board
-@@ -101,9 +101,8 @@ manage a virtual machine. QEMU is a virtualizer, that interacts with various
- hypervisors.
-
- In the context of QEMU, an hypervisor is an API, provided by the Host OS,
--allowing to execute virtual machines. Linux implementation is KVM (and supports
--Xen as well). For MacOS, it's HVF. Windows defines WHPX. And NetBSD provides
--NVMM.
-+allowing to execute virtual machines. Linux provides a choice of KVM, Xen
-+or MSHV; MacOS provides HVF; Windows provides WHPX; NetBSD provides NVMM.
-
- .. _machine:
-
-diff --git a/docs/system/introduction.rst b/docs/system/introduction.rst
-index 4cd46b5b8f..9c57523b6c 100644
---- a/docs/system/introduction.rst
-+++ b/docs/system/introduction.rst
-@@ -23,6 +23,9 @@ Tiny Code Generator (TCG) capable of emulating many CPUs.
- * - Xen
- - Linux (as dom0)
- - Arm, x86
-+ * - MSHV
-+ - Linux (as dom0)
-+ - x86
- * - Hypervisor Framework (hvf)
- - MacOS
- - x86 (64 bit only), Arm (64 bit only)
-diff --git a/qemu-options.hx b/qemu-options.hx
-index 5f146c1860..8eca7faa94 100644
---- a/qemu-options.hx
-+++ b/qemu-options.hx
-@@ -28,7 +28,7 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
- "-machine [type=]name[,prop[=value][,...]]\n"
- " selects emulated machine ('-machine help' for list)\n"
- " property accel=accel1[:accel2[:...]] selects accelerator\n"
-- " supported accelerators are kvm, xen, hvf, nvmm, whpx or tcg (default: tcg)\n"
-+ " supported accelerators are kvm, xen, hvf, nvmm, whpx, mshv or tcg (default: tcg)\n"
- " vmport=on|off|auto controls emulation of vmport (default: auto)\n"
- " dump-guest-core=on|off include guest memory in a core dump (default=on)\n"
- " mem-merge=on|off controls memory merge support (default: on)\n"
-@@ -66,10 +66,10 @@ SRST
-
- ``accel=accels1[:accels2[:...]]``
- This is used to enable an accelerator. Depending on the target
-- architecture, kvm, xen, hvf, nvmm, whpx or tcg can be available.
-- By default, tcg is used. If there is more than one accelerator
-- specified, the next one is used if the previous one fails to
-- initialize.
-+ architecture, kvm, xen, hvf, nvmm, whpx, mshv or tcg can be
-+ available. By default, tcg is used. If there is more than one
-+ accelerator specified, the next one is used if the previous one
-+ fails to initialize.
-
- ``vmport=on|off|auto``
- Enables emulation of VMWare IO port, for vmmouse etc. auto says
-@@ -226,7 +226,7 @@ ERST
-
- DEF("accel", HAS_ARG, QEMU_OPTION_accel,
- "-accel [accel=]accelerator[,prop[=value][,...]]\n"
-- " select accelerator (kvm, xen, hvf, nvmm, whpx or tcg; use 'help' for a list)\n"
-+ " select accelerator (kvm, xen, hvf, nvmm, whpx, mshv or tcg; use 'help' for a list)\n"
- " igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n"
- " kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n"
- " kvm-shadow-mem=size of KVM shadow MMU in bytes\n"
-@@ -241,8 +241,8 @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel,
- SRST
- ``-accel name[,prop=value[,...]]``
- This is used to enable an accelerator. Depending on the target
-- architecture, kvm, xen, hvf, nvmm, whpx or tcg can be available. By
-- default, tcg is used. If there is more than one accelerator
-+ architecture, kvm, xen, hvf, nvmm, whpx, mshv or tcg can be available.
-+ By default, tcg is used. If there is more than one accelerator
- specified, the next one is used if the previous one fails to
- initialize.
-
---
-2.47.3
-
diff --git a/kvm-docs-add-SCSI-migrate-pr-documentation.patch b/kvm-docs-add-SCSI-migrate-pr-documentation.patch
deleted file mode 100644
index 507524b..0000000
--- a/kvm-docs-add-SCSI-migrate-pr-documentation.patch
+++ /dev/null
@@ -1,118 +0,0 @@
-From a47cd8b532de2235c3be76a79f42d40c32a4fa58 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Thu, 29 Jan 2026 16:20:35 -0500
-Subject: [PATCH 6/7] docs: add SCSI migrate-pr documentation
-
-RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
-RH-MergeRequest: 464: scsi: persistent reservation live migration
-RH-Jira: RHEL-132749
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
-RH-Commit: [5/5] e081d8f5e12d1228cd3de395964c0cb4d483559e (stefanha/centos-stream-qemu-kvm)
-
-Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-Message-id: 20260129212035.219676-6-stefanha@redhat.com
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-(cherry picked from commit a67819adb2212977360e9290bd005badb07dd2e4)
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- docs/system/device-emulation.rst | 1 +
- docs/system/devices/scsi/index.rst | 10 +++++
- docs/system/devices/scsi/migrate-pr.rst | 54 +++++++++++++++++++++++++
- 3 files changed, 65 insertions(+)
- create mode 100644 docs/system/devices/scsi/index.rst
- create mode 100644 docs/system/devices/scsi/migrate-pr.rst
-
-diff --git a/docs/system/device-emulation.rst b/docs/system/device-emulation.rst
-index 911381643f..72a9dbd54d 100644
---- a/docs/system/device-emulation.rst
-+++ b/docs/system/device-emulation.rst
-@@ -91,6 +91,7 @@ Emulated Devices
- devices/keyboard.rst
- devices/net.rst
- devices/nvme.rst
-+ devices/scsi/index.rst
- devices/usb.rst
- devices/vhost-user.rst
- devices/virtio-gpu.rst
-diff --git a/docs/system/devices/scsi/index.rst b/docs/system/devices/scsi/index.rst
-new file mode 100644
-index 0000000000..4f0929b0ca
---- /dev/null
-+++ b/docs/system/devices/scsi/index.rst
-@@ -0,0 +1,10 @@
-+SCSI Devices
-+============
-+
-+Several SCSI devices are available in QEMU. They are primarily used for block
-+storage.
-+
-+.. toctree::
-+ :maxdepth: 1
-+
-+ migrate-pr.rst
-diff --git a/docs/system/devices/scsi/migrate-pr.rst b/docs/system/devices/scsi/migrate-pr.rst
-new file mode 100644
-index 0000000000..a8f2790a86
---- /dev/null
-+++ b/docs/system/devices/scsi/migrate-pr.rst
-@@ -0,0 +1,54 @@
-+..
-+ SPDX-License-Identifier: GPL-2.0-or-later
-+
-+.. _scsi_migrate_pr:
-+
-+SCSI Persistent Reservation Live Migration
-+==========================================
-+
-+This document explains how to live migrate SCSI Persistent Reservations.
-+
-+The ``scsi-block`` device migrates SCSI Persistent Reservations when the
-+``migrate-pr=on`` parameter is given. Migration is enabled by default in
-+versioned machine types since QEMU 11.0. It is disabled by default on older
-+machine types and needs to be explicitly enabled with ``--device
-+scsi-block,migrate-pr=on,...``.
-+
-+When migration is enabled, QEMU snoops PERSISTENT RESERVATION OUT commands and
-+tracks the reservation key registered by the guest as well as reservations that
-+the guest acquires. This information is migrated along with the guest and the
-+destination QEMU submits a PERSISTENT RESERVATION OUT command with the PREEMPT
-+service action to atomically transfer the reservation to the destination before
-+the guest starts running on the destination.
-+
-+The following persistent reservation capabilities reported by the PERSISTENT
-+RESERVATION IN command with the REPORT CAPABILITIES service action are masked
-+from the guest by QEMU when migration is enabled:
-+
-+ * Specify Initiator Ports Capable (SIP_C)
-+ * All Target Ports Capable (ATC_C)
-+
-+When migration is disabled, the ``scsi-block`` device is live migrated but
-+reservations remain in place on the source. Usually this is not the intended
-+behavior unless there is another mechanism to update reservations during
-+migration. The PERSISTENT RESERVATION IN command also does not mask
-+capabilities reported to the guest when migration is disabled.
-+
-+Limitations
-+-----------
-+
-+QEMU does not remember snooped reservation details across restart, so software
-+inside the guest must acquire the reservation after boot in order for live
-+migration to work. Similarly, if the reservation is acquired outside the guest
-+then it will not live migrate along with the guest.
-+
-+Snooping only considers the PERSISTENT RESERVATION OUT commands from the guest
-+and does not track reservation changes made by other SCSI initiators. QEMU's
-+snooped reservation details can become stale if another SCSI initiator
-+makes changes to the reservation.
-+
-+Guests running on the same host share a single SCSI initiator identity unless
-+Fibre Channel N_Port ID Virtualization is configured. As a consequence,
-+multiple guests on the same hosts may observe unexpected behavior if they use
-+the same physical LUN. From the LUN's perspective all guests are the same
-+initiator and there is no way to distinguish between guests.
---
-2.47.3
-
diff --git a/kvm-docs-creation-of-x509-certs-compliant-with-post-quan.patch b/kvm-docs-creation-of-x509-certs-compliant-with-post-quan.patch
deleted file mode 100644
index 97d4bab..0000000
--- a/kvm-docs-creation-of-x509-certs-compliant-with-post-quan.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From 1d81f2a727c083b3c5093ab4179fc25a4fc316f6 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Mon, 27 Oct 2025 12:21:46 +0000
-Subject: [PATCH 28/30] docs: creation of x509 certs compliant with
- post-quantum crypto
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Daniel P. Berrangé <berrange@redhat.com>
-RH-MergeRequest: 460: crypto: changes to support multiple certificates for PQC
-RH-Jira: RHEL-111934
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [27/27] a7fc97d6ab465bb8da77ef3154262e18a9e8e34a (berrange/centos-src-qemu)
-
-Explain how to alter the certtool commands for creating certficates,
-so that they can use algorithms that are compliant with post-quantum
-crytography standards.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 2aaca8c6d22b18786ceff51189704113d0639590)
----
- docs/system/tls.rst | 68 +++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 68 insertions(+)
-
-diff --git a/docs/system/tls.rst b/docs/system/tls.rst
-index 7cec4ac3df..03fa1d8166 100644
---- a/docs/system/tls.rst
-+++ b/docs/system/tls.rst
-@@ -345,6 +345,74 @@ example with VNC:
-
- .. _tls_005fpsk:
-
-+TLS certificates for Post-Quantum Cryptography
-+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-+
-+Given a new enough gnutls release, suitably integrated & configured with the
-+operating system crypto policies, QEMU is able to support post-quantum
-+crytography on TLS enabled services, either exclusively or in a hybrid mode.
-+
-+In exclusive mode, only a single set of certificates need to be configured
-+for QEMU, with PQC compliant algorithms. Such a QEMU configuration will only
-+be able to interoperate with other services (including other QEMU's) that
-+also have PQC enabled. This can result in compatibility concerns during the
-+period of transition over to PQC compliant algorithms.
-+
-+In hybrid mode, multiple sets of certificates need to be configured for QEMU,
-+at least one set with traditional (non-PQC compliant) algorithms, and at least
-+one other set with modern (PQC compliant) algorithms. At time of the TLS
-+handshake, the GNUTLS algorithm priorities should ensure that PQC compliant
-+algorithms are negotiated if both sides of the connection support PQC. If one
-+side lacks PQC, the TLS handshake should fallback to the non-PQC algorithms.
-+This can assist with interoperability during the transition to PQC, but has a
-+potential weakness wrt downgrade attacks forcing use of non-PQC algorithms.
-+Exclusive PQC mode should be preferred where both peers in the TLS connections
-+are known to support PQC.
-+
-+Key generation parameters
-+^^^^^^^^^^^^^^^^^^^^^^^^^
-+
-+To create certificates with PQC compliant algorithms, the ``--key-type``
-+argument must be passed to ``certtool`` when creating private keys. No
-+extra arguments are required for the other ``certtool`` commands, as
-+their behaviour will be determined by the private key type.
-+
-+The typical PQC compliant algorithms to use are ``ML-DSA-44``, ``ML-DSA-65``
-+and ``ML-DSA-87``, with ``ML-DSA-65`` being a suitable default choice in
-+the absence of explicit requirements.
-+
-+Taking the example earlier, for creating a key for a client certificate,
-+to use ``ML-DSA-65`` the command line would be modified to look like::
-+
-+ # certtool --generate-privkey --key-type=mldsa65 > client-hostNNN-key.pem
-+
-+The equivalent modification applies to the creation of the private keys
-+used for server certs, or root/intermediate CA certs.
-+
-+For hybrid mode, the additional indexed certificate naming must be used.
-+If multiple configured certificates are compatible with the mutually
-+supported crypto algorithms between the client and server, then the
-+first matching certificate will be used.
-+
-+IOW, to ensure that PQC certificates are preferred, they must use a
-+non-index based filename, or use an index that is smaller than any
-+non-PQC certificates. ie, ``server-cert.pem`` for PQC and ``server-cert-0.pem``
-+for non-PQC, or ``server-cert-0.pem`` for PQC and ``server-cert-1.pem`` for
-+non-PQC.
-+
-+Force disabling PQC via crypto priority
-+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-+
-+In the OS configuration for system crypto algorithm priorities has
-+enabled PQC, this can (optionally) be overriden in QEMU configuration
-+disable use of PQC using the ``priority`` parameter to the ``tls-creds-x509``
-+object::
-+
-+ NO_MLDSA="-SIGN-ML-DSA-65:-SIGN-ML-DSA-44:-SIGN-ML-DSA-87"
-+ NO_MLKEM="-GROUP-X25519-MLKEM768:-GROUP-SECP256R1-MLKEM768:-GROUP-SECP384R1-MLKEM1024"
-+ # qemu-nbd --object tls-creds-x509,id=tls0,endpoint=server,dir=....,priority=@SYSTEM:$NO_MLDSA:$NO_MLKEM
-+
-+
- TLS Pre-Shared Keys (PSK)
- ~~~~~~~~~~~~~~~~~~~~~~~~~
-
---
-2.52.0
-
diff --git a/kvm-docs-specs-tpm-document-PPI-support-on-ARM64-virt.patch b/kvm-docs-specs-tpm-document-PPI-support-on-ARM64-virt.patch
deleted file mode 100644
index e1d574b..0000000
--- a/kvm-docs-specs-tpm-document-PPI-support-on-ARM64-virt.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 5386583d1150ea010b4e7c57d6ff23b2eb4582ea Mon Sep 17 00:00:00 2001
-From: Mohammadfaiz Bawa <mbawa@redhat.com>
-Date: Thu, 7 May 2026 15:36:58 +0530
-Subject: [PATCH 7/9] docs/specs/tpm: document PPI support on ARM64 virt
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Mohammadfaiz Bawa <None>
-RH-MergeRequest: 485: hw/tpm: add PPI support to tpm-tis-device for ARM64 virt
-RH-Jira: RHEL-112608
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [6/8] f9c4890c23d5b26789da5a95a2e5075924e0b416 (faizb/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-112608
-
-Document that tpm-tis-device on the ARM virt machine supports PPI
-with dynamically allocated MMIO via the platform bus, unlike x86
-where PPI is at the fixed address 0xFED45000.
-
-Also add hw/arm/virt-acpi-build.c and hw/acpi/tpm.c to the list
-of files related to TPM ACPI tables.
-
-Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
-Message-ID: <20260327173209.148180-2-mbawa@redhat.com>
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-(cherry picked from commit ffdd1949a159502d4e85d76e27b51020929a9d1c)
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
----
- docs/specs/tpm.rst | 24 ++++++++++++++++++++++++
- 1 file changed, 24 insertions(+)
-
-diff --git a/docs/specs/tpm.rst b/docs/specs/tpm.rst
-index b630a351b4..ba2b0d7267 100644
---- a/docs/specs/tpm.rst
-+++ b/docs/specs/tpm.rst
-@@ -187,8 +187,32 @@ The location of the table is given by the fw_cfg ``tpmppi_address``
- field. The PPI memory region size is 0x400 (``TPM_PPI_ADDR_SIZE``) to
- leave enough room for future updates.
-
-+PPI on ARM64 virt
-+-----------------
-+
-+The ARM virt machine supports PPI for ``tpm-tis-device`` as defined
-+in the `PPI specification`_.
-+
-+Unlike the x86 TIS device where the PPI memory region is mapped at
-+the fixed address ``0xFED45000`` (within the TIS MMIO range), the
-+ARM64 sysbus device registers PPI memory as a second MMIO region
-+on the platform bus. The platform bus assigns the guest physical
-+address dynamically at device plug time. The ACPI ``_DSM`` method
-+and PPI operation regions reference this dynamically resolved
-+address.
-+
-+PPI is controlled by the ``ppi`` property (default ``on``)::
-+
-+ -device tpm-tis-device,tpmdev=tpm0,ppi=on
-+
-+Without PPI, guest operating systems such as Windows 11
-+ARM64 will log errors when attempting to query TPM Physical
-+Presence capabilities via the ACPI ``_DSM`` method.
-+
- QEMU files related to TPM ACPI tables:
- - ``hw/i386/acpi-build.c``
-+ - ``hw/arm/virt-acpi-build.c``
-+ - ``hw/acpi/tpm.c``
- - ``include/hw/acpi/tpm.h``
-
- TPM backend devices
---
-2.52.0
-
diff --git a/kvm-e1000e-Prevent-crash-from-legacy-interrupt-firing-af.patch b/kvm-e1000e-Prevent-crash-from-legacy-interrupt-firing-af.patch
deleted file mode 100644
index d1e4d00..0000000
--- a/kvm-e1000e-Prevent-crash-from-legacy-interrupt-firing-af.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From a2f30bafa346ef50932c359eaf71574ed3c1239d Mon Sep 17 00:00:00 2001
-From: Laurent Vivier <lvivier@redhat.com>
-Date: Thu, 7 Aug 2025 13:08:06 +0200
-Subject: [PATCH] e1000e: Prevent crash from legacy interrupt firing after
- MSI-X enable
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 403: e1000e: Prevent crash from legacy interrupt firing after MSI-X enable
-RH-Jira: RHEL-112882
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: Jason Wang <jasowang@redhat.com>
-RH-Commit: [1/1] 8241a58b76307f27ad3d3b3b2106e00b153b7b53 (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-112882
-
-A race condition between guest driver actions and QEMU timers can lead
-to an assertion failure when the guest switches the e1000e from legacy
-interrupt mode to MSI-X. If a legacy interrupt delay timer (TIDV or
-RDTR) is active, but the guest enables MSI-X before the timer fires,
-the pending interrupt cause can trigger an assert in
-e1000e_intmgr_collect_delayed_causes().
-
-This patch removes the assertion and executes the code that clears the
-pending legacy causes. This change is safe and introduces no unintended
-behavioral side effects, as it only alters a state that previously led
-to termination.
-
-- when core->delayed_causes == 0 the function was already a no-op and
- remains so.
-
-- when core->delayed_causes != 0 the function would previously
- crash due to the assertion failure. The patch now defines a safe
- outcome by clearing the cause and returning. Since behavior after
- the assertion never existed, this simply corrects the crash.
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1863
-Suggested-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Message-ID: <20250807110806.409065-1-lvivier@redhat.com>
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-(cherry picked from commit 8e4649cac9bcddc050d2df07908075e9e69bccc7)
----
- hw/net/e1000e_core.c | 5 -----
- 1 file changed, 5 deletions(-)
-
-diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
-index 2413858790..06657bb3ac 100644
---- a/hw/net/e1000e_core.c
-+++ b/hw/net/e1000e_core.c
-@@ -341,11 +341,6 @@ e1000e_intmgr_collect_delayed_causes(E1000ECore *core)
- {
- uint32_t res;
-
-- if (msix_enabled(core->owner)) {
-- assert(core->delayed_causes == 0);
-- return 0;
-- }
--
- res = core->delayed_causes;
- core->delayed_causes = 0;
-
---
-2.47.3
-
diff --git a/kvm-file-posix-Handle-suspended-dm-multipath-better-for-.patch b/kvm-file-posix-Handle-suspended-dm-multipath-better-for-.patch
deleted file mode 100644
index b4dd6ee..0000000
--- a/kvm-file-posix-Handle-suspended-dm-multipath-better-for-.patch
+++ /dev/null
@@ -1,123 +0,0 @@
-From 56703080fdf6630d6d844c736f3195b3b7b80f74 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Fri, 28 Nov 2025 23:14:40 +0100
-Subject: [PATCH 02/32] file-posix: Handle suspended dm-multipath better for
- SG_IO
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 436: file-posix: Handle suspended dm-multipath better for SG_IO
-RH-Jira: RHEL-121543
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Commit: [1/1] f90d36aba5b374dcb9d5986f968c2dbde4bdd18d (kmwolf/centos-qemu-kvm)
-
-When introducing DM_MPATH_PROBE_PATHS, we already anticipated that
-dm-multipath devices might be suspended for a short time when the DM
-tables are reloaded and that they return -EAGAIN in this case. We then
-wait for a millisecond and retry.
-
-However, meanwhile it has also turned out that libmpathpersist (which is
-used by qemu-pr-helper) may need to perform more complex recovery
-operations to get reservations back to expected state if a path failure
-happened in the middle of a PR operation. In this case, the device is
-suspended for a longer time compared to the case we originally expected.
-
-This patch changes hdev_co_ioctl() to treat -EAGAIN separately so that
-it doesn't result in an immediate failure if the device is suspended for
-more than 1ms, and moves to incremental backoff to cover both quick and
-slow cases without excessive delays.
-
-Buglink: https://issues.redhat.com/browse/RHEL-121543
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20251128221440.89125-1-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 2c3165a1a61c299b4a3ae30899e1cc738d20e004)
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/file-posix.c | 56 ++++++++++++++++++++++++++++------------------
- 1 file changed, 34 insertions(+), 22 deletions(-)
-
-diff --git a/block/file-posix.c b/block/file-posix.c
-index cb2e94d7db..ffca37130b 100644
---- a/block/file-posix.c
-+++ b/block/file-posix.c
-@@ -4289,25 +4289,8 @@ hdev_open_Mac_error:
- static bool coroutine_fn sgio_path_error(int ret, sg_io_hdr_t *io_hdr)
- {
- if (ret < 0) {
-- switch (ret) {
-- case -ENODEV:
-- return true;
-- case -EAGAIN:
-- /*
-- * The device is probably suspended. This happens while the dm table
-- * is reloaded, e.g. because a path is added or removed. This is an
-- * operation that should complete within 1ms, so just wait a bit and
-- * retry.
-- *
-- * If the device was suspended for another reason, we'll wait and
-- * retry SG_IO_MAX_RETRIES times. This is a tolerable delay before
-- * we return an error and potentially stop the VM.
-- */
-- qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, 1000000);
-- return true;
-- default:
-- return false;
-- }
-+ /* Path errors sometimes result in -ENODEV */
-+ return ret == -ENODEV;
- }
-
- if (io_hdr->host_status != SCSI_HOST_OK) {
-@@ -4376,6 +4359,7 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
- {
- BDRVRawState *s = bs->opaque;
- RawPosixAIOData acb;
-+ uint64_t eagain_sleep_ns = 1 * SCALE_MS;
- int retries = SG_IO_MAX_RETRIES;
- int ret;
-
-@@ -4404,9 +4388,37 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
- },
- };
-
-- do {
-- ret = raw_thread_pool_submit(handle_aiocb_ioctl, &acb);
-- } while (req == SG_IO && retries-- && hdev_co_ioctl_sgio_retry(&acb, ret));
-+retry:
-+ ret = raw_thread_pool_submit(handle_aiocb_ioctl, &acb);
-+ if (req == SG_IO && s->use_mpath) {
-+ if (ret == -EAGAIN && eagain_sleep_ns < NANOSECONDS_PER_SECOND) {
-+ /*
-+ * If this is a multipath device, it is probably suspended.
-+ *
-+ * This can happen while the dm table is reloaded, e.g. because a
-+ * path is added or removed. This is an operation that should
-+ * complete within 1ms, so just wait a bit and retry.
-+ *
-+ * There are also some cases in which libmpathpersist must recover
-+ * from path failure during its operation, which can leave the
-+ * device suspended for a bit longer while the library brings back
-+ * reservations into the expected state.
-+ *
-+ * Use increasing delays to cover both cases without waiting
-+ * excessively, and stop after a bit more than a second (1023 ms).
-+ * This is a tolerable delay before we return an error and
-+ * potentially stop the VM.
-+ */
-+ qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, eagain_sleep_ns);
-+ eagain_sleep_ns *= 2;
-+ goto retry;
-+ }
-+
-+ /* Even for ret == 0, the SG_IO header can contain an error */
-+ if (retries-- && hdev_co_ioctl_sgio_retry(&acb, ret)) {
-+ goto retry;
-+ }
-+ }
-
- return ret;
- }
---
-2.47.3
-
diff --git a/kvm-file-posix-populate-pwrite_zeroes_alignment.patch b/kvm-file-posix-populate-pwrite_zeroes_alignment.patch
deleted file mode 100644
index 08ddd32..0000000
--- a/kvm-file-posix-populate-pwrite_zeroes_alignment.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 746244e9df305293f9518dcb1dd636a7f8def4ac Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Tue, 7 Oct 2025 10:16:58 -0400
-Subject: [PATCH 34/52] file-posix: populate pwrite_zeroes_alignment
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [27/45] 4e268f2334911f502cc5290a93732acdd9a8df3b (kmwolf/centos-qemu-kvm)
-
-Linux block devices require write zeroes alignment whereas files do not.
-
-It may come as a surprise that block devices opened in buffered I/O mode
-require the alignment for write zeroes requests although normal
-read/write requests do not.
-
-Therefore it is necessary to populate the pwrite_zeroes_alignment field.
-
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Message-ID: <20251007141700.71891-2-stefanha@redhat.com>
-Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-Tested-by: Fiona Ebner <f.ebner@proxmox.com>
-Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 98e788b91ad037193b1fb375561ef7e0fef3c2fd)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/file-posix.c | 16 ++++++++++++++++
- 1 file changed, 16 insertions(+)
-
-diff --git a/block/file-posix.c b/block/file-posix.c
-index ffca37130b..0129413273 100644
---- a/block/file-posix.c
-+++ b/block/file-posix.c
-@@ -1607,6 +1607,22 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
-
- bs->bl.pdiscard_alignment = dalign;
- }
-+
-+#ifdef __linux__
-+ /*
-+ * Linux requires logical block size alignment for write zeroes even
-+ * when normal reads/writes do not require alignment.
-+ */
-+ if (!s->needs_alignment) {
-+ ret = probe_logical_blocksize(s->fd,
-+ &bs->bl.pwrite_zeroes_alignment);
-+ if (ret < 0) {
-+ error_setg_errno(errp, -ret,
-+ "Failed to probe logical block size");
-+ return;
-+ }
-+ }
-+#endif /* __linux__ */
- }
-
- raw_refresh_zoned_limits(bs, &st, errp);
---
-2.52.0
-
diff --git a/kvm-fix-pc_rhel_10_2_compat_len.patch b/kvm-fix-pc_rhel_10_2_compat_len.patch
deleted file mode 100644
index b93defd..0000000
--- a/kvm-fix-pc_rhel_10_2_compat_len.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From c4415936b6033aff4b2e38b1c470c920e14fa35a Mon Sep 17 00:00:00 2001
-From: Gerd Hoffmann <kraxel@redhat.com>
-Date: Mon, 12 Jan 2026 09:19:07 +0100
-Subject: [PATCH 1/4] fix pc_rhel_10_2_compat_len
-
-RH-Author: Gerd Hoffmann <kraxel@redhat.com>
-RH-MergeRequest: 447: q35: increase default tseg size
-RH-Jira: RHEL-126707
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/2] b9291186e031c0c018dfdc87960b04817421ecec (kraxel.rh/centos-src-qemu-kvm)
-
-There is an (apparently) cut+paste error in the definition
-pc_rhel_10_2_compat_len variable, it calculates the length
-of the wrong array. Fix it.
-
-Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
----
- hw/i386/pc.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/i386/pc.c b/hw/i386/pc.c
-index 446d4a7c93..394a84eb8a 100644
---- a/hw/i386/pc.c
-+++ b/hw/i386/pc.c
-@@ -304,7 +304,7 @@ GlobalProperty pc_rhel_10_2_compat[] = {
- { TYPE_X86_CPU, "x-arch-cap-always-on", "true" },
- { TYPE_X86_CPU, "x-pdcm-on-even-without-pmu", "true" },
- };
--const size_t pc_rhel_10_2_compat_len = G_N_ELEMENTS(pc_compat_10_0);
-+const size_t pc_rhel_10_2_compat_len = G_N_ELEMENTS(pc_rhel_10_2_compat);
-
- GlobalProperty pc_rhel_10_1_compat[] = {
- /* pc_rhel_10_1_compat from pc_compat_9_1 */
---
-2.47.3
-
diff --git a/kvm-hw-Remove-unnecessary-system-ram_addr.h-header.patch b/kvm-hw-Remove-unnecessary-system-ram_addr.h-header.patch
deleted file mode 100644
index f2da34c..0000000
--- a/kvm-hw-Remove-unnecessary-system-ram_addr.h-header.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-From eb8e987dcd0daf3dfabb014e71c7f4d840f569ca Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
-Date: Tue, 30 Sep 2025 09:20:38 +0200
-Subject: [PATCH 097/116] hw: Remove unnecessary 'system/ram_addr.h' header
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [81/100] bd76df276be7e688948ada5f196d3086f80d227e (rovick1/qemu-kvm)
-
-None of these files require definition exposed by "system/ram_addr.h",
-remove its inclusion.
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-Reviewed-by: Jagannathan Raman <jag.raman@oracle.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Eric Farman <farman@linux.ibm.com>
-Reviewed-by: Thomas Huth <thuth@redhat.com>
-Acked-by: Michael S. Tsirkin <mst@redhat.com>
-Message-Id: <20251001175448.18933-7-philmd@linaro.org>
-(cherry picked from commit 97480ca692e94bb790190a43bb122bd0752b8f62)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/ppc/spapr.c | 1 -
- hw/ppc/spapr_caps.c | 1 -
- hw/ppc/spapr_pci.c | 1 -
- hw/remote/memory.c | 1 -
- hw/remote/proxy-memory-listener.c | 1 -
- hw/s390x/s390-virtio-ccw.c | 1 -
- hw/vfio/spapr.c | 1 -
- hw/virtio/virtio-mem.c | 1 -
- 8 files changed, 8 deletions(-)
-
-diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
-index 1855a3cd8d..5906a1325d 100644
---- a/hw/ppc/spapr.c
-+++ b/hw/ppc/spapr.c
-@@ -77,7 +77,6 @@
- #include "hw/virtio/virtio-scsi.h"
- #include "hw/virtio/vhost-scsi-common.h"
-
--#include "system/ram_addr.h"
- #include "system/confidential-guest-support.h"
- #include "hw/usb.h"
- #include "qemu/config-file.h"
-diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
-index f2f5722d8a..0f94c192fd 100644
---- a/hw/ppc/spapr_caps.c
-+++ b/hw/ppc/spapr_caps.c
-@@ -27,7 +27,6 @@
- #include "qapi/error.h"
- #include "qapi/visitor.h"
- #include "system/hw_accel.h"
--#include "system/ram_addr.h"
- #include "target/ppc/cpu.h"
- #include "target/ppc/mmu-hash64.h"
- #include "cpu-models.h"
-diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
-index 1ac1185825..f9095552e8 100644
---- a/hw/ppc/spapr_pci.c
-+++ b/hw/ppc/spapr_pci.c
-@@ -34,7 +34,6 @@
- #include "hw/pci/pci_host.h"
- #include "hw/ppc/spapr.h"
- #include "hw/pci-host/spapr.h"
--#include "system/ram_addr.h"
- #include <libfdt.h>
- #include "trace.h"
- #include "qemu/error-report.h"
-diff --git a/hw/remote/memory.c b/hw/remote/memory.c
-index 00193a552f..8195aa5fb8 100644
---- a/hw/remote/memory.c
-+++ b/hw/remote/memory.c
-@@ -11,7 +11,6 @@
- #include "qemu/osdep.h"
-
- #include "hw/remote/memory.h"
--#include "system/ram_addr.h"
- #include "qapi/error.h"
-
- static void remote_sysmem_reset(void)
-diff --git a/hw/remote/proxy-memory-listener.c b/hw/remote/proxy-memory-listener.c
-index 30ac74961d..e1a52d24f0 100644
---- a/hw/remote/proxy-memory-listener.c
-+++ b/hw/remote/proxy-memory-listener.c
-@@ -12,7 +12,6 @@
- #include "qemu/range.h"
- #include "system/memory.h"
- #include "exec/cpu-common.h"
--#include "system/ram_addr.h"
- #include "qapi/error.h"
- #include "qemu/error-report.h"
- #include "hw/remote/mpqemu-link.h"
-diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
-index 4937a0c3b8..c2ebc086b3 100644
---- a/hw/s390x/s390-virtio-ccw.c
-+++ b/hw/s390x/s390-virtio-ccw.c
-@@ -13,7 +13,6 @@
-
- #include "qemu/osdep.h"
- #include "qapi/error.h"
--#include "system/ram_addr.h"
- #include "system/confidential-guest-support.h"
- #include "hw/boards.h"
- #include "hw/s390x/sclp.h"
-diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c
-index 8d9d68da4e..0f23681a3f 100644
---- a/hw/vfio/spapr.c
-+++ b/hw/vfio/spapr.c
-@@ -17,7 +17,6 @@
-
- #include "hw/vfio/vfio-container-legacy.h"
- #include "hw/hw.h"
--#include "system/ram_addr.h"
- #include "qemu/error-report.h"
- #include "qapi/error.h"
- #include "trace.h"
-diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
-index 1805597879..582f3f0e00 100644
---- a/hw/virtio/virtio-mem.c
-+++ b/hw/virtio/virtio-mem.c
-@@ -24,7 +24,6 @@
- #include "hw/virtio/virtio-mem.h"
- #include "qapi/error.h"
- #include "qapi/visitor.h"
--#include "system/ram_addr.h"
- #include "migration/misc.h"
- #include "hw/boards.h"
- #include "hw/qdev-properties.h"
---
-2.52.0
-
diff --git a/kvm-hw-acpi-tpm-parameterize-PPI-base-address-in-tpm_bui.patch b/kvm-hw-acpi-tpm-parameterize-PPI-base-address-in-tpm_bui.patch
deleted file mode 100644
index 6d2a7c1..0000000
--- a/kvm-hw-acpi-tpm-parameterize-PPI-base-address-in-tpm_bui.patch
+++ /dev/null
@@ -1,130 +0,0 @@
-From d6915cae3f12625851154ddc936e1ca4ebf4b44a Mon Sep 17 00:00:00 2001
-From: Mohammadfaiz Bawa <mbawa@redhat.com>
-Date: Thu, 7 May 2026 15:37:00 +0530
-Subject: [PATCH 8/9] hw/acpi/tpm: parameterize PPI base address in
- tpm_build_ppi_acpi
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Mohammadfaiz Bawa <None>
-RH-MergeRequest: 485: hw/tpm: add PPI support to tpm-tis-device for ARM64 virt
-RH-Jira: RHEL-112608
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [7/8] c6ee1f0245e11a9768533bab054b96acfff3e366 (faizb/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-112608
-
-Add a ppi_base parameter to tpm_build_ppi_acpi() instead of
-hardcoding TPM_PPI_ADDR_BASE. This prepares for ARM64 support where
-PPI memory is dynamically allocated by the platform bus and the
-address is not known at compile time.
-
-Update the x86 callers (ISA TIS and CRB) to pass TPM_PPI_ADDR_BASE
-explicitly. No behavioral change.
-
-Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Message-ID: <20260327173209.148180-3-mbawa@redhat.com>
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-(cherry picked from commit 859252e13bb5a84bb9d25490168ec37e621ab92a)
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
----
- hw/acpi/tpm.c | 8 ++++----
- hw/i386/acpi-build.c | 2 +-
- hw/tpm/tpm_tis_isa.c | 2 +-
- include/hw/acpi/tpm.h | 3 ++-
- 4 files changed, 8 insertions(+), 7 deletions(-)
-
-diff --git a/hw/acpi/tpm.c b/hw/acpi/tpm.c
-index 5fe95f2e3f..e703775984 100644
---- a/hw/acpi/tpm.c
-+++ b/hw/acpi/tpm.c
-@@ -20,7 +20,7 @@
- #include "qapi/error.h"
- #include "hw/acpi/tpm.h"
-
--void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev)
-+void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev, hwaddr ppi_base)
- {
- Aml *method, *field, *ifctx, *ifctx2, *ifctx3, *func_mask,
- *not_implemented, *pak, *tpm2, *tpm3, *pprm, *pprq, *zero, *one;
-@@ -40,7 +40,7 @@ void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev)
- */
- aml_append(dev,
- aml_operation_region("TPP2", AML_SYSTEM_MEMORY,
-- aml_int(TPM_PPI_ADDR_BASE + 0x100),
-+ aml_int(ppi_base + 0x100),
- 0x5A));
- field = aml_field("TPP2", AML_ANY_ACC, AML_NOLOCK, AML_PRESERVE);
- aml_append(field, aml_named_field("PPIN", 8));
-@@ -56,7 +56,7 @@ void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev)
- aml_append(dev,
- aml_operation_region(
- "TPP3", AML_SYSTEM_MEMORY,
-- aml_int(TPM_PPI_ADDR_BASE +
-+ aml_int(ppi_base +
- 0x15a /* movv, docs/specs/tpm.rst */),
- 0x1));
- field = aml_field("TPP3", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
-@@ -78,7 +78,7 @@ void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev)
-
- aml_append(method,
- aml_operation_region("TPP1", AML_SYSTEM_MEMORY,
-- aml_add(aml_int(TPM_PPI_ADDR_BASE), op, NULL), 0x1));
-+ aml_add(aml_int(ppi_base), op, NULL), 0x1));
- field = aml_field("TPP1", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
- aml_append(field, aml_named_field("TPPF", 8));
- aml_append(method, field);
-diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
-index f97d7b9f0c..7ad7941aba 100644
---- a/hw/i386/acpi-build.c
-+++ b/hw/i386/acpi-build.c
-@@ -1220,7 +1220,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
- aml_append(dev, aml_name_decl("_STA", aml_int(0xf)));
- aml_append(dev, aml_name_decl("_UID", aml_int(1)));
-
-- tpm_build_ppi_acpi(tpm, dev);
-+ tpm_build_ppi_acpi(tpm, dev, TPM_PPI_ADDR_BASE);
-
- aml_append(sb_scope, dev);
- }
-diff --git a/hw/tpm/tpm_tis_isa.c b/hw/tpm/tpm_tis_isa.c
-index e481c174e1..835006a2f4 100644
---- a/hw/tpm/tpm_tis_isa.c
-+++ b/hw/tpm/tpm_tis_isa.c
-@@ -159,7 +159,7 @@ static void build_tpm_tis_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
- */
- /* aml_append(crs, aml_irq_no_flags(isadev->state.irq_num)); */
- aml_append(dev, aml_name_decl("_CRS", crs));
-- tpm_build_ppi_acpi(ti, dev);
-+ tpm_build_ppi_acpi(ti, dev, TPM_PPI_ADDR_BASE);
- aml_append(scope, dev);
- }
-
-diff --git a/include/hw/acpi/tpm.h b/include/hw/acpi/tpm.h
-index 9d0fe6f2f9..798f77592d 100644
---- a/include/hw/acpi/tpm.h
-+++ b/include/hw/acpi/tpm.h
-@@ -20,6 +20,7 @@
- #include "hw/registerfields.h"
- #include "hw/acpi/aml-build.h"
- #include "system/tpm.h"
-+#include "exec/hwaddr.h"
-
- #ifdef CONFIG_TPM
-
-@@ -250,7 +251,7 @@ REG32(CRB_DATA_BUFFER, 0x80)
- */
- #define TPM_I2C_INT_ENABLE_MASK 0x0
-
--void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev);
-+void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev, hwaddr ppi_base);
-
- #endif /* CONFIG_TPM */
-
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmu-add-memory-regions-as-property-for-an-SM.patch b/kvm-hw-arm-smmu-add-memory-regions-as-property-for-an-SM.patch
deleted file mode 100644
index 0b058c0..0000000
--- a/kvm-hw-arm-smmu-add-memory-regions-as-property-for-an-SM.patch
+++ /dev/null
@@ -1,210 +0,0 @@
-From 938b9e6cc71799999c3d2911c3281de87a32ae5a Mon Sep 17 00:00:00 2001
-From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
-Date: Thu, 15 Jan 2026 15:26:30 +0000
-Subject: [PATCH 004/111] hw/arm/smmu: add memory regions as property for an
- SMMU instance
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [4/111] de140c2d7250de6154e18e036a7a114502a43867 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-This will be used to access non-secure and secure memory. Secure support
-and Granule Protection Check (for RME) for SMMU need to access secure
-memory.
-
-As well, it allows to remove usage of global address_space_memory,
-allowing different SMMU instances to have a specific view of memory.
-
-User creatable SMMU are handled as well for virt machine,
-by setting the memory properties when device is plugged in.
-
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260108210453.2280733-1-pierrick.bouvier@linaro.org
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 53b54a82520f23da2be49cc0d69210a086fc7072)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/sbsa-ref.c | 16 ++++++++++++----
- hw/arm/smmu-common.c | 11 +++++++++++
- hw/arm/virt.c | 13 +++++++++++--
- include/hw/arm/smmu-common.h | 4 ++++
- include/hw/arm/virt.h | 2 ++
- 5 files changed, 40 insertions(+), 6 deletions(-)
-
-diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
-index 15c1ff4b14..48c2054be0 100644
---- a/hw/arm/sbsa-ref.c
-+++ b/hw/arm/sbsa-ref.c
-@@ -611,7 +611,9 @@ static void create_xhci(const SBSAMachineState *sms)
- sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(sms->gic, irq));
- }
-
--static void create_smmu(const SBSAMachineState *sms, PCIBus *bus)
-+static void create_smmu(const SBSAMachineState *sms, PCIBus *bus,
-+ MemoryRegion *sysmem,
-+ MemoryRegion *secure_sysmem)
- {
- hwaddr base = sbsa_ref_memmap[SBSA_SMMU].base;
- int irq = sbsa_ref_irqmap[SBSA_SMMU];
-@@ -623,6 +625,10 @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus)
- object_property_set_str(OBJECT(dev), "stage", "nested", &error_abort);
- object_property_set_link(OBJECT(dev), "primary-bus", OBJECT(bus),
- &error_abort);
-+ object_property_set_link(OBJECT(dev), "memory", OBJECT(sysmem),
-+ &error_abort);
-+ object_property_set_link(OBJECT(dev), "secure-memory", OBJECT(secure_sysmem),
-+ &error_abort);
- sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
- sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
- for (i = 0; i < NUM_SMMU_IRQS; i++) {
-@@ -631,7 +637,9 @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus)
- }
- }
-
--static void create_pcie(SBSAMachineState *sms)
-+static void create_pcie(SBSAMachineState *sms,
-+ MemoryRegion *sysmem,
-+ MemoryRegion *secure_sysmem)
- {
- hwaddr base_ecam = sbsa_ref_memmap[SBSA_PCIE_ECAM].base;
- hwaddr size_ecam = sbsa_ref_memmap[SBSA_PCIE_ECAM].size;
-@@ -687,7 +695,7 @@ static void create_pcie(SBSAMachineState *sms)
-
- pci_create_simple(pci->bus, -1, "bochs-display");
-
-- create_smmu(sms, pci->bus);
-+ create_smmu(sms, pci->bus, sysmem, secure_sysmem);
- }
-
- static void *sbsa_ref_dtb(const struct arm_boot_info *binfo, int *fdt_size)
-@@ -823,7 +831,7 @@ static void sbsa_ref_init(MachineState *machine)
-
- create_xhci(sms);
-
-- create_pcie(sms);
-+ create_pcie(sms, sysmem, secure_sysmem);
-
- create_secure_ec(secure_sysmem);
-
-diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
-index 59d6147ec9..75d840e389 100644
---- a/hw/arm/smmu-common.c
-+++ b/hw/arm/smmu-common.c
-@@ -952,6 +952,13 @@ static void smmu_base_realize(DeviceState *dev, Error **errp)
- return;
- }
-
-+ g_assert(s->memory);
-+ address_space_init(&s->memory_as, s->memory, "smmu-memory-view");
-+ if (s->secure_memory) {
-+ address_space_init(&s->secure_memory_as, s->secure_memory,
-+ "smmu-secure-memory-view");
-+ }
-+
- /*
- * We only allow default PCIe Root Complex(pcie.0) or pxb-pcie based extra
- * root complexes to be associated with SMMU.
-@@ -1002,6 +1009,10 @@ static const Property smmu_dev_properties[] = {
- DEFINE_PROP_BOOL("smmu_per_bus", SMMUState, smmu_per_bus, false),
- DEFINE_PROP_LINK("primary-bus", SMMUState, primary_bus,
- TYPE_PCI_BUS, PCIBus *),
-+ DEFINE_PROP_LINK("memory", SMMUState, memory,
-+ TYPE_MEMORY_REGION, MemoryRegion *),
-+ DEFINE_PROP_LINK("secure-memory", SMMUState, secure_memory,
-+ TYPE_MEMORY_REGION, MemoryRegion *),
- };
-
- static void smmu_base_class_init(ObjectClass *klass, const void *data)
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index 5bb6ba7de7..e3e0233474 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -1526,8 +1526,7 @@ static void create_smmuv3_dev_dtb(VirtMachineState *vms,
- 0x0, vms->iommu_phandle, 0x0, 0x10000);
- }
-
--static void create_smmu(const VirtMachineState *vms,
-- PCIBus *bus)
-+static void create_smmu(const VirtMachineState *vms, PCIBus *bus)
- {
- VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
- int irq = vms->irqmap[VIRT_SMMU];
-@@ -1547,6 +1546,10 @@ static void create_smmu(const VirtMachineState *vms,
- }
- object_property_set_link(OBJECT(dev), "primary-bus", OBJECT(bus),
- &error_abort);
-+ object_property_set_link(OBJECT(dev), "memory", OBJECT(vms->sysmem),
-+ &error_abort);
-+ object_property_set_link(OBJECT(dev), "secure-memory", OBJECT(vms->secure_sysmem),
-+ &error_abort);
- sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
- sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
- for (i = 0; i < NUM_SMMU_IRQS; i++) {
-@@ -1621,6 +1624,7 @@ static void create_pcie(VirtMachineState *vms)
- memory_region_init_alias(ecam_alias, OBJECT(dev), "pcie-ecam",
- ecam_reg, 0, size_ecam);
- memory_region_add_subregion(get_system_memory(), base_ecam, ecam_alias);
-+ vms->sysmem = get_system_memory();
-
- /* Map the MMIO window into system address space so as to expose
- * the section of PCI MMIO space which starts at the same base address
-@@ -2279,6 +2283,7 @@ static void machvirt_init(MachineState *machine)
- * devices go in at higher priority and take precedence.
- */
- secure_sysmem = g_new(MemoryRegion, 1);
-+ vms->secure_sysmem = secure_sysmem;
- memory_region_init(secure_sysmem, OBJECT(machine), "secure-memory",
- UINT64_MAX);
- memory_region_add_subregion_overlap(secure_sysmem, 0, sysmem, -1);
-@@ -3082,6 +3087,10 @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
- } else if (vms->iommu == VIRT_IOMMU_NONE) {
- /* The new SMMUv3 device is specific to the PCI bus */
- object_property_set_bool(OBJECT(dev), "smmu_per_bus", true, NULL);
-+ object_property_set_link(OBJECT(dev), "memory",
-+ OBJECT(vms->sysmem), NULL);
-+ object_property_set_link(OBJECT(dev), "secure-memory",
-+ OBJECT(vms->secure_sysmem), NULL);
- }
- }
- }
-diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
-index d307ddd952..e626c6c567 100644
---- a/include/hw/arm/smmu-common.h
-+++ b/include/hw/arm/smmu-common.h
-@@ -162,6 +162,10 @@ struct SMMUState {
- uint8_t bus_num;
- PCIBus *primary_bus;
- bool smmu_per_bus; /* SMMU is specific to the primary_bus */
-+ MemoryRegion *memory;
-+ AddressSpace memory_as;
-+ MemoryRegion *secure_memory;
-+ AddressSpace secure_memory_as;
- };
-
- struct SMMUBaseClass {
-diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
-index 98b877c8b9..8d90b66b87 100644
---- a/include/hw/arm/virt.h
-+++ b/include/hw/arm/virt.h
-@@ -181,6 +181,8 @@ struct VirtMachineState {
- bool ns_el2_virt_timer_irq;
- CXLState cxl_devices_state;
- bool legacy_smmuv3_present;
-+ MemoryRegion *sysmem;
-+ MemoryRegion *secure_sysmem;
- };
-
- #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmu-common-Check-SMMU-has-PCIe-Root-Complex-.patch b/kvm-hw-arm-smmu-common-Check-SMMU-has-PCIe-Root-Complex-.patch
deleted file mode 100644
index 1f0fe4a..0000000
--- a/kvm-hw-arm-smmu-common-Check-SMMU-has-PCIe-Root-Complex-.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From ad929c3b2e90eeb1f81a3f7074cdaaa922b073b9 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 29 Aug 2025 09:25:23 +0100
-Subject: [PATCH 05/16] hw/arm/smmu-common: Check SMMU has PCIe Root Complex
- association
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 423: hw/arm/virt: Add support for user creatable SMMUv3 device
-RH-Jira: RHEL-73800
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Donald Dutile <None>
-RH-Commit: [1/11] 9e7a87070ebfef643848d31fe66f5b4e82bfe0cf (eauger1/centos-qemu-kvm)
-
-We only allow default PCIe Root Complex(pcie.0) or pxb-pcie based extra
-root complexes to be associated with SMMU.
-
-Although this change does not affect functionality at present, it is
-required when we add support for user-creatable SMMUv3 devices in
-future patches.
-
-Note: Added a specific check to identify pxb-pcie to avoid matching
-pxb-cxl host bridges, which are also of type PCI_HOST_BRIDGE. This
-restriction can be relaxed once support for CXL devices on arm/virt
-is added and validated with SMMUv3.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nathan Chen <nathanc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Donald Dutile <ddutile@redhat.com>
-Message-id: 20250829082543.7680-2-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit d9e6b8424fd2523a0361972d5dd841471879479c)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmu-common.c | 31 ++++++++++++++++++++++++++---
- hw/pci-bridge/pci_expander_bridge.c | 1 -
- include/hw/pci/pci_bridge.h | 1 +
- 3 files changed, 29 insertions(+), 4 deletions(-)
-
-diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
-index 0dcaf2f589..7f64ea48d0 100644
---- a/hw/arm/smmu-common.c
-+++ b/hw/arm/smmu-common.c
-@@ -20,6 +20,7 @@
- #include "trace.h"
- #include "exec/target_page.h"
- #include "hw/core/cpu.h"
-+#include "hw/pci/pci_bridge.h"
- #include "hw/qdev-properties.h"
- #include "qapi/error.h"
- #include "qemu/jhash.h"
-@@ -925,6 +926,7 @@ static void smmu_base_realize(DeviceState *dev, Error **errp)
- {
- SMMUState *s = ARM_SMMU(dev);
- SMMUBaseClass *sbc = ARM_SMMU_GET_CLASS(dev);
-+ PCIBus *pci_bus = s->primary_bus;
- Error *local_err = NULL;
-
- sbc->parent_realize(dev, &local_err);
-@@ -937,11 +939,34 @@ static void smmu_base_realize(DeviceState *dev, Error **errp)
- g_free, g_free);
- s->smmu_pcibus_by_busptr = g_hash_table_new(NULL, NULL);
-
-- if (s->primary_bus) {
-- pci_setup_iommu(s->primary_bus, &smmu_ops, s);
-- } else {
-+ if (!pci_bus) {
- error_setg(errp, "SMMU is not attached to any PCI bus!");
-+ return;
-+ }
-+
-+ /*
-+ * We only allow default PCIe Root Complex(pcie.0) or pxb-pcie based extra
-+ * root complexes to be associated with SMMU.
-+ */
-+ if (pci_bus_is_express(pci_bus) && pci_bus_is_root(pci_bus) &&
-+ object_dynamic_cast(OBJECT(pci_bus)->parent, TYPE_PCI_HOST_BRIDGE)) {
-+ /*
-+ * This condition matches either the default pcie.0, pxb-pcie, or
-+ * pxb-cxl. For both pxb-pcie and pxb-cxl, parent_dev will be set.
-+ * Currently, we don't allow pxb-cxl as it requires further
-+ * verification. Therefore, make sure this is indeed pxb-pcie.
-+ */
-+ if (pci_bus->parent_dev) {
-+ if (!object_dynamic_cast(OBJECT(pci_bus), TYPE_PXB_PCIE_BUS)) {
-+ goto out_err;
-+ }
-+ }
-+ pci_setup_iommu(pci_bus, &smmu_ops, s);
-+ return;
- }
-+out_err:
-+ error_setg(errp, "SMMU should be attached to a default PCIe root complex"
-+ "(pcie.0) or a pxb-pcie based root complex");
- }
-
- /*
-diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
-index 3a29dfefc2..1bcceddbc4 100644
---- a/hw/pci-bridge/pci_expander_bridge.c
-+++ b/hw/pci-bridge/pci_expander_bridge.c
-@@ -34,7 +34,6 @@ typedef struct PXBBus PXBBus;
- DECLARE_INSTANCE_CHECKER(PXBBus, PXB_BUS,
- TYPE_PXB_BUS)
-
--#define TYPE_PXB_PCIE_BUS "pxb-pcie-bus"
- DECLARE_INSTANCE_CHECKER(PXBBus, PXB_PCIE_BUS,
- TYPE_PXB_PCIE_BUS)
-
-diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
-index 8cdacbc4e1..a055fd8d32 100644
---- a/include/hw/pci/pci_bridge.h
-+++ b/include/hw/pci/pci_bridge.h
-@@ -104,6 +104,7 @@ typedef struct PXBPCIEDev {
- PXBDev parent_obj;
- } PXBPCIEDev;
-
-+#define TYPE_PXB_PCIE_BUS "pxb-pcie-bus"
- #define TYPE_PXB_CXL_BUS "pxb-cxl-bus"
- #define TYPE_PXB_DEV "pxb"
- OBJECT_DECLARE_SIMPLE_TYPE(PXBDev, PXB_DEV)
---
-2.47.3
-
diff --git a/kvm-hw-arm-smmu-common-Factor-out-common-helper-function.patch b/kvm-hw-arm-smmu-common-Factor-out-common-helper-function.patch
deleted file mode 100644
index 72cf640..0000000
--- a/kvm-hw-arm-smmu-common-Factor-out-common-helper-function.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-From 918055b41105a10c2378ffd6d6c24543a66a11e4 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 003/111] hw/arm/smmu-common: Factor out common helper
- functions and export
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [3/111] 24724b112687ea545700cdf9580220b83c302707 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Factor out common helper functions and export. Subsequent patches for
-smmuv3 accel support will make use of this.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-4-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 8d9633f1edbbdf693f39106a23dc020476cc2ebc)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmu-common.c | 44 +++++++++++++++++++++---------------
- include/hw/arm/smmu-common.h | 6 +++++
- 2 files changed, 32 insertions(+), 18 deletions(-)
-
-diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
-index 62a7612184..59d6147ec9 100644
---- a/hw/arm/smmu-common.c
-+++ b/hw/arm/smmu-common.c
-@@ -847,12 +847,24 @@ SMMUPciBus *smmu_find_smmu_pcibus(SMMUState *s, uint8_t bus_num)
- return NULL;
- }
-
--static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
-+void smmu_init_sdev(SMMUState *s, SMMUDevice *sdev, PCIBus *bus, int devfn)
- {
-- SMMUState *s = opaque;
-- SMMUPciBus *sbus = g_hash_table_lookup(s->smmu_pcibus_by_busptr, bus);
-- SMMUDevice *sdev;
- static unsigned int index;
-+ g_autofree char *name = g_strdup_printf("%s-%d-%d", s->mrtypename, devfn,
-+ index++);
-+ sdev->smmu = s;
-+ sdev->bus = bus;
-+ sdev->devfn = devfn;
-+
-+ memory_region_init_iommu(&sdev->iommu, sizeof(sdev->iommu),
-+ s->mrtypename, OBJECT(s), name, UINT64_MAX);
-+ address_space_init(&sdev->as, MEMORY_REGION(&sdev->iommu), name);
-+ trace_smmu_add_mr(name);
-+}
-+
-+SMMUPciBus *smmu_get_sbus(SMMUState *s, PCIBus *bus)
-+{
-+ SMMUPciBus *sbus = g_hash_table_lookup(s->smmu_pcibus_by_busptr, bus);
-
- if (!sbus) {
- sbus = g_malloc0(sizeof(SMMUPciBus) +
-@@ -861,23 +873,19 @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
- g_hash_table_insert(s->smmu_pcibus_by_busptr, bus, sbus);
- }
-
-+ return sbus;
-+}
-+
-+static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
-+{
-+ SMMUState *s = opaque;
-+ SMMUPciBus *sbus = smmu_get_sbus(s, bus);
-+ SMMUDevice *sdev;
-+
- sdev = sbus->pbdev[devfn];
- if (!sdev) {
-- char *name = g_strdup_printf("%s-%d-%d", s->mrtypename, devfn, index++);
--
- sdev = sbus->pbdev[devfn] = g_new0(SMMUDevice, 1);
--
-- sdev->smmu = s;
-- sdev->bus = bus;
-- sdev->devfn = devfn;
--
-- memory_region_init_iommu(&sdev->iommu, sizeof(sdev->iommu),
-- s->mrtypename,
-- OBJECT(s), name, UINT64_MAX);
-- address_space_init(&sdev->as,
-- MEMORY_REGION(&sdev->iommu), name);
-- trace_smmu_add_mr(name);
-- g_free(name);
-+ smmu_init_sdev(s, sdev, bus, devfn);
- }
-
- return &sdev->as;
-diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
-index 80d0fecfde..d307ddd952 100644
---- a/include/hw/arm/smmu-common.h
-+++ b/include/hw/arm/smmu-common.h
-@@ -180,6 +180,12 @@ OBJECT_DECLARE_TYPE(SMMUState, SMMUBaseClass, ARM_SMMU)
- /* Return the SMMUPciBus handle associated to a PCI bus number */
- SMMUPciBus *smmu_find_smmu_pcibus(SMMUState *s, uint8_t bus_num);
-
-+/* Return the SMMUPciBus handle associated to a PCI bus */
-+SMMUPciBus *smmu_get_sbus(SMMUState *s, PCIBus *bus);
-+
-+/* Initialize SMMUDevice handle associated to a SMMUPciBus */
-+void smmu_init_sdev(SMMUState *s, SMMUDevice *sdev, PCIBus *bus, int devfn);
-+
- /* Return the stream ID of an SMMU device */
- static inline uint16_t smmu_get_sid(SMMUDevice *sdev)
- {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmu-common-Make-iommu-ops-part-of-SMMUState.patch b/kvm-hw-arm-smmu-common-Make-iommu-ops-part-of-SMMUState.patch
deleted file mode 100644
index fe1a00c..0000000
--- a/kvm-hw-arm-smmu-common-Make-iommu-ops-part-of-SMMUState.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From 060b817ebbd77d3ec0a7a9d7bdfce8df4ce3e7e6 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 006/111] hw/arm/smmu-common: Make iommu ops part of SMMUState
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [6/111] 1a120125bce9df1d6897d71d66ed94f72c3a615d (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Make iommu ops part of SMMUState and set to the current default smmu_ops.
-No functional change intended. This will allow SMMUv3 accel implementation
-to set a different iommu ops later.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-5-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 797fffedac9355495c010a12d4766517db2aa911)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmu-common.c | 7 +++++--
- include/hw/arm/smmu-common.h | 1 +
- 2 files changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
-index 75d840e389..d70ca81775 100644
---- a/hw/arm/smmu-common.c
-+++ b/hw/arm/smmu-common.c
-@@ -959,6 +959,9 @@ static void smmu_base_realize(DeviceState *dev, Error **errp)
- "smmu-secure-memory-view");
- }
-
-+ if (!s->iommu_ops) {
-+ s->iommu_ops = &smmu_ops;
-+ }
- /*
- * We only allow default PCIe Root Complex(pcie.0) or pxb-pcie based extra
- * root complexes to be associated with SMMU.
-@@ -978,9 +981,9 @@ static void smmu_base_realize(DeviceState *dev, Error **errp)
- }
-
- if (s->smmu_per_bus) {
-- pci_setup_iommu_per_bus(pci_bus, &smmu_ops, s);
-+ pci_setup_iommu_per_bus(pci_bus, s->iommu_ops, s);
- } else {
-- pci_setup_iommu(pci_bus, &smmu_ops, s);
-+ pci_setup_iommu(pci_bus, s->iommu_ops, s);
- }
- return;
- }
-diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
-index e626c6c567..ffcac991de 100644
---- a/include/hw/arm/smmu-common.h
-+++ b/include/hw/arm/smmu-common.h
-@@ -166,6 +166,7 @@ struct SMMUState {
- AddressSpace memory_as;
- MemoryRegion *secure_memory;
- AddressSpace secure_memory_as;
-+ const PCIIOMMUOps *iommu_ops;
- };
-
- struct SMMUBaseClass {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Add-accel-property-for-SMMUv3-device.patch b/kvm-hw-arm-smmuv3-Add-accel-property-for-SMMUv3-device.patch
deleted file mode 100644
index 354f63b..0000000
--- a/kvm-hw-arm-smmuv3-Add-accel-property-for-SMMUv3-device.patch
+++ /dev/null
@@ -1,179 +0,0 @@
-From 3f2d3f5c1d9a64009abfa03f01ddd2411449ff5f Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 036/111] hw/arm/smmuv3: Add accel property for SMMUv3 device
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [36/111] baba44ac01f76bcea04c4366994441a55cb7cb5e (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Add an "accel" property to enable SMMUv3 accelerator mode.
-
-Accelerator mode relies on IORT RMR entries for MSI support and is
-therefore not supported when booting with a device tree.
-
-In this mode, the host SMMUv3 operates in nested translation
-(Stage-1 + Stage-2), with the guest owning the Stage-1 page tables.
-Expose only Stage-1 to the guest to ensure it uses the correct page
-table format
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-29-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 6cc3a621c6f184ffa04bf68f7a57323c63f6ef56)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3.c | 32 ++++++++++++++++++++++++++++++++
- hw/arm/virt-acpi-build.c | 4 +---
- hw/arm/virt.c | 22 +++++++++++++---------
- 3 files changed, 46 insertions(+), 12 deletions(-)
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 6faa660bab..0d2f5a9b0c 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1916,6 +1916,29 @@ static void smmu_reset_exit(Object *obj, ResetType type)
- smmuv3_accel_reset(s);
- }
-
-+static bool smmu_validate_property(SMMUv3State *s, Error **errp)
-+{
-+#ifndef CONFIG_ARM_SMMUV3_ACCEL
-+ if (s->accel) {
-+ error_setg(errp, "accel=on support not compiled in");
-+ return false;
-+ }
-+#endif
-+
-+ if (!s->accel) {
-+ return true;
-+ }
-+
-+ /* If no stage specified, SMMUv3 defaults to stage 1 */
-+ if (s->stage && strcmp(s->stage, "1")) {
-+ error_setg(errp,
-+ "Only stage1 is supported for SMMUv3 with accel=on");
-+ return false;
-+ }
-+
-+ return true;
-+}
-+
- static void smmu_realize(DeviceState *d, Error **errp)
- {
- SMMUState *sys = ARM_SMMU(d);
-@@ -1924,6 +1947,10 @@ static void smmu_realize(DeviceState *d, Error **errp)
- SysBusDevice *dev = SYS_BUS_DEVICE(d);
- Error *local_err = NULL;
-
-+ if (!smmu_validate_property(s, errp)) {
-+ return;
-+ }
-+
- if (s->accel) {
- smmuv3_accel_init(s);
- error_setg(&s->migration_blocker, "Migration not supported with SMMUv3 "
-@@ -2029,6 +2056,7 @@ static const Property smmuv3_properties[] = {
- * Defaults to stage 1
- */
- DEFINE_PROP_STRING("stage", SMMUv3State, stage),
-+ DEFINE_PROP_BOOL("accel", SMMUv3State, accel, false),
- /* GPA of MSI doorbell, for SMMUv3 accel use. */
- DEFINE_PROP_UINT64("msi-gpa", SMMUv3State, msi_gpa, 0),
- };
-@@ -2052,6 +2080,10 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- device_class_set_props(dc, smmuv3_properties);
- dc->hotpluggable = false;
- dc->user_creatable = true;
-+
-+ object_class_property_set_description(klass, "accel",
-+ "Enable SMMUv3 accelerator support. Allows host SMMUv3 to be "
-+ "configured in nested mode for vfio-pci dev assignment");
- }
-
- static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
-diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
-index 1323d1a0da..33c6519f0a 100644
---- a/hw/arm/virt-acpi-build.c
-+++ b/hw/arm/virt-acpi-build.c
-@@ -406,9 +406,7 @@ static int iort_smmuv3_devices(Object *obj, void *opaque)
- }
-
- bus = PCI_BUS(object_property_get_link(obj, "primary-bus", &error_abort));
-- if (object_property_find(obj, "accel")) {
-- sdev.accel = object_property_get_bool(obj, "accel", &error_abort);
-- }
-+ sdev.accel = object_property_get_bool(obj, "accel", &error_abort);
- pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
- sbdev = SYS_BUS_DEVICE(obj);
- sdev.base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index 672b8d912c..5486af4456 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -1503,8 +1503,8 @@ static void create_smmuv3_dt_bindings(const VirtMachineState *vms, hwaddr base,
- g_free(node);
- }
-
--static void create_smmuv3_dev_dtb(VirtMachineState *vms,
-- DeviceState *dev, PCIBus *bus)
-+static void create_smmuv3_dev_dtb(VirtMachineState *vms, DeviceState *dev,
-+ PCIBus *bus, Error **errp)
- {
- PlatformBusDevice *pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
- SysBusDevice *sbdev = SYS_BUS_DEVICE(dev);
-@@ -1512,10 +1512,15 @@ static void create_smmuv3_dev_dtb(VirtMachineState *vms,
- hwaddr base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
- MachineState *ms = MACHINE(vms);
-
-- if (!(vms->bootinfo.firmware_loaded && virt_is_acpi_enabled(vms)) &&
-- strcmp("pcie.0", bus->qbus.name)) {
-- warn_report("SMMUv3 device only supported with pcie.0 for DT");
-- return;
-+ if (!(vms->bootinfo.firmware_loaded && virt_is_acpi_enabled(vms))) {
-+ if (object_property_get_bool(OBJECT(dev), "accel", &error_abort)) {
-+ error_setg(errp, "SMMUv3 with accel=on not supported for DT");
-+ return;
-+ }
-+ if (strcmp("pcie.0", bus->qbus.name)) {
-+ warn_report("SMMUv3 device only supported with pcie.0 for DT");
-+ return;
-+ }
- }
- base += vms->memmap[VIRT_PLATFORM_BUS].base;
- irq += vms->irqmap[VIRT_PLATFORM_BUS];
-@@ -3092,8 +3097,7 @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
- object_property_set_link(OBJECT(dev), "secure-memory",
- OBJECT(vms->secure_sysmem), NULL);
- }
-- if (object_property_find(OBJECT(dev), "accel") &&
-- object_property_get_bool(OBJECT(dev), "accel", &error_abort)) {
-+ if (object_property_get_bool(OBJECT(dev), "accel", &error_abort)) {
- hwaddr db_start = 0;
-
- if (!kvm_enabled() || !kvm_irqchip_in_kernel()) {
-@@ -3148,7 +3152,7 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,
- return;
- }
-
-- create_smmuv3_dev_dtb(vms, dev, bus);
-+ create_smmuv3_dev_dtb(vms, dev, bus, errp);
- }
- }
-
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Add-cmdqv-property-for-SMMUv3-device.patch b/kvm-hw-arm-smmuv3-Add-cmdqv-property-for-SMMUv3-device.patch
deleted file mode 100644
index b449b91..0000000
--- a/kvm-hw-arm-smmuv3-Add-cmdqv-property-for-SMMUv3-device.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From 00aaa67fff49aa2dabd33cc51975e2d09287af60 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:52 +0100
-Subject: [PATCH 110/111] hw/arm/smmuv3: Add cmdqv property for SMMUv3 device
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [110/111] afd980dfcdcf4d602312a4c65fedf19f08fc6c3b (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Conflicts: contextual conflict in qemu-options.hx as we don't
-have amd-iommu device documentation downstream
-
-Introduce a "cmdqv" property to enable Tegra241 CMDQV support.
-This is only enabled for accelerated SMMUv3 devices.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-32-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit fced8da695f9f40842aa87d0dfde365c8ef65a36)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3.c | 8 ++++++++
- qemu-options.hx | 8 ++++++++
- 2 files changed, 16 insertions(+)
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 9e252bca66..931c2fe710 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1994,6 +1994,10 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- "bits if accel=on");
- return false;
- }
-+ if (s->cmdqv == ON_OFF_AUTO_ON) {
-+ error_setg(errp, "cmdqv can only be enabled if accel=on");
-+ return false;
-+ }
- return true;
- }
-
-@@ -2144,6 +2148,7 @@ static const Property smmuv3_properties[] = {
- DEFINE_PROP_OAS_MODE("oas", SMMUv3State, oas, OAS_MODE_AUTO),
- DEFINE_PROP_SSIDSIZE_MODE("ssidsize", SMMUv3State, ssidsize,
- SSID_SIZE_MODE_AUTO),
-+ DEFINE_PROP_ON_OFF_AUTO("cmdqv", SMMUv3State, cmdqv, ON_OFF_AUTO_AUTO),
- };
-
- static void smmuv3_instance_init(Object *obj)
-@@ -2194,6 +2199,9 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- "than 0 is required to enable PASID support."
- "Please ensure the value does not exceed the maximum "
- "SubstreamID size supported by the host platform.");
-+ object_class_property_set_description(klass, "cmdqv",
-+ "Enable/disable CMDQV support (for accel=on). "
-+ "Valid values are on, off, and auto. Defaults to auto.");
- }
-
- static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
-diff --git a/qemu-options.hx b/qemu-options.hx
-index 3fe2171e70..c0e863bb00 100644
---- a/qemu-options.hx
-+++ b/qemu-options.hx
-@@ -1281,6 +1281,14 @@ SRST
-
- - With accel=off, auto is resolved to 0.
-
-+ ``cmdqv=on|off|auto`` (default: auto)
-+ Enable hardware Command Queue Virtualization (CMDQV) for the
-+ SMMUv3 command queue. Currently only the NVIDIA Tegra241 CMDQV
-+ implementation is supported.
-+
-+ - With accel=on, auto means the value is automatically derived from the host SMMU.
-+ - With accel=off, auto is resolved to 'off'.
-+
- ERST
-
- DEF("name", HAS_ARG, QEMU_OPTION_name,
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Add-per-device-identifier-property.patch b/kvm-hw-arm-smmuv3-Add-per-device-identifier-property.patch
deleted file mode 100644
index d0b2bf5..0000000
--- a/kvm-hw-arm-smmuv3-Add-per-device-identifier-property.patch
+++ /dev/null
@@ -1,136 +0,0 @@
-From 370cea17a431430e0a69d659b75c9ef9295191e4 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:47 +0100
-Subject: [PATCH 105/111] hw/arm/smmuv3: Add per-device identifier property
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [105/111] 96bf9c1f23c27769323425ffd01bf0baf4809454 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Add an "identifier" property to the SMMUv3 device and use it when
-building the ACPI IORT SMMUv3 node Identifier field.
-
-This avoids relying on device enumeration order and provides a stable
-per-device identifier. A subsequent patch will use the same identifier
-when generating the DSDT description for Tegra241 CMDQV, ensuring that
-the IORT and DSDT entries refer to the same SMMUv3 instance.
-
-The identifier is assigned at pre-plug time, accounting for the ITS Group
-node that build_iort() places before SMMUv3 nodes in the IORT table, so
-that identifiers are globally unique across all IORT nodes.
-
-No functional change: IORT blob content for bios-tables qtest is identical
-to before.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-27-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit eb7a06e842409f41cbd85b01086d8e6a2b9c4774)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3.c | 2 ++
- hw/arm/virt-acpi-build.c | 5 ++++-
- hw/arm/virt.c | 12 ++++++++++++
- include/hw/arm/smmuv3.h | 1 +
- 4 files changed, 19 insertions(+), 1 deletion(-)
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 1e98ee0e76..9e252bca66 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -2126,6 +2126,8 @@ static const Property smmuv3_properties[] = {
- * Defaults to stage 1
- */
- DEFINE_PROP_STRING("stage", SMMUv3State, stage),
-+ /* Identifier used for ACPI IORT SMMUv3 (and DSDT for CMDQV) generation */
-+ DEFINE_PROP_UINT8("identifier", SMMUv3State, identifier, 0),
- DEFINE_PROP_BOOL("accel", SMMUv3State, accel, false),
- /* GPA of MSI doorbell, for SMMUv3 accel use. */
- DEFINE_PROP_UINT64("msi-gpa", SMMUv3State, msi_gpa, 0),
-diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
-index 597d51199c..20dfe9e4d8 100644
---- a/hw/arm/virt-acpi-build.c
-+++ b/hw/arm/virt-acpi-build.c
-@@ -348,6 +348,7 @@ static int iort_idmap_compare(gconstpointer a, gconstpointer b)
- typedef struct AcpiIortSMMUv3Dev {
- int irq;
- hwaddr base;
-+ uint8_t id;
- GArray *rc_smmu_idmaps;
- /* Offset of the SMMUv3 IORT Node relative to the start of the IORT */
- size_t offset;
-@@ -410,6 +411,7 @@ static int populate_smmuv3_dev(VirtMachineState *vms, GArray *sdev_blob)
- &error_abort));
- sdev.accel = object_property_get_bool(obj, "accel", &error_abort);
- sdev.ats = smmuv3_ats_enabled(ARM_SMMUV3(obj));
-+ sdev.id = object_property_get_uint(obj, "identifier", &error_abort);
- pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
- sbdev = SYS_BUS_DEVICE(obj);
- sdev.base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
-@@ -636,7 +638,8 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- (ID_MAPPING_ENTRY_SIZE * smmu_mapping_count);
- build_append_int_noprefix(table_data, node_size, 2); /* Length */
- build_append_int_noprefix(table_data, 4, 1); /* Revision */
-- build_append_int_noprefix(table_data, id++, 4); /* Identifier */
-+ build_append_int_noprefix(table_data, sdev->id, 4); /* Identifier */
-+ id++; /* advance shared counter for RC/RMR node uniqueness */
- /* Number of ID mappings */
- build_append_int_noprefix(table_data, smmu_mapping_count, 4);
- /* Reference to ID Array */
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index ca150d455c..dc993cbaa1 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -264,6 +264,9 @@ static MemMapEntry extended_memmap[] = {
- /* Any CXL Fixed memory windows come here */
- };
-
-+/* Counts SMMUv3 devices plugged; used to assign stable IORT identifiers */
-+static uint8_t smmuv3_dev_id;
-+
- static const int a15irqmap[] = {
- [VIRT_UART0] = 1,
- [VIRT_RTC] = 2,
-@@ -3118,6 +3121,15 @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
- OBJECT(vms->sysmem), NULL);
- object_property_set_link(OBJECT(dev), "secure-memory",
- OBJECT(vms->secure_sysmem), NULL);
-+ /*
-+ * In build_iort(), the ITS node(id=0) precedes SMMUv3 nodes
-+ * when present. Account for it so this SMMUv3's identifier
-+ * is globally unique across all IORT nodes.
-+ */
-+ uint8_t its_offset = (vms->msi_controller == VIRT_MSI_CTRL_ITS)
-+ ? 1 : 0;
-+ object_property_set_uint(OBJECT(dev), "identifier",
-+ its_offset + smmuv3_dev_id++, NULL);
- }
- if (object_property_get_bool(OBJECT(dev), "accel", &error_abort)) {
- hwaddr db_start = 0;
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index 34d0f65eaa..d39fe8850b 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -65,6 +65,7 @@ struct SMMUv3State {
- qemu_irq irq[4];
- QemuMutex mutex;
- char *stage;
-+ uint8_t identifier;
-
- /* SMMU has HW accelerator support for nested S1 + s2 */
- bool accel;
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Avoid-including-CONFIG_DEVICES-in-hw-h.patch b/kvm-hw-arm-smmuv3-Avoid-including-CONFIG_DEVICES-in-hw-h.patch
deleted file mode 100644
index ad2d9b6..0000000
--- a/kvm-hw-arm-smmuv3-Avoid-including-CONFIG_DEVICES-in-hw-h.patch
+++ /dev/null
@@ -1,178 +0,0 @@
-From b1520bc26a36eca3f4ea73606dcec1081918e323 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
-Date: Tue, 10 Mar 2026 12:06:19 +0100
-Subject: [PATCH 085/111] hw/arm/smmuv3: Avoid including CONFIG_DEVICES in hw/
- header
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [85/111] 9e4fac5674fbf767b565deab18de671a3cdecdbd (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-By turning the inline functions into stubs we can avoid the
-use of target-specific CONFIG_DEVICES include in a hw/ header,
-allowing to build the source files including it as common objects.
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Thomas Huth <thuth@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-Id: <20260410200031.18572-3-philmd@linaro.org>
-(cherry picked from commit 12ce4d9630ae09edec706f6254417e3ec96e08e5)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/meson.build | 5 ++--
- hw/arm/smmuv3-accel-stubs.c | 52 +++++++++++++++++++++++++++++++++++++
- hw/arm/smmuv3-accel.h | 42 ------------------------------
- 3 files changed, 55 insertions(+), 44 deletions(-)
- create mode 100644 hw/arm/smmuv3-accel-stubs.c
-
-diff --git a/hw/arm/meson.build b/hw/arm/meson.build
-index bcb27c0bf6..b3f2e4d5dd 100644
---- a/hw/arm/meson.build
-+++ b/hw/arm/meson.build
-@@ -61,8 +61,9 @@ arm_common_ss.add(when: 'CONFIG_ARMSSE', if_true: files('armsse.c'))
- arm_common_ss.add(when: 'CONFIG_FSL_IMX7', if_true: files('fsl-imx7.c', 'mcimx7d-sabre.c'))
- arm_common_ss.add(when: 'CONFIG_FSL_IMX8MP', if_true: files('fsl-imx8mp.c'))
- arm_common_ss.add(when: 'CONFIG_FSL_IMX8MP_EVK', if_true: files('imx8mp-evk.c'))
--arm_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmuv3.c'))
--arm_ss.add(when: 'CONFIG_ARM_SMMUV3_ACCEL', if_true: files('smmuv3-accel.c'))
-+arm_common_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmuv3.c'))
-+arm_common_ss.add(when: 'CONFIG_ARM_SMMUV3_ACCEL', if_true: files('smmuv3-accel.c'))
-+stub_ss.add(files('smmuv3-accel-stubs.c'))
- arm_common_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c', 'mcimx6ul-evk.c'))
- arm_common_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c'))
- arm_ss.add(when: 'CONFIG_XEN', if_true: files(
-diff --git a/hw/arm/smmuv3-accel-stubs.c b/hw/arm/smmuv3-accel-stubs.c
-new file mode 100644
-index 0000000000..70cef66966
---- /dev/null
-+++ b/hw/arm/smmuv3-accel-stubs.c
-@@ -0,0 +1,52 @@
-+/*
-+ * Stubs for accelerated SMMU instance backed by an iommufd vIOMMU object.
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#include "qemu/osdep.h"
-+#include "qapi/error.h"
-+#include "hw/arm/smmuv3.h"
-+#include "hw/arm/smmuv3-accel.h"
-+
-+bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
-+{
-+ error_setg(errp, "accel=on support not compiled in");
-+ return false;
-+}
-+
-+bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
-+ Error **errp)
-+{
-+ return true;
-+}
-+
-+bool smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
-+ Error **errp)
-+{
-+ return true;
-+}
-+
-+bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp)
-+{
-+ return true;
-+}
-+
-+bool smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
-+ Error **errp)
-+{
-+ return true;
-+}
-+
-+void smmuv3_accel_idr_override(SMMUv3State *s)
-+{
-+}
-+
-+bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp)
-+{
-+ return true;
-+}
-+
-+void smmuv3_accel_reset(SMMUv3State *s)
-+{
-+}
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index 849015f98e..b45f25ad03 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -15,7 +15,6 @@
- #ifdef CONFIG_LINUX
- #include <linux/iommufd.h>
- #endif
--#include CONFIG_DEVICES
-
- /*
- * CMDQ-Virtualization (CMDQV) hardware support, extends the SMMUv3 to
-@@ -77,7 +76,6 @@ typedef struct SMMUv3AccelDevice {
- SMMUv3AccelState *s_accel;
- } SMMUv3AccelDevice;
-
--#ifdef CONFIG_ARM_SMMUV3_ACCEL
- bool smmuv3_accel_init(SMMUv3State *s, Error **errp);
- bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
- Error **errp);
-@@ -89,45 +87,5 @@ bool smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
- void smmuv3_accel_idr_override(SMMUv3State *s);
- bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp);
- void smmuv3_accel_reset(SMMUv3State *s);
--#else
--#include "qapi/error.h"
--static inline bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
--{
-- error_setg(errp, "accel=on support not compiled in");
-- return false;
--}
--static inline bool
--smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
-- Error **errp)
--{
-- return true;
--}
--static inline bool
--smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
-- Error **errp)
--{
-- return true;
--}
--static inline bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp)
--{
-- return true;
--}
--static inline bool
--smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
-- Error **errp)
--{
-- return true;
--}
--static inline void smmuv3_accel_idr_override(SMMUv3State *s)
--{
--}
--static inline bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp)
--{
-- return true;
--}
--static inline void smmuv3_accel_reset(SMMUv3State *s)
--{
--}
--#endif
-
- #endif /* HW_ARM_SMMUV3_ACCEL_H */
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Block-migration-when-accel-is-enabled.patch b/kvm-hw-arm-smmuv3-Block-migration-when-accel-is-enabled.patch
deleted file mode 100644
index b9de00f..0000000
--- a/kvm-hw-arm-smmuv3-Block-migration-when-accel-is-enabled.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From 81b2907455241359747060e7ccd97f7cdfeaefe0 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 035/111] hw/arm/smmuv3: Block migration when accel is enabled
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [35/111] 8765c2972ab5482b548e8799ed48e3a15505f74c (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Live migration is not supported when the SMMUv3 accelerator mode is
-enabled. Add a migration blocker to prevent migration in this
-configuration.
-
-Conflicts: use hw/irq.h and hw/sysbus.h instead of hw/core/*
-because we don't have
-32222dc3bbd1 include: move hw/irq.h to hw/core/ nor
-c755f3b95964 include: move hw/sysbus.h to hw/core
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-28-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit be0cf3c8f121f5c0ec398429666d2ef0e88aa37a)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3.c | 6 ++++++
- include/hw/arm/smmuv3.h | 1 +
- 2 files changed, 7 insertions(+)
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index dba5abc8d3..6faa660bab 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -20,6 +20,7 @@
- #include "qemu/bitops.h"
- #include "hw/irq.h"
- #include "hw/sysbus.h"
-+#include "migration/blocker.h"
- #include "migration/vmstate.h"
- #include "hw/qdev-properties.h"
- #include "hw/qdev-core.h"
-@@ -1925,6 +1926,11 @@ static void smmu_realize(DeviceState *d, Error **errp)
-
- if (s->accel) {
- smmuv3_accel_init(s);
-+ error_setg(&s->migration_blocker, "Migration not supported with SMMUv3 "
-+ "accelerator mode enabled");
-+ if (migrate_add_blocker(&s->migration_blocker, errp) < 0) {
-+ return;
-+ }
- }
-
- c->parent_realize(d, &local_err);
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index 5616a8a2be..9c39acd5ca 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -68,6 +68,7 @@ struct SMMUv3State {
- bool accel;
- struct SMMUv3AccelState *s_accel;
- uint64_t msi_gpa;
-+ Error *migration_blocker;
- };
-
- typedef enum {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Correct-SMMUEN-field-name-in-CR0.patch b/kvm-hw-arm-smmuv3-Correct-SMMUEN-field-name-in-CR0.patch
deleted file mode 100644
index e66e2de..0000000
--- a/kvm-hw-arm-smmuv3-Correct-SMMUEN-field-name-in-CR0.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From f34e634b62b520727c41a992cc22891b6d3e7ac2 Mon Sep 17 00:00:00 2001
-From: Tao Tang <tangtao1634@phytium.com.cn>
-Date: Wed, 4 Mar 2026 22:23:43 +0800
-Subject: [PATCH 055/111] hw/arm/smmuv3: Correct SMMUEN field name in CR0
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [55/111] 33926f3b19af938bd90f11d1c0aa920655940111 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-160190
-
-The FIELD macro for the SMMU enable bit in the CR0 register was
-incorrectly named SMMU_ENABLE.
-
-The ARM SMMUv3 Architecture Specification (both older IHI 0070.E.a and
-newer IHI 0070.G.b) consistently refers to the SMMU enable bit as SMMUEN.
-
-This change makes our implementation consistent with the manual.
-
-Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
-Reviewed-by: Mostafa Saleh <smostafa@google.com>
-Message-id: 20260304142344.3341444-3-tangtao1634@phytium.com.cn
-Fixes: 10a83cb9887 ("hw/arm/smmuv3: Skeleton")
-Link: https://lists.nongnu.org/archive/html/qemu-arm/2025-09/msg01270.html
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit af15801a61d66510434131ae50c2ad2135fa3de1)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-internal.h | 2 +-
- include/hw/arm/smmuv3-common.h | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
-index 466bfd390e..0bfb02a054 100644
---- a/hw/arm/smmuv3-internal.h
-+++ b/hw/arm/smmuv3-internal.h
-@@ -41,7 +41,7 @@ typedef enum SMMUTranslationClass {
-
- static inline int smmu_enabled(SMMUv3State *s)
- {
-- return FIELD_EX32(s->cr[0], CR0, SMMU_ENABLE);
-+ return FIELD_EX32(s->cr[0], CR0, SMMUEN);
- }
-
- /* Command Queue Entry */
-diff --git a/include/hw/arm/smmuv3-common.h b/include/hw/arm/smmuv3-common.h
-index 4b764ed125..f1d74d6832 100644
---- a/include/hw/arm/smmuv3-common.h
-+++ b/include/hw/arm/smmuv3-common.h
-@@ -351,7 +351,7 @@ REG32(IDR5, 0x14)
- REG32(IIDR, 0x18)
- REG32(AIDR, 0x1c)
- REG32(CR0, 0x20)
-- FIELD(CR0, SMMU_ENABLE, 0, 1)
-+ FIELD(CR0, SMMUEN, 0, 1)
- FIELD(CR0, EVENTQEN, 2, 1)
- FIELD(CR0, CMDQEN, 3, 1)
-
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Extract-common-definitions-to-smmuv3-c.patch b/kvm-hw-arm-smmuv3-Extract-common-definitions-to-smmuv3-c.patch
deleted file mode 100644
index 13638f5..0000000
--- a/kvm-hw-arm-smmuv3-Extract-common-definitions-to-smmuv3-c.patch
+++ /dev/null
@@ -1,611 +0,0 @@
-From 89c1b05e005bb0bdbcd9439c08738a13d8e94564 Mon Sep 17 00:00:00 2001
-From: Tao Tang <tangtao1634@phytium.com.cn>
-Date: Sun, 21 Dec 2025 11:25:01 +0800
-Subject: [PATCH 005/111] hw/arm/smmuv3: Extract common definitions to
- smmuv3-common.h
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [5/111] b556c954826de35f2ae70d8b5e7ef936eaa7a2f7 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Move register definitions, command enums, and Stream Table Entry (STE) /
-Context Descriptor (CD) structure definitions from the internal header
-hw/arm/smmuv3-internal.h to a new common header
-include/hw/arm/smmuv3-common.h.
-
-This allows other components, such as generic SMMUv3 tests or test devices,
-to utilize these definitions without including the specific SMMUv3 device
-internal state.
-
-Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
-Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Message-ID: <20260119161112.3841386-2-tangtao1634@phytium.com.cn>
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-(cherry picked from commit 81ee3206f05797aeeae4baa0cecae44e5fad5d64)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-internal.h | 255 +------------------------------
- include/hw/arm/smmuv3-common.h | 268 +++++++++++++++++++++++++++++++++
- 2 files changed, 269 insertions(+), 254 deletions(-)
- create mode 100644 include/hw/arm/smmuv3-common.h
-
-diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
-index b6b7399347..8679ab6d09 100644
---- a/hw/arm/smmuv3-internal.h
-+++ b/hw/arm/smmuv3-internal.h
-@@ -23,6 +23,7 @@
-
- #include "hw/registerfields.h"
- #include "hw/arm/smmu-common.h"
-+#include "hw/arm/smmuv3-common.h"
-
- typedef enum SMMUTranslationStatus {
- SMMU_TRANS_DISABLE,
-@@ -38,147 +39,6 @@ typedef enum SMMUTranslationClass {
- SMMU_CLASS_IN,
- } SMMUTranslationClass;
-
--/* MMIO Registers */
--
--REG32(IDR0, 0x0)
-- FIELD(IDR0, S2P, 0 , 1)
-- FIELD(IDR0, S1P, 1 , 1)
-- FIELD(IDR0, TTF, 2 , 2)
-- FIELD(IDR0, COHACC, 4 , 1)
-- FIELD(IDR0, BTM, 5 , 1)
-- FIELD(IDR0, HTTU, 6 , 2)
-- FIELD(IDR0, DORMHINT, 8 , 1)
-- FIELD(IDR0, HYP, 9 , 1)
-- FIELD(IDR0, ATS, 10, 1)
-- FIELD(IDR0, NS1ATS, 11, 1)
-- FIELD(IDR0, ASID16, 12, 1)
-- FIELD(IDR0, MSI, 13, 1)
-- FIELD(IDR0, SEV, 14, 1)
-- FIELD(IDR0, ATOS, 15, 1)
-- FIELD(IDR0, PRI, 16, 1)
-- FIELD(IDR0, VMW, 17, 1)
-- FIELD(IDR0, VMID16, 18, 1)
-- FIELD(IDR0, CD2L, 19, 1)
-- FIELD(IDR0, VATOS, 20, 1)
-- FIELD(IDR0, TTENDIAN, 21, 2)
-- FIELD(IDR0, ATSRECERR, 23, 1)
-- FIELD(IDR0, STALL_MODEL, 24, 2)
-- FIELD(IDR0, TERM_MODEL, 26, 1)
-- FIELD(IDR0, STLEVEL, 27, 2)
-- FIELD(IDR0, RME_IMPL, 30, 1)
--
--REG32(IDR1, 0x4)
-- FIELD(IDR1, SIDSIZE, 0 , 6)
-- FIELD(IDR1, SSIDSIZE, 6 , 5)
-- FIELD(IDR1, PRIQS, 11, 5)
-- FIELD(IDR1, EVENTQS, 16, 5)
-- FIELD(IDR1, CMDQS, 21, 5)
-- FIELD(IDR1, ATTR_PERMS_OVR, 26, 1)
-- FIELD(IDR1, ATTR_TYPES_OVR, 27, 1)
-- FIELD(IDR1, REL, 28, 1)
-- FIELD(IDR1, QUEUES_PRESET, 29, 1)
-- FIELD(IDR1, TABLES_PRESET, 30, 1)
-- FIELD(IDR1, ECMDQ, 31, 1)
--
--#define SMMU_IDR1_SIDSIZE 16
--#define SMMU_CMDQS 19
--#define SMMU_EVENTQS 19
--
--REG32(IDR2, 0x8)
-- FIELD(IDR2, BA_VATOS, 0, 10)
--
--REG32(IDR3, 0xc)
-- FIELD(IDR3, HAD, 2, 1);
-- FIELD(IDR3, PBHA, 3, 1);
-- FIELD(IDR3, XNX, 4, 1);
-- FIELD(IDR3, PPS, 5, 1);
-- FIELD(IDR3, MPAM, 7, 1);
-- FIELD(IDR3, FWB, 8, 1);
-- FIELD(IDR3, STT, 9, 1);
-- FIELD(IDR3, RIL, 10, 1);
-- FIELD(IDR3, BBML, 11, 2);
-- FIELD(IDR3, E0PD, 13, 1);
-- FIELD(IDR3, PTWNNC, 14, 1);
-- FIELD(IDR3, DPT, 15, 1);
--
--REG32(IDR4, 0x10)
--
--REG32(IDR5, 0x14)
-- FIELD(IDR5, OAS, 0, 3);
-- FIELD(IDR5, GRAN4K, 4, 1);
-- FIELD(IDR5, GRAN16K, 5, 1);
-- FIELD(IDR5, GRAN64K, 6, 1);
-- FIELD(IDR5, VAX, 10, 2);
-- FIELD(IDR5, STALL_MAX, 16, 16);
--
--#define SMMU_IDR5_OAS 4
--
--REG32(IIDR, 0x18)
--REG32(AIDR, 0x1c)
--REG32(CR0, 0x20)
-- FIELD(CR0, SMMU_ENABLE, 0, 1)
-- FIELD(CR0, EVENTQEN, 2, 1)
-- FIELD(CR0, CMDQEN, 3, 1)
--
--#define SMMU_CR0_RESERVED 0xFFFFFC20
--
--REG32(CR0ACK, 0x24)
--REG32(CR1, 0x28)
--REG32(CR2, 0x2c)
--REG32(STATUSR, 0x40)
--REG32(GBPA, 0x44)
-- FIELD(GBPA, ABORT, 20, 1)
-- FIELD(GBPA, UPDATE, 31, 1)
--
--/* Use incoming. */
--#define SMMU_GBPA_RESET_VAL 0x1000
--
--REG32(IRQ_CTRL, 0x50)
-- FIELD(IRQ_CTRL, GERROR_IRQEN, 0, 1)
-- FIELD(IRQ_CTRL, PRI_IRQEN, 1, 1)
-- FIELD(IRQ_CTRL, EVENTQ_IRQEN, 2, 1)
--
--REG32(IRQ_CTRL_ACK, 0x54)
--REG32(GERROR, 0x60)
-- FIELD(GERROR, CMDQ_ERR, 0, 1)
-- FIELD(GERROR, EVENTQ_ABT_ERR, 2, 1)
-- FIELD(GERROR, PRIQ_ABT_ERR, 3, 1)
-- FIELD(GERROR, MSI_CMDQ_ABT_ERR, 4, 1)
-- FIELD(GERROR, MSI_EVENTQ_ABT_ERR, 5, 1)
-- FIELD(GERROR, MSI_PRIQ_ABT_ERR, 6, 1)
-- FIELD(GERROR, MSI_GERROR_ABT_ERR, 7, 1)
-- FIELD(GERROR, MSI_SFM_ERR, 8, 1)
--
--REG32(GERRORN, 0x64)
--
--#define A_GERROR_IRQ_CFG0 0x68 /* 64b */
--REG32(GERROR_IRQ_CFG1, 0x70)
--REG32(GERROR_IRQ_CFG2, 0x74)
--
--#define A_STRTAB_BASE 0x80 /* 64b */
--
--#define SMMU_BASE_ADDR_MASK 0xfffffffffffc0
--
--REG32(STRTAB_BASE_CFG, 0x88)
-- FIELD(STRTAB_BASE_CFG, FMT, 16, 2)
-- FIELD(STRTAB_BASE_CFG, SPLIT, 6 , 5)
-- FIELD(STRTAB_BASE_CFG, LOG2SIZE, 0 , 6)
--
--#define A_CMDQ_BASE 0x90 /* 64b */
--REG32(CMDQ_PROD, 0x98)
--REG32(CMDQ_CONS, 0x9c)
-- FIELD(CMDQ_CONS, ERR, 24, 7)
--
--#define A_EVENTQ_BASE 0xa0 /* 64b */
--REG32(EVENTQ_PROD, 0xa8)
--REG32(EVENTQ_CONS, 0xac)
--
--#define A_EVENTQ_IRQ_CFG0 0xb0 /* 64b */
--REG32(EVENTQ_IRQ_CFG1, 0xb8)
--REG32(EVENTQ_IRQ_CFG2, 0xbc)
--
--#define A_IDREGS 0xfd0
--
- static inline int smmu_enabled(SMMUv3State *s)
- {
- return FIELD_EX32(s->cr[0], CR0, SMMU_ENABLE);
-@@ -272,37 +132,6 @@ static inline void smmu_write_cmdq_err(SMMUv3State *s, uint32_t err_type)
- s->cmdq.cons = FIELD_DP32(s->cmdq.cons, CMDQ_CONS, ERR, err_type);
- }
-
--/* Commands */
--
--typedef enum SMMUCommandType {
-- SMMU_CMD_NONE = 0x00,
-- SMMU_CMD_PREFETCH_CONFIG ,
-- SMMU_CMD_PREFETCH_ADDR,
-- SMMU_CMD_CFGI_STE,
-- SMMU_CMD_CFGI_STE_RANGE,
-- SMMU_CMD_CFGI_CD,
-- SMMU_CMD_CFGI_CD_ALL,
-- SMMU_CMD_CFGI_ALL,
-- SMMU_CMD_TLBI_NH_ALL = 0x10,
-- SMMU_CMD_TLBI_NH_ASID,
-- SMMU_CMD_TLBI_NH_VA,
-- SMMU_CMD_TLBI_NH_VAA,
-- SMMU_CMD_TLBI_EL3_ALL = 0x18,
-- SMMU_CMD_TLBI_EL3_VA = 0x1a,
-- SMMU_CMD_TLBI_EL2_ALL = 0x20,
-- SMMU_CMD_TLBI_EL2_ASID,
-- SMMU_CMD_TLBI_EL2_VA,
-- SMMU_CMD_TLBI_EL2_VAA,
-- SMMU_CMD_TLBI_S12_VMALL = 0x28,
-- SMMU_CMD_TLBI_S2_IPA = 0x2a,
-- SMMU_CMD_TLBI_NSNH_ALL = 0x30,
-- SMMU_CMD_ATC_INV = 0x40,
-- SMMU_CMD_PRI_RESP,
-- SMMU_CMD_RESUME = 0x44,
-- SMMU_CMD_STALL_TERM,
-- SMMU_CMD_SYNC,
--} SMMUCommandType;
--
- static const char *cmd_stringify[] = {
- [SMMU_CMD_PREFETCH_CONFIG] = "SMMU_CMD_PREFETCH_CONFIG",
- [SMMU_CMD_PREFETCH_ADDR] = "SMMU_CMD_PREFETCH_ADDR",
-@@ -525,64 +354,6 @@ typedef struct SMMUEventInfo {
-
- void smmuv3_record_event(SMMUv3State *s, SMMUEventInfo *event);
-
--/* Configuration Data */
--
--/* STE Level 1 Descriptor */
--typedef struct STEDesc {
-- uint32_t word[2];
--} STEDesc;
--
--/* CD Level 1 Descriptor */
--typedef struct CDDesc {
-- uint32_t word[2];
--} CDDesc;
--
--/* Stream Table Entry(STE) */
--typedef struct STE {
-- uint32_t word[16];
--} STE;
--
--/* Context Descriptor(CD) */
--typedef struct CD {
-- uint32_t word[16];
--} CD;
--
--/* STE fields */
--
--#define STE_VALID(x) extract32((x)->word[0], 0, 1)
--
--#define STE_CONFIG(x) extract32((x)->word[0], 1, 3)
--#define STE_CFG_S1_ENABLED(config) (config & 0x1)
--#define STE_CFG_S2_ENABLED(config) (config & 0x2)
--#define STE_CFG_ABORT(config) (!(config & 0x4))
--#define STE_CFG_BYPASS(config) (config == 0x4)
--
--#define STE_S1FMT(x) extract32((x)->word[0], 4 , 2)
--#define STE_S1CDMAX(x) extract32((x)->word[1], 27, 5)
--#define STE_S1STALLD(x) extract32((x)->word[2], 27, 1)
--#define STE_EATS(x) extract32((x)->word[2], 28, 2)
--#define STE_STRW(x) extract32((x)->word[2], 30, 2)
--#define STE_S2VMID(x) extract32((x)->word[4], 0 , 16)
--#define STE_S2T0SZ(x) extract32((x)->word[5], 0 , 6)
--#define STE_S2SL0(x) extract32((x)->word[5], 6 , 2)
--#define STE_S2TG(x) extract32((x)->word[5], 14, 2)
--#define STE_S2PS(x) extract32((x)->word[5], 16, 3)
--#define STE_S2AA64(x) extract32((x)->word[5], 19, 1)
--#define STE_S2ENDI(x) extract32((x)->word[5], 20, 1)
--#define STE_S2AFFD(x) extract32((x)->word[5], 21, 1)
--#define STE_S2HD(x) extract32((x)->word[5], 23, 1)
--#define STE_S2HA(x) extract32((x)->word[5], 24, 1)
--#define STE_S2S(x) extract32((x)->word[5], 25, 1)
--#define STE_S2R(x) extract32((x)->word[5], 26, 1)
--
--#define STE_CTXPTR(x) \
-- ((extract64((x)->word[1], 0, 16) << 32) | \
-- ((x)->word[0] & 0xffffffc0))
--
--#define STE_S2TTB(x) \
-- ((extract64((x)->word[7], 0, 16) << 32) | \
-- ((x)->word[6] & 0xfffffff0))
--
- static inline int oas2bits(int oas_field)
- {
- switch (oas_field) {
-@@ -603,30 +374,6 @@ static inline int oas2bits(int oas_field)
- g_assert_not_reached();
- }
-
--/* CD fields */
--
--#define CD_VALID(x) extract32((x)->word[0], 31, 1)
--#define CD_ASID(x) extract32((x)->word[1], 16, 16)
--#define CD_TTB(x, sel) \
-- ((extract64((x)->word[(sel) * 2 + 3], 0, 19) << 32) | \
-- ((x)->word[(sel) * 2 + 2] & ~0xfULL))
--
--#define CD_HAD(x, sel) extract32((x)->word[(sel) * 2 + 2], 1, 1)
--
--#define CD_TSZ(x, sel) extract32((x)->word[0], (16 * (sel)) + 0, 6)
--#define CD_TG(x, sel) extract32((x)->word[0], (16 * (sel)) + 6, 2)
--#define CD_EPD(x, sel) extract32((x)->word[0], (16 * (sel)) + 14, 1)
--#define CD_ENDI(x) extract32((x)->word[0], 15, 1)
--#define CD_IPS(x) extract32((x)->word[1], 0 , 3)
--#define CD_AFFD(x) extract32((x)->word[1], 3 , 1)
--#define CD_TBI(x) extract32((x)->word[1], 6 , 2)
--#define CD_HD(x) extract32((x)->word[1], 10 , 1)
--#define CD_HA(x) extract32((x)->word[1], 11 , 1)
--#define CD_S(x) extract32((x)->word[1], 12, 1)
--#define CD_R(x) extract32((x)->word[1], 13, 1)
--#define CD_A(x) extract32((x)->word[1], 14, 1)
--#define CD_AARCH64(x) extract32((x)->word[1], 9 , 1)
--
- /**
- * tg2granule - Decodes the CD translation granule size field according
- * to the ttbr in use
-diff --git a/include/hw/arm/smmuv3-common.h b/include/hw/arm/smmuv3-common.h
-new file mode 100644
-index 0000000000..9da817f41a
---- /dev/null
-+++ b/include/hw/arm/smmuv3-common.h
-@@ -0,0 +1,268 @@
-+/*
-+ * ARM SMMUv3 support - Common API
-+ *
-+ * Copyright (C) 2014-2016 Broadcom Corporation
-+ * Copyright (c) 2017 Red Hat, Inc.
-+ * Written by Prem Mallappa, Eric Auger
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#ifndef HW_ARM_SMMUV3_COMMON_H
-+#define HW_ARM_SMMUV3_COMMON_H
-+
-+/* Configuration Data */
-+
-+/* STE Level 1 Descriptor */
-+typedef struct STEDesc {
-+ uint32_t word[2];
-+} STEDesc;
-+
-+/* CD Level 1 Descriptor */
-+typedef struct CDDesc {
-+ uint32_t word[2];
-+} CDDesc;
-+
-+/* Stream Table Entry(STE) */
-+typedef struct STE {
-+ uint32_t word[16];
-+} STE;
-+
-+/* Context Descriptor(CD) */
-+typedef struct CD {
-+ uint32_t word[16];
-+} CD;
-+
-+/* STE fields */
-+
-+#define STE_VALID(x) extract32((x)->word[0], 0, 1)
-+
-+#define STE_CONFIG(x) extract32((x)->word[0], 1, 3)
-+#define STE_CFG_S1_ENABLED(config) (config & 0x1)
-+#define STE_CFG_S2_ENABLED(config) (config & 0x2)
-+#define STE_CFG_ABORT(config) (!(config & 0x4))
-+#define STE_CFG_BYPASS(config) (config == 0x4)
-+
-+#define STE_S1FMT(x) extract32((x)->word[0], 4 , 2)
-+#define STE_S1CDMAX(x) extract32((x)->word[1], 27, 5)
-+#define STE_S1STALLD(x) extract32((x)->word[2], 27, 1)
-+#define STE_EATS(x) extract32((x)->word[2], 28, 2)
-+#define STE_STRW(x) extract32((x)->word[2], 30, 2)
-+#define STE_S2VMID(x) extract32((x)->word[4], 0 , 16)
-+#define STE_S2T0SZ(x) extract32((x)->word[5], 0 , 6)
-+#define STE_S2SL0(x) extract32((x)->word[5], 6 , 2)
-+#define STE_S2TG(x) extract32((x)->word[5], 14, 2)
-+#define STE_S2PS(x) extract32((x)->word[5], 16, 3)
-+#define STE_S2AA64(x) extract32((x)->word[5], 19, 1)
-+#define STE_S2ENDI(x) extract32((x)->word[5], 20, 1)
-+#define STE_S2AFFD(x) extract32((x)->word[5], 21, 1)
-+#define STE_S2HD(x) extract32((x)->word[5], 23, 1)
-+#define STE_S2HA(x) extract32((x)->word[5], 24, 1)
-+#define STE_S2S(x) extract32((x)->word[5], 25, 1)
-+#define STE_S2R(x) extract32((x)->word[5], 26, 1)
-+
-+#define STE_CTXPTR(x) \
-+ ((extract64((x)->word[1], 0, 16) << 32) | \
-+ ((x)->word[0] & 0xffffffc0))
-+
-+#define STE_S2TTB(x) \
-+ ((extract64((x)->word[7], 0, 16) << 32) | \
-+ ((x)->word[6] & 0xfffffff0))
-+
-+/* CD fields */
-+
-+#define CD_VALID(x) extract32((x)->word[0], 31, 1)
-+#define CD_ASID(x) extract32((x)->word[1], 16, 16)
-+#define CD_TTB(x, sel) \
-+ ((extract64((x)->word[(sel) * 2 + 3], 0, 19) << 32) | \
-+ ((x)->word[(sel) * 2 + 2] & ~0xfULL))
-+
-+#define CD_HAD(x, sel) extract32((x)->word[(sel) * 2 + 2], 1, 1)
-+
-+#define CD_TSZ(x, sel) extract32((x)->word[0], (16 * (sel)) + 0, 6)
-+#define CD_TG(x, sel) extract32((x)->word[0], (16 * (sel)) + 6, 2)
-+#define CD_EPD(x, sel) extract32((x)->word[0], (16 * (sel)) + 14, 1)
-+#define CD_ENDI(x) extract32((x)->word[0], 15, 1)
-+#define CD_IPS(x) extract32((x)->word[1], 0 , 3)
-+#define CD_AFFD(x) extract32((x)->word[1], 3 , 1)
-+#define CD_TBI(x) extract32((x)->word[1], 6 , 2)
-+#define CD_HD(x) extract32((x)->word[1], 10 , 1)
-+#define CD_HA(x) extract32((x)->word[1], 11 , 1)
-+#define CD_S(x) extract32((x)->word[1], 12, 1)
-+#define CD_R(x) extract32((x)->word[1], 13, 1)
-+#define CD_A(x) extract32((x)->word[1], 14, 1)
-+#define CD_AARCH64(x) extract32((x)->word[1], 9 , 1)
-+
-+/* MMIO Registers */
-+
-+REG32(IDR0, 0x0)
-+ FIELD(IDR0, S2P, 0 , 1)
-+ FIELD(IDR0, S1P, 1 , 1)
-+ FIELD(IDR0, TTF, 2 , 2)
-+ FIELD(IDR0, COHACC, 4 , 1)
-+ FIELD(IDR0, BTM, 5 , 1)
-+ FIELD(IDR0, HTTU, 6 , 2)
-+ FIELD(IDR0, DORMHINT, 8 , 1)
-+ FIELD(IDR0, HYP, 9 , 1)
-+ FIELD(IDR0, ATS, 10, 1)
-+ FIELD(IDR0, NS1ATS, 11, 1)
-+ FIELD(IDR0, ASID16, 12, 1)
-+ FIELD(IDR0, MSI, 13, 1)
-+ FIELD(IDR0, SEV, 14, 1)
-+ FIELD(IDR0, ATOS, 15, 1)
-+ FIELD(IDR0, PRI, 16, 1)
-+ FIELD(IDR0, VMW, 17, 1)
-+ FIELD(IDR0, VMID16, 18, 1)
-+ FIELD(IDR0, CD2L, 19, 1)
-+ FIELD(IDR0, VATOS, 20, 1)
-+ FIELD(IDR0, TTENDIAN, 21, 2)
-+ FIELD(IDR0, ATSRECERR, 23, 1)
-+ FIELD(IDR0, STALL_MODEL, 24, 2)
-+ FIELD(IDR0, TERM_MODEL, 26, 1)
-+ FIELD(IDR0, STLEVEL, 27, 2)
-+ FIELD(IDR0, RME_IMPL, 30, 1)
-+
-+REG32(IDR1, 0x4)
-+ FIELD(IDR1, SIDSIZE, 0 , 6)
-+ FIELD(IDR1, SSIDSIZE, 6 , 5)
-+ FIELD(IDR1, PRIQS, 11, 5)
-+ FIELD(IDR1, EVENTQS, 16, 5)
-+ FIELD(IDR1, CMDQS, 21, 5)
-+ FIELD(IDR1, ATTR_PERMS_OVR, 26, 1)
-+ FIELD(IDR1, ATTR_TYPES_OVR, 27, 1)
-+ FIELD(IDR1, REL, 28, 1)
-+ FIELD(IDR1, QUEUES_PRESET, 29, 1)
-+ FIELD(IDR1, TABLES_PRESET, 30, 1)
-+ FIELD(IDR1, ECMDQ, 31, 1)
-+
-+#define SMMU_IDR1_SIDSIZE 16
-+#define SMMU_CMDQS 19
-+#define SMMU_EVENTQS 19
-+
-+REG32(IDR2, 0x8)
-+ FIELD(IDR2, BA_VATOS, 0, 10)
-+
-+REG32(IDR3, 0xc)
-+ FIELD(IDR3, HAD, 2, 1);
-+ FIELD(IDR3, PBHA, 3, 1);
-+ FIELD(IDR3, XNX, 4, 1);
-+ FIELD(IDR3, PPS, 5, 1);
-+ FIELD(IDR3, MPAM, 7, 1);
-+ FIELD(IDR3, FWB, 8, 1);
-+ FIELD(IDR3, STT, 9, 1);
-+ FIELD(IDR3, RIL, 10, 1);
-+ FIELD(IDR3, BBML, 11, 2);
-+ FIELD(IDR3, E0PD, 13, 1);
-+ FIELD(IDR3, PTWNNC, 14, 1);
-+ FIELD(IDR3, DPT, 15, 1);
-+
-+REG32(IDR4, 0x10)
-+
-+REG32(IDR5, 0x14)
-+ FIELD(IDR5, OAS, 0, 3);
-+ FIELD(IDR5, GRAN4K, 4, 1);
-+ FIELD(IDR5, GRAN16K, 5, 1);
-+ FIELD(IDR5, GRAN64K, 6, 1);
-+ FIELD(IDR5, VAX, 10, 2);
-+ FIELD(IDR5, STALL_MAX, 16, 16);
-+
-+#define SMMU_IDR5_OAS 4
-+
-+REG32(IIDR, 0x18)
-+REG32(AIDR, 0x1c)
-+REG32(CR0, 0x20)
-+ FIELD(CR0, SMMU_ENABLE, 0, 1)
-+ FIELD(CR0, EVENTQEN, 2, 1)
-+ FIELD(CR0, CMDQEN, 3, 1)
-+
-+#define SMMU_CR0_RESERVED 0xFFFFFC20
-+
-+REG32(CR0ACK, 0x24)
-+REG32(CR1, 0x28)
-+REG32(CR2, 0x2c)
-+REG32(STATUSR, 0x40)
-+REG32(GBPA, 0x44)
-+ FIELD(GBPA, ABORT, 20, 1)
-+ FIELD(GBPA, UPDATE, 31, 1)
-+
-+/* Use incoming. */
-+#define SMMU_GBPA_RESET_VAL 0x1000
-+
-+REG32(IRQ_CTRL, 0x50)
-+ FIELD(IRQ_CTRL, GERROR_IRQEN, 0, 1)
-+ FIELD(IRQ_CTRL, PRI_IRQEN, 1, 1)
-+ FIELD(IRQ_CTRL, EVENTQ_IRQEN, 2, 1)
-+
-+REG32(IRQ_CTRL_ACK, 0x54)
-+REG32(GERROR, 0x60)
-+ FIELD(GERROR, CMDQ_ERR, 0, 1)
-+ FIELD(GERROR, EVENTQ_ABT_ERR, 2, 1)
-+ FIELD(GERROR, PRIQ_ABT_ERR, 3, 1)
-+ FIELD(GERROR, MSI_CMDQ_ABT_ERR, 4, 1)
-+ FIELD(GERROR, MSI_EVENTQ_ABT_ERR, 5, 1)
-+ FIELD(GERROR, MSI_PRIQ_ABT_ERR, 6, 1)
-+ FIELD(GERROR, MSI_GERROR_ABT_ERR, 7, 1)
-+ FIELD(GERROR, MSI_SFM_ERR, 8, 1)
-+
-+REG32(GERRORN, 0x64)
-+
-+#define A_GERROR_IRQ_CFG0 0x68 /* 64b */
-+REG32(GERROR_IRQ_CFG1, 0x70)
-+REG32(GERROR_IRQ_CFG2, 0x74)
-+
-+#define A_STRTAB_BASE 0x80 /* 64b */
-+
-+#define SMMU_BASE_ADDR_MASK 0xfffffffffffc0
-+
-+REG32(STRTAB_BASE_CFG, 0x88)
-+ FIELD(STRTAB_BASE_CFG, FMT, 16, 2)
-+ FIELD(STRTAB_BASE_CFG, SPLIT, 6 , 5)
-+ FIELD(STRTAB_BASE_CFG, LOG2SIZE, 0 , 6)
-+
-+#define A_CMDQ_BASE 0x90 /* 64b */
-+REG32(CMDQ_PROD, 0x98)
-+REG32(CMDQ_CONS, 0x9c)
-+ FIELD(CMDQ_CONS, ERR, 24, 7)
-+
-+#define A_EVENTQ_BASE 0xa0 /* 64b */
-+REG32(EVENTQ_PROD, 0xa8)
-+REG32(EVENTQ_CONS, 0xac)
-+
-+#define A_EVENTQ_IRQ_CFG0 0xb0 /* 64b */
-+REG32(EVENTQ_IRQ_CFG1, 0xb8)
-+REG32(EVENTQ_IRQ_CFG2, 0xbc)
-+
-+#define A_IDREGS 0xfd0
-+
-+/* Commands */
-+
-+typedef enum SMMUCommandType {
-+ SMMU_CMD_NONE = 0x00,
-+ SMMU_CMD_PREFETCH_CONFIG ,
-+ SMMU_CMD_PREFETCH_ADDR,
-+ SMMU_CMD_CFGI_STE,
-+ SMMU_CMD_CFGI_STE_RANGE,
-+ SMMU_CMD_CFGI_CD,
-+ SMMU_CMD_CFGI_CD_ALL,
-+ SMMU_CMD_CFGI_ALL,
-+ SMMU_CMD_TLBI_NH_ALL = 0x10,
-+ SMMU_CMD_TLBI_NH_ASID,
-+ SMMU_CMD_TLBI_NH_VA,
-+ SMMU_CMD_TLBI_NH_VAA,
-+ SMMU_CMD_TLBI_EL3_ALL = 0x18,
-+ SMMU_CMD_TLBI_EL3_VA = 0x1a,
-+ SMMU_CMD_TLBI_EL2_ALL = 0x20,
-+ SMMU_CMD_TLBI_EL2_ASID,
-+ SMMU_CMD_TLBI_EL2_VA,
-+ SMMU_CMD_TLBI_EL2_VAA,
-+ SMMU_CMD_TLBI_S12_VMALL = 0x28,
-+ SMMU_CMD_TLBI_S2_IPA = 0x2a,
-+ SMMU_CMD_TLBI_NSNH_ALL = 0x30,
-+ SMMU_CMD_ATC_INV = 0x40,
-+ SMMU_CMD_PRI_RESP,
-+ SMMU_CMD_RESUME = 0x44,
-+ SMMU_CMD_STALL_TERM,
-+ SMMU_CMD_SYNC,
-+} SMMUCommandType;
-+
-+#endif /* HW_ARM_SMMUV3_COMMON_H */
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Fix-CFGI_CD-handling-when-stage-1-is-u.patch b/kvm-hw-arm-smmuv3-Fix-CFGI_CD-handling-when-stage-1-is-u.patch
deleted file mode 100644
index 4ba5d73..0000000
--- a/kvm-hw-arm-smmuv3-Fix-CFGI_CD-handling-when-stage-1-is-u.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From f5ccf1f80d37ce44ce10d8c12f4f8233deb03066 Mon Sep 17 00:00:00 2001
-From: Tao Tang <tangtao1634@phytium.com.cn>
-Date: Wed, 4 Mar 2026 22:23:44 +0800
-Subject: [PATCH 056/111] hw/arm/smmuv3: Fix CFGI_CD handling when stage-1 is
- unsupported
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [56/111] ba0c09d31ebe3ea81c3ea2d716c22268ffe9f122 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-160190
-
-Add a STAGE1_SUPPORTED check in the CMD_CFGI_CD and CMD_CFGI_CD_ALL path
-and return CERROR_ILL when stage-1 translation is not implemented,
-matching the architecture requirement (IHI 0070G.b, page 176).
-
-Fixes: 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
-Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
-Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
-Reviewed-by: Mostafa Saleh <smostafa@google.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260304142344.3341444-4-tangtao1634@phytium.com.cn
-Links: https://lore.kernel.org/qemu-devel/20260221101733.2995020-1-tangtao1634@phytium.com.cn/
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit fb147007d145866775b0cd5a794c9fa8efdb8c3d)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 8b51554620..d937f4add5 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1407,6 +1407,15 @@ static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp)
- break;
- }
-
-+ /*
-+ * This command raises CERROR_ILL when stage 1 is not implemented
-+ * according to (IHI 0070G.b) Page 176.
-+ */
-+ if (!STAGE1_SUPPORTED(s)) {
-+ cmd_error = SMMU_CERROR_ILL;
-+ break;
-+ }
-+
- trace_smmuv3_cmdq_cfgi_cd(sid);
- smmuv3_flush_config(sdev);
- if (!smmuv3_accel_issue_inv_cmd(s, &cmd, sdev, errp)) {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Have-smmuv3_accel_init-take-an-Error-p.patch b/kvm-hw-arm-smmuv3-Have-smmuv3_accel_init-take-an-Error-p.patch
deleted file mode 100644
index 8c46cd0..0000000
--- a/kvm-hw-arm-smmuv3-Have-smmuv3_accel_init-take-an-Error-p.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-From 3bc8b97e9b2ba8b67a2fca2313832d565d2303df Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
-Date: Thu, 9 Apr 2026 13:35:56 +0200
-Subject: [PATCH 065/111] hw/arm/smmuv3: Have smmuv3_accel_init() take an
- Error* parameter
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [65/111] ff4ac1030fe29a13b111252411a1e15038f7cca7 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-163596
-
-By giving smmuv3_accel_init() the ability to populate an error,
-we can fail early in smmu_realize() when CONFIG_ARM_SMMUV3_ACCEL
-is not available, simplifying smmu_validate_property().
-
-Suggested-by: Shameer Kolothum Thodi <skolothumtho@nvidia.com>
-Co-developed-by: Shameer Kolothum Thodi <skolothumtho@nvidia.com>
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-Id: <20260410200031.18572-2-philmd@linaro.org>
-(cherry picked from commit 4c7fefc2d043a66f799cf2c2e34ed680b1b44b5c)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 3 ++-
- hw/arm/smmuv3-accel.h | 7 +++++--
- hw/arm/smmuv3.c | 11 +++--------
- 3 files changed, 10 insertions(+), 11 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 65c2f44880..ae031f1ecc 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -917,11 +917,12 @@ static void smmuv3_accel_as_init(SMMUv3State *s)
- address_space_init(shared_as_sysmem, &root, "smmuv3-accel-as-sysmem");
- }
-
--void smmuv3_accel_init(SMMUv3State *s)
-+bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
- {
- SMMUState *bs = ARM_SMMU(s);
-
- s->s_accel = g_new0(SMMUv3AccelState, 1);
- bs->iommu_ops = &smmuv3_accel_ops;
- smmuv3_accel_as_init(s);
-+ return true;
- }
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index dba6c71de5..1ca2c80a93 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -42,7 +42,7 @@ typedef struct SMMUv3AccelDevice {
- } SMMUv3AccelDevice;
-
- #ifdef CONFIG_ARM_SMMUV3_ACCEL
--void smmuv3_accel_init(SMMUv3State *s);
-+bool smmuv3_accel_init(SMMUv3State *s, Error **errp);
- bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
- Error **errp);
- bool smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
-@@ -54,8 +54,11 @@ void smmuv3_accel_idr_override(SMMUv3State *s);
- bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp);
- void smmuv3_accel_reset(SMMUv3State *s);
- #else
--static inline void smmuv3_accel_init(SMMUv3State *s)
-+#include "qapi/error.h"
-+static inline bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
- {
-+ error_setg(errp, "accel=on support not compiled in");
-+ return false;
- }
- static inline bool
- smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 7951d85ec9..5fc55aa30a 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1965,13 +1965,6 @@ static void smmu_reset_exit(Object *obj, ResetType type)
-
- static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- {
--#ifndef CONFIG_ARM_SMMUV3_ACCEL
-- if (s->accel) {
-- error_setg(errp, "accel=on support not compiled in");
-- return false;
-- }
--#endif
--
- if (s->ats == ON_OFF_AUTO_AUTO) {
- error_setg(errp, "ats auto mode is not supported");
- return false;
-@@ -2033,7 +2026,9 @@ static void smmu_realize(DeviceState *d, Error **errp)
- }
-
- if (s->accel) {
-- smmuv3_accel_init(s);
-+ if (!smmuv3_accel_init(s, errp)) {
-+ return;
-+ }
- error_setg(&s->migration_blocker, "Migration not supported with SMMUv3 "
- "accelerator mode enabled");
- if (migrate_add_blocker(&s->migration_blocker, errp) < 0) {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Implement-get_viommu_cap-callback.patch b/kvm-hw-arm-smmuv3-Implement-get_viommu_cap-callback.patch
deleted file mode 100644
index cbbf741..0000000
--- a/kvm-hw-arm-smmuv3-Implement-get_viommu_cap-callback.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From c4cf09178e90bd22d7815c4fc16f1a6c5b99f46f Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 014/111] hw/arm/smmuv3: Implement get_viommu_cap() callback
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [14/111] 254bfc96a6ae9a8a909be4f4df74cc31b05ec205 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-For accelerated SMMUv3, we need nested parent domain creation. Add the
-callback support so that VFIO can create a nested parent.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-12-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit fc6dafb98cec0905fca61c15eb8287de75af2230)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 13 +++++++++++++
- 1 file changed, 13 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 2fcd301322..be09cf8b73 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -10,6 +10,7 @@
- #include "qemu/error-report.h"
-
- #include "hw/arm/smmuv3.h"
-+#include "hw/core/iommu.h"
- #include "hw/pci/pci_bridge.h"
- #include "hw/pci-host/gpex.h"
- #include "hw/vfio/pci.h"
-@@ -129,9 +130,21 @@ static AddressSpace *smmuv3_accel_find_add_as(PCIBus *bus, void *opaque,
- }
- }
-
-+static uint64_t smmuv3_accel_get_viommu_flags(void *opaque)
-+{
-+ /*
-+ * We return VIOMMU_FLAG_WANT_NESTING_PARENT to inform VFIO core to create a
-+ * nesting parent which is required for accelerated SMMUv3 support.
-+ * The real HW nested support should be reported from host SMMUv3 and if
-+ * it doesn't, the nesting parent allocation will fail anyway in VFIO core.
-+ */
-+ return VIOMMU_FLAG_WANT_NESTING_PARENT;
-+}
-+
- static const PCIIOMMUOps smmuv3_accel_ops = {
- .supports_address_space = smmuv3_accel_supports_as,
- .get_address_space = smmuv3_accel_find_add_as,
-+ .get_viommu_flags = smmuv3_accel_get_viommu_flags,
- };
-
- static void smmuv3_accel_as_init(SMMUv3State *s)
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Improve-accel-SMMUv3-usage-documentati.patch b/kvm-hw-arm-smmuv3-Improve-accel-SMMUv3-usage-documentati.patch
deleted file mode 100644
index 6da21cf..0000000
--- a/kvm-hw-arm-smmuv3-Improve-accel-SMMUv3-usage-documentati.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From c153b0934b729a36c377366769822a4ac87099ac Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Mon, 8 Jun 2026 10:48:53 -0700
-Subject: [PATCH 067/111] hw/arm/smmuv3: Improve accel SMMUv3 usage
- documentation
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [67/111] 1b682f65ef48f1736b6179c5e0520b4f17ba75e6 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-163596
-
-Add a statement to clarify that the host SMMUv3 must support HW-accelerated
-vfio-pci device assignment when setting accel=on.
-
-Reported-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260608174900.2227340-3-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 6328edbe5d72fd9f636b0e9785e72efe883d557e)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index c724c6b819..f76a527182 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -2165,7 +2165,9 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
-
- object_class_property_set_description(klass, "accel",
- "Enable SMMUv3 accelerator support. Allows host SMMUv3 to be "
-- "configured in nested mode for vfio-pci dev assignment");
-+ "configured in nested mode for vfio-pci dev assignment. Please "
-+ "ensure the host SMMUv3 supports nested translation before "
-+ "enabling.");
- object_class_property_set_description(klass, "ril",
- "Disable range invalidation support (for accel=on). ril=auto "
- "is not supported.");
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Initialize-ID-registers-early-during-r.patch b/kvm-hw-arm-smmuv3-Initialize-ID-registers-early-during-r.patch
deleted file mode 100644
index 3cafe62..0000000
--- a/kvm-hw-arm-smmuv3-Initialize-ID-registers-early-during-r.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-From 27993494929455703de48a0fdd98c78af882dada Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 028/111] hw/arm/smmuv3: Initialize ID registers early during
- realize()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [28/111] c31ff8cc5b1eda787830e66138080dbf11f6906e (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Factor out ID register init into smmuv3_init_id_regs() and call it from
-realize(). This ensures ID registers are initialized early for use in the
-accelerated SMMUv3 path and will be utilized in subsequent patch.
-
-Other registers remain initialized in smmuv3_reset().
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-21-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit f577dcdb5c1ca7d458d2cb365e884813c1505f9b)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3.c | 15 ++++++++++++---
- 1 file changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 513da966a4..dba5abc8d3 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -258,7 +258,12 @@ void smmuv3_record_event(SMMUv3State *s, SMMUEventInfo *info)
- info->recorded = true;
- }
-
--static void smmuv3_init_regs(SMMUv3State *s)
-+/*
-+ * Called during realize(), as the ID registers will be accessed early in the
-+ * SMMUv3 accel path for feature compatibility checks. The remaining registers
-+ * are initialized later in smmuv3_reset().
-+ */
-+static void smmuv3_init_id_regs(SMMUv3State *s)
- {
- /* Based on sys property, the stages supported in smmu will be advertised.*/
- if (s->stage && !strcmp("2", s->stage)) {
-@@ -298,7 +303,11 @@ static void smmuv3_init_regs(SMMUv3State *s)
- s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN4K, 1);
- s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN16K, 1);
- s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN64K, 1);
-+ s->aidr = 0x1;
-+}
-
-+static void smmuv3_reset(SMMUv3State *s)
-+{
- s->cmdq.base = deposit64(s->cmdq.base, 0, 5, SMMU_CMDQS);
- s->cmdq.prod = 0;
- s->cmdq.cons = 0;
-@@ -310,7 +319,6 @@ static void smmuv3_init_regs(SMMUv3State *s)
-
- s->features = 0;
- s->sid_split = 0;
-- s->aidr = 0x1;
- s->cr[0] = 0;
- s->cr0ack = 0;
- s->irq_ctrl = 0;
-@@ -1903,7 +1911,7 @@ static void smmu_reset_exit(Object *obj, ResetType type)
- c->parent_phases.exit(obj, type);
- }
-
-- smmuv3_init_regs(s);
-+ smmuv3_reset(s);
- smmuv3_accel_reset(s);
- }
-
-@@ -1935,6 +1943,7 @@ static void smmu_realize(DeviceState *d, Error **errp)
- sysbus_init_mmio(dev, &sys->iomem);
-
- smmu_init_irq(s, dev);
-+ smmuv3_init_id_regs(s);
- }
-
- static const VMStateDescription vmstate_smmuv3_queue = {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Introduce-a-helper-function-for-event-.patch b/kvm-hw-arm-smmuv3-Introduce-a-helper-function-for-event-.patch
deleted file mode 100644
index 3dc99c9..0000000
--- a/kvm-hw-arm-smmuv3-Introduce-a-helper-function-for-event-.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-From efca87fb97687307cc608b0beec14873d31014fa Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 6 Mar 2026 09:01:11 +0000
-Subject: [PATCH 053/111] hw/arm/smmuv3: Introduce a helper function for event
- propagation
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [53/111] 8ce584d593ad657ef9ea7fcd337ef53e13f1d2b2 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73796
-
-Factor out the code that propagates event records to the guest into a
-helper function. The accelerated SMMUv3 path can use this to propagate
-host events in a subsequent patch.
-
-Take the mutex inside the helper before accessing the Event Queue.
-Today event propagation occurs only in the core SMMUv3 path and is
-effectively serialized. A subsequent patch will also invoke this helper
-from the accelerated event read path, which may run concurrently.
-Therefore serialization is required here.
-
-No functional change intended.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260226084456.112142-5-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 43585524a7c628c0ebace5c33ba865c4e2c55177)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-internal.h | 4 ++++
- hw/arm/smmuv3.c | 20 ++++++++++++++------
- hw/arm/trace-events | 2 +-
- 3 files changed, 19 insertions(+), 7 deletions(-)
-
-diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
-index 998d30473d..466bfd390e 100644
---- a/hw/arm/smmuv3-internal.h
-+++ b/hw/arm/smmuv3-internal.h
-@@ -352,7 +352,11 @@ typedef struct SMMUEventInfo {
- (x)->word[6] = (uint32_t)(addr & 0xffffffff); \
- } while (0)
-
-+#define EVT_GET_TYPE(x) extract32((x)->word[0], 0, 8)
-+#define EVT_GET_SID(x) ((x)->word[1])
-+
- void smmuv3_record_event(SMMUv3State *s, SMMUEventInfo *event);
-+void smmuv3_propagate_event(SMMUv3State *s, Evt *evt);
- int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste, SMMUEventInfo *event);
-
- static inline int oas2bits(int oas_field)
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 1a218f749d..8b51554620 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -168,10 +168,22 @@ static MemTxResult smmuv3_write_eventq(SMMUv3State *s, Evt *evt)
- return MEMTX_OK;
- }
-
-+void smmuv3_propagate_event(SMMUv3State *s, Evt *evt)
-+{
-+ MemTxResult r;
-+
-+ trace_smmuv3_propagate_event(smmu_event_string(EVT_GET_TYPE(evt)),
-+ EVT_GET_SID(evt));
-+ QEMU_LOCK_GUARD(&s->mutex);
-+ r = smmuv3_write_eventq(s, evt);
-+ if (r != MEMTX_OK) {
-+ smmuv3_trigger_irq(s, SMMU_IRQ_GERROR, R_GERROR_EVENTQ_ABT_ERR_MASK);
-+ }
-+}
-+
- void smmuv3_record_event(SMMUv3State *s, SMMUEventInfo *info)
- {
- Evt evt = {};
-- MemTxResult r;
-
- if (!smmuv3_eventq_enabled(s)) {
- return;
-@@ -251,11 +263,7 @@ void smmuv3_record_event(SMMUv3State *s, SMMUEventInfo *info)
- g_assert_not_reached();
- }
-
-- trace_smmuv3_record_event(smmu_event_string(info->type), info->sid);
-- r = smmuv3_write_eventq(s, &evt);
-- if (r != MEMTX_OK) {
-- smmuv3_trigger_irq(s, SMMU_IRQ_GERROR, R_GERROR_EVENTQ_ABT_ERR_MASK);
-- }
-+ smmuv3_propagate_event(s, &evt);
- info->recorded = true;
- }
-
-diff --git a/hw/arm/trace-events b/hw/arm/trace-events
-index 8135c0c734..3457536fb0 100644
---- a/hw/arm/trace-events
-+++ b/hw/arm/trace-events
-@@ -40,7 +40,7 @@ smmuv3_cmdq_opcode(const char *opcode) "<--- %s"
- smmuv3_cmdq_consume_out(uint32_t prod, uint32_t cons, uint8_t prod_wrap, uint8_t cons_wrap) "prod:%d, cons:%d, prod_wrap:%d, cons_wrap:%d "
- smmuv3_cmdq_consume_error(const char *cmd_name, uint8_t cmd_error) "Error on %s command execution: %d"
- smmuv3_write_mmio(uint64_t addr, uint64_t val, unsigned size, uint32_t r) "addr: 0x%"PRIx64" val:0x%"PRIx64" size: 0x%x(%d)"
--smmuv3_record_event(const char *type, uint32_t sid) "%s sid=0x%x"
-+smmuv3_propagate_event(const char *type, uint32_t sid) "%s sid=0x%x"
- smmuv3_find_ste(uint16_t sid, uint32_t features, uint16_t sid_split) "sid=0x%x features:0x%x, sid_split:0x%x"
- smmuv3_find_ste_2lvl(uint64_t strtab_base, uint64_t l1ptr, int l1_ste_offset, uint64_t l2ptr, int l2_ste_offset, int max_l2_ste) "strtab_base:0x%"PRIx64" l1ptr:0x%"PRIx64" l1_off:0x%x, l2ptr:0x%"PRIx64" l2_off:0x%x max_l2_ste:%d"
- smmuv3_get_ste(uint64_t addr) "STE addr: 0x%"PRIx64
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Set-default-ats-ril-ssidsize-oas-to-au.patch b/kvm-hw-arm-smmuv3-Set-default-ats-ril-ssidsize-oas-to-au.patch
deleted file mode 100644
index 270e6de..0000000
--- a/kvm-hw-arm-smmuv3-Set-default-ats-ril-ssidsize-oas-to-au.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-From 404ac4a7236dc28940c7185b2e8a4fadbbe6f06c Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Mon, 8 Jun 2026 10:48:59 -0700
-Subject: [PATCH 073/111] hw/arm/smmuv3: Set default ats, ril, ssidsize, oas to
- auto
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [73/111] ad6ebf8a64277a364ee604cf9c13b8dced85b7f1 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-163596
-
-Conflicts: contextual conflict in machine.c as we don't have
-hw_compat_10_1, hw_compat_10_2, hw_compat_11_0 in RHEL. So add
-the compats in last hw_compat_10_0 which then are propagated to
-hw_compat_rhel_10_2. Note as we don't have a new machine type in
-10.3 the new defaults don't apply and it will be needed to set auto
-value explicitly. Also fix the setting of hw_compat_rhel_10_2_len.
-
-Set the default value of ATS, RIL, SSIDSIZE, and OAS to auto, in order
-to match the host IOMMU properties when accel=on.
-
-If accel=off and these property values are set to auto, the default
-property values defined in smmuv3_init_id_regs() for OAS and RIL will
-remain unchanged, while SSIDSIZE and ATS values will remain initialized
-at 0.
-
-Introduce a new compat for the changed defaults.
-
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260608174900.2227340-9-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit e61f8d1138aa0f702632723f14161da8288936d4)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3.c | 23 +++++++++++++++--------
- hw/core/machine.c | 15 ++++++++++++++-
- 2 files changed, 29 insertions(+), 9 deletions(-)
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 89d34c9923..1e98ee0e76 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -2129,12 +2129,19 @@ static const Property smmuv3_properties[] = {
- DEFINE_PROP_BOOL("accel", SMMUv3State, accel, false),
- /* GPA of MSI doorbell, for SMMUv3 accel use. */
- DEFINE_PROP_UINT64("msi-gpa", SMMUv3State, msi_gpa, 0),
-+ /*
-+ * AUTO values for accel=off will resolve to:
-+ * ril: on
-+ * ats: off
-+ * oas: 44
-+ * ssidsize: 0
-+ */
- /* RIL can be turned off for accel cases */
-- DEFINE_PROP_ON_OFF_AUTO("ril", SMMUv3State, ril, ON_OFF_AUTO_ON),
-- DEFINE_PROP_ON_OFF_AUTO("ats", SMMUv3State, ats, ON_OFF_AUTO_OFF),
-- DEFINE_PROP_OAS_MODE("oas", SMMUv3State, oas, OAS_MODE_44),
-+ DEFINE_PROP_ON_OFF_AUTO("ril", SMMUv3State, ril, ON_OFF_AUTO_AUTO),
-+ DEFINE_PROP_ON_OFF_AUTO("ats", SMMUv3State, ats, ON_OFF_AUTO_AUTO),
-+ DEFINE_PROP_OAS_MODE("oas", SMMUv3State, oas, OAS_MODE_AUTO),
- DEFINE_PROP_SSIDSIZE_MODE("ssidsize", SMMUv3State, ssidsize,
-- SSID_SIZE_MODE_0),
-+ SSID_SIZE_MODE_AUTO),
- };
-
- static void smmuv3_instance_init(Object *obj)
-@@ -2164,22 +2171,22 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- "enabling.");
- object_class_property_set_description(klass, "ril",
- "Enable/disable range invalidation support (for accel=on). "
-- "Valid values are on, off, and auto. Defaults to on. "
-+ "Valid values are on, off, and auto. Defaults to auto. "
- "Any attempt to turn it 'on' while the host does not support "
- "it would fail.");
- object_class_property_set_description(klass, "ats",
- "Enable/disable ATS support (for accel=on). "
-- "Valid values are on, off, and auto. Defaults to off. "
-+ "Valid values are on, off, and auto. Defaults to auto. "
- "Please ensure host platform supports ATS before setting it "
- "to on.");
- object_class_property_set_description(klass, "oas",
- "Set Output Address Size in bits (for accel=on). "
-- "Valid values are 44, 48, and auto. Defaults to 44 bits."
-+ "Valid values are 44, 48, and auto. Defaults to auto."
- "Please ensure the value does not exceed the maximum "
- "Output Address Size supported by the host platform.");
- object_class_property_set_description(klass, "ssidsize",
- "Set number of bits used to represent SubstreamIDs (SSIDs). "
-- "Valid values are 0-20 and auto. Defaults to 0. "
-+ "Valid values are 0-20 and auto. Defaults to auto. "
- "A value of N allows SSIDs in the range [0 .. 2^N - 1]. "
- "A value of 0 disables SubstreamID support. A value greater "
- "than 0 is required to enable PASID support."
-diff --git a/hw/core/machine.c b/hw/core/machine.c
-index 2b339f6a13..601d8c6a1f 100644
---- a/hw/core/machine.c
-+++ b/hw/core/machine.c
-@@ -36,12 +36,17 @@
- #include "hw/virtio/virtio-net.h"
- #include "hw/virtio/virtio-iommu.h"
- #include "audio/audio.h"
-+#include "hw/arm/smmuv3.h"
-
- GlobalProperty hw_compat_10_0[] = {
- { "scsi-hd", "dpofua", "off" },
- { "vfio-pci", "x-migration-load-config-after-iter", "off" },
- { "ramfb", "use-legacy-x86-rom", "true"},
- { "vfio-pci-nohotplug", "use-legacy-x86-rom", "true" },
-+ { TYPE_ARM_SMMUV3, "ats", "off" },
-+ { TYPE_ARM_SMMUV3, "ril", "on" },
-+ { TYPE_ARM_SMMUV3, "ssidsize", "0" },
-+ { TYPE_ARM_SMMUV3, "oas", "44" },
- };
- const size_t hw_compat_10_0_len = G_N_ELEMENTS(hw_compat_10_0);
-
-@@ -304,8 +309,16 @@ GlobalProperty hw_compat_rhel_10_2[] = {
- { "ramfb", "use-legacy-x86-rom", "true"},
- /* hw_compat_rhel_10_2 from hw_compat_10_0 */
- { "vfio-pci-nohotplug", "use-legacy-x86-rom", "true" },
-+ /* hw_compat_rhel_10_2 from hw_compat_10_0 */
-+ { TYPE_ARM_SMMUV3, "ats", "off" },
-+ /* hw_compat_rhel_10_2 from hw_compat_10_0 */
-+ { TYPE_ARM_SMMUV3, "ril", "on" },
-+ /* hw_compat_rhel_10_2 from hw_compat_10_0 */
-+ { TYPE_ARM_SMMUV3, "ssidsize", "0" },
-+ /* hw_compat_rhel_10_2 from hw_compat_10_0 */
-+ { TYPE_ARM_SMMUV3, "oas", "44" },
- };
--const size_t hw_compat_rhel_10_2_len = G_N_ELEMENTS(hw_compat_10_0);
-+const size_t hw_compat_rhel_10_2_len = G_N_ELEMENTS(hw_compat_rhel_10_2);
-
- GlobalProperty hw_compat_rhel_10_1[] = {
- /* hw_compat_rhel_10_1 from hw_compat_9_1 */
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-Update-ATC-invalidation-check.patch b/kvm-hw-arm-smmuv3-Update-ATC-invalidation-check.patch
deleted file mode 100644
index 2ec47e1..0000000
--- a/kvm-hw-arm-smmuv3-Update-ATC-invalidation-check.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From ef1caeab79fd5be8bd3e46170af2c6c630dc3958 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Mon, 8 Jun 2026 10:48:52 -0700
-Subject: [PATCH 066/111] hw/arm/smmuv3: Update ATC invalidation check
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [66/111] 3c32cca7cc7c03287d85f5aaae983149d19a5cad (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-163596
-
-Use smmuv3_ats_enabled() to determine whether ATS is enabled for the
-guest when handling an ATC invalidation command, as setting the ATS
-property value to 'auto' will resolve to ATS being detected as
-enabled in the ATC invalidation check otherwise.
-
-Fixes: f7f5013a55a3 ("hw/arm/smmuv3-accel: Add support for ATS")
-Reported-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260608174900.2227340-2-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 8addbdb793b783228ab22867ac5e2d59ea6662a7)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 5fc55aa30a..c724c6b819 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1528,7 +1528,7 @@ static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp)
- {
- SMMUDevice *sdev = smmu_find_sdev(bs, CMD_SID(&cmd));
-
-- if (!sdev || !s->ats) {
-+ if (!sdev || !smmuv3_ats_enabled(s)) {
- trace_smmuv3_unhandled_cmd(type);
- break;
- }
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Add-a-property-to-specify-RIL-su.patch b/kvm-hw-arm-smmuv3-accel-Add-a-property-to-specify-RIL-su.patch
deleted file mode 100644
index 2225cbe..0000000
--- a/kvm-hw-arm-smmuv3-accel-Add-a-property-to-specify-RIL-su.patch
+++ /dev/null
@@ -1,150 +0,0 @@
-From 173447f0eb8f5d9486e21e6290c7059cdba4df46 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 037/111] hw/arm/smmuv3-accel: Add a property to specify RIL
- support
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [37/111] ce485009c27e5fc84da112baab386d28c178e4c7 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Currently QEMU SMMUv3 has RIL support by default. But if accelerated mode
-is enabled, RIL has to be compatible with host SMMUv3 support.
-
-Add a property so that the user can specify this.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-30-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit bd715ff5bda973c85caa16f1cabf1e9aef30dc70)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 14 ++++++++++++--
- hw/arm/smmuv3-accel.h | 4 ++++
- hw/arm/smmuv3.c | 9 +++++++++
- include/hw/arm/smmuv3.h | 1 +
- 4 files changed, 26 insertions(+), 2 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 33011962e3..df82f1e32a 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -68,8 +68,8 @@ smmuv3_accel_check_hw_compatible(SMMUv3State *s,
- return false;
- }
-
-- /* QEMU SMMUv3 supports Range Invalidation by default */
-- if (FIELD_EX32(info->idr[3], IDR3, RIL) !=
-+ /* User can disable QEMU SMMUv3 Range Invalidation support */
-+ if (FIELD_EX32(info->idr[3], IDR3, RIL) <
- FIELD_EX32(s->idr[3], IDR3, RIL)) {
- error_setg(errp, "Host SMMUv3 doesn't support Range Invalidation");
- return false;
-@@ -646,6 +646,16 @@ static const PCIIOMMUOps smmuv3_accel_ops = {
- .get_msi_direct_gpa = smmuv3_accel_get_msi_gpa,
- };
-
-+void smmuv3_accel_idr_override(SMMUv3State *s)
-+{
-+ if (!s->accel) {
-+ return;
-+ }
-+
-+ /* By default QEMU SMMUv3 has RIL. Update IDR3 if user has disabled it */
-+ s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, s->ril);
-+}
-+
- /* Based on SMUUv3 GPBA.ABORT configuration, attach a corresponding HWPT */
- bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp)
- {
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index 41b37e3122..a8a64802ec 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -49,6 +49,7 @@ bool smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
- bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp);
- bool smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
- Error **errp);
-+void smmuv3_accel_idr_override(SMMUv3State *s);
- void smmuv3_accel_reset(SMMUv3State *s);
- #else
- static inline void smmuv3_accel_init(SMMUv3State *s)
-@@ -76,6 +77,9 @@ smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
- {
- return true;
- }
-+static inline void smmuv3_accel_idr_override(SMMUv3State *s)
-+{
-+}
- static inline void smmuv3_accel_reset(SMMUv3State *s)
- {
- }
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 0d2f5a9b0c..643706b29c 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -305,6 +305,7 @@ static void smmuv3_init_id_regs(SMMUv3State *s)
- s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN16K, 1);
- s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN64K, 1);
- s->aidr = 0x1;
-+ smmuv3_accel_idr_override(s);
- }
-
- static void smmuv3_reset(SMMUv3State *s)
-@@ -1926,6 +1927,10 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- #endif
-
- if (!s->accel) {
-+ if (!s->ril) {
-+ error_setg(errp, "ril can only be disabled if accel=on");
-+ return false;
-+ }
- return true;
- }
-
-@@ -2059,6 +2064,8 @@ static const Property smmuv3_properties[] = {
- DEFINE_PROP_BOOL("accel", SMMUv3State, accel, false),
- /* GPA of MSI doorbell, for SMMUv3 accel use. */
- DEFINE_PROP_UINT64("msi-gpa", SMMUv3State, msi_gpa, 0),
-+ /* RIL can be turned off for accel cases */
-+ DEFINE_PROP_BOOL("ril", SMMUv3State, ril, true),
- };
-
- static void smmuv3_instance_init(Object *obj)
-@@ -2084,6 +2091,8 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- object_class_property_set_description(klass, "accel",
- "Enable SMMUv3 accelerator support. Allows host SMMUv3 to be "
- "configured in nested mode for vfio-pci dev assignment");
-+ object_class_property_set_description(klass, "ril",
-+ "Disable range invalidation support (for accel=on)");
- }
-
- static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index 9c39acd5ca..533a2182e8 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -69,6 +69,7 @@ struct SMMUv3State {
- struct SMMUv3AccelState *s_accel;
- uint64_t msi_gpa;
- Error *migration_blocker;
-+ bool ril;
- };
-
- typedef enum {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Add-helper-for-resolving-auto-pa.patch b/kvm-hw-arm-smmuv3-accel-Add-helper-for-resolving-auto-pa.patch
deleted file mode 100644
index 15420b7..0000000
--- a/kvm-hw-arm-smmuv3-accel-Add-helper-for-resolving-auto-pa.patch
+++ /dev/null
@@ -1,167 +0,0 @@
-From c7ecd05ab988cc750b7367ea6cebae674cb3e31c Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Mon, 8 Jun 2026 10:48:54 -0700
-Subject: [PATCH 068/111] hw/arm/smmuv3-accel: Add helper for resolving auto
- parameters
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [68/111] cb386d939db43c67b117bfe51e31407c02e8c616 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-163596
-
-Introduce smmuv3_accel_auto_finalise() to resolve properties that are
-set to 'auto' for accelerated SMMUv3. This helper function allows
-properties such as ats, ril, ssidsize, and oas support to be resolved
-from host IOMMU capabilities via IOMMU_GET_HW_INFO.
-
-The later commits in this series set the auto_mode flag to true when
-an accel SMMUv3 property value is explicitly set to 'auto', or if the
-property value is not set and defaults to auto mode.
-
-Setting these property values to 'auto' requires at least one
-cold-plugged device to retrieve and finalise these properties. If the
-auto_mode flag is true, register a machine_init_done notifier to
-verify this requirement and fail boot if it is not met.
-
-Hot-plugged devices into an accel SMMUv3-associated bus will re-use
-the resolved host values from the initial cold-plug.
-
-Subsequent patches will make use of this helper to resolve 'auto' to
-what is reported by host IOMMU capabilities.
-
-Suggested-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260608174900.2227340-4-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 16c547e9cb911d751d35fbe181a5cea8f9d52fbc)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 41 +++++++++++++++++++++++++++++++++++++++++
- hw/arm/smmuv3-accel.h | 2 ++
- include/hw/arm/smmuv3.h | 3 +++
- 3 files changed, 46 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index ae031f1ecc..e625f145c4 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -18,6 +18,7 @@
-
- #include "smmuv3-internal.h"
- #include "smmuv3-accel.h"
-+#include "system/system.h"
-
- /*
- * The root region aliases the global system memory, and shared_as_sysmem
-@@ -35,11 +36,33 @@ static int smmuv3_oas_bits(uint32_t oas)
- return map[oas];
- }
-
-+static void smmuv3_accel_auto_finalise(SMMUv3State *s,
-+ struct iommu_hw_info_arm_smmuv3 *info)
-+{
-+ SMMUv3AccelState *accel = s->s_accel;
-+
-+ /*
-+ * Return if 'auto' was not set for any accel SMMUv3 property, or
-+ * if property values were already resolved from a previous call
-+ * to this function (e.g. if this function was called again after
-+ * VM boot during device hot plug). We do not accept new property
-+ * values in this case where auto_finalised == true, and we re-use
-+ * the values determined from the initial cold plug.
-+ */
-+ if (!accel->auto_mode || accel->auto_finalised) {
-+ return;
-+ }
-+
-+ accel->auto_finalised = true;
-+}
-+
- static bool
- smmuv3_accel_check_hw_compatible(SMMUv3State *s,
- struct iommu_hw_info_arm_smmuv3 *info,
- Error **errp)
- {
-+ smmuv3_accel_auto_finalise(s, info);
-+
- /* QEMU SMMUv3 supports both linear and 2-level stream tables */
- if (FIELD_EX32(info->idr[0], IDR0, STLEVEL) !=
- FIELD_EX32(s->idr[0], IDR0, STLEVEL)) {
-@@ -917,6 +940,18 @@ static void smmuv3_accel_as_init(SMMUv3State *s)
- address_space_init(shared_as_sysmem, &root, "smmuv3-accel-as-sysmem");
- }
-
-+static void smmuv3_accel_machine_done(Notifier *notifier, void *data)
-+{
-+ SMMUv3State *s = container_of(notifier, SMMUv3State, machine_done);
-+ SMMUv3AccelState *accel = s->s_accel;
-+
-+ if (accel->auto_mode && !accel->auto_finalised) {
-+ error_report("arm-smmuv3 accel=on with 'auto' properties requires "
-+ "at least one cold-plugged VFIO device");
-+ exit(1);
-+ }
-+}
-+
- bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
- {
- SMMUState *bs = ARM_SMMU(s);
-@@ -924,5 +959,11 @@ bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
- s->s_accel = g_new0(SMMUv3AccelState, 1);
- bs->iommu_ops = &smmuv3_accel_ops;
- smmuv3_accel_as_init(s);
-+
-+ if (s->s_accel->auto_mode) {
-+ s->machine_done.notify = smmuv3_accel_machine_done;
-+ qemu_add_machine_init_done_notifier(&s->machine_done);
-+ }
-+
- return true;
- }
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index 1ca2c80a93..d7b9f8a8e6 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -26,6 +26,8 @@ typedef struct SMMUv3AccelState {
- uint32_t bypass_hwpt_id;
- uint32_t abort_hwpt_id;
- QLIST_HEAD(, SMMUv3AccelDevice) device_list;
-+ bool auto_mode;
-+ bool auto_finalised;
- } SMMUv3AccelState;
-
- typedef struct SMMUS1Hwpt {
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index 82f18eb090..85be3d7467 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -22,6 +22,7 @@
- #include "hw/arm/smmu-common.h"
- #include "qom/object.h"
- #include "qapi/qapi-types-misc-arm.h"
-+#include "qemu/notify.h"
-
- #define TYPE_SMMUV3_IOMMU_MEMORY_REGION "smmuv3-iommu-memory-region"
-
-@@ -74,6 +75,8 @@ struct SMMUv3State {
- OnOffAuto ats;
- OasMode oas;
- SsidSizeMode ssidsize;
-+
-+ Notifier machine_done;
- };
-
- typedef enum {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Add-nested-vSTE-install-uninstal.patch b/kvm-hw-arm-smmuv3-accel-Add-nested-vSTE-install-uninstal.patch
deleted file mode 100644
index 83e1377..0000000
--- a/kvm-hw-arm-smmuv3-accel-Add-nested-vSTE-install-uninstal.patch
+++ /dev/null
@@ -1,421 +0,0 @@
-From 9ea3b4bff367d92ec736e800eca1858b599a419a Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 022/111] hw/arm/smmuv3-accel: Add nested vSTE
- install/uninstall support
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [22/111] 82797493d2a4627bc07d4faaba7d4405d1ecda90 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-A device placed behind a vSMMU instance must have corresponding vSTEs
-(bypass, abort, or translate) installed. The bypass and abort proxy nested
-HWPTs are pre-allocated.
-
-For translat HWPT, a vDEVICE object is allocated and associated with the
-vIOMMU for each guest device. This allows the host kernel to establish a
-virtual SID to physical SID mapping, which is required for handling
-invalidations and event reporting.
-
-An translate HWPT is allocated based on the guest STE configuration and
-attached to the device when the guest issues SMMU_CMD_CFGI_STE or
-SMMU_CMD_CFGI_STE_RANGE, provided the STE enables S1 translation.
-
-If the guest STE is invalid or S1 translation is disabled, the device is
-attached to one of the pre-allocated ABORT or BYPASS HWPTs instead.
-
-While at it, export smmu_find_ste() for use here.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-15-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 2da17a988c2d387b8fde04fdaddf03afa73085f5)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 197 +++++++++++++++++++++++++++++++++
- hw/arm/smmuv3-accel.h | 22 ++++
- hw/arm/smmuv3-internal.h | 1 +
- hw/arm/smmuv3.c | 11 +-
- hw/arm/trace-events | 2 +
- include/hw/arm/smmuv3-common.h | 18 +++
- 6 files changed, 249 insertions(+), 2 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 9c2b917a11..877b7e0e17 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -51,6 +51,188 @@ static uint32_t smmuv3_accel_gbpa_hwpt(SMMUv3State *s, SMMUv3AccelState *accel)
- accel->abort_hwpt_id : accel->bypass_hwpt_id;
- }
-
-+static bool
-+smmuv3_accel_alloc_vdev(SMMUv3AccelDevice *accel_dev, int sid, Error **errp)
-+{
-+ SMMUv3AccelState *accel = accel_dev->s_accel;
-+ HostIOMMUDeviceIOMMUFD *idev = accel_dev->idev;
-+ IOMMUFDVdev *vdev = accel_dev->vdev;
-+ uint32_t vdevice_id;
-+
-+ if (!idev || vdev) {
-+ return true;
-+ }
-+
-+ if (!iommufd_backend_alloc_vdev(idev->iommufd, idev->devid,
-+ accel->viommu->viommu_id, sid,
-+ &vdevice_id, errp)) {
-+ return false;
-+ }
-+
-+ vdev = g_new(IOMMUFDVdev, 1);
-+ vdev->vdevice_id = vdevice_id;
-+ vdev->virt_id = sid;
-+ accel_dev->vdev = vdev;
-+ return true;
-+}
-+
-+static SMMUS1Hwpt *
-+smmuv3_accel_dev_alloc_translate(SMMUv3AccelDevice *accel_dev, STE *ste,
-+ Error **errp)
-+{
-+ uint64_t ste_0 = (uint64_t)ste->word[0] | (uint64_t)ste->word[1] << 32;
-+ uint64_t ste_1 = (uint64_t)ste->word[2] | (uint64_t)ste->word[3] << 32;
-+ HostIOMMUDeviceIOMMUFD *idev = accel_dev->idev;
-+ SMMUv3AccelState *accel = accel_dev->s_accel;
-+ struct iommu_hwpt_arm_smmuv3 nested_data = {
-+ .ste = {
-+ cpu_to_le64(ste_0 & STE0_MASK),
-+ cpu_to_le64(ste_1 & STE1_MASK),
-+ },
-+ };
-+ uint32_t hwpt_id = 0, flags = 0;
-+ SMMUS1Hwpt *s1_hwpt;
-+
-+ if (!iommufd_backend_alloc_hwpt(idev->iommufd, idev->devid,
-+ accel->viommu->viommu_id, flags,
-+ IOMMU_HWPT_DATA_ARM_SMMUV3,
-+ sizeof(nested_data), &nested_data,
-+ &hwpt_id, errp)) {
-+ return NULL;
-+ }
-+
-+ s1_hwpt = g_new0(SMMUS1Hwpt, 1);
-+ s1_hwpt->hwpt_id = hwpt_id;
-+ trace_smmuv3_accel_translate_ste(accel_dev->vdev->virt_id, hwpt_id,
-+ nested_data.ste[1], nested_data.ste[0]);
-+ return s1_hwpt;
-+}
-+
-+bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
-+ Error **errp)
-+{
-+ SMMUEventInfo event = {.type = SMMU_EVT_NONE, .sid = sid,
-+ .inval_ste_allowed = true};
-+ SMMUv3AccelState *accel = s->s_accel;
-+ SMMUv3AccelDevice *accel_dev;
-+ HostIOMMUDeviceIOMMUFD *idev;
-+ uint32_t config, hwpt_id = 0;
-+ SMMUS1Hwpt *s1_hwpt = NULL;
-+ const char *type;
-+ STE ste;
-+
-+ if (!accel || !accel->viommu) {
-+ return true;
-+ }
-+
-+ accel_dev = container_of(sdev, SMMUv3AccelDevice, sdev);
-+ if (!accel_dev->s_accel) {
-+ return true;
-+ }
-+
-+ idev = accel_dev->idev;
-+ if (!smmuv3_accel_alloc_vdev(accel_dev, sid, errp)) {
-+ return false;
-+ }
-+
-+ if (smmu_find_ste(sdev->smmu, sid, &ste, &event)) {
-+ /* No STE found, nothing to install */
-+ return true;
-+ }
-+
-+ /*
-+ * Install the STE based on SMMU enabled/config:
-+ * - attach a pre-allocated HWPT for abort/bypass
-+ * - or a new HWPT for translate STE
-+ *
-+ * Note: The vdev remains associated with accel_dev even if HWPT
-+ * attach/alloc fails, since the Guest–Host SID mapping stays
-+ * valid as long as the device is behind the accelerated SMMUv3.
-+ */
-+ if (!smmu_enabled(s)) {
-+ hwpt_id = smmuv3_accel_gbpa_hwpt(s, accel);
-+ } else {
-+ config = STE_CONFIG(&ste);
-+
-+ if (!STE_VALID(&ste) || STE_CFG_ABORT(config)) {
-+ hwpt_id = accel->abort_hwpt_id;
-+ } else if (STE_CFG_BYPASS(config)) {
-+ hwpt_id = accel->bypass_hwpt_id;
-+ } else if (STE_CFG_S1_TRANSLATE(config)) {
-+ s1_hwpt = smmuv3_accel_dev_alloc_translate(accel_dev, &ste, errp);
-+ if (!s1_hwpt) {
-+ return false;
-+ }
-+ hwpt_id = s1_hwpt->hwpt_id;
-+ }
-+ }
-+
-+ if (!hwpt_id) {
-+ error_setg(errp, "Invalid STE config for sid 0x%x",
-+ smmu_get_sid(&accel_dev->sdev));
-+ return false;
-+ }
-+
-+ if (!host_iommu_device_iommufd_attach_hwpt(idev, hwpt_id, errp)) {
-+ if (s1_hwpt) {
-+ iommufd_backend_free_id(idev->iommufd, s1_hwpt->hwpt_id);
-+ g_free(s1_hwpt);
-+ }
-+ return false;
-+ }
-+
-+ /* Free the previous s1_hwpt */
-+ if (accel_dev->s1_hwpt) {
-+ iommufd_backend_free_id(idev->iommufd, accel_dev->s1_hwpt->hwpt_id);
-+ g_free(accel_dev->s1_hwpt);
-+ }
-+
-+ accel_dev->s1_hwpt = s1_hwpt;
-+ if (hwpt_id == accel->abort_hwpt_id) {
-+ type = "abort";
-+ } else if (hwpt_id == accel->bypass_hwpt_id) {
-+ type = "bypass";
-+ } else {
-+ type = "translate";
-+ }
-+
-+ trace_smmuv3_accel_install_ste(sid, type, hwpt_id);
-+ return true;
-+}
-+
-+bool smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
-+ Error **errp)
-+{
-+ SMMUv3AccelState *accel = s->s_accel;
-+ SMMUv3AccelDevice *accel_dev;
-+ Error *local_err = NULL;
-+ bool all_ok = true;
-+
-+ if (!accel || !accel->viommu) {
-+ return true;
-+ }
-+
-+ QLIST_FOREACH(accel_dev, &accel->device_list, next) {
-+ uint32_t sid = smmu_get_sid(&accel_dev->sdev);
-+
-+ if (sid >= range->start && sid <= range->end) {
-+ if (!smmuv3_accel_install_ste(s, &accel_dev->sdev,
-+ sid, &local_err)) {
-+ error_append_hint(&local_err, "Device 0x%x: Failed to install "
-+ "STE\n", sid);
-+ error_report_err(local_err);
-+ local_err = NULL;
-+ all_ok = false;
-+ }
-+ }
-+ }
-+
-+ if (!all_ok) {
-+ error_setg(errp, "Failed to install all STEs properly");
-+ }
-+ return all_ok;
-+}
-+
- static bool
- smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- Error **errp)
-@@ -161,6 +343,7 @@ static void smmuv3_accel_unset_iommu_device(PCIBus *bus, void *opaque,
- HostIOMMUDeviceIOMMUFD *idev;
- SMMUv3AccelDevice *accel_dev;
- SMMUv3AccelState *accel;
-+ IOMMUFDVdev *vdev;
- SMMUDevice *sdev;
-
- if (!sbus) {
-@@ -181,6 +364,20 @@ static void smmuv3_accel_unset_iommu_device(PCIBus *bus, void *opaque,
- "0x%x", idev->devid);
- }
-
-+ if (accel_dev->s1_hwpt) {
-+ iommufd_backend_free_id(accel_dev->idev->iommufd,
-+ accel_dev->s1_hwpt->hwpt_id);
-+ g_free(accel_dev->s1_hwpt);
-+ accel_dev->s1_hwpt = NULL;
-+ }
-+
-+ vdev = accel_dev->vdev;
-+ if (vdev) {
-+ iommufd_backend_free_id(accel->viommu->iommufd, vdev->vdevice_id);
-+ g_free(vdev);
-+ accel_dev->vdev = NULL;
-+ }
-+
- accel_dev->idev = NULL;
- accel_dev->s_accel = NULL;
- QLIST_REMOVE(accel_dev, next);
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index efb631db4f..4e20b646dc 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -27,19 +27,41 @@ typedef struct SMMUv3AccelState {
- QLIST_HEAD(, SMMUv3AccelDevice) device_list;
- } SMMUv3AccelState;
-
-+typedef struct SMMUS1Hwpt {
-+ uint32_t hwpt_id;
-+} SMMUS1Hwpt;
-+
- typedef struct SMMUv3AccelDevice {
- SMMUDevice sdev;
- HostIOMMUDeviceIOMMUFD *idev;
-+ SMMUS1Hwpt *s1_hwpt;
-+ IOMMUFDVdev *vdev;
- QLIST_ENTRY(SMMUv3AccelDevice) next;
- SMMUv3AccelState *s_accel;
- } SMMUv3AccelDevice;
-
- #ifdef CONFIG_ARM_SMMUV3_ACCEL
- void smmuv3_accel_init(SMMUv3State *s);
-+bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
-+ Error **errp);
-+bool smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
-+ Error **errp);
- #else
- static inline void smmuv3_accel_init(SMMUv3State *s)
- {
- }
-+static inline bool
-+smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
-+ Error **errp)
-+{
-+ return true;
-+}
-+static inline bool
-+smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
-+ Error **errp)
-+{
-+ return true;
-+}
- #endif
-
- #endif /* HW_ARM_SMMUV3_ACCEL_H */
-diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
-index 8679ab6d09..998d30473d 100644
---- a/hw/arm/smmuv3-internal.h
-+++ b/hw/arm/smmuv3-internal.h
-@@ -353,6 +353,7 @@ typedef struct SMMUEventInfo {
- } while (0)
-
- void smmuv3_record_event(SMMUv3State *s, SMMUEventInfo *event);
-+int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste, SMMUEventInfo *event);
-
- static inline int oas2bits(int oas_field)
- {
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 374ae08baa..bfb41b8866 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -630,8 +630,7 @@ bad_ste:
- * Supports linear and 2-level stream table
- * Return 0 on success, -EINVAL otherwise
- */
--static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste,
-- SMMUEventInfo *event)
-+int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste, SMMUEventInfo *event)
- {
- dma_addr_t addr, strtab_base;
- uint32_t log2size;
-@@ -1341,6 +1340,10 @@ static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp)
- }
-
- trace_smmuv3_cmdq_cfgi_ste(sid);
-+ if (!smmuv3_accel_install_ste(s, sdev, sid, errp)) {
-+ cmd_error = SMMU_CERROR_ILL;
-+ break;
-+ }
- smmuv3_flush_config(sdev);
-
- break;
-@@ -1361,6 +1364,10 @@ static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp)
- sid_range.end = sid_range.start + mask;
-
- trace_smmuv3_cmdq_cfgi_ste_range(sid_range.start, sid_range.end);
-+ if (!smmuv3_accel_install_ste_range(s, &sid_range, errp)) {
-+ cmd_error = SMMU_CERROR_ILL;
-+ break;
-+ }
- smmu_configs_inv_sid_range(bs, sid_range);
- break;
- }
-diff --git a/hw/arm/trace-events b/hw/arm/trace-events
-index 2aaa0c40c7..8135c0c734 100644
---- a/hw/arm/trace-events
-+++ b/hw/arm/trace-events
-@@ -69,6 +69,8 @@ smmu_reset_exit(void) ""
- #smmuv3-accel.c
- smmuv3_accel_set_iommu_device(int devfn, uint32_t devid) "devfn=0x%x (idev devid=0x%x)"
- smmuv3_accel_unset_iommu_device(int devfn, uint32_t devid) "devfn=0x%x (idev devid=0x%x)"
-+smmuv3_accel_translate_ste(uint32_t vsid, uint32_t hwpt_id, uint64_t ste_1, uint64_t ste_0) "vSID=0x%x hwpt_id=0x%x ste=%"PRIx64":%"PRIx64
-+smmuv3_accel_install_ste(uint32_t vsid, const char * type, uint32_t hwpt_id) "vSID=0x%x ste type=%s hwpt_id=0x%x"
-
- # strongarm.c
- strongarm_uart_update_parameters(const char *label, int speed, char parity, int data_bits, int stop_bits) "%s speed=%d parity=%c data=%d stop=%d"
-diff --git a/include/hw/arm/smmuv3-common.h b/include/hw/arm/smmuv3-common.h
-index 905e6ca67f..4d8af5736a 100644
---- a/include/hw/arm/smmuv3-common.h
-+++ b/include/hw/arm/smmuv3-common.h
-@@ -99,10 +99,28 @@ REG32(STE_7, 28)
- #define STE_CFG_S2_ENABLED(config) (config & 0x2)
- #define STE_CFG_ABORT(config) (!(config & 0x4))
- #define STE_CFG_BYPASS(config) (config == 0x4)
-+#define STE_CFG_S1_TRANSLATE(config) (config == 0x5)
-
- #define SMMU_STE_VALID (1ULL << 0)
- #define SMMU_STE_CFG_BYPASS (1ULL << 3)
-
-+#define STE0_V MAKE_64BIT_MASK(0, 1)
-+#define STE0_CONFIG MAKE_64BIT_MASK(1, 3)
-+#define STE0_S1FMT MAKE_64BIT_MASK(4, 2)
-+#define STE0_CTXPTR MAKE_64BIT_MASK(6, 50)
-+#define STE0_S1CDMAX MAKE_64BIT_MASK(59, 5)
-+#define STE0_MASK (STE0_S1CDMAX | STE0_CTXPTR | STE0_S1FMT | STE0_CONFIG | \
-+ STE0_V)
-+
-+#define STE1_S1DSS MAKE_64BIT_MASK(0, 2)
-+#define STE1_S1CIR MAKE_64BIT_MASK(2, 2)
-+#define STE1_S1COR MAKE_64BIT_MASK(4, 2)
-+#define STE1_S1CSH MAKE_64BIT_MASK(6, 2)
-+#define STE1_S1STALLD MAKE_64BIT_MASK(27, 1)
-+#define STE1_EATS MAKE_64BIT_MASK(28, 2)
-+#define STE1_MASK (STE1_EATS | STE1_S1STALLD | STE1_S1CSH | STE1_S1COR | \
-+ STE1_S1CIR | STE1_S1DSS)
-+
- /* Update STE fields */
- #define STE_SET_VALID(ste, v) \
- ((ste)->word[0] = FIELD_DP32((ste)->word[0], STE_0, VALID, (v)))
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Add-property-to-specify-OAS-bits.patch b/kvm-hw-arm-smmuv3-accel-Add-property-to-specify-OAS-bits.patch
deleted file mode 100644
index 5291a7c..0000000
--- a/kvm-hw-arm-smmuv3-accel-Add-property-to-specify-OAS-bits.patch
+++ /dev/null
@@ -1,183 +0,0 @@
-From 49c01e7b1f196b1251bbf6e3a993d662bd60b2a3 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 039/111] hw/arm/smmuv3-accel: Add property to specify OAS bits
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [39/111] db95cb3ea63f5ab2bdf80fccdf7f8baa4c81cc17 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-QEMU SMMUv3 currently sets the output address size (OAS) to 44 bits.
-With accelerator mode enabled, a device may use SVA, where CPU page tables
-are shared with the SMMU, requiring an OAS at least as large as the
-CPU’s output address size. A user option is added to configure this.
-
-However, the OAS value advertised by the virtual SMMU must remain
-compatible with the capabilities of the host SMMUv3. In accelerated
-mode, the host SMMU performs stage-2 translation and must be able to
-consume the intermediate physical addresses (IPA) produced by stage-1.
-
-The OAS exposed by the virtual SMMU defines the maximum IPA width that
-stage-1 translations may generate. For AArch64 implementations, the
-maximum usable IPA size on the host SMMU is determined by its own OAS.
-Check that the configured OAS does not exceed what the host SMMU
-can safely support.
-
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-32-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit a015ac990fd31bd4c93ce430aa4fce19dbfa49f8)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 22 ++++++++++++++++++++++
- hw/arm/smmuv3.c | 16 +++++++++++++++-
- include/hw/arm/smmuv3-common.h | 5 ++++-
- include/hw/arm/smmuv3.h | 1 +
- 4 files changed, 42 insertions(+), 2 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index a97abc1f79..ea420afeb7 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -27,6 +27,14 @@
- static MemoryRegion root, sysmem;
- static AddressSpace *shared_as_sysmem;
-
-+static int smmuv3_oas_bits(uint32_t oas)
-+{
-+ static const int map[] = { 32, 36, 40, 42, 44, 48, 52, 56 };
-+
-+ g_assert(oas < ARRAY_SIZE(map));
-+ return map[oas];
-+}
-+
- static bool
- smmuv3_accel_check_hw_compatible(SMMUv3State *s,
- struct iommu_hw_info_arm_smmuv3 *info,
-@@ -74,6 +82,15 @@ smmuv3_accel_check_hw_compatible(SMMUv3State *s,
- error_setg(errp, "Host SMMUv3 doesn't support Range Invalidation");
- return false;
- }
-+ /* Check OAS value opted is compatible with Host SMMUv3 IPA */
-+ if (FIELD_EX32(info->idr[5], IDR5, OAS) <
-+ FIELD_EX32(s->idr[5], IDR5, OAS)) {
-+ error_setg(errp, "Host SMMUv3 supports only %d-bit IPA, but the vSMMU "
-+ "OAS implies %d-bit IPA",
-+ smmuv3_oas_bits(FIELD_EX32(info->idr[5], IDR5, OAS)),
-+ smmuv3_oas_bits(FIELD_EX32(s->idr[5], IDR5, OAS)));
-+ return false;
-+ }
-
- /* QEMU SMMUv3 supports GRAN4K/GRAN16K/GRAN64K translation granules */
- if (FIELD_EX32(info->idr[5], IDR5, GRAN4K) !=
-@@ -657,6 +674,11 @@ void smmuv3_accel_idr_override(SMMUv3State *s)
-
- /* QEMU SMMUv3 has no ATS. Advertise ATS if opt-in by property */
- s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ATS, s->ats);
-+
-+ /* Advertise 48-bit OAS in IDR5 when requested (default is 44 bits). */
-+ if (s->oas == SMMU_OAS_48BIT) {
-+ s->idr[5] = FIELD_DP32(s->idr[5], IDR5, OAS, SMMU_IDR5_OAS_48);
-+ }
- }
-
- /* Based on SMUUv3 GPBA.ABORT configuration, attach a corresponding HWPT */
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index ead0785b2b..ef75a9bec0 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -299,7 +299,8 @@ static void smmuv3_init_id_regs(SMMUv3State *s)
- s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, 1);
- s->idr[3] = FIELD_DP32(s->idr[3], IDR3, BBML, 2);
-
-- s->idr[5] = FIELD_DP32(s->idr[5], IDR5, OAS, SMMU_IDR5_OAS); /* 44 bits */
-+ /* OAS: 44 bits */
-+ s->idr[5] = FIELD_DP32(s->idr[5], IDR5, OAS, SMMU_IDR5_OAS_44);
- /* 4K, 16K and 64K granule support */
- s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN4K, 1);
- s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN16K, 1);
-@@ -1949,6 +1950,10 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- error_setg(errp, "ats can only be enabled if accel=on");
- return false;
- }
-+ if (s->oas != SMMU_OAS_44BIT) {
-+ error_setg(errp, "OAS must be 44 bits when accel=off");
-+ return false;
-+ }
- return true;
- }
-
-@@ -1959,6 +1964,11 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- return false;
- }
-
-+ if (s->oas != SMMU_OAS_44BIT && s->oas != SMMU_OAS_48BIT) {
-+ error_setg(errp, "OAS can only be set to 44 or 48 bits");
-+ return false;
-+ }
-+
- return true;
- }
-
-@@ -2085,6 +2095,7 @@ static const Property smmuv3_properties[] = {
- /* RIL can be turned off for accel cases */
- DEFINE_PROP_BOOL("ril", SMMUv3State, ril, true),
- DEFINE_PROP_BOOL("ats", SMMUv3State, ats, false),
-+ DEFINE_PROP_UINT8("oas", SMMUv3State, oas, 44),
- };
-
- static void smmuv3_instance_init(Object *obj)
-@@ -2115,6 +2126,9 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- object_class_property_set_description(klass, "ats",
- "Enable/disable ATS support (for accel=on). Please ensure host "
- "platform has ATS support before enabling this");
-+ object_class_property_set_description(klass, "oas",
-+ "Specify Output Address Size (for accel=on). Supported values "
-+ "are 44 or 48 bits. Defaults to 44 bits");
- }
-
- static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
-diff --git a/include/hw/arm/smmuv3-common.h b/include/hw/arm/smmuv3-common.h
-index 4d8af5736a..bc2d49ef4e 100644
---- a/include/hw/arm/smmuv3-common.h
-+++ b/include/hw/arm/smmuv3-common.h
-@@ -342,7 +342,10 @@ REG32(IDR5, 0x14)
- FIELD(IDR5, VAX, 10, 2);
- FIELD(IDR5, STALL_MAX, 16, 16);
-
--#define SMMU_IDR5_OAS 4
-+#define SMMU_OAS_44BIT 44
-+#define SMMU_OAS_48BIT 48
-+#define SMMU_IDR5_OAS_44 4
-+#define SMMU_IDR5_OAS_48 5
-
- REG32(IIDR, 0x18)
- REG32(AIDR, 0x1c)
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index 242d6429ed..d488a39cd0 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -71,6 +71,7 @@ struct SMMUv3State {
- Error *migration_blocker;
- bool ril;
- bool ats;
-+ uint8_t oas;
- };
-
- typedef enum {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Add-set-unset_iommu_device-callb.patch b/kvm-hw-arm-smmuv3-accel-Add-set-unset_iommu_device-callb.patch
deleted file mode 100644
index e5cd7c3..0000000
--- a/kvm-hw-arm-smmuv3-accel-Add-set-unset_iommu_device-callb.patch
+++ /dev/null
@@ -1,365 +0,0 @@
-From 3ffeaf008bfcd0e3517239322b1469074cb474bf Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 020/111] hw/arm/smmuv3-accel: Add set/unset_iommu_device
- callback
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [20/111] ed11473feafc3c55d8fef15e1837baa55ae48974 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Implement the VFIO/PCI callbacks to attach and detach a HostIOMMUDevice
-to a vSMMUv3 when accel=on,
-
- - set_iommu_device(): attach a HostIOMMUDevice to a vIOMMU
- - unset_iommu_device(): detach and release associated resources
-
-In SMMUv3 accel=on mode, the guest SMMUv3 is backed by the host SMMUv3 via
-IOMMUFD. A vIOMMU object (created via IOMMU_VIOMMU_ALLOC) provides a per-VM,
-security-isolated handle to the physical SMMUv3. Without a vIOMMU, the
-vSMMUv3 cannot relay guest operations to the host hardware nor maintain
-isolation across VMs or devices. Therefore, set_iommu_device() allocates
-a vIOMMU object if one does not already exist.
-
-There are two main points to consider in this implementation:
-
-1) VFIO core allocates and attaches a S2 HWPT that acts as the nesting
- parent for nested HWPTs(IOMMU_DOMAIN_NESTED). This parent HWPT will
- be shared across multiple vSMMU instances within a VM.
-
-2) A device cannot attach directly to a vIOMMU. Instead, it attaches
- through a proxy nested HWPT (IOMMU_DOMAIN_NESTED). Based on the STE
- configuration,there are three types of nested HWPTs: bypass, abort,
- and translate.
- -The bypass and abort proxy HWPTs are pre-allocated. When SMMUv3
- operates in global abort or bypass modes, as controlled by the GBPA
- register, or issues a vSTE for bypass or abort we attach these
- pre-allocated nested HWPTs.
- -The translate HWPT requires a vDEVICE to be allocated first, since
- invalidations and events depend on a valid vSID.
- -The vDEVICE allocation and attach operations for vSTE based HWPTs
- are implemented in subsequent patches.
-
-In summary, a device placed behind a vSMMU instance must have a vSID for
-translate vSTE. The bypass and abort vSTEs are pre-allocated as proxy
-nested HWPTs and is attached based on GBPA register. The core-managed
-nesting parent S2 HWPT is used as parent S2 HWPT for all the nested
-HWPTs and is intended to be shared across vSMMU instances within the
-same VM.
-
-set_iommu_device():
- - Reuse an existing vIOMMU for the same physical SMMU if available.
- If not, allocate a new one using the nesting parent S2 HWPT.
- - Pre-allocate two proxy nested HWPTs (bypass and abort) under the
- vIOMMU and install one based on GBPA.ABORT value.
- - Add the device to the vIOMMU’s device list.
-
-unset_iommu_device():
- - Re-attach device to the nesting parent S2 HWPT.
- - Remove the device from the vIOMMU’s device list.
- - If the list is empty, free the proxy HWPTs (bypass and abort)
- and release the vIOMMU object.
-
-Introduce struct SMMUv3AccelState, representing an accelerated SMMUv3
-instance backed by an iommufd vIOMMU object, and storing the bypass and
-abort proxy HWPT IDs.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-13-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 703b7b91db064b94bb67bc49eaf503b2d6a8d333)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 156 +++++++++++++++++++++++++++++++++
- hw/arm/smmuv3-accel.h | 18 ++++
- hw/arm/trace-events | 4 +
- include/hw/arm/smmuv3-common.h | 3 +
- include/hw/arm/smmuv3.h | 1 +
- 5 files changed, 182 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index be09cf8b73..9c2b917a11 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -8,6 +8,7 @@
-
- #include "qemu/osdep.h"
- #include "qemu/error-report.h"
-+#include "trace.h"
-
- #include "hw/arm/smmuv3.h"
- #include "hw/core/iommu.h"
-@@ -15,6 +16,7 @@
- #include "hw/pci-host/gpex.h"
- #include "hw/vfio/pci.h"
-
-+#include "smmuv3-internal.h"
- #include "smmuv3-accel.h"
-
- /*
-@@ -43,6 +45,157 @@ static SMMUv3AccelDevice *smmuv3_accel_get_dev(SMMUState *bs, SMMUPciBus *sbus,
- return accel_dev;
- }
-
-+static uint32_t smmuv3_accel_gbpa_hwpt(SMMUv3State *s, SMMUv3AccelState *accel)
-+{
-+ return FIELD_EX32(s->gbpa, GBPA, ABORT) ?
-+ accel->abort_hwpt_id : accel->bypass_hwpt_id;
-+}
-+
-+static bool
-+smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
-+ Error **errp)
-+{
-+ SMMUv3AccelState *accel = s->s_accel;
-+ struct iommu_hwpt_arm_smmuv3 bypass_data = {
-+ .ste = { SMMU_STE_CFG_BYPASS | SMMU_STE_VALID, 0x0ULL },
-+ };
-+ struct iommu_hwpt_arm_smmuv3 abort_data = {
-+ .ste = { SMMU_STE_VALID, 0x0ULL },
-+ };
-+ uint32_t s2_hwpt_id = idev->hwpt_id;
-+ uint32_t viommu_id, hwpt_id;
-+ IOMMUFDViommu *viommu;
-+
-+ if (!iommufd_backend_alloc_viommu(idev->iommufd, idev->devid,
-+ IOMMU_VIOMMU_TYPE_ARM_SMMUV3,
-+ s2_hwpt_id, &viommu_id, errp)) {
-+ return false;
-+ }
-+
-+ viommu = g_new0(IOMMUFDViommu, 1);
-+ viommu->viommu_id = viommu_id;
-+ viommu->s2_hwpt_id = s2_hwpt_id;
-+ viommu->iommufd = idev->iommufd;
-+
-+ /*
-+ * Pre-allocate HWPTs for S1 bypass and abort cases. These will be attached
-+ * later for guest STEs or GBPAs that require bypass or abort configuration.
-+ */
-+ if (!iommufd_backend_alloc_hwpt(idev->iommufd, idev->devid, viommu_id,
-+ 0, IOMMU_HWPT_DATA_ARM_SMMUV3,
-+ sizeof(abort_data), &abort_data,
-+ &accel->abort_hwpt_id, errp)) {
-+ goto free_viommu;
-+ }
-+
-+ if (!iommufd_backend_alloc_hwpt(idev->iommufd, idev->devid, viommu_id,
-+ 0, IOMMU_HWPT_DATA_ARM_SMMUV3,
-+ sizeof(bypass_data), &bypass_data,
-+ &accel->bypass_hwpt_id, errp)) {
-+ goto free_abort_hwpt;
-+ }
-+
-+ /* Attach a HWPT based on SMMUv3 GBPA.ABORT value */
-+ hwpt_id = smmuv3_accel_gbpa_hwpt(s, accel);
-+ if (!host_iommu_device_iommufd_attach_hwpt(idev, hwpt_id, errp)) {
-+ goto free_bypass_hwpt;
-+ }
-+ accel->viommu = viommu;
-+ return true;
-+
-+free_bypass_hwpt:
-+ iommufd_backend_free_id(idev->iommufd, accel->bypass_hwpt_id);
-+free_abort_hwpt:
-+ iommufd_backend_free_id(idev->iommufd, accel->abort_hwpt_id);
-+free_viommu:
-+ iommufd_backend_free_id(idev->iommufd, viommu->viommu_id);
-+ g_free(viommu);
-+ return false;
-+}
-+
-+static bool smmuv3_accel_set_iommu_device(PCIBus *bus, void *opaque, int devfn,
-+ HostIOMMUDevice *hiod, Error **errp)
-+{
-+ HostIOMMUDeviceIOMMUFD *idev = HOST_IOMMU_DEVICE_IOMMUFD(hiod);
-+ SMMUState *bs = opaque;
-+ SMMUv3State *s = ARM_SMMUV3(bs);
-+ SMMUPciBus *sbus = smmu_get_sbus(bs, bus);
-+ SMMUv3AccelDevice *accel_dev = smmuv3_accel_get_dev(bs, sbus, bus, devfn);
-+
-+ if (!idev) {
-+ return true;
-+ }
-+
-+ if (accel_dev->idev) {
-+ if (accel_dev->idev != idev) {
-+ error_setg(errp, "Device already has an associated idev 0x%x",
-+ idev->devid);
-+ return false;
-+ }
-+ return true;
-+ }
-+
-+ if (s->s_accel->viommu) {
-+ goto done;
-+ }
-+
-+ if (!smmuv3_accel_alloc_viommu(s, idev, errp)) {
-+ error_append_hint(errp, "Unable to alloc vIOMMU: idev devid 0x%x: ",
-+ idev->devid);
-+ return false;
-+ }
-+
-+done:
-+ accel_dev->idev = idev;
-+ accel_dev->s_accel = s->s_accel;
-+ QLIST_INSERT_HEAD(&s->s_accel->device_list, accel_dev, next);
-+ trace_smmuv3_accel_set_iommu_device(devfn, idev->devid);
-+ return true;
-+}
-+
-+static void smmuv3_accel_unset_iommu_device(PCIBus *bus, void *opaque,
-+ int devfn)
-+{
-+ SMMUState *bs = opaque;
-+ SMMUPciBus *sbus = g_hash_table_lookup(bs->smmu_pcibus_by_busptr, bus);
-+ HostIOMMUDeviceIOMMUFD *idev;
-+ SMMUv3AccelDevice *accel_dev;
-+ SMMUv3AccelState *accel;
-+ SMMUDevice *sdev;
-+
-+ if (!sbus) {
-+ return;
-+ }
-+
-+ sdev = sbus->pbdev[devfn];
-+ if (!sdev) {
-+ return;
-+ }
-+
-+ accel_dev = container_of(sdev, SMMUv3AccelDevice, sdev);
-+ idev = accel_dev->idev;
-+ accel = accel_dev->s_accel;
-+ /* Re-attach the default s2 hwpt id */
-+ if (!host_iommu_device_iommufd_attach_hwpt(idev, idev->hwpt_id, NULL)) {
-+ error_report("Unable to attach the default HW pagetable: idev devid "
-+ "0x%x", idev->devid);
-+ }
-+
-+ accel_dev->idev = NULL;
-+ accel_dev->s_accel = NULL;
-+ QLIST_REMOVE(accel_dev, next);
-+ trace_smmuv3_accel_unset_iommu_device(devfn, idev->devid);
-+
-+ if (QLIST_EMPTY(&accel->device_list)) {
-+ iommufd_backend_free_id(accel->viommu->iommufd, accel->bypass_hwpt_id);
-+ iommufd_backend_free_id(accel->viommu->iommufd, accel->abort_hwpt_id);
-+ iommufd_backend_free_id(accel->viommu->iommufd,
-+ accel->viommu->viommu_id);
-+ g_free(accel->viommu);
-+ accel->viommu = NULL;
-+ }
-+}
-+
- /*
- * Only allow PCIe bridges, pxb-pcie roots, and GPEX roots so vfio-pci
- * endpoints can sit downstream. Accelerated SMMUv3 requires a vfio-pci
-@@ -145,6 +298,8 @@ static const PCIIOMMUOps smmuv3_accel_ops = {
- .supports_address_space = smmuv3_accel_supports_as,
- .get_address_space = smmuv3_accel_find_add_as,
- .get_viommu_flags = smmuv3_accel_get_viommu_flags,
-+ .set_iommu_device = smmuv3_accel_set_iommu_device,
-+ .unset_iommu_device = smmuv3_accel_unset_iommu_device,
- };
-
- static void smmuv3_accel_as_init(SMMUv3State *s)
-@@ -168,6 +323,7 @@ void smmuv3_accel_init(SMMUv3State *s)
- {
- SMMUState *bs = ARM_SMMU(s);
-
-+ s->s_accel = g_new0(SMMUv3AccelState, 1);
- bs->iommu_ops = &smmuv3_accel_ops;
- smmuv3_accel_as_init(s);
- }
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index 0dc6b00d35..efb631db4f 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -10,10 +10,28 @@
- #define HW_ARM_SMMUV3_ACCEL_H
-
- #include "hw/arm/smmu-common.h"
-+#include "system/iommufd.h"
-+#ifdef CONFIG_LINUX
-+#include <linux/iommufd.h>
-+#endif
- #include CONFIG_DEVICES
-
-+/*
-+ * Represents an accelerated SMMU instance backed by an iommufd vIOMMU object.
-+ * Holds bypass and abort proxy HWPT IDs used for device attachment.
-+ */
-+typedef struct SMMUv3AccelState {
-+ IOMMUFDViommu *viommu;
-+ uint32_t bypass_hwpt_id;
-+ uint32_t abort_hwpt_id;
-+ QLIST_HEAD(, SMMUv3AccelDevice) device_list;
-+} SMMUv3AccelState;
-+
- typedef struct SMMUv3AccelDevice {
- SMMUDevice sdev;
-+ HostIOMMUDeviceIOMMUFD *idev;
-+ QLIST_ENTRY(SMMUv3AccelDevice) next;
-+ SMMUv3AccelState *s_accel;
- } SMMUv3AccelDevice;
-
- #ifdef CONFIG_ARM_SMMUV3_ACCEL
-diff --git a/hw/arm/trace-events b/hw/arm/trace-events
-index f3386bd7ae..2aaa0c40c7 100644
---- a/hw/arm/trace-events
-+++ b/hw/arm/trace-events
-@@ -66,6 +66,10 @@ smmuv3_notify_flag_del(const char *iommu) "DEL SMMUNotifier node for iommu mr=%s
- smmuv3_inv_notifiers_iova(const char *name, int asid, int vmid, uint64_t iova, uint8_t tg, uint64_t num_pages, int stage) "iommu mr=%s asid=%d vmid=%d iova=0x%"PRIx64" tg=%d num_pages=0x%"PRIx64" stage=%d"
- smmu_reset_exit(void) ""
-
-+#smmuv3-accel.c
-+smmuv3_accel_set_iommu_device(int devfn, uint32_t devid) "devfn=0x%x (idev devid=0x%x)"
-+smmuv3_accel_unset_iommu_device(int devfn, uint32_t devid) "devfn=0x%x (idev devid=0x%x)"
-+
- # strongarm.c
- strongarm_uart_update_parameters(const char *label, int speed, char parity, int data_bits, int stop_bits) "%s speed=%d parity=%c data=%d stop=%d"
- strongarm_ssp_read_underrun(void) "SSP rx underrun"
-diff --git a/include/hw/arm/smmuv3-common.h b/include/hw/arm/smmuv3-common.h
-index 30101915e2..905e6ca67f 100644
---- a/include/hw/arm/smmuv3-common.h
-+++ b/include/hw/arm/smmuv3-common.h
-@@ -100,6 +100,9 @@ REG32(STE_7, 28)
- #define STE_CFG_ABORT(config) (!(config & 0x4))
- #define STE_CFG_BYPASS(config) (config == 0x4)
-
-+#define SMMU_STE_VALID (1ULL << 0)
-+#define SMMU_STE_CFG_BYPASS (1ULL << 3)
-+
- /* Update STE fields */
- #define STE_SET_VALID(ste, v) \
- ((ste)->word[0] = FIELD_DP32((ste)->word[0], STE_0, VALID, (v)))
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index bb7076286b..e54ece2d38 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -66,6 +66,7 @@ struct SMMUv3State {
-
- /* SMMU has HW accelerator support for nested S1 + s2 */
- bool accel;
-+ struct SMMUv3AccelState *s_accel;
- };
-
- typedef enum {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Add-support-for-ATS.patch b/kvm-hw-arm-smmuv3-accel-Add-support-for-ATS.patch
deleted file mode 100644
index a6513bb..0000000
--- a/kvm-hw-arm-smmuv3-accel-Add-support-for-ATS.patch
+++ /dev/null
@@ -1,188 +0,0 @@
-From edf2b5c6f9319e6516568a31d19c46eac686303f Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 038/111] hw/arm/smmuv3-accel: Add support for ATS
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [38/111] 55e6f061ef300a52b72b8268437085e344a6f818 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-QEMU SMMUv3 does not enable ATS (Address Translation Services) by default.
-When accelerated mode is enabled and the host SMMUv3 supports ATS, it can
-be useful to report ATS capability to the guest so it can take advantage
-of it if the device also supports ATS.
-
-Note: ATS support cannot be reliably detected from the host SMMUv3 IDR
-registers alone, as firmware ACPI IORT tables may override them. The
-user must therefore ensure the support before enabling it.
-
-The ATS support enabled here is only relevant for vfio-pci endpoints,
-as SMMUv3 accelerated mode does not support emulated endpoint devices.
-QEMU’s SMMUv3 implementation still lacks support for handling ATS
-translation requests, which would be required for emulated endpoints.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-31-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit f7f5013a55a3447ca81383d8969626e092feb0c9)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 3 +++
- hw/arm/smmuv3.c | 24 +++++++++++++++++++++++-
- hw/arm/virt-acpi-build.c | 10 ++++++++--
- include/hw/arm/smmuv3.h | 1 +
- 4 files changed, 35 insertions(+), 3 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index df82f1e32a..a97abc1f79 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -654,6 +654,9 @@ void smmuv3_accel_idr_override(SMMUv3State *s)
-
- /* By default QEMU SMMUv3 has RIL. Update IDR3 if user has disabled it */
- s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, s->ril);
-+
-+ /* QEMU SMMUv3 has no ATS. Advertise ATS if opt-in by property */
-+ s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ATS, s->ats);
- }
-
- /* Based on SMUUv3 GPBA.ABORT configuration, attach a corresponding HWPT */
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 643706b29c..ead0785b2b 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1498,13 +1498,27 @@ static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp)
- */
- smmuv3_range_inval(bs, &cmd, SMMU_STAGE_2);
- break;
-+ case SMMU_CMD_ATC_INV:
-+ {
-+ SMMUDevice *sdev = smmu_find_sdev(bs, CMD_SID(&cmd));
-+
-+ if (!sdev || !s->ats) {
-+ trace_smmuv3_unhandled_cmd(type);
-+ break;
-+ }
-+
-+ if (!smmuv3_accel_issue_inv_cmd(s, &cmd, sdev, errp)) {
-+ cmd_error = SMMU_CERROR_ILL;
-+ break;
-+ }
-+ break;
-+ }
- case SMMU_CMD_TLBI_EL3_ALL:
- case SMMU_CMD_TLBI_EL3_VA:
- case SMMU_CMD_TLBI_EL2_ALL:
- case SMMU_CMD_TLBI_EL2_ASID:
- case SMMU_CMD_TLBI_EL2_VA:
- case SMMU_CMD_TLBI_EL2_VAA:
-- case SMMU_CMD_ATC_INV:
- case SMMU_CMD_PRI_RESP:
- case SMMU_CMD_RESUME:
- case SMMU_CMD_STALL_TERM:
-@@ -1931,6 +1945,10 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- error_setg(errp, "ril can only be disabled if accel=on");
- return false;
- }
-+ if (s->ats) {
-+ error_setg(errp, "ats can only be enabled if accel=on");
-+ return false;
-+ }
- return true;
- }
-
-@@ -2066,6 +2084,7 @@ static const Property smmuv3_properties[] = {
- DEFINE_PROP_UINT64("msi-gpa", SMMUv3State, msi_gpa, 0),
- /* RIL can be turned off for accel cases */
- DEFINE_PROP_BOOL("ril", SMMUv3State, ril, true),
-+ DEFINE_PROP_BOOL("ats", SMMUv3State, ats, false),
- };
-
- static void smmuv3_instance_init(Object *obj)
-@@ -2093,6 +2112,9 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- "configured in nested mode for vfio-pci dev assignment");
- object_class_property_set_description(klass, "ril",
- "Disable range invalidation support (for accel=on)");
-+ object_class_property_set_description(klass, "ats",
-+ "Enable/disable ATS support (for accel=on). Please ensure host "
-+ "platform has ATS support before enabling this");
- }
-
- static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
-diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
-index 33c6519f0a..160f1d10e5 100644
---- a/hw/arm/virt-acpi-build.c
-+++ b/hw/arm/virt-acpi-build.c
-@@ -352,6 +352,7 @@ typedef struct AcpiIortSMMUv3Dev {
- /* Offset of the SMMUv3 IORT Node relative to the start of the IORT */
- size_t offset;
- bool accel;
-+ bool ats;
- } AcpiIortSMMUv3Dev;
-
- /*
-@@ -407,6 +408,7 @@ static int iort_smmuv3_devices(Object *obj, void *opaque)
-
- bus = PCI_BUS(object_property_get_link(obj, "primary-bus", &error_abort));
- sdev.accel = object_property_get_bool(obj, "accel", &error_abort);
-+ sdev.ats = object_property_get_bool(obj, "ats", &error_abort);
- pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
- sbdev = SYS_BUS_DEVICE(obj);
- sdev.base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
-@@ -550,6 +552,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- int i, nb_nodes, rc_mapping_count;
- AcpiIortSMMUv3Dev *sdev;
- size_t node_size;
-+ bool ats_needed = false;
- int num_smmus = 0;
- uint32_t id = 0;
- int rc_smmu_idmaps_len = 0;
-@@ -585,6 +588,9 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- /* Calculate RMR nodes required. One per SMMUv3 with accelerated mode */
- for (i = 0; i < num_smmus; i++) {
- sdev = &g_array_index(smmuv3_devs, AcpiIortSMMUv3Dev, i);
-+ if (sdev->ats) {
-+ ats_needed = true;
-+ }
- if (sdev->accel) {
- nb_nodes++;
- }
-@@ -684,8 +690,8 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- build_append_int_noprefix(table_data, 0, 2); /* Reserved */
- /* Table 15 Memory Access Flags */
- build_append_int_noprefix(table_data, 0x3 /* CCA = CPM = DACS = 1 */, 1);
--
-- build_append_int_noprefix(table_data, 0, 4); /* ATS Attribute */
-+ /* ATS Attribute */
-+ build_append_int_noprefix(table_data, ats_needed, 4);
- /* MCFG pci_segment */
- build_append_int_noprefix(table_data, 0, 4); /* PCI Segment number */
-
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index 533a2182e8..242d6429ed 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -70,6 +70,7 @@ struct SMMUv3State {
- uint64_t msi_gpa;
- Error *migration_blocker;
- bool ril;
-+ bool ats;
- };
-
- typedef enum {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Add-support-to-issue-invalidatio.patch b/kvm-hw-arm-smmuv3-accel-Add-support-to-issue-invalidatio.patch
deleted file mode 100644
index 737310c..0000000
--- a/kvm-hw-arm-smmuv3-accel-Add-support-to-issue-invalidatio.patch
+++ /dev/null
@@ -1,164 +0,0 @@
-From e63deec0748ea8d907098217a1692d442ba0d6a2 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 027/111] hw/arm/smmuv3-accel: Add support to issue
- invalidation cmd to host
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [27/111] 5f28f189e1947bf85860a98e0952b5384d73db00 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Provide a helper and use that to issue the invalidation cmd to host SMMUv3.
-We only issue one cmd at a time for now.
-
-Support for batching of commands will be added later after analysing the
-impact.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-20-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 58a789c389cb691c8b25c1a673cfffe49fe93554)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 36 ++++++++++++++++++++++++++++++++++++
- hw/arm/smmuv3-accel.h | 8 ++++++++
- hw/arm/smmuv3.c | 16 ++++++++++++++++
- 3 files changed, 60 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index c6ee123cdf..89dc6f991c 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -233,6 +233,42 @@ bool smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
- return all_ok;
- }
-
-+/*
-+ * This issues the invalidation cmd to the host SMMUv3.
-+ *
-+ * sdev is non-NULL for SID based invalidations (e.g. CFGI_CD), and NULL for
-+ * non SID invalidations such as SMMU_CMD_TLBI_NH_ASID and SMMU_CMD_TLBI_NH_VA.
-+ */
-+bool smmuv3_accel_issue_inv_cmd(SMMUv3State *bs, void *cmd, SMMUDevice *sdev,
-+ Error **errp)
-+{
-+ SMMUv3State *s = ARM_SMMUV3(bs);
-+ SMMUv3AccelState *accel = s->s_accel;
-+ uint32_t entry_num = 1;
-+
-+ /*
-+ * No accel or viommu means no VFIO/IOMMUFD devices, nothing to
-+ * invalidate.
-+ */
-+ if (!accel || !accel->viommu) {
-+ return true;
-+ }
-+
-+ /*
-+ * SID based invalidations (e.g. CFGI_CD) apply only to vfio-pci endpoints
-+ * with a valid vIOMMU vdev.
-+ */
-+ if (sdev && !container_of(sdev, SMMUv3AccelDevice, sdev)->vdev) {
-+ return true;
-+ }
-+
-+ /* Single command (entry_num = 1); no need to check returned entry_num */
-+ return iommufd_backend_invalidate_cache(
-+ accel->viommu->iommufd, accel->viommu->viommu_id,
-+ IOMMU_VIOMMU_INVALIDATE_DATA_ARM_SMMUV3,
-+ sizeof(Cmd), &entry_num, cmd, errp);
-+}
-+
- static bool
- smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- Error **errp)
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index c7ed4dce3a..41b37e3122 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -47,6 +47,8 @@ bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
- bool smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
- Error **errp);
- bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp);
-+bool smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
-+ Error **errp);
- void smmuv3_accel_reset(SMMUv3State *s);
- #else
- static inline void smmuv3_accel_init(SMMUv3State *s)
-@@ -68,6 +70,12 @@ static inline bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp)
- {
- return true;
- }
-+static inline bool
-+smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
-+ Error **errp)
-+{
-+ return true;
-+}
- static inline void smmuv3_accel_reset(SMMUv3State *s)
- {
- }
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index f02e3ee46c..513da966a4 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1388,6 +1388,10 @@ static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp)
-
- trace_smmuv3_cmdq_cfgi_cd(sid);
- smmuv3_flush_config(sdev);
-+ if (!smmuv3_accel_issue_inv_cmd(s, &cmd, sdev, errp)) {
-+ cmd_error = SMMU_CERROR_ILL;
-+ break;
-+ }
- break;
- }
- case SMMU_CMD_TLBI_NH_ASID:
-@@ -1411,6 +1415,10 @@ static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp)
- trace_smmuv3_cmdq_tlbi_nh_asid(asid);
- smmu_inv_notifiers_all(&s->smmu_state);
- smmu_iotlb_inv_asid_vmid(bs, asid, vmid);
-+ if (!smmuv3_accel_issue_inv_cmd(s, &cmd, NULL, errp)) {
-+ cmd_error = SMMU_CERROR_ILL;
-+ break;
-+ }
- break;
- }
- case SMMU_CMD_TLBI_NH_ALL:
-@@ -1438,6 +1446,10 @@ static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp)
- trace_smmuv3_cmdq_tlbi_nsnh();
- smmu_inv_notifiers_all(&s->smmu_state);
- smmu_iotlb_inv_all(bs);
-+ if (!smmuv3_accel_issue_inv_cmd(s, &cmd, NULL, errp)) {
-+ cmd_error = SMMU_CERROR_ILL;
-+ break;
-+ }
- break;
- case SMMU_CMD_TLBI_NH_VAA:
- case SMMU_CMD_TLBI_NH_VA:
-@@ -1446,6 +1458,10 @@ static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp)
- break;
- }
- smmuv3_range_inval(bs, &cmd, SMMU_STAGE_1);
-+ if (!smmuv3_accel_issue_inv_cmd(s, &cmd, NULL, errp)) {
-+ cmd_error = SMMU_CERROR_ILL;
-+ break;
-+ }
- break;
- case SMMU_CMD_TLBI_S12_VMALL:
- {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Add-viommu-free-helper.patch b/kvm-hw-arm-smmuv3-accel-Add-viommu-free-helper.patch
deleted file mode 100644
index 2c6b3a8..0000000
--- a/kvm-hw-arm-smmuv3-accel-Add-viommu-free-helper.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-From bb6023507aee06a4e9c7436425b863fe1088e515 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 6 Mar 2026 09:01:11 +0000
-Subject: [PATCH 051/111] hw/arm/smmuv3-accel: Add viommu free helper
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [51/111] ac43708d52e6d4d84e4d54b0cb955f8518fe35d6 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73796
-
-Move viommu teardown into a helper function and use it from the
-last device removal path.
-
-This groups related cleanup logic in one place and improves readability.
-It also makes it easier to extend the teardown in future, for example
-when freeing related objects such as vEVENTQ.
-
-No functional change.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260226084456.112142-3-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 674d57bf6e26a3ae7076a7ee56e6be90580d5208)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 21 +++++++++++++++------
- 1 file changed, 15 insertions(+), 6 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index f5cd4df336..c19c526fca 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -390,6 +390,20 @@ bool smmuv3_accel_issue_inv_cmd(SMMUv3State *bs, void *cmd, SMMUDevice *sdev,
- sizeof(Cmd), &entry_num, cmd, errp);
- }
-
-+static void smmuv3_accel_free_viommu(SMMUv3AccelState *accel)
-+{
-+ IOMMUFDViommu *viommu = accel->viommu;
-+
-+ if (!viommu) {
-+ return;
-+ }
-+ iommufd_backend_free_id(viommu->iommufd, accel->bypass_hwpt_id);
-+ iommufd_backend_free_id(viommu->iommufd, accel->abort_hwpt_id);
-+ iommufd_backend_free_id(viommu->iommufd, accel->viommu->viommu_id);
-+ g_free(viommu);
-+ accel->viommu = NULL;
-+}
-+
- static bool
- smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- Error **errp)
-@@ -549,12 +563,7 @@ static void smmuv3_accel_unset_iommu_device(PCIBus *bus, void *opaque,
- trace_smmuv3_accel_unset_iommu_device(devfn, idev->devid);
-
- if (QLIST_EMPTY(&accel->device_list)) {
-- iommufd_backend_free_id(accel->viommu->iommufd, accel->bypass_hwpt_id);
-- iommufd_backend_free_id(accel->viommu->iommufd, accel->abort_hwpt_id);
-- iommufd_backend_free_id(accel->viommu->iommufd,
-- accel->viommu->viommu_id);
-- g_free(accel->viommu);
-- accel->viommu = NULL;
-+ smmuv3_accel_free_viommu(accel);
- }
- }
-
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Allocate-vEVENTQ-for-accelerated.patch b/kvm-hw-arm-smmuv3-accel-Allocate-vEVENTQ-for-accelerated.patch
deleted file mode 100644
index 60718fc..0000000
--- a/kvm-hw-arm-smmuv3-accel-Allocate-vEVENTQ-for-accelerated.patch
+++ /dev/null
@@ -1,225 +0,0 @@
-From ad0ae224f8e30f6504181cc9d580422ce204b03a Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Fri, 6 Mar 2026 09:01:11 +0000
-Subject: [PATCH 052/111] hw/arm/smmuv3-accel: Allocate vEVENTQ for accelerated
- SMMUv3 devices
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [52/111] 91c7085fb8f11c45dfde43b0b5aaaac772571282 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73796
-
-When the guest enables the Event Queue and a vIOMMU is present, allocate a
-vEVENTQ object so that host-side events related to the vIOMMU can be
-received and propagated back to the guest.
-
-Allocate a vEVENTQ only when both of the following conditions are met:
-
- 1) The guest SMMUv3 driver has set EVENTQEN = 1 in SMMU_CR0.
- 2) A vIOMMU exists (created when the first VFIO device is attached).
-
-These two conditions may occur in any order.
-
-In the cold-plug case, the vIOMMU already exists before the guest
-driver probes. When the guest sets EVENTQEN = 1 during driver probe,
-the vEVENTQ is allocated at that point.
-
-With hot-plug, the VFIO device may be attached either before or after
-the guest sets EVENTQEN. If the vIOMMU is created first, allocation is
-deferred until EVENTQEN = 1. If EVENTQEN is already set, allocation
-happens when the vIOMMU is created.
-
-In all cases, allocation is triggered when the second required
-condition becomes true.
-
-Errors from command queue consumption and vEVENTQ allocation are reported
-independently as the two operations are unrelated.
-
-Event read and propagation will be added in a later patch.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260226084456.112142-4-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 46f0d48393529cfa3659012971c20f6808eb3b78)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 61 +++++++++++++++++++++++++++++++++++++++++--
- hw/arm/smmuv3-accel.h | 6 +++++
- hw/arm/smmuv3.c | 6 +++++
- 3 files changed, 71 insertions(+), 2 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index c19c526fca..f703ea1aac 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -390,6 +390,19 @@ bool smmuv3_accel_issue_inv_cmd(SMMUv3State *bs, void *cmd, SMMUDevice *sdev,
- sizeof(Cmd), &entry_num, cmd, errp);
- }
-
-+static void smmuv3_accel_free_veventq(SMMUv3AccelState *accel)
-+{
-+ IOMMUFDVeventq *veventq = accel->veventq;
-+
-+ if (!veventq) {
-+ return;
-+ }
-+ close(veventq->veventq_fd);
-+ iommufd_backend_free_id(accel->viommu->iommufd, veventq->veventq_id);
-+ g_free(veventq);
-+ accel->veventq = NULL;
-+}
-+
- static void smmuv3_accel_free_viommu(SMMUv3AccelState *accel)
- {
- IOMMUFDViommu *viommu = accel->viommu;
-@@ -397,6 +410,7 @@ static void smmuv3_accel_free_viommu(SMMUv3AccelState *accel)
- if (!viommu) {
- return;
- }
-+ smmuv3_accel_free_veventq(accel);
- iommufd_backend_free_id(viommu->iommufd, accel->bypass_hwpt_id);
- iommufd_backend_free_id(viommu->iommufd, accel->abort_hwpt_id);
- iommufd_backend_free_id(viommu->iommufd, accel->viommu->viommu_id);
-@@ -404,6 +418,41 @@ static void smmuv3_accel_free_viommu(SMMUv3AccelState *accel)
- accel->viommu = NULL;
- }
-
-+bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp)
-+{
-+ SMMUv3AccelState *accel = s->s_accel;
-+ IOMMUFDVeventq *veventq;
-+ uint32_t veventq_id;
-+ uint32_t veventq_fd;
-+
-+ if (!accel || !accel->viommu) {
-+ return true;
-+ }
-+
-+ if (accel->veventq) {
-+ return true;
-+ }
-+
-+ if (!smmuv3_eventq_enabled(s)) {
-+ return true;
-+ }
-+
-+ if (!iommufd_backend_alloc_veventq(accel->viommu->iommufd,
-+ accel->viommu->viommu_id,
-+ IOMMU_VEVENTQ_TYPE_ARM_SMMUV3,
-+ 1 << s->eventq.log2size, &veventq_id,
-+ &veventq_fd, errp)) {
-+ return false;
-+ }
-+
-+ veventq = g_new0(IOMMUFDVeventq, 1);
-+ veventq->veventq_id = veventq_id;
-+ veventq->veventq_fd = veventq_fd;
-+ veventq->viommu = accel->viommu;
-+ accel->veventq = veventq;
-+ return true;
-+}
-+
- static bool
- smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- Error **errp)
-@@ -429,6 +478,7 @@ smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- viommu->viommu_id = viommu_id;
- viommu->s2_hwpt_id = s2_hwpt_id;
- viommu->iommufd = idev->iommufd;
-+ accel->viommu = viommu;
-
- /*
- * Pre-allocate HWPTs for S1 bypass and abort cases. These will be attached
-@@ -448,14 +498,20 @@ smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- goto free_abort_hwpt;
- }
-
-+ /* Allocate a vEVENTQ if guest has enabled event queue */
-+ if (!smmuv3_accel_alloc_veventq(s, errp)) {
-+ goto free_bypass_hwpt;
-+ }
-+
- /* Attach a HWPT based on SMMUv3 GBPA.ABORT value */
- hwpt_id = smmuv3_accel_gbpa_hwpt(s, accel);
- if (!host_iommu_device_iommufd_attach_hwpt(idev, hwpt_id, errp)) {
-- goto free_bypass_hwpt;
-+ goto free_veventq;
- }
-- accel->viommu = viommu;
- return true;
-
-+free_veventq:
-+ smmuv3_accel_free_veventq(accel);
- free_bypass_hwpt:
- iommufd_backend_free_id(idev->iommufd, accel->bypass_hwpt_id);
- free_abort_hwpt:
-@@ -463,6 +519,7 @@ free_abort_hwpt:
- free_viommu:
- iommufd_backend_free_id(idev->iommufd, viommu->viommu_id);
- g_free(viommu);
-+ accel->viommu = NULL;
- return false;
- }
-
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index a8a64802ec..dba6c71de5 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -22,6 +22,7 @@
- */
- typedef struct SMMUv3AccelState {
- IOMMUFDViommu *viommu;
-+ IOMMUFDVeventq *veventq;
- uint32_t bypass_hwpt_id;
- uint32_t abort_hwpt_id;
- QLIST_HEAD(, SMMUv3AccelDevice) device_list;
-@@ -50,6 +51,7 @@ bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp);
- bool smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
- Error **errp);
- void smmuv3_accel_idr_override(SMMUv3State *s);
-+bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp);
- void smmuv3_accel_reset(SMMUv3State *s);
- #else
- static inline void smmuv3_accel_init(SMMUv3State *s)
-@@ -80,6 +82,10 @@ smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
- static inline void smmuv3_accel_idr_override(SMMUv3State *s)
- {
- }
-+static inline bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp)
-+{
-+ return true;
-+}
- static inline void smmuv3_accel_reset(SMMUv3State *s)
- {
- }
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 49311f5bbf..1a218f749d 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1605,6 +1605,12 @@ static MemTxResult smmu_writel(SMMUv3State *s, hwaddr offset,
- s->cr0ack = data & ~SMMU_CR0_RESERVED;
- /* in case the command queue has been enabled */
- smmuv3_cmdq_consume(s, &local_err);
-+ if (local_err) {
-+ error_report_err(local_err);
-+ local_err = NULL;
-+ }
-+ /* Allocate vEVENTQ if EVENTQ is enabled and a vIOMMU is available */
-+ smmuv3_accel_alloc_veventq(s, &local_err);
- break;
- case A_CR1:
- s->cr[1] = data;
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Change-ats-property-type-to-OnOf.patch b/kvm-hw-arm-smmuv3-accel-Change-ats-property-type-to-OnOf.patch
deleted file mode 100644
index c234126..0000000
--- a/kvm-hw-arm-smmuv3-accel-Change-ats-property-type-to-OnOf.patch
+++ /dev/null
@@ -1,154 +0,0 @@
-From 90c17ee6172d145d3d79e5ffed4f58d6a4747728 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Tue, 24 Mar 2026 14:02:29 +0000
-Subject: [PATCH 058/111] hw/arm/smmuv3-accel: Change "ats" property type to
- OnOffAuto
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [58/111] 0ddc3fd7fce821a980fc30482c6316191d49d300 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-160190
-
-Change accel SMMUv3 ATS property from bool to OnOffAuto. The 'auto'
-value is not implemented, as this commit is meant to set the property
-to the correct type and avoid breaking JSON/QMP when the auto mode is
-introduced. A future patch will implement resolution of the 'auto'
-value to match the host SMMUv3 ATS support.
-
-The conversion of the ATS property type to OnOffAuto is an
-incompatible change for JSON/QMP when a bool value is expected for
-"ats", but the "ats" property is new in 11.0 and this patch is
-submitted as a fix to the property type.
-
-Fixes: f7f5013a55a3 ("hw/arm/smmuv3-accel: Add support for ATS")
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Acked-by: Markus Armbruster <armbru@redhat.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Message-id: 20260323182454.1416110-3-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 9f8a8e0f2c6fd48b4f3759a02b5210cba6a978e3)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 4 +++-
- hw/arm/smmuv3.c | 17 ++++++++++++++---
- hw/arm/virt-acpi-build.c | 2 +-
- include/hw/arm/smmuv3.h | 4 +++-
- 4 files changed, 21 insertions(+), 6 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 2bb142c47f..f21a6a9997 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -827,7 +827,9 @@ void smmuv3_accel_idr_override(SMMUv3State *s)
- s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, s->ril);
-
- /* QEMU SMMUv3 has no ATS. Advertise ATS if opt-in by property */
-- s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ATS, s->ats);
-+ if (s->ats == ON_OFF_AUTO_ON) {
-+ s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ATS, 1);
-+ }
-
- /* Advertise 48-bit OAS in IDR5 when requested (default is 44 bits). */
- if (s->oas == SMMU_OAS_48BIT) {
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index d937f4add5..6f8d093f51 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -317,6 +317,11 @@ static void smmuv3_init_id_regs(SMMUv3State *s)
- smmuv3_accel_idr_override(s);
- }
-
-+bool smmuv3_ats_enabled(SMMUv3State *s)
-+{
-+ return FIELD_EX32(s->idr[0], IDR0, ATS);
-+}
-+
- static void smmuv3_reset(SMMUv3State *s)
- {
- s->cmdq.base = deposit64(s->cmdq.base, 0, 5, SMMU_CMDQS);
-@@ -1966,12 +1971,17 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- }
- #endif
-
-+ if (s->ats == ON_OFF_AUTO_AUTO) {
-+ error_setg(errp, "ats auto mode is not supported");
-+ return false;
-+ }
-+
- if (!s->accel) {
- if (!s->ril) {
- error_setg(errp, "ril can only be disabled if accel=on");
- return false;
- }
-- if (s->ats) {
-+ if (s->ats == ON_OFF_AUTO_ON) {
- error_setg(errp, "ats can only be enabled if accel=on");
- return false;
- }
-@@ -2128,7 +2138,7 @@ static const Property smmuv3_properties[] = {
- DEFINE_PROP_UINT64("msi-gpa", SMMUv3State, msi_gpa, 0),
- /* RIL can be turned off for accel cases */
- DEFINE_PROP_BOOL("ril", SMMUv3State, ril, true),
-- DEFINE_PROP_BOOL("ats", SMMUv3State, ats, false),
-+ DEFINE_PROP_ON_OFF_AUTO("ats", SMMUv3State, ats, ON_OFF_AUTO_OFF),
- DEFINE_PROP_UINT8("oas", SMMUv3State, oas, 44),
- DEFINE_PROP_UINT8("ssidsize", SMMUv3State, ssidsize, 0),
- };
-@@ -2160,7 +2170,8 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- "Disable range invalidation support (for accel=on)");
- object_class_property_set_description(klass, "ats",
- "Enable/disable ATS support (for accel=on). Please ensure host "
-- "platform has ATS support before enabling this");
-+ "platform has ATS support before enabling this. ats=auto is not "
-+ "supported.");
- object_class_property_set_description(klass, "oas",
- "Specify Output Address Size (for accel=on). Supported values "
- "are 44 or 48 bits. Defaults to 44 bits");
-diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
-index 160f1d10e5..b923e965da 100644
---- a/hw/arm/virt-acpi-build.c
-+++ b/hw/arm/virt-acpi-build.c
-@@ -408,7 +408,7 @@ static int iort_smmuv3_devices(Object *obj, void *opaque)
-
- bus = PCI_BUS(object_property_get_link(obj, "primary-bus", &error_abort));
- sdev.accel = object_property_get_bool(obj, "accel", &error_abort);
-- sdev.ats = object_property_get_bool(obj, "ats", &error_abort);
-+ sdev.ats = smmuv3_ats_enabled(ARM_SMMUV3(obj));
- pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
- sbdev = SYS_BUS_DEVICE(obj);
- sdev.base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index 26b2fc42fd..ce51a5b9b4 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -70,7 +70,7 @@ struct SMMUv3State {
- uint64_t msi_gpa;
- Error *migration_blocker;
- bool ril;
-- bool ats;
-+ OnOffAuto ats;
- uint8_t oas;
- uint8_t ssidsize;
- };
-@@ -91,6 +91,8 @@ struct SMMUv3Class {
- ResettablePhases parent_phases;
- };
-
-+bool smmuv3_ats_enabled(struct SMMUv3State *s);
-+
- #define TYPE_ARM_SMMUV3 "arm-smmuv3"
- OBJECT_DECLARE_TYPE(SMMUv3State, SMMUv3Class, ARM_SMMUV3)
-
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Change-oas-property-type-to-OasM.patch b/kvm-hw-arm-smmuv3-accel-Change-oas-property-type-to-OasM.patch
deleted file mode 100644
index 90e823f..0000000
--- a/kvm-hw-arm-smmuv3-accel-Change-oas-property-type-to-OasM.patch
+++ /dev/null
@@ -1,145 +0,0 @@
-From 9756413223d749c334e823d885e7a88c6781f2c6 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Tue, 24 Mar 2026 14:02:30 +0000
-Subject: [PATCH 063/111] hw/arm/smmuv3-accel: Change "oas" property type to
- OasMode
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [63/111] d86f2fd1e98a85b59690c130b71eb79cedd1686a (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-160190
-
-Change accel SMMUv3 OAS property from uint8_t to OasMode. The
-'auto' value is not implemented, as this commit is meant to
-set the property to the correct type and avoid breaking JSON/QMP
-when the auto mode is introduced. A future patch will implement
-resolution of 'auto' value to match the host SMMUv3 OAS value.
-
-The conversion of the "oas" property type to OnOffAuto is an
-incompatible change for JSON/QMP when a uint8_t value is expected for
-"oas", but this property is new in 11.0 and this patch is
-submitted as a fix to the property type.
-
-Fixes: a015ac990fd3 ("hw/arm/smmuv3-accel: Add property to specify OAS bits")
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Acked-by: Markus Armbruster <armbru@redhat.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Message-id: 20260323182454.1416110-8-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit c2ff1305cc7da7cd4596f4409936f25489ea0397)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 2 +-
- hw/arm/smmuv3.c | 17 +++++++++--------
- include/hw/arm/smmuv3-common.h | 2 --
- include/hw/arm/smmuv3.h | 2 +-
- 4 files changed, 11 insertions(+), 12 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index bc6cbfebc2..65c2f44880 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -850,7 +850,7 @@ void smmuv3_accel_idr_override(SMMUv3State *s)
- }
-
- /* Advertise 48-bit OAS in IDR5 when requested (default is 44 bits). */
-- if (s->oas == SMMU_OAS_48BIT) {
-+ if (s->oas == OAS_MODE_48) {
- s->idr[5] = FIELD_DP32(s->idr[5], IDR5, OAS, SMMU_IDR5_OAS_48);
- }
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 66546dbf9e..7951d85ec9 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1984,6 +1984,11 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- error_setg(errp, "ssidsize auto mode is not supported");
- return false;
- }
-+ if (s->oas != OAS_MODE_44 && s->oas != OAS_MODE_48) {
-+ error_setg(errp, "QEMU SMMUv3 model only implements 44 and 48 bit"
-+ "OAS; other OasMode values are not supported");
-+ return false;
-+ }
-
- if (!s->accel) {
- if (s->ril == ON_OFF_AUTO_OFF) {
-@@ -1994,7 +1999,7 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- error_setg(errp, "ats can only be enabled if accel=on");
- return false;
- }
-- if (s->oas != SMMU_OAS_44BIT) {
-+ if (s->oas > OAS_MODE_44) {
- error_setg(errp, "OAS must be 44 bits when accel=off");
- return false;
- }
-@@ -2012,11 +2017,6 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- return false;
- }
-
-- if (s->oas != SMMU_OAS_44BIT && s->oas != SMMU_OAS_48BIT) {
-- error_setg(errp, "OAS can only be set to 44 or 48 bits");
-- return false;
-- }
--
- return true;
- }
-
-@@ -2143,7 +2143,7 @@ static const Property smmuv3_properties[] = {
- /* RIL can be turned off for accel cases */
- DEFINE_PROP_ON_OFF_AUTO("ril", SMMUv3State, ril, ON_OFF_AUTO_ON),
- DEFINE_PROP_ON_OFF_AUTO("ats", SMMUv3State, ats, ON_OFF_AUTO_OFF),
-- DEFINE_PROP_UINT8("oas", SMMUv3State, oas, 44),
-+ DEFINE_PROP_OAS_MODE("oas", SMMUv3State, oas, OAS_MODE_44),
- DEFINE_PROP_SSIDSIZE_MODE("ssidsize", SMMUv3State, ssidsize,
- SSID_SIZE_MODE_0),
- };
-@@ -2180,7 +2180,8 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- "supported.");
- object_class_property_set_description(klass, "oas",
- "Specify Output Address Size (for accel=on). Supported values "
-- "are 44 or 48 bits. Defaults to 44 bits");
-+ "are 44 or 48 bits. Defaults to 44 bits. oas=auto is not "
-+ "supported.");
- object_class_property_set_description(klass, "ssidsize",
- "Number of bits used to represent SubstreamIDs (SSIDs). "
- "A value of N allows SSIDs in the range [0 .. 2^N - 1]. "
-diff --git a/include/hw/arm/smmuv3-common.h b/include/hw/arm/smmuv3-common.h
-index 75464b2f91..b4557d117f 100644
---- a/include/hw/arm/smmuv3-common.h
-+++ b/include/hw/arm/smmuv3-common.h
-@@ -342,8 +342,6 @@ REG32(IDR5, 0x14)
- FIELD(IDR5, VAX, 10, 2);
- FIELD(IDR5, STALL_MAX, 16, 16);
-
--#define SMMU_OAS_44BIT 44
--#define SMMU_OAS_48BIT 48
- #define SMMU_IDR5_OAS_44 4
- #define SMMU_IDR5_OAS_48 5
-
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index ddf472493d..82f18eb090 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -72,7 +72,7 @@ struct SMMUv3State {
- Error *migration_blocker;
- OnOffAuto ril;
- OnOffAuto ats;
-- uint8_t oas;
-+ OasMode oas;
- SsidSizeMode ssidsize;
- };
-
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Change-ril-property-type-to-OnOf.patch b/kvm-hw-arm-smmuv3-accel-Change-ril-property-type-to-OnOf.patch
deleted file mode 100644
index 4cbf3bb..0000000
--- a/kvm-hw-arm-smmuv3-accel-Change-ril-property-type-to-OnOf.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-From f48e038a50505883038433a91158ae70f4ddaf49 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Tue, 24 Mar 2026 14:02:29 +0000
-Subject: [PATCH 059/111] hw/arm/smmuv3-accel: Change "ril" property type to
- OnOffAuto
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [59/111] 91f6258e9a17ae761f0eb9444ce3caa65e9d2e0f (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-160190
-
-Change accel SMMUv3 RIL property from bool to OnOffAuto. The 'auto'
-value is not implemented, as this commit is meant to set the property
-to the correct type and avoid breaking JSON/QMP when the auto mode is
-introduced. A future patch will implement resolution of the 'auto'
-value to match the host SMMUv3 RIL support.
-
-The conversion of the RIL property type to OnOffAuto is an
-incompatible change for JSON/QMP when a bool value is expected for
-"ril", but the "ril" property is new in 11.0 and this patch is
-submitted as a fix to the property type.
-
-Fixes: bd715ff5bda9 ("hw/arm/smmuv3-accel: Add a property to specify RIL support")
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Acked-by: Markus Armbruster <armbru@redhat.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Message-id: 20260323182454.1416110-4-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 1a76cc39333c7870ee34075c2295a28e53d1b1ba)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 6 ++++--
- hw/arm/smmuv3.c | 11 ++++++++---
- include/hw/arm/smmuv3.h | 2 +-
- 3 files changed, 13 insertions(+), 6 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index f21a6a9997..c31b64295e 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -823,8 +823,10 @@ void smmuv3_accel_idr_override(SMMUv3State *s)
- return;
- }
-
-- /* By default QEMU SMMUv3 has RIL. Update IDR3 if user has disabled it */
-- s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, s->ril);
-+ /* Only override RIL if user explicitly set OFF */
-+ if (s->ril == ON_OFF_AUTO_OFF) {
-+ s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, 0);
-+ }
-
- /* QEMU SMMUv3 has no ATS. Advertise ATS if opt-in by property */
- if (s->ats == ON_OFF_AUTO_ON) {
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 6f8d093f51..a7e606c966 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1975,9 +1975,13 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- error_setg(errp, "ats auto mode is not supported");
- return false;
- }
-+ if (s->ril == ON_OFF_AUTO_AUTO) {
-+ error_setg(errp, "ril auto mode is not supported");
-+ return false;
-+ }
-
- if (!s->accel) {
-- if (!s->ril) {
-+ if (s->ril == ON_OFF_AUTO_OFF) {
- error_setg(errp, "ril can only be disabled if accel=on");
- return false;
- }
-@@ -2137,7 +2141,7 @@ static const Property smmuv3_properties[] = {
- /* GPA of MSI doorbell, for SMMUv3 accel use. */
- DEFINE_PROP_UINT64("msi-gpa", SMMUv3State, msi_gpa, 0),
- /* RIL can be turned off for accel cases */
-- DEFINE_PROP_BOOL("ril", SMMUv3State, ril, true),
-+ DEFINE_PROP_ON_OFF_AUTO("ril", SMMUv3State, ril, ON_OFF_AUTO_ON),
- DEFINE_PROP_ON_OFF_AUTO("ats", SMMUv3State, ats, ON_OFF_AUTO_OFF),
- DEFINE_PROP_UINT8("oas", SMMUv3State, oas, 44),
- DEFINE_PROP_UINT8("ssidsize", SMMUv3State, ssidsize, 0),
-@@ -2167,7 +2171,8 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- "Enable SMMUv3 accelerator support. Allows host SMMUv3 to be "
- "configured in nested mode for vfio-pci dev assignment");
- object_class_property_set_description(klass, "ril",
-- "Disable range invalidation support (for accel=on)");
-+ "Disable range invalidation support (for accel=on). ril=auto "
-+ "is not supported.");
- object_class_property_set_description(klass, "ats",
- "Enable/disable ATS support (for accel=on). Please ensure host "
- "platform has ATS support before enabling this. ats=auto is not "
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index ce51a5b9b4..c35e599bbc 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -69,7 +69,7 @@ struct SMMUv3State {
- struct SMMUv3AccelState *s_accel;
- uint64_t msi_gpa;
- Error *migration_blocker;
-- bool ril;
-+ OnOffAuto ril;
- OnOffAuto ats;
- uint8_t oas;
- uint8_t ssidsize;
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Change-ssidsize-property-type-to.patch b/kvm-hw-arm-smmuv3-accel-Change-ssidsize-property-type-to.patch
deleted file mode 100644
index 8d960a8..0000000
--- a/kvm-hw-arm-smmuv3-accel-Change-ssidsize-property-type-to.patch
+++ /dev/null
@@ -1,206 +0,0 @@
-From 034bb0700695cd0f3dac66a04549cf149b1bb923 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Tue, 24 Mar 2026 14:02:29 +0000
-Subject: [PATCH 061/111] hw/arm/smmuv3-accel: Change "ssidsize" property type
- to SsidSizeMode
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [61/111] ba4a1f1758a7a13d36cac6881fa52d97a5fdef09 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-160190
-
-Conflicts: contextual conflict in hw/arm/smmuv3.c because we keep on
-using headers in hw directory and not in hw/core
-
-Change accel SMMUv3 SSIDSIZE property from uint8_t to SsidSizeMode.
-The 'auto' value is not implemented, as this commit is meant to set the
-property to the correct type and avoid breaking JSON/QMP when the auto
-mode is introduced. A future patch will implement resolution of 'auto'
-value to match the host SMMUv3 SSIDSIZE value.
-
-The conversion of the "ssidsize" property type to OnOffAuto is an
-incompatible change for JSON/QMP when a uint8_t value is expected for
-"ssidsize", but this property is new in 11.0 and this patch is
-submitted as a fix to the property type.
-
-Fixes: b8c6f8a69d27 ("hw/arm/smmuv3-accel: Make SubstreamID support configurable")
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Acked-by: Markus Armbruster <armbru@redhat.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Message-id: 20260323182454.1416110-6-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit ffded86bdda6171fea1771199f3f0c9e0601029f)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 23 +++++++++++++++++++++--
- hw/arm/smmuv3.c | 19 ++++++++++---------
- include/hw/arm/smmuv3-common.h | 1 -
- include/hw/arm/smmuv3.h | 3 ++-
- 4 files changed, 33 insertions(+), 13 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index c31b64295e..bc6cbfebc2 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -802,7 +802,7 @@ static uint64_t smmuv3_accel_get_viommu_flags(void *opaque)
- SMMUState *bs = opaque;
- SMMUv3State *s = ARM_SMMUV3(bs);
-
-- if (s->ssidsize) {
-+ if (s->ssidsize > SSID_SIZE_MODE_0) {
- flags |= VIOMMU_FLAG_PASID_SUPPORTED;
- }
- return flags;
-@@ -817,6 +817,22 @@ static const PCIIOMMUOps smmuv3_accel_ops = {
- .get_msi_direct_gpa = smmuv3_accel_get_msi_gpa,
- };
-
-+/*
-+ * This returns the value of a SsidSizeMode value offset by 1 to
-+ * account for the enum values offset by 1 from actual values.
-+ *
-+ * SSID_SIZE_MODE_0 = 1, SSID_SIZE_MODE_1 = 2, etc. so return 0
-+ * if SSID_SIZE_MODE_0 is passed as input, return 1 if
-+ * SSID_SIZE_MODE_1 is passed as input, etc.
-+ */
-+static uint8_t ssidsize_mode_to_value(SsidSizeMode mode)
-+{
-+ if (mode == SSID_SIZE_MODE_AUTO) {
-+ return 0;
-+ }
-+ return mode - 1;
-+}
-+
- void smmuv3_accel_idr_override(SMMUv3State *s)
- {
- if (!s->accel) {
-@@ -842,7 +858,10 @@ void smmuv3_accel_idr_override(SMMUv3State *s)
- * By default QEMU SMMUv3 has no SubstreamID support. Update IDR1 if user
- * has enabled it.
- */
-- s->idr[1] = FIELD_DP32(s->idr[1], IDR1, SSIDSIZE, s->ssidsize);
-+ if (s->ssidsize > SSID_SIZE_MODE_0) {
-+ s->idr[1] = FIELD_DP32(s->idr[1], IDR1, SSIDSIZE,
-+ ssidsize_mode_to_value(s->ssidsize));
-+ }
- }
-
- /* Based on SMUUv3 GPBA.ABORT configuration, attach a corresponding HWPT */
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index a7e606c966..66546dbf9e 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -20,6 +20,7 @@
- #include "qemu/bitops.h"
- #include "hw/irq.h"
- #include "hw/sysbus.h"
-+#include "hw/qdev-properties-system.h"
- #include "migration/blocker.h"
- #include "migration/vmstate.h"
- #include "hw/qdev-properties.h"
-@@ -625,7 +626,7 @@ static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg,
- }
-
- /* Multiple context descriptors require SubstreamID support */
-- if (!s->ssidsize && STE_S1CDMAX(ste) != 0) {
-+ if (s->ssidsize == SSID_SIZE_MODE_0 && STE_S1CDMAX(ste) != 0) {
- qemu_log_mask(LOG_UNIMP,
- "SMMUv3: multiple S1 context descriptors require SubstreamID support. "
- "Configure ssidsize > 0 (requires accel=on)\n");
-@@ -1979,6 +1980,10 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- error_setg(errp, "ril auto mode is not supported");
- return false;
- }
-+ if (s->ssidsize == SSID_SIZE_MODE_AUTO) {
-+ error_setg(errp, "ssidsize auto mode is not supported");
-+ return false;
-+ }
-
- if (!s->accel) {
- if (s->ril == ON_OFF_AUTO_OFF) {
-@@ -1993,7 +1998,7 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- error_setg(errp, "OAS must be 44 bits when accel=off");
- return false;
- }
-- if (s->ssidsize) {
-+ if (s->ssidsize > SSID_SIZE_MODE_0) {
- error_setg(errp, "ssidsize can only be set if accel=on");
- return false;
- }
-@@ -2011,11 +2016,6 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- error_setg(errp, "OAS can only be set to 44 or 48 bits");
- return false;
- }
-- if (s->ssidsize > SMMU_SSID_MAX_BITS) {
-- error_setg(errp, "ssidsize must be in the range 0 to %d",
-- SMMU_SSID_MAX_BITS);
-- return false;
-- }
-
- return true;
- }
-@@ -2144,7 +2144,8 @@ static const Property smmuv3_properties[] = {
- DEFINE_PROP_ON_OFF_AUTO("ril", SMMUv3State, ril, ON_OFF_AUTO_ON),
- DEFINE_PROP_ON_OFF_AUTO("ats", SMMUv3State, ats, ON_OFF_AUTO_OFF),
- DEFINE_PROP_UINT8("oas", SMMUv3State, oas, 44),
-- DEFINE_PROP_UINT8("ssidsize", SMMUv3State, ssidsize, 0),
-+ DEFINE_PROP_SSIDSIZE_MODE("ssidsize", SMMUv3State, ssidsize,
-+ SSID_SIZE_MODE_0),
- };
-
- static void smmuv3_instance_init(Object *obj)
-@@ -2185,7 +2186,7 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- "A value of N allows SSIDs in the range [0 .. 2^N - 1]. "
- "Valid range is 0-20, where 0 disables SubstreamID support. "
- "Defaults to 0. A value greater than 0 is required to enable "
-- "PASID support.");
-+ "PASID support. ssidsize=auto is not supported.");
- }
-
- static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
-diff --git a/include/hw/arm/smmuv3-common.h b/include/hw/arm/smmuv3-common.h
-index f1d74d6832..75464b2f91 100644
---- a/include/hw/arm/smmuv3-common.h
-+++ b/include/hw/arm/smmuv3-common.h
-@@ -311,7 +311,6 @@ REG32(IDR1, 0x4)
- FIELD(IDR1, TABLES_PRESET, 30, 1)
- FIELD(IDR1, ECMDQ, 31, 1)
-
--#define SMMU_SSID_MAX_BITS 20
- #define SMMU_IDR1_SIDSIZE 16
- #define SMMU_CMDQS 19
- #define SMMU_EVENTQS 19
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index c35e599bbc..ddf472493d 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -21,6 +21,7 @@
-
- #include "hw/arm/smmu-common.h"
- #include "qom/object.h"
-+#include "qapi/qapi-types-misc-arm.h"
-
- #define TYPE_SMMUV3_IOMMU_MEMORY_REGION "smmuv3-iommu-memory-region"
-
-@@ -72,7 +73,7 @@ struct SMMUv3State {
- OnOffAuto ril;
- OnOffAuto ats;
- uint8_t oas;
-- uint8_t ssidsize;
-+ SsidSizeMode ssidsize;
- };
-
- typedef enum {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Check-ATS-compatibility-between-.patch b/kvm-hw-arm-smmuv3-accel-Check-ATS-compatibility-between-.patch
deleted file mode 100644
index 768cce9..0000000
--- a/kvm-hw-arm-smmuv3-accel-Check-ATS-compatibility-between-.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 376ff3d65cb420c0629ecead6acefa3c17d127b5 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Tue, 24 Mar 2026 14:02:29 +0000
-Subject: [PATCH 057/111] hw/arm/smmuv3-accel: Check ATS compatibility between
- host and guest
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [57/111] 63d0ca91b471cb66464226e104162e0fc9d2a19c (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-160190
-
-Compare the host SMMUv3 ATS support bit with the guest SMMUv3 ATS support
-bit in IDR0 and fail the compatibility check if ATS support is opted as
-enabled on the guest SMMUv3 when it is not supported on host SMMUv3.
-
-Fixes: f7f5013a55a3 ("hw/arm/smmuv3-accel: Add support for ATS")
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Message-id: 20260323182454.1416110-2-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit dc86d45232444e75f1b4569fada0a73b5dc209b4)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 17306cd04b..2bb142c47f 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -101,6 +101,12 @@ smmuv3_accel_check_hw_compatible(SMMUv3State *s,
- smmuv3_oas_bits(FIELD_EX32(s->idr[5], IDR5, OAS)));
- return false;
- }
-+ /* Check ATS value opted is compatible with Host SMMUv3 */
-+ if (FIELD_EX32(info->idr[0], IDR0, ATS) <
-+ FIELD_EX32(s->idr[0], IDR0, ATS)) {
-+ error_setg(errp, "Host SMMUv3 doesn't support Address Translation Services");
-+ return false;
-+ }
-
- /* QEMU SMMUv3 supports GRAN4K/GRAN16K/GRAN64K translation granules */
- if (FIELD_EX32(info->idr[5], IDR5, GRAN4K) !=
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Enforce-viommu-association-when-.patch b/kvm-hw-arm-smmuv3-accel-Enforce-viommu-association-when-.patch
deleted file mode 100644
index a4efc9c..0000000
--- a/kvm-hw-arm-smmuv3-accel-Enforce-viommu-association-when-.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From e5129f70e077c23e44e1a37c5f99fc8e9fdc6bdb Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:50 +0100
-Subject: [PATCH 108/111] hw/arm/smmuv3-accel: Enforce viommu association when
- CMDQV is active
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [108/111] 0f6e9ec6a9a3eecfdb80bd6db4c630cccbdb07fd (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-When CMDQV is active, the first cold-plugged VFIO device establishes
-the viommu to host SMMUv3 association, and the guest's boot-time CMDQV
-configuration (VINTFs, VCMDQs) is built on top of that association.
-
-Hot-unplugging that device would release the viommu and tear down all
-CMDQV state. Hot-plugging another device behind a different host
-SMMUv3+CMDQV would then re-bind the same vSMMUv3 to new host hardware,
-while the guest keeps using its boot-time configuration and ends up
-issuing commands to the wrong host. Block hot-unplug of the
-establishing device to avoid this; retaining the binding across unplug
-is non-trivial and not required by any current use case.
-
-Also abort at machine_done if cmdqv=on is requested but no cold-plugged
-VFIO device was present to initialize it.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-30-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 4435853689e245a8bfec9eb92fd84f3904d60d47)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 18 ++++++++++++++++++
- hw/arm/smmuv3-accel.h | 1 +
- 2 files changed, 19 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 9c3bd4413d..80900c2521 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -759,6 +759,18 @@ static bool smmuv3_accel_set_iommu_device(PCIBus *bus, void *opaque, int devfn,
- return false;
- }
-
-+ /*
-+ * CMDQV is active: block hot-unplug of the device that established the
-+ * viommu association. Removing it would cause the vIOMMU to host SMMUv3
-+ * association be changed via device hot-plug.
-+ */
-+ if (s->s_accel->cmdqv_ops) {
-+ PCIDevice *pdev = pci_find_device(bus, pci_bus_num(bus), devfn);
-+ error_setg(&accel_dev->unplug_blocker,
-+ "CMDQV is active: removing the device that established the "
-+ "viommu association would break the guest CMDQV");
-+ qdev_add_unplug_blocker(DEVICE(pdev), accel_dev->unplug_blocker);
-+ }
- done:
- accel_dev->hiodi = hiodi;
- accel_dev->s_accel = s->s_accel;
-@@ -1082,6 +1094,12 @@ static void smmuv3_accel_machine_done(Notifier *notifier, void *data)
- "at least one cold-plugged VFIO device");
- exit(1);
- }
-+
-+ if (s->cmdqv == ON_OFF_AUTO_ON && !accel->cmdqv) {
-+ error_report("arm-smmuv3 cmdqv=on requires at least one cold-plugged "
-+ "VFIO device");
-+ exit(1);
-+ }
- }
-
- bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index 5fc85fb89d..dd755c394d 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -84,6 +84,7 @@ typedef struct SMMUv3AccelDevice {
- IOMMUFDVdev *vdev;
- QLIST_ENTRY(SMMUv3AccelDevice) next;
- SMMUv3AccelState *s_accel;
-+ Error *unplug_blocker; /* set when CMDQV is active to block hot-unplug */
- } SMMUv3AccelDevice;
-
- bool smmuv3_accel_init(SMMUv3State *s, Error **errp);
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Get-host-SMMUv3-hw-info-and-vali.patch b/kvm-hw-arm-smmuv3-accel-Get-host-SMMUv3-hw-info-and-vali.patch
deleted file mode 100644
index ee1a906..0000000
--- a/kvm-hw-arm-smmuv3-accel-Get-host-SMMUv3-hw-info-and-vali.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-From 074db18ed80a05411b4156620537b1255ecab3a7 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 029/111] hw/arm/smmuv3-accel: Get host SMMUv3 hw info and
- validate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [29/111] 154dbf7600fabd9f8b373ffd5443cc9091e1bb95 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Just before the device gets attached to the SMMUv3, make sure QEMU SMMUv3
-features are compatible with the host SMMUv3.
-
-Not all fields in the host SMMUv3 IDR registers are meaningful for userspace.
-Only the following fields can be used:
-
- - IDR0: ST_LEVEL, TERM_MODEL, STALL_MODEL, TTENDIAN, CD2L, ASID16, TTF
- - IDR1: SIDSIZE, SSIDSIZE
- - IDR3: BBML, RIL
- - IDR5: VAX, GRAN64K, GRAN16K, GRAN4K
-
-For now, the check is to make sure the features are in sync to enable
-basic accelerated SMMUv3 support. AIDR is not checked, as hardware
-implementations often provide a mix of architecture features regardless
-of the revision reported in AIDR.
-
-Note that SSIDSIZE check will be added later when support for PASID is
-introduced.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-22-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit ad32238ad26bcaa6293742dd712782425253b6fe)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 101 ++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 101 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 89dc6f991c..33011962e3 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -27,6 +27,99 @@
- static MemoryRegion root, sysmem;
- static AddressSpace *shared_as_sysmem;
-
-+static bool
-+smmuv3_accel_check_hw_compatible(SMMUv3State *s,
-+ struct iommu_hw_info_arm_smmuv3 *info,
-+ Error **errp)
-+{
-+ /* QEMU SMMUv3 supports both linear and 2-level stream tables */
-+ if (FIELD_EX32(info->idr[0], IDR0, STLEVEL) !=
-+ FIELD_EX32(s->idr[0], IDR0, STLEVEL)) {
-+ error_setg(errp, "Host SMMUv3 Stream Table format mismatch "
-+ "(host STLEVEL=%u, QEMU STLEVEL=%u)",
-+ FIELD_EX32(info->idr[0], IDR0, STLEVEL),
-+ FIELD_EX32(s->idr[0], IDR0, STLEVEL));
-+ return false;
-+ }
-+
-+ /* QEMU SMMUv3 supports only little-endian translation table walks */
-+ if (FIELD_EX32(info->idr[0], IDR0, TTENDIAN) >
-+ FIELD_EX32(s->idr[0], IDR0, TTENDIAN)) {
-+ error_setg(errp, "Host SMMUv3 doesn't support Little-endian "
-+ "translation table");
-+ return false;
-+ }
-+
-+ /* QEMU SMMUv3 supports only AArch64 translation table format */
-+ if (FIELD_EX32(info->idr[0], IDR0, TTF) <
-+ FIELD_EX32(s->idr[0], IDR0, TTF)) {
-+ error_setg(errp, "Host SMMUv3 doesn't support AArch64 translation "
-+ "table format");
-+ return false;
-+ }
-+
-+ /* QEMU SMMUv3 supports SIDSIZE 16 */
-+ if (FIELD_EX32(info->idr[1], IDR1, SIDSIZE) <
-+ FIELD_EX32(s->idr[1], IDR1, SIDSIZE)) {
-+ error_setg(errp, "Host SMMUv3 SIDSIZE not compatible "
-+ "(host=%u, QEMU=%u)",
-+ FIELD_EX32(info->idr[1], IDR1, SIDSIZE),
-+ FIELD_EX32(s->idr[1], IDR1, SIDSIZE));
-+ return false;
-+ }
-+
-+ /* QEMU SMMUv3 supports Range Invalidation by default */
-+ if (FIELD_EX32(info->idr[3], IDR3, RIL) !=
-+ FIELD_EX32(s->idr[3], IDR3, RIL)) {
-+ error_setg(errp, "Host SMMUv3 doesn't support Range Invalidation");
-+ return false;
-+ }
-+
-+ /* QEMU SMMUv3 supports GRAN4K/GRAN16K/GRAN64K translation granules */
-+ if (FIELD_EX32(info->idr[5], IDR5, GRAN4K) !=
-+ FIELD_EX32(s->idr[5], IDR5, GRAN4K)) {
-+ error_setg(errp, "Host SMMUv3 doesn't support 4K translation granule");
-+ return false;
-+ }
-+ if (FIELD_EX32(info->idr[5], IDR5, GRAN16K) !=
-+ FIELD_EX32(s->idr[5], IDR5, GRAN16K)) {
-+ error_setg(errp, "Host SMMUv3 doesn't support 16K translation granule");
-+ return false;
-+ }
-+ if (FIELD_EX32(info->idr[5], IDR5, GRAN64K) !=
-+ FIELD_EX32(s->idr[5], IDR5, GRAN64K)) {
-+ error_setg(errp, "Host SMMUv3 doesn't support 64K translation granule");
-+ return false;
-+ }
-+
-+ return true;
-+}
-+
-+static bool
-+smmuv3_accel_hw_compatible(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
-+ Error **errp)
-+{
-+ struct iommu_hw_info_arm_smmuv3 info;
-+ uint32_t data_type;
-+ uint64_t caps;
-+
-+ if (!iommufd_backend_get_device_info(idev->iommufd, idev->devid, &data_type,
-+ &info, sizeof(info), &caps, errp)) {
-+ return false;
-+ }
-+
-+ if (data_type != IOMMU_HW_INFO_TYPE_ARM_SMMUV3) {
-+ error_setg(errp, "Wrong data type (%d) for Host SMMUv3 device info",
-+ data_type);
-+ return false;
-+ }
-+
-+ if (!smmuv3_accel_check_hw_compatible(s, &info, errp)) {
-+ return false;
-+ }
-+ return true;
-+}
-+
- static SMMUv3AccelDevice *smmuv3_accel_get_dev(SMMUState *bs, SMMUPciBus *sbus,
- PCIBus *bus, int devfn)
- {
-@@ -353,6 +446,14 @@ static bool smmuv3_accel_set_iommu_device(PCIBus *bus, void *opaque, int devfn,
- return true;
- }
-
-+ /*
-+ * Check the host SMMUv3 associated with the dev is compatible with the
-+ * QEMU SMMUv3 accel.
-+ */
-+ if (!smmuv3_accel_hw_compatible(s, idev, errp)) {
-+ return false;
-+ }
-+
- if (s->s_accel->viommu) {
- goto done;
- }
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-ats.patch b/kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-ats.patch
deleted file mode 100644
index a4f84be..0000000
--- a/kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-ats.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From ac95c83d843a5e7d06abbc173fb1b5ebeb938540 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Mon, 8 Jun 2026 10:48:55 -0700
-Subject: [PATCH 069/111] hw/arm/smmuv3-accel: Implement "auto" value for "ats"
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [69/111] 101e6549edfef8b539367d77ad887875abdd1b49 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-163596
-
-Allow accelerated SMMUv3 Address Translation Services support property
-to be derived from host IOMMU capabilities. Derive host values using
-IOMMU_GET_HW_INFO, retrieving ATS capability from IDR0.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260608174900.2227340-5-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 7e88c1a9d0f99f42a652e0af856b903e038b38cb)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 9 +++++++++
- hw/arm/smmuv3.c | 11 ++++-------
- 2 files changed, 13 insertions(+), 7 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index e625f145c4..e03b0883af 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -53,6 +53,11 @@ static void smmuv3_accel_auto_finalise(SMMUv3State *s,
- return;
- }
-
-+ if (s->ats == ON_OFF_AUTO_AUTO) {
-+ s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ATS,
-+ FIELD_EX32(info->idr[0], IDR0, ATS));
-+ }
-+
- accel->auto_finalised = true;
- }
-
-@@ -960,6 +965,10 @@ bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
- bs->iommu_ops = &smmuv3_accel_ops;
- smmuv3_accel_as_init(s);
-
-+ if (s->ats == ON_OFF_AUTO_AUTO) {
-+ s->s_accel->auto_mode = true;
-+ }
-+
- if (s->s_accel->auto_mode) {
- s->machine_done.notify = smmuv3_accel_machine_done;
- qemu_add_machine_init_done_notifier(&s->machine_done);
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index f76a527182..e2071938c0 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1965,10 +1965,6 @@ static void smmu_reset_exit(Object *obj, ResetType type)
-
- static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- {
-- if (s->ats == ON_OFF_AUTO_AUTO) {
-- error_setg(errp, "ats auto mode is not supported");
-- return false;
-- }
- if (s->ril == ON_OFF_AUTO_AUTO) {
- error_setg(errp, "ril auto mode is not supported");
- return false;
-@@ -2172,9 +2168,10 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- "Disable range invalidation support (for accel=on). ril=auto "
- "is not supported.");
- object_class_property_set_description(klass, "ats",
-- "Enable/disable ATS support (for accel=on). Please ensure host "
-- "platform has ATS support before enabling this. ats=auto is not "
-- "supported.");
-+ "Enable/disable ATS support (for accel=on). "
-+ "Valid values are on, off, and auto. Defaults to off. "
-+ "Please ensure host platform supports ATS before setting it "
-+ "to on.");
- object_class_property_set_description(klass, "oas",
- "Specify Output Address Size (for accel=on). Supported values "
- "are 44 or 48 bits. Defaults to 44 bits. oas=auto is not "
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-oas.patch b/kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-oas.patch
deleted file mode 100644
index c5d97ea..0000000
--- a/kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-oas.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-From ace86d844117aa4f39ad165b61fc92090c5201f3 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Mon, 8 Jun 2026 10:48:58 -0700
-Subject: [PATCH 072/111] hw/arm/smmuv3-accel: Implement "auto" value for "oas"
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [72/111] 20acbc3ce50f8a38e8009254c891b1d80d7a3c8a (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-163596
-
-Allow accelerated SMMUv3 OAS property to be derived from host IOMMU
-capabilities. Derive host values using IOMMU_GET_HW_INFO, retrieving
-OAS from IDR5.
-
-This keeps the OAS value advertised by the virtual SMMU compatible with
-the capabilities of the host SMMUv3, so that the intermediate physical
-addresses (IPA) consumed by host SMMU for stage-2 translation do not
-exceed the host's max supported IPA size.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260608174900.2227340-8-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 86ec6639b18cafab2e23cd10c50f4b27597c4a9b)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 8 +++++++-
- hw/arm/smmuv3.c | 17 ++++++++++-------
- 2 files changed, 17 insertions(+), 8 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 182676157d..0b01848292 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -68,6 +68,11 @@ static void smmuv3_accel_auto_finalise(SMMUv3State *s,
- FIELD_EX32(info->idr[1], IDR1, SSIDSIZE));
- }
-
-+ if (s->oas == OAS_MODE_AUTO) {
-+ s->idr[5] = FIELD_DP32(s->idr[5], IDR5, OAS,
-+ FIELD_EX32(info->idr[5], IDR5, OAS));
-+ }
-+
- accel->auto_finalised = true;
- }
-
-@@ -984,7 +989,8 @@ bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
-
- if (s->ats == ON_OFF_AUTO_AUTO ||
- s->ril == ON_OFF_AUTO_AUTO ||
-- s->ssidsize == SSID_SIZE_MODE_AUTO) {
-+ s->ssidsize == SSID_SIZE_MODE_AUTO ||
-+ s->oas == OAS_MODE_AUTO) {
- s->s_accel->auto_mode = true;
- }
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index bc734fb477..89d34c9923 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1968,9 +1968,11 @@ static void smmu_reset_exit(Object *obj, ResetType type)
-
- static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- {
-- if (s->oas != OAS_MODE_44 && s->oas != OAS_MODE_48) {
-- error_setg(errp, "QEMU SMMUv3 model only implements 44 and 48 bit"
-- "OAS; other OasMode values are not supported");
-+ if (s->oas != OAS_MODE_44 && s->oas != OAS_MODE_48 &&
-+ s->oas != OAS_MODE_AUTO) {
-+ error_setg(errp, "QEMU SMMUv3 model only implements auto, "
-+ "44 bit, or 48 bit OAS. Other OasMode values are "
-+ "not supported.");
- return false;
- }
-
-@@ -1984,7 +1986,7 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- return false;
- }
- if (s->oas > OAS_MODE_44) {
-- error_setg(errp, "OAS must be 44 bits when accel=off");
-+ error_setg(errp, "oas must be 44 bits when accel=off");
- return false;
- }
- if (s->ssidsize > SSID_SIZE_MODE_0) {
-@@ -2171,9 +2173,10 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- "Please ensure host platform supports ATS before setting it "
- "to on.");
- object_class_property_set_description(klass, "oas",
-- "Specify Output Address Size (for accel=on). Supported values "
-- "are 44 or 48 bits. Defaults to 44 bits. oas=auto is not "
-- "supported.");
-+ "Set Output Address Size in bits (for accel=on). "
-+ "Valid values are 44, 48, and auto. Defaults to 44 bits."
-+ "Please ensure the value does not exceed the maximum "
-+ "Output Address Size supported by the host platform.");
- object_class_property_set_description(klass, "ssidsize",
- "Set number of bits used to represent SubstreamIDs (SSIDs). "
- "Valid values are 0-20 and auto. Defaults to 0. "
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-ril.patch b/kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-ril.patch
deleted file mode 100644
index 3ce88b8..0000000
--- a/kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-ril.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From db9b51eba6ce584776873db265b3c97e2e5fd406 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Mon, 8 Jun 2026 10:48:56 -0700
-Subject: [PATCH 070/111] hw/arm/smmuv3-accel: Implement "auto" value for "ril"
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [70/111] 8e22d10a8838c024247af280928fd7620ecc8453 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-163596
-
-Allow accelerated SMMUv3 Range Invalidation support property to be
-derived from host IOMMU capabilities. Derive host values using
-IOMMU_GET_HW_INFO, retrieving RIL capability from IDR3.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260608174900.2227340-6-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 8e0a2aa777f69def65aa382fc66dabf9cf53b8f0)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 8 +++++++-
- hw/arm/smmuv3.c | 10 ++++------
- 2 files changed, 11 insertions(+), 7 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index e03b0883af..0243e292d8 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -58,6 +58,11 @@ static void smmuv3_accel_auto_finalise(SMMUv3State *s,
- FIELD_EX32(info->idr[0], IDR0, ATS));
- }
-
-+ if (s->ril == ON_OFF_AUTO_AUTO) {
-+ s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL,
-+ FIELD_EX32(info->idr[3], IDR3, RIL));
-+ }
-+
- accel->auto_finalised = true;
- }
-
-@@ -965,7 +970,8 @@ bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
- bs->iommu_ops = &smmuv3_accel_ops;
- smmuv3_accel_as_init(s);
-
-- if (s->ats == ON_OFF_AUTO_AUTO) {
-+ if (s->ats == ON_OFF_AUTO_AUTO ||
-+ s->ril == ON_OFF_AUTO_AUTO) {
- s->s_accel->auto_mode = true;
- }
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index e2071938c0..78ed2a9df1 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1965,10 +1965,6 @@ static void smmu_reset_exit(Object *obj, ResetType type)
-
- static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- {
-- if (s->ril == ON_OFF_AUTO_AUTO) {
-- error_setg(errp, "ril auto mode is not supported");
-- return false;
-- }
- if (s->ssidsize == SSID_SIZE_MODE_AUTO) {
- error_setg(errp, "ssidsize auto mode is not supported");
- return false;
-@@ -2165,8 +2161,10 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- "ensure the host SMMUv3 supports nested translation before "
- "enabling.");
- object_class_property_set_description(klass, "ril",
-- "Disable range invalidation support (for accel=on). ril=auto "
-- "is not supported.");
-+ "Enable/disable range invalidation support (for accel=on). "
-+ "Valid values are on, off, and auto. Defaults to on. "
-+ "Any attempt to turn it 'on' while the host does not support "
-+ "it would fail.");
- object_class_property_set_description(klass, "ats",
- "Enable/disable ATS support (for accel=on). "
- "Valid values are on, off, and auto. Defaults to off. "
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-ssidsiz.patch b/kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-ssidsiz.patch
deleted file mode 100644
index dcc385e..0000000
--- a/kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-ssidsiz.patch
+++ /dev/null
@@ -1,145 +0,0 @@
-From 753ace52c01dd9da1175e2e18d060dc945cd80af Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Mon, 8 Jun 2026 10:48:57 -0700
-Subject: [PATCH 071/111] hw/arm/smmuv3-accel: Implement "auto" value for
- "ssidsize"
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [71/111] f4c6e14d54eb749fbcc601aaeb2bbac539859690 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-163596
-
-Allow accelerated SMMUv3 SSID size property to be derived from host
-IOMMU capabilities. Derive host values using IOMMU_GET_HW_INFO,
-retrieving SSID size from IDR1. When the auto SSID size is resolved
-to a non-zero value, PASID capability is advertised to the vIOMMU
-and accelerated use cases such as Shared Virtual Addressing (SVA)
-are supported.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260608174900.2227340-7-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 13b941aaff48060ce0b5dca5a2b345a6dc25cb1c)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 17 +++++++++++++++--
- hw/arm/smmuv3.c | 22 ++++++++++++----------
- 2 files changed, 27 insertions(+), 12 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 0243e292d8..182676157d 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -63,6 +63,11 @@ static void smmuv3_accel_auto_finalise(SMMUv3State *s,
- FIELD_EX32(info->idr[3], IDR3, RIL));
- }
-
-+ if (s->ssidsize == SSID_SIZE_MODE_AUTO) {
-+ s->idr[1] = FIELD_DP32(s->idr[1], IDR1, SSIDSIZE,
-+ FIELD_EX32(info->idr[1], IDR1, SSIDSIZE));
-+ }
-+
- accel->auto_finalised = true;
- }
-
-@@ -823,6 +828,13 @@ static AddressSpace *smmuv3_accel_find_add_as(PCIBus *bus, void *opaque,
- }
- }
-
-+static inline bool smmuv3_pasid_supported(SMMUv3State *s)
-+{
-+ return s->ssidsize > SSID_SIZE_MODE_0 ||
-+ (s->ssidsize == SSID_SIZE_MODE_AUTO &&
-+ FIELD_EX32(s->idr[1], IDR1, SSIDSIZE));
-+}
-+
- static uint64_t smmuv3_accel_get_viommu_flags(void *opaque)
- {
- /*
-@@ -835,7 +847,7 @@ static uint64_t smmuv3_accel_get_viommu_flags(void *opaque)
- SMMUState *bs = opaque;
- SMMUv3State *s = ARM_SMMUV3(bs);
-
-- if (s->ssidsize > SSID_SIZE_MODE_0) {
-+ if (smmuv3_pasid_supported(s)) {
- flags |= VIOMMU_FLAG_PASID_SUPPORTED;
- }
- return flags;
-@@ -971,7 +983,8 @@ bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
- smmuv3_accel_as_init(s);
-
- if (s->ats == ON_OFF_AUTO_AUTO ||
-- s->ril == ON_OFF_AUTO_AUTO) {
-+ s->ril == ON_OFF_AUTO_AUTO ||
-+ s->ssidsize == SSID_SIZE_MODE_AUTO) {
- s->s_accel->auto_mode = true;
- }
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 78ed2a9df1..bc734fb477 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -626,7 +626,10 @@ static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg,
- }
-
- /* Multiple context descriptors require SubstreamID support */
-- if (s->ssidsize == SSID_SIZE_MODE_0 && STE_S1CDMAX(ste) != 0) {
-+ if ((s->ssidsize == SSID_SIZE_MODE_0 ||
-+ (s->ssidsize == SSID_SIZE_MODE_AUTO &&
-+ !FIELD_EX32(s->idr[1], IDR1, SSIDSIZE))) &&
-+ STE_S1CDMAX(ste) != 0) {
- qemu_log_mask(LOG_UNIMP,
- "SMMUv3: multiple S1 context descriptors require SubstreamID support. "
- "Configure ssidsize > 0 (requires accel=on)\n");
-@@ -1965,10 +1968,6 @@ static void smmu_reset_exit(Object *obj, ResetType type)
-
- static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- {
-- if (s->ssidsize == SSID_SIZE_MODE_AUTO) {
-- error_setg(errp, "ssidsize auto mode is not supported");
-- return false;
-- }
- if (s->oas != OAS_MODE_44 && s->oas != OAS_MODE_48) {
- error_setg(errp, "QEMU SMMUv3 model only implements 44 and 48 bit"
- "OAS; other OasMode values are not supported");
-@@ -1989,7 +1988,8 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- return false;
- }
- if (s->ssidsize > SSID_SIZE_MODE_0) {
-- error_setg(errp, "ssidsize can only be set if accel=on");
-+ error_setg(errp, "ssidsize can only be greater than 0 "
-+ "bits if accel=on");
- return false;
- }
- return true;
-@@ -2175,11 +2175,13 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- "are 44 or 48 bits. Defaults to 44 bits. oas=auto is not "
- "supported.");
- object_class_property_set_description(klass, "ssidsize",
-- "Number of bits used to represent SubstreamIDs (SSIDs). "
-+ "Set number of bits used to represent SubstreamIDs (SSIDs). "
-+ "Valid values are 0-20 and auto. Defaults to 0. "
- "A value of N allows SSIDs in the range [0 .. 2^N - 1]. "
-- "Valid range is 0-20, where 0 disables SubstreamID support. "
-- "Defaults to 0. A value greater than 0 is required to enable "
-- "PASID support. ssidsize=auto is not supported.");
-+ "A value of 0 disables SubstreamID support. A value greater "
-+ "than 0 is required to enable PASID support."
-+ "Please ensure the value does not exceed the maximum "
-+ "SubstreamID size supported by the host platform.");
- }
-
- static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Implement-get_msi_direct_gpa-cal.patch b/kvm-hw-arm-smmuv3-accel-Implement-get_msi_direct_gpa-cal.patch
deleted file mode 100644
index 381d516..0000000
--- a/kvm-hw-arm-smmuv3-accel-Implement-get_msi_direct_gpa-cal.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From f826cb97e9de8c7bc8fae7b81b380d0e7726fb84 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 025/111] hw/arm/smmuv3-accel: Implement get_msi_direct_gpa
- callback
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [25/111] afc6a8d07e2db927aed8443d173b66fc3f8f6459 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Accelerated SMMUv3 instances rely on the physical SMMUv3 for nested
-translation (guest Stage-1, host Stage-2). In this mode, the guest Stage-1
-tables are programmed directly into hardware, and QEMU must not attempt to
-walk them for translation, as doing so is not reliably safe. For vfio-pci
-endpoints behind such a vSMMU, the only translation QEMU needs to perform
-is for the MSI doorbell used during KVM MSI setup.
-
-Implement the callback so that kvm_arch_fixup_msi_route() can retrieve the
-MSI doorbell GPA directly, instead of attempting a software walk of the
-guest translation tables.
-
-Also introduce an SMMUv3 device property to carry the MSI doorbell GPA.
-This property will be set by the virt machine in a subsequent patch.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-18-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 3558c85392a46db064eb983633de998a25ea9705)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 10 ++++++++++
- hw/arm/smmuv3.c | 2 ++
- include/hw/arm/smmuv3.h | 1 +
- 3 files changed, 13 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index c125974d12..c6ee123cdf 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -393,6 +393,15 @@ static void smmuv3_accel_unset_iommu_device(PCIBus *bus, void *opaque,
- }
- }
-
-+static uint64_t smmuv3_accel_get_msi_gpa(PCIBus *bus, void *opaque, int devfn)
-+{
-+ SMMUState *bs = opaque;
-+ SMMUv3State *s = ARM_SMMUV3(bs);
-+
-+ g_assert(s->msi_gpa);
-+ return s->msi_gpa;
-+}
-+
- /*
- * Only allow PCIe bridges, pxb-pcie roots, and GPEX roots so vfio-pci
- * endpoints can sit downstream. Accelerated SMMUv3 requires a vfio-pci
-@@ -497,6 +506,7 @@ static const PCIIOMMUOps smmuv3_accel_ops = {
- .get_viommu_flags = smmuv3_accel_get_viommu_flags,
- .set_iommu_device = smmuv3_accel_set_iommu_device,
- .unset_iommu_device = smmuv3_accel_unset_iommu_device,
-+ .get_msi_direct_gpa = smmuv3_accel_get_msi_gpa,
- };
-
- /* Based on SMUUv3 GPBA.ABORT configuration, attach a corresponding HWPT */
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index 42c60b1ec8..f02e3ee46c 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1998,6 +1998,8 @@ static const Property smmuv3_properties[] = {
- * Defaults to stage 1
- */
- DEFINE_PROP_STRING("stage", SMMUv3State, stage),
-+ /* GPA of MSI doorbell, for SMMUv3 accel use. */
-+ DEFINE_PROP_UINT64("msi-gpa", SMMUv3State, msi_gpa, 0),
- };
-
- static void smmuv3_instance_init(Object *obj)
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index e54ece2d38..5616a8a2be 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -67,6 +67,7 @@ struct SMMUv3State {
- /* SMMU has HW accelerator support for nested S1 + s2 */
- bool accel;
- struct SMMUv3AccelState *s_accel;
-+ uint64_t msi_gpa;
- };
-
- typedef enum {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Initialize-shared-system-address.patch b/kvm-hw-arm-smmuv3-accel-Initialize-shared-system-address.patch
deleted file mode 100644
index 1b0d599..0000000
--- a/kvm-hw-arm-smmuv3-accel-Initialize-shared-system-address.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From e9fa710039a71015b0dfcff975e5ee16fb1f310f Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 008/111] hw/arm/smmuv3-accel: Initialize shared system address
- space
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [8/111] 696fdb31b39d27f329d68bc0d8acd4686ef7f596 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-To support accelerated SMMUv3 instances, introduce a shared system-wide
-AddressSpace (shared_as_sysmem) that aliases the global system memory.
-This shared AddressSpace will be used in a subsequent patch for all
-vfio-pci devices behind all accelerated SMMUv3 instances within a VM.
-
-Sharing a single system AddressSpace ensures that all devices behind
-accelerated SMMUv3s use the same system address space pointer. This
-allows VFIO/iommufd to reuse a single IOAS ID in iommufd_cdev_attach(),
-enabling the Stage-2 page tables to be shared within the VM rather than
-duplicated for each SMMUv3 instance.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-7-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 7d7931257d6f748d8f0cd595952425c19670f0b5)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 26 ++++++++++++++++++++++++++
- 1 file changed, 26 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 99ef0db8c4..b2eded743e 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -11,6 +11,14 @@
- #include "hw/arm/smmuv3.h"
- #include "smmuv3-accel.h"
-
-+/*
-+ * The root region aliases the global system memory, and shared_as_sysmem
-+ * provides a shared Address Space referencing it. This Address Space is used
-+ * by all vfio-pci devices behind all accelerated SMMUv3 instances within a VM.
-+ */
-+static MemoryRegion root, sysmem;
-+static AddressSpace *shared_as_sysmem;
-+
- static SMMUv3AccelDevice *smmuv3_accel_get_dev(SMMUState *bs, SMMUPciBus *sbus,
- PCIBus *bus, int devfn)
- {
-@@ -51,9 +59,27 @@ static const PCIIOMMUOps smmuv3_accel_ops = {
- .get_address_space = smmuv3_accel_find_add_as,
- };
-
-+static void smmuv3_accel_as_init(SMMUv3State *s)
-+{
-+
-+ if (shared_as_sysmem) {
-+ return;
-+ }
-+
-+ memory_region_init(&root, OBJECT(s), "root", UINT64_MAX);
-+ memory_region_init_alias(&sysmem, OBJECT(s), "smmuv3-accel-sysmem",
-+ get_system_memory(), 0,
-+ memory_region_size(get_system_memory()));
-+ memory_region_add_subregion(&root, 0, &sysmem);
-+
-+ shared_as_sysmem = g_new0(AddressSpace, 1);
-+ address_space_init(shared_as_sysmem, &root, "smmuv3-accel-as-sysmem");
-+}
-+
- void smmuv3_accel_init(SMMUv3State *s)
- {
- SMMUState *bs = ARM_SMMU(s);
-
- bs->iommu_ops = &smmuv3_accel_ops;
-+ smmuv3_accel_as_init(s);
- }
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Install-SMMUv3-GBPA-based-hwpt.patch b/kvm-hw-arm-smmuv3-accel-Install-SMMUv3-GBPA-based-hwpt.patch
deleted file mode 100644
index 874372a..0000000
--- a/kvm-hw-arm-smmuv3-accel-Install-SMMUv3-GBPA-based-hwpt.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-From b95cb9924294da296caddfcd37ad15ea45f0d86c Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 023/111] hw/arm/smmuv3-accel: Install SMMUv3 GBPA based hwpt
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [23/111] 6efcc61bf304eb1ab554334c20a963121b33108c (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-On guest reboot or on GBPA update, attach a nested HWPT based on the
-GPBA.ABORT bit which either aborts all incoming transactions or bypasses
-them.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-16-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit b6b867b9c16d479af0ba95ac71411a0ff788220a)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 36 ++++++++++++++++++++++++++++++++++++
- hw/arm/smmuv3-accel.h | 9 +++++++++
- hw/arm/smmuv3.c | 2 ++
- 3 files changed, 47 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 877b7e0e17..c125974d12 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -499,6 +499,42 @@ static const PCIIOMMUOps smmuv3_accel_ops = {
- .unset_iommu_device = smmuv3_accel_unset_iommu_device,
- };
-
-+/* Based on SMUUv3 GPBA.ABORT configuration, attach a corresponding HWPT */
-+bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp)
-+{
-+ SMMUv3AccelState *accel = s->s_accel;
-+ SMMUv3AccelDevice *accel_dev;
-+ Error *local_err = NULL;
-+ bool all_ok = true;
-+ uint32_t hwpt_id;
-+
-+ if (!accel || !accel->viommu) {
-+ return true;
-+ }
-+
-+ hwpt_id = smmuv3_accel_gbpa_hwpt(s, accel);
-+ QLIST_FOREACH(accel_dev, &accel->device_list, next) {
-+ if (!host_iommu_device_iommufd_attach_hwpt(accel_dev->idev, hwpt_id,
-+ &local_err)) {
-+ error_append_hint(&local_err, "Failed to attach GBPA hwpt %u for "
-+ "idev devid %u", hwpt_id, accel_dev->idev->devid);
-+ error_report_err(local_err);
-+ local_err = NULL;
-+ all_ok = false;
-+ }
-+ }
-+ if (!all_ok) {
-+ error_setg(errp, "Failed to attach all GBPA based HWPTs properly");
-+ }
-+ return all_ok;
-+}
-+
-+void smmuv3_accel_reset(SMMUv3State *s)
-+{
-+ /* Attach a HWPT based on GBPA reset value */
-+ smmuv3_accel_attach_gbpa_hwpt(s, NULL);
-+}
-+
- static void smmuv3_accel_as_init(SMMUv3State *s)
- {
-
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index 4e20b646dc..c7ed4dce3a 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -46,6 +46,8 @@ bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
- Error **errp);
- bool smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
- Error **errp);
-+bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp);
-+void smmuv3_accel_reset(SMMUv3State *s);
- #else
- static inline void smmuv3_accel_init(SMMUv3State *s)
- {
-@@ -62,6 +64,13 @@ smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
- {
- return true;
- }
-+static inline bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp)
-+{
-+ return true;
-+}
-+static inline void smmuv3_accel_reset(SMMUv3State *s)
-+{
-+}
- #endif
-
- #endif /* HW_ARM_SMMUV3_ACCEL_H */
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index bfb41b8866..42c60b1ec8 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1600,6 +1600,7 @@ static MemTxResult smmu_writel(SMMUv3State *s, hwaddr offset,
- if (data & R_GBPA_UPDATE_MASK) {
- /* Ignore update bit as write is synchronous. */
- s->gbpa = data & ~R_GBPA_UPDATE_MASK;
-+ smmuv3_accel_attach_gbpa_hwpt(s, &local_err);
- }
- break;
- case A_STRTAB_BASE: /* 64b */
-@@ -1887,6 +1888,7 @@ static void smmu_reset_exit(Object *obj, ResetType type)
- }
-
- smmuv3_init_regs(s);
-+ smmuv3_accel_reset(s);
- }
-
- static void smmu_realize(DeviceState *d, Error **errp)
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Introduce-CMDQV-ops-interface.patch b/kvm-hw-arm-smmuv3-accel-Introduce-CMDQV-ops-interface.patch
deleted file mode 100644
index 9917c6f..0000000
--- a/kvm-hw-arm-smmuv3-accel-Introduce-CMDQV-ops-interface.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-From b51c2abea81d87ed70013f9004b716d4264ff839 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:27 +0100
-Subject: [PATCH 084/111] hw/arm/smmuv3-accel: Introduce CMDQV ops interface
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [84/111] d0ebe2694524a5e53e830a9636b25371c09c820a (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Command Queue Virtualization (CMDQV) is a hardware extension available
-on certain platforms that allows the SMMUv3 command queue to be
-virtualized and passed through to a VM, improving performance.
-
-For example, NVIDIA Tegra241 implements CMDQV to support virtualization
-of multiple command queues (VCMDQs).
-
-The term CMDQV is used here generically to refer to any platform that
-provides hardware support to virtualize the SMMUv3 command queue.
-
-CMDQV support is a specialization of the IOMMUFD-backed accelerated
-SMMUv3 path. Introduce an ops interface to factor out CMDQV-specific
-probe, initialization, and vIOMMU allocation logic from the base
-implementation. The ops pointer and associated state are stored in
-the accelerated SMMUv3 state.
-
-This provides an extensible design to support future vendor-specific
-CMDQV implementations.
-
-No functional change.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-7-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 4912111c682f9649176026c5ce0137c25dc91b4a)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.h | 34 ++++++++++++++++++++++++++++++++++
- 1 file changed, 34 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index d89c117fd1..849015f98e 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -10,12 +10,45 @@
- #define HW_ARM_SMMUV3_ACCEL_H
-
- #include "hw/arm/smmu-common.h"
-+#include "hw/arm/smmuv3.h"
- #include "system/iommufd.h"
- #ifdef CONFIG_LINUX
- #include <linux/iommufd.h>
- #endif
- #include CONFIG_DEVICES
-
-+/*
-+ * CMDQ-Virtualization (CMDQV) hardware support, extends the SMMUv3 to
-+ * support multiple VCMDQs with virtualization capabilities.
-+ * CMDQV specific behavior is factored behind this ops interface.
-+ */
-+typedef struct SMMUv3AccelCmdqvOps {
-+ /**
-+ * @probe: Mandatory. Vendor-specific device probing.
-+ */
-+ bool (*probe)(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev, Error **errp);
-+ /**
-+ * @init: Optional callback. Initialize CMDQV hardware.
-+ */
-+ bool (*init)(SMMUv3State *s, Error **errp);
-+ /**
-+ * @alloc_viommu: Mandatory. Allocate CMDQV viommu resources.
-+ */
-+ bool (*alloc_viommu)(SMMUv3State *s,
-+ HostIOMMUDeviceIOMMUFD *idev,
-+ uint32_t *out_viommu_id,
-+ Error **errp);
-+ /**
-+ * @free_viommu: Optional callback. Free CMDQV viommu resources.
-+ * If NULL, the viommu_id is freed directly via iommufd_backend_free_id().
-+ */
-+ void (*free_viommu)(SMMUv3State *s);
-+ /**
-+ * @reset: Optional callback. Reset CMDQV state.
-+ */
-+ void (*reset)(SMMUv3State *s);
-+} SMMUv3AccelCmdqvOps;
-+
- /*
- * Represents an accelerated SMMU instance backed by an iommufd vIOMMU object.
- * Holds bypass and abort proxy HWPT IDs used for device attachment.
-@@ -28,6 +61,7 @@ typedef struct SMMUv3AccelState {
- QLIST_HEAD(, SMMUv3AccelDevice) device_list;
- bool auto_mode;
- bool auto_finalised;
-+ const SMMUv3AccelCmdqvOps *cmdqv_ops;
- } SMMUv3AccelState;
-
- typedef struct SMMUS1Hwpt {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Introduce-common-helper-for-veve.patch b/kvm-hw-arm-smmuv3-accel-Introduce-common-helper-for-veve.patch
deleted file mode 100644
index b750fc5..0000000
--- a/kvm-hw-arm-smmuv3-accel-Introduce-common-helper-for-veve.patch
+++ /dev/null
@@ -1,171 +0,0 @@
-From 797da99309c9e32426b24dd0ccb50b9c184e7ede Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:43 +0100
-Subject: [PATCH 101/111] hw/arm/smmuv3-accel: Introduce common helper for
- veventq read
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [101/111] dd3f176292b344f27dffcb67334d2b9fdcf92faa (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Move the vEVENTQ read and validation logic into a common helper
-smmuv3_accel_event_read_validate(). The helper performs the read(),
-checks for overflow and short reads, validates the sequence number,
-and updates the sequence state.
-
-This helper can be reused for Tegra241 CMDQV vEVENTQ support in a
-subsequent patch.
-
-Error handling is slightly adjusted: instead of reporting errors
-directly in the read handler, the helper now returns errors via
-Error **. Sequence gaps are reported as warnings.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-23-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit f8015fe988df09448ea67458dd31f04d704388c3)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel-stubs.c | 7 ++++
- hw/arm/smmuv3-accel.c | 67 ++++++++++++++++++++++---------------
- hw/arm/smmuv3-accel.h | 2 ++
- 3 files changed, 49 insertions(+), 27 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel-stubs.c b/hw/arm/smmuv3-accel-stubs.c
-index 70cef66966..9e6c44a282 100644
---- a/hw/arm/smmuv3-accel-stubs.c
-+++ b/hw/arm/smmuv3-accel-stubs.c
-@@ -47,6 +47,13 @@ bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp)
- return true;
- }
-
-+bool smmuv3_accel_event_read_validate(IOMMUFDVeventq *veventq, uint32_t type,
-+ void *buf, size_t size, Error **errp)
-+{
-+ return true;
-+}
-+
-+
- void smmuv3_accel_reset(SMMUv3State *s)
- {
- }
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 3ceca56a67..c1c2a67c97 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -440,47 +440,60 @@ bool smmuv3_accel_issue_inv_cmd(SMMUv3State *bs, void *cmd, SMMUDevice *sdev,
- sizeof(Cmd), &entry_num, cmd, errp);
- }
-
--static void smmuv3_accel_event_read(void *opaque)
-+bool smmuv3_accel_event_read_validate(IOMMUFDVeventq *veventq, uint32_t type,
-+ void *buf, size_t size, Error **errp)
- {
-- SMMUv3State *s = opaque;
-- IOMMUFDVeventq *veventq = s->s_accel->veventq;
-- struct {
-- struct iommufd_vevent_header hdr;
-- struct iommu_vevent_arm_smmuv3 vevent;
-- } buf;
-- enum iommu_veventq_type type = IOMMU_VEVENTQ_TYPE_ARM_SMMUV3;
-- uint32_t id = veventq->veventq_id;
- uint32_t last_seq = veventq->last_event_seq;
-+ uint32_t id = veventq->veventq_id;
-+ struct iommufd_vevent_header *hdr;
- ssize_t bytes;
-
-- bytes = read(veventq->veventq_fd, &buf, sizeof(buf));
-+ bytes = read(veventq->veventq_fd, buf, size);
- if (bytes <= 0) {
- if (errno == EAGAIN || errno == EINTR) {
-- return;
-+ return true;
- }
-- error_report_once("vEVENTQ(type %u id %u): read failed (%m)", type, id);
-- return;
-+ error_setg(errp, "vEVENTQ(type %u id %u): read failed (%m)", type, id);
-+ return false;
- }
--
-- if (bytes == sizeof(buf.hdr) &&
-- (buf.hdr.flags & IOMMU_VEVENTQ_FLAG_LOST_EVENTS)) {
-- error_report_once("vEVENTQ(type %u id %u): overflowed", type, id);
-+ hdr = (struct iommufd_vevent_header *)buf;
-+ if (bytes == sizeof(*hdr) &&
-+ (hdr->flags & IOMMU_VEVENTQ_FLAG_LOST_EVENTS)) {
-+ error_setg(errp, "vEVENTQ(type %u id %u): overflowed", type, id);
- veventq->event_start = false;
-- return;
-+ return false;
- }
-- if (bytes < sizeof(buf)) {
-- error_report_once("vEVENTQ(type %u id %u): short read(%zd/%zd bytes)",
-- type, id, bytes, sizeof(buf));
-- return;
-+ if (bytes < size) {
-+ error_setg(errp, "vEVENTQ(type %u id %u): short read(%zd/%zd bytes)",
-+ type, id, bytes, size);
-+ return false;
- }
--
- /* Check sequence in hdr for lost events if any */
-- if (veventq->event_start && (buf.hdr.sequence - last_seq != 1)) {
-- error_report_once("vEVENTQ(type %u id %u): lost %u event(s)",
-- type, id, buf.hdr.sequence - last_seq - 1);
-+ if (veventq->event_start && (hdr->sequence - last_seq != 1)) {
-+ warn_report("vEVENTQ(type %u id %u): lost %u event(s)",
-+ type, id, hdr->sequence - last_seq - 1);
- }
-- veventq->last_event_seq = buf.hdr.sequence;
-+ veventq->last_event_seq = hdr->sequence;
- veventq->event_start = true;
-+ return true;
-+}
-+
-+static void smmuv3_accel_event_read(void *opaque)
-+{
-+ SMMUv3State *s = opaque;
-+ IOMMUFDVeventq *veventq = s->s_accel->veventq;
-+ struct {
-+ struct iommufd_vevent_header hdr;
-+ struct iommu_vevent_arm_smmuv3 vevent;
-+ } buf;
-+ Error *local_err = NULL;
-+
-+ if (!smmuv3_accel_event_read_validate(veventq,
-+ IOMMU_VEVENTQ_TYPE_ARM_SMMUV3, &buf,
-+ sizeof(buf), &local_err)) {
-+ warn_report_err_once(local_err);
-+ return;
-+ }
- smmuv3_propagate_event(s, (Evt *)&buf.vevent);
- }
-
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index e0bbec8581..8d0f636338 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -87,6 +87,8 @@ bool smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
- Error **errp);
- void smmuv3_accel_idr_override(SMMUv3State *s);
- bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp);
-+bool smmuv3_accel_event_read_validate(IOMMUFDVeventq *veventq, uint32_t type,
-+ void *buf, size_t size, Error **errp);
- void smmuv3_accel_reset(SMMUv3State *s);
-
- #endif /* HW_ARM_SMMUV3_ACCEL_H */
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Introduce-helper-to-query-CMDQV-.patch b/kvm-hw-arm-smmuv3-accel-Introduce-helper-to-query-CMDQV-.patch
deleted file mode 100644
index 738e9d0..0000000
--- a/kvm-hw-arm-smmuv3-accel-Introduce-helper-to-query-CMDQV-.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-From e75168be94bda921feca7955b173de4700dd6b0c Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:48 +0100
-Subject: [PATCH 106/111] hw/arm/smmuv3-accel: Introduce helper to query CMDQV
- type
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [106/111] 363c0461547a4df58e52522d40ca1cb1b7575f60 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Introduce a SMMUv3AccelCmdqvType enum and a helper to query the
-CMDQV implementation type associated with an accelerated SMMUv3
-instance.
-
-A subsequent patch will use this helper when generating the
-Tegra241 CMDQV DSDT.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-28-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit d3e56703bfc58969ac02009bcdbac7f5b25998db)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel-stubs.c | 5 +++++
- hw/arm/smmuv3-accel.c | 12 ++++++++++++
- hw/arm/smmuv3-accel.h | 10 ++++++++++
- hw/arm/tegra241-cmdqv.c | 6 ++++++
- 4 files changed, 33 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel-stubs.c b/hw/arm/smmuv3-accel-stubs.c
-index 9e6c44a282..147ae06163 100644
---- a/hw/arm/smmuv3-accel-stubs.c
-+++ b/hw/arm/smmuv3-accel-stubs.c
-@@ -57,3 +57,8 @@ bool smmuv3_accel_event_read_validate(IOMMUFDVeventq *veventq, uint32_t type,
- void smmuv3_accel_reset(SMMUv3State *s)
- {
- }
-+
-+SMMUv3AccelCmdqvType smmuv3_accel_cmdqv_type(Object *obj)
-+{
-+ return SMMUV3_CMDQV_NONE;
-+}
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index c1c2a67c97..9c3bd4413d 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -1060,6 +1060,18 @@ static void smmuv3_accel_as_init(SMMUv3State *s)
- address_space_init(shared_as_sysmem, &root, "smmuv3-accel-as-sysmem");
- }
-
-+SMMUv3AccelCmdqvType smmuv3_accel_cmdqv_type(Object *obj)
-+{
-+ SMMUv3State *s = ARM_SMMUV3(obj);
-+ SMMUv3AccelState *accel = s->s_accel;
-+
-+ if (!accel || !accel->cmdqv_ops || !accel->cmdqv_ops->get_type) {
-+ return SMMUV3_CMDQV_NONE;
-+ }
-+
-+ return accel->cmdqv_ops->get_type();
-+}
-+
- static void smmuv3_accel_machine_done(Notifier *notifier, void *data)
- {
- SMMUv3State *s = container_of(notifier, SMMUv3State, machine_done);
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index 8d0f636338..5fc85fb89d 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -16,6 +16,11 @@
- #include <linux/iommufd.h>
- #endif
-
-+typedef enum SMMUv3AccelCmdqvType {
-+ SMMUV3_CMDQV_NONE = 0,
-+ SMMUV3_CMDQV_TEGRA241,
-+} SMMUv3AccelCmdqvType;
-+
- /*
- * CMDQ-Virtualization (CMDQV) hardware support, extends the SMMUv3 to
- * support multiple VCMDQs with virtualization capabilities.
-@@ -42,6 +47,10 @@ typedef struct SMMUv3AccelCmdqvOps {
- * If NULL, the viommu_id is freed directly via iommufd_backend_free_id().
- */
- void (*free_viommu)(SMMUv3State *s);
-+ /**
-+ * @get_type: Optional callback. Return the CMDQV implementation type.
-+ */
-+ SMMUv3AccelCmdqvType (*get_type)(void);
- /**
- * @reset: Optional callback. Reset CMDQV state.
- */
-@@ -90,5 +99,6 @@ bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp);
- bool smmuv3_accel_event_read_validate(IOMMUFDVeventq *veventq, uint32_t type,
- void *buf, size_t size, Error **errp);
- void smmuv3_accel_reset(SMMUv3State *s);
-+SMMUv3AccelCmdqvType smmuv3_accel_cmdqv_type(Object *obj);
-
- #endif /* HW_ARM_SMMUV3_ACCEL_H */
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index a4c140e34c..1bed1374ba 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -964,6 +964,11 @@ static bool tegra241_cmdqv_init(SMMUv3State *s, Error **errp)
- return true;
- }
-
-+static SMMUv3AccelCmdqvType tegra241_cmdqv_get_type(void)
-+{
-+ return SMMUV3_CMDQV_TEGRA241;
-+}
-+
- static bool tegra241_cmdqv_probe(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- Error **errp)
- {
-@@ -1004,6 +1009,7 @@ static const SMMUv3AccelCmdqvOps tegra241_cmdqv_ops = {
- .init = tegra241_cmdqv_init,
- .alloc_viommu = tegra241_cmdqv_alloc_viommu,
- .free_viommu = tegra241_cmdqv_free_viommu,
-+ .get_type = tegra241_cmdqv_get_type,
- .reset = tegra241_cmdqv_reset,
- };
-
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Introduce-smmuv3-accel-device.patch b/kvm-hw-arm-smmuv3-accel-Introduce-smmuv3-accel-device.patch
deleted file mode 100644
index 4a7e746..0000000
--- a/kvm-hw-arm-smmuv3-accel-Introduce-smmuv3-accel-device.patch
+++ /dev/null
@@ -1,219 +0,0 @@
-From 9fa0e1b82cc1863a481e3700929c40f0160d95cb Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 007/111] hw/arm/smmuv3-accel: Introduce smmuv3 accel device
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [7/111] 1b76cd4032c19e0abebd850ee1e000f5e7768993 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Set up dedicated PCIIOMMUOps for the accel SMMUv3, since it will need
-different callback handling in upcoming patches. This also adds a
-CONFIG_ARM_SMMUV3_ACCEL build option so the feature can be disabled
-at compile time. Because we now include CONFIG_DEVICES in the header to
-check for ARM_SMMUV3_ACCEL, the meson file entry for smmuv3.c needs to
-be changed to arm_ss.add.
-
-The “accel” property isn’t user visible yet and it will be introduced in
-a later patch once all the supporting pieces are ready.
-
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-6-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 79fcbec80a85891b30684703d3ac96a7b992ae49)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/Kconfig | 5 ++++
- hw/arm/meson.build | 3 ++-
- hw/arm/smmuv3-accel.c | 59 +++++++++++++++++++++++++++++++++++++++++
- hw/arm/smmuv3-accel.h | 27 +++++++++++++++++++
- hw/arm/smmuv3.c | 5 ++++
- include/hw/arm/smmuv3.h | 3 +++
- 6 files changed, 101 insertions(+), 1 deletion(-)
- create mode 100644 hw/arm/smmuv3-accel.c
- create mode 100644 hw/arm/smmuv3-accel.h
-
-diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
-index 3baa6c6c74..1f49550c61 100644
---- a/hw/arm/Kconfig
-+++ b/hw/arm/Kconfig
-@@ -622,8 +622,13 @@ config FSL_IMX8MP_EVK
- depends on TCG && AARCH64
- select FSL_IMX8MP
-
-+config ARM_SMMUV3_ACCEL
-+ bool
-+ depends on ARM_SMMUV3
-+
- config ARM_SMMUV3
- bool
-+ select ARM_SMMUV3_ACCEL if IOMMUFD
-
- config FSL_IMX6UL
- bool
-diff --git a/hw/arm/meson.build b/hw/arm/meson.build
-index dc68391305..bcb27c0bf6 100644
---- a/hw/arm/meson.build
-+++ b/hw/arm/meson.build
-@@ -61,7 +61,8 @@ arm_common_ss.add(when: 'CONFIG_ARMSSE', if_true: files('armsse.c'))
- arm_common_ss.add(when: 'CONFIG_FSL_IMX7', if_true: files('fsl-imx7.c', 'mcimx7d-sabre.c'))
- arm_common_ss.add(when: 'CONFIG_FSL_IMX8MP', if_true: files('fsl-imx8mp.c'))
- arm_common_ss.add(when: 'CONFIG_FSL_IMX8MP_EVK', if_true: files('imx8mp-evk.c'))
--arm_common_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmuv3.c'))
-+arm_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmuv3.c'))
-+arm_ss.add(when: 'CONFIG_ARM_SMMUV3_ACCEL', if_true: files('smmuv3-accel.c'))
- arm_common_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c', 'mcimx6ul-evk.c'))
- arm_common_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c'))
- arm_ss.add(when: 'CONFIG_XEN', if_true: files(
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-new file mode 100644
-index 0000000000..99ef0db8c4
---- /dev/null
-+++ b/hw/arm/smmuv3-accel.c
-@@ -0,0 +1,59 @@
-+/*
-+ * Copyright (c) 2025 Huawei Technologies R & D (UK) Ltd
-+ * Copyright (C) 2025 NVIDIA
-+ * Written by Nicolin Chen, Shameer Kolothum
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#include "qemu/osdep.h"
-+
-+#include "hw/arm/smmuv3.h"
-+#include "smmuv3-accel.h"
-+
-+static SMMUv3AccelDevice *smmuv3_accel_get_dev(SMMUState *bs, SMMUPciBus *sbus,
-+ PCIBus *bus, int devfn)
-+{
-+ SMMUDevice *sdev = sbus->pbdev[devfn];
-+ SMMUv3AccelDevice *accel_dev;
-+
-+ if (sdev) {
-+ return container_of(sdev, SMMUv3AccelDevice, sdev);
-+ }
-+
-+ accel_dev = g_new0(SMMUv3AccelDevice, 1);
-+ sdev = &accel_dev->sdev;
-+
-+ sbus->pbdev[devfn] = sdev;
-+ smmu_init_sdev(bs, sdev, bus, devfn);
-+ return accel_dev;
-+}
-+
-+/*
-+ * Find or add an address space for the given PCI device.
-+ *
-+ * If a device matching @bus and @devfn already exists, return its
-+ * corresponding address space. Otherwise, create a new device entry
-+ * and initialize address space for it.
-+ */
-+static AddressSpace *smmuv3_accel_find_add_as(PCIBus *bus, void *opaque,
-+ int devfn)
-+{
-+ SMMUState *bs = opaque;
-+ SMMUPciBus *sbus = smmu_get_sbus(bs, bus);
-+ SMMUv3AccelDevice *accel_dev = smmuv3_accel_get_dev(bs, sbus, bus, devfn);
-+ SMMUDevice *sdev = &accel_dev->sdev;
-+
-+ return &sdev->as;
-+}
-+
-+static const PCIIOMMUOps smmuv3_accel_ops = {
-+ .get_address_space = smmuv3_accel_find_add_as,
-+};
-+
-+void smmuv3_accel_init(SMMUv3State *s)
-+{
-+ SMMUState *bs = ARM_SMMU(s);
-+
-+ bs->iommu_ops = &smmuv3_accel_ops;
-+}
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-new file mode 100644
-index 0000000000..0dc6b00d35
---- /dev/null
-+++ b/hw/arm/smmuv3-accel.h
-@@ -0,0 +1,27 @@
-+/*
-+ * Copyright (c) 2025 Huawei Technologies R & D (UK) Ltd
-+ * Copyright (C) 2025 NVIDIA
-+ * Written by Nicolin Chen, Shameer Kolothum
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#ifndef HW_ARM_SMMUV3_ACCEL_H
-+#define HW_ARM_SMMUV3_ACCEL_H
-+
-+#include "hw/arm/smmu-common.h"
-+#include CONFIG_DEVICES
-+
-+typedef struct SMMUv3AccelDevice {
-+ SMMUDevice sdev;
-+} SMMUv3AccelDevice;
-+
-+#ifdef CONFIG_ARM_SMMUV3_ACCEL
-+void smmuv3_accel_init(SMMUv3State *s);
-+#else
-+static inline void smmuv3_accel_init(SMMUv3State *s)
-+{
-+}
-+#endif
-+
-+#endif /* HW_ARM_SMMUV3_ACCEL_H */
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index bcf8af8dc7..ef991cb7d8 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -32,6 +32,7 @@
- #include "qapi/error.h"
-
- #include "hw/arm/smmuv3.h"
-+#include "smmuv3-accel.h"
- #include "smmuv3-internal.h"
- #include "smmu-internal.h"
-
-@@ -1882,6 +1883,10 @@ static void smmu_realize(DeviceState *d, Error **errp)
- SysBusDevice *dev = SYS_BUS_DEVICE(d);
- Error *local_err = NULL;
-
-+ if (s->accel) {
-+ smmuv3_accel_init(s);
-+ }
-+
- c->parent_realize(d, &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index d183a62766..bb7076286b 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -63,6 +63,9 @@ struct SMMUv3State {
- qemu_irq irq[4];
- QemuMutex mutex;
- char *stage;
-+
-+ /* SMMU has HW accelerator support for nested S1 + s2 */
-+ bool accel;
- };
-
- typedef enum {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Make-SubstreamID-support-configu.patch b/kvm-hw-arm-smmuv3-accel-Make-SubstreamID-support-configu.patch
deleted file mode 100644
index 1ef4063..0000000
--- a/kvm-hw-arm-smmuv3-accel-Make-SubstreamID-support-configu.patch
+++ /dev/null
@@ -1,186 +0,0 @@
-From 2e3a09c929d35cc1f5d998801811260e1da24105 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 045/111] hw/arm/smmuv3-accel: Make SubstreamID support
- configurable
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [45/111] 78b8d97d32ebb27be666593bec7ca0cb80007eb7 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-QEMU SMMUv3 currently reports no SubstreamID support, forcing SSID to
-zero. This prevents accelerated use cases such as Shared Virtual
-Addressing (SVA), which require multiple Stage-1 context descriptors
-indexed by SubstreamID.
-
-Add a new "ssidsize" property to explicitly configure the number of bits
-used for SubstreamIDs. A value greater than zero enables SubstreamID
-support and advertises PASID capability to the vIOMMU.
-
-The requested SSIDSIZE is validated against host SMMUv3 capabilities and
-is only supported when accel=on.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-38-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit b8c6f8a69d2734a65a00f11788d6711e5d28a4ec)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 25 ++++++++++++++++++++++++-
- hw/arm/smmuv3.c | 22 ++++++++++++++++++++--
- include/hw/arm/smmuv3-common.h | 1 +
- include/hw/arm/smmuv3.h | 1 +
- 4 files changed, 46 insertions(+), 3 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 342944da23..f5cd4df336 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -76,6 +76,16 @@ smmuv3_accel_check_hw_compatible(SMMUv3State *s,
- return false;
- }
-
-+ /* Check SSIDSIZE value opted-in is compatible with Host SMMUv3 SSIDSIZE */
-+ if (FIELD_EX32(info->idr[1], IDR1, SSIDSIZE) <
-+ FIELD_EX32(s->idr[1], IDR1, SSIDSIZE)) {
-+ error_setg(errp, "Host SMMUv3 SSIDSIZE not compatible "
-+ "(host=%u, QEMU=%u)",
-+ FIELD_EX32(info->idr[1], IDR1, SSIDSIZE),
-+ FIELD_EX32(s->idr[1], IDR1, SSIDSIZE));
-+ return false;
-+ }
-+
- /* User can disable QEMU SMMUv3 Range Invalidation support */
- if (FIELD_EX32(info->idr[3], IDR3, RIL) <
- FIELD_EX32(s->idr[3], IDR3, RIL)) {
-@@ -652,7 +662,14 @@ static uint64_t smmuv3_accel_get_viommu_flags(void *opaque)
- * The real HW nested support should be reported from host SMMUv3 and if
- * it doesn't, the nesting parent allocation will fail anyway in VFIO core.
- */
-- return VIOMMU_FLAG_WANT_NESTING_PARENT;
-+ uint64_t flags = VIOMMU_FLAG_WANT_NESTING_PARENT;
-+ SMMUState *bs = opaque;
-+ SMMUv3State *s = ARM_SMMUV3(bs);
-+
-+ if (s->ssidsize) {
-+ flags |= VIOMMU_FLAG_PASID_SUPPORTED;
-+ }
-+ return flags;
- }
-
- static const PCIIOMMUOps smmuv3_accel_ops = {
-@@ -680,6 +697,12 @@ void smmuv3_accel_idr_override(SMMUv3State *s)
- if (s->oas == SMMU_OAS_48BIT) {
- s->idr[5] = FIELD_DP32(s->idr[5], IDR5, OAS, SMMU_IDR5_OAS_48);
- }
-+
-+ /*
-+ * By default QEMU SMMUv3 has no SubstreamID support. Update IDR1 if user
-+ * has enabled it.
-+ */
-+ s->idr[1] = FIELD_DP32(s->idr[1], IDR1, SSIDSIZE, s->ssidsize);
- }
-
- /* Based on SMUUv3 GPBA.ABORT configuration, attach a corresponding HWPT */
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index ef75a9bec0..49311f5bbf 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -611,9 +611,11 @@ static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg,
- }
- }
-
-- if (STE_S1CDMAX(ste) != 0) {
-+ /* Multiple context descriptors require SubstreamID support */
-+ if (!s->ssidsize && STE_S1CDMAX(ste) != 0) {
- qemu_log_mask(LOG_UNIMP,
-- "SMMUv3 does not support multiple context descriptors yet\n");
-+ "SMMUv3: multiple S1 context descriptors require SubstreamID support. "
-+ "Configure ssidsize > 0 (requires accel=on)\n");
- goto bad_ste;
- }
-
-@@ -1954,6 +1956,10 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- error_setg(errp, "OAS must be 44 bits when accel=off");
- return false;
- }
-+ if (s->ssidsize) {
-+ error_setg(errp, "ssidsize can only be set if accel=on");
-+ return false;
-+ }
- return true;
- }
-
-@@ -1968,6 +1974,11 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
- error_setg(errp, "OAS can only be set to 44 or 48 bits");
- return false;
- }
-+ if (s->ssidsize > SMMU_SSID_MAX_BITS) {
-+ error_setg(errp, "ssidsize must be in the range 0 to %d",
-+ SMMU_SSID_MAX_BITS);
-+ return false;
-+ }
-
- return true;
- }
-@@ -2096,6 +2107,7 @@ static const Property smmuv3_properties[] = {
- DEFINE_PROP_BOOL("ril", SMMUv3State, ril, true),
- DEFINE_PROP_BOOL("ats", SMMUv3State, ats, false),
- DEFINE_PROP_UINT8("oas", SMMUv3State, oas, 44),
-+ DEFINE_PROP_UINT8("ssidsize", SMMUv3State, ssidsize, 0),
- };
-
- static void smmuv3_instance_init(Object *obj)
-@@ -2129,6 +2141,12 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- object_class_property_set_description(klass, "oas",
- "Specify Output Address Size (for accel=on). Supported values "
- "are 44 or 48 bits. Defaults to 44 bits");
-+ object_class_property_set_description(klass, "ssidsize",
-+ "Number of bits used to represent SubstreamIDs (SSIDs). "
-+ "A value of N allows SSIDs in the range [0 .. 2^N - 1]. "
-+ "Valid range is 0-20, where 0 disables SubstreamID support. "
-+ "Defaults to 0. A value greater than 0 is required to enable "
-+ "PASID support.");
- }
-
- static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
-diff --git a/include/hw/arm/smmuv3-common.h b/include/hw/arm/smmuv3-common.h
-index bc2d49ef4e..4b764ed125 100644
---- a/include/hw/arm/smmuv3-common.h
-+++ b/include/hw/arm/smmuv3-common.h
-@@ -311,6 +311,7 @@ REG32(IDR1, 0x4)
- FIELD(IDR1, TABLES_PRESET, 30, 1)
- FIELD(IDR1, ECMDQ, 31, 1)
-
-+#define SMMU_SSID_MAX_BITS 20
- #define SMMU_IDR1_SIDSIZE 16
- #define SMMU_CMDQS 19
- #define SMMU_EVENTQS 19
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index d488a39cd0..26b2fc42fd 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -72,6 +72,7 @@ struct SMMUv3State {
- bool ril;
- bool ats;
- uint8_t oas;
-+ uint8_t ssidsize;
- };
-
- typedef enum {
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Read-and-propagate-host-vIOMMU-e.patch b/kvm-hw-arm-smmuv3-accel-Read-and-propagate-host-vIOMMU-e.patch
deleted file mode 100644
index 8730b82..0000000
--- a/kvm-hw-arm-smmuv3-accel-Read-and-propagate-host-vIOMMU-e.patch
+++ /dev/null
@@ -1,143 +0,0 @@
-From 6560e5f70f3f242b06b3523e1f910e25db719073 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 6 Mar 2026 09:01:11 +0000
-Subject: [PATCH 054/111] hw/arm/smmuv3-accel: Read and propagate host vIOMMU
- events
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [54/111] 87b794e5d88a3402c0f8250bd80eb65dd3435b2d (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73796
-
-Install an event handler on the vEVENTQ fd to read and propagate host
-generated vIOMMU events to the guest.
-
-The handler runs in QEMU's main loop, using a non-blocking fd registered
-via qemu_set_fd_handler().
-
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260226084456.112142-6-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit c0c97fbc6cf764f0d66d5122c4117d0770e89902)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 64 +++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 64 insertions(+)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index f703ea1aac..17306cd04b 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -390,6 +390,50 @@ bool smmuv3_accel_issue_inv_cmd(SMMUv3State *bs, void *cmd, SMMUDevice *sdev,
- sizeof(Cmd), &entry_num, cmd, errp);
- }
-
-+static void smmuv3_accel_event_read(void *opaque)
-+{
-+ SMMUv3State *s = opaque;
-+ IOMMUFDVeventq *veventq = s->s_accel->veventq;
-+ struct {
-+ struct iommufd_vevent_header hdr;
-+ struct iommu_vevent_arm_smmuv3 vevent;
-+ } buf;
-+ enum iommu_veventq_type type = IOMMU_VEVENTQ_TYPE_ARM_SMMUV3;
-+ uint32_t id = veventq->veventq_id;
-+ uint32_t last_seq = veventq->last_event_seq;
-+ ssize_t bytes;
-+
-+ bytes = read(veventq->veventq_fd, &buf, sizeof(buf));
-+ if (bytes <= 0) {
-+ if (errno == EAGAIN || errno == EINTR) {
-+ return;
-+ }
-+ error_report_once("vEVENTQ(type %u id %u): read failed (%m)", type, id);
-+ return;
-+ }
-+
-+ if (bytes == sizeof(buf.hdr) &&
-+ (buf.hdr.flags & IOMMU_VEVENTQ_FLAG_LOST_EVENTS)) {
-+ error_report_once("vEVENTQ(type %u id %u): overflowed", type, id);
-+ veventq->event_start = false;
-+ return;
-+ }
-+ if (bytes < sizeof(buf)) {
-+ error_report_once("vEVENTQ(type %u id %u): short read(%zd/%zd bytes)",
-+ type, id, bytes, sizeof(buf));
-+ return;
-+ }
-+
-+ /* Check sequence in hdr for lost events if any */
-+ if (veventq->event_start && (buf.hdr.sequence - last_seq != 1)) {
-+ error_report_once("vEVENTQ(type %u id %u): lost %u event(s)",
-+ type, id, buf.hdr.sequence - last_seq - 1);
-+ }
-+ veventq->last_event_seq = buf.hdr.sequence;
-+ veventq->event_start = true;
-+ smmuv3_propagate_event(s, (Evt *)&buf.vevent);
-+}
-+
- static void smmuv3_accel_free_veventq(SMMUv3AccelState *accel)
- {
- IOMMUFDVeventq *veventq = accel->veventq;
-@@ -397,6 +441,7 @@ static void smmuv3_accel_free_veventq(SMMUv3AccelState *accel)
- if (!veventq) {
- return;
- }
-+ qemu_set_fd_handler(veventq->veventq_fd, NULL, NULL, NULL);
- close(veventq->veventq_fd);
- iommufd_backend_free_id(accel->viommu->iommufd, veventq->veventq_id);
- g_free(veventq);
-@@ -424,6 +469,7 @@ bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp)
- IOMMUFDVeventq *veventq;
- uint32_t veventq_id;
- uint32_t veventq_fd;
-+ int flags;
-
- if (!accel || !accel->viommu) {
- return true;
-@@ -445,12 +491,30 @@ bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp)
- return false;
- }
-
-+ flags = fcntl(veventq_fd, F_GETFL);
-+ if (flags < 0) {
-+ error_setg_errno(errp, errno, "Failed to get flags for vEVENTQ fd");
-+ goto free_veventq;
-+ }
-+ if (fcntl(veventq_fd, F_SETFL, flags | O_NONBLOCK) < 0) {
-+ error_setg_errno(errp, errno, "Failed to set O_NONBLOCK on vEVENTQ fd");
-+ goto free_veventq;
-+ }
-+
- veventq = g_new0(IOMMUFDVeventq, 1);
- veventq->veventq_id = veventq_id;
- veventq->veventq_fd = veventq_fd;
- veventq->viommu = accel->viommu;
- accel->veventq = veventq;
-+
-+ /* Set up event handler for veventq fd */
-+ qemu_set_fd_handler(veventq_fd, smmuv3_accel_event_read, NULL, s);
- return true;
-+
-+free_veventq:
-+ close(veventq_fd);
-+ iommufd_backend_free_id(accel->viommu->iommufd, veventq_id);
-+ return false;
- }
-
- static bool
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Restrict-accelerated-SMMUv3-to-v.patch b/kvm-hw-arm-smmuv3-accel-Restrict-accelerated-SMMUv3-to-v.patch
deleted file mode 100644
index deb3471..0000000
--- a/kvm-hw-arm-smmuv3-accel-Restrict-accelerated-SMMUv3-to-v.patch
+++ /dev/null
@@ -1,198 +0,0 @@
-From 85d81ec5715c42de0019cbe8260ddbc6662f850b Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 013/111] hw/arm/smmuv3-accel: Restrict accelerated SMMUv3 to
- vfio-pci endpoints with iommufd
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [13/111] c7a4d250dd7429e1c136ad544552dd499e87af35 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Accelerated SMMUv3 is only meaningful when a device can leverage the host
-SMMUv3 in nested mode (S1+S2 translation). To keep the model consistent
-and correct, this mode is restricted to vfio-pci endpoint devices using
-the iommufd backend.
-
-Non-endpoint emulated devices such as PCIe root ports and bridges are also
-permitted so that vfio-pci devices can be attached downstream. All other
-device types are unsupported in accelerated mode.
-
-Implement supports_address_space() callback to reject all such unsupported
-devices.
-
-This restriction also avoids complications with IOTLB invalidations. Some
-TLBI commands (e.g. CMD_TLBI_NH_ASID) lack an associated SID, making it
-difficult to trace the originating device. Allowing emulated endpoints
-would require invalidating both QEMU’s software IOTLB and the host’s
-hardware IOTLB, which can significantly degrade performance.
-
-A key design choice is the address space returned for accelerated vfio-pci
-endpoints. VFIO core has a container that manages an HWPT. By default, it
-allocates a stage-1 normal HWPT, unless vIOMMU requests for a nesting
-parent HWPT for accelerated cases.
-
-VFIO core adds a listener for that HWPT and sets up a handler
-vfio_container_region_add() where it checks the memory region.
-
- -If the region is a non-IOMMU translated one (system address space), VFIO
- treats it as RAM and handles all stage-2 mappings for the core allocated
- nesting parent HWPT.
-
- -If the region is an IOMMU address space, VFIO instead enables IOTLB
- notifier handling and translation replay, skipping the RAM listener and
- therefore not installing stage-2 mappings.
-
-For accelerated SMMUv3, correct operation requires the S1+S2 nesting
-model, and therefore VFIO must take the "system address space" path so
-that stage-2 mappings are properly built. Returning an alias of the
-system address space ensures this happens. Returning the IOMMU address
-space would omit stage-2 mapping and break nested translation.
-
-Another option considered was forcing a pre-registration path using
-vfio_prereg_listener() to set up stage-2 mappings, but this requires
-changes in VFIO core and was not adopted. Returning an alias of the
-system address space keeps the design aligned with existing VFIO/iommufd
-nesting flows and avoids the need for cross-subsystem changes.
-
-In summary:
- - vfio-pci devices(with iommufd as backend) return an address space
- aliased to system address space.
- - bridges and root ports return the IOMMU address space.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-11-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit c7ecb4cf2e9458678d649ffd3b8aa61a7976552e)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 77 ++++++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 76 insertions(+), 1 deletion(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index b2eded743e..2fcd301322 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -7,8 +7,13 @@
- */
-
- #include "qemu/osdep.h"
-+#include "qemu/error-report.h"
-
- #include "hw/arm/smmuv3.h"
-+#include "hw/pci/pci_bridge.h"
-+#include "hw/pci-host/gpex.h"
-+#include "hw/vfio/pci.h"
-+
- #include "smmuv3-accel.h"
-
- /*
-@@ -37,6 +42,48 @@ static SMMUv3AccelDevice *smmuv3_accel_get_dev(SMMUState *bs, SMMUPciBus *sbus,
- return accel_dev;
- }
-
-+/*
-+ * Only allow PCIe bridges, pxb-pcie roots, and GPEX roots so vfio-pci
-+ * endpoints can sit downstream. Accelerated SMMUv3 requires a vfio-pci
-+ * endpoint using the iommufd backend; all other device types are rejected.
-+ * This avoids supporting emulated endpoints, which would complicate IOTLB
-+ * invalidation and hurt performance.
-+ */
-+static bool smmuv3_accel_pdev_allowed(PCIDevice *pdev, bool *vfio_pci)
-+{
-+
-+ if (object_dynamic_cast(OBJECT(pdev), TYPE_PCI_BRIDGE) ||
-+ object_dynamic_cast(OBJECT(pdev), TYPE_PXB_PCIE_DEV) ||
-+ object_dynamic_cast(OBJECT(pdev), TYPE_GPEX_ROOT_DEVICE)) {
-+ return true;
-+ } else if ((object_dynamic_cast(OBJECT(pdev), TYPE_VFIO_PCI))) {
-+ *vfio_pci = true;
-+ if (object_property_get_link(OBJECT(pdev), "iommufd", NULL)) {
-+ return true;
-+ }
-+ }
-+ return false;
-+}
-+
-+static bool smmuv3_accel_supports_as(PCIBus *bus, void *opaque, int devfn,
-+ Error **errp)
-+{
-+ PCIDevice *pdev = pci_find_device(bus, pci_bus_num(bus), devfn);
-+ bool vfio_pci = false;
-+
-+ if (pdev && !smmuv3_accel_pdev_allowed(pdev, &vfio_pci)) {
-+ if (vfio_pci) {
-+ error_setg(errp, "vfio-pci endpoint devices without an iommufd "
-+ "backend not allowed when using arm-smmuv3,accel=on");
-+
-+ } else {
-+ error_setg(errp, "Emulated endpoint devices are not allowed when "
-+ "using arm-smmuv3,accel=on");
-+ }
-+ return false;
-+ }
-+ return true;
-+}
- /*
- * Find or add an address space for the given PCI device.
- *
-@@ -47,15 +94,43 @@ static SMMUv3AccelDevice *smmuv3_accel_get_dev(SMMUState *bs, SMMUPciBus *sbus,
- static AddressSpace *smmuv3_accel_find_add_as(PCIBus *bus, void *opaque,
- int devfn)
- {
-+ PCIDevice *pdev = pci_find_device(bus, pci_bus_num(bus), devfn);
- SMMUState *bs = opaque;
- SMMUPciBus *sbus = smmu_get_sbus(bs, bus);
- SMMUv3AccelDevice *accel_dev = smmuv3_accel_get_dev(bs, sbus, bus, devfn);
- SMMUDevice *sdev = &accel_dev->sdev;
-+ bool vfio_pci = false;
-
-- return &sdev->as;
-+ if (pdev && !smmuv3_accel_pdev_allowed(pdev, &vfio_pci)) {
-+ /* Should never be here: supports_address_space() filters these out */
-+ g_assert_not_reached();
-+ }
-+
-+ /*
-+ * In the accelerated mode, a vfio-pci device attached via the iommufd
-+ * backend must remain in the system address space. Such a device is
-+ * always translated by its physical SMMU (using either a stage-2-only
-+ * STE or a nested STE), where the parent stage-2 page table is allocated
-+ * by the VFIO core to back the system address space.
-+ *
-+ * Return the shared_as_sysmem aliased to the global system memory in this
-+ * case. Sharing address_space_memory also allows devices under different
-+ * vSMMU instances in the same VM to reuse a single nesting parent HWPT in
-+ * the VFIO core.
-+ *
-+ * For non-endpoint emulated devices such as PCIe root ports and bridges,
-+ * which may use the normal emulated translation path and software IOTLBs,
-+ * return the SMMU's IOMMU address space.
-+ */
-+ if (vfio_pci) {
-+ return shared_as_sysmem;
-+ } else {
-+ return &sdev->as;
-+ }
- }
-
- static const PCIIOMMUOps smmuv3_accel_ops = {
-+ .supports_address_space = smmuv3_accel_supports_as,
- .get_address_space = smmuv3_accel_find_add_as,
- };
-
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-accel-Wire-CMDQV-ops-into-accel-lifecy.patch b/kvm-hw-arm-smmuv3-accel-Wire-CMDQV-ops-into-accel-lifecy.patch
deleted file mode 100644
index fbfa1ad..0000000
--- a/kvm-hw-arm-smmuv3-accel-Wire-CMDQV-ops-into-accel-lifecy.patch
+++ /dev/null
@@ -1,217 +0,0 @@
-From e65e13ba52d7bf68a18e0fbebe238e3fe1741008 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:29 +0100
-Subject: [PATCH 087/111] hw/arm/smmuv3-accel: Wire CMDQV ops into accel
- lifecycle
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [87/111] 478812c8d4b682cb6eb159100712ff6eeec32e16 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Add support for selecting and initializing a CMDQV backend based on the
-cmdqv OnOffAuto property.
-
-If set to OFF, CMDQV is not used and the default IOMMUFD-backed allocation
-path is taken.
-
-If set to AUTO, QEMU attempts to probe a CMDQV backend during device setup.
-If probing succeeds, the selected ops are stored in the accelerated SMMUv3
-state and used. If probing fails, QEMU silently falls back to the default
-path.
-
-If set to ON, QEMU requires CMDQV support. Probing is performed during
-setup and failure results in an error.
-
-When a CMDQV backend is active, its callbacks are used for vIOMMU
-allocation, free, and reset handling. Otherwise, the base implementation
-is used.
-
-The current implementation wires up the Tegra241 CMDQV backend through the
-generic ops interface. Functional CMDQV behaviour is added in subsequent
-patches.
-
-No functional change.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-9-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit f4ec4767ce0c1fe5b0b1adf5f559ca808c3c2aba)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 94 ++++++++++++++++++++++++++++++++++++++---
- include/hw/arm/smmuv3.h | 2 +
- 2 files changed, 89 insertions(+), 7 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 70b2581c17..3ceca56a67 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -19,6 +19,7 @@
- #include "smmuv3-internal.h"
- #include "smmuv3-accel.h"
- #include "system/system.h"
-+#include "tegra241-cmdqv.h"
-
- /*
- * The root region aliases the global system memory, and shared_as_sysmem
-@@ -570,6 +571,7 @@ smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *hiodi,
- Error **errp)
- {
- SMMUv3AccelState *accel = s->s_accel;
-+ const SMMUv3AccelCmdqvOps *cmdqv_ops = accel->cmdqv_ops;
- struct iommu_hwpt_arm_smmuv3 bypass_data = {
- .ste = { SMMU_STE_CFG_BYPASS | SMMU_STE_VALID, 0x0ULL },
- };
-@@ -580,10 +582,17 @@ smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *hiodi,
- uint32_t viommu_id, hwpt_id;
- IOMMUFDViommu *viommu;
-
-- if (!iommufd_backend_alloc_viommu(hiodi->iommufd, hiodi->devid,
-- IOMMU_VIOMMU_TYPE_ARM_SMMUV3, s2_hwpt_id,
-- NULL, 0, &viommu_id, errp)) {
-- return false;
-+ if (cmdqv_ops) {
-+ if (!cmdqv_ops->alloc_viommu(s, hiodi, &viommu_id, errp)) {
-+ return false;
-+ }
-+ } else {
-+ if (!iommufd_backend_alloc_viommu(hiodi->iommufd, hiodi->devid,
-+ IOMMU_VIOMMU_TYPE_ARM_SMMUV3,
-+ s2_hwpt_id, NULL, 0, &viommu_id,
-+ errp)) {
-+ return false;
-+ }
- }
-
- viommu = g_new0(IOMMUFDViommu, 1);
-@@ -629,12 +638,70 @@ free_bypass_hwpt:
- free_abort_hwpt:
- iommufd_backend_free_id(hiodi->iommufd, accel->abort_hwpt_id);
- free_viommu:
-- iommufd_backend_free_id(hiodi->iommufd, viommu->viommu_id);
-+ if (cmdqv_ops && cmdqv_ops->free_viommu) {
-+ cmdqv_ops->free_viommu(s);
-+ } else {
-+ iommufd_backend_free_id(hiodi->iommufd, viommu->viommu_id);
-+ }
- g_free(viommu);
- accel->viommu = NULL;
- return false;
- }
-
-+static const SMMUv3AccelCmdqvOps *
-+smmuv3_accel_probe_cmdqv(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
-+ Error **errp)
-+{
-+ const SMMUv3AccelCmdqvOps *ops = tegra241_cmdqv_get_ops();
-+
-+ if (!ops) {
-+ error_setg(errp, "No CMDQV ops found");
-+ return NULL;
-+ }
-+ g_assert(ops->probe);
-+ g_assert(ops->alloc_viommu);
-+
-+ if (!ops->probe(s, idev, errp)) {
-+ return NULL;
-+ }
-+ return ops;
-+}
-+
-+static bool
-+smmuv3_accel_select_cmdqv(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
-+ Error **errp)
-+{
-+ const SMMUv3AccelCmdqvOps *ops = NULL;
-+
-+ if (s->s_accel->cmdqv_ops) {
-+ return true;
-+ }
-+
-+ switch (s->cmdqv) {
-+ case ON_OFF_AUTO_OFF:
-+ s->s_accel->cmdqv_ops = NULL;
-+ return true;
-+ case ON_OFF_AUTO_AUTO:
-+ ops = smmuv3_accel_probe_cmdqv(s, idev, NULL);
-+ break;
-+ case ON_OFF_AUTO_ON:
-+ ops = smmuv3_accel_probe_cmdqv(s, idev, errp);
-+ if (!ops) {
-+ error_append_hint(errp, "CMDQV requested but not supported");
-+ return false;
-+ }
-+ break;
-+ default:
-+ g_assert_not_reached();
-+ }
-+
-+ if (ops && ops->init && !ops->init(s, errp)) {
-+ return false;
-+ }
-+ s->s_accel->cmdqv_ops = ops;
-+ return true;
-+}
-+
- static bool smmuv3_accel_set_iommu_device(PCIBus *bus, void *opaque, int devfn,
- HostIOMMUDevice *hiod, Error **errp)
- {
-@@ -669,6 +736,10 @@ static bool smmuv3_accel_set_iommu_device(PCIBus *bus, void *opaque, int devfn,
- goto done;
- }
-
-+ if (!smmuv3_accel_select_cmdqv(s, hiodi, errp)) {
-+ return false;
-+ }
-+
- if (!smmuv3_accel_alloc_viommu(s, hiodi, errp)) {
- error_append_hint(errp, "Unable to alloc vIOMMU: hiodi devid 0x%x: ",
- hiodi->devid);
-@@ -946,8 +1017,17 @@ bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp)
-
- void smmuv3_accel_reset(SMMUv3State *s)
- {
-- /* Attach a HWPT based on GBPA reset value */
-- smmuv3_accel_attach_gbpa_hwpt(s, NULL);
-+ SMMUv3AccelState *accel = s->s_accel;
-+
-+ if (!accel) {
-+ return;
-+ }
-+ /* Attach a HWPT based on GBPA reset value */
-+ smmuv3_accel_attach_gbpa_hwpt(s, NULL);
-+
-+ if (accel->cmdqv_ops && accel->cmdqv_ops->reset) {
-+ accel->cmdqv_ops->reset(s);
-+ }
- }
-
- static void smmuv3_accel_as_init(SMMUv3State *s)
-diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
-index 85be3d7467..34d0f65eaa 100644
---- a/include/hw/arm/smmuv3.h
-+++ b/include/hw/arm/smmuv3.h
-@@ -75,6 +75,8 @@ struct SMMUv3State {
- OnOffAuto ats;
- OasMode oas;
- SsidSizeMode ssidsize;
-+ /* SMMU CMDQV extension */
-+ OnOffAuto cmdqv;
-
- Notifier machine_done;
- };
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-common-Add-NSCFG-bit-definition-for-CD.patch b/kvm-hw-arm-smmuv3-common-Add-NSCFG-bit-definition-for-CD.patch
deleted file mode 100644
index 5b05a89..0000000
--- a/kvm-hw-arm-smmuv3-common-Add-NSCFG-bit-definition-for-CD.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 65ad5f09c955ddda26e37eab3178be5740f9aa27 Mon Sep 17 00:00:00 2001
-From: Tao Tang <tangtao1634@phytium.com.cn>
-Date: Sun, 21 Dec 2025 16:25:11 +0800
-Subject: [PATCH 018/111] hw/arm/smmuv3-common: Add NSCFG bit definition for CD
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [18/111] 881eb3ccb1c31e2207e8aa8b98d80fde6436cce3 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Add NSCFG bit definition for CD structure. This allows proper
-configuration of non-secure access settings in CD.
-
-Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
-Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Message-ID: <20260119161112.3841386-5-tangtao1634@phytium.com.cn>
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-(cherry picked from commit ee1c84ded10cf82674e494df4f6b92aef099e4fb)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- include/hw/arm/smmuv3-common.h | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/include/hw/arm/smmuv3-common.h b/include/hw/arm/smmuv3-common.h
-index 90300ad61c..06ef6e7720 100644
---- a/include/hw/arm/smmuv3-common.h
-+++ b/include/hw/arm/smmuv3-common.h
-@@ -123,11 +123,13 @@ REG32(CD_1, 4)
- FIELD(CD_1, A, 14, 1)
- FIELD(CD_1, ASID, 16, 16)
- REG32(CD_2, 8)
-+ FIELD(CD_2, NSCFG0, 0, 1)
- FIELD(CD_2, HAD0, 1, 1)
- FIELD(CD_2, TTB0_LO, 4, 28)
- REG32(CD_3, 12)
- FIELD(CD_3, TTB0_HI, 0, 20)
- REG32(CD_4, 16)
-+ FIELD(CD_4, NSCFG1, 0, 1)
- FIELD(CD_4, HAD1, 1, 1)
- FIELD(CD_4, TTB1_LO, 4, 28)
- REG32(CD_5, 20)
-@@ -155,6 +157,9 @@ REG32(CD_5, 20)
- #define CD_R(x) FIELD_EX32((x)->word[1], CD_1, R)
- #define CD_A(x) FIELD_EX32((x)->word[1], CD_1, A)
- #define CD_ASID(x) FIELD_EX32((x)->word[1], CD_1, ASID)
-+#define CD_NSCFG(x, sel) ((sel) ? \
-+ FIELD_EX32((x)->word[4], CD_4, NSCFG1) : \
-+ FIELD_EX32((x)->word[2], CD_2, NSCFG0))
- #define CD_HAD(x, sel) ((sel) ? \
- FIELD_EX32((x)->word[4], CD_4, HAD1) : \
- FIELD_EX32((x)->word[2], CD_2, HAD0))
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-common-Add-STE-CD-set-helpers-for-repe.patch b/kvm-hw-arm-smmuv3-common-Add-STE-CD-set-helpers-for-repe.patch
deleted file mode 100644
index 23c97d9..0000000
--- a/kvm-hw-arm-smmuv3-common-Add-STE-CD-set-helpers-for-repe.patch
+++ /dev/null
@@ -1,132 +0,0 @@
-From feef2df0075cedfa205ddad395c57cc09e928bee Mon Sep 17 00:00:00 2001
-From: Tao Tang <tangtao1634@phytium.com.cn>
-Date: Sun, 21 Dec 2025 16:28:00 +0800
-Subject: [PATCH 019/111] hw/arm/smmuv3-common: Add STE/CD set helpers for
- repeated field setup
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [19/111] d3b17fe755f5a98f7fee1bc231504fb44230d2a2 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-This change introduces STE_SET_* and CD_SET_* helpers to centralize and
-simplify repeated field setting logic.
-
-Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
-Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Message-ID: <20260119161112.3841386-6-tangtao1634@phytium.com.cn>
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-(cherry picked from commit 59a6b74aeb34c185e261a0cc8d0beb4591388422)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- include/hw/arm/smmuv3-common.h | 79 ++++++++++++++++++++++++++++++++++
- 1 file changed, 79 insertions(+)
-
-diff --git a/include/hw/arm/smmuv3-common.h b/include/hw/arm/smmuv3-common.h
-index 06ef6e7720..30101915e2 100644
---- a/include/hw/arm/smmuv3-common.h
-+++ b/include/hw/arm/smmuv3-common.h
-@@ -100,6 +100,37 @@ REG32(STE_7, 28)
- #define STE_CFG_ABORT(config) (!(config & 0x4))
- #define STE_CFG_BYPASS(config) (config == 0x4)
-
-+/* Update STE fields */
-+#define STE_SET_VALID(ste, v) \
-+ ((ste)->word[0] = FIELD_DP32((ste)->word[0], STE_0, VALID, (v)))
-+#define STE_SET_CONFIG(ste, v) \
-+ ((ste)->word[0] = FIELD_DP32((ste)->word[0], STE_0, CONFIG, (v)))
-+
-+#define STE_SET_CTXPTR(ste, v) do { \
-+ (ste)->word[0] = FIELD_DP32((ste)->word[0], STE_0, CTXPTR_LO, (v) >> 6); \
-+ (ste)->word[1] = FIELD_DP32((ste)->word[1], STE_1, CTXPTR_HI, (v) >> 32); \
-+} while (0)
-+#define STE_SET_S2T0SZ(ste, v) \
-+ ((ste)->word[5] = FIELD_DP32((ste)->word[5], STE_5, S2T0SZ, (v)))
-+#define STE_SET_S2SL0(ste, v) \
-+ ((ste)->word[5] = FIELD_DP32((ste)->word[5], STE_5, S2SL0, (v)))
-+#define STE_SET_S2TG(ste, v) \
-+ ((ste)->word[5] = FIELD_DP32((ste)->word[5], STE_5, S2TG, (v)))
-+#define STE_SET_S2PS(ste, v) \
-+ ((ste)->word[5] = FIELD_DP32((ste)->word[5], STE_5, S2PS, (v)))
-+#define STE_SET_S2AA64(ste, v) \
-+ ((ste)->word[5] = FIELD_DP32((ste)->word[5], STE_5, S2AA64, (v)))
-+#define STE_SET_S2ENDI(ste, v) \
-+ ((ste)->word[5] = FIELD_DP32((ste)->word[5], STE_5, S2ENDI, (v)))
-+#define STE_SET_S2AFFD(ste, v) \
-+ ((ste)->word[5] = FIELD_DP32((ste)->word[5], STE_5, S2AFFD, (v)))
-+#define STE_SET_S2S(ste, v) \
-+ ((ste)->word[5] = FIELD_DP32((ste)->word[5], STE_5, S2S, (v)))
-+#define STE_SET_S2TTB(ste, v) do { \
-+ (ste)->word[6] = FIELD_DP32((ste)->word[6], STE_6, S2TTB_LO, (v) >> 4); \
-+ (ste)->word[7] = FIELD_DP32((ste)->word[7], STE_7, S2TTB_HI, (v) >> 32); \
-+} while (0)
-+
- /* CD fields */
-
- REG32(CD_0, 0)
-@@ -169,6 +200,54 @@ REG32(CD_5, 20)
- (((uint64_t)FIELD_EX32((x)->word[3], CD_3, TTB0_HI) << 32) | \
- ((uint64_t)FIELD_EX32((x)->word[2], CD_2, TTB0_LO) << 4)))
-
-+/* Update CD fields */
-+#define CD_SET_VALID(cd, v) \
-+ ((cd)->word[0] = FIELD_DP32((cd)->word[0], CD_0, VALID, (v)))
-+#define CD_SET_ASID(cd, v) \
-+ ((cd)->word[1] = FIELD_DP32((cd)->word[1], CD_1, ASID, (v)))
-+#define CD_SET_TTB(cd, sel, v) do { \
-+ if (sel) { \
-+ (cd)->word[4] = FIELD_DP32((cd)->word[4], CD_4, TTB1_LO, (v) >> 4); \
-+ (cd)->word[5] = FIELD_DP32((cd)->word[5], CD_5, TTB1_HI, (v) >> 32); \
-+ } else { \
-+ (cd)->word[2] = FIELD_DP32((cd)->word[2], CD_2, TTB0_LO, (v) >> 4); \
-+ (cd)->word[3] = FIELD_DP32((cd)->word[3], CD_3, TTB0_HI, (v) >> 32); \
-+ } \
-+} while (0)
-+
-+#define CD_SET_TSZ(cd, sel, v) \
-+ ((cd)->word[0] = (sel) ? FIELD_DP32((cd)->word[0], CD_0, TSZ1, (v)) : \
-+ FIELD_DP32((cd)->word[0], CD_0, TSZ0, (v)))
-+#define CD_SET_TG(cd, sel, v) \
-+ ((cd)->word[0] = (sel) ? FIELD_DP32((cd)->word[0], CD_0, TG1, (v)) : \
-+ FIELD_DP32((cd)->word[0], CD_0, TG0, (v)))
-+#define CD_SET_EPD(cd, sel, v) \
-+ ((cd)->word[0] = (sel) ? FIELD_DP32((cd)->word[0], CD_0, EPD1, (v)) : \
-+ FIELD_DP32((cd)->word[0], CD_0, EPD0, (v)))
-+#define CD_SET_ENDI(cd, v) \
-+ ((cd)->word[0] = FIELD_DP32((cd)->word[0], CD_0, ENDI, (v)))
-+#define CD_SET_IPS(cd, v) \
-+ ((cd)->word[1] = FIELD_DP32((cd)->word[1], CD_1, IPS, (v)))
-+#define CD_SET_AFFD(cd, v) \
-+ ((cd)->word[1] = FIELD_DP32((cd)->word[1], CD_1, AFFD, (v)))
-+#define CD_SET_TBI(cd, v) \
-+ ((cd)->word[1] = FIELD_DP32((cd)->word[1], CD_1, TBI, (v)))
-+#define CD_SET_HD(cd, v) \
-+ ((cd)->word[1] = FIELD_DP32((cd)->word[1], CD_1, HD, (v)))
-+#define CD_SET_HA(cd, v) \
-+ ((cd)->word[1] = FIELD_DP32((cd)->word[1], CD_1, HA, (v)))
-+#define CD_SET_S(cd, v) \
-+ ((cd)->word[1] = FIELD_DP32((cd)->word[1], CD_1, S, (v)))
-+#define CD_SET_R(cd, v) \
-+ ((cd)->word[1] = FIELD_DP32((cd)->word[1], CD_1, R, (v)))
-+#define CD_SET_A(cd, v) \
-+ ((cd)->word[1] = FIELD_DP32((cd)->word[1], CD_1, A, (v)))
-+#define CD_SET_AARCH64(cd, v) \
-+ ((cd)->word[1] = FIELD_DP32((cd)->word[1], CD_1, AARCH64, (v)))
-+#define CD_SET_NSCFG(cd, sel, v) \
-+ ((sel) ? ((cd)->word[4] = FIELD_DP32((cd)->word[4], CD_4, NSCFG1, (v))) : \
-+ ((cd)->word[2] = FIELD_DP32((cd)->word[2], CD_2, NSCFG0, (v))))
-+
- /* MMIO Registers */
-
- REG32(IDR0, 0x0)
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-common-Define-STE-CD-fields-via-regist.patch b/kvm-hw-arm-smmuv3-common-Define-STE-CD-fields-via-regist.patch
deleted file mode 100644
index 48cd5d9..0000000
--- a/kvm-hw-arm-smmuv3-common-Define-STE-CD-fields-via-regist.patch
+++ /dev/null
@@ -1,235 +0,0 @@
-From dade45312b53d2bf2bb29337eaff362816c7e119 Mon Sep 17 00:00:00 2001
-From: Tao Tang <tangtao1634@phytium.com.cn>
-Date: Sun, 21 Dec 2025 12:46:12 +0800
-Subject: [PATCH 017/111] hw/arm/smmuv3-common: Define STE/CD fields via
- registerfields
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [17/111] c466c568db1c9242dd6eecd772c6aeb69277bd5e (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Conflicts: replace hw/core/registerfields.h by former
- hw/registerfields.h because we don't have
-3e7316044d9c include: move hw/registerfields.h to hw/core/
-
-Switch STE/CD bitfield definitions and accessors to the
-'registerfields.h' REG/FIELD API.
-
-Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
-Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Message-ID: <20260119161112.3841386-3-tangtao1634@phytium.com.cn>
-[PMD: Updated STE::CTXPTR_HI, STE::S2TTB_HI and CD:TTBx_HI lengths]
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-(cherry picked from commit 0a50d06fa1dd5425077c71f223ef29be9b36fe45)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- include/hw/arm/smmuv3-common.h | 169 +++++++++++++++++++++++----------
- 1 file changed, 120 insertions(+), 49 deletions(-)
-
-diff --git a/include/hw/arm/smmuv3-common.h b/include/hw/arm/smmuv3-common.h
-index 9da817f41a..90300ad61c 100644
---- a/include/hw/arm/smmuv3-common.h
-+++ b/include/hw/arm/smmuv3-common.h
-@@ -11,6 +11,8 @@
- #ifndef HW_ARM_SMMUV3_COMMON_H
- #define HW_ARM_SMMUV3_COMMON_H
-
-+#include "hw/registerfields.h"
-+
- /* Configuration Data */
-
- /* STE Level 1 Descriptor */
-@@ -35,63 +37,132 @@ typedef struct CD {
-
- /* STE fields */
-
--#define STE_VALID(x) extract32((x)->word[0], 0, 1)
-+REG32(STE_0, 0)
-+ FIELD(STE_0, VALID, 0, 1)
-+ FIELD(STE_0, CONFIG, 1, 3)
-+ FIELD(STE_0, S1FMT, 4, 2)
-+ FIELD(STE_0, CTXPTR_LO, 6, 26)
-+REG32(STE_1, 4)
-+ FIELD(STE_1, CTXPTR_HI, 0, 24)
-+ FIELD(STE_1, S1CDMAX, 27, 5)
-+REG32(STE_2, 8)
-+ FIELD(STE_2, S1STALLD, 27, 1)
-+ FIELD(STE_2, EATS, 28, 2)
-+ FIELD(STE_2, STRW, 30, 2)
-+REG32(STE_4, 16)
-+ FIELD(STE_4, S2VMID, 0, 16)
-+REG32(STE_5, 20)
-+ FIELD(STE_5, S2T0SZ, 0, 6)
-+ FIELD(STE_5, S2SL0, 6, 2)
-+ FIELD(STE_5, S2TG, 14, 2)
-+ FIELD(STE_5, S2PS, 16, 3)
-+ FIELD(STE_5, S2AA64, 19, 1)
-+ FIELD(STE_5, S2ENDI, 20, 1)
-+ FIELD(STE_5, S2AFFD, 21, 1)
-+ FIELD(STE_5, S2HD, 23, 1)
-+ FIELD(STE_5, S2HA, 24, 1)
-+ FIELD(STE_5, S2S, 25, 1)
-+ FIELD(STE_5, S2R, 26, 1)
-+REG32(STE_6, 24)
-+ FIELD(STE_6, S2TTB_LO, 4, 28)
-+REG32(STE_7, 28)
-+ FIELD(STE_7, S2TTB_HI, 0, 20)
-+
-+/* Get STE fields */
-+#define STE_VALID(x) FIELD_EX32((x)->word[0], STE_0, VALID)
-+#define STE_CONFIG(x) FIELD_EX32((x)->word[0], STE_0, CONFIG)
-+#define STE_S1FMT(x) FIELD_EX32((x)->word[0], STE_0, S1FMT)
-+#define STE_CTXPTR(x) \
-+ (((uint64_t)FIELD_EX32((x)->word[0], STE_0, CTXPTR_LO) << 6) | \
-+ ((uint64_t)FIELD_EX32((x)->word[1], STE_1, CTXPTR_HI) << 32))
-+#define STE_S1CDMAX(x) FIELD_EX32((x)->word[1], STE_1, S1CDMAX)
-+#define STE_S1STALLD(x) FIELD_EX32((x)->word[2], STE_2, S1STALLD)
-+#define STE_EATS(x) FIELD_EX32((x)->word[2], STE_2, EATS)
-+#define STE_STRW(x) FIELD_EX32((x)->word[2], STE_2, STRW)
-+#define STE_S2VMID(x) FIELD_EX32((x)->word[4], STE_4, S2VMID)
-+#define STE_S2T0SZ(x) FIELD_EX32((x)->word[5], STE_5, S2T0SZ)
-+#define STE_S2SL0(x) FIELD_EX32((x)->word[5], STE_5, S2SL0)
-+#define STE_S2TG(x) FIELD_EX32((x)->word[5], STE_5, S2TG)
-+#define STE_S2PS(x) FIELD_EX32((x)->word[5], STE_5, S2PS)
-+#define STE_S2AA64(x) FIELD_EX32((x)->word[5], STE_5, S2AA64)
-+#define STE_S2ENDI(x) FIELD_EX32((x)->word[5], STE_5, S2ENDI)
-+#define STE_S2AFFD(x) FIELD_EX32((x)->word[5], STE_5, S2AFFD)
-+#define STE_S2HD(x) FIELD_EX32((x)->word[5], STE_5, S2HD)
-+#define STE_S2HA(x) FIELD_EX32((x)->word[5], STE_5, S2HA)
-+#define STE_S2S(x) FIELD_EX32((x)->word[5], STE_5, S2S)
-+#define STE_S2R(x) FIELD_EX32((x)->word[5], STE_5, S2R)
-+#define STE_S2TTB(x) \
-+ (((uint64_t)FIELD_EX32((x)->word[6], STE_6, S2TTB_LO) << 4) | \
-+ ((uint64_t)FIELD_EX32((x)->word[7], STE_7, S2TTB_HI) << 32))
-
--#define STE_CONFIG(x) extract32((x)->word[0], 1, 3)
- #define STE_CFG_S1_ENABLED(config) (config & 0x1)
- #define STE_CFG_S2_ENABLED(config) (config & 0x2)
- #define STE_CFG_ABORT(config) (!(config & 0x4))
- #define STE_CFG_BYPASS(config) (config == 0x4)
-
--#define STE_S1FMT(x) extract32((x)->word[0], 4 , 2)
--#define STE_S1CDMAX(x) extract32((x)->word[1], 27, 5)
--#define STE_S1STALLD(x) extract32((x)->word[2], 27, 1)
--#define STE_EATS(x) extract32((x)->word[2], 28, 2)
--#define STE_STRW(x) extract32((x)->word[2], 30, 2)
--#define STE_S2VMID(x) extract32((x)->word[4], 0 , 16)
--#define STE_S2T0SZ(x) extract32((x)->word[5], 0 , 6)
--#define STE_S2SL0(x) extract32((x)->word[5], 6 , 2)
--#define STE_S2TG(x) extract32((x)->word[5], 14, 2)
--#define STE_S2PS(x) extract32((x)->word[5], 16, 3)
--#define STE_S2AA64(x) extract32((x)->word[5], 19, 1)
--#define STE_S2ENDI(x) extract32((x)->word[5], 20, 1)
--#define STE_S2AFFD(x) extract32((x)->word[5], 21, 1)
--#define STE_S2HD(x) extract32((x)->word[5], 23, 1)
--#define STE_S2HA(x) extract32((x)->word[5], 24, 1)
--#define STE_S2S(x) extract32((x)->word[5], 25, 1)
--#define STE_S2R(x) extract32((x)->word[5], 26, 1)
--
--#define STE_CTXPTR(x) \
-- ((extract64((x)->word[1], 0, 16) << 32) | \
-- ((x)->word[0] & 0xffffffc0))
--
--#define STE_S2TTB(x) \
-- ((extract64((x)->word[7], 0, 16) << 32) | \
-- ((x)->word[6] & 0xfffffff0))
--
- /* CD fields */
-
--#define CD_VALID(x) extract32((x)->word[0], 31, 1)
--#define CD_ASID(x) extract32((x)->word[1], 16, 16)
--#define CD_TTB(x, sel) \
-- ((extract64((x)->word[(sel) * 2 + 3], 0, 19) << 32) | \
-- ((x)->word[(sel) * 2 + 2] & ~0xfULL))
--
--#define CD_HAD(x, sel) extract32((x)->word[(sel) * 2 + 2], 1, 1)
--
--#define CD_TSZ(x, sel) extract32((x)->word[0], (16 * (sel)) + 0, 6)
--#define CD_TG(x, sel) extract32((x)->word[0], (16 * (sel)) + 6, 2)
--#define CD_EPD(x, sel) extract32((x)->word[0], (16 * (sel)) + 14, 1)
--#define CD_ENDI(x) extract32((x)->word[0], 15, 1)
--#define CD_IPS(x) extract32((x)->word[1], 0 , 3)
--#define CD_AFFD(x) extract32((x)->word[1], 3 , 1)
--#define CD_TBI(x) extract32((x)->word[1], 6 , 2)
--#define CD_HD(x) extract32((x)->word[1], 10 , 1)
--#define CD_HA(x) extract32((x)->word[1], 11 , 1)
--#define CD_S(x) extract32((x)->word[1], 12, 1)
--#define CD_R(x) extract32((x)->word[1], 13, 1)
--#define CD_A(x) extract32((x)->word[1], 14, 1)
--#define CD_AARCH64(x) extract32((x)->word[1], 9 , 1)
-+REG32(CD_0, 0)
-+ FIELD(CD_0, TSZ0, 0, 6)
-+ FIELD(CD_0, TG0, 6, 2)
-+ FIELD(CD_0, EPD0, 14, 1)
-+ FIELD(CD_0, ENDI, 15, 1)
-+ FIELD(CD_0, TSZ1, 16, 6)
-+ FIELD(CD_0, TG1, 22, 2)
-+ FIELD(CD_0, EPD1, 30, 1)
-+ FIELD(CD_0, VALID, 31, 1)
-+REG32(CD_1, 4)
-+ FIELD(CD_1, IPS, 0, 3)
-+ FIELD(CD_1, AFFD, 3, 1)
-+ FIELD(CD_1, TBI, 6, 2)
-+ FIELD(CD_1, AARCH64, 9, 1)
-+ FIELD(CD_1, HD, 10, 1)
-+ FIELD(CD_1, HA, 11, 1)
-+ FIELD(CD_1, S, 12, 1)
-+ FIELD(CD_1, R, 13, 1)
-+ FIELD(CD_1, A, 14, 1)
-+ FIELD(CD_1, ASID, 16, 16)
-+REG32(CD_2, 8)
-+ FIELD(CD_2, HAD0, 1, 1)
-+ FIELD(CD_2, TTB0_LO, 4, 28)
-+REG32(CD_3, 12)
-+ FIELD(CD_3, TTB0_HI, 0, 20)
-+REG32(CD_4, 16)
-+ FIELD(CD_4, HAD1, 1, 1)
-+ FIELD(CD_4, TTB1_LO, 4, 28)
-+REG32(CD_5, 20)
-+ FIELD(CD_5, TTB1_HI, 0, 20)
-+
-+/* Get CD fields */
-+#define CD_TSZ(x, sel) ((sel) ? \
-+ FIELD_EX32((x)->word[0], CD_0, TSZ1) : \
-+ FIELD_EX32((x)->word[0], CD_0, TSZ0))
-+#define CD_TG(x, sel) ((sel) ? \
-+ FIELD_EX32((x)->word[0], CD_0, TG1) : \
-+ FIELD_EX32((x)->word[0], CD_0, TG0))
-+#define CD_EPD(x, sel) ((sel) ? \
-+ FIELD_EX32((x)->word[0], CD_0, EPD1) : \
-+ FIELD_EX32((x)->word[0], CD_0, EPD0))
-+#define CD_ENDI(x) FIELD_EX32((x)->word[0], CD_0, ENDI)
-+#define CD_VALID(x) FIELD_EX32((x)->word[0], CD_0, VALID)
-+#define CD_IPS(x) FIELD_EX32((x)->word[1], CD_1, IPS)
-+#define CD_AFFD(x) FIELD_EX32((x)->word[1], CD_1, AFFD)
-+#define CD_TBI(x) FIELD_EX32((x)->word[1], CD_1, TBI)
-+#define CD_AARCH64(x) FIELD_EX32((x)->word[1], CD_1, AARCH64)
-+#define CD_HD(x) FIELD_EX32((x)->word[1], CD_1, HD)
-+#define CD_HA(x) FIELD_EX32((x)->word[1], CD_1, HA)
-+#define CD_S(x) FIELD_EX32((x)->word[1], CD_1, S)
-+#define CD_R(x) FIELD_EX32((x)->word[1], CD_1, R)
-+#define CD_A(x) FIELD_EX32((x)->word[1], CD_1, A)
-+#define CD_ASID(x) FIELD_EX32((x)->word[1], CD_1, ASID)
-+#define CD_HAD(x, sel) ((sel) ? \
-+ FIELD_EX32((x)->word[4], CD_4, HAD1) : \
-+ FIELD_EX32((x)->word[2], CD_2, HAD0))
-+#define CD_TTB(x, sel) \
-+ ((sel) ? (((uint64_t)FIELD_EX32((x)->word[5], CD_5, TTB1_HI) << 32) | \
-+ ((uint64_t)FIELD_EX32((x)->word[4], CD_4, TTB1_LO) << 4)) : \
-+ (((uint64_t)FIELD_EX32((x)->word[3], CD_3, TTB0_HI) << 32) | \
-+ ((uint64_t)FIELD_EX32((x)->word[2], CD_2, TTB0_LO) << 4)))
-
- /* MMIO Registers */
-
---
-2.52.0
-
diff --git a/kvm-hw-arm-smmuv3-propagate-smmuv3_cmdq_consume-errors-t.patch b/kvm-hw-arm-smmuv3-propagate-smmuv3_cmdq_consume-errors-t.patch
deleted file mode 100644
index a9453ce..0000000
--- a/kvm-hw-arm-smmuv3-propagate-smmuv3_cmdq_consume-errors-t.patch
+++ /dev/null
@@ -1,205 +0,0 @@
-From c57870a0ab4ec54fd7d5e9527a72e709d7416589 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 021/111] hw/arm/smmuv3: propagate smmuv3_cmdq_consume() errors
- to caller
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [21/111] d548a7201d043a4e0e8ade5c10a3f19ca03357cc (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-smmuv3_cmdq_consume() is updated to return detailed errors via errp.
-
-Although this is currently a no-op, it prepares the ground for accel
-SMMUv3 specific command handling where proper error reporting will be
-useful.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-14-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 95d855167af43e958903f29430f563205b8b2afd)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3.c | 67 +++++++++++++++++++++++++++----------------------
- 1 file changed, 37 insertions(+), 30 deletions(-)
-
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index ef991cb7d8..374ae08baa 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1279,7 +1279,7 @@ static void smmuv3_range_inval(SMMUState *s, Cmd *cmd, SMMUStage stage)
- }
- }
-
--static int smmuv3_cmdq_consume(SMMUv3State *s)
-+static int smmuv3_cmdq_consume(SMMUv3State *s, Error **errp)
- {
- SMMUState *bs = ARM_SMMU(s);
- SMMUCmdError cmd_error = SMMU_CERROR_NONE;
-@@ -1547,42 +1547,44 @@ static MemTxResult smmu_writell(SMMUv3State *s, hwaddr offset,
- static MemTxResult smmu_writel(SMMUv3State *s, hwaddr offset,
- uint64_t data, MemTxAttrs attrs)
- {
-+ Error *local_err = NULL;
-+
- switch (offset) {
- case A_CR0:
- s->cr[0] = data;
- s->cr0ack = data & ~SMMU_CR0_RESERVED;
- /* in case the command queue has been enabled */
-- smmuv3_cmdq_consume(s);
-- return MEMTX_OK;
-+ smmuv3_cmdq_consume(s, &local_err);
-+ break;
- case A_CR1:
- s->cr[1] = data;
-- return MEMTX_OK;
-+ break;
- case A_CR2:
- s->cr[2] = data;
-- return MEMTX_OK;
-+ break;
- case A_IRQ_CTRL:
- s->irq_ctrl = data;
-- return MEMTX_OK;
-+ break;
- case A_GERRORN:
- smmuv3_write_gerrorn(s, data);
- /*
- * By acknowledging the CMDQ_ERR, SW may notify cmds can
- * be processed again
- */
-- smmuv3_cmdq_consume(s);
-- return MEMTX_OK;
-+ smmuv3_cmdq_consume(s, &local_err);
-+ break;
- case A_GERROR_IRQ_CFG0: /* 64b */
- s->gerror_irq_cfg0 = deposit64(s->gerror_irq_cfg0, 0, 32, data);
-- return MEMTX_OK;
-+ break;
- case A_GERROR_IRQ_CFG0 + 4:
- s->gerror_irq_cfg0 = deposit64(s->gerror_irq_cfg0, 32, 32, data);
-- return MEMTX_OK;
-+ break;
- case A_GERROR_IRQ_CFG1:
- s->gerror_irq_cfg1 = data;
-- return MEMTX_OK;
-+ break;
- case A_GERROR_IRQ_CFG2:
- s->gerror_irq_cfg2 = data;
-- return MEMTX_OK;
-+ break;
- case A_GBPA:
- /*
- * If UPDATE is not set, the write is ignored. This is the only
-@@ -1592,71 +1594,76 @@ static MemTxResult smmu_writel(SMMUv3State *s, hwaddr offset,
- /* Ignore update bit as write is synchronous. */
- s->gbpa = data & ~R_GBPA_UPDATE_MASK;
- }
-- return MEMTX_OK;
-+ break;
- case A_STRTAB_BASE: /* 64b */
- s->strtab_base = deposit64(s->strtab_base, 0, 32, data);
-- return MEMTX_OK;
-+ break;
- case A_STRTAB_BASE + 4:
- s->strtab_base = deposit64(s->strtab_base, 32, 32, data);
-- return MEMTX_OK;
-+ break;
- case A_STRTAB_BASE_CFG:
- s->strtab_base_cfg = data;
- if (FIELD_EX32(data, STRTAB_BASE_CFG, FMT) == 1) {
- s->sid_split = FIELD_EX32(data, STRTAB_BASE_CFG, SPLIT);
- s->features |= SMMU_FEATURE_2LVL_STE;
- }
-- return MEMTX_OK;
-+ break;
- case A_CMDQ_BASE: /* 64b */
- s->cmdq.base = deposit64(s->cmdq.base, 0, 32, data);
- s->cmdq.log2size = extract64(s->cmdq.base, 0, 5);
- if (s->cmdq.log2size > SMMU_CMDQS) {
- s->cmdq.log2size = SMMU_CMDQS;
- }
-- return MEMTX_OK;
-+ break;
- case A_CMDQ_BASE + 4: /* 64b */
- s->cmdq.base = deposit64(s->cmdq.base, 32, 32, data);
-- return MEMTX_OK;
-+ break;
- case A_CMDQ_PROD:
- s->cmdq.prod = data;
-- smmuv3_cmdq_consume(s);
-- return MEMTX_OK;
-+ smmuv3_cmdq_consume(s, &local_err);
-+ break;
- case A_CMDQ_CONS:
- s->cmdq.cons = data;
-- return MEMTX_OK;
-+ break;
- case A_EVENTQ_BASE: /* 64b */
- s->eventq.base = deposit64(s->eventq.base, 0, 32, data);
- s->eventq.log2size = extract64(s->eventq.base, 0, 5);
- if (s->eventq.log2size > SMMU_EVENTQS) {
- s->eventq.log2size = SMMU_EVENTQS;
- }
-- return MEMTX_OK;
-+ break;
- case A_EVENTQ_BASE + 4:
- s->eventq.base = deposit64(s->eventq.base, 32, 32, data);
-- return MEMTX_OK;
-+ break;
- case A_EVENTQ_PROD:
- s->eventq.prod = data;
-- return MEMTX_OK;
-+ break;
- case A_EVENTQ_CONS:
- s->eventq.cons = data;
-- return MEMTX_OK;
-+ break;
- case A_EVENTQ_IRQ_CFG0: /* 64b */
- s->eventq_irq_cfg0 = deposit64(s->eventq_irq_cfg0, 0, 32, data);
-- return MEMTX_OK;
-+ break;
- case A_EVENTQ_IRQ_CFG0 + 4:
- s->eventq_irq_cfg0 = deposit64(s->eventq_irq_cfg0, 32, 32, data);
-- return MEMTX_OK;
-+ break;
- case A_EVENTQ_IRQ_CFG1:
- s->eventq_irq_cfg1 = data;
-- return MEMTX_OK;
-+ break;
- case A_EVENTQ_IRQ_CFG2:
- s->eventq_irq_cfg2 = data;
-- return MEMTX_OK;
-+ break;
- default:
- qemu_log_mask(LOG_UNIMP,
- "%s Unexpected 32-bit access to 0x%"PRIx64" (WI)\n",
- __func__, offset);
-- return MEMTX_OK;
-+ break;
- }
-+
-+ if (local_err) {
-+ error_report_err(local_err);
-+ }
-+ return MEMTX_OK;
- }
-
- static MemTxResult smmu_write_mmio(void *opaque, hwaddr offset, uint64_t data,
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Add-Tegra241-CMDQV-ops-backend.patch b/kvm-hw-arm-tegra241-cmdqv-Add-Tegra241-CMDQV-ops-backend.patch
deleted file mode 100644
index 60b784d..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Add-Tegra241-CMDQV-ops-backend.patch
+++ /dev/null
@@ -1,194 +0,0 @@
-From 47e539f1cfed8264f2fb82a169598e2dc7d73e61 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:28 +0100
-Subject: [PATCH 086/111] hw/arm/tegra241-cmdqv: Add Tegra241 CMDQV ops backend
- stub
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [86/111] 516b341a36eced6dbaab054d06afb4c57f78eda4 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Conflicts: contextual conflict in hw/arm/Kconfig as we don't have
-FSL_IMX8MM FSL_IMX8MM_EVK configs
-
-Introduce a Tegra241 CMDQV backend that plugs into the SMMUv3 accelerated
-CMDQV ops interface.
-
-This patch wires up the Tegra241 CMDQV backend and provides a stub
-implementation for CMDQV probe, initialization, vIOMMU allocation
-and reset handling.
-
-Functional CMDQV support is added in follow-up patches.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-8-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit bc2fd5ce6ca0f06559c5f9c4f682642ec9d20b25)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/Kconfig | 5 ++++
- hw/arm/meson.build | 2 ++
- hw/arm/tegra241-cmdqv-stubs.c | 16 ++++++++++
- hw/arm/tegra241-cmdqv.c | 56 +++++++++++++++++++++++++++++++++++
- hw/arm/tegra241-cmdqv.h | 15 ++++++++++
- 5 files changed, 94 insertions(+)
- create mode 100644 hw/arm/tegra241-cmdqv-stubs.c
- create mode 100644 hw/arm/tegra241-cmdqv.c
- create mode 100644 hw/arm/tegra241-cmdqv.h
-
-diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
-index 1f49550c61..f7bdcfdc83 100644
---- a/hw/arm/Kconfig
-+++ b/hw/arm/Kconfig
-@@ -622,6 +622,10 @@ config FSL_IMX8MP_EVK
- depends on TCG && AARCH64
- select FSL_IMX8MP
-
-+config TEGRA241_CMDQV
-+ bool
-+ depends on ARM_SMMUV3_ACCEL
-+
- config ARM_SMMUV3_ACCEL
- bool
- depends on ARM_SMMUV3
-@@ -629,6 +633,7 @@ config ARM_SMMUV3_ACCEL
- config ARM_SMMUV3
- bool
- select ARM_SMMUV3_ACCEL if IOMMUFD
-+ imply TEGRA241_CMDQV
-
- config FSL_IMX6UL
- bool
-diff --git a/hw/arm/meson.build b/hw/arm/meson.build
-index b3f2e4d5dd..18b96b657c 100644
---- a/hw/arm/meson.build
-+++ b/hw/arm/meson.build
-@@ -64,6 +64,8 @@ arm_common_ss.add(when: 'CONFIG_FSL_IMX8MP_EVK', if_true: files('imx8mp-evk.c'))
- arm_common_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmuv3.c'))
- arm_common_ss.add(when: 'CONFIG_ARM_SMMUV3_ACCEL', if_true: files('smmuv3-accel.c'))
- stub_ss.add(files('smmuv3-accel-stubs.c'))
-+arm_common_ss.add(when: 'CONFIG_TEGRA241_CMDQV', if_true: files('tegra241-cmdqv.c'))
-+stub_ss.add(files('tegra241-cmdqv-stubs.c'))
- arm_common_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c', 'mcimx6ul-evk.c'))
- arm_common_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c'))
- arm_ss.add(when: 'CONFIG_XEN', if_true: files(
-diff --git a/hw/arm/tegra241-cmdqv-stubs.c b/hw/arm/tegra241-cmdqv-stubs.c
-new file mode 100644
-index 0000000000..4669f5c5f5
---- /dev/null
-+++ b/hw/arm/tegra241-cmdqv-stubs.c
-@@ -0,0 +1,16 @@
-+/*
-+ * Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved
-+ *
-+ * Stubs for Tegra241 CMDQ-Virtualization extension for SMMUv3
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#include "qemu/osdep.h"
-+#include "smmuv3-accel.h"
-+#include "hw/arm/tegra241-cmdqv.h"
-+
-+const SMMUv3AccelCmdqvOps *tegra241_cmdqv_get_ops(void)
-+{
-+ return NULL;
-+}
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-new file mode 100644
-index 0000000000..ad5a0d4611
---- /dev/null
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -0,0 +1,56 @@
-+/*
-+ * Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved
-+ * NVIDIA Tegra241 CMDQ-Virtualization extension for SMMUv3
-+ *
-+ * Written by Nicolin Chen, Shameer Kolothum
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#include "qemu/osdep.h"
-+
-+#include "hw/arm/smmuv3.h"
-+#include "smmuv3-accel.h"
-+#include "tegra241-cmdqv.h"
-+
-+static void tegra241_cmdqv_free_viommu(SMMUv3State *s)
-+{
-+}
-+
-+static bool
-+tegra241_cmdqv_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
-+ uint32_t *out_viommu_id, Error **errp)
-+{
-+ error_setg(errp, "NVIDIA Tegra241 CMDQV is unsupported");
-+ return false;
-+}
-+
-+static void tegra241_cmdqv_reset(SMMUv3State *s)
-+{
-+}
-+
-+static bool tegra241_cmdqv_init(SMMUv3State *s, Error **errp)
-+{
-+ error_setg(errp, "NVIDIA Tegra241 CMDQV is unsupported");
-+ return false;
-+}
-+
-+static bool tegra241_cmdqv_probe(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
-+ Error **errp)
-+{
-+ error_setg(errp, "NVIDIA Tegra241 CMDQV is unsupported");
-+ return false;
-+}
-+
-+static const SMMUv3AccelCmdqvOps tegra241_cmdqv_ops = {
-+ .probe = tegra241_cmdqv_probe,
-+ .init = tegra241_cmdqv_init,
-+ .alloc_viommu = tegra241_cmdqv_alloc_viommu,
-+ .free_viommu = tegra241_cmdqv_free_viommu,
-+ .reset = tegra241_cmdqv_reset,
-+};
-+
-+const SMMUv3AccelCmdqvOps *tegra241_cmdqv_get_ops(void)
-+{
-+ return &tegra241_cmdqv_ops;
-+}
-diff --git a/hw/arm/tegra241-cmdqv.h b/hw/arm/tegra241-cmdqv.h
-new file mode 100644
-index 0000000000..74a6954017
---- /dev/null
-+++ b/hw/arm/tegra241-cmdqv.h
-@@ -0,0 +1,15 @@
-+/*
-+ * Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved
-+ * NVIDIA Tegra241 CMDQ-Virtualization extension for SMMUv3
-+ *
-+ * Written by Nicolin Chen, Shameer Kolothum
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#ifndef HW_ARM_TEGRA241_CMDQV_H
-+#define HW_ARM_TEGRA241_CMDQV_H
-+
-+const SMMUv3AccelCmdqvOps *tegra241_cmdqv_get_ops(void);
-+
-+#endif /* HW_ARM_TEGRA241_CMDQV_H */
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Allocate-HW-VCMDQs-once-config.patch b/kvm-hw-arm-tegra241-cmdqv-Allocate-HW-VCMDQs-once-config.patch
deleted file mode 100644
index f09c802..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Allocate-HW-VCMDQs-once-config.patch
+++ /dev/null
@@ -1,390 +0,0 @@
-From 829d4bd1b7a39838071d95fb93bb3fc46f09fd8d Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:39 +0100
-Subject: [PATCH 097/111] hw/arm/tegra241-cmdqv: Allocate HW VCMDQs once
- configured
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [97/111] 8926f87f22c76e5fbeae87f101d325f2b902e245 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Add support for allocating IOMMUFD hardware queues when the guest
-programs the VCMDQ BASE registers.
-
-VCMDQ_EN lives in VCMDQ_CONFIG, which is on the VINTF Page0 region
-that a later patch installs into guest MMIO — so QEMU won't trap its
-writes. Allocate the hardware queue instead once all of these are
-set: BASE programmed, CMDQ_ALLOC_MAP.ALLOC, and CMDQV / VINTF
-enabled. Each precondition write retries the allocation, so the
-guest may program them in any order.
-
-iommufd_backend_alloc_hw_queue() needs the guest physical address of
-the VCMDQ ring buffer, so allocation is deferred until the guest has
-populated BASE.
-
-If a hardware queue was previously allocated for the same VCMDQ,
-free it before reallocation. All allocated VCMDQs are freed when
-CMDQV or VINTF is disabled, when the ALLOC bit is cleared, or on reset.
-
-On allocation failure, set CMDQ_INIT_ERR and clear CMDQ_EN_OK in the
-cache so trapped guest reads see the failure rather than a queue
-that looks live. Clear them on a later successful allocation. A guest
-CMDQ_EN write then sets CMDQ_EN_OK only if CMDQ_INIT_ERR is clear.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-19-skolothumtho@nvidia.com
-Co-developed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 68336529877af422c0d7c087432998d69af5384f)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 171 +++++++++++++++++++++++++++++++++++++---
- hw/arm/tegra241-cmdqv.h | 11 +++
- 2 files changed, 171 insertions(+), 11 deletions(-)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index 1f3d883cfe..8cb39e87c4 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -16,6 +16,96 @@
- #include "tegra241-cmdqv.h"
- #include "trace.h"
-
-+static void tegra241_cmdqv_free_vcmdq(Tegra241CMDQV *cmdqv, int index)
-+{
-+ IOMMUFDViommu *viommu = cmdqv->s_accel->viommu;
-+ IOMMUFDHWqueue *vcmdq = cmdqv->vcmdq[index];
-+
-+ if (!vcmdq) {
-+ return;
-+ }
-+ iommufd_backend_free_id(viommu->iommufd, vcmdq->hw_queue_id);
-+ g_free(vcmdq);
-+ cmdqv->vcmdq[index] = NULL;
-+}
-+
-+/*
-+ * A VCMDQ's HW queue can be allocated once the guest has programmed:
-+ * - VCMDQ_BASE (ring buffer GPA and size). This only checks that BASE is
-+ * non-zero, not that both the _L and _H halves have been written; a
-+ * half-written BASE may pass here, but the write of the second half
-+ * re-runs setup and reallocates with the complete address.
-+ * - the VINTF mapping (CMDQ_ALLOC_MAP.ALLOC).
-+ * - both the CMDQV global enable and the VINTF enable.
-+ */
-+static bool tegra241_cmdqv_vcmdq_ready_to_alloc(Tegra241CMDQV *cmdqv, int index)
-+{
-+ return cmdqv->vcmdq_base[index] &&
-+ (cmdqv->cmdq_alloc_map[index] & R_CMDQ_ALLOC_MAP_0_ALLOC_MASK) &&
-+ tegra241_cmdqv_enabled(cmdqv) && tegra241_vintf_enabled(cmdqv);
-+}
-+
-+/*
-+ * Allocate a host HW VCMDQ from the current cached BASE / size for @index.
-+ * No-op (returns true) until the VCMDQ is ready to be allocated.
-+ */
-+static bool tegra241_cmdqv_setup_vcmdq(Tegra241CMDQV *cmdqv, int index,
-+ Error **errp)
-+{
-+ SMMUv3AccelState *accel = cmdqv->s_accel;
-+ uint64_t base_mask = (uint64_t)R_VCMDQ0_BASE_L_ADDR_MASK |
-+ (uint64_t)R_VCMDQ0_BASE_H_ADDR_MASK << 32;
-+ uint64_t addr = cmdqv->vcmdq_base[index] & base_mask;
-+ uint64_t log2 = cmdqv->vcmdq_base[index] & R_VCMDQ0_BASE_L_LOG2SIZE_MASK;
-+ uint64_t size = 1ULL << (log2 + 4);
-+ IOMMUFDViommu *viommu = accel->viommu;
-+ IOMMUFDHWqueue *hw_queue;
-+ uint32_t hw_queue_id;
-+
-+ if (!tegra241_cmdqv_vcmdq_ready_to_alloc(cmdqv, index)) {
-+ return true;
-+ }
-+
-+ tegra241_cmdqv_free_vcmdq(cmdqv, index);
-+
-+ if (!iommufd_backend_alloc_hw_queue(viommu->iommufd, viommu->viommu_id,
-+ IOMMU_HW_QUEUE_TYPE_TEGRA241_CMDQV,
-+ index, addr, size, &hw_queue_id,
-+ errp)) {
-+ /* Record the failure in the cache. */
-+ cmdqv->vcmdq_gerror[index] |= R_VCMDQ0_GERROR_CMDQ_INIT_ERR_MASK;
-+ cmdqv->vcmdq_status[index] &= ~R_VCMDQ0_STATUS_CMDQ_EN_OK_MASK;
-+ return false;
-+ }
-+ hw_queue = g_new(IOMMUFDHWqueue, 1);
-+ hw_queue->hw_queue_id = hw_queue_id;
-+ hw_queue->viommu = viommu;
-+ cmdqv->vcmdq[index] = hw_queue;
-+
-+ cmdqv->vcmdq_gerror[index] &= ~R_VCMDQ0_GERROR_CMDQ_INIT_ERR_MASK;
-+ cmdqv->vcmdq_status[index] |= R_VCMDQ0_STATUS_CMDQ_EN_OK_MASK;
-+
-+ return true;
-+}
-+
-+static void tegra241_cmdqv_free_all_vcmdq(Tegra241CMDQV *cmdqv)
-+{
-+ /* uapi/linux/iommufd.h: hw_queue destroy must be in descending @index. */
-+ for (int i = (TEGRA241_CMDQV_MAX_CMDQ - 1); i >= 0; i--) {
-+ tegra241_cmdqv_free_vcmdq(cmdqv, i);
-+ }
-+}
-+
-+static void tegra241_cmdqv_setup_all_vcmdq(Tegra241CMDQV *cmdqv,
-+ Error **errp)
-+{
-+ for (int i = 0; i < TEGRA241_CMDQV_MAX_CMDQ; i++) {
-+ if (!tegra241_cmdqv_setup_vcmdq(cmdqv, i, errp)) {
-+ return;
-+ }
-+ }
-+}
-+
- /*
- * Read a VCMDQ Page 0 register (control/status) using VCMDQ0_* offsets.
- *
-@@ -143,7 +233,12 @@ static void tegra241_cmdqv_write_vcmdq_page0(Tegra241CMDQV *cmdqv,
- break;
- case A_VCMDQ0_CONFIG:
- if (value & R_VCMDQ0_CONFIG_CMDQ_EN_MASK) {
-- cmdqv->vcmdq_status[index] |= R_VCMDQ0_STATUS_CMDQ_EN_OK_MASK;
-+ /* Report init error if any. */
-+ if (!(cmdqv->vcmdq_gerror[index] &
-+ R_VCMDQ0_GERROR_CMDQ_INIT_ERR_MASK)) {
-+ cmdqv->vcmdq_status[index] |=
-+ R_VCMDQ0_STATUS_CMDQ_EN_OK_MASK;
-+ }
- } else {
- cmdqv->vcmdq_status[index] &= ~R_VCMDQ0_STATUS_CMDQ_EN_OK_MASK;
- }
-@@ -167,16 +262,19 @@ static void tegra241_cmdqv_write_vcmdq_page0(Tegra241CMDQV *cmdqv,
- */
- static void tegra241_cmdqv_write_vcmdq_page1(Tegra241CMDQV *cmdqv,
- hwaddr offset0, int index,
-- uint32_t value, bool direct)
-+ uint32_t value, bool direct,
-+ Error **errp)
- {
- switch (offset0) {
- case A_VCMDQ0_BASE_L:
- cmdqv->vcmdq_base[index] =
- deposit64(cmdqv->vcmdq_base[index], 0, 32, value);
-+ tegra241_cmdqv_setup_vcmdq(cmdqv, index, errp);
- break;
- case A_VCMDQ0_BASE_H:
- cmdqv->vcmdq_base[index] =
- deposit64(cmdqv->vcmdq_base[index], 32, 32, value);
-+ tegra241_cmdqv_setup_vcmdq(cmdqv, index, errp);
- break;
- case A_VCMDQ0_CONS_INDX_BASE_DRAM_L:
- cmdqv->vcmdq_cons_indx_base[index] =
-@@ -200,11 +298,13 @@ static void tegra241_cmdqv_write_vcmdq_page1(Tegra241CMDQV *cmdqv,
- */
- static void tegra241_cmdqv_write_vcmdq_page1_64(Tegra241CMDQV *cmdqv,
- hwaddr offset0, int index,
-- uint64_t value, bool direct)
-+ uint64_t value, bool direct,
-+ Error **errp)
- {
- switch (offset0) {
- case A_VCMDQ0_BASE_L:
- cmdqv->vcmdq_base[index] = value;
-+ tegra241_cmdqv_setup_vcmdq(cmdqv, index, errp);
- break;
- case A_VCMDQ0_CONS_INDX_BASE_DRAM_L:
- cmdqv->vcmdq_cons_indx_base[index] = value;
-@@ -219,7 +319,8 @@ static void tegra241_cmdqv_write_vcmdq_page1_64(Tegra241CMDQV *cmdqv,
- }
-
- static void tegra241_cmdqv_config_vintf_write(Tegra241CMDQV *cmdqv,
-- hwaddr offset, uint64_t value)
-+ hwaddr offset, uint64_t value,
-+ Error **errp)
- {
- int i;
-
-@@ -235,7 +336,13 @@ static void tegra241_cmdqv_config_vintf_write(Tegra241CMDQV *cmdqv,
- cmdqv->vintf_config = value;
- if (value & R_VINTF0_CONFIG_ENABLE_MASK) {
- cmdqv->vintf_status |= R_VINTF0_STATUS_ENABLE_OK_MASK;
-+ /*
-+ * VCMDQs whose BASE was programmed before VINTF was
-+ * enabled need their hw_queue allocated now.
-+ */
-+ tegra241_cmdqv_setup_all_vcmdq(cmdqv, errp);
- } else {
-+ tegra241_cmdqv_free_all_vcmdq(cmdqv);
- cmdqv->vintf_status &= ~R_VINTF0_STATUS_ENABLE_OK_MASK;
- }
- break;
-@@ -341,6 +448,7 @@ out:
- static void tegra241_cmdqv_writel_mmio(Tegra241CMDQV *cmdqv, hwaddr offset,
- uint32_t value)
- {
-+ Error *local_err = NULL;
- int index;
-
- switch (offset) {
-@@ -348,18 +456,39 @@ static void tegra241_cmdqv_writel_mmio(Tegra241CMDQV *cmdqv, hwaddr offset,
- cmdqv->config = value;
- if (value & R_CONFIG_CMDQV_EN_MASK) {
- cmdqv->status |= R_STATUS_CMDQV_ENABLED_MASK;
-+ /*
-+ * VCMDQs whose BASE was programmed before CMDQV was enabled
-+ * need their hw_queue allocated now.
-+ */
-+ tegra241_cmdqv_setup_all_vcmdq(cmdqv, &local_err);
- } else {
-+ tegra241_cmdqv_free_all_vcmdq(cmdqv);
- cmdqv->status &= ~R_STATUS_CMDQV_ENABLED_MASK;
- }
- break;
- case A_VI_INT_MASK_0 ... A_VI_INT_MASK_1:
- cmdqv->vi_int_mask[(offset - A_VI_INT_MASK_0) / 4] = value;
- break;
-- case A_CMDQ_ALLOC_MAP_0 ... A_CMDQ_ALLOC_MAP_1:
-- cmdqv->cmdq_alloc_map[(offset - A_CMDQ_ALLOC_MAP_0) / 4] = value;
-+ case A_CMDQ_ALLOC_MAP_0 ... A_CMDQ_ALLOC_MAP_1: {
-+ int idx = (offset - A_CMDQ_ALLOC_MAP_0) / 4;
-+ bool was_alloc = cmdqv->cmdq_alloc_map[idx] &
-+ R_CMDQ_ALLOC_MAP_0_ALLOC_MASK;
-+ bool now_alloc = value & R_CMDQ_ALLOC_MAP_0_ALLOC_MASK;
-+
-+ cmdqv->cmdq_alloc_map[idx] = value;
-+ /*
-+ * If the VCMDQ was already programmed (BASE) before mapping, fire
-+ * setup on the ALLOC 0->1 transition; tear down on 1->0.
-+ */
-+ if (!was_alloc && now_alloc) {
-+ tegra241_cmdqv_setup_vcmdq(cmdqv, idx, &local_err);
-+ } else if (was_alloc && !now_alloc) {
-+ tegra241_cmdqv_free_vcmdq(cmdqv, idx);
-+ }
- break;
-+ }
- case A_VINTF0_CONFIG ... A_VINTF0_LVCMDQ_ERR_MAP_3:
-- tegra241_cmdqv_config_vintf_write(cmdqv, offset, value);
-+ tegra241_cmdqv_config_vintf_write(cmdqv, offset, value, &local_err);
- break;
- case A_VI_VCMDQ0_CONS_INDX ... A_VI_VCMDQ1_GERRORN:
- /*
-@@ -387,17 +516,23 @@ static void tegra241_cmdqv_writel_mmio(Tegra241CMDQV *cmdqv, hwaddr offset,
- offset -= CMDQV_VINTF_PAGE1_BASE - CMDQV_VCMDQ_PAGE1_BASE;
- index = (offset - CMDQV_VCMDQ_PAGE1_BASE) / CMDQV_VCMDQ_STRIDE;
- tegra241_cmdqv_write_vcmdq_page1(cmdqv,
-- offset - index * CMDQV_VCMDQ_STRIDE, index, value, false);
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, value, false,
-+ &local_err);
- break;
- case A_VCMDQ0_BASE_L ... A_VCMDQ1_CONS_INDX_BASE_DRAM_H:
- index = (offset - CMDQV_VCMDQ_PAGE1_BASE) / CMDQV_VCMDQ_STRIDE;
- tegra241_cmdqv_write_vcmdq_page1(cmdqv,
-- offset - index * CMDQV_VCMDQ_STRIDE, index, value, true);
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, value, true,
-+ &local_err);
- break;
- default:
- qemu_log_mask(LOG_UNIMP, "%s unhandled write access at 0x%" PRIx64 "\n",
- __func__, offset);
- }
-+
-+ if (local_err) {
-+ error_report_err(local_err);
-+ }
- }
-
- /*
-@@ -407,6 +542,7 @@ static void tegra241_cmdqv_writel_mmio(Tegra241CMDQV *cmdqv, hwaddr offset,
- static void tegra241_cmdqv_writell_mmio(Tegra241CMDQV *cmdqv, hwaddr offset,
- uint64_t value)
- {
-+ Error *local_err = NULL;
- int index;
-
- switch (offset) {
-@@ -419,18 +555,24 @@ static void tegra241_cmdqv_writell_mmio(Tegra241CMDQV *cmdqv, hwaddr offset,
- offset -= CMDQV_VINTF_PAGE1_BASE - CMDQV_VCMDQ_PAGE1_BASE;
- index = (offset - CMDQV_VCMDQ_PAGE1_BASE) / CMDQV_VCMDQ_STRIDE;
- tegra241_cmdqv_write_vcmdq_page1_64(cmdqv,
-- offset - index * CMDQV_VCMDQ_STRIDE, index, value, false);
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, value, false,
-+ &local_err);
- break;
- case A_VCMDQ0_BASE_L ... A_VCMDQ1_CONS_INDX_BASE_DRAM_H:
- index = (offset - CMDQV_VCMDQ_PAGE1_BASE) / CMDQV_VCMDQ_STRIDE;
- tegra241_cmdqv_write_vcmdq_page1_64(cmdqv,
-- offset - index * CMDQV_VCMDQ_STRIDE, index, value, true);
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, value, true,
-+ &local_err);
- break;
- default:
- qemu_log_mask(LOG_UNIMP,
- "%s unhandled 64-bit write at 0x%" PRIx64 " (WI)\n",
- __func__, offset);
- }
-+
-+ if (local_err) {
-+ error_report_err(local_err);
-+ }
- }
-
- static void tegra241_cmdqv_write_mmio(void *opaque, hwaddr offset,
-@@ -535,6 +677,13 @@ free_viommu:
-
- static void tegra241_cmdqv_reset(SMMUv3State *s)
- {
-+ Tegra241CMDQV *cmdqv = s->s_accel->cmdqv;
-+
-+ if (!cmdqv) {
-+ return;
-+ }
-+
-+ tegra241_cmdqv_free_all_vcmdq(cmdqv);
- }
-
- static const MemoryRegionOps mmio_cmdqv_ops = {
-diff --git a/hw/arm/tegra241-cmdqv.h b/hw/arm/tegra241-cmdqv.h
-index cc1b55a5e1..c795da0444 100644
---- a/hw/arm/tegra241-cmdqv.h
-+++ b/hw/arm/tegra241-cmdqv.h
-@@ -47,6 +47,7 @@ typedef struct Tegra241CMDQV {
- MemoryRegion mmio_cmdqv;
- qemu_irq irq;
- IOMMUFDVeventq *veventq;
-+ IOMMUFDHWqueue *vcmdq[TEGRA241_CMDQV_MAX_CMDQ];
- void *vintf_page0;
-
- /* CMDQ-V Config page register cache */
-@@ -364,6 +365,16 @@ SMMU_CMDQV_VI_VCMDQi_BASE_H_(1)
- SMMU_CMDQV_VI_VCMDQi_CONS_INDX_BASE_DRAM_L_(1)
- SMMU_CMDQV_VI_VCMDQi_CONS_INDX_BASE_DRAM_H_(1)
-
-+static inline bool tegra241_cmdqv_enabled(Tegra241CMDQV *cmdqv)
-+{
-+ return cmdqv->status & R_STATUS_CMDQV_ENABLED_MASK;
-+}
-+
-+static inline bool tegra241_vintf_enabled(Tegra241CMDQV *cmdqv)
-+{
-+ return cmdqv->vintf_status & R_VINTF0_STATUS_ENABLE_OK_MASK;
-+}
-+
- const SMMUv3AccelCmdqvOps *tegra241_cmdqv_get_ops(void);
-
- #endif /* HW_ARM_TEGRA241_CMDQV_H */
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Document-the-CMDQV-design-and-.patch b/kvm-hw-arm-tegra241-cmdqv-Document-the-CMDQV-design-and-.patch
deleted file mode 100644
index 7a6e245..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Document-the-CMDQV-design-and-.patch
+++ /dev/null
@@ -1,148 +0,0 @@
-From b87b7e2da3b0255abd7d6ae5321c64b730d421e4 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:51 +0100
-Subject: [PATCH 109/111] hw/arm/tegra241-cmdqv: Document the CMDQV design and
- lifecycle
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [109/111] 459c891d5e7df2bfbc8b190babbda310eb6fd177 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Add an overview describing the Tegra241 CMDQV passthrough model, MMIO
-layout, guest-driven lifecycle, and per-VM isolation.
-
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Message-id: 20260609112552.378999-31-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 295ca0e14c6169e831c4a277e48df3a4aa0d8606)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 100 ++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 100 insertions(+)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index 1bed1374ba..5e15494a7f 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -7,6 +7,106 @@
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-+/*
-+ * Tegra241 CMDQV - overview
-+ * =========================
-+ *
-+ * NVIDIA Tegra241 extends SMMUv3 with a Command Queue Virtualization (CMDQ-V)
-+ * block. It lets a guest issue SMMU invalidation commands directly to
-+ * dedicated hardware queues (vCMDQs) without trapping into the hypervisor on
-+ * the fast path. vCMDQs are exclusively allocated to Virtual Interfaces
-+ * (VINTFs); the host kernel allocates one VINTF per emulated SMMUv3 instance
-+ * via iommufd. QEMU emulates the CMDQV MMIO region and drives the host kernel
-+ * calls (VIOMMU_ALLOC, HW_QUEUE_ALLOC, mmap); the actual command processing
-+ * happens on real hardware.
-+ *
-+ * A vCMDQ becomes functional only once allocated to the host VINTF; until then
-+ * no command processing happens, and trapped register accesses fall back to a
-+ * QEMU-side cache. After allocation, the cached register state is migrated to
-+ * the hardware and command processing runs on the host; guest accesses to the
-+ * live control/status registers then bypass QEMU and reach the host directly.
-+ *
-+ * MMIO layout (64KB pages, total TEGRA241_CMDQV_IO_LEN)
-+ * -----------------------------------------------------
-+ * 0x00000 CMDQV Config page: QEMU-trapped.
-+ * 0x10000 Direct vCMDQ Page 0 (control/status): QEMU-trapped and routed
-+ * to either the mmap'd host VINTF Page 0 (if the vCMDQ has been
-+ * allocated to a VINTF) or a per-vCMDQ register cache (otherwise).
-+ * 0x20000 Direct vCMDQ Page 1 (BASE / DRAM addresses): QEMU-trapped.
-+ * 0x30000 VINTF Page 0 (per-VINTF control/status): the guest's virtual
-+ * VINTF Page 0 aperture, backed by the host VINTF Page 0 (mmap'd
-+ * via iommufd) and installed into guest MMIO as a RAM-device
-+ * subregion when VINTF is enabled; subsequent accesses bypass QEMU.
-+ * 0x40000 VINTF Page 1 (per-VINTF BASE): QEMU-trapped. Although this is
-+ * a HW alias of the direct Page 1, the kernel only exposes mmap
-+ * for the host VINTF Page 0; the host VINTF Page 1 is not mmap'd
-+ * and stays trapped.
-+ *
-+ * The direct vCMDQ apertures (0x10000/0x20000) are HW aliases of the VINTF
-+ * apertures (0x30000/0x40000); they expose the same per-vCMDQ register slots
-+ * under different addressing.
-+ *
-+ * The direct vCMDQ Page 0 stays trapped rather than aliased to the host VINTF
-+ * Page 0 mmap. The CMDQV architecture allows software to program a vCMDQ
-+ * through the direct aperture before allocating it to a VINTF; aliasing to
-+ * the host VINTF Page 0 mmap would route those accesses into unallocated
-+ * logical slots where the hardware silently drops them, so trapping keeps
-+ * accesses well-defined for an unallocated vCMDQ.
-+ *
-+ * Lifecycle (driven by guest events)
-+ * ----------------------------------
-+ * 1. First vfio-pci device attach (.set_iommu_device) triggers:
-+ * - tegra241_cmdqv_probe(): IOMMU_GET_HW_INFO confirms host CMDQV support.
-+ * - IOMMU_VIOMMU_ALLOC: the kernel allocates and enables a VINTF for this
-+ * VM, configures the VM's VMID (from its stage-2 HWPT) in VINTF_CONFIG,
-+ * forces HYP_OWN=0, and returns the mmap offset/length for the host
-+ * VINTF Page 0, which QEMU then mmap()s.
-+ *
-+ * 2. Guest writes VINTF_CONFIG.ENABLE = 1:
-+ * QEMU installs the mmap'd host VINTF Page 0 into guest MMIO as the guest's
-+ * virtual VINTF Page 0 aperture (a RAM-device subregion) and reports
-+ * STATUS.ENABLE_OK = 1. The aperture is now a direct window onto the host
-+ * page, so accesses no longer trap into QEMU; a vCMDQ within it operates as
-+ * a real command queue only once it has been allocated (step 3).
-+ *
-+ * 3. Guest completes vCMDQ setup (BASE, CMDQ_ALLOC_MAP.ALLOC, CMDQV_EN,
-+ * VINTF.ENABLE, in any order; each precondition write retries the HW queue
-+ * allocation):
-+ * IOMMU_HW_QUEUE_ALLOC grants the guest a new host vCMDQ in this VM's
-+ * VINTF, binding the guest BASE GPA (translated through stage-2 and pinned
-+ * by the kernel) to it.
-+ *
-+ * 4. Guest SMMU driver programs a Stream Table Entry for a passthrough
-+ * device: IOMMU_VDEVICE_ALLOC programs SID_MATCH/SID_REPLACE in this VM's
-+ * VINTF so that the HW translates the device's guest vSID into its host
-+ * pSID. Commands referencing unmapped SIDs are rejected by HW.
-+ *
-+ * This reflects the current accel SMMUv3 design, which allocates the
-+ * vDEVICE when the guest programs the STE.
-+ *
-+ * Per-VM isolation
-+ * ----------------
-+ * - Each VM has its own iommufd FD; all iommufd objects (VINTF, vdevices,
-+ * hw_queues, mmap regions) belong to that FD. Cross-FD lookups fail, so
-+ * one VM cannot reach another VM's IDs.
-+ * - IOMMU_VIOMMU_ALLOC configures the VM's VMID in VINTF_CONFIG; the CMDQV
-+ * hardware substitutes / checks VMID on every command the guest issues.
-+ * - The kernel allocates the VINTF with HYP_OWN = 0, which restricts the
-+ * guest to a safe subset of commands.
-+ * - IOMMU_VDEVICE_ALLOC populates SID_MATCH/SID_REPLACE so invalidations
-+ * only reach the host StreamIDs assigned to this VM (see step 4).
-+ * - IOMMU_HW_QUEUE_ALLOC binds each vCMDQ to a single VINTF, so a guest
-+ * cannot reach a vCMDQ that belongs to another VM.
-+ *
-+ * Limits exposed to the guest
-+ * ---------------------------
-+ * One VINTF per emulated SMMUv3 and two vCMDQs per VINTF. The HW maximum
-+ * vCMDQ size is 8MiB, but the size QEMU exposes to the guest may be smaller.
-+ * The queue must be physically contiguous in host memory, so QEMU caps the
-+ * exposed size to the host memory-backend page size. Use hugepage backing to
-+ * reach the 8MiB maximum.
-+ */
-+
- #include "qemu/osdep.h"
- #include "qemu/log.h"
-
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Emulate-CMDQ-V-Config-region.patch b/kvm-hw-arm-tegra241-cmdqv-Emulate-CMDQ-V-Config-region.patch
deleted file mode 100644
index 86b9aff..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Emulate-CMDQ-V-Config-region.patch
+++ /dev/null
@@ -1,409 +0,0 @@
-From 56c1c28fee7f306288a45c2c25b839cc9e467aac Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:36 +0100
-Subject: [PATCH 094/111] hw/arm/tegra241-cmdqv: Emulate CMDQ-V Config region
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [94/111] d7440fe197d4839cf28c6049bf7752f5a3df331b (eauger1/centos-qemu-kvm)
-
-Conflicts: in hw/arm/tegra241-cmdqv.h used hw/registerfields.h
-instead of hw/core/registerfields.h
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Tegra241 CMDQV exposes control and status registers in the CMDQ-V
-Config page (offset [0x0, 0x10000)) used to configure virtual command
-queue allocation and interrupt behavior.
-
-Add read/write emulation for the CMDQ-V Config region
-([CMDQV_BASE, CMDQV_CMDQ_BASE]), backed by a simple register cache.
-This includes CONFIG, PARAM, STATUS, VI error and interrupt maps, CMDQ
-allocation map and the VINTF0 related registers defined in the CMDQ-V
-Config space. Only VINTF0 is supported; VINTF1-63 are not.
-
-Dispatch writes on access size: Introduced writel_mmio for 4-byte and
-writell_mmio for 8-byte. Reads need no split as the MMIO framework masks
-the returned value to the access size.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260609112552.378999-16-skolothumtho@nvidia.com
-Co-developed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit ab9ead11f03d8abc0c069309d516a8abb75eebe7)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 181 +++++++++++++++++++++++++++++++++++++++-
- hw/arm/tegra241-cmdqv.h | 110 ++++++++++++++++++++++++
- hw/arm/trace-events | 4 +
- 3 files changed, 294 insertions(+), 1 deletion(-)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index 3eec6073a4..8950d5153b 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -8,21 +8,200 @@
- */
-
- #include "qemu/osdep.h"
-+#include "qemu/log.h"
-
- #include "hw/arm/smmuv3.h"
- #include "hw/arm/smmuv3-common.h"
- #include "smmuv3-accel.h"
- #include "tegra241-cmdqv.h"
-+#include "trace.h"
-+
-+static uint64_t tegra241_cmdqv_config_vintf_read(Tegra241CMDQV *cmdqv,
-+ hwaddr offset)
-+{
-+ int i;
-+
-+ switch (offset) {
-+ case A_VINTF0_CONFIG:
-+ return cmdqv->vintf_config;
-+ case A_VINTF0_STATUS:
-+ return cmdqv->vintf_status;
-+ case A_VINTF0_SID_MATCH_0 ... A_VINTF0_SID_MATCH_15:
-+ i = (offset - A_VINTF0_SID_MATCH_0) / 4;
-+ return cmdqv->vintf_sid_match[i];
-+ case A_VINTF0_SID_REPLACE_0 ... A_VINTF0_SID_REPLACE_15:
-+ i = (offset - A_VINTF0_SID_REPLACE_0) / 4;
-+ return cmdqv->vintf_sid_replace[i];
-+ case A_VINTF0_LVCMDQ_ERR_MAP_0 ... A_VINTF0_LVCMDQ_ERR_MAP_3:
-+ i = (offset - A_VINTF0_LVCMDQ_ERR_MAP_0) / 4;
-+ return cmdqv->vintf_cmdq_err_map[i];
-+ default:
-+ /*
-+ * GLB_FILT_CFG_0 (offset 0xC) and GLB_FILT_DATA_0 (offset 0x10) are
-+ * filter config and filter data registers. They are not required for
-+ * normal VINTF operation and are not emulated.
-+ */
-+ qemu_log_mask(LOG_UNIMP, "%s unhandled read access at 0x%" PRIx64 "\n",
-+ __func__, offset);
-+ return 0;
-+ }
-+}
-+
-+static void tegra241_cmdqv_config_vintf_write(Tegra241CMDQV *cmdqv,
-+ hwaddr offset, uint64_t value)
-+{
-+ int i;
-+
-+ switch (offset) {
-+ case A_VINTF0_CONFIG:
-+ /*
-+ * Mask out HYP_OWN on guest writes. This bit selects Hypervisor (1) vs
-+ * Guest (0) ownership of the CMDQ. Force it to 0 so the VINTF always
-+ * remains guest-owned.
-+ */
-+ value &= ~R_VINTF0_CONFIG_HYP_OWN_MASK;
-+
-+ cmdqv->vintf_config = value;
-+ if (value & R_VINTF0_CONFIG_ENABLE_MASK) {
-+ cmdqv->vintf_status |= R_VINTF0_STATUS_ENABLE_OK_MASK;
-+ } else {
-+ cmdqv->vintf_status &= ~R_VINTF0_STATUS_ENABLE_OK_MASK;
-+ }
-+ break;
-+ case A_VINTF0_SID_MATCH_0 ... A_VINTF0_SID_MATCH_15:
-+ i = (offset - A_VINTF0_SID_MATCH_0) / 4;
-+ cmdqv->vintf_sid_match[i] = value;
-+ break;
-+ case A_VINTF0_SID_REPLACE_0 ... A_VINTF0_SID_REPLACE_15:
-+ i = (offset - A_VINTF0_SID_REPLACE_0) / 4;
-+ cmdqv->vintf_sid_replace[i] = value;
-+ break;
-+ default:
-+ /*
-+ * GLB_FILT_CFG_0 (offset 0xC) and GLB_FILT_DATA_0 (offset 0x10) are
-+ * filter config and filter data registers. They are not required for
-+ * normal VINTF operation and are not emulated.
-+ */
-+ qemu_log_mask(LOG_UNIMP, "%s unhandled write access at 0x%" PRIx64 "\n",
-+ __func__, offset);
-+ return;
-+ }
-+}
-
- static uint64_t tegra241_cmdqv_read_mmio(void *opaque, hwaddr offset,
- unsigned size)
- {
-- return 0;
-+ Tegra241CMDQV *cmdqv = (Tegra241CMDQV *)opaque;
-+ uint64_t val = 0;
-+
-+ if (offset >= TEGRA241_CMDQV_IO_LEN) {
-+ qemu_log_mask(LOG_UNIMP,
-+ "%s offset 0x%" PRIx64 " off limit (0x%x)\n", __func__,
-+ offset, TEGRA241_CMDQV_IO_LEN);
-+ goto out;
-+ }
-+
-+ switch (offset) {
-+ case A_CONFIG:
-+ val = cmdqv->config;
-+ break;
-+ case A_PARAM:
-+ val = cmdqv->param;
-+ break;
-+ case A_STATUS:
-+ val = cmdqv->status;
-+ break;
-+ case A_VI_ERR_MAP_0 ... A_VI_ERR_MAP_1:
-+ val = cmdqv->vi_err_map[(offset - A_VI_ERR_MAP_0) / 4];
-+ break;
-+ case A_VI_INT_MASK_0 ... A_VI_INT_MASK_1:
-+ val = cmdqv->vi_int_mask[(offset - A_VI_INT_MASK_0) / 4];
-+ break;
-+ case A_CMDQ_ERR_MAP_0 ... A_CMDQ_ERR_MAP_3:
-+ val = cmdqv->cmdq_err_map[(offset - A_CMDQ_ERR_MAP_0) / 4];
-+ break;
-+ case A_CMDQ_ALLOC_MAP_0 ... A_CMDQ_ALLOC_MAP_1:
-+ val = cmdqv->cmdq_alloc_map[(offset - A_CMDQ_ALLOC_MAP_0) / 4];
-+ break;
-+ case A_VINTF0_CONFIG ... A_VINTF0_LVCMDQ_ERR_MAP_3:
-+ val = tegra241_cmdqv_config_vintf_read(cmdqv, offset);
-+ break;
-+ default:
-+ qemu_log_mask(LOG_UNIMP, "%s unhandled read access at 0x%" PRIx64 "\n",
-+ __func__, offset);
-+ }
-+
-+out:
-+ trace_tegra241_cmdqv_read_mmio(offset, val, size);
-+ return val;
-+}
-+
-+/* 4-byte MMIO write handler. */
-+static void tegra241_cmdqv_writel_mmio(Tegra241CMDQV *cmdqv, hwaddr offset,
-+ uint32_t value)
-+{
-+ switch (offset) {
-+ case A_CONFIG:
-+ cmdqv->config = value;
-+ if (value & R_CONFIG_CMDQV_EN_MASK) {
-+ cmdqv->status |= R_STATUS_CMDQV_ENABLED_MASK;
-+ } else {
-+ cmdqv->status &= ~R_STATUS_CMDQV_ENABLED_MASK;
-+ }
-+ break;
-+ case A_VI_INT_MASK_0 ... A_VI_INT_MASK_1:
-+ cmdqv->vi_int_mask[(offset - A_VI_INT_MASK_0) / 4] = value;
-+ break;
-+ case A_CMDQ_ALLOC_MAP_0 ... A_CMDQ_ALLOC_MAP_1:
-+ cmdqv->cmdq_alloc_map[(offset - A_CMDQ_ALLOC_MAP_0) / 4] = value;
-+ break;
-+ case A_VINTF0_CONFIG ... A_VINTF0_LVCMDQ_ERR_MAP_3:
-+ tegra241_cmdqv_config_vintf_write(cmdqv, offset, value);
-+ break;
-+ default:
-+ qemu_log_mask(LOG_UNIMP, "%s unhandled write access at 0x%" PRIx64 "\n",
-+ __func__, offset);
-+ }
-+}
-+
-+/*
-+ * 8-byte MMIO write handler.
-+ */
-+static void tegra241_cmdqv_writell_mmio(Tegra241CMDQV *cmdqv, hwaddr offset,
-+ uint64_t value)
-+{
-+ qemu_log_mask(LOG_UNIMP,
-+ "%s unhandled 64-bit write at 0x%" PRIx64 " (WI)\n",
-+ __func__, offset);
- }
-
- static void tegra241_cmdqv_write_mmio(void *opaque, hwaddr offset,
- uint64_t value, unsigned size)
- {
-+ Tegra241CMDQV *cmdqv = (Tegra241CMDQV *)opaque;
-+
-+ if (offset >= TEGRA241_CMDQV_IO_LEN) {
-+ qemu_log_mask(LOG_UNIMP,
-+ "%s offset 0x%" PRIx64 " off limit (0x%x)\n", __func__,
-+ offset, TEGRA241_CMDQV_IO_LEN);
-+ goto out;
-+ }
-+
-+ switch (size) {
-+ case 4:
-+ tegra241_cmdqv_writel_mmio(cmdqv, offset, value);
-+ break;
-+ case 8:
-+ tegra241_cmdqv_writell_mmio(cmdqv, offset, value);
-+ break;
-+ default:
-+ qemu_log_mask(LOG_GUEST_ERROR,
-+ "%s bad write size %u at 0x%" PRIx64 "\n",
-+ __func__, size, offset);
-+ }
-+
-+out:
-+ trace_tegra241_cmdqv_write_mmio(offset, value, size);
- }
-
- static void tegra241_cmdqv_free_viommu(SMMUv3State *s)
-diff --git a/hw/arm/tegra241-cmdqv.h b/hw/arm/tegra241-cmdqv.h
-index 00c83b6186..4b86aa01d3 100644
---- a/hw/arm/tegra241-cmdqv.h
-+++ b/hw/arm/tegra241-cmdqv.h
-@@ -10,10 +10,15 @@
- #ifndef HW_ARM_TEGRA241_CMDQV_H
- #define HW_ARM_TEGRA241_CMDQV_H
-
-+#include "hw/registerfields.h"
-+
- #define CMDQV_VER 1
- #define CMDQV_NUM_CMDQ_LOG2 1
- #define CMDQV_NUM_SID_PER_VI_LOG2 4
-
-+#define TEGRA241_CMDQV_MAX_CMDQ (1U << CMDQV_NUM_CMDQ_LOG2)
-+#define TEGRA241_CMDQV_MAX_NUM_SID (1U << CMDQV_NUM_SID_PER_VI_LOG2)
-+
- /*
- * Tegra241 CMDQV MMIO layout (64KB pages)
- *
-@@ -36,8 +41,113 @@ typedef struct Tegra241CMDQV {
- qemu_irq irq;
- IOMMUFDVeventq *veventq;
- void *vintf_page0;
-+
-+ /* CMDQ-V Config page register cache */
-+ uint32_t config;
-+ uint32_t param;
-+ uint32_t status;
-+ uint32_t vi_err_map[2];
-+ uint32_t vi_int_mask[2];
-+ uint32_t cmdq_err_map[4];
-+ uint32_t cmdq_alloc_map[TEGRA241_CMDQV_MAX_CMDQ];
-+
-+ /* VINTF0 register cache (within CMDQ-V Config page) */
-+ uint32_t vintf_config;
-+ uint32_t vintf_status;
-+ uint32_t vintf_sid_match[TEGRA241_CMDQV_MAX_NUM_SID];
-+ uint32_t vintf_sid_replace[TEGRA241_CMDQV_MAX_NUM_SID];
-+ uint32_t vintf_cmdq_err_map[4];
- } Tegra241CMDQV;
-
-+/* CMDQ-V Config page registers (offset 0x00000) */
-+REG32(CONFIG, 0x0)
-+FIELD(CONFIG, CMDQV_EN, 0, 1)
-+FIELD(CONFIG, CMDQV_PER_CMD_OFFSET, 1, 3)
-+FIELD(CONFIG, CMDQ_MAX_CLK_BATCH, 4, 8)
-+FIELD(CONFIG, CMDQ_MAX_CMD_BATCH, 12, 8)
-+FIELD(CONFIG, CONS_DRAM_EN, 20, 1)
-+
-+REG32(PARAM, 0x4)
-+FIELD(PARAM, CMDQV_VER, 0, 4)
-+FIELD(PARAM, CMDQV_NUM_CMDQ_LOG2, 4, 4)
-+FIELD(PARAM, CMDQV_NUM_VI_LOG2, 8, 4)
-+FIELD(PARAM, CMDQV_NUM_SID_PER_VI_LOG2, 12, 4)
-+
-+REG32(STATUS, 0x8)
-+FIELD(STATUS, CMDQV_ENABLED, 0, 1)
-+
-+/* SMMU_CMDQV_VI_ERR_MAP_0/1 definitions */
-+#define A_VI_ERR_MAP_0 0x14
-+#define A_VI_ERR_MAP_1 0x18
-+#define V_VI_ERR_MAP_NO_ERROR (0)
-+#define V_VI_ERR_MAP_ERROR (1)
-+
-+/* SMMU_CMDQV_VI_INT_MASK_0/1 definitions */
-+#define A_VI_INT_MASK_0 0x1c
-+#define A_VI_INT_MASK_1 0x20
-+#define V_VI_INT_MASK_NOT_MASKED (0)
-+#define V_VI_INT_MASK_MASKED (1)
-+
-+/* SMMU_CMDQV_CMDQ_ERR_MAP_0-3 definitions */
-+#define A_CMDQ_ERR_MAP_0 0x24
-+#define A_CMDQ_ERR_MAP_1 0x28
-+#define A_CMDQ_ERR_MAP_2 0x2c
-+#define A_CMDQ_ERR_MAP_3 0x30
-+
-+/*
-+ * CMDQ_ALLOC_MAP: one entry per physical VCMDQ. Hardware supports up to 128
-+ * entries (CMDQV_NUM_CMDQ_LOG2=7), but QEMU only exposes
-+ * TEGRA241_CMDQV_MAX_CMDQ (=2) VCMDQs per VM so only entries 0 and 1 are
-+ * defined here.
-+ */
-+/* 2 identical register entries */
-+#define SMMU_CMDQV_CMDQ_ALLOC_MAP_(i) \
-+ REG32(CMDQ_ALLOC_MAP_##i, 0x200 + i * 4) \
-+ FIELD(CMDQ_ALLOC_MAP_##i, ALLOC, 0, 1) \
-+ FIELD(CMDQ_ALLOC_MAP_##i, LVCMDQ, 1, 7) \
-+ FIELD(CMDQ_ALLOC_MAP_##i, VIRT_INTF_INDX, 15, 6)
-+
-+SMMU_CMDQV_CMDQ_ALLOC_MAP_(0)
-+SMMU_CMDQV_CMDQ_ALLOC_MAP_(1)
-+
-+/* SMMU_CMDQV_VINTF0 registers (only VINTF0 is exposed to the guest) */
-+REG32(VINTF0_CONFIG, 0x1000)
-+FIELD(VINTF0_CONFIG, ENABLE, 0, 1)
-+FIELD(VINTF0_CONFIG, VMID, 1, 16)
-+FIELD(VINTF0_CONFIG, HYP_OWN, 17, 1)
-+
-+REG32(VINTF0_STATUS, 0x1004)
-+FIELD(VINTF0_STATUS, ENABLE_OK, 0, 1)
-+FIELD(VINTF0_STATUS, STATUS, 1, 3)
-+FIELD(VINTF0_STATUS, VI_NUM_LVCMDQ, 16, 8)
-+
-+#define V_VINTF_STATUS_NO_ERROR (0 << 1)
-+#define V_VINTF_STATUS_VCMDQ_ERROR (1 << 1)
-+
-+/*
-+ * SMMU_CMDQV_VINTF0_SID_MATCH/_REPLACE: 16 entries per VINTF
-+ * (CMDQV_NUM_SID_PER_VI_LOG2=4). Only _0 and _15 are defined,
-+ * used as switch case range bounds.
-+ */
-+REG32(VINTF0_SID_MATCH_0, 0x1040)
-+FIELD(VINTF0_SID_MATCH_0, ENABLE, 0, 1)
-+FIELD(VINTF0_SID_MATCH_0, VIRT_SID, 1, 20)
-+#define A_VINTF0_SID_MATCH_15 (A_VINTF0_SID_MATCH_0 + 15 * 4)
-+
-+REG32(VINTF0_SID_REPLACE_0, 0x1080)
-+FIELD(VINTF0_SID_REPLACE_0, PHYS_SID, 0, 20)
-+#define A_VINTF0_SID_REPLACE_15 (A_VINTF0_SID_REPLACE_0 + 15 * 4)
-+
-+/*
-+ * SMMU_CMDQV_VINTF0_LVCMDQ_ERR_MAP: 4 registers per VINTF covering 32 logical
-+ * VCMDQs each. With TEGRA241_CMDQV_MAX_CMDQ=2, only MAP_0 bits [1:0] carry
-+ * error state. MAP_1..MAP_3 always read as 0. Only _0 and _3 are defined,
-+ * used as switch case range bounds.
-+ */
-+REG32(VINTF0_LVCMDQ_ERR_MAP_0, 0x10c0)
-+FIELD(VINTF0_LVCMDQ_ERR_MAP_0, LVCMDQ_ERR_MAP, 0, 32)
-+#define A_VINTF0_LVCMDQ_ERR_MAP_3 (A_VINTF0_LVCMDQ_ERR_MAP_0 + 3 * 4)
-+
- const SMMUv3AccelCmdqvOps *tegra241_cmdqv_get_ops(void);
-
- #endif /* HW_ARM_TEGRA241_CMDQV_H */
-diff --git a/hw/arm/trace-events b/hw/arm/trace-events
-index 3457536fb0..8c61d66a26 100644
---- a/hw/arm/trace-events
-+++ b/hw/arm/trace-events
-@@ -72,6 +72,10 @@ smmuv3_accel_unset_iommu_device(int devfn, uint32_t devid) "devfn=0x%x (idev dev
- smmuv3_accel_translate_ste(uint32_t vsid, uint32_t hwpt_id, uint64_t ste_1, uint64_t ste_0) "vSID=0x%x hwpt_id=0x%x ste=%"PRIx64":%"PRIx64
- smmuv3_accel_install_ste(uint32_t vsid, const char * type, uint32_t hwpt_id) "vSID=0x%x ste type=%s hwpt_id=0x%x"
-
-+# tegra241-cmdqv
-+tegra241_cmdqv_read_mmio(uint64_t offset, uint64_t val, unsigned size) "offset: 0x%"PRIx64" val: 0x%"PRIx64" size: 0x%x"
-+tegra241_cmdqv_write_mmio(uint64_t offset, uint64_t val, unsigned size) "offset: 0x%"PRIx64" val: 0x%"PRIx64" size: 0x%x"
-+
- # strongarm.c
- strongarm_uart_update_parameters(const char *label, int speed, char parity, int data_bits, int stop_bits) "%s speed=%d parity=%c data=%d stop=%d"
- strongarm_ssp_read_underrun(void) "SSP rx underrun"
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Emulate-VCMDQ-register-reads.patch b/kvm-hw-arm-tegra241-cmdqv-Emulate-VCMDQ-register-reads.patch
deleted file mode 100644
index 7ddb4ad..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Emulate-VCMDQ-register-reads.patch
+++ /dev/null
@@ -1,451 +0,0 @@
-From 41cd0be6ec20382df99d2e13e181603452f7a203 Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:37 +0100
-Subject: [PATCH 095/111] hw/arm/tegra241-cmdqv: Emulate VCMDQ register reads
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [95/111] 00a83972276e9eadcc48efa1fe453d197a5ac873 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Tegra241 CMDQV exposes per-VCMDQ register windows through two MMIO
-apertures:
-
- Direct VCMDQ aperture (0x10000/0x20000): VCMDQ Page0/Page1
- VINTF logical aperture (0x30000/0x40000): VINTF0 LVCMDQ Page0/Page1
-
-Both apertures are hardware aliases of the same underlying registers:
-
- Page 0 (control/status): CONS_INDX, PROD_INDX, CONFIG, STATUS,
- GERROR, GERRORN
- Page 1 (base/DRAM): BASE_L/H, CONS_INDX_BASE_DRAM_L/H
-
-The direct aperture Page 0 is programmable at any time so long as
-CMDQV_EN is enabled. The VINTF (logical) aperture Page 0 is
-programmable only once SW has mapped a VCMDQ to a VINTF; the
-"logical" view is local to that VINTF.
-
-Add read emulation for both apertures, backed by a single per-VCMDQ
-register cache. VINTF aperture reads are translated to their
-equivalent direct-aperture offset and served from the same cached
-state.
-
-Per the CMDQV architecture, a VCMDQ must be allocated to a Virtual
-Interface before it is used to send commands to the SMMU. Until that
-allocation happens, reads return cached register state with no HW
-interaction. Subsequent patches wire up IOMMU_HW_QUEUE_ALLOC, mmap
-the host VINTF Page 0, and install it into guest MMIO; after that,
-Page 0 reads from either aperture are served from the hardware-backed
-mmap'd page instead of the cache. Page 1 is also a hardware alias,
-but the kernel only exposes mmap for Page 0, so Page 1 reads always
-trap to QEMU and are served from cache.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260609112552.378999-17-skolothumtho@nvidia.com
-Co-developed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 0d06b1cc2050fb8efdb9f023344b2e55125003f0)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 103 +++++++++++++++++++
- hw/arm/tegra241-cmdqv.h | 216 ++++++++++++++++++++++++++++++++++++++++
- hw/arm/trace-events | 2 +
- 3 files changed, 321 insertions(+)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index 8950d5153b..2dfd377ee9 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -16,6 +16,79 @@
- #include "tegra241-cmdqv.h"
- #include "trace.h"
-
-+/*
-+ * Read a VCMDQ Page 0 register (control/status) using VCMDQ0_* offsets.
-+ *
-+ * The caller normalizes the MMIO offset such that @offset0 always refers
-+ * to a VCMDQ0_* register, while @index selects the VCMDQ instance.
-+ */
-+static uint64_t tegra241_cmdqv_read_vcmdq_page0(Tegra241CMDQV *cmdqv,
-+ hwaddr offset0, int index,
-+ bool direct)
-+{
-+ uint64_t val = 0;
-+
-+ switch (offset0) {
-+ case A_VCMDQ0_CONS_INDX:
-+ val = cmdqv->vcmdq_cons_indx[index];
-+ break;
-+ case A_VCMDQ0_PROD_INDX:
-+ val = cmdqv->vcmdq_prod_indx[index];
-+ break;
-+ case A_VCMDQ0_CONFIG:
-+ val = cmdqv->vcmdq_config[index];
-+ break;
-+ case A_VCMDQ0_STATUS:
-+ val = cmdqv->vcmdq_status[index];
-+ break;
-+ case A_VCMDQ0_GERROR:
-+ val = cmdqv->vcmdq_gerror[index];
-+ break;
-+ case A_VCMDQ0_GERRORN:
-+ val = cmdqv->vcmdq_gerrorn[index];
-+ break;
-+ default:
-+ qemu_log_mask(LOG_UNIMP,
-+ "%s unhandled read access at 0x%" PRIx64 "\n",
-+ __func__, offset0);
-+ }
-+ trace_tegra241_cmdqv_read_vcmdq_page0(index, direct ? "direct" : "vi",
-+ offset0, val);
-+ return val;
-+}
-+
-+/*
-+ * Read a VCMDQ Page 1 register (base / DRAM address) using VCMDQ0_* offsets.
-+ */
-+static uint64_t tegra241_cmdqv_read_vcmdq_page1(Tegra241CMDQV *cmdqv,
-+ hwaddr offset0, int index,
-+ bool direct)
-+{
-+ uint64_t val = 0;
-+
-+ switch (offset0) {
-+ case A_VCMDQ0_BASE_L:
-+ val = cmdqv->vcmdq_base[index];
-+ break;
-+ case A_VCMDQ0_BASE_H:
-+ val = cmdqv->vcmdq_base[index] >> 32;
-+ break;
-+ case A_VCMDQ0_CONS_INDX_BASE_DRAM_L:
-+ val = cmdqv->vcmdq_cons_indx_base[index];
-+ break;
-+ case A_VCMDQ0_CONS_INDX_BASE_DRAM_H:
-+ val = cmdqv->vcmdq_cons_indx_base[index] >> 32;
-+ break;
-+ default:
-+ qemu_log_mask(LOG_UNIMP,
-+ "%s unhandled read access at 0x%" PRIx64 "\n",
-+ __func__, offset0);
-+ }
-+ trace_tegra241_cmdqv_read_vcmdq_page1(index, direct ? "direct" : "vi",
-+ offset0, val);
-+ return val;
-+}
-+
- static uint64_t tegra241_cmdqv_config_vintf_read(Tegra241CMDQV *cmdqv,
- hwaddr offset)
- {
-@@ -93,6 +166,7 @@ static uint64_t tegra241_cmdqv_read_mmio(void *opaque, hwaddr offset,
- {
- Tegra241CMDQV *cmdqv = (Tegra241CMDQV *)opaque;
- uint64_t val = 0;
-+ int index;
-
- if (offset >= TEGRA241_CMDQV_IO_LEN) {
- qemu_log_mask(LOG_UNIMP,
-@@ -126,6 +200,35 @@ static uint64_t tegra241_cmdqv_read_mmio(void *opaque, hwaddr offset,
- case A_VINTF0_CONFIG ... A_VINTF0_LVCMDQ_ERR_MAP_3:
- val = tegra241_cmdqv_config_vintf_read(cmdqv, offset);
- break;
-+ case A_VI_VCMDQ0_CONS_INDX ... A_VI_VCMDQ1_GERRORN:
-+ /*
-+ * VINTF Page0 registers are hardware aliases of VCMDQ Page0 registers.
-+ * Translate the VINTF aperture offset to its VCMDQ Page0 equivalent
-+ * before dispatching to the Page 0 helper.
-+ */
-+ offset -= CMDQV_VINTF_PAGE0_BASE - CMDQV_VCMDQ_PAGE0_BASE;
-+ index = (offset - CMDQV_VCMDQ_PAGE0_BASE) / CMDQV_VCMDQ_STRIDE;
-+ return tegra241_cmdqv_read_vcmdq_page0(cmdqv,
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, false);
-+ case A_VCMDQ0_CONS_INDX ... A_VCMDQ1_GERRORN:
-+ /*
-+ * Decode a per-VCMDQ Page 0 access. Each VCMDQ occupies a
-+ * CMDQV_VCMDQ_STRIDE-byte window; extract the index and normalize
-+ * to the VCMDQ0_* offset before calling the Page 0 helper.
-+ */
-+ index = (offset - CMDQV_VCMDQ_PAGE0_BASE) / CMDQV_VCMDQ_STRIDE;
-+ return tegra241_cmdqv_read_vcmdq_page0(cmdqv,
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, true);
-+ case A_VI_VCMDQ0_BASE_L ... A_VI_VCMDQ1_CONS_INDX_BASE_DRAM_H:
-+ /* Same VINTF-to-VCMDQ translation as VINTF Page0 case above. */
-+ offset -= CMDQV_VINTF_PAGE1_BASE - CMDQV_VCMDQ_PAGE1_BASE;
-+ index = (offset - CMDQV_VCMDQ_PAGE1_BASE) / CMDQV_VCMDQ_STRIDE;
-+ return tegra241_cmdqv_read_vcmdq_page1(cmdqv,
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, false);
-+ case A_VCMDQ0_BASE_L ... A_VCMDQ1_CONS_INDX_BASE_DRAM_H:
-+ index = (offset - CMDQV_VCMDQ_PAGE1_BASE) / CMDQV_VCMDQ_STRIDE;
-+ return tegra241_cmdqv_read_vcmdq_page1(cmdqv,
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, true);
- default:
- qemu_log_mask(LOG_UNIMP, "%s unhandled read access at 0x%" PRIx64 "\n",
- __func__, offset);
-diff --git a/hw/arm/tegra241-cmdqv.h b/hw/arm/tegra241-cmdqv.h
-index 4b86aa01d3..cc1b55a5e1 100644
---- a/hw/arm/tegra241-cmdqv.h
-+++ b/hw/arm/tegra241-cmdqv.h
-@@ -30,6 +30,13 @@
- */
- #define TEGRA241_CMDQV_IO_LEN 0x50000
-
-+/* CMDQV MMIO aperture bases and VCMDQ stride */
-+#define CMDQV_VCMDQ_PAGE0_BASE 0x10000 /* CMDQV_CMDQ_BASE */
-+#define CMDQV_VCMDQ_PAGE1_BASE 0x20000
-+#define CMDQV_VINTF_PAGE0_BASE 0x30000 /* CMDQV_VI_CMDQ_BASE */
-+#define CMDQV_VINTF_PAGE1_BASE 0x40000
-+#define CMDQV_VCMDQ_STRIDE 0x80
-+
- #define VINTF_PAGE_SIZE 0x10000
-
- struct iommu_viommu_tegra241_cmdqv;
-@@ -57,6 +64,19 @@ typedef struct Tegra241CMDQV {
- uint32_t vintf_sid_match[TEGRA241_CMDQV_MAX_NUM_SID];
- uint32_t vintf_sid_replace[TEGRA241_CMDQV_MAX_NUM_SID];
- uint32_t vintf_cmdq_err_map[4];
-+ /*
-+ * VCMDQ register cache. The direct (VCMDQ aperture) and logical
-+ * (VINTF aperture) views are hardware aliases; both are served from
-+ * this single cached copy.
-+ */
-+ uint32_t vcmdq_cons_indx[TEGRA241_CMDQV_MAX_CMDQ];
-+ uint32_t vcmdq_prod_indx[TEGRA241_CMDQV_MAX_CMDQ];
-+ uint32_t vcmdq_config[TEGRA241_CMDQV_MAX_CMDQ];
-+ uint32_t vcmdq_status[TEGRA241_CMDQV_MAX_CMDQ];
-+ uint32_t vcmdq_gerror[TEGRA241_CMDQV_MAX_CMDQ];
-+ uint32_t vcmdq_gerrorn[TEGRA241_CMDQV_MAX_CMDQ];
-+ uint64_t vcmdq_base[TEGRA241_CMDQV_MAX_CMDQ];
-+ uint64_t vcmdq_cons_indx_base[TEGRA241_CMDQV_MAX_CMDQ];
- } Tegra241CMDQV;
-
- /* CMDQ-V Config page registers (offset 0x00000) */
-@@ -148,6 +168,202 @@ REG32(VINTF0_LVCMDQ_ERR_MAP_0, 0x10c0)
- FIELD(VINTF0_LVCMDQ_ERR_MAP_0, LVCMDQ_ERR_MAP, 0, 32)
- #define A_VINTF0_LVCMDQ_ERR_MAP_3 (A_VINTF0_LVCMDQ_ERR_MAP_0 + 3 * 4)
-
-+/*
-+ * Direct VCMDQ aperture register windows.
-+ *
-+ * Page 0 @ CMDQV_VCMDQ_PAGE0_BASE: VCMDQ control and status registers.
-+ * Page 1 @ CMDQV_VCMDQ_PAGE1_BASE: VCMDQ base and DRAM address registers.
-+ *
-+ * Each VCMDQ occupies a CMDQV_VCMDQ_STRIDE-byte slot within its page.
-+ */
-+
-+/* --- Page 0 register macros --- */
-+#define SMMU_CMDQV_VCMDQi_CONS_INDX_(i) \
-+ REG32(VCMDQ##i##_CONS_INDX, \
-+ CMDQV_VCMDQ_PAGE0_BASE + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VCMDQ##i##_CONS_INDX, RD, 0, 20) \
-+ FIELD(VCMDQ##i##_CONS_INDX, ERR, 24, 7)
-+
-+#define V_VCMDQ_CONS_INDX_ERR_CERROR_NONE 0
-+#define V_VCMDQ_CONS_INDX_ERR_CERROR_ILL_OPCODE 1
-+#define V_VCMDQ_CONS_INDX_ERR_CERROR_ABT 2
-+#define V_VCMDQ_CONS_INDX_ERR_CERROR_ATC_INV_SYNC 3
-+#define V_VCMDQ_CONS_INDX_ERR_CERROR_ILL_ACCESS 4
-+
-+#define SMMU_CMDQV_VCMDQi_PROD_INDX_(i) \
-+ REG32(VCMDQ##i##_PROD_INDX, \
-+ CMDQV_VCMDQ_PAGE0_BASE + 0x4 + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VCMDQ##i##_PROD_INDX, WR, 0, 20)
-+
-+#define SMMU_CMDQV_VCMDQi_CONFIG_(i) \
-+ REG32(VCMDQ##i##_CONFIG, \
-+ CMDQV_VCMDQ_PAGE0_BASE + 0x8 + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VCMDQ##i##_CONFIG, CMDQ_EN, 0, 1)
-+
-+#define SMMU_CMDQV_VCMDQi_STATUS_(i) \
-+ REG32(VCMDQ##i##_STATUS, \
-+ CMDQV_VCMDQ_PAGE0_BASE + 0xc + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VCMDQ##i##_STATUS, CMDQ_EN_OK, 0, 1)
-+
-+#define SMMU_CMDQV_VCMDQi_GERROR_(i) \
-+ REG32(VCMDQ##i##_GERROR, \
-+ CMDQV_VCMDQ_PAGE0_BASE + 0x10 + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VCMDQ##i##_GERROR, CMDQ_ERR, 0, 1) \
-+ FIELD(VCMDQ##i##_GERROR, CONS_DRAM_WR_ABT_ERR, 1, 1) \
-+ FIELD(VCMDQ##i##_GERROR, CMDQ_INIT_ERR, 2, 1)
-+
-+#define SMMU_CMDQV_VCMDQi_GERRORN_(i) \
-+ REG32(VCMDQ##i##_GERRORN, \
-+ CMDQV_VCMDQ_PAGE0_BASE + 0x14 + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VCMDQ##i##_GERRORN, CMDQ_ERR, 0, 1) \
-+ FIELD(VCMDQ##i##_GERRORN, CONS_DRAM_WR_ABT_ERR, 1, 1) \
-+ FIELD(VCMDQ##i##_GERRORN, CMDQ_INIT_ERR, 2, 1)
-+
-+/* Page 0 layout: VCMDQ0 */
-+SMMU_CMDQV_VCMDQi_CONS_INDX_(0)
-+SMMU_CMDQV_VCMDQi_PROD_INDX_(0)
-+SMMU_CMDQV_VCMDQi_CONFIG_(0)
-+SMMU_CMDQV_VCMDQi_STATUS_(0)
-+SMMU_CMDQV_VCMDQi_GERROR_(0)
-+SMMU_CMDQV_VCMDQi_GERRORN_(0)
-+
-+/* Page 0 layout: VCMDQ1 */
-+SMMU_CMDQV_VCMDQi_CONS_INDX_(1)
-+SMMU_CMDQV_VCMDQi_PROD_INDX_(1)
-+SMMU_CMDQV_VCMDQi_CONFIG_(1)
-+SMMU_CMDQV_VCMDQi_STATUS_(1)
-+SMMU_CMDQV_VCMDQi_GERROR_(1)
-+SMMU_CMDQV_VCMDQi_GERRORN_(1)
-+
-+/* --- Page 1 register macros --- */
-+#define SMMU_CMDQV_VCMDQi_BASE_L_(i) \
-+ REG32(VCMDQ##i##_BASE_L, CMDQV_VCMDQ_PAGE1_BASE + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VCMDQ##i##_BASE_L, LOG2SIZE, 0, 5) \
-+ FIELD(VCMDQ##i##_BASE_L, ADDR, 5, 27)
-+
-+#define SMMU_CMDQV_VCMDQi_BASE_H_(i) \
-+ REG32(VCMDQ##i##_BASE_H, \
-+ CMDQV_VCMDQ_PAGE1_BASE + 0x4 + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VCMDQ##i##_BASE_H, ADDR, 0, 16)
-+
-+#define SMMU_CMDQV_VCMDQi_CONS_INDX_BASE_DRAM_L_(i) \
-+ REG32(VCMDQ##i##_CONS_INDX_BASE_DRAM_L, \
-+ CMDQV_VCMDQ_PAGE1_BASE + 0x8 + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VCMDQ##i##_CONS_INDX_BASE_DRAM_L, ADDR, 0, 32)
-+
-+#define SMMU_CMDQV_VCMDQi_CONS_INDX_BASE_DRAM_H_(i) \
-+ REG32(VCMDQ##i##_CONS_INDX_BASE_DRAM_H, \
-+ CMDQV_VCMDQ_PAGE1_BASE + 0xc + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VCMDQ##i##_CONS_INDX_BASE_DRAM_H, ADDR, 0, 16)
-+
-+/* Page 1 layout: VCMDQ0 */
-+SMMU_CMDQV_VCMDQi_BASE_L_(0)
-+SMMU_CMDQV_VCMDQi_BASE_H_(0)
-+SMMU_CMDQV_VCMDQi_CONS_INDX_BASE_DRAM_L_(0)
-+SMMU_CMDQV_VCMDQi_CONS_INDX_BASE_DRAM_H_(0)
-+
-+/* Page 1 layout: VCMDQ1 */
-+SMMU_CMDQV_VCMDQi_BASE_L_(1)
-+SMMU_CMDQV_VCMDQi_BASE_H_(1)
-+SMMU_CMDQV_VCMDQi_CONS_INDX_BASE_DRAM_L_(1)
-+SMMU_CMDQV_VCMDQi_CONS_INDX_BASE_DRAM_H_(1)
-+
-+/*
-+ * VINTF0 logical VCMDQ aperture register windows.
-+ *
-+ * Page 0 @ CMDQV_VINTF_PAGE0_BASE: VCMDQ control and status registers.
-+ * Page 1 @ CMDQV_VINTF_PAGE1_BASE: VCMDQ base and DRAM address registers.
-+ *
-+ * VCMDQs mapped via VINTF are accessed through this aperture as
-+ * hardware aliases of the direct VCMDQ aperture above.
-+ */
-+
-+/* --- Page 0 register macros --- */
-+#define SMMU_CMDQV_VI_VCMDQi_CONS_INDX_(i) \
-+ REG32(VI_VCMDQ##i##_CONS_INDX, \
-+ CMDQV_VINTF_PAGE0_BASE + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VI_VCMDQ##i##_CONS_INDX, RD, 0, 20) \
-+ FIELD(VI_VCMDQ##i##_CONS_INDX, ERR, 24, 7)
-+
-+#define SMMU_CMDQV_VI_VCMDQi_PROD_INDX_(i) \
-+ REG32(VI_VCMDQ##i##_PROD_INDX, \
-+ CMDQV_VINTF_PAGE0_BASE + 0x4 + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VI_VCMDQ##i##_PROD_INDX, WR, 0, 20)
-+
-+#define SMMU_CMDQV_VI_VCMDQi_CONFIG_(i) \
-+ REG32(VI_VCMDQ##i##_CONFIG, \
-+ CMDQV_VINTF_PAGE0_BASE + 0x8 + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VI_VCMDQ##i##_CONFIG, CMDQ_EN, 0, 1)
-+
-+#define SMMU_CMDQV_VI_VCMDQi_STATUS_(i) \
-+ REG32(VI_VCMDQ##i##_STATUS, \
-+ CMDQV_VINTF_PAGE0_BASE + 0xc + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VI_VCMDQ##i##_STATUS, CMDQ_EN_OK, 0, 1)
-+
-+#define SMMU_CMDQV_VI_VCMDQi_GERROR_(i) \
-+ REG32(VI_VCMDQ##i##_GERROR, \
-+ CMDQV_VINTF_PAGE0_BASE + 0x10 + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VI_VCMDQ##i##_GERROR, CMDQ_ERR, 0, 1) \
-+ FIELD(VI_VCMDQ##i##_GERROR, CONS_DRAM_WR_ABT_ERR, 1, 1) \
-+ FIELD(VI_VCMDQ##i##_GERROR, CMDQ_INIT_ERR, 2, 1)
-+
-+#define SMMU_CMDQV_VI_VCMDQi_GERRORN_(i) \
-+ REG32(VI_VCMDQ##i##_GERRORN, \
-+ CMDQV_VINTF_PAGE0_BASE + 0x14 + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VI_VCMDQ##i##_GERRORN, CMDQ_ERR, 0, 1) \
-+ FIELD(VI_VCMDQ##i##_GERRORN, CONS_DRAM_WR_ABT_ERR, 1, 1) \
-+ FIELD(VI_VCMDQ##i##_GERRORN, CMDQ_INIT_ERR, 2, 1)
-+
-+/* Page 0 layout: VCMDQ0 */
-+SMMU_CMDQV_VI_VCMDQi_CONS_INDX_(0)
-+SMMU_CMDQV_VI_VCMDQi_PROD_INDX_(0)
-+SMMU_CMDQV_VI_VCMDQi_CONFIG_(0)
-+SMMU_CMDQV_VI_VCMDQi_STATUS_(0)
-+SMMU_CMDQV_VI_VCMDQi_GERROR_(0)
-+SMMU_CMDQV_VI_VCMDQi_GERRORN_(0)
-+
-+/* Page 0 layout: VCMDQ1 */
-+SMMU_CMDQV_VI_VCMDQi_CONS_INDX_(1)
-+SMMU_CMDQV_VI_VCMDQi_PROD_INDX_(1)
-+SMMU_CMDQV_VI_VCMDQi_CONFIG_(1)
-+SMMU_CMDQV_VI_VCMDQi_STATUS_(1)
-+SMMU_CMDQV_VI_VCMDQi_GERROR_(1)
-+SMMU_CMDQV_VI_VCMDQi_GERRORN_(1)
-+
-+/* --- Page 1 register macros --- */
-+#define SMMU_CMDQV_VI_VCMDQi_BASE_L_(i) \
-+ REG32(VI_VCMDQ##i##_BASE_L, \
-+ CMDQV_VINTF_PAGE1_BASE + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VI_VCMDQ##i##_BASE_L, LOG2SIZE, 0, 5) \
-+ FIELD(VI_VCMDQ##i##_BASE_L, ADDR, 5, 27)
-+
-+#define SMMU_CMDQV_VI_VCMDQi_BASE_H_(i) \
-+ REG32(VI_VCMDQ##i##_BASE_H, \
-+ CMDQV_VINTF_PAGE1_BASE + 0x4 + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VI_VCMDQ##i##_BASE_H, ADDR, 0, 16)
-+
-+#define SMMU_CMDQV_VI_VCMDQi_CONS_INDX_BASE_DRAM_L_(i) \
-+ REG32(VI_VCMDQ##i##_CONS_INDX_BASE_DRAM_L, \
-+ CMDQV_VINTF_PAGE1_BASE + 0x8 + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VI_VCMDQ##i##_CONS_INDX_BASE_DRAM_L, ADDR, 0, 32)
-+
-+#define SMMU_CMDQV_VI_VCMDQi_CONS_INDX_BASE_DRAM_H_(i) \
-+ REG32(VI_VCMDQ##i##_CONS_INDX_BASE_DRAM_H, \
-+ CMDQV_VINTF_PAGE1_BASE + 0xc + i * CMDQV_VCMDQ_STRIDE) \
-+ FIELD(VI_VCMDQ##i##_CONS_INDX_BASE_DRAM_H, ADDR, 0, 16)
-+
-+/* Page 1 layout: VCMDQ0 */
-+SMMU_CMDQV_VI_VCMDQi_BASE_L_(0)
-+SMMU_CMDQV_VI_VCMDQi_BASE_H_(0)
-+SMMU_CMDQV_VI_VCMDQi_CONS_INDX_BASE_DRAM_L_(0)
-+SMMU_CMDQV_VI_VCMDQi_CONS_INDX_BASE_DRAM_H_(0)
-+
-+/* Page 1 layout: VCMDQ1 */
-+SMMU_CMDQV_VI_VCMDQi_BASE_L_(1)
-+SMMU_CMDQV_VI_VCMDQi_BASE_H_(1)
-+SMMU_CMDQV_VI_VCMDQi_CONS_INDX_BASE_DRAM_L_(1)
-+SMMU_CMDQV_VI_VCMDQi_CONS_INDX_BASE_DRAM_H_(1)
-+
- const SMMUv3AccelCmdqvOps *tegra241_cmdqv_get_ops(void);
-
- #endif /* HW_ARM_TEGRA241_CMDQV_H */
-diff --git a/hw/arm/trace-events b/hw/arm/trace-events
-index 8c61d66a26..5156604228 100644
---- a/hw/arm/trace-events
-+++ b/hw/arm/trace-events
-@@ -75,6 +75,8 @@ smmuv3_accel_install_ste(uint32_t vsid, const char * type, uint32_t hwpt_id) "vS
- # tegra241-cmdqv
- tegra241_cmdqv_read_mmio(uint64_t offset, uint64_t val, unsigned size) "offset: 0x%"PRIx64" val: 0x%"PRIx64" size: 0x%x"
- tegra241_cmdqv_write_mmio(uint64_t offset, uint64_t val, unsigned size) "offset: 0x%"PRIx64" val: 0x%"PRIx64" size: 0x%x"
-+tegra241_cmdqv_read_vcmdq_page0(int index, const char *aperture, uint64_t offset0, uint64_t val) "vcmdq[%d] %s offset0: 0x%"PRIx64" val: 0x%"PRIx64
-+tegra241_cmdqv_read_vcmdq_page1(int index, const char *aperture, uint64_t offset0, uint64_t val) "vcmdq[%d] %s offset0: 0x%"PRIx64" val: 0x%"PRIx64
-
- # strongarm.c
- strongarm_uart_update_parameters(const char *label, int speed, char parity, int data_bits, int stop_bits) "%s speed=%d parity=%c data=%d stop=%d"
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Emulate-VCMDQ-register-writes.patch b/kvm-hw-arm-tegra241-cmdqv-Emulate-VCMDQ-register-writes.patch
deleted file mode 100644
index b09a59a..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Emulate-VCMDQ-register-writes.patch
+++ /dev/null
@@ -1,264 +0,0 @@
-From 0cd4d9d91be6d973f4dedb5414f6ed9819b4be49 Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:38 +0100
-Subject: [PATCH 096/111] hw/arm/tegra241-cmdqv: Emulate VCMDQ register writes
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [96/111] f9145dcb13afc681df094d30fecbfc211913410f (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-This is the write side counterpart of the VCMDQ read emulation. Add
-write handling for both the direct VCMDQ aperture and the VINTF
-logical aperture using the same index decoding and VINTF-to-VCMDQ
-translation logic as the read path.
-
-VINTF aperture writes are translated to their direct-aperture
-equivalent and update the same cached state. Page 1 registers
-(BASE, CONS_INDX_BASE) always update the cache.
-
-Per the CMDQV architecture, a VCMDQ must be allocated to a Virtual
-Interface before it is used to send commands to the SMMU. Until
-that allocation happens, MMIO writes only update cached register
-state - no command consumption, error handling, or interrupt
-activity is driven from these writes. Subsequent patches wire up
-IOMMU_HW_QUEUE_ALLOC, mmap the host VINTF Page 0, and install it
-into guest MMIO; after that, Page 0 writes from either aperture
-reach the hardware-backed mmap'd page instead of just the cache.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260609112552.378999-18-skolothumtho@nvidia.com
-Co-developed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit bbe6bc469a96c64a66e221d83605fe71d248ff9f)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 159 +++++++++++++++++++++++++++++++++++++++-
- hw/arm/trace-events | 2 +
- 2 files changed, 159 insertions(+), 2 deletions(-)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index 2dfd377ee9..1f3d883cfe 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -120,6 +120,104 @@ static uint64_t tegra241_cmdqv_config_vintf_read(Tegra241CMDQV *cmdqv,
- }
- }
-
-+/*
-+ * Write a VCMDQ Page 0 register (control/status) using VCMDQ0_* offsets.
-+ *
-+ * The caller normalizes the MMIO offset such that @offset0 always refers
-+ * to a VCMDQ0_* register, while @index selects the VCMDQ instance.
-+ *
-+ * Page 0 registers are all 32-bit; this helper is only called for 4-byte
-+ * writes.
-+ */
-+static void tegra241_cmdqv_write_vcmdq_page0(Tegra241CMDQV *cmdqv,
-+ hwaddr offset0, int index,
-+ uint32_t value, bool direct)
-+{
-+ switch (offset0) {
-+ case A_VCMDQ0_CONS_INDX:
-+ cmdqv->vcmdq_cons_indx[index] = value;
-+ break;
-+ case A_VCMDQ0_PROD_INDX:
-+ /* VCMDQ is functional only once allocated to a VINTF; cache only. */
-+ cmdqv->vcmdq_prod_indx[index] = value;
-+ break;
-+ case A_VCMDQ0_CONFIG:
-+ if (value & R_VCMDQ0_CONFIG_CMDQ_EN_MASK) {
-+ cmdqv->vcmdq_status[index] |= R_VCMDQ0_STATUS_CMDQ_EN_OK_MASK;
-+ } else {
-+ cmdqv->vcmdq_status[index] &= ~R_VCMDQ0_STATUS_CMDQ_EN_OK_MASK;
-+ }
-+ cmdqv->vcmdq_config[index] = value;
-+ break;
-+ case A_VCMDQ0_GERRORN:
-+ /* VCMDQ is functional only once allocated to a VINTF; cache only. */
-+ cmdqv->vcmdq_gerrorn[index] = value;
-+ break;
-+ default:
-+ qemu_log_mask(LOG_UNIMP,
-+ "%s unhandled write access at 0x%" PRIx64 "\n",
-+ __func__, offset0);
-+ }
-+ trace_tegra241_cmdqv_write_vcmdq_page0(index, direct ? "direct" : "vi",
-+ offset0, value);
-+}
-+
-+/*
-+ * Write a VCMDQ Page 1 register (base / DRAM address) - 4-byte access.
-+ */
-+static void tegra241_cmdqv_write_vcmdq_page1(Tegra241CMDQV *cmdqv,
-+ hwaddr offset0, int index,
-+ uint32_t value, bool direct)
-+{
-+ switch (offset0) {
-+ case A_VCMDQ0_BASE_L:
-+ cmdqv->vcmdq_base[index] =
-+ deposit64(cmdqv->vcmdq_base[index], 0, 32, value);
-+ break;
-+ case A_VCMDQ0_BASE_H:
-+ cmdqv->vcmdq_base[index] =
-+ deposit64(cmdqv->vcmdq_base[index], 32, 32, value);
-+ break;
-+ case A_VCMDQ0_CONS_INDX_BASE_DRAM_L:
-+ cmdqv->vcmdq_cons_indx_base[index] =
-+ deposit64(cmdqv->vcmdq_cons_indx_base[index], 0, 32, value);
-+ break;
-+ case A_VCMDQ0_CONS_INDX_BASE_DRAM_H:
-+ cmdqv->vcmdq_cons_indx_base[index] =
-+ deposit64(cmdqv->vcmdq_cons_indx_base[index], 32, 32, value);
-+ break;
-+ default:
-+ qemu_log_mask(LOG_UNIMP,
-+ "%s unhandled write access at 0x%" PRIx64 "\n",
-+ __func__, offset0);
-+ }
-+ trace_tegra241_cmdqv_write_vcmdq_page1(index, direct ? "direct" : "vi",
-+ offset0, value);
-+}
-+
-+/*
-+ * Write a VCMDQ Page 1 register - 8-byte access at BASE_L or DRAM_L.
-+ */
-+static void tegra241_cmdqv_write_vcmdq_page1_64(Tegra241CMDQV *cmdqv,
-+ hwaddr offset0, int index,
-+ uint64_t value, bool direct)
-+{
-+ switch (offset0) {
-+ case A_VCMDQ0_BASE_L:
-+ cmdqv->vcmdq_base[index] = value;
-+ break;
-+ case A_VCMDQ0_CONS_INDX_BASE_DRAM_L:
-+ cmdqv->vcmdq_cons_indx_base[index] = value;
-+ break;
-+ default:
-+ qemu_log_mask(LOG_UNIMP,
-+ "%s unhandled 64-bit write at 0x%" PRIx64 "\n",
-+ __func__, offset0);
-+ }
-+ trace_tegra241_cmdqv_write_vcmdq_page1(index, direct ? "direct" : "vi",
-+ offset0, value);
-+}
-+
- static void tegra241_cmdqv_config_vintf_write(Tegra241CMDQV *cmdqv,
- hwaddr offset, uint64_t value)
- {
-@@ -243,6 +341,8 @@ out:
- static void tegra241_cmdqv_writel_mmio(Tegra241CMDQV *cmdqv, hwaddr offset,
- uint32_t value)
- {
-+ int index;
-+
- switch (offset) {
- case A_CONFIG:
- cmdqv->config = value;
-@@ -261,6 +361,39 @@ static void tegra241_cmdqv_writel_mmio(Tegra241CMDQV *cmdqv, hwaddr offset,
- case A_VINTF0_CONFIG ... A_VINTF0_LVCMDQ_ERR_MAP_3:
- tegra241_cmdqv_config_vintf_write(cmdqv, offset, value);
- break;
-+ case A_VI_VCMDQ0_CONS_INDX ... A_VI_VCMDQ1_GERRORN:
-+ /*
-+ * VINTF Page0 registers are hardware aliases of VCMDQ Page0 registers.
-+ * Translate the VINTF aperture offset to its VCMDQ Page0 equivalent
-+ * before dispatching to the Page 0 helper.
-+ */
-+ offset -= CMDQV_VINTF_PAGE0_BASE - CMDQV_VCMDQ_PAGE0_BASE;
-+ index = (offset - CMDQV_VCMDQ_PAGE0_BASE) / CMDQV_VCMDQ_STRIDE;
-+ tegra241_cmdqv_write_vcmdq_page0(cmdqv,
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, value, false);
-+ break;
-+ case A_VCMDQ0_CONS_INDX ... A_VCMDQ1_GERRORN:
-+ /*
-+ * Decode a per-VCMDQ Page 0 access. Each VCMDQ occupies a
-+ * CMDQV_VCMDQ_STRIDE-byte window; extract the index and normalize
-+ * to the VCMDQ0_* offset before calling the Page 0 helper.
-+ */
-+ index = (offset - CMDQV_VCMDQ_PAGE0_BASE) / CMDQV_VCMDQ_STRIDE;
-+ tegra241_cmdqv_write_vcmdq_page0(cmdqv,
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, value, true);
-+ break;
-+ case A_VI_VCMDQ0_BASE_L ... A_VI_VCMDQ1_CONS_INDX_BASE_DRAM_H:
-+ /* Same VINTF-to-VCMDQ translation as VINTF Page0 case above. */
-+ offset -= CMDQV_VINTF_PAGE1_BASE - CMDQV_VCMDQ_PAGE1_BASE;
-+ index = (offset - CMDQV_VCMDQ_PAGE1_BASE) / CMDQV_VCMDQ_STRIDE;
-+ tegra241_cmdqv_write_vcmdq_page1(cmdqv,
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, value, false);
-+ break;
-+ case A_VCMDQ0_BASE_L ... A_VCMDQ1_CONS_INDX_BASE_DRAM_H:
-+ index = (offset - CMDQV_VCMDQ_PAGE1_BASE) / CMDQV_VCMDQ_STRIDE;
-+ tegra241_cmdqv_write_vcmdq_page1(cmdqv,
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, value, true);
-+ break;
- default:
- qemu_log_mask(LOG_UNIMP, "%s unhandled write access at 0x%" PRIx64 "\n",
- __func__, offset);
-@@ -268,14 +401,36 @@ static void tegra241_cmdqv_writel_mmio(Tegra241CMDQV *cmdqv, hwaddr offset,
- }
-
- /*
-- * 8-byte MMIO write handler.
-+ * 8-byte MMIO write handler. Only Page 1 BASE / CONS_INDX_BASE_DRAM accept
-+ * full 64-bit writes; other offsets are write-ignored.
- */
- static void tegra241_cmdqv_writell_mmio(Tegra241CMDQV *cmdqv, hwaddr offset,
- uint64_t value)
- {
-- qemu_log_mask(LOG_UNIMP,
-+ int index;
-+
-+ switch (offset) {
-+ case A_VI_VCMDQ0_BASE_L ... A_VI_VCMDQ1_CONS_INDX_BASE_DRAM_H:
-+ /*
-+ * VINTF Page1 registers are hardware aliases of VCMDQ Page1 registers.
-+ * Translate the VINTF aperture offset to its VCMDQ Page1 equivalent
-+ * before dispatching to the Page 1 helper.
-+ */
-+ offset -= CMDQV_VINTF_PAGE1_BASE - CMDQV_VCMDQ_PAGE1_BASE;
-+ index = (offset - CMDQV_VCMDQ_PAGE1_BASE) / CMDQV_VCMDQ_STRIDE;
-+ tegra241_cmdqv_write_vcmdq_page1_64(cmdqv,
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, value, false);
-+ break;
-+ case A_VCMDQ0_BASE_L ... A_VCMDQ1_CONS_INDX_BASE_DRAM_H:
-+ index = (offset - CMDQV_VCMDQ_PAGE1_BASE) / CMDQV_VCMDQ_STRIDE;
-+ tegra241_cmdqv_write_vcmdq_page1_64(cmdqv,
-+ offset - index * CMDQV_VCMDQ_STRIDE, index, value, true);
-+ break;
-+ default:
-+ qemu_log_mask(LOG_UNIMP,
- "%s unhandled 64-bit write at 0x%" PRIx64 " (WI)\n",
- __func__, offset);
-+ }
- }
-
- static void tegra241_cmdqv_write_mmio(void *opaque, hwaddr offset,
-diff --git a/hw/arm/trace-events b/hw/arm/trace-events
-index 5156604228..666967dc5e 100644
---- a/hw/arm/trace-events
-+++ b/hw/arm/trace-events
-@@ -77,6 +77,8 @@ tegra241_cmdqv_read_mmio(uint64_t offset, uint64_t val, unsigned size) "offset:
- tegra241_cmdqv_write_mmio(uint64_t offset, uint64_t val, unsigned size) "offset: 0x%"PRIx64" val: 0x%"PRIx64" size: 0x%x"
- tegra241_cmdqv_read_vcmdq_page0(int index, const char *aperture, uint64_t offset0, uint64_t val) "vcmdq[%d] %s offset0: 0x%"PRIx64" val: 0x%"PRIx64
- tegra241_cmdqv_read_vcmdq_page1(int index, const char *aperture, uint64_t offset0, uint64_t val) "vcmdq[%d] %s offset0: 0x%"PRIx64" val: 0x%"PRIx64
-+tegra241_cmdqv_write_vcmdq_page0(int index, const char *aperture, uint64_t offset0, uint64_t val) "vcmdq[%d] %s offset0: 0x%"PRIx64" val: 0x%"PRIx64
-+tegra241_cmdqv_write_vcmdq_page1(int index, const char *aperture, uint64_t offset0, uint64_t val) "vcmdq[%d] %s offset0: 0x%"PRIx64" val: 0x%"PRIx64
-
- # strongarm.c
- strongarm_uart_update_parameters(const char *label, int speed, char parity, int data_bits, int stop_bits) "%s speed=%d parity=%c data=%d stop=%d"
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Implement-CMDQV-init.patch b/kvm-hw-arm-tegra241-cmdqv-Implement-CMDQV-init.patch
deleted file mode 100644
index 7c80ba4..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Implement-CMDQV-init.patch
+++ /dev/null
@@ -1,163 +0,0 @@
-From 45e38151ba9dbaed137e4a8df39e4ab795ac39ab Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:32 +0100
-Subject: [PATCH 090/111] hw/arm/tegra241-cmdqv: Implement CMDQV init
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [90/111] 88aae2a631de96c673ac5615e40b98040a2a4961 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Tegra241 CMDQV extends SMMUv3 with support for virtual command queues
-(VCMDQs) exposed via a CMDQV MMIO region. The CMDQV MMIO space is split
-into 64KB pages:
-
-0x00000 (CMDQ-V Config page)
-0x10000 (CMDQ-V CMDQ Page0)
-0x20000 (CMDQ-V CMDQ Page1)
-0x30000 (Virtual Interface Page0)
-0x40000 (Virtual Interface Page1)
-
-This patch wires up the Tegra241 CMDQV init callback and allocates
-vendor-specific CMDQV state. The state pointer is stored in
-SMMUv3AccelState for use by subsequent CMDQV operations.
-
-The CMDQV MMIO region and a dedicated IRQ line are registered with the
-SMMUv3 device. The MMIO read/write handlers are currently stubs and will
-be implemented in later patches.
-
-The CMDQV interrupt is edge-triggered and indicates VCMDQ or VINTF
-error conditions. This patch only registers the IRQ line. Interrupt
-generation and propagation to the guest will be added in a subsequent
-patch.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260609112552.378999-12-skolothumtho@nvidia.com
-Co-developed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit b110918bce7c65bd514c5dfd36e6abc8c21534f5)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.h | 1 +
- hw/arm/tegra241-cmdqv.c | 40 ++++++++++++++++++++++++++++++++++++++--
- hw/arm/tegra241-cmdqv.h | 20 ++++++++++++++++++++
- 3 files changed, 59 insertions(+), 2 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index b45f25ad03..e0bbec8581 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -61,6 +61,7 @@ typedef struct SMMUv3AccelState {
- bool auto_mode;
- bool auto_finalised;
- const SMMUv3AccelCmdqvOps *cmdqv_ops;
-+ void *cmdqv; /* vendor specific CMDQV state */
- } SMMUv3AccelState;
-
- typedef struct SMMUS1Hwpt {
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index 3a19a1af56..2875affc8d 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -13,6 +13,17 @@
- #include "smmuv3-accel.h"
- #include "tegra241-cmdqv.h"
-
-+static uint64_t tegra241_cmdqv_read_mmio(void *opaque, hwaddr offset,
-+ unsigned size)
-+{
-+ return 0;
-+}
-+
-+static void tegra241_cmdqv_write_mmio(void *opaque, hwaddr offset,
-+ uint64_t value, unsigned size)
-+{
-+}
-+
- static void tegra241_cmdqv_free_viommu(SMMUv3State *s)
- {
- }
-@@ -29,10 +40,35 @@ static void tegra241_cmdqv_reset(SMMUv3State *s)
- {
- }
-
-+static const MemoryRegionOps mmio_cmdqv_ops = {
-+ .read = tegra241_cmdqv_read_mmio,
-+ .write = tegra241_cmdqv_write_mmio,
-+ .endianness = DEVICE_LITTLE_ENDIAN,
-+ .valid = {
-+ .min_access_size = 4,
-+ .max_access_size = 8,
-+ },
-+ .impl = {
-+ .min_access_size = 4,
-+ .max_access_size = 8,
-+ },
-+};
-+
- static bool tegra241_cmdqv_init(SMMUv3State *s, Error **errp)
- {
-- error_setg(errp, "NVIDIA Tegra241 CMDQV is unsupported");
-- return false;
-+ SysBusDevice *sbd = SYS_BUS_DEVICE(OBJECT(s));
-+ SMMUv3AccelState *accel = s->s_accel;
-+ Tegra241CMDQV *cmdqv;
-+
-+ cmdqv = g_new0(Tegra241CMDQV, 1);
-+ cmdqv->cmdqv_data = g_new0(struct iommu_viommu_tegra241_cmdqv, 1);
-+ memory_region_init_io(&cmdqv->mmio_cmdqv, OBJECT(s), &mmio_cmdqv_ops, cmdqv,
-+ "tegra241-cmdqv", TEGRA241_CMDQV_IO_LEN);
-+ sysbus_init_mmio(sbd, &cmdqv->mmio_cmdqv);
-+ sysbus_init_irq(sbd, &cmdqv->irq);
-+ cmdqv->s_accel = accel;
-+ accel->cmdqv = cmdqv;
-+ return true;
- }
-
- static bool tegra241_cmdqv_probe(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
-diff --git a/hw/arm/tegra241-cmdqv.h b/hw/arm/tegra241-cmdqv.h
-index 38c8b27b4d..a5f65a8991 100644
---- a/hw/arm/tegra241-cmdqv.h
-+++ b/hw/arm/tegra241-cmdqv.h
-@@ -14,6 +14,26 @@
- #define CMDQV_NUM_CMDQ_LOG2 1
- #define CMDQV_NUM_SID_PER_VI_LOG2 4
-
-+/*
-+ * Tegra241 CMDQV MMIO layout (64KB pages)
-+ *
-+ * 0x00000 (CMDQ-V Config page)
-+ * 0x10000 (CMDQ-V CMDQ Page0)
-+ * 0x20000 (CMDQ-V CMDQ Page1)
-+ * 0x30000 (Virtual Interface Page0)
-+ * 0x40000 (Virtual Interface Page1)
-+ */
-+#define TEGRA241_CMDQV_IO_LEN 0x50000
-+
-+struct iommu_viommu_tegra241_cmdqv;
-+
-+typedef struct Tegra241CMDQV {
-+ struct iommu_viommu_tegra241_cmdqv *cmdqv_data;
-+ SMMUv3AccelState *s_accel;
-+ MemoryRegion mmio_cmdqv;
-+ qemu_irq irq;
-+} Tegra241CMDQV;
-+
- const SMMUv3AccelCmdqvOps *tegra241_cmdqv_get_ops(void);
-
- #endif /* HW_ARM_TEGRA241_CMDQV_H */
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Implement-CMDQV-vIOMMU-alloc-f.patch b/kvm-hw-arm-tegra241-cmdqv-Implement-CMDQV-vIOMMU-alloc-f.patch
deleted file mode 100644
index 8ea5615..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Implement-CMDQV-vIOMMU-alloc-f.patch
+++ /dev/null
@@ -1,130 +0,0 @@
-From ee99c9bf31e30f284e374d8b02c44b8fdaf4139f Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:34 +0100
-Subject: [PATCH 092/111] hw/arm/tegra241-cmdqv: Implement CMDQV vIOMMU
- alloc/free
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [92/111] f932036d720a12681cb5515842421d3ce56e9e30 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Replace the stub implementation with real vIOMMU allocation for
-Tegra241 CMDQV.
-
-Allocate a matching vEVENTQ together with the vIOMMU, since it is
-specific to the Tegra241 CMDQV vIOMMU and used to receive CMDQV
-events.
-
-Free both objects on teardown.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260609112552.378999-14-skolothumtho@nvidia.com
-Co-developed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 43763a1ab76fb618119bb76b0e4a93b599b40f13)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 48 ++++++++++++++++++++++++++++++++++++++++-
- hw/arm/tegra241-cmdqv.h | 1 +
- 2 files changed, 48 insertions(+), 1 deletion(-)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index 2875affc8d..c1351c8519 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -10,6 +10,7 @@
- #include "qemu/osdep.h"
-
- #include "hw/arm/smmuv3.h"
-+#include "hw/arm/smmuv3-common.h"
- #include "smmuv3-accel.h"
- #include "tegra241-cmdqv.h"
-
-@@ -26,13 +27,58 @@ static void tegra241_cmdqv_write_mmio(void *opaque, hwaddr offset,
-
- static void tegra241_cmdqv_free_viommu(SMMUv3State *s)
- {
-+ SMMUv3AccelState *accel = s->s_accel;
-+ IOMMUFDViommu *viommu = accel->viommu;
-+ Tegra241CMDQV *cmdqv = accel->cmdqv;
-+ IOMMUFDVeventq *veventq = cmdqv->veventq;
-+
-+ if (!viommu) {
-+ return;
-+ }
-+ if (veventq) {
-+ close(veventq->veventq_fd);
-+ iommufd_backend_free_id(viommu->iommufd, veventq->veventq_id);
-+ g_free(veventq);
-+ cmdqv->veventq = NULL;
-+ }
-+ iommufd_backend_free_id(viommu->iommufd, viommu->viommu_id);
- }
-
- static bool
- tegra241_cmdqv_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- uint32_t *out_viommu_id, Error **errp)
- {
-- error_setg(errp, "NVIDIA Tegra241 CMDQV is unsupported");
-+ Tegra241CMDQV *cmdqv = s->s_accel->cmdqv;
-+ uint32_t viommu_id, veventq_id, veventq_fd;
-+ IOMMUFDVeventq *veventq;
-+
-+ if (!iommufd_backend_alloc_viommu(idev->iommufd, idev->devid,
-+ IOMMU_VIOMMU_TYPE_TEGRA241_CMDQV,
-+ idev->hwpt_id, cmdqv->cmdqv_data,
-+ sizeof(*cmdqv->cmdqv_data), &viommu_id,
-+ errp)) {
-+ return false;
-+ }
-+
-+ if (!iommufd_backend_alloc_veventq(idev->iommufd, viommu_id,
-+ IOMMU_VEVENTQ_TYPE_TEGRA241_CMDQV,
-+ 1 << SMMU_EVENTQS, &veventq_id,
-+ &veventq_fd,
-+ errp)) {
-+ error_append_hint(errp, "Tegra241 CMDQV: failed to alloc veventq");
-+ goto free_viommu;
-+ }
-+
-+ veventq = g_new(IOMMUFDVeventq, 1);
-+ veventq->veventq_id = veventq_id;
-+ veventq->veventq_fd = veventq_fd;
-+ cmdqv->veventq = veventq;
-+
-+ *out_viommu_id = viommu_id;
-+ return true;
-+
-+free_viommu:
-+ iommufd_backend_free_id(idev->iommufd, viommu_id);
- return false;
- }
-
-diff --git a/hw/arm/tegra241-cmdqv.h b/hw/arm/tegra241-cmdqv.h
-index a5f65a8991..9fc720e96c 100644
---- a/hw/arm/tegra241-cmdqv.h
-+++ b/hw/arm/tegra241-cmdqv.h
-@@ -32,6 +32,7 @@ typedef struct Tegra241CMDQV {
- SMMUv3AccelState *s_accel;
- MemoryRegion mmio_cmdqv;
- qemu_irq irq;
-+ IOMMUFDVeventq *veventq;
- } Tegra241CMDQV;
-
- const SMMUv3AccelCmdqvOps *tegra241_cmdqv_get_ops(void);
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Initialize-register-state-on-r.patch b/kvm-hw-arm-tegra241-cmdqv-Initialize-register-state-on-r.patch
deleted file mode 100644
index 4e42547..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Initialize-register-state-on-r.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-From 3d0860d341a6cfb580cb1f5369fc42c8e5edf7e5 Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:45 +0100
-Subject: [PATCH 103/111] hw/arm/tegra241-cmdqv: Initialize register state on
- reset
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [103/111] c7d9172502f2e3ab87e9205b814f5f6e80637eee (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Initialize the Tegra241 CMDQV register state in the reset handler.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-25-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit ae1a6a69c002fc331861be505d641014198bc33e)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 38 ++++++++++++++++++++++++++++++++++++++
- hw/arm/tegra241-cmdqv.h | 3 +++
- hw/arm/trace-events | 1 +
- 3 files changed, 42 insertions(+)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index 71d02ae740..6804f0bb7e 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -863,6 +863,42 @@ free_viommu:
- return false;
- }
-
-+static void tegra241_cmdqv_init_regs(SMMUv3State *s, Tegra241CMDQV *cmdqv)
-+{
-+ int i;
-+
-+ cmdqv->config = V_CONFIG_RESET;
-+ cmdqv->param = FIELD_DP32(0, PARAM, CMDQV_VER, CMDQV_VER);
-+ cmdqv->param = FIELD_DP32(cmdqv->param, PARAM, CMDQV_NUM_CMDQ_LOG2,
-+ CMDQV_NUM_CMDQ_LOG2);
-+ cmdqv->param = FIELD_DP32(cmdqv->param, PARAM, CMDQV_NUM_SID_PER_VI_LOG2,
-+ CMDQV_NUM_SID_PER_VI_LOG2);
-+ trace_tegra241_cmdqv_init_regs(cmdqv->param);
-+ cmdqv->status = R_STATUS_CMDQV_ENABLED_MASK;
-+
-+ for (i = 0; i < 2; i++) {
-+ cmdqv->vi_err_map[i] = 0;
-+ cmdqv->vi_int_mask[i] = 0;
-+ }
-+ for (i = 0; i < 4; i++) {
-+ cmdqv->cmdq_err_map[i] = 0;
-+ cmdqv->vintf_cmdq_err_map[i] = 0;
-+ }
-+ cmdqv->vintf_config = 0;
-+ cmdqv->vintf_status = 0;
-+ for (i = 0; i < TEGRA241_CMDQV_MAX_CMDQ; i++) {
-+ cmdqv->cmdq_alloc_map[i] = 0;
-+ cmdqv->vcmdq_cons_indx[i] = 0;
-+ cmdqv->vcmdq_prod_indx[i] = 0;
-+ cmdqv->vcmdq_config[i] = 0;
-+ cmdqv->vcmdq_status[i] = 0;
-+ cmdqv->vcmdq_gerror[i] = 0;
-+ cmdqv->vcmdq_gerrorn[i] = 0;
-+ cmdqv->vcmdq_base[i] = 0;
-+ cmdqv->vcmdq_cons_indx_base[i] = 0;
-+ }
-+}
-+
- static void tegra241_cmdqv_reset(SMMUv3State *s)
- {
- Tegra241CMDQV *cmdqv = s->s_accel->cmdqv;
-@@ -873,6 +909,8 @@ static void tegra241_cmdqv_reset(SMMUv3State *s)
-
- tegra241_cmdqv_guest_unmap_vintf_page0(cmdqv);
- tegra241_cmdqv_free_all_vcmdq(cmdqv);
-+
-+ tegra241_cmdqv_init_regs(s, cmdqv);
- }
-
- static const MemoryRegionOps mmio_cmdqv_ops = {
-diff --git a/hw/arm/tegra241-cmdqv.h b/hw/arm/tegra241-cmdqv.h
-index 0964f68a20..a924e7e90f 100644
---- a/hw/arm/tegra241-cmdqv.h
-+++ b/hw/arm/tegra241-cmdqv.h
-@@ -89,6 +89,9 @@ FIELD(CONFIG, CMDQ_MAX_CLK_BATCH, 4, 8)
- FIELD(CONFIG, CMDQ_MAX_CMD_BATCH, 12, 8)
- FIELD(CONFIG, CONS_DRAM_EN, 20, 1)
-
-+/* CMDQV_EN=1, PER_CMD_OFFSET=16B, CLK_BATCH=256, CMD_BATCH=32. */
-+#define V_CONFIG_RESET 0x00020083
-+
- REG32(PARAM, 0x4)
- FIELD(PARAM, CMDQV_VER, 0, 4)
- FIELD(PARAM, CMDQV_NUM_CMDQ_LOG2, 4, 4)
-diff --git a/hw/arm/trace-events b/hw/arm/trace-events
-index dbed00afbb..0bd718b1ab 100644
---- a/hw/arm/trace-events
-+++ b/hw/arm/trace-events
-@@ -76,6 +76,7 @@ smmuv3_accel_install_ste(uint32_t vsid, const char * type, uint32_t hwpt_id) "vS
- tegra241_cmdqv_read_mmio(uint64_t offset, uint64_t val, unsigned size) "offset: 0x%"PRIx64" val: 0x%"PRIx64" size: 0x%x"
- tegra241_cmdqv_write_mmio(uint64_t offset, uint64_t val, unsigned size) "offset: 0x%"PRIx64" val: 0x%"PRIx64" size: 0x%x"
- tegra241_cmdqv_err_map(uint32_t map3, uint32_t map2, uint32_t map1, uint32_t map0) "hw irq received. error (hex) maps: %04X:%04X:%04X:%04X"
-+tegra241_cmdqv_init_regs(uint32_t param) "register init, param=0x%08X"
- tegra241_cmdqv_read_vcmdq_page0(int index, const char *aperture, const char *backing, uint64_t offset0, uint64_t val) "vcmdq[%d] %s (%s) offset0: 0x%"PRIx64" val: 0x%"PRIx64
- tegra241_cmdqv_read_vcmdq_page1(int index, const char *aperture, uint64_t offset0, uint64_t val) "vcmdq[%d] %s offset0: 0x%"PRIx64" val: 0x%"PRIx64
- tegra241_cmdqv_write_vcmdq_page0(int index, const char *aperture, const char *backing, uint64_t offset0, uint64_t val) "vcmdq[%d] %s (%s) offset0: 0x%"PRIx64" val: 0x%"PRIx64
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Limit-queue-size-based-on-back.patch b/kvm-hw-arm-tegra241-cmdqv-Limit-queue-size-based-on-back.patch
deleted file mode 100644
index aaa2e43..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Limit-queue-size-based-on-back.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-From e87230889999d19b5bb045670cca5721e4e92533 Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:46 +0100
-Subject: [PATCH 104/111] hw/arm/tegra241-cmdqv: Limit queue size based on
- backend page size
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [104/111] a3c4ec875272161cf41791a9806a4a085a659ffa (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-CMDQV HW performs DMA accesses to guest queue memory by its host
-physical address set up via IOMMUFD. This requires the guest queue
-to be contiguous in both guest PA and host PA space. With Tegra241
-CMDQV enabled, we must only advertise a command queue size (CMDQS)
-that the host can safely back with physically contiguous memory.
-Allowing a queue size larger than the host page size could cause
-the hardware to DMA across page boundaries, leading to faults.
-
-Use qemu_minrampagesize() to find the smallest memory-backend page
-size in use, then cap IDR1.CMDQS so the guest cannot configure a
-command queue that exceeds that contiguous backing.
-
-Note this is done at SMMUv3 init, before any guest queue GPA is
-known, so the cap is conservative. Maximum queue size is 8MiB;
-it is recommended to back the VM with hugepage sizes large enough
-so CMDQS stays at the HW maximum. Smaller backing pages reduce
-CMDQS accordingly.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-26-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 0552f94fbdb6d2a3cee292911353241b1ba534cd)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 20 ++++++++++++++++++++
- 1 file changed, 20 insertions(+)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index 6804f0bb7e..a4c140e34c 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -14,6 +14,8 @@
- #include "hw/arm/smmuv3-common.h"
- #include "hw/irq.h"
- #include "smmuv3-accel.h"
-+#include "smmuv3-internal.h"
-+#include "system/hostmem.h"
- #include "tegra241-cmdqv.h"
- #include "trace.h"
-
-@@ -866,6 +868,8 @@ free_viommu:
- static void tegra241_cmdqv_init_regs(SMMUv3State *s, Tegra241CMDQV *cmdqv)
- {
- int i;
-+ long pgsize;
-+ uint32_t val;
-
- cmdqv->config = V_CONFIG_RESET;
- cmdqv->param = FIELD_DP32(0, PARAM, CMDQV_VER, CMDQV_VER);
-@@ -897,6 +901,22 @@ static void tegra241_cmdqv_init_regs(SMMUv3State *s, Tegra241CMDQV *cmdqv)
- cmdqv->vcmdq_base[i] = 0;
- cmdqv->vcmdq_cons_indx_base[i] = 0;
- }
-+
-+ /*
-+ * CMDQ must not cross a physical RAM backend page. Adjust CMDQS so the
-+ * queue fits entirely within the smallest backend page size, ensuring
-+ * the command queue is physically contiguous in host memory.
-+ *
-+ * IDR1.CMDQS = log2(max_qsz) - entry_shift
-+ *
-+ * where entry_shift = 4 (each CMDQ entry is 16 bytes = 2^4).
-+ */
-+ pgsize = qemu_minrampagesize();
-+ if (pgsize == LONG_MAX) {
-+ pgsize = qemu_real_host_page_size();
-+ }
-+ val = FIELD_EX32(s->idr[1], IDR1, CMDQS);
-+ s->idr[1] = FIELD_DP32(s->idr[1], IDR1, CMDQS, MIN(ctz64(pgsize) - 4, val));
- }
-
- static void tegra241_cmdqv_reset(SMMUv3State *s)
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Probe-host-Tegra241-CMDQV-supp.patch b/kvm-hw-arm-tegra241-cmdqv-Probe-host-Tegra241-CMDQV-supp.patch
deleted file mode 100644
index 678b194..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Probe-host-Tegra241-CMDQV-supp.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From 2886a2c1b009f99327da4b691c30f7d0149f18e6 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:31 +0100
-Subject: [PATCH 089/111] hw/arm/tegra241-cmdqv: Probe host Tegra241 CMDQV
- support
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [89/111] 2dfd7f24b8300f222b3be054996d3bd17aabf9e6 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Use IOMMU_GET_HW_INFO to query host support for Tegra241 CMDQV.
-
-Validate the returned data type, version, and minimum number of vCMDQs and
-SIDs per Tegra241 CMDQ Virtual Interface(VI). Fail the probe if the host
-does not meet these requirements.
-
-The QEMU model supports one Virtual Interface(VI) per VM with 2 vCMDQs and
-16 SIDs per VI, so the probe ensures the host implementation is compatible
-with these limits.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-11-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 61e7de842085f313cab0be4f1b296f3dec52b5a2)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 32 ++++++++++++++++++++++++++++++--
- hw/arm/tegra241-cmdqv.h | 4 ++++
- 2 files changed, 34 insertions(+), 2 deletions(-)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index ad5a0d4611..3a19a1af56 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -38,8 +38,36 @@ static bool tegra241_cmdqv_init(SMMUv3State *s, Error **errp)
- static bool tegra241_cmdqv_probe(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- Error **errp)
- {
-- error_setg(errp, "NVIDIA Tegra241 CMDQV is unsupported");
-- return false;
-+ uint32_t data_type = IOMMU_HW_INFO_TYPE_TEGRA241_CMDQV;
-+ struct iommu_hw_info_tegra241_cmdqv cmdqv_info;
-+ uint64_t caps;
-+
-+ if (!iommufd_backend_get_device_info(idev->iommufd, idev->devid, &data_type,
-+ &cmdqv_info, sizeof(cmdqv_info), &caps,
-+ NULL, errp)) {
-+ return false;
-+ }
-+ if (data_type != IOMMU_HW_INFO_TYPE_TEGRA241_CMDQV) {
-+ error_setg(errp, "Host CMDQV: unexpected data type %u (expected %u)",
-+ data_type, IOMMU_HW_INFO_TYPE_TEGRA241_CMDQV);
-+ return false;
-+ }
-+ if (cmdqv_info.version != CMDQV_VER) {
-+ error_setg(errp, "Host CMDQV: unsupported version %u (expected %u)",
-+ cmdqv_info.version, CMDQV_VER);
-+ return false;
-+ }
-+ if (cmdqv_info.log2vcmdqs < CMDQV_NUM_CMDQ_LOG2) {
-+ error_setg(errp, "Host CMDQV: insufficient vCMDQs log2=%u (need >= %u)",
-+ cmdqv_info.log2vcmdqs, CMDQV_NUM_CMDQ_LOG2);
-+ return false;
-+ }
-+ if (cmdqv_info.log2vsids < CMDQV_NUM_SID_PER_VI_LOG2) {
-+ error_setg(errp, "Host CMDQV: insufficient SIDs log2=%u (need >= %u)",
-+ cmdqv_info.log2vsids, CMDQV_NUM_SID_PER_VI_LOG2);
-+ return false;
-+ }
-+ return true;
- }
-
- static const SMMUv3AccelCmdqvOps tegra241_cmdqv_ops = {
-diff --git a/hw/arm/tegra241-cmdqv.h b/hw/arm/tegra241-cmdqv.h
-index 74a6954017..38c8b27b4d 100644
---- a/hw/arm/tegra241-cmdqv.h
-+++ b/hw/arm/tegra241-cmdqv.h
-@@ -10,6 +10,10 @@
- #ifndef HW_ARM_TEGRA241_CMDQV_H
- #define HW_ARM_TEGRA241_CMDQV_H
-
-+#define CMDQV_VER 1
-+#define CMDQV_NUM_CMDQ_LOG2 1
-+#define CMDQV_NUM_SID_PER_VI_LOG2 4
-+
- const SMMUv3AccelCmdqvOps *tegra241_cmdqv_get_ops(void);
-
- #endif /* HW_ARM_TEGRA241_CMDQV_H */
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Read-and-propagate-Tegra241-CM.patch b/kvm-hw-arm-tegra241-cmdqv-Read-and-propagate-Tegra241-CM.patch
deleted file mode 100644
index e1b0377..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Read-and-propagate-Tegra241-CM.patch
+++ /dev/null
@@ -1,165 +0,0 @@
-From 89fb1af579e19967cb0af6e779827a526ca9598a Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:44 +0100
-Subject: [PATCH 102/111] hw/arm/tegra241-cmdqv: Read and propagate Tegra241
- CMDQV errors
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [102/111] b4f1bb2a739a357cdf2b145c0be5a93c9b771171 (eauger1/centos-qemu-kvm)
-
-Conflicts: hw/core/irq.h replaced by hw/irq.h in hw/arm/tegra241-cmdqv.c
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Install an event handler on the CMDQV vEVENTQ fd to read and propagate
-host received CMDQV errors to the guest.
-
-The handler runs in QEMU's main loop, using a non-blocking fd registered
-via qemu_set_fd_handler().
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-24-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 1de52612f3ff339598b8c19ee5caa563a371a323)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 63 +++++++++++++++++++++++++++++++++++++++++
- hw/arm/trace-events | 1 +
- 2 files changed, 64 insertions(+)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index 7264b4bfa9..71d02ae740 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -12,6 +12,7 @@
-
- #include "hw/arm/smmuv3.h"
- #include "hw/arm/smmuv3-common.h"
-+#include "hw/irq.h"
- #include "smmuv3-accel.h"
- #include "tegra241-cmdqv.h"
- #include "trace.h"
-@@ -729,6 +730,51 @@ out:
- trace_tegra241_cmdqv_write_mmio(offset, value, size);
- }
-
-+static void tegra241_cmdqv_event_read(void *opaque)
-+{
-+ Tegra241CMDQV *cmdqv = opaque;
-+ IOMMUFDVeventq *veventq = cmdqv->veventq;
-+ struct {
-+ struct iommufd_vevent_header hdr;
-+ struct iommu_vevent_tegra241_cmdqv vevent;
-+ } buf;
-+ Error *local_err = NULL;
-+
-+ if (!smmuv3_accel_event_read_validate(veventq,
-+ IOMMU_VEVENTQ_TYPE_TEGRA241_CMDQV,
-+ &buf, sizeof(buf), &local_err)) {
-+ warn_report_err_once(local_err);
-+ return;
-+ }
-+
-+ if (buf.vevent.lvcmdq_err_map[0] || buf.vevent.lvcmdq_err_map[1]) {
-+ cmdqv->vintf_cmdq_err_map[0] =
-+ extract64(buf.vevent.lvcmdq_err_map[0], 0, 32);
-+ cmdqv->vintf_cmdq_err_map[1] =
-+ extract64(buf.vevent.lvcmdq_err_map[0], 32, 32);
-+ cmdqv->vintf_cmdq_err_map[2] =
-+ extract64(buf.vevent.lvcmdq_err_map[1], 0, 32);
-+ cmdqv->vintf_cmdq_err_map[3] =
-+ extract64(buf.vevent.lvcmdq_err_map[1], 32, 32);
-+ /*
-+ * CMDQV_CMDQ_ERR_MAP and VINTF0_LVCMDQ_ERR_MAP are distinct
-+ * registers (different MMIO offsets). With only VINTF0 exposed
-+ * they carry the same data, so mirror.
-+ */
-+ for (int i = 0; i < 4; i++) {
-+ cmdqv->cmdq_err_map[i] = cmdqv->vintf_cmdq_err_map[i];
-+ }
-+ /* Set the VINTF0 bit in VI_ERR_MAP_0 (only VINTF0 is exposed). */
-+ cmdqv->vi_err_map[0] |= BIT(0);
-+ if (!(cmdqv->vi_int_mask[0] & BIT(0))) {
-+ qemu_irq_pulse(cmdqv->irq);
-+ }
-+ trace_tegra241_cmdqv_err_map(
-+ cmdqv->vintf_cmdq_err_map[3], cmdqv->vintf_cmdq_err_map[2],
-+ cmdqv->vintf_cmdq_err_map[1], cmdqv->vintf_cmdq_err_map[0]);
-+ }
-+}
-+
- static void tegra241_cmdqv_free_viommu(SMMUv3State *s)
- {
- SMMUv3AccelState *accel = s->s_accel;
-@@ -740,6 +786,7 @@ static void tegra241_cmdqv_free_viommu(SMMUv3State *s)
- return;
- }
- if (veventq) {
-+ qemu_set_fd_handler(veventq->veventq_fd, NULL, NULL, NULL);
- close(veventq->veventq_fd);
- iommufd_backend_free_id(viommu->iommufd, veventq->veventq_id);
- g_free(veventq);
-@@ -759,6 +806,7 @@ tegra241_cmdqv_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- Tegra241CMDQV *cmdqv = s->s_accel->cmdqv;
- uint32_t viommu_id, veventq_id, veventq_fd;
- IOMMUFDVeventq *veventq;
-+ int flags;
-
- if (!iommufd_backend_alloc_viommu(idev->iommufd, idev->devid,
- IOMMU_VIOMMU_TYPE_TEGRA241_CMDQV,
-@@ -784,14 +832,29 @@ tegra241_cmdqv_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- goto munmap_page0;
- }
-
-+ flags = fcntl(veventq_fd, F_GETFL);
-+ if (flags < 0) {
-+ error_setg(errp, "Failed to get flags for vEVENTQ fd");
-+ goto free_veventq;
-+ }
-+ if (fcntl(veventq_fd, F_SETFL, O_NONBLOCK | flags) < 0) {
-+ error_setg(errp, "Failed to set O_NONBLOCK on vEVENTQ fd");
-+ goto free_veventq;
-+ }
-+
- veventq = g_new(IOMMUFDVeventq, 1);
- veventq->veventq_id = veventq_id;
- veventq->veventq_fd = veventq_fd;
- cmdqv->veventq = veventq;
-
-+ /* Set up event handler for veventq fd */
-+ qemu_set_fd_handler(veventq_fd, tegra241_cmdqv_event_read, NULL, cmdqv);
- *out_viommu_id = viommu_id;
- return true;
-
-+free_veventq:
-+ close(veventq_fd);
-+ iommufd_backend_free_id(idev->iommufd, veventq_id);
- munmap_page0:
- munmap(cmdqv->vintf_page0, VINTF_PAGE_SIZE);
- cmdqv->vintf_page0 = NULL;
-diff --git a/hw/arm/trace-events b/hw/arm/trace-events
-index a8dcbc82db..dbed00afbb 100644
---- a/hw/arm/trace-events
-+++ b/hw/arm/trace-events
-@@ -75,6 +75,7 @@ smmuv3_accel_install_ste(uint32_t vsid, const char * type, uint32_t hwpt_id) "vS
- # tegra241-cmdqv
- tegra241_cmdqv_read_mmio(uint64_t offset, uint64_t val, unsigned size) "offset: 0x%"PRIx64" val: 0x%"PRIx64" size: 0x%x"
- tegra241_cmdqv_write_mmio(uint64_t offset, uint64_t val, unsigned size) "offset: 0x%"PRIx64" val: 0x%"PRIx64" size: 0x%x"
-+tegra241_cmdqv_err_map(uint32_t map3, uint32_t map2, uint32_t map1, uint32_t map0) "hw irq received. error (hex) maps: %04X:%04X:%04X:%04X"
- tegra241_cmdqv_read_vcmdq_page0(int index, const char *aperture, const char *backing, uint64_t offset0, uint64_t val) "vcmdq[%d] %s (%s) offset0: 0x%"PRIx64" val: 0x%"PRIx64
- tegra241_cmdqv_read_vcmdq_page1(int index, const char *aperture, uint64_t offset0, uint64_t val) "vcmdq[%d] %s offset0: 0x%"PRIx64" val: 0x%"PRIx64
- tegra241_cmdqv_write_vcmdq_page0(int index, const char *aperture, const char *backing, uint64_t offset0, uint64_t val) "vcmdq[%d] %s (%s) offset0: 0x%"PRIx64" val: 0x%"PRIx64
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Route-allocated-VCMDQ-Page0-ac.patch b/kvm-hw-arm-tegra241-cmdqv-Route-allocated-VCMDQ-Page0-ac.patch
deleted file mode 100644
index 7ac65c3..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Route-allocated-VCMDQ-Page0-ac.patch
+++ /dev/null
@@ -1,244 +0,0 @@
-From 05198739d42d3ad9b57a52075b56dbfa7042de41 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:40 +0100
-Subject: [PATCH 098/111] hw/arm/tegra241-cmdqv: Route allocated VCMDQ Page0
- accesses to the mmap'd host VINTF page0
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [98/111] 06b905fe92b20420565b5730d6ed2d0a843c0eba (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Introduce tegra241_cmdqv_vintf_lvcmdq_ptr() to route VCMDQ Page 0
-register accesses through the mmap'd host VINTF Page 0 backing once a
-hardware queue has been allocated for the VCMDQ.
-
-The two QEMU-trapped Page 0 apertures (direct at 0x10000, VINTF at
-0x30000) are hardware aliases of the same underlying registers. A
-subsequent patch installs the VINTF aperture as a RAM-device into
-guest MMIO; in this patch both remain QEMU-trapped.
-
-The direct VCMDQ aperture stays QEMU-trapped (rather than aliased
-to the VINTF mmap) so that writes to an unallocated VCMDQ remain
-well-defined. The CMDQV architecture allows software to program a
-VCMDQ through the direct aperture without first allocating it to a
-VINTF; aliasing to the VINTF mmap would route those writes into
-unallocated logical slots where the hardware silently drops them.
-
-A VCMDQ Page 0 access is served from one of two sources:
-
- - Cache-backed: no hw_queue is allocated for the VCMDQ
- (HW_QUEUE_ALLOC has not yet succeeded). Both apertures use
- QEMU's register cache.
-
- - HW-backed: HW_QUEUE_ALLOC has succeeded. Both apertures access
- the registers directly through the mmap'd host VINTF Page 0.
-
-tegra241_cmdqv_sync_vcmdq() copies any cached writes (CONS_INDX,
-PROD_INDX, CONFIG, GERRORN) into the mmap'd page on the cache-to-HW
-transition so the guest's earlier register state survives. Freeing a
-VCMDQ clears the cached Page0 registers.
-
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Message-id: 20260609112552.378999-20-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 1d0f7753541784cbafb7aee3adc843816bf7c66d)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 89 +++++++++++++++++++++++++++++++++++++++++
- hw/arm/trace-events | 4 +-
- 2 files changed, 91 insertions(+), 2 deletions(-)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index 8cb39e87c4..63fe0ac681 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -16,6 +16,16 @@
- #include "tegra241-cmdqv.h"
- #include "trace.h"
-
-+static void tegra241_cmdqv_reset_vcmdq_cache(Tegra241CMDQV *cmdqv, int index)
-+{
-+ cmdqv->vcmdq_cons_indx[index] = 0;
-+ cmdqv->vcmdq_prod_indx[index] = 0;
-+ cmdqv->vcmdq_config[index] = 0;
-+ cmdqv->vcmdq_status[index] = 0;
-+ cmdqv->vcmdq_gerror[index] = 0;
-+ cmdqv->vcmdq_gerrorn[index] = 0;
-+}
-+
- static void tegra241_cmdqv_free_vcmdq(Tegra241CMDQV *cmdqv, int index)
- {
- IOMMUFDViommu *viommu = cmdqv->s_accel->viommu;
-@@ -27,6 +37,7 @@ static void tegra241_cmdqv_free_vcmdq(Tegra241CMDQV *cmdqv, int index)
- iommufd_backend_free_id(viommu->iommufd, vcmdq->hw_queue_id);
- g_free(vcmdq);
- cmdqv->vcmdq[index] = NULL;
-+ tegra241_cmdqv_reset_vcmdq_cache(cmdqv, index);
- }
-
- /*
-@@ -45,6 +56,47 @@ static bool tegra241_cmdqv_vcmdq_ready_to_alloc(Tegra241CMDQV *cmdqv, int index)
- tegra241_cmdqv_enabled(cmdqv) && tegra241_vintf_enabled(cmdqv);
- }
-
-+/*
-+ * Return a pointer into the mmap'd VINTF page0 for the VCMDQ Page 0
-+ * register at @offset0 in VCMDQ slot @index, or NULL when the VCMDQ
-+ * has no hw_queue allocated or the host VINTF page0 is not mmap'd.
-+ */
-+static inline uint32_t *tegra241_cmdqv_vintf_lvcmdq_ptr(Tegra241CMDQV *cmdqv,
-+ int index, hwaddr offset0)
-+{
-+ if (!cmdqv->vcmdq[index] || !cmdqv->vintf_page0) {
-+ return NULL;
-+ }
-+ return (uint32_t *)(cmdqv->vintf_page0 +
-+ (index * CMDQV_VCMDQ_STRIDE) +
-+ (offset0 - CMDQV_VCMDQ_PAGE0_BASE));
-+}
-+
-+/*
-+ * Flush cached register writes into the mmap'd host VINTF page0 after a
-+ * successful HW_QUEUE_ALLOC, so the guest's earlier writes survive
-+ * the cache-to-hardware transition.
-+ */
-+static void tegra241_cmdqv_sync_vcmdq(Tegra241CMDQV *cmdqv, int index)
-+{
-+ uint32_t *ptr;
-+
-+ ptr = tegra241_cmdqv_vintf_lvcmdq_ptr(cmdqv, index, A_VCMDQ0_CONS_INDX);
-+ if (!ptr) {
-+ return;
-+ }
-+ *ptr = cmdqv->vcmdq_cons_indx[index];
-+
-+ ptr = tegra241_cmdqv_vintf_lvcmdq_ptr(cmdqv, index, A_VCMDQ0_PROD_INDX);
-+ *ptr = cmdqv->vcmdq_prod_indx[index];
-+
-+ ptr = tegra241_cmdqv_vintf_lvcmdq_ptr(cmdqv, index, A_VCMDQ0_CONFIG);
-+ *ptr = cmdqv->vcmdq_config[index];
-+
-+ ptr = tegra241_cmdqv_vintf_lvcmdq_ptr(cmdqv, index, A_VCMDQ0_GERRORN);
-+ *ptr = cmdqv->vcmdq_gerrorn[index];
-+}
-+
- /*
- * Allocate a host HW VCMDQ from the current cached BASE / size for @index.
- * No-op (returns true) until the VCMDQ is ready to be allocated.
-@@ -85,6 +137,9 @@ static bool tegra241_cmdqv_setup_vcmdq(Tegra241CMDQV *cmdqv, int index,
- cmdqv->vcmdq_gerror[index] &= ~R_VCMDQ0_GERROR_CMDQ_INIT_ERR_MASK;
- cmdqv->vcmdq_status[index] |= R_VCMDQ0_STATUS_CMDQ_EN_OK_MASK;
-
-+ /* Push cached writes to HW; freeing resets the cache. */
-+ tegra241_cmdqv_sync_vcmdq(cmdqv, index);
-+
- return true;
- }
-
-@@ -111,13 +166,23 @@ static void tegra241_cmdqv_setup_all_vcmdq(Tegra241CMDQV *cmdqv,
- *
- * The caller normalizes the MMIO offset such that @offset0 always refers
- * to a VCMDQ0_* register, while @index selects the VCMDQ instance.
-+ *
-+ * If the VCMDQ is allocated and the host VINTF page0 is mmap'd, read
-+ * directly from the host VINTF page0 backing. Otherwise, fall back to
-+ * the cache.
- */
- static uint64_t tegra241_cmdqv_read_vcmdq_page0(Tegra241CMDQV *cmdqv,
- hwaddr offset0, int index,
- bool direct)
- {
-+ uint32_t *ptr = tegra241_cmdqv_vintf_lvcmdq_ptr(cmdqv, index, offset0);
- uint64_t val = 0;
-
-+ if (ptr) {
-+ val = *ptr;
-+ goto out;
-+ }
-+
- switch (offset0) {
- case A_VCMDQ0_CONS_INDX:
- val = cmdqv->vcmdq_cons_indx[index];
-@@ -142,7 +207,9 @@ static uint64_t tegra241_cmdqv_read_vcmdq_page0(Tegra241CMDQV *cmdqv,
- "%s unhandled read access at 0x%" PRIx64 "\n",
- __func__, offset0);
- }
-+out:
- trace_tegra241_cmdqv_read_vcmdq_page0(index, direct ? "direct" : "vi",
-+ ptr ? "hw" : "cache",
- offset0, val);
- return val;
- }
-@@ -218,11 +285,31 @@ static uint64_t tegra241_cmdqv_config_vintf_read(Tegra241CMDQV *cmdqv,
- *
- * Page 0 registers are all 32-bit; this helper is only called for 4-byte
- * writes.
-+ *
-+ * If the VCMDQ is allocated and the host VINTF page0 is mmap'd, write
-+ * directly to the VINTF page0 backing. Otherwise, update the cache.
- */
- static void tegra241_cmdqv_write_vcmdq_page0(Tegra241CMDQV *cmdqv,
- hwaddr offset0, int index,
- uint32_t value, bool direct)
- {
-+ uint32_t *ptr = tegra241_cmdqv_vintf_lvcmdq_ptr(cmdqv, index, offset0);
-+ bool hw = false;
-+
-+ if (ptr) {
-+ switch (offset0) {
-+ case A_VCMDQ0_CONS_INDX:
-+ case A_VCMDQ0_PROD_INDX:
-+ case A_VCMDQ0_CONFIG:
-+ case A_VCMDQ0_GERRORN:
-+ *ptr = value;
-+ hw = true;
-+ goto out;
-+ default:
-+ break;
-+ }
-+ }
-+
- switch (offset0) {
- case A_VCMDQ0_CONS_INDX:
- cmdqv->vcmdq_cons_indx[index] = value;
-@@ -253,7 +340,9 @@ static void tegra241_cmdqv_write_vcmdq_page0(Tegra241CMDQV *cmdqv,
- "%s unhandled write access at 0x%" PRIx64 "\n",
- __func__, offset0);
- }
-+out:
- trace_tegra241_cmdqv_write_vcmdq_page0(index, direct ? "direct" : "vi",
-+ hw ? "hw" : "cache",
- offset0, value);
- }
-
-diff --git a/hw/arm/trace-events b/hw/arm/trace-events
-index 666967dc5e..a8dcbc82db 100644
---- a/hw/arm/trace-events
-+++ b/hw/arm/trace-events
-@@ -75,9 +75,9 @@ smmuv3_accel_install_ste(uint32_t vsid, const char * type, uint32_t hwpt_id) "vS
- # tegra241-cmdqv
- tegra241_cmdqv_read_mmio(uint64_t offset, uint64_t val, unsigned size) "offset: 0x%"PRIx64" val: 0x%"PRIx64" size: 0x%x"
- tegra241_cmdqv_write_mmio(uint64_t offset, uint64_t val, unsigned size) "offset: 0x%"PRIx64" val: 0x%"PRIx64" size: 0x%x"
--tegra241_cmdqv_read_vcmdq_page0(int index, const char *aperture, uint64_t offset0, uint64_t val) "vcmdq[%d] %s offset0: 0x%"PRIx64" val: 0x%"PRIx64
-+tegra241_cmdqv_read_vcmdq_page0(int index, const char *aperture, const char *backing, uint64_t offset0, uint64_t val) "vcmdq[%d] %s (%s) offset0: 0x%"PRIx64" val: 0x%"PRIx64
- tegra241_cmdqv_read_vcmdq_page1(int index, const char *aperture, uint64_t offset0, uint64_t val) "vcmdq[%d] %s offset0: 0x%"PRIx64" val: 0x%"PRIx64
--tegra241_cmdqv_write_vcmdq_page0(int index, const char *aperture, uint64_t offset0, uint64_t val) "vcmdq[%d] %s offset0: 0x%"PRIx64" val: 0x%"PRIx64
-+tegra241_cmdqv_write_vcmdq_page0(int index, const char *aperture, const char *backing, uint64_t offset0, uint64_t val) "vcmdq[%d] %s (%s) offset0: 0x%"PRIx64" val: 0x%"PRIx64
- tegra241_cmdqv_write_vcmdq_page1(int index, const char *aperture, uint64_t offset0, uint64_t val) "vcmdq[%d] %s offset0: 0x%"PRIx64" val: 0x%"PRIx64
-
- # strongarm.c
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-Use-mmap-d-host-VINTF-page0-fo.patch b/kvm-hw-arm-tegra241-cmdqv-Use-mmap-d-host-VINTF-page0-fo.patch
deleted file mode 100644
index 7391b86..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-Use-mmap-d-host-VINTF-page0-fo.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-From 9d5701e0445ac377f61fa219ddf59ec7714dc858 Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:42 +0100
-Subject: [PATCH 100/111] hw/arm/tegra241-cmdqv: Use mmap'd host VINTF page0
- for virtual VINTF page0
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [100/111] 2417c5223a363995121cd311eb7f714572dc5447 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Install the mmap'd host VINTF page0 as a RAM-device MemoryRegion
-backing the guest's virtual VINTF Page 0 aperture (guest MMIO offset
-0x30000) when VINTF is enabled, and remove it on VINTF disable or
-reset. This eliminates QEMU trapping for hot-path CONS/PROD index
-updates via that aperture.
-
-After this patch, the two VCMDQ Page 0 apertures use different
-access paths: the direct aperture (0x10000) remains QEMU-trapped,
-while the VINTF aperture (0x30000) is a guest-direct RAM mapping.
-
-The direct aperture is intentionally kept trapped (not aliased to
-the host VINTF mmap) so that writes to an unallocated VCMDQ remain
-well-defined. The CMDQV architecture allows software to program a
-VCMDQ through the direct aperture without first allocating it to a
-VINTF; aliasing would route those writes to unallocated logical
-slots in the VINTF page, where the hardware silently drops them.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-22-skolothumtho@nvidia.com
-Co-developed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 5965b81ce2835de49ba4eb36c386e72be5ff1ba8)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 37 +++++++++++++++++++++++++++++++++++++
- hw/arm/tegra241-cmdqv.h | 1 +
- 2 files changed, 38 insertions(+)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index 63fe0ac681..7264b4bfa9 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -26,6 +26,40 @@ static void tegra241_cmdqv_reset_vcmdq_cache(Tegra241CMDQV *cmdqv, int index)
- cmdqv->vcmdq_gerrorn[index] = 0;
- }
-
-+static void tegra241_cmdqv_guest_unmap_vintf_page0(Tegra241CMDQV *cmdqv)
-+{
-+ if (!cmdqv->mr_vintf_page0) {
-+ return;
-+ }
-+
-+ memory_region_del_subregion(&cmdqv->mmio_cmdqv, cmdqv->mr_vintf_page0);
-+ object_unparent(OBJECT(cmdqv->mr_vintf_page0));
-+ g_free(cmdqv->mr_vintf_page0);
-+ cmdqv->mr_vintf_page0 = NULL;
-+}
-+
-+static void tegra241_cmdqv_guest_map_vintf_page0(Tegra241CMDQV *cmdqv)
-+{
-+ char *name;
-+
-+ if (cmdqv->mr_vintf_page0) {
-+ return;
-+ }
-+
-+ name = g_strdup_printf("%s vintf-page0",
-+ memory_region_name(&cmdqv->mmio_cmdqv));
-+ cmdqv->mr_vintf_page0 = g_malloc0(sizeof(*cmdqv->mr_vintf_page0));
-+ memory_region_init_ram_device_ptr(cmdqv->mr_vintf_page0,
-+ memory_region_owner(&cmdqv->mmio_cmdqv),
-+ name, VINTF_PAGE_SIZE,
-+ cmdqv->vintf_page0);
-+ memory_region_set_skip_iommu_map(cmdqv->mr_vintf_page0, true);
-+ memory_region_add_subregion_overlap(&cmdqv->mmio_cmdqv,
-+ CMDQV_VINTF_PAGE0_BASE,
-+ cmdqv->mr_vintf_page0, 1);
-+ g_free(name);
-+}
-+
- static void tegra241_cmdqv_free_vcmdq(Tegra241CMDQV *cmdqv, int index)
- {
- IOMMUFDViommu *viommu = cmdqv->s_accel->viommu;
-@@ -430,7 +464,9 @@ static void tegra241_cmdqv_config_vintf_write(Tegra241CMDQV *cmdqv,
- * enabled need their hw_queue allocated now.
- */
- tegra241_cmdqv_setup_all_vcmdq(cmdqv, errp);
-+ tegra241_cmdqv_guest_map_vintf_page0(cmdqv);
- } else {
-+ tegra241_cmdqv_guest_unmap_vintf_page0(cmdqv);
- tegra241_cmdqv_free_all_vcmdq(cmdqv);
- cmdqv->vintf_status &= ~R_VINTF0_STATUS_ENABLE_OK_MASK;
- }
-@@ -772,6 +808,7 @@ static void tegra241_cmdqv_reset(SMMUv3State *s)
- return;
- }
-
-+ tegra241_cmdqv_guest_unmap_vintf_page0(cmdqv);
- tegra241_cmdqv_free_all_vcmdq(cmdqv);
- }
-
-diff --git a/hw/arm/tegra241-cmdqv.h b/hw/arm/tegra241-cmdqv.h
-index c795da0444..0964f68a20 100644
---- a/hw/arm/tegra241-cmdqv.h
-+++ b/hw/arm/tegra241-cmdqv.h
-@@ -49,6 +49,7 @@ typedef struct Tegra241CMDQV {
- IOMMUFDVeventq *veventq;
- IOMMUFDHWqueue *vcmdq[TEGRA241_CMDQV_MAX_CMDQ];
- void *vintf_page0;
-+ MemoryRegion *mr_vintf_page0;
-
- /* CMDQ-V Config page register cache */
- uint32_t config;
---
-2.52.0
-
diff --git a/kvm-hw-arm-tegra241-cmdqv-mmap-host-VINTF-Page0-for-CMDQ.patch b/kvm-hw-arm-tegra241-cmdqv-mmap-host-VINTF-Page0-for-CMDQ.patch
deleted file mode 100644
index 37fd6c4..0000000
--- a/kvm-hw-arm-tegra241-cmdqv-mmap-host-VINTF-Page0-for-CMDQ.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From afe9e82db92db41cb6d87f55410b388667b8e537 Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:35 +0100
-Subject: [PATCH 093/111] hw/arm/tegra241-cmdqv: mmap host VINTF Page0 for
- CMDQV
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [93/111] 049d226826cbec9ff2d6509d46b73b3d70371230 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-The kernel currently exposes a single VINTF per emulated SMMUv3
-instance. IOMMU_VIOMMU_ALLOC returns an mmap offset for the host
-VINTF Page0 allocated for this SMMU. However, VCMDQs only become
-bound to that VINTF after IOMMU_HW_QUEUE_ALLOC, so until then the
-mapped Page0 does not back any real VCMDQ state.
-
-mmap the host VINTF Page0 right after IOMMU_VIOMMU_ALLOC, as the host
-VINTF is already enabled at that point, and unmap it when the vIOMMU is
-freed. The mapping shares the vIOMMU's lifetime. This prepares the VINTF
-mapping in advance of subsequent patches that add VCMDQ allocation.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-15-skolothumtho@nvidia.com
-Co-developed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit ab15bda3ac1380f63c6e7ae1e80f799cff2a262b)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/tegra241-cmdqv.c | 16 +++++++++++++++-
- hw/arm/tegra241-cmdqv.h | 3 +++
- 2 files changed, 18 insertions(+), 1 deletion(-)
-
-diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
-index c1351c8519..3eec6073a4 100644
---- a/hw/arm/tegra241-cmdqv.c
-+++ b/hw/arm/tegra241-cmdqv.c
-@@ -41,6 +41,10 @@ static void tegra241_cmdqv_free_viommu(SMMUv3State *s)
- g_free(veventq);
- cmdqv->veventq = NULL;
- }
-+ if (cmdqv->vintf_page0) {
-+ munmap(cmdqv->vintf_page0, VINTF_PAGE_SIZE);
-+ cmdqv->vintf_page0 = NULL;
-+ }
- iommufd_backend_free_id(viommu->iommufd, viommu->viommu_id);
- }
-
-@@ -60,13 +64,20 @@ tegra241_cmdqv_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- return false;
- }
-
-+ if (!iommufd_backend_viommu_mmap(idev->iommufd, viommu_id, VINTF_PAGE_SIZE,
-+ cmdqv->cmdqv_data->out_vintf_mmap_offset,
-+ &cmdqv->vintf_page0, errp)) {
-+ error_append_hint(errp, "Tegra241 CMDQV: failed to mmap VINTF page0");
-+ goto free_viommu;
-+ }
-+
- if (!iommufd_backend_alloc_veventq(idev->iommufd, viommu_id,
- IOMMU_VEVENTQ_TYPE_TEGRA241_CMDQV,
- 1 << SMMU_EVENTQS, &veventq_id,
- &veventq_fd,
- errp)) {
- error_append_hint(errp, "Tegra241 CMDQV: failed to alloc veventq");
-- goto free_viommu;
-+ goto munmap_page0;
- }
-
- veventq = g_new(IOMMUFDVeventq, 1);
-@@ -77,6 +88,9 @@ tegra241_cmdqv_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- *out_viommu_id = viommu_id;
- return true;
-
-+munmap_page0:
-+ munmap(cmdqv->vintf_page0, VINTF_PAGE_SIZE);
-+ cmdqv->vintf_page0 = NULL;
- free_viommu:
- iommufd_backend_free_id(idev->iommufd, viommu_id);
- return false;
-diff --git a/hw/arm/tegra241-cmdqv.h b/hw/arm/tegra241-cmdqv.h
-index 9fc720e96c..00c83b6186 100644
---- a/hw/arm/tegra241-cmdqv.h
-+++ b/hw/arm/tegra241-cmdqv.h
-@@ -25,6 +25,8 @@
- */
- #define TEGRA241_CMDQV_IO_LEN 0x50000
-
-+#define VINTF_PAGE_SIZE 0x10000
-+
- struct iommu_viommu_tegra241_cmdqv;
-
- typedef struct Tegra241CMDQV {
-@@ -33,6 +35,7 @@ typedef struct Tegra241CMDQV {
- MemoryRegion mmio_cmdqv;
- qemu_irq irq;
- IOMMUFDVeventq *veventq;
-+ void *vintf_page0;
- } Tegra241CMDQV;
-
- const SMMUv3AccelCmdqvOps *tegra241_cmdqv_get_ops(void);
---
-2.52.0
-
diff --git a/kvm-hw-arm-virt-Add-an-SMMU_IO_LEN-macro.patch b/kvm-hw-arm-virt-Add-an-SMMU_IO_LEN-macro.patch
deleted file mode 100644
index f511d7c..0000000
--- a/kvm-hw-arm-virt-Add-an-SMMU_IO_LEN-macro.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From c62e5defde6f02bdd316b772169571d0de5d2d83 Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Fri, 29 Aug 2025 09:25:27 +0100
-Subject: [PATCH 09/16] hw/arm/virt: Add an SMMU_IO_LEN macro
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 423: hw/arm/virt: Add support for user creatable SMMUv3 device
-RH-Jira: RHEL-73800
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Donald Dutile <None>
-RH-Commit: [5/11] 72c82e228bb256db07fbe28728ad47dbd8b04dc3 (eauger1/centos-qemu-kvm)
-
-This is useful as the subsequent support for new SMMUv3 dev will also
-use the same.
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Donald Dutile <ddutile@redhat.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nathan Chen <nathanc@nvidia.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Message-id: 20250829082543.7680-6-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 466197fc7a25658f9187d538c26887f5738d1ac9)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/virt.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index 9b95a7c9a9..b435efafe1 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -186,6 +186,9 @@ static void arm_virt_compat_set(MachineClass *mc)
- #define LEGACY_RAMLIMIT_GB 255
- #define LEGACY_RAMLIMIT_BYTES (LEGACY_RAMLIMIT_GB * GiB)
-
-+/* MMIO region size for SMMUv3 */
-+#define SMMU_IO_LEN 0x20000
-+
- /* Addresses and sizes of our components.
- * 0..128MB is space for a flash device so we can run bootrom code such as UEFI.
- * 128MB..256MB is used for miscellaneous device I/O.
-@@ -217,7 +220,7 @@ static const MemMapEntry base_memmap[] = {
- [VIRT_FW_CFG] = { 0x09020000, 0x00000018 },
- [VIRT_GPIO] = { 0x09030000, 0x00001000 },
- [VIRT_UART1] = { 0x09040000, 0x00001000 },
-- [VIRT_SMMU] = { 0x09050000, 0x00020000 },
-+ [VIRT_SMMU] = { 0x09050000, SMMU_IO_LEN },
- [VIRT_PCDIMM_ACPI] = { 0x09070000, MEMORY_HOTPLUG_IO_LEN },
- [VIRT_ACPI_GED] = { 0x09080000, ACPI_GED_EVT_SEL_LEN },
- [VIRT_NVDIMM_ACPI] = { 0x09090000, NVDIMM_ACPI_IO_LEN},
---
-2.47.3
-
diff --git a/kvm-hw-arm-virt-Allow-user-creatable-SMMUv3-dev-instanti.patch b/kvm-hw-arm-virt-Allow-user-creatable-SMMUv3-dev-instanti.patch
deleted file mode 100644
index 41e280e..0000000
--- a/kvm-hw-arm-virt-Allow-user-creatable-SMMUv3-dev-instanti.patch
+++ /dev/null
@@ -1,215 +0,0 @@
-From 20b24c8ae68ff5059392188762c8d8b24c3dfa28 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 29 Aug 2025 09:25:29 +0100
-Subject: [PATCH 11/16] hw/arm/virt: Allow user-creatable SMMUv3 dev
- instantiation
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 423: hw/arm/virt: Add support for user creatable SMMUv3 device
-RH-Jira: RHEL-73800
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Donald Dutile <None>
-RH-Commit: [7/11] 8f4a03c34d5c699023b3916f4919caf669f7a87c (eauger1/centos-qemu-kvm)
-
-Allow cold-plugging of an SMMUv3 device on the virt machine when no
-global (legacy) SMMUv3 is present or when a virtio-iommu is specified.
-
-This user-created SMMUv3 device is tied to a specific PCI bus provided
-by the user, so ensure the IOMMU ops are configured accordingly.
-
-Due to current limitations in QEMU’s device tree support, specifically
-its inability to properly present pxb-pcie based root complexes and
-their devices, the device tree support for the new SMMUv3 device is
-limited to cases where it is attached to the default pcie.0 root complex.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nathan Chen <nathanc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Donald Dutile <ddutile@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Message-id: 20250829082543.7680-8-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 66d2f665e163cf1afccd171e3c16f8d3acb3d94a)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmu-common.c | 8 +++++-
- hw/arm/smmuv3.c | 2 ++
- hw/arm/virt.c | 51 ++++++++++++++++++++++++++++++++++++
- hw/core/sysbus-fdt.c | 3 +++
- include/hw/arm/smmu-common.h | 1 +
- 5 files changed, 64 insertions(+), 1 deletion(-)
-
-diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
-index 7f64ea48d0..62a7612184 100644
---- a/hw/arm/smmu-common.c
-+++ b/hw/arm/smmu-common.c
-@@ -961,7 +961,12 @@ static void smmu_base_realize(DeviceState *dev, Error **errp)
- goto out_err;
- }
- }
-- pci_setup_iommu(pci_bus, &smmu_ops, s);
-+
-+ if (s->smmu_per_bus) {
-+ pci_setup_iommu_per_bus(pci_bus, &smmu_ops, s);
-+ } else {
-+ pci_setup_iommu(pci_bus, &smmu_ops, s);
-+ }
- return;
- }
- out_err:
-@@ -986,6 +991,7 @@ static void smmu_base_reset_exit(Object *obj, ResetType type)
-
- static const Property smmu_dev_properties[] = {
- DEFINE_PROP_UINT8("bus_num", SMMUState, bus_num, 0),
-+ DEFINE_PROP_BOOL("smmu_per_bus", SMMUState, smmu_per_bus, false),
- DEFINE_PROP_LINK("primary-bus", SMMUState, primary_bus,
- TYPE_PCI_BUS, PCIBus *),
- };
-diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
-index ab67972353..bcf8af8dc7 100644
---- a/hw/arm/smmuv3.c
-+++ b/hw/arm/smmuv3.c
-@@ -1996,6 +1996,8 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
- device_class_set_parent_realize(dc, smmu_realize,
- &c->parent_realize);
- device_class_set_props(dc, smmuv3_properties);
-+ dc->hotpluggable = false;
-+ dc->user_creatable = true;
- }
-
- static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index b435efafe1..e8e64fe7fe 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -56,6 +56,7 @@
- #include "qemu/cutils.h"
- #include "qemu/error-report.h"
- #include "qemu/module.h"
-+#include "hw/pci/pci_bus.h"
- #include "hw/pci-host/gpex.h"
- #include "hw/pci-bridge/pci_expander_bridge.h"
- #include "hw/virtio/virtio-pci.h"
-@@ -1510,6 +1511,29 @@ static void create_smmuv3_dt_bindings(const VirtMachineState *vms, hwaddr base,
- g_free(node);
- }
-
-+static void create_smmuv3_dev_dtb(VirtMachineState *vms,
-+ DeviceState *dev, PCIBus *bus)
-+{
-+ PlatformBusDevice *pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
-+ SysBusDevice *sbdev = SYS_BUS_DEVICE(dev);
-+ int irq = platform_bus_get_irqn(pbus, sbdev, 0);
-+ hwaddr base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
-+ MachineState *ms = MACHINE(vms);
-+
-+ if (!(vms->bootinfo.firmware_loaded && virt_is_acpi_enabled(vms)) &&
-+ strcmp("pcie.0", bus->qbus.name)) {
-+ warn_report("SMMUv3 device only supported with pcie.0 for DT");
-+ return;
-+ }
-+ base += vms->memmap[VIRT_PLATFORM_BUS].base;
-+ irq += vms->irqmap[VIRT_PLATFORM_BUS];
-+
-+ vms->iommu_phandle = qemu_fdt_alloc_phandle(ms->fdt);
-+ create_smmuv3_dt_bindings(vms, base, SMMU_IO_LEN, irq);
-+ qemu_fdt_setprop_cells(ms->fdt, vms->pciehb_nodename, "iommu-map",
-+ 0x0, vms->iommu_phandle, 0x0, 0x10000);
-+}
-+
- static void create_smmu(const VirtMachineState *vms,
- PCIBus *bus)
- {
-@@ -3057,6 +3081,16 @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
- qlist_append_str(reserved_regions, resv_prop_str);
- qdev_prop_set_array(dev, "reserved-regions", reserved_regions);
- g_free(resv_prop_str);
-+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_ARM_SMMUV3)) {
-+ if (vms->legacy_smmuv3_present || vms->iommu == VIRT_IOMMU_VIRTIO) {
-+ error_setg(errp, "virt machine already has %s set. "
-+ "Doesn't support incompatible iommus",
-+ (vms->legacy_smmuv3_present) ?
-+ "iommu=smmuv3" : "virtio-iommu");
-+ } else if (vms->iommu == VIRT_IOMMU_NONE) {
-+ /* The new SMMUv3 device is specific to the PCI bus */
-+ object_property_set_bool(OBJECT(dev), "smmu_per_bus", true, NULL);
-+ }
- }
- }
-
-@@ -3080,6 +3114,22 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,
- virtio_md_pci_plug(VIRTIO_MD_PCI(dev), MACHINE(hotplug_dev), errp);
- }
-
-+ if (object_dynamic_cast(OBJECT(dev), TYPE_ARM_SMMUV3)) {
-+ if (!vms->legacy_smmuv3_present && vms->platform_bus_dev) {
-+ PCIBus *bus;
-+
-+ bus = PCI_BUS(object_property_get_link(OBJECT(dev), "primary-bus",
-+ &error_abort));
-+ if (pci_bus_bypass_iommu(bus)) {
-+ error_setg(errp, "Bypass option cannot be set for SMMUv3 "
-+ "associated PCIe RC");
-+ return;
-+ }
-+
-+ create_smmuv3_dev_dtb(vms, dev, bus);
-+ }
-+ }
-+
- if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
- PCIDevice *pdev = PCI_DEVICE(dev);
-
-@@ -3286,6 +3336,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
- #endif
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_UEFI_VARS_SYSBUS);
-+ machine_class_allow_dynamic_sysbus_dev(mc, TYPE_ARM_SMMUV3);
- #ifdef CONFIG_TPM
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
- #endif
-diff --git a/hw/core/sysbus-fdt.c b/hw/core/sysbus-fdt.c
-index 1e1966813f..673e083d31 100644
---- a/hw/core/sysbus-fdt.c
-+++ b/hw/core/sysbus-fdt.c
-@@ -31,6 +31,7 @@
- #include "qemu/error-report.h"
- #include "system/device_tree.h"
- #include "system/tpm.h"
-+#include "hw/arm/smmuv3.h"
- #include "hw/platform-bus.h"
- #include "hw/vfio/vfio-platform.h"
- #include "hw/vfio/vfio-calxeda-xgmac.h"
-@@ -518,6 +519,8 @@ static const BindingEntry bindings[] = {
- #ifdef CONFIG_TPM
- TYPE_BINDING(TYPE_TPM_TIS_SYSBUS, add_tpm_tis_fdt_node),
- #endif
-+ /* No generic DT support for smmuv3 dev. Support added for arm virt only */
-+ TYPE_BINDING(TYPE_ARM_SMMUV3, no_fdt_node),
- TYPE_BINDING(TYPE_RAMFB_DEVICE, no_fdt_node),
- TYPE_BINDING(TYPE_UEFI_VARS_SYSBUS, add_uefi_vars_node),
- TYPE_BINDING("", NULL), /* last element */
-diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
-index e5e2d09294..80d0fecfde 100644
---- a/include/hw/arm/smmu-common.h
-+++ b/include/hw/arm/smmu-common.h
-@@ -161,6 +161,7 @@ struct SMMUState {
- QLIST_HEAD(, SMMUDevice) devices_with_notifiers;
- uint8_t bus_num;
- PCIBus *primary_bus;
-+ bool smmu_per_bus; /* SMMU is specific to the primary_bus */
- };
-
- struct SMMUBaseClass {
---
-2.47.3
-
diff --git a/kvm-hw-arm-virt-Factor-out-common-SMMUV3-dt-bindings-cod.patch b/kvm-hw-arm-virt-Factor-out-common-SMMUV3-dt-bindings-cod.patch
deleted file mode 100644
index 5935080..0000000
--- a/kvm-hw-arm-virt-Factor-out-common-SMMUV3-dt-bindings-cod.patch
+++ /dev/null
@@ -1,118 +0,0 @@
-From 1b3c413355ee5f3917e8e39dbf7a281f8e31a0f5 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 29 Aug 2025 09:25:26 +0100
-Subject: [PATCH 08/16] hw/arm/virt: Factor out common SMMUV3 dt bindings code
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 423: hw/arm/virt: Add support for user creatable SMMUv3 device
-RH-Jira: RHEL-73800
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Donald Dutile <None>
-RH-Commit: [4/11] db5d2a44f4cd1583c839b93ae551a2ddbd68b83b (eauger1/centos-qemu-kvm)
-
-No functional changes intended. This will be useful when we
-add support for user-creatable smmuv3 device.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nathan Chen <nathanc@nvidia.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Donald Dutile <ddutile@redhat.com>
-Message-id: 20250829082543.7680-5-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 7a276b7570266ec39611f9d91089741ec7e9295b)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/virt.c | 54 +++++++++++++++++++++++++++------------------------
- 1 file changed, 29 insertions(+), 25 deletions(-)
-
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index 0cc9e5f068..9b95a7c9a9 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -1479,19 +1479,43 @@ static void create_pcie_irq_map(const MachineState *ms,
- 0x7 /* PCI irq */);
- }
-
-+static void create_smmuv3_dt_bindings(const VirtMachineState *vms, hwaddr base,
-+ hwaddr size, int irq)
-+{
-+ char *node;
-+ const char compat[] = "arm,smmu-v3";
-+ const char irq_names[] = "eventq\0priq\0cmdq-sync\0gerror";
-+ MachineState *ms = MACHINE(vms);
-+
-+ node = g_strdup_printf("/smmuv3@%" PRIx64, base);
-+ qemu_fdt_add_subnode(ms->fdt, node);
-+ qemu_fdt_setprop(ms->fdt, node, "compatible", compat, sizeof(compat));
-+ qemu_fdt_setprop_sized_cells(ms->fdt, node, "reg", 2, base, 2, size);
-+
-+ qemu_fdt_setprop_cells(ms->fdt, node, "interrupts",
-+ GIC_FDT_IRQ_TYPE_SPI, irq , GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
-+ GIC_FDT_IRQ_TYPE_SPI, irq + 1, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
-+ GIC_FDT_IRQ_TYPE_SPI, irq + 2, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
-+ GIC_FDT_IRQ_TYPE_SPI, irq + 3, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI);
-+
-+ qemu_fdt_setprop(ms->fdt, node, "interrupt-names", irq_names,
-+ sizeof(irq_names));
-+
-+ qemu_fdt_setprop(ms->fdt, node, "dma-coherent", NULL, 0);
-+ qemu_fdt_setprop_cell(ms->fdt, node, "#iommu-cells", 1);
-+ qemu_fdt_setprop_cell(ms->fdt, node, "phandle", vms->iommu_phandle);
-+ g_free(node);
-+}
-+
- static void create_smmu(const VirtMachineState *vms,
- PCIBus *bus)
- {
- VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
-- char *node;
-- const char compat[] = "arm,smmu-v3";
- int irq = vms->irqmap[VIRT_SMMU];
- int i;
- hwaddr base = vms->memmap[VIRT_SMMU].base;
- hwaddr size = vms->memmap[VIRT_SMMU].size;
-- const char irq_names[] = "eventq\0priq\0cmdq-sync\0gerror";
- DeviceState *dev;
-- MachineState *ms = MACHINE(vms);
-
- if (vms->iommu != VIRT_IOMMU_SMMUV3 || !vms->iommu_phandle) {
- return;
-@@ -1510,27 +1534,7 @@ static void create_smmu(const VirtMachineState *vms,
- sysbus_connect_irq(SYS_BUS_DEVICE(dev), i,
- qdev_get_gpio_in(vms->gic, irq + i));
- }
--
-- node = g_strdup_printf("/smmuv3@%" PRIx64, base);
-- qemu_fdt_add_subnode(ms->fdt, node);
-- qemu_fdt_setprop(ms->fdt, node, "compatible", compat, sizeof(compat));
-- qemu_fdt_setprop_sized_cells(ms->fdt, node, "reg", 2, base, 2, size);
--
-- qemu_fdt_setprop_cells(ms->fdt, node, "interrupts",
-- GIC_FDT_IRQ_TYPE_SPI, irq , GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
-- GIC_FDT_IRQ_TYPE_SPI, irq + 1, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
-- GIC_FDT_IRQ_TYPE_SPI, irq + 2, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
-- GIC_FDT_IRQ_TYPE_SPI, irq + 3, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI);
--
-- qemu_fdt_setprop(ms->fdt, node, "interrupt-names", irq_names,
-- sizeof(irq_names));
--
-- qemu_fdt_setprop(ms->fdt, node, "dma-coherent", NULL, 0);
--
-- qemu_fdt_setprop_cell(ms->fdt, node, "#iommu-cells", 1);
--
-- qemu_fdt_setprop_cell(ms->fdt, node, "phandle", vms->iommu_phandle);
-- g_free(node);
-+ create_smmuv3_dt_bindings(vms, base, size, irq);
- }
-
- static void create_virtio_iommu_dt_bindings(VirtMachineState *vms)
---
-2.47.3
-
diff --git a/kvm-hw-arm-virt-Include-system-system.h.patch b/kvm-hw-arm-virt-Include-system-system.h.patch
deleted file mode 100644
index ba7c518..0000000
--- a/kvm-hw-arm-virt-Include-system-system.h.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 03d37e65c55a45d57410e3494681c79a43762adc Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
-Date: Mon, 1 Sep 2025 08:46:24 +0200
-Subject: [PATCH 022/116] hw/arm/virt: Include 'system/system.h'
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [6/100] 17d12a26fb83432d261f644ff9583bdd4224fee3 (rovick1/qemu-kvm)
-
-hw/arm/virt.c should include 'system/system.h' for :
-
- serial_hd()
- qemu_add_machine_init_done_notifier()
-
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Link: https://lore.kernel.org/qemu-devel/20250731144019.1403591-1-clg@redhat.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-Message-ID: <20250901064631.530723-2-clg@redhat.com>
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-(cherry picked from commit 319ca84949fc3134774342d50790592680c3b9b0)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/virt.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index 2a399e468c..990d2c73c7 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -49,6 +49,7 @@
- #include "system/kvm.h"
- #include "system/hvf.h"
- #include "system/qtest.h"
-+#include "system/system.h"
- #include "hw/loader.h"
- #include "qapi/error.h"
- #include "qemu/bitops.h"
---
-2.52.0
-
diff --git a/kvm-hw-arm-virt-Link-SMMUv3-CMDQV-resources-to-platform-.patch b/kvm-hw-arm-virt-Link-SMMUv3-CMDQV-resources-to-platform-.patch
deleted file mode 100644
index f541f39..0000000
--- a/kvm-hw-arm-virt-Link-SMMUv3-CMDQV-resources-to-platform-.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From 9de83551465e408908b9999a70709041c417a120 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:33 +0100
-Subject: [PATCH 091/111] hw/arm/virt: Link SMMUv3 CMDQV resources to platform
- bus
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [91/111] dad452aedd8dc1227e783e058fd1b58806f5f5e6 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-SMMUv3 devices with acceleration may enable CMDQV extensions
-after device realize. In that case, additional MMIO regions and
-IRQ lines may be registered but not yet mapped to the platform bus.
-
-Ensure SMMUv3 device resources are linked to the platform bus
-during machine_done().
-
-This is safe to do unconditionally since the platform bus helpers
-skip resources that are already mapped.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-13-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit dc5726da05a4595338de0e9c3947beaf2e766552)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/virt.c | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index 5169b4ba5b..ca150d455c 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -1853,6 +1853,25 @@ static void virt_build_smbios(VirtMachineState *vms)
- }
- }
-
-+/*
-+ * SMMUv3 devices with acceleration may enable CMDQV extensions
-+ * after device realize. In that case, additional MMIO regions and
-+ * IRQ lines may be registered but not yet mapped to the platform bus.
-+ *
-+ * Ensure all resources are linked to the platform bus before final
-+ * machine setup.
-+ */
-+
-+static void virt_smmuv3_dev_link_cmdqv(VirtMachineState *vms)
-+{
-+ for (int i = 0; i < vms->smmuv3_devices->len; i++) {
-+ DeviceState *dev = g_ptr_array_index(vms->smmuv3_devices, i);
-+
-+ platform_bus_link_device(PLATFORM_BUS_DEVICE(vms->platform_bus_dev),
-+ SYS_BUS_DEVICE(dev));
-+ }
-+}
-+
- static
- void virt_machine_done(Notifier *notifier, void *data)
- {
-@@ -1869,6 +1888,9 @@ void virt_machine_done(Notifier *notifier, void *data)
- if (vms->cxl_devices_state.is_enabled) {
- cxl_fmws_link_targets(&error_fatal);
- }
-+
-+ virt_smmuv3_dev_link_cmdqv(vms);
-+
- /*
- * If the user provided a dtb, we assume the dynamic sysbus nodes
- * already are integrated there. This corresponds to a use case where
---
-2.52.0
-
diff --git a/kvm-hw-arm-virt-Set-PCI-preserve_config-for-accel-SMMUv3.patch b/kvm-hw-arm-virt-Set-PCI-preserve_config-for-accel-SMMUv3.patch
deleted file mode 100644
index 86fd855..0000000
--- a/kvm-hw-arm-virt-Set-PCI-preserve_config-for-accel-SMMUv3.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From d614dc06f252e256ce36a88494a77fc1622ca312 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 031/111] hw/arm/virt: Set PCI preserve_config for accel SMMUv3
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [31/111] 02e02c742a5492d4a0e4d0c6e29d94bf39d16210 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Introduce a new pci_preserve_config field in virt machine state which
-allows the generation of DSM #5. This field is only set if accel SMMU
-is instantiated.
-
-In a subsequent patch, SMMUv3 accel mode will make use of IORT RMR nodes
-to enable nested translation of MSI doorbell addresses. IORT RMR requires
-_DSM #5 to be set for the PCI host bridge so that the Guest kernel
-preserves the PCI boot configuration.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-24-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 45c57eaefd4c7a67c93e77d6f4436c8569aefbb9)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/virt-acpi-build.c | 8 ++++++++
- hw/arm/virt.c | 1 +
- include/hw/arm/virt.h | 1 +
- 3 files changed, 10 insertions(+)
-
-diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
-index 5a642abac6..6883147040 100644
---- a/hw/arm/virt-acpi-build.c
-+++ b/hw/arm/virt-acpi-build.c
-@@ -163,6 +163,14 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,
- .pci_native_hotplug = !acpi_pcihp,
- };
-
-+ /*
-+ * Accel SMMU requires RMRs for MSI 1-1 mapping, which require _DSM
-+ * function 5 (_DSM for Preserving PCI Boot Configurations).
-+ */
-+ if (vms->pci_preserve_config) {
-+ cfg.preserve_config = true;
-+ }
-+
- if (vms->highmem_mmio) {
- cfg.mmio64 = memmap[VIRT_HIGH_PCIE_MMIO];
- }
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index b9765d4248..672b8d912c 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -3111,6 +3111,7 @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
- }
- object_property_set_uint(OBJECT(dev), "msi-gpa", db_start,
- &error_abort);
-+ vms->pci_preserve_config = true;
- }
- }
- }
-diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
-index 8d90b66b87..b6d696e8ce 100644
---- a/include/hw/arm/virt.h
-+++ b/include/hw/arm/virt.h
-@@ -183,6 +183,7 @@ struct VirtMachineState {
- bool legacy_smmuv3_present;
- MemoryRegion *sysmem;
- MemoryRegion *secure_sysmem;
-+ bool pci_preserve_config;
- };
-
- #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)
---
-2.52.0
-
diff --git a/kvm-hw-arm-virt-Set-msi-gpa-property.patch b/kvm-hw-arm-virt-Set-msi-gpa-property.patch
deleted file mode 100644
index 6561cf5..0000000
--- a/kvm-hw-arm-virt-Set-msi-gpa-property.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 6eaf5c560a39669ec7f43a3714549b14a164c72b Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 026/111] hw/arm/virt: Set msi-gpa property
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [26/111] 8089fb878db15fbb5929e15fb2210b1ec2ccb9c0 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Set the MSI doorbell GPA property for accelerated SMMUv3 devices for use
-by KVM MSI setup. Also, since any meaningful use of vfio-pci devices with
-an accelerated SMMUv3 requires both KVM and a kernel irqchip, ensure
-those are specified when accel=on is selected.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-19-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 5ec2700dcbf72c6bbeb00322e5258f999071d9d5)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/virt.c | 20 ++++++++++++++++++++
- 1 file changed, 20 insertions(+)
-
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index e3e0233474..b9765d4248 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -3092,6 +3092,26 @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
- object_property_set_link(OBJECT(dev), "secure-memory",
- OBJECT(vms->secure_sysmem), NULL);
- }
-+ if (object_property_find(OBJECT(dev), "accel") &&
-+ object_property_get_bool(OBJECT(dev), "accel", &error_abort)) {
-+ hwaddr db_start = 0;
-+
-+ if (!kvm_enabled() || !kvm_irqchip_in_kernel()) {
-+ error_setg(errp, "SMMUv3 accel=on requires KVM with "
-+ "kernel-irqchip=on support");
-+ return;
-+ }
-+
-+ if (vms->msi_controller == VIRT_MSI_CTRL_ITS) {
-+ /* GITS_TRANSLATER page + offset */
-+ db_start = base_memmap[VIRT_GIC_ITS].base + 0x10000 + 0x40;
-+ } else if (vms->msi_controller == VIRT_MSI_CTRL_GICV2M) {
-+ /* MSI_SETSPI_NS page + offset */
-+ db_start = base_memmap[VIRT_GIC_V2M].base + 0x40;
-+ }
-+ object_property_set_uint(OBJECT(dev), "msi-gpa", db_start,
-+ &error_abort);
-+ }
- }
- }
-
---
-2.52.0
-
diff --git a/kvm-hw-arm-virt-Use-ACPI-PCI-hotplug-by-default-from-10..patch b/kvm-hw-arm-virt-Use-ACPI-PCI-hotplug-by-default-from-10..patch
deleted file mode 100644
index a30d175..0000000
--- a/kvm-hw-arm-virt-Use-ACPI-PCI-hotplug-by-default-from-10..patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From 5264d9ea8c029dab0663a3da82f4d8241ad0f1b9 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Fri, 7 Nov 2025 05:23:16 -0500
-Subject: [PATCH 04/16] hw/arm/virt: Use ACPI PCI hotplug by default from 10.2
- onwards
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 422: hw/arm/virt: Use ACPI PCI hotplug by default from 10.2 onwards
-RH-Jira: RHEL-67323
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
-RH-Commit: [1/1] 4539ba6526fef80adb9893a643eb001449397447 (eauger1/centos-qemu-kvm)
-
-UPSTREAM: RHEL-only
-
-Use ACPI PCI hotplug by default from 10.2 onwards. For older
-rhel10 machine types and all rhel9 machine types ACPI PCI hotplug
-is kept disabled.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/virt.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index dcdd53043e..542d702513 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -94,9 +94,15 @@
-
- static GlobalProperty arm_virt_compat[] = {
- { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "48" },
-+ { TYPE_ACPI_GED, "acpi-pci-hotplug-with-bridge-support", "on" },
- };
- static const size_t arm_virt_compat_len = G_N_ELEMENTS(arm_virt_compat);
-
-+GlobalProperty arm_acpi_pci_hp_disabled_compat[] = {
-+ { TYPE_ACPI_GED, "acpi-pci-hotplug-with-bridge-support", "off" },
-+};
-+static const size_t arm_acpi_pci_hp_disabled_compat_len = G_N_ELEMENTS(arm_virt_compat);
-+
- /*
- * RHEL9 kernels have pauth disabled while RHEL10 has it enabled,
- * since qemu will setup the VM with pauth when KVM supports it we
-@@ -104,6 +110,7 @@ static const size_t arm_virt_compat_len = G_N_ELEMENTS(arm_virt_compat);
- */
- GlobalProperty arm_rhel9_compat[] = {
- {TYPE_ARM_CPU, "pauth", "off", .optional = true},
-+ {TYPE_ACPI_GED, "acpi-pci-hotplug-with-bridge-support", "off" },
- };
- const size_t arm_rhel9_compat_len = G_N_ELEMENTS(arm_rhel9_compat);
-
-@@ -3701,6 +3708,8 @@ static void virt_rhel_machine_10_0_0_options(MachineClass *mc)
-
- /* QEMU 9.1 and earlier have only a stage-1 SMMU, not a nested s1+2 one */
- vmc->no_nested_smmu = true;
-+ compat_props_add(mc->compat_props, arm_acpi_pci_hp_disabled_compat,
-+ arm_acpi_pci_hp_disabled_compat_len);
- compat_props_add(mc->compat_props, hw_compat_rhel_10_2, hw_compat_rhel_10_2_len);
- compat_props_add(mc->compat_props, hw_compat_rhel_10_1, hw_compat_rhel_10_1_len);
- }
---
-2.47.3
-
diff --git a/kvm-hw-arm-virt-Use-stored-SMMUv3-device-list-for-IORT-b.patch b/kvm-hw-arm-virt-Use-stored-SMMUv3-device-list-for-IORT-b.patch
deleted file mode 100644
index 481fb2c..0000000
--- a/kvm-hw-arm-virt-Use-stored-SMMUv3-device-list-for-IORT-b.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-From 20f7137990c3b537c92774b18ebcb98ae497cdf7 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:30 +0100
-Subject: [PATCH 088/111] hw/arm/virt: Use stored SMMUv3 device list for IORT
- build
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [88/111] 901595fab4bc977b43954b0563e95dc3bf505d6f (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Introduce a GPtrArray in VirtMachineState to track all SMMUv3 devices
-created on the virt machine, and use it when building the IORT table
-instead of relying on object_child_foreach_recursive() walks of the
-object tree.
-
-This avoids recursive object traversal and provides a foundation for
-subsequent patches that need direct access to SMMUv3 instances for
-CMDQV-related handling.
-
-No functional change. No bios-tables qtest failures observed.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-10-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 92e340997f861cc7289da76336d40f65a4a58318)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/virt-acpi-build.c | 70 ++++++++++++++++++----------------------
- hw/arm/virt.c | 3 ++
- include/hw/arm/virt.h | 1 +
- 3 files changed, 35 insertions(+), 39 deletions(-)
-
-diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
-index b923e965da..597d51199c 100644
---- a/hw/arm/virt-acpi-build.c
-+++ b/hw/arm/virt-acpi-build.c
-@@ -391,49 +391,41 @@ static int smmuv3_dev_idmap_compare(gconstpointer a, gconstpointer b)
- return map_a->input_base - map_b->input_base;
- }
-
--static int iort_smmuv3_devices(Object *obj, void *opaque)
--{
-- VirtMachineState *vms = VIRT_MACHINE(qdev_get_machine());
-- AcpiIortSMMUv3Dev sdev = {0};
-- GArray *sdev_blob = opaque;
-- AcpiIortIdMapping idmap;
-- PlatformBusDevice *pbus;
-- int min_bus, max_bus;
-- SysBusDevice *sbdev;
-- PCIBus *bus;
--
-- if (!object_dynamic_cast(obj, TYPE_ARM_SMMUV3)) {
-- return 0;
-- }
--
-- bus = PCI_BUS(object_property_get_link(obj, "primary-bus", &error_abort));
-- sdev.accel = object_property_get_bool(obj, "accel", &error_abort);
-- sdev.ats = smmuv3_ats_enabled(ARM_SMMUV3(obj));
-- pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
-- sbdev = SYS_BUS_DEVICE(obj);
-- sdev.base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
-- sdev.base += vms->memmap[VIRT_PLATFORM_BUS].base;
-- sdev.irq = platform_bus_get_irqn(pbus, sbdev, 0);
-- sdev.irq += vms->irqmap[VIRT_PLATFORM_BUS];
-- sdev.irq += ARM_SPI_BASE;
--
-- pci_bus_range(bus, &min_bus, &max_bus);
-- sdev.rc_smmu_idmaps = g_array_new(false, true, sizeof(AcpiIortIdMapping));
-- idmap.input_base = min_bus << 8,
-- idmap.id_count = (max_bus - min_bus + 1) << 8,
-- g_array_append_val(sdev.rc_smmu_idmaps, idmap);
-- g_array_append_val(sdev_blob, sdev);
-- return 0;
--}
--
- /*
- * Populate the struct AcpiIortSMMUv3Dev for all SMMUv3 devices and
- * return the total number of idmaps.
- */
--static int populate_smmuv3_dev(GArray *sdev_blob)
-+static int populate_smmuv3_dev(VirtMachineState *vms, GArray *sdev_blob)
- {
-- object_child_foreach_recursive(object_get_root(),
-- iort_smmuv3_devices, sdev_blob);
-+ for (int i = 0; i < vms->smmuv3_devices->len; i++) {
-+ Object *obj = OBJECT(g_ptr_array_index(vms->smmuv3_devices, i));
-+ AcpiIortSMMUv3Dev sdev = {0};
-+ AcpiIortIdMapping idmap;
-+ PlatformBusDevice *pbus;
-+ int min_bus, max_bus;
-+ SysBusDevice *sbdev;
-+ PCIBus *bus;
-+
-+ bus = PCI_BUS(object_property_get_link(obj, "primary-bus",
-+ &error_abort));
-+ sdev.accel = object_property_get_bool(obj, "accel", &error_abort);
-+ sdev.ats = smmuv3_ats_enabled(ARM_SMMUV3(obj));
-+ pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
-+ sbdev = SYS_BUS_DEVICE(obj);
-+ sdev.base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
-+ sdev.base += vms->memmap[VIRT_PLATFORM_BUS].base;
-+ sdev.irq = platform_bus_get_irqn(pbus, sbdev, 0);
-+ sdev.irq += vms->irqmap[VIRT_PLATFORM_BUS];
-+ sdev.irq += ARM_SPI_BASE;
-+
-+ pci_bus_range(bus, &min_bus, &max_bus);
-+ sdev.rc_smmu_idmaps = g_array_new(false, true,
-+ sizeof(AcpiIortIdMapping));
-+ idmap.input_base = min_bus << 8;
-+ idmap.id_count = (max_bus - min_bus + 1) << 8;
-+ g_array_append_val(sdev.rc_smmu_idmaps, idmap);
-+ g_array_append_val(sdev_blob, sdev);
-+ }
- /* Sort the smmuv3 devices(if any) by smmu idmap input_base */
- g_array_sort(sdev_blob, smmuv3_dev_idmap_compare);
- /*
-@@ -567,7 +559,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- if (vms->legacy_smmuv3_present) {
- rc_smmu_idmaps_len = populate_smmuv3_legacy_dev(smmuv3_devs);
- } else {
-- rc_smmu_idmaps_len = populate_smmuv3_dev(smmuv3_devs);
-+ rc_smmu_idmaps_len = populate_smmuv3_dev(vms, smmuv3_devs);
- }
-
- num_smmus = smmuv3_devs->len;
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index 5486af4456..5169b4ba5b 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -3153,6 +3153,7 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,
- }
-
- create_smmuv3_dev_dtb(vms, dev, bus, errp);
-+ g_ptr_array_add(vms->smmuv3_devices, dev);
- }
- }
-
-@@ -3575,6 +3576,8 @@ static void virt_instance_init(Object *obj)
- vms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
- vms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
- cxl_machine_init(obj, &vms->cxl_devices_state);
-+
-+ vms->smmuv3_devices = g_ptr_array_new_with_free_func(NULL);
- }
-
- static const TypeInfo virt_machine_info = {
-diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
-index b6d696e8ce..58a9db9723 100644
---- a/include/hw/arm/virt.h
-+++ b/include/hw/arm/virt.h
-@@ -184,6 +184,7 @@ struct VirtMachineState {
- MemoryRegion *sysmem;
- MemoryRegion *secure_sysmem;
- bool pci_preserve_config;
-+ GPtrArray *smmuv3_devices;
- };
-
- #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)
---
-2.52.0
-
diff --git a/kvm-hw-arm-virt-acpi-Advertise-Tegra241-CMDQV-nodes-in-D.patch b/kvm-hw-arm-virt-acpi-Advertise-Tegra241-CMDQV-nodes-in-D.patch
deleted file mode 100644
index 2ce01e5..0000000
--- a/kvm-hw-arm-virt-acpi-Advertise-Tegra241-CMDQV-nodes-in-D.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-From e20c2fceac0cad9a6f509d9087e2fa965cc1489d Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:49 +0100
-Subject: [PATCH 107/111] hw/arm/virt-acpi: Advertise Tegra241 CMDQV nodes in
- DSDT
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [107/111] bae67aefac140c1e405d35e4b6a02560cc40f671 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Add ACPI DSDT support for Tegra241 CMDQV when the SMMUv3 instance is
-created with tegra241-cmdqv.
-
-For each accelerated SMMUv3 instance, add a Tegra241 CMDQV device
-object under the DSDT \_SB namespace, with HID "NVDA200C" and a UID
-that matches the Identifier of the corresponding SMMUv3 IORT node, so
-the guest OS can associate the DSDT device with the right SMMU. The
-_CRS covers the CMDQV MMIO aperture plus its interrupt, and _CCA
-declares I/O cache coherency.
-
-See ACPI Specification 6.5, Section 6 (Device Configuration) for
-_HID/_UID/_CCA/_CRS.
-
-Generated DSDT entry for a CMDQV instance paired with SMMUv3 Identifier=1:
- ...
- Device (CV01)
- {
- Name (_HID, "NVDA200C") // _HID: Hardware ID
- Name (_UID, One) // _UID: Unique ID
- Name (_CCA, One) // _CCA: Cache Coherency Attribute
- Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
- {
- QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
- 0x0000000000000000, // Granularity
- 0x000000000C080000, // Range Minimum
- 0x000000000C0CFFFF, // Range Maximum
- 0x0000000000000000, // Translation Offset
- 0x0000000000050000, // Length
- ,, , AddressRangeMemory, TypeStatic)
- Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )
- {
- 0x00000094,
- }
- })
- }
- ...
-Generated IORT SMMUv3 node (Identifier = 1):
-
- ...
- [048h 0072 001h] Type : 04
- [049h 0073 002h] Length : 0058
- [04Bh 0075 001h] Revision : 04
- [04Ch 0076 004h] Identifier : 00000001
- [050h 0080 004h] Mapping Count : 00000001
- [054h 0084 004h] Mapping Offset : 00000044
- ...
-
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260609112552.378999-29-skolothumtho@nvidia.com
-Co-developed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 67dc6a4c911b5f3a82766d27f41c5cf60b9c17d4)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/trace-events | 1 +
- hw/arm/virt-acpi-build.c | 52 ++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 53 insertions(+)
-
-diff --git a/hw/arm/trace-events b/hw/arm/trace-events
-index 0bd718b1ab..1b16f710fe 100644
---- a/hw/arm/trace-events
-+++ b/hw/arm/trace-events
-@@ -9,6 +9,7 @@ omap1_lpg_led(const char *onoff) "omap1 LPG: LED is %s"
-
- # virt-acpi-build.c
- virt_acpi_setup(void) "No fw cfg or ACPI disabled. Bailing out."
-+virt_acpi_dsdt_tegra241_cmdqv(int smmu_id, uint64_t base, uint32_t irq) "DSDT: add cmdqv node for (id=%d), base=0x%" PRIx64 ", irq=%d"
-
- # smmu-common.c
- smmu_add_mr(const char *name) "%s"
-diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
-index 20dfe9e4d8..2c77d443fe 100644
---- a/hw/arm/virt-acpi-build.c
-+++ b/hw/arm/virt-acpi-build.c
-@@ -64,6 +64,9 @@
- #include "hw/virtio/virtio-acpi.h"
- #include "target/arm/multiprocessing.h"
-
-+#include "smmuv3-accel.h"
-+#include "tegra241-cmdqv.h"
-+
- #define ARM_SPI_BASE 32
-
- #define ACPI_BUILD_TABLE_SIZE 0x20000
-@@ -1116,6 +1119,51 @@ static void build_fadt_rev6(GArray *table_data, BIOSLinker *linker,
- build_fadt(table_data, linker, &fadt, vms->oem_id, vms->oem_table_id);
- }
-
-+static void acpi_dsdt_add_tegra241_cmdqv(Aml *scope, VirtMachineState *vms)
-+{
-+ for (int i = 0; i < vms->smmuv3_devices->len; i++) {
-+ Object *obj = OBJECT(g_ptr_array_index(vms->smmuv3_devices, i));
-+ PlatformBusDevice *pbus;
-+ Aml *dev, *crs, *addr;
-+ SysBusDevice *sbdev;
-+ hwaddr base;
-+ uint32_t id;
-+ int irq;
-+
-+ if (smmuv3_accel_cmdqv_type(obj) != SMMUV3_CMDQV_TEGRA241) {
-+ continue;
-+ }
-+ id = object_property_get_uint(obj, "identifier", &error_abort);
-+ pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
-+ sbdev = SYS_BUS_DEVICE(obj);
-+ base = platform_bus_get_mmio_addr(pbus, sbdev, 1);
-+ base += vms->memmap[VIRT_PLATFORM_BUS].base;
-+ irq = platform_bus_get_irqn(pbus, sbdev, NUM_SMMU_IRQS);
-+ irq += vms->irqmap[VIRT_PLATFORM_BUS];
-+ irq += ARM_SPI_BASE;
-+
-+ dev = aml_device("CV%.02u", id);
-+ aml_append(dev, aml_name_decl("_HID", aml_string("NVDA200C")));
-+ aml_append(dev, aml_name_decl("_UID", aml_int(id)));
-+ aml_append(dev, aml_name_decl("_CCA", aml_int(1)));
-+
-+ crs = aml_resource_template();
-+ addr = aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED,
-+ AML_CACHEABLE, AML_READ_WRITE, 0x0, base,
-+ base + TEGRA241_CMDQV_IO_LEN - 0x1, 0x0,
-+ TEGRA241_CMDQV_IO_LEN);
-+ aml_append(crs, addr);
-+ aml_append(crs, aml_interrupt(AML_CONSUMER, AML_EDGE,
-+ AML_ACTIVE_HIGH, AML_EXCLUSIVE,
-+ (uint32_t *)&irq, 1));
-+ aml_append(dev, aml_name_decl("_CRS", crs));
-+
-+ aml_append(scope, dev);
-+
-+ trace_virt_acpi_dsdt_tegra241_cmdqv(id, base, irq);
-+ }
-+}
-+
- /* DSDT */
- static void
- build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
-@@ -1179,6 +1227,10 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- acpi_dsdt_add_tpm(scope, vms);
- #endif
-
-+ if (!vms->legacy_smmuv3_present) {
-+ acpi_dsdt_add_tegra241_cmdqv(scope, vms);
-+ }
-+
- aml_append(dsdt, scope);
-
- pci0_scope = aml_scope("\\_SB.PCI0");
---
-2.52.0
-
diff --git a/kvm-hw-arm-virt-acpi-build-Add-IORT-RMR-regions-to-handl.patch b/kvm-hw-arm-virt-acpi-build-Add-IORT-RMR-regions-to-handl.patch
deleted file mode 100644
index d19328b..0000000
--- a/kvm-hw-arm-virt-acpi-build-Add-IORT-RMR-regions-to-handl.patch
+++ /dev/null
@@ -1,291 +0,0 @@
-From 37e10410d051d4e6143e6e9ecda4547f18977a68 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 033/111] hw/arm/virt-acpi-build: Add IORT RMR regions to
- handle MSI nested binding
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [33/111] d727e3f2e2cc2886cf9498b1a5e757017f16ca5e (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-To handle SMMUv3 accel=on mode(which configures the host SMMUv3 in nested
-mode), it is practical to expose the guest with reserved memory regions
-(RMRs) covering the IOVAs used by the host kernel to map physical MSI
-doorbells.
-
-Those IOVAs belong to [0x8000000, 0x8100000] matching MSI_IOVA_BASE and
-MSI_IOVA_LENGTH definitions in kernel arm-smmu-v3 driver. This is the
-window used to allocate IOVAs matching physical MSI doorbells.
-
-With those RMRs, the guest is forced to use a flat mapping for this range.
-Hence the assigned device is programmed with one IOVA from this range.
-Stage 1, owned by the guest has a flat mapping for this IOVA. Stage2,
-owned by the VMM then enforces a mapping from this IOVA to the physical
-MSI doorbell.
-
-The creation of those RMR nodes is only relevant if nested stage SMMU is
-in use, along with VFIO. As VFIO devices can be hotplugged, all RMRs need
-to be created in advance.
-
-Initialise AcpiIortSMMUv3Dev structures to avoid using uninitialised
-state when building the IORT, as legacy and device SMMUv3 paths
-populate different fields now(e.g. accel).
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Message-id: 20260126104342.253965-26-skolothumtho@nvidia.com
-Suggested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 06c0c8fde7867f634f226cec6a318606885b9bc8)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/virt-acpi-build.c | 115 +++++++++++++++++++++++++++++++++++----
- 1 file changed, 105 insertions(+), 10 deletions(-)
-
-diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
-index 6883147040..1323d1a0da 100644
---- a/hw/arm/virt-acpi-build.c
-+++ b/hw/arm/virt-acpi-build.c
-@@ -263,6 +263,29 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
- #define ROOT_COMPLEX_ENTRY_SIZE 36
- #define IORT_NODE_OFFSET 48
-
-+#define IORT_RMR_NUM_ID_MAPPINGS 1
-+#define IORT_RMR_NUM_MEM_RANGE_DESC 1
-+#define IORT_RMR_COMMON_HEADER_SIZE 28
-+#define IORT_RMR_MEM_RANGE_DESC_SIZE 20
-+
-+/*
-+ * IORT RMR flags:
-+ * Bit[0] = 0 Disallow remapping of reserved ranges
-+ * Bit[1] = 0 Unprivileged access
-+ * Bits[9:2] = 0x00 Device nGnRnE memory
-+ */
-+#define IORT_RMR_FLAGS 0
-+
-+/*
-+ * MSI doorbell IOVA window used by the host kernel SMMUv3 driver.
-+ * Described in IORT RMR nodes to reserve the IOVA range where the host
-+ * kernel maps physical MSI doorbells for devices. This ensures guests
-+ * preserve a flat mapping for MSI doorbell in nested SMMUv3(accel=on)
-+ * configurations.
-+ */
-+#define MSI_IOVA_BASE 0x8000000
-+#define MSI_IOVA_LENGTH 0x100000
-+
- /*
- * Append an ID mapping entry as described by "Table 4 ID mapping format" in
- * "IO Remapping Table System Software on ARM Platforms", Chapter 3.
-@@ -271,7 +294,8 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
- * Note that @id_count gets internally subtracted by one, following the spec.
- */
- static void build_iort_id_mapping(GArray *table_data, uint32_t input_base,
-- uint32_t id_count, uint32_t out_ref)
-+ uint32_t id_count, uint32_t out_ref,
-+ uint32_t flags)
- {
- build_append_int_noprefix(table_data, input_base, 4); /* Input base */
- /* Number of IDs - The number of IDs in the range minus one */
-@@ -279,7 +303,7 @@ static void build_iort_id_mapping(GArray *table_data, uint32_t input_base,
- build_append_int_noprefix(table_data, input_base, 4); /* Output base */
- build_append_int_noprefix(table_data, out_ref, 4); /* Output Reference */
- /* Flags */
-- build_append_int_noprefix(table_data, 0 /* Single mapping (disabled) */, 4);
-+ build_append_int_noprefix(table_data, flags, 4);
- }
-
- struct AcpiIortIdMapping {
-@@ -327,6 +351,7 @@ typedef struct AcpiIortSMMUv3Dev {
- GArray *rc_smmu_idmaps;
- /* Offset of the SMMUv3 IORT Node relative to the start of the IORT */
- size_t offset;
-+ bool accel;
- } AcpiIortSMMUv3Dev;
-
- /*
-@@ -336,7 +361,7 @@ typedef struct AcpiIortSMMUv3Dev {
- static int populate_smmuv3_legacy_dev(GArray *sdev_blob)
- {
- VirtMachineState *vms = VIRT_MACHINE(qdev_get_machine());
-- AcpiIortSMMUv3Dev sdev;
-+ AcpiIortSMMUv3Dev sdev = {0};
-
- sdev.rc_smmu_idmaps = g_array_new(false, true, sizeof(AcpiIortIdMapping));
- object_child_foreach_recursive(object_get_root(), iort_host_bridges,
-@@ -368,10 +393,10 @@ static int smmuv3_dev_idmap_compare(gconstpointer a, gconstpointer b)
- static int iort_smmuv3_devices(Object *obj, void *opaque)
- {
- VirtMachineState *vms = VIRT_MACHINE(qdev_get_machine());
-+ AcpiIortSMMUv3Dev sdev = {0};
- GArray *sdev_blob = opaque;
- AcpiIortIdMapping idmap;
- PlatformBusDevice *pbus;
-- AcpiIortSMMUv3Dev sdev;
- int min_bus, max_bus;
- SysBusDevice *sbdev;
- PCIBus *bus;
-@@ -381,6 +406,9 @@ static int iort_smmuv3_devices(Object *obj, void *opaque)
- }
-
- bus = PCI_BUS(object_property_get_link(obj, "primary-bus", &error_abort));
-+ if (object_property_find(obj, "accel")) {
-+ sdev.accel = object_property_get_bool(obj, "accel", &error_abort);
-+ }
- pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
- sbdev = SYS_BUS_DEVICE(obj);
- sdev.base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
-@@ -454,10 +482,69 @@ static void create_rc_its_idmaps(GArray *its_idmaps, GArray *smmuv3_devs)
- }
- }
-
-+static void
-+build_iort_rmr_nodes(GArray *table_data, GArray *smmuv3_devices, uint32_t *id)
-+{
-+ AcpiIortSMMUv3Dev *sdev;
-+ AcpiIortIdMapping *idmap;
-+ int i;
-+
-+ for (i = 0; i < smmuv3_devices->len; i++) {
-+ uint16_t rmr_len;
-+ int bdf;
-+
-+ sdev = &g_array_index(smmuv3_devices, AcpiIortSMMUv3Dev, i);
-+ if (!sdev->accel) {
-+ continue;
-+ }
-+
-+ /*
-+ * Spec reference:Arm IO Remapping Table(IORT), ARM DEN 0049E.d,
-+ * Section 3.1.1.5 "Reserved Memory Range node"
-+ */
-+ idmap = &g_array_index(sdev->rc_smmu_idmaps, AcpiIortIdMapping, 0);
-+ bdf = idmap->input_base;
-+ rmr_len = IORT_RMR_COMMON_HEADER_SIZE
-+ + (IORT_RMR_NUM_ID_MAPPINGS * ID_MAPPING_ENTRY_SIZE)
-+ + (IORT_RMR_NUM_MEM_RANGE_DESC * IORT_RMR_MEM_RANGE_DESC_SIZE);
-+
-+ /* Table 18 Reserved Memory Range Node */
-+ build_append_int_noprefix(table_data, 6 /* RMR */, 1); /* Type */
-+ /* Length */
-+ build_append_int_noprefix(table_data, rmr_len, 2);
-+ build_append_int_noprefix(table_data, 3, 1); /* Revision */
-+ build_append_int_noprefix(table_data, (*id)++, 4); /* Identifier */
-+ /* Number of ID mappings */
-+ build_append_int_noprefix(table_data, IORT_RMR_NUM_ID_MAPPINGS, 4);
-+ /* Reference to ID Array */
-+ build_append_int_noprefix(table_data, IORT_RMR_COMMON_HEADER_SIZE, 4);
-+
-+ /* RMR specific data */
-+
-+ /* Flags */
-+ build_append_int_noprefix(table_data, IORT_RMR_FLAGS, 4);
-+ /* Number of Memory Range Descriptors */
-+ build_append_int_noprefix(table_data, IORT_RMR_NUM_MEM_RANGE_DESC, 4);
-+ /* Reference to Memory Range Descriptors */
-+ build_append_int_noprefix(table_data, IORT_RMR_COMMON_HEADER_SIZE +
-+ (IORT_RMR_NUM_ID_MAPPINGS * ID_MAPPING_ENTRY_SIZE), 4);
-+ build_iort_id_mapping(table_data, bdf, idmap->id_count, sdev->offset,
-+ 1);
-+
-+ /* Table 19 Memory Range Descriptor */
-+
-+ /* Physical Range offset */
-+ build_append_int_noprefix(table_data, MSI_IOVA_BASE, 8);
-+ /* Physical Range length */
-+ build_append_int_noprefix(table_data, MSI_IOVA_LENGTH, 8);
-+ build_append_int_noprefix(table_data, 0, 4); /* Reserved */
-+ }
-+}
-+
- /*
- * Input Output Remapping Table (IORT)
- * Conforms to "IO Remapping Table System Software on ARM Platforms",
-- * Document number: ARM DEN 0049E.b, Feb 2021
-+ * Document number: ARM DEN 0049E.d, Feb 2022
- */
- static void
- build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
-@@ -471,7 +558,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- GArray *smmuv3_devs = g_array_new(false, true, sizeof(AcpiIortSMMUv3Dev));
- GArray *rc_its_idmaps = g_array_new(false, true, sizeof(AcpiIortIdMapping));
-
-- AcpiTable table = { .sig = "IORT", .rev = 3, .oem_id = vms->oem_id,
-+ AcpiTable table = { .sig = "IORT", .rev = 5, .oem_id = vms->oem_id,
- .oem_table_id = vms->oem_table_id };
- /* Table 2 The IORT */
- acpi_table_begin(&table, table_data);
-@@ -497,6 +584,13 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- nb_nodes++; /* ITS */
- rc_mapping_count += rc_its_idmaps->len;
- }
-+ /* Calculate RMR nodes required. One per SMMUv3 with accelerated mode */
-+ for (i = 0; i < num_smmus; i++) {
-+ sdev = &g_array_index(smmuv3_devs, AcpiIortSMMUv3Dev, i);
-+ if (sdev->accel) {
-+ nb_nodes++;
-+ }
-+ }
- } else {
- if (vms->its) {
- nb_nodes = 2; /* RC and ITS */
-@@ -569,7 +663,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- /* Array of ID mappings */
- if (smmu_mapping_count) {
- /* Output IORT node is the ITS Group node (the first node). */
-- build_iort_id_mapping(table_data, 0, 0x10000, IORT_NODE_OFFSET);
-+ build_iort_id_mapping(table_data, 0, 0x10000, IORT_NODE_OFFSET, 0);
- }
- }
-
-@@ -621,7 +715,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- AcpiIortIdMapping, j);
- /* Output IORT node is the SMMUv3 node. */
- build_iort_id_mapping(table_data, range->input_base,
-- range->id_count, sdev->offset);
-+ range->id_count, sdev->offset, 0);
- }
- }
-
-@@ -634,7 +728,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- range = &g_array_index(rc_its_idmaps, AcpiIortIdMapping, i);
- /* Output IORT node is the ITS Group node (the first node). */
- build_iort_id_mapping(table_data, range->input_base,
-- range->id_count, IORT_NODE_OFFSET);
-+ range->id_count, IORT_NODE_OFFSET, 0);
- }
- }
- } else {
-@@ -643,9 +737,10 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- * SMMU: RC -> ITS.
- * Output IORT node is the ITS Group node (the first node).
- */
-- build_iort_id_mapping(table_data, 0, 0x10000, IORT_NODE_OFFSET);
-+ build_iort_id_mapping(table_data, 0, 0x10000, IORT_NODE_OFFSET, 0);
- }
-
-+ build_iort_rmr_nodes(table_data, smmuv3_devs, &id);
- acpi_table_end(linker, &table);
- g_array_free(rc_its_idmaps, true);
- for (i = 0; i < num_smmus; i++) {
---
-2.52.0
-
diff --git a/kvm-hw-arm-virt-acpi-build-Re-arrange-SMMUv3-IORT-build.patch b/kvm-hw-arm-virt-acpi-build-Re-arrange-SMMUv3-IORT-build.patch
deleted file mode 100644
index e12a15d..0000000
--- a/kvm-hw-arm-virt-acpi-build-Re-arrange-SMMUv3-IORT-build.patch
+++ /dev/null
@@ -1,291 +0,0 @@
-From 221e12accdd5e699d727cd862760829e973a7b2a Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 29 Aug 2025 09:25:24 +0100
-Subject: [PATCH 06/16] hw/arm/virt-acpi-build: Re-arrange SMMUv3 IORT build
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 423: hw/arm/virt: Add support for user creatable SMMUv3 device
-RH-Jira: RHEL-73800
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Donald Dutile <None>
-RH-Commit: [2/11] 73e2dd4f48ffaf614c79241bc73cbb0457849131 (eauger1/centos-qemu-kvm)
-
-Introduce a new struct AcpiIortSMMUv3Dev to hold all the information
-required for SMMUv3 IORT node and use that for populating the node.
-
-The current machine wide SMMUv3 is named as legacy SMMUv3 as we will
-soon add support for user-creatable SMMUv3 devices. These changes will
-be useful to have common code paths when we add that support.
-
-Tested-by: Nathan Chen <nathanc@nvidia.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Donald Dutile <ddutile@redhat.com>
-Message-id: 20250829082543.7680-3-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 0e6a5bfb0eb17f57fb923b7905bd1435204bdd62)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/virt-acpi-build.c | 137 ++++++++++++++++++++++++++-------------
- hw/arm/virt.c | 1 +
- include/hw/arm/virt.h | 1 +
- 3 files changed, 94 insertions(+), 45 deletions(-)
-
-diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
-index b01fc4f8ef..bef4fabe56 100644
---- a/hw/arm/virt-acpi-build.c
-+++ b/hw/arm/virt-acpi-build.c
-@@ -305,29 +305,65 @@ static int iort_idmap_compare(gconstpointer a, gconstpointer b)
- return idmap_a->input_base - idmap_b->input_base;
- }
-
-+typedef struct AcpiIortSMMUv3Dev {
-+ int irq;
-+ hwaddr base;
-+ GArray *rc_smmu_idmaps;
-+ /* Offset of the SMMUv3 IORT Node relative to the start of the IORT */
-+ size_t offset;
-+} AcpiIortSMMUv3Dev;
-+
-+/*
-+ * Populate the struct AcpiIortSMMUv3Dev for the legacy SMMUv3 and
-+ * return the total number of associated idmaps.
-+ */
-+static int populate_smmuv3_legacy_dev(GArray *sdev_blob)
-+{
-+ VirtMachineState *vms = VIRT_MACHINE(qdev_get_machine());
-+ AcpiIortSMMUv3Dev sdev;
-+
-+ sdev.rc_smmu_idmaps = g_array_new(false, true, sizeof(AcpiIortIdMapping));
-+ object_child_foreach_recursive(object_get_root(), iort_host_bridges,
-+ sdev.rc_smmu_idmaps);
-+ /*
-+ * There can be only one legacy SMMUv3("iommu=smmuv3") as it is a machine
-+ * wide one. Since it may cover multiple PCIe RCs(based on "bypass_iommu"
-+ * property), may have multiple SMMUv3 idmaps. Sort it by input_base.
-+ */
-+ g_array_sort(sdev.rc_smmu_idmaps, iort_idmap_compare);
-+
-+ sdev.base = vms->memmap[VIRT_SMMU].base;
-+ sdev.irq = vms->irqmap[VIRT_SMMU] + ARM_SPI_BASE;
-+ g_array_append_val(sdev_blob, sdev);
-+ return sdev.rc_smmu_idmaps->len;
-+}
-+
- /* Compute ID ranges (RIDs) from RC that are directed to the ITS Group node */
--static void create_rc_its_idmaps(GArray *its_idmaps, GArray *smmu_idmaps)
-+static void create_rc_its_idmaps(GArray *its_idmaps, GArray *smmuv3_devs)
- {
- AcpiIortIdMapping *idmap;
- AcpiIortIdMapping next_range = {0};
-+ AcpiIortSMMUv3Dev *sdev;
-
-- /*
-- * Based on the RID ranges that are directed to the SMMU, determine the
-- * bypassed RID ranges, i.e., the ones that are directed to the ITS Group
-- * node and do not pass through the SMMU, by subtracting the SMMU-bound
-- * ranges from the full RID range (0x0000–0xFFFF).
-- */
-- for (int i = 0; i < smmu_idmaps->len; i++) {
-- idmap = &g_array_index(smmu_idmaps, AcpiIortIdMapping, i);
-+ for (int i = 0; i < smmuv3_devs->len; i++) {
-+ sdev = &g_array_index(smmuv3_devs, AcpiIortSMMUv3Dev, i);
-+ /*
-+ * Based on the RID ranges that are directed to the SMMU, determine the
-+ * bypassed RID ranges, i.e., the ones that are directed to the ITS
-+ * Group node and do not pass through the SMMU, by subtracting the
-+ * SMMU-bound ranges from the full RID range (0x0000–0xFFFF).
-+ */
-+ for (int j = 0; j < sdev->rc_smmu_idmaps->len; j++) {
-+ idmap = &g_array_index(sdev->rc_smmu_idmaps, AcpiIortIdMapping, j);
-
-- if (next_range.input_base < idmap->input_base) {
-- next_range.id_count = idmap->input_base - next_range.input_base;
-- g_array_append_val(its_idmaps, next_range);
-- }
-+ if (next_range.input_base < idmap->input_base) {
-+ next_range.id_count = idmap->input_base - next_range.input_base;
-+ g_array_append_val(its_idmaps, next_range);
-+ }
-
-- next_range.input_base = idmap->input_base + idmap->id_count;
-+ next_range.input_base = idmap->input_base + idmap->id_count;
-+ }
- }
--
- /*
- * Append the last RC -> ITS ID mapping.
- *
-@@ -341,7 +377,6 @@ static void create_rc_its_idmaps(GArray *its_idmaps, GArray *smmu_idmaps)
- }
- }
-
--
- /*
- * Input Output Remapping Table (IORT)
- * Conforms to "IO Remapping Table System Software on ARM Platforms",
-@@ -351,9 +386,12 @@ static void
- build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- {
- int i, nb_nodes, rc_mapping_count;
-- size_t node_size, smmu_offset = 0;
-+ AcpiIortSMMUv3Dev *sdev;
-+ size_t node_size;
-+ int num_smmus = 0;
- uint32_t id = 0;
-- GArray *rc_smmu_idmaps = g_array_new(false, true, sizeof(AcpiIortIdMapping));
-+ int rc_smmu_idmaps_len = 0;
-+ GArray *smmuv3_devs = g_array_new(false, true, sizeof(AcpiIortSMMUv3Dev));
- GArray *rc_its_idmaps = g_array_new(false, true, sizeof(AcpiIortIdMapping));
-
- AcpiTable table = { .sig = "IORT", .rev = 3, .oem_id = vms->oem_id,
-@@ -361,22 +399,21 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- /* Table 2 The IORT */
- acpi_table_begin(&table, table_data);
-
-- if (vms->iommu == VIRT_IOMMU_SMMUV3) {
-- object_child_foreach_recursive(object_get_root(),
-- iort_host_bridges, rc_smmu_idmaps);
--
-- /* Sort the smmu idmap by input_base */
-- g_array_sort(rc_smmu_idmaps, iort_idmap_compare);
-+ if (vms->legacy_smmuv3_present) {
-+ rc_smmu_idmaps_len = populate_smmuv3_legacy_dev(smmuv3_devs);
-+ }
-
-- nb_nodes = 2; /* RC and SMMUv3 */
-- rc_mapping_count = rc_smmu_idmaps->len;
-+ num_smmus = smmuv3_devs->len;
-+ if (num_smmus) {
-+ nb_nodes = num_smmus + 1; /* RC and SMMUv3 */
-+ rc_mapping_count = rc_smmu_idmaps_len;
-
- if (vms->its) {
- /*
- * Knowing the ID ranges from the RC to the SMMU, it's possible to
- * determine the ID ranges from RC that go directly to ITS.
- */
-- create_rc_its_idmaps(rc_its_idmaps, rc_smmu_idmaps);
-+ create_rc_its_idmaps(rc_its_idmaps, smmuv3_devs);
-
- nb_nodes++; /* ITS */
- rc_mapping_count += rc_its_idmaps->len;
-@@ -411,9 +448,10 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- build_append_int_noprefix(table_data, 0 /* MADT translation_id */, 4);
- }
-
-- if (vms->iommu == VIRT_IOMMU_SMMUV3) {
-- int irq = vms->irqmap[VIRT_SMMU] + ARM_SPI_BASE;
-+ for (i = 0; i < num_smmus; i++) {
-+ sdev = &g_array_index(smmuv3_devs, AcpiIortSMMUv3Dev, i);
- int smmu_mapping_count, offset_to_id_array;
-+ int irq = sdev->irq;
-
- if (vms->its) {
- smmu_mapping_count = 1; /* ITS Group node */
-@@ -422,7 +460,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- smmu_mapping_count = 0; /* No ID mappings */
- offset_to_id_array = 0; /* No ID mappings array */
- }
-- smmu_offset = table_data->len - table.table_offset;
-+ sdev->offset = table_data->len - table.table_offset;
- /* Table 9 SMMUv3 Format */
- build_append_int_noprefix(table_data, 4 /* SMMUv3 */, 1); /* Type */
- node_size = SMMU_V3_ENTRY_SIZE +
-@@ -435,7 +473,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- /* Reference to ID Array */
- build_append_int_noprefix(table_data, offset_to_id_array, 4);
- /* Base address */
-- build_append_int_noprefix(table_data, vms->memmap[VIRT_SMMU].base, 8);
-+ build_append_int_noprefix(table_data, sdev->base, 8);
- /* Flags */
- build_append_int_noprefix(table_data, 1 /* COHACC Override */, 4);
- build_append_int_noprefix(table_data, 0, 4); /* Reserved */
-@@ -486,21 +524,26 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- build_append_int_noprefix(table_data, 0, 3); /* Reserved */
-
- /* Output Reference */
-- if (vms->iommu == VIRT_IOMMU_SMMUV3) {
-+ if (num_smmus) {
- AcpiIortIdMapping *range;
-
-- /*
-- * Map RIDs (input) from RC to SMMUv3 nodes: RC -> SMMUv3.
-- *
-- * N.B.: The mapping from SMMUv3 to ITS Group node (SMMUv3 -> ITS) is
-- * defined in the SMMUv3 table, where all SMMUv3 IDs are mapped to the
-- * ITS Group node, if ITS is available.
-- */
-- for (i = 0; i < rc_smmu_idmaps->len; i++) {
-- range = &g_array_index(rc_smmu_idmaps, AcpiIortIdMapping, i);
-- /* Output IORT node is the SMMUv3 node. */
-- build_iort_id_mapping(table_data, range->input_base,
-- range->id_count, smmu_offset);
-+ for (i = 0; i < num_smmus; i++) {
-+ sdev = &g_array_index(smmuv3_devs, AcpiIortSMMUv3Dev, i);
-+
-+ /*
-+ * Map RIDs (input) from RC to SMMUv3 nodes: RC -> SMMUv3.
-+ *
-+ * N.B.: The mapping from SMMUv3 to ITS Group node (SMMUv3 -> ITS)
-+ * is defined in the SMMUv3 table, where all SMMUv3 IDs are mapped
-+ * to the ITS Group node, if ITS is available.
-+ */
-+ for (int j = 0; j < sdev->rc_smmu_idmaps->len; j++) {
-+ range = &g_array_index(sdev->rc_smmu_idmaps,
-+ AcpiIortIdMapping, j);
-+ /* Output IORT node is the SMMUv3 node. */
-+ build_iort_id_mapping(table_data, range->input_base,
-+ range->id_count, sdev->offset);
-+ }
- }
-
- if (vms->its) {
-@@ -525,8 +568,12 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
- }
-
- acpi_table_end(linker, &table);
-- g_array_free(rc_smmu_idmaps, true);
- g_array_free(rc_its_idmaps, true);
-+ for (i = 0; i < num_smmus; i++) {
-+ sdev = &g_array_index(smmuv3_devs, AcpiIortSMMUv3Dev, i);
-+ g_array_free(sdev->rc_smmu_idmaps, true);
-+ }
-+ g_array_free(smmuv3_devs, true);
- }
-
- /*
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index 542d702513..0cc9e5f068 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -1686,6 +1686,7 @@ static void create_pcie(VirtMachineState *vms)
- qemu_fdt_setprop_cells(ms->fdt, nodename, "iommu-map",
- 0x0, vms->iommu_phandle, 0x0, 0x10000);
- }
-+ vms->legacy_smmuv3_present = true;
- break;
- default:
- g_assert_not_reached();
-diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
-index 94c79d6c6d..98b877c8b9 100644
---- a/include/hw/arm/virt.h
-+++ b/include/hw/arm/virt.h
-@@ -180,6 +180,7 @@ struct VirtMachineState {
- char *oem_table_id;
- bool ns_el2_virt_timer_irq;
- CXLState cxl_devices_state;
-+ bool legacy_smmuv3_present;
- };
-
- #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)
---
-2.47.3
-
diff --git a/kvm-hw-arm-virt-acpi-build-Update-IORT-for-multiple-smmu.patch b/kvm-hw-arm-virt-acpi-build-Update-IORT-for-multiple-smmu.patch
deleted file mode 100644
index 7e4267a..0000000
--- a/kvm-hw-arm-virt-acpi-build-Update-IORT-for-multiple-smmu.patch
+++ /dev/null
@@ -1,170 +0,0 @@
-From f89d89a3758ebd8725e677431f1e7493c65381c2 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 29 Aug 2025 09:25:25 +0100
-Subject: [PATCH 07/16] hw/arm/virt-acpi-build: Update IORT for multiple smmuv3
- devices
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 423: hw/arm/virt: Add support for user creatable SMMUv3 device
-RH-Jira: RHEL-73800
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Donald Dutile <None>
-RH-Commit: [3/11] 9cb15768a319676af16cd2cdef8b8fabfa7b6f13 (eauger1/centos-qemu-kvm)
-
-With the soon to be introduced user-creatable SMMUv3 devices for
-virt, it is possible to have multiple SMMUv3 devices associated
-with different PCIe root complexes.
-
-Update IORT nodes accordingly.
-
-An example IORT Id mappings for a Qemu virt machine with two
-PCIe Root Complexes each assocaited with a SMMUv3 will
-be something like below,
-
- -device arm-smmuv3,primary-bus=pcie.0,id=smmuv3.0
- -device arm-smmuv3,primary-bus=pcie.1,id=smmuv3.1
- ...
-
- +--------------------+ +--------------------+
- | Root Complex 0 | | Root Complex 1 |
- | | | |
- | Requestor IDs | | Requestor IDs |
- | 0x0000 - 0x00FF | | 0x0100 - 0x01FF |
- +---------+----------+ +---------+----------+
- | |
- | |
- | Stream ID Mapping |
- v v
- +--------------------+ +--------------------+
- | SMMUv3 Node 0 | | SMMUv3 Node 1 |
- | | | |
- | Stream IDs 0x0000- | | Stream IDs 0x0100- |
- | 0x00FF mapped from | | 0x01FF mapped from |
- | RC0 Requestor IDs | | RC1 Requestor IDs |
- +--------------------+ +--------------------+
- | |
- | |
- +----------------+---------------+
- |
- |Device ID Mapping
- v
- +----------------------------+
- | ITS Node 0 |
- | |
- | Device IDs: |
- | 0x0000 - 0x00FF (from RC0) |
- | 0x0100 - 0x01FF (from RC1) |
- | 0x0200 - 0xFFFF (No SMMU) |
- +----------------------------+
-
-Tested-by: Nathan Chen <nathanc@nvidia.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Donald Dutile <ddutile@redhat.com>
-Message-id: 20250829082543.7680-4-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 01e9a18730e6f56f713ed074603a8b0f2982ed26)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/virt-acpi-build.c | 64 ++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 64 insertions(+)
-
-diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
-index bef4fabe56..96830f7c4e 100644
---- a/hw/arm/virt-acpi-build.c
-+++ b/hw/arm/virt-acpi-build.c
-@@ -45,6 +45,7 @@
- #include "hw/acpi/generic_event_device.h"
- #include "hw/acpi/tpm.h"
- #include "hw/acpi/hmat.h"
-+#include "hw/arm/smmuv3.h"
- #include "hw/cxl/cxl.h"
- #include "hw/pci/pcie_host.h"
- #include "hw/pci/pci.h"
-@@ -338,6 +339,67 @@ static int populate_smmuv3_legacy_dev(GArray *sdev_blob)
- return sdev.rc_smmu_idmaps->len;
- }
-
-+static int smmuv3_dev_idmap_compare(gconstpointer a, gconstpointer b)
-+{
-+ AcpiIortSMMUv3Dev *sdev_a = (AcpiIortSMMUv3Dev *)a;
-+ AcpiIortSMMUv3Dev *sdev_b = (AcpiIortSMMUv3Dev *)b;
-+ AcpiIortIdMapping *map_a = &g_array_index(sdev_a->rc_smmu_idmaps,
-+ AcpiIortIdMapping, 0);
-+ AcpiIortIdMapping *map_b = &g_array_index(sdev_b->rc_smmu_idmaps,
-+ AcpiIortIdMapping, 0);
-+ return map_a->input_base - map_b->input_base;
-+}
-+
-+static int iort_smmuv3_devices(Object *obj, void *opaque)
-+{
-+ VirtMachineState *vms = VIRT_MACHINE(qdev_get_machine());
-+ GArray *sdev_blob = opaque;
-+ AcpiIortIdMapping idmap;
-+ PlatformBusDevice *pbus;
-+ AcpiIortSMMUv3Dev sdev;
-+ int min_bus, max_bus;
-+ SysBusDevice *sbdev;
-+ PCIBus *bus;
-+
-+ if (!object_dynamic_cast(obj, TYPE_ARM_SMMUV3)) {
-+ return 0;
-+ }
-+
-+ bus = PCI_BUS(object_property_get_link(obj, "primary-bus", &error_abort));
-+ pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
-+ sbdev = SYS_BUS_DEVICE(obj);
-+ sdev.base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
-+ sdev.base += vms->memmap[VIRT_PLATFORM_BUS].base;
-+ sdev.irq = platform_bus_get_irqn(pbus, sbdev, 0);
-+ sdev.irq += vms->irqmap[VIRT_PLATFORM_BUS];
-+ sdev.irq += ARM_SPI_BASE;
-+
-+ pci_bus_range(bus, &min_bus, &max_bus);
-+ sdev.rc_smmu_idmaps = g_array_new(false, true, sizeof(AcpiIortIdMapping));
-+ idmap.input_base = min_bus << 8,
-+ idmap.id_count = (max_bus - min_bus + 1) << 8,
-+ g_array_append_val(sdev.rc_smmu_idmaps, idmap);
-+ g_array_append_val(sdev_blob, sdev);
-+ return 0;
-+}
-+
-+/*
-+ * Populate the struct AcpiIortSMMUv3Dev for all SMMUv3 devices and
-+ * return the total number of idmaps.
-+ */
-+static int populate_smmuv3_dev(GArray *sdev_blob)
-+{
-+ object_child_foreach_recursive(object_get_root(),
-+ iort_smmuv3_devices, sdev_blob);
-+ /* Sort the smmuv3 devices(if any) by smmu idmap input_base */
-+ g_array_sort(sdev_blob, smmuv3_dev_idmap_compare);
-+ /*
-+ * Since each SMMUv3 dev is assocaited with specific host bridge,
-+ * total number of idmaps equals to total number of smmuv3 devices.
-+ */
-+ return sdev_blob->len;
-+}
-+
- /* Compute ID ranges (RIDs) from RC that are directed to the ITS Group node */
- static void create_rc_its_idmaps(GArray *its_idmaps, GArray *smmuv3_devs)
- {
-@@ -401,6 +463,8 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
-
- if (vms->legacy_smmuv3_present) {
- rc_smmu_idmaps_len = populate_smmuv3_legacy_dev(smmuv3_devs);
-+ } else {
-+ rc_smmu_idmaps_len = populate_smmuv3_dev(smmuv3_devs);
- }
-
- num_smmus = smmuv3_devs->len;
---
-2.47.3
-
diff --git a/kvm-hw-core-platform-bus-guard-platform_bus_get_mmio_add.patch b/kvm-hw-core-platform-bus-guard-platform_bus_get_mmio_add.patch
deleted file mode 100644
index c46e74d..0000000
--- a/kvm-hw-core-platform-bus-guard-platform_bus_get_mmio_add.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From dee147a00ef424ebb5882f45b2dcd88eef30e0d1 Mon Sep 17 00:00:00 2001
-From: Mohammadfaiz Bawa <mbawa@redhat.com>
-Date: Tue, 14 Jul 2026 22:01:45 +0530
-Subject: [PATCH 01/12] hw/core/platform-bus: guard
- platform_bus_get_mmio_addr() against NULL
-
-RH-Author: Mohammadfaiz Bawa <None>
-RH-MergeRequest: 511: hw/tpm: fix tpm-ppi migration failure for older machine types
-RH-Jira: RHEL-180837
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [1/3] 622f42e2d1c609def22b2796cf83080248897548 (faizb/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-180837
-
-sysbus_mmio_get_region() returns NULL when a device has fewer MMIO
-regions than the requested slot index. platform_bus_get_mmio_addr()
-passes the result directly to memory_region_is_mapped() without a
-NULL check, causing a SIGSEGV.
-
-Return -1 early when the region pointer is NULL, consistent with the
-existing "not mapped" path.
-
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20260619093140.832136-2-mbawa@redhat.com
-Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
-(cherry picked from commit fb7609c4bf74e31ea06c0d8e400dd01badcfa4c3)
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
----
- hw/core/platform-bus.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c
-index 6950063de4..95add361cc 100644
---- a/hw/core/platform-bus.c
-+++ b/hw/core/platform-bus.c
-@@ -59,8 +59,7 @@ hwaddr platform_bus_get_mmio_addr(PlatformBusDevice *pbus, SysBusDevice *sbdev,
- Object *pbus_mr_obj = OBJECT(pbus_mr);
- Object *parent_mr;
-
-- if (!memory_region_is_mapped(sbdev_mr)) {
-- /* Region is not mapped? */
-+ if (!sbdev_mr || !memory_region_is_mapped(sbdev_mr)) {
- return -1;
- }
-
---
-2.52.0
-
diff --git a/kvm-hw-intc-Generalize-APIC-helper-names-from-kvm_-to-ac.patch b/kvm-hw-intc-Generalize-APIC-helper-names-from-kvm_-to-ac.patch
deleted file mode 100644
index 09dbaef..0000000
--- a/kvm-hw-intc-Generalize-APIC-helper-names-from-kvm_-to-ac.patch
+++ /dev/null
@@ -1,386 +0,0 @@
-From ea903da8f0546ded20f84a3c4f46139a8206609e Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:24 +0200
-Subject: [PATCH 06/32] hw/intc: Generalize APIC helper names from kvm_* to
- accel_*
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [4/30] 2622233d15ed5138cb143d2a5b54fb05c8574654
-
-Rename APIC helper functions to use an accel_* prefix instead of kvm_*
-to support use by accelerators other than KVM. This is a preparatory
-step for integrating MSHV support with common APIC logic.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-5-magnuskulke@linux.microsoft.com
-[Remove dead definition of mshv_msi_via_irqfd_enabled. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 638ac1c78457dd93ccd795b9c6c2673af8c7dd21)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- accel/accel-irq.c | 106 +++++++++++++++++++++++++++++++++++++
- accel/meson.build | 2 +-
- hw/intc/ioapic.c | 20 ++++---
- hw/virtio/virtio-pci.c | 21 ++++----
- include/system/accel-irq.h | 37 +++++++++++++
- include/system/mshv.h | 17 ++++++
- 6 files changed, 185 insertions(+), 18 deletions(-)
- create mode 100644 accel/accel-irq.c
- create mode 100644 include/system/accel-irq.h
-
-diff --git a/accel/accel-irq.c b/accel/accel-irq.c
-new file mode 100644
-index 0000000000..7f864e35c4
---- /dev/null
-+++ b/accel/accel-irq.c
-@@ -0,0 +1,106 @@
-+/*
-+ * Accelerated irqchip abstraction
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * Authors: Ziqiao Zhou <ziqiaozhou@microsoft.com>
-+ * Magnus Kulke <magnuskulke@microsoft.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#include "qemu/osdep.h"
-+#include "hw/pci/msi.h"
-+
-+#include "system/kvm.h"
-+#include "system/mshv.h"
-+#include "system/accel-irq.h"
-+
-+int accel_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev)
-+{
-+#ifdef CONFIG_MSHV_IS_POSSIBLE
-+ if (mshv_msi_via_irqfd_enabled()) {
-+ return mshv_irqchip_add_msi_route(vector, dev);
-+ }
-+#endif
-+ if (kvm_enabled()) {
-+ return kvm_irqchip_add_msi_route(c, vector, dev);
-+ }
-+ return -ENOSYS;
-+}
-+
-+int accel_irqchip_update_msi_route(int vector, MSIMessage msg, PCIDevice *dev)
-+{
-+#ifdef CONFIG_MSHV_IS_POSSIBLE
-+ if (mshv_msi_via_irqfd_enabled()) {
-+ return mshv_irqchip_update_msi_route(vector, msg, dev);
-+ }
-+#endif
-+ if (kvm_enabled()) {
-+ return kvm_irqchip_update_msi_route(kvm_state, vector, msg, dev);
-+ }
-+ return -ENOSYS;
-+}
-+
-+void accel_irqchip_commit_route_changes(KVMRouteChange *c)
-+{
-+#ifdef CONFIG_MSHV_IS_POSSIBLE
-+ if (mshv_msi_via_irqfd_enabled()) {
-+ mshv_irqchip_commit_routes();
-+ }
-+#endif
-+ if (kvm_enabled()) {
-+ kvm_irqchip_commit_route_changes(c);
-+ }
-+}
-+
-+void accel_irqchip_commit_routes(void)
-+{
-+#ifdef CONFIG_MSHV_IS_POSSIBLE
-+ if (mshv_msi_via_irqfd_enabled()) {
-+ mshv_irqchip_commit_routes();
-+ }
-+#endif
-+ if (kvm_enabled()) {
-+ kvm_irqchip_commit_routes(kvm_state);
-+ }
-+}
-+
-+void accel_irqchip_release_virq(int virq)
-+{
-+#ifdef CONFIG_MSHV_IS_POSSIBLE
-+ if (mshv_msi_via_irqfd_enabled()) {
-+ mshv_irqchip_release_virq(virq);
-+ }
-+#endif
-+ if (kvm_enabled()) {
-+ kvm_irqchip_release_virq(kvm_state, virq);
-+ }
-+}
-+
-+int accel_irqchip_add_irqfd_notifier_gsi(EventNotifier *n, EventNotifier *rn,
-+ int virq)
-+{
-+#ifdef CONFIG_MSHV_IS_POSSIBLE
-+ if (mshv_msi_via_irqfd_enabled()) {
-+ return mshv_irqchip_add_irqfd_notifier_gsi(n, rn, virq);
-+ }
-+#endif
-+ if (kvm_enabled()) {
-+ return kvm_irqchip_add_irqfd_notifier_gsi(kvm_state, n, rn, virq);
-+ }
-+ return -ENOSYS;
-+}
-+
-+int accel_irqchip_remove_irqfd_notifier_gsi(EventNotifier *n, int virq)
-+{
-+#ifdef CONFIG_MSHV_IS_POSSIBLE
-+ if (mshv_msi_via_irqfd_enabled()) {
-+ return mshv_irqchip_remove_irqfd_notifier_gsi(n, virq);
-+ }
-+#endif
-+ if (kvm_enabled()) {
-+ return kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, n, virq);
-+ }
-+ return -ENOSYS;
-+}
-diff --git a/accel/meson.build b/accel/meson.build
-index 25b0f100b5..6349efe682 100644
---- a/accel/meson.build
-+++ b/accel/meson.build
-@@ -1,6 +1,6 @@
- common_ss.add(files('accel-common.c'))
- specific_ss.add(files('accel-target.c'))
--system_ss.add(files('accel-system.c', 'accel-blocker.c', 'accel-qmp.c'))
-+system_ss.add(files('accel-system.c', 'accel-blocker.c', 'accel-qmp.c', 'accel-irq.c'))
- user_ss.add(files('accel-user.c'))
-
- subdir('tcg')
-diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
-index 133bef852d..e431d00311 100644
---- a/hw/intc/ioapic.c
-+++ b/hw/intc/ioapic.c
-@@ -30,12 +30,18 @@
- #include "hw/intc/ioapic_internal.h"
- #include "hw/pci/msi.h"
- #include "hw/qdev-properties.h"
-+#include "system/accel-irq.h"
- #include "system/kvm.h"
- #include "system/system.h"
- #include "hw/i386/apic-msidef.h"
- #include "hw/i386/x86-iommu.h"
- #include "trace.h"
-
-+
-+#if defined(CONFIG_KVM) || defined(CONFIG_MSHV)
-+#define ACCEL_GSI_IRQFD_POSSIBLE
-+#endif
-+
- #define APIC_DELIVERY_MODE_SHIFT 8
- #define APIC_POLARITY_SHIFT 14
- #define APIC_TRIG_MODE_SHIFT 15
-@@ -191,10 +197,10 @@ static void ioapic_set_irq(void *opaque, int vector, int level)
-
- static void ioapic_update_kvm_routes(IOAPICCommonState *s)
- {
--#ifdef CONFIG_KVM
-+#ifdef ACCEL_GSI_IRQFD_POSSIBLE
- int i;
-
-- if (kvm_irqchip_is_split()) {
-+ if (accel_irqchip_is_split()) {
- for (i = 0; i < IOAPIC_NUM_PINS; i++) {
- MSIMessage msg;
- struct ioapic_entry_info info;
-@@ -202,15 +208,15 @@ static void ioapic_update_kvm_routes(IOAPICCommonState *s)
- if (!info.masked) {
- msg.address = info.addr;
- msg.data = info.data;
-- kvm_irqchip_update_msi_route(kvm_state, i, msg, NULL);
-+ accel_irqchip_update_msi_route(i, msg, NULL);
- }
- }
-- kvm_irqchip_commit_routes(kvm_state);
-+ accel_irqchip_commit_routes();
- }
- #endif
- }
-
--#ifdef CONFIG_KVM
-+#ifdef ACCEL_KERNEL_GSI_IRQFD_POSSIBLE
- static void ioapic_iec_notifier(void *private, bool global,
- uint32_t index, uint32_t mask)
- {
-@@ -428,11 +434,11 @@ static const MemoryRegionOps ioapic_io_ops = {
-
- static void ioapic_machine_done_notify(Notifier *notifier, void *data)
- {
--#ifdef CONFIG_KVM
-+#ifdef ACCEL_KERNEL_GSI_IRQFD_POSSIBLE
- IOAPICCommonState *s = container_of(notifier, IOAPICCommonState,
- machine_done);
-
-- if (kvm_irqchip_is_split()) {
-+ if (accel_irqchip_is_split()) {
- X86IOMMUState *iommu = x86_iommu_get_default();
- if (iommu) {
- /* Register this IOAPIC with IOMMU IEC notifier, so that
-diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
-index 767216d795..0cdc16217f 100644
---- a/hw/virtio/virtio-pci.c
-+++ b/hw/virtio/virtio-pci.c
-@@ -34,6 +34,7 @@
- #include "hw/pci/msi.h"
- #include "hw/pci/msix.h"
- #include "hw/loader.h"
-+#include "system/accel-irq.h"
- #include "system/kvm.h"
- #include "hw/virtio/virtio-pci.h"
- #include "qemu/range.h"
-@@ -825,11 +826,11 @@ static int kvm_virtio_pci_vq_vector_use(VirtIOPCIProxy *proxy,
-
- if (irqfd->users == 0) {
- KVMRouteChange c = kvm_irqchip_begin_route_changes(kvm_state);
-- ret = kvm_irqchip_add_msi_route(&c, vector, &proxy->pci_dev);
-+ ret = accel_irqchip_add_msi_route(&c, vector, &proxy->pci_dev);
- if (ret < 0) {
- return ret;
- }
-- kvm_irqchip_commit_route_changes(&c);
-+ accel_irqchip_commit_route_changes(&c);
- irqfd->virq = ret;
- }
- irqfd->users++;
-@@ -841,7 +842,7 @@ static void kvm_virtio_pci_vq_vector_release(VirtIOPCIProxy *proxy,
- {
- VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
- if (--irqfd->users == 0) {
-- kvm_irqchip_release_virq(kvm_state, irqfd->virq);
-+ accel_irqchip_release_virq(irqfd->virq);
- }
- }
-
-@@ -850,7 +851,7 @@ static int kvm_virtio_pci_irqfd_use(VirtIOPCIProxy *proxy,
- unsigned int vector)
- {
- VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
-- return kvm_irqchip_add_irqfd_notifier_gsi(kvm_state, n, NULL, irqfd->virq);
-+ return accel_irqchip_add_irqfd_notifier_gsi(n, NULL, irqfd->virq);
- }
-
- static void kvm_virtio_pci_irqfd_release(VirtIOPCIProxy *proxy,
-@@ -860,7 +861,7 @@ static void kvm_virtio_pci_irqfd_release(VirtIOPCIProxy *proxy,
- VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
- int ret;
-
-- ret = kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, n, irqfd->virq);
-+ ret = accel_irqchip_remove_irqfd_notifier_gsi(n, irqfd->virq);
- assert(ret == 0);
- }
- static int virtio_pci_get_notifier(VirtIOPCIProxy *proxy, int queue_no,
-@@ -995,12 +996,12 @@ static int virtio_pci_one_vector_unmask(VirtIOPCIProxy *proxy,
- if (proxy->vector_irqfd) {
- irqfd = &proxy->vector_irqfd[vector];
- if (irqfd->msg.data != msg.data || irqfd->msg.address != msg.address) {
-- ret = kvm_irqchip_update_msi_route(kvm_state, irqfd->virq, msg,
-- &proxy->pci_dev);
-+ ret = accel_irqchip_update_msi_route(irqfd->virq, msg,
-+ &proxy->pci_dev);
- if (ret < 0) {
- return ret;
- }
-- kvm_irqchip_commit_routes(kvm_state);
-+ accel_irqchip_commit_routes();
- }
- }
-
-@@ -1229,7 +1230,7 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign)
- VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
- int r, n;
- bool with_irqfd = msix_enabled(&proxy->pci_dev) &&
-- kvm_msi_via_irqfd_enabled();
-+ accel_msi_via_irqfd_enabled() ;
-
- nvqs = MIN(nvqs, VIRTIO_QUEUE_MAX);
-
-@@ -1433,7 +1434,7 @@ static void virtio_pci_set_vector(VirtIODevice *vdev,
- uint16_t new_vector)
- {
- bool kvm_irqfd = (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) &&
-- msix_enabled(&proxy->pci_dev) && kvm_msi_via_irqfd_enabled();
-+ msix_enabled(&proxy->pci_dev) && accel_msi_via_irqfd_enabled();
-
- if (new_vector == old_vector) {
- return;
-diff --git a/include/system/accel-irq.h b/include/system/accel-irq.h
-new file mode 100644
-index 0000000000..671fb7dfdb
---- /dev/null
-+++ b/include/system/accel-irq.h
-@@ -0,0 +1,37 @@
-+/*
-+ * Accelerated irqchip abstraction
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * Authors: Ziqiao Zhou <ziqiaozhou@microsoft.com>
-+ * Magnus Kulke <magnuskulke@microsoft.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#ifndef SYSTEM_ACCEL_IRQ_H
-+#define SYSTEM_ACCEL_IRQ_H
-+#include "hw/pci/msi.h"
-+#include "qemu/osdep.h"
-+#include "system/kvm.h"
-+#include "system/mshv.h"
-+
-+static inline bool accel_msi_via_irqfd_enabled(void)
-+{
-+ return mshv_msi_via_irqfd_enabled() || kvm_msi_via_irqfd_enabled();
-+}
-+
-+static inline bool accel_irqchip_is_split(void)
-+{
-+ return mshv_msi_via_irqfd_enabled() || kvm_irqchip_is_split();
-+}
-+
-+int accel_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev);
-+int accel_irqchip_update_msi_route(int vector, MSIMessage msg, PCIDevice *dev);
-+void accel_irqchip_commit_route_changes(KVMRouteChange *c);
-+void accel_irqchip_commit_routes(void);
-+void accel_irqchip_release_virq(int virq);
-+int accel_irqchip_add_irqfd_notifier_gsi(EventNotifier *n, EventNotifier *rn,
-+ int virq);
-+int accel_irqchip_remove_irqfd_notifier_gsi(EventNotifier *n, int virq);
-+#endif
-diff --git a/include/system/mshv.h b/include/system/mshv.h
-index 342f1ef6a9..2a504ed81f 100644
---- a/include/system/mshv.h
-+++ b/include/system/mshv.h
-@@ -22,4 +22,21 @@
- #define CONFIG_MSHV_IS_POSSIBLE
- #endif
-
-+#ifdef CONFIG_MSHV_IS_POSSIBLE
-+extern bool mshv_allowed;
-+#define mshv_enabled() (mshv_allowed)
-+#else /* CONFIG_MSHV_IS_POSSIBLE */
-+#define mshv_enabled() false
-+#endif
-+#define mshv_msi_via_irqfd_enabled() false
-+
-+/* interrupt */
-+int mshv_irqchip_add_msi_route(int vector, PCIDevice *dev);
-+int mshv_irqchip_update_msi_route(int virq, MSIMessage msg, PCIDevice *dev);
-+void mshv_irqchip_commit_routes(void);
-+void mshv_irqchip_release_virq(int virq);
-+int mshv_irqchip_add_irqfd_notifier_gsi(const EventNotifier *n,
-+ const EventNotifier *rn, int virq);
-+int mshv_irqchip_remove_irqfd_notifier_gsi(const EventNotifier *n, int virq);
-+
- #endif
---
-2.47.3
-
diff --git a/kvm-hw-intc-ioapic-Fix-ACCEL_KERNEL_GSI_IRQFD_POSSIBLE-t.patch b/kvm-hw-intc-ioapic-Fix-ACCEL_KERNEL_GSI_IRQFD_POSSIBLE-t.patch
deleted file mode 100644
index fc1797d..0000000
--- a/kvm-hw-intc-ioapic-Fix-ACCEL_KERNEL_GSI_IRQFD_POSSIBLE-t.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From 7ecba7856c08f410391ccb12620aeb304d800815 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
-Date: Thu, 6 Nov 2025 11:51:48 +0100
-Subject: [PATCH 3/4] hw/intc/ioapic: Fix ACCEL_KERNEL_GSI_IRQFD_POSSIBLE typo
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Cédric Le Goater <clg@redhat.com>
-RH-MergeRequest: 449: hw/intc/ioapic: Fix ACCEL_KERNEL_GSI_IRQFD_POSSIBLE typo
-RH-Jira: RHEL-139028
-RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/1] 61c1a3f68e0a5403a90f1d1f2cb793cc83e0cea9 (clegoate/qemu-kvm-centos)
-
-Commit 638ac1c78457 introduced a regression in interrupt remapping
-when running a VM configured with an intel-iommu device and an
-assigned PCI VF. During boot, Linux reports repeated messages :
-
- [ 15.416794] __common_interrupt: 2.37 No irq handler for vector
- [ 15.417266] __common_interrupt: 2.37 No irq handler for vector
- [ 15.417733] __common_interrupt: 2.37 No irq handler for vector
- [ 15.418202] __common_interrupt: 2.37 No irq handler for vector
- [ 15.418670] __common_interrupt: 2.37 No irq handler for vector
-
-and may eventually hang.
-
-The issue is caused by the incorrect use of the macro
-ACCEL_KERNEL_GSI_IRQFD_POSSIBLE, which should instead be
-ACCEL_GSI_IRQFD_POSSIBLE.
-
-Fixes: 638ac1c78457 ("hw/intc: Generalize APIC helper names from kvm_* to accel_*")
-Cc: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Message-ID: <20251106105148.737093-1-clg@redhat.com>
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-(cherry picked from commit 3abfbb571143ba865488b6c11f8ad75dda97d1a3)
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
----
- hw/intc/ioapic.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
-index e431d00311..38e4384648 100644
---- a/hw/intc/ioapic.c
-+++ b/hw/intc/ioapic.c
-@@ -216,7 +216,7 @@ static void ioapic_update_kvm_routes(IOAPICCommonState *s)
- #endif
- }
-
--#ifdef ACCEL_KERNEL_GSI_IRQFD_POSSIBLE
-+#ifdef ACCEL_GSI_IRQFD_POSSIBLE
- static void ioapic_iec_notifier(void *private, bool global,
- uint32_t index, uint32_t mask)
- {
-@@ -434,7 +434,7 @@ static const MemoryRegionOps ioapic_io_ops = {
-
- static void ioapic_machine_done_notify(Notifier *notifier, void *data)
- {
--#ifdef ACCEL_KERNEL_GSI_IRQFD_POSSIBLE
-+#ifdef ACCEL_GSI_IRQFD_POSSIBLE
- IOAPICCommonState *s = container_of(notifier, IOAPICCommonState,
- machine_done);
-
---
-2.47.3
-
diff --git a/kvm-hw-pci-Add-helper-to-insert-PCIe-extended-capability.patch b/kvm-hw-pci-Add-helper-to-insert-PCIe-extended-capability.patch
deleted file mode 100644
index 9ec6151..0000000
--- a/kvm-hw-pci-Add-helper-to-insert-PCIe-extended-capability.patch
+++ /dev/null
@@ -1,144 +0,0 @@
-From 3e612715c478cb8707e854e1c775485598ab1316 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 042/111] hw/pci: Add helper to insert PCIe extended capability
- at a fixed offset
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [42/111] a442c70c88c172c341736a6cab31e11622ff9c75 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Add pcie_insert_capability(), a helper to insert a PCIe extended
-capability into an existing extended capability list at a caller
-specified offset.
-
-Unlike pcie_add_capability(), which always appends a capability to the
-end of the list, this helper preserves the existing list ordering while
-allowing insertion at an arbitrary offset.
-
-The helper only validates that the insertion does not overwrite an
-existing PCIe extended capability header, since corrupting a header
-would break the extended capability linked list. Validation of overlaps
-with other configuration space registers or capability-specific
-register blocks is left to the caller.
-
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Message-id: 20260126104342.253965-35-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 49a2bed19b0e4e68bdc06e6c37532313193e766c)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/pci/pcie.c | 69 +++++++++++++++++++++++++++++++++++++++++++
- include/hw/pci/pcie.h | 2 ++
- 2 files changed, 71 insertions(+)
-
-diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
-index eaeb68894e..348b26e4f1 100644
---- a/hw/pci/pcie.c
-+++ b/hw/pci/pcie.c
-@@ -1050,6 +1050,75 @@ static void pcie_ext_cap_set_next(PCIDevice *dev, uint16_t pos, uint16_t next)
- pci_set_long(dev->config + pos, header);
- }
-
-+/*
-+ * Insert a PCIe extended capability at a given offset.
-+ *
-+ * This helper only validates that the insertion does not overwrite an
-+ * existing PCIe extended capability header, as corrupting a header would
-+ * break the extended capability linked list.
-+ *
-+ * The caller must ensure that (offset, size) does not overlap with other
-+ * registers or capability-specific register blocks. Overlaps with
-+ * capability-specific registers are not checked and are considered a
-+ * user-controlled override.
-+ *
-+ * Note: Best effort helper. The PCIe spec does not require extended
-+ * capabilities to be ordered, but most devices use a forward-linked list.
-+ * Devices that do not consistently use a forward-linked list may cause
-+ * insertion to fail.
-+ */
-+bool pcie_insert_capability(PCIDevice *dev, uint16_t cap_id, uint8_t cap_ver,
-+ uint16_t offset, uint16_t size)
-+{
-+ uint16_t pos = PCI_CONFIG_SPACE_SIZE, prev = 0;
-+ uint32_t header;
-+
-+ assert(pci_is_express(dev));
-+
-+ if (!QEMU_IS_ALIGNED(offset, PCI_EXT_CAP_ALIGN) ||
-+ size < 8 ||
-+ offset < PCI_CONFIG_SPACE_SIZE ||
-+ offset >= PCIE_CONFIG_SPACE_SIZE ||
-+ offset + size > PCIE_CONFIG_SPACE_SIZE) {
-+ return false;
-+ }
-+
-+ header = pci_get_long(dev->config + pos);
-+ if (!header) {
-+ /* No extended capability present, insertion must be at the ECAP head */
-+ if (offset != pos) {
-+ return false;
-+ }
-+ pci_set_long(dev->config + pos, PCI_EXT_CAP(cap_id, cap_ver, 0));
-+ goto out;
-+ }
-+
-+ while (header && pos && offset >= pos) {
-+ uint16_t next = PCI_EXT_CAP_NEXT(header);
-+
-+ /* Reject insertion inside an existing ECAP header (4 bytes) */
-+ if (offset < pos + PCI_EXT_CAP_ALIGN) {
-+ return false;
-+ }
-+
-+ prev = pos;
-+ pos = next;
-+ header = pos ? pci_get_long(dev->config + pos) : 0;
-+ }
-+
-+ pci_set_long(dev->config + offset, PCI_EXT_CAP(cap_id, cap_ver, pos));
-+ if (prev) {
-+ pcie_ext_cap_set_next(dev, prev, offset);
-+ }
-+
-+out:
-+ /* Make capability read-only by default */
-+ memset(dev->wmask + offset, 0, size);
-+ memset(dev->w1cmask + offset, 0, size);
-+ /* Check capability by default */
-+ memset(dev->cmask + offset, 0xFF, size);
-+ return true;
-+}
- /*
- * Caller must supply valid (offset, size) such that the range wouldn't
- * overlap with other capability or other registers.
-diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h
-index ff6ce08e13..3d01718c96 100644
---- a/include/hw/pci/pcie.h
-+++ b/include/hw/pci/pcie.h
-@@ -133,6 +133,8 @@ uint16_t pcie_find_capability(PCIDevice *dev, uint16_t cap_id);
- void pcie_add_capability(PCIDevice *dev,
- uint16_t cap_id, uint8_t cap_ver,
- uint16_t offset, uint16_t size);
-+bool pcie_insert_capability(PCIDevice *dev, uint16_t cap_id, uint8_t cap_ver,
-+ uint16_t offset, uint16_t size);
- void pcie_sync_bridge_lnk(PCIDevice *dev);
-
- void pcie_acs_init(PCIDevice *dev, uint16_t offset);
---
-2.52.0
-
diff --git a/kvm-hw-pci-Export-pci_device_get_iommu_bus_devfn-and-ret.patch b/kvm-hw-pci-Export-pci_device_get_iommu_bus_devfn-and-ret.patch
deleted file mode 100644
index 796e993..0000000
--- a/kvm-hw-pci-Export-pci_device_get_iommu_bus_devfn-and-ret.patch
+++ /dev/null
@@ -1,99 +0,0 @@
-From 557603fab8b9a836d4a00e5c0a169b581b21c526 Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Tue, 6 Jan 2026 01:12:46 -0500
-Subject: [PATCH 010/111] hw/pci: Export pci_device_get_iommu_bus_devfn() and
- return bool
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [10/111] eaed17d04b1a47b5101c99ca8066769b1fcc0ba7 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Returns true if PCI device is aliased or false otherwise. This will be
-used in following patch to determine if a PCI device is under a PCI
-bridge.
-
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20260106061304.314546-5-zhenzhong.duan@intel.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit d58230d8754fedf6fc7313e0faa25bb5edc5ba2e)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/pci/pci.c | 12 ++++++++----
- include/hw/pci/pci.h | 2 ++
- 2 files changed, 10 insertions(+), 4 deletions(-)
-
-diff --git a/hw/pci/pci.c b/hw/pci/pci.c
-index a8eeafd3b2..15dd232cf8 100644
---- a/hw/pci/pci.c
-+++ b/hw/pci/pci.c
-@@ -2855,20 +2855,21 @@ static void pci_device_class_base_init(ObjectClass *klass, const void *data)
- * For call sites which don't need aliased BDF, passing NULL to
- * aliased_[bus|devfn] is allowed.
- *
-+ * Returns true if PCI device RID is aliased or false otherwise.
-+ *
- * @piommu_bus: return root #PCIBus backed by an IOMMU for the PCI device.
- *
- * @aliased_bus: return aliased #PCIBus of the PCI device, optional.
- *
- * @aliased_devfn: return aliased devfn of the PCI device, optional.
- */
--static void pci_device_get_iommu_bus_devfn(PCIDevice *dev,
-- PCIBus **piommu_bus,
-- PCIBus **aliased_bus,
-- int *aliased_devfn)
-+bool pci_device_get_iommu_bus_devfn(PCIDevice *dev, PCIBus **piommu_bus,
-+ PCIBus **aliased_bus, int *aliased_devfn)
- {
- PCIBus *bus = pci_get_bus(dev);
- PCIBus *iommu_bus = bus;
- int devfn = dev->devfn;
-+ bool aliased = false;
-
- while (iommu_bus && !iommu_bus->iommu_ops && iommu_bus->parent_dev) {
- PCIBus *parent_bus = pci_get_bus(iommu_bus->parent_dev);
-@@ -2905,6 +2906,7 @@ static void pci_device_get_iommu_bus_devfn(PCIDevice *dev,
- devfn = parent->devfn;
- bus = parent_bus;
- }
-+ aliased = true;
- }
-
- /*
-@@ -2939,6 +2941,8 @@ static void pci_device_get_iommu_bus_devfn(PCIDevice *dev,
- if (aliased_devfn) {
- *aliased_devfn = devfn;
- }
-+
-+ return aliased;
- }
-
- AddressSpace *pci_device_iommu_address_space(PCIDevice *dev)
-diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
-index 6bccb25ac2..bde9dca8e2 100644
---- a/include/hw/pci/pci.h
-+++ b/include/hw/pci/pci.h
-@@ -637,6 +637,8 @@ typedef struct PCIIOMMUOps {
- bool is_write);
- } PCIIOMMUOps;
-
-+bool pci_device_get_iommu_bus_devfn(PCIDevice *dev, PCIBus **piommu_bus,
-+ PCIBus **aliased_bus, int *aliased_devfn);
- AddressSpace *pci_device_iommu_address_space(PCIDevice *dev);
- bool pci_device_set_iommu_device(PCIDevice *dev, HostIOMMUDevice *hiod,
- Error **errp);
---
-2.52.0
-
diff --git a/kvm-hw-pci-Factor-out-common-PASID-capability-initializa.patch b/kvm-hw-pci-Factor-out-common-PASID-capability-initializa.patch
deleted file mode 100644
index 87eac08..0000000
--- a/kvm-hw-pci-Factor-out-common-PASID-capability-initializa.patch
+++ /dev/null
@@ -1,101 +0,0 @@
-From 980df3009788a6c4e449c98caecf117f50820753 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 043/111] hw/pci: Factor out common PASID capability
- initialization
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [43/111] 1016e3b1598c9595a0b7ea324a44d84d53fd807e (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Refactor PCIe PASID capability initialization by moving the common
-register init into a new helper, pcie_pasid_common_init().
-
-Subsequent patch to synthesize a vPASID will make use of this
-helper.
-
-No functional change intended.
-
-Cc: Michael S. Tsirkin <mst@redhat.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Message-id: 20260126104342.253965-36-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 7d59fa20594ec053861f7c49ac53090a41901209)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/pci/pcie.c | 19 ++++++++++++-------
- include/hw/pci/pcie.h | 2 ++
- 2 files changed, 14 insertions(+), 7 deletions(-)
-
-diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
-index 348b26e4f1..40242fead2 100644
---- a/hw/pci/pcie.c
-+++ b/hw/pci/pcie.c
-@@ -1284,18 +1284,13 @@ void pcie_acs_reset(PCIDevice *dev)
- }
- }
-
--/* PASID */
--void pcie_pasid_init(PCIDevice *dev, uint16_t offset, uint8_t pasid_width,
-- bool exec_perm, bool priv_mod)
-+void pcie_pasid_common_init(PCIDevice *dev, uint16_t offset,
-+ uint8_t pasid_width, bool exec_perm, bool priv_mod)
- {
- static const uint16_t control_reg_rw_mask = 0x07;
- uint16_t capability_reg;
-
- assert(pasid_width <= PCI_EXT_CAP_PASID_MAX_WIDTH);
--
-- pcie_add_capability(dev, PCI_EXT_CAP_ID_PASID, PCI_PASID_VER, offset,
-- PCI_EXT_CAP_PASID_SIZEOF);
--
- capability_reg = ((uint16_t)pasid_width) << PCI_PASID_CAP_WIDTH_SHIFT;
- capability_reg |= exec_perm ? PCI_PASID_CAP_EXEC : 0;
- capability_reg |= priv_mod ? PCI_PASID_CAP_PRIV : 0;
-@@ -1307,6 +1302,16 @@ void pcie_pasid_init(PCIDevice *dev, uint16_t offset, uint8_t pasid_width,
- pci_set_word(dev->wmask + offset + PCI_PASID_CTRL, control_reg_rw_mask);
-
- dev->exp.pasid_cap = offset;
-+
-+}
-+
-+/* PASID */
-+void pcie_pasid_init(PCIDevice *dev, uint16_t offset, uint8_t pasid_width,
-+ bool exec_perm, bool priv_mod)
-+{
-+ pcie_add_capability(dev, PCI_EXT_CAP_ID_PASID, PCI_PASID_VER, offset,
-+ PCI_EXT_CAP_PASID_SIZEOF);
-+ pcie_pasid_common_init(dev, offset, pasid_width, exec_perm, priv_mod);
- }
-
- /* PRI */
-diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h
-index 3d01718c96..029a809ae2 100644
---- a/include/hw/pci/pcie.h
-+++ b/include/hw/pci/pcie.h
-@@ -155,6 +155,8 @@ void pcie_cap_slot_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
- void pcie_cap_slot_unplug_request_cb(HotplugHandler *hotplug_dev,
- DeviceState *dev, Error **errp);
-
-+void pcie_pasid_common_init(PCIDevice *dev, uint16_t offset,
-+ uint8_t pasid_width, bool exec_perm, bool priv_mod);
- void pcie_pasid_init(PCIDevice *dev, uint16_t offset, uint8_t pasid_width,
- bool exec_perm, bool priv_mod);
- void pcie_pri_init(PCIDevice *dev, uint16_t offset, uint32_t outstanding_pr_cap,
---
-2.52.0
-
diff --git a/kvm-hw-pci-Introduce-pci_device_get_host_iommu_quirks.patch b/kvm-hw-pci-Introduce-pci_device_get_host_iommu_quirks.patch
deleted file mode 100644
index 1bd9475..0000000
--- a/kvm-hw-pci-Introduce-pci_device_get_host_iommu_quirks.patch
+++ /dev/null
@@ -1,130 +0,0 @@
-From dc2391bb200e6ab3c38d76db46919ff4bd7c3e60 Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Tue, 6 Jan 2026 01:28:03 -0500
-Subject: [PATCH 016/111] hw/pci: Introduce pci_device_get_host_iommu_quirks()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [16/111] dd4f09360ae6171c7faf6f18af2f6c66367189f7 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-In VFIO core, we call iommufd_backend_get_device_info() to return vendor
-specific hardware information data, but it's not good to retrieve this raw
-data in VFIO core.
-
-Introduce a new PCIIOMMUOps optional callback, get_host_iommu_quirk() which
-allows to retrieve the vendor specific hardware information data and convert
-it into bitmaps defined with enum host_iommu_quirks.
-
-pci_device_get_host_iommu_quirks() is a wrapper that can be called on a PCI
-device potentially protected by a vIOMMU.
-
-Suggested-by: Eric Auger <eric.auger@redhat.com>
-Suggested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Link: https://lore.kernel.org/qemu-devel/20260106062808.316574-2-zhenzhong.duan@intel.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit cd4d7fb72109043d60b5cf6191a1678e96775b98)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/pci/pci.c | 12 ++++++++++++
- include/hw/core/iommu.h | 5 +++++
- include/hw/pci/pci.h | 31 +++++++++++++++++++++++++++++++
- 3 files changed, 48 insertions(+)
-
-diff --git a/hw/pci/pci.c b/hw/pci/pci.c
-index 27bb2285d4..1f2d4d76f9 100644
---- a/hw/pci/pci.c
-+++ b/hw/pci/pci.c
-@@ -3038,6 +3038,18 @@ uint64_t pci_device_get_viommu_flags(PCIDevice *dev)
- return 0;
- }
-
-+uint64_t pci_device_get_host_iommu_quirks(PCIDevice *dev, uint32_t type,
-+ void *caps, uint32_t size)
-+{
-+ PCIBus *iommu_bus;
-+
-+ pci_device_get_iommu_bus_devfn(dev, &iommu_bus, NULL, NULL);
-+ if (iommu_bus && iommu_bus->iommu_ops->get_host_iommu_quirks) {
-+ return iommu_bus->iommu_ops->get_host_iommu_quirks(type, caps, size);
-+ }
-+ return 0;
-+}
-+
- int pci_pri_request_page(PCIDevice *dev, uint32_t pasid, bool priv_req,
- bool exec_req, hwaddr addr, bool lpig,
- uint16_t prgi, bool is_read, bool is_write)
-diff --git a/include/hw/core/iommu.h b/include/hw/core/iommu.h
-index fcbbcd1015..d5401a397b 100644
---- a/include/hw/core/iommu.h
-+++ b/include/hw/core/iommu.h
-@@ -22,4 +22,9 @@ enum viommu_flags {
- VIOMMU_FLAG_WANT_NESTING_PARENT = BIT_ULL(0),
- };
-
-+/* Host IOMMU quirks. Extracted from host IOMMU capabilities */
-+enum host_iommu_quirks {
-+ HOST_IOMMU_QUIRK_NESTING_PARENT_BYPASS_RO = BIT_ULL(0),
-+};
-+
- #endif /* HW_IOMMU_H */
-diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
-index 299e7f94da..528faafad2 100644
---- a/include/hw/pci/pci.h
-+++ b/include/hw/pci/pci.h
-@@ -493,6 +493,23 @@ typedef struct PCIIOMMUOps {
- * enum viommu_flags.
- */
- uint64_t (*get_viommu_flags)(void *opaque);
-+ /**
-+ * @get_host_iommu_quirks: get host IOMMU quirks
-+ *
-+ * Optional callback, if not implemented, then vIOMMU doesn't support
-+ * converting @type specific hardware information data into a standard
-+ * bitmap format.
-+ *
-+ * @type: IOMMU hardware info type
-+ *
-+ * @caps: IOMMU @type specific hardware information data
-+ *
-+ * @size: size of @caps
-+ *
-+ * Returns: bitmap with each bit representing a host IOMMU quirk defined in
-+ * enum host_iommu_quirks
-+ */
-+ uint64_t (*get_host_iommu_quirks)(uint32_t type, void *caps, uint32_t size);
- /**
- * @get_iotlb_info: get properties required to initialize a device IOTLB.
- *
-@@ -685,6 +702,20 @@ void pci_device_unset_iommu_device(PCIDevice *dev);
- */
- uint64_t pci_device_get_viommu_flags(PCIDevice *dev);
-
-+/**
-+ * pci_device_get_host_iommu_quirks: get host IOMMU quirks.
-+ *
-+ * Returns: bitmap with each bit representing a host IOMMU quirk defined in
-+ * enum host_iommu_quirks. Or 0 if vIOMMU doesn't convert any.
-+ *
-+ * @dev: PCI device pointer.
-+ * @type: IOMMU hardware info type
-+ * @caps: IOMMU @type specific hardware information data
-+ * @size: size of @caps
-+ */
-+uint64_t pci_device_get_host_iommu_quirks(PCIDevice *dev, uint32_t type,
-+ void *caps, uint32_t size);
-+
- /**
- * pci_iommu_get_iotlb_info: get properties required to initialize a
- * device IOTLB.
---
-2.52.0
-
diff --git a/kvm-hw-pci-Introduce-pci_device_get_viommu_flags.patch b/kvm-hw-pci-Introduce-pci_device_get_viommu_flags.patch
deleted file mode 100644
index 5593623..0000000
--- a/kvm-hw-pci-Introduce-pci_device_get_viommu_flags.patch
+++ /dev/null
@@ -1,177 +0,0 @@
-From 299e2a06b1166b9d942ccf0e49703916b6a5028d Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Tue, 6 Jan 2026 01:12:47 -0500
-Subject: [PATCH 015/111] hw/pci: Introduce pci_device_get_viommu_flags()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [15/111] ccbb01571d6c2e1c9ac51e05098649748bc7a8b6 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Introduce a new PCIIOMMUOps optional callback, get_viommu_flags() which
-allows to retrieve flags exposed by a vIOMMU. The first planned vIOMMU
-device flag is VIOMMU_FLAG_WANT_NESTING_PARENT that advertises the
-support of HW nested stage translation scheme and wants other sub-system
-like VFIO's cooperation to create nesting parent HWPT.
-
-pci_device_get_viommu_flags() is a wrapper that can be called on a PCI
-device potentially protected by a vIOMMU.
-
-get_viommu_flags() is designed to return 64bit bitmap of purely vIOMMU
-flags which are only determined by user's configuration, no host
-capabilities involved. Reasons are:
-
-1. host may has heterogeneous IOMMUs, each with different capabilities
-2. this is migration friendly, return value is consistent between source
- and target.
-
-Note that this op will be invoked at the attach_device() stage, at which
-point host IOMMU capabilities are not yet forwarded to the vIOMMU through
-the set_iommu_device() callback that will be after the attach_device().
-
-See below sequence:
-
- vfio_device_attach():
- iommufd_cdev_attach():
- pci_device_get_viommu_flags() for HW nesting cap
- create a nesting parent HWPT
- attach device to the HWPT
- vfio_device_hiod_create_and_realize() creating hiod
- ...
- pci_device_set_iommu_device(hiod)
-
-Suggested-by: Yi Liu <yi.l.liu@intel.com>
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20260106061304.314546-6-zhenzhong.duan@intel.com
-[ clg: include/hw/core/iommu.h: Changed Copyright date 2025 -> 2026 ]
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 844302bd5961d8e7a35b601495b9af8f3d26a4c8)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- MAINTAINERS | 1 +
- hw/pci/pci.c | 11 +++++++++++
- include/hw/core/iommu.h | 25 +++++++++++++++++++++++++
- include/hw/pci/pci.h | 22 ++++++++++++++++++++++
- 4 files changed, 59 insertions(+)
- create mode 100644 include/hw/core/iommu.h
-
-diff --git a/MAINTAINERS b/MAINTAINERS
-index d4696f00d7..c71f53c480 100644
---- a/MAINTAINERS
-+++ b/MAINTAINERS
-@@ -2320,6 +2320,7 @@ F: include/system/iommufd.h
- F: backends/host_iommu_device.c
- F: include/system/host_iommu_device.h
- F: include/qemu/chardev_open.h
-+F: include/hw/core/iommu.h
- F: util/chardev_open.c
- F: docs/devel/vfio-iommufd.rst
-
-diff --git a/hw/pci/pci.c b/hw/pci/pci.c
-index 141b7ad1f8..27bb2285d4 100644
---- a/hw/pci/pci.c
-+++ b/hw/pci/pci.c
-@@ -3027,6 +3027,17 @@ void pci_device_unset_iommu_device(PCIDevice *dev)
- }
- }
-
-+uint64_t pci_device_get_viommu_flags(PCIDevice *dev)
-+{
-+ PCIBus *iommu_bus;
-+
-+ pci_device_get_iommu_bus_devfn(dev, &iommu_bus, NULL, NULL);
-+ if (iommu_bus && iommu_bus->iommu_ops->get_viommu_flags) {
-+ return iommu_bus->iommu_ops->get_viommu_flags(iommu_bus->iommu_opaque);
-+ }
-+ return 0;
-+}
-+
- int pci_pri_request_page(PCIDevice *dev, uint32_t pasid, bool priv_req,
- bool exec_req, hwaddr addr, bool lpig,
- uint16_t prgi, bool is_read, bool is_write)
-diff --git a/include/hw/core/iommu.h b/include/hw/core/iommu.h
-new file mode 100644
-index 0000000000..fcbbcd1015
---- /dev/null
-+++ b/include/hw/core/iommu.h
-@@ -0,0 +1,25 @@
-+/*
-+ * General vIOMMU flags
-+ *
-+ * Copyright (C) 2026 Intel Corporation.
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#ifndef HW_IOMMU_H
-+#define HW_IOMMU_H
-+
-+#include "qemu/bitops.h"
-+
-+/*
-+ * Theoretical vIOMMU flags. Only determined by the vIOMMU device properties and
-+ * independent on the actual host IOMMU capabilities they may depend on. Each
-+ * flag can be an expectation or request to other sub-system or just a pure
-+ * vIOMMU capability. vIOMMU can choose which flags to expose.
-+ */
-+enum viommu_flags {
-+ /* vIOMMU needs nesting parent HWPT to create nested HWPT */
-+ VIOMMU_FLAG_WANT_NESTING_PARENT = BIT_ULL(0),
-+};
-+
-+#endif /* HW_IOMMU_H */
-diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
-index a19773d0f9..299e7f94da 100644
---- a/include/hw/pci/pci.h
-+++ b/include/hw/pci/pci.h
-@@ -481,6 +481,18 @@ typedef struct PCIIOMMUOps {
- * @devfn: device and function number of the PCI device.
- */
- void (*unset_iommu_device)(PCIBus *bus, void *opaque, int devfn);
-+ /**
-+ * @get_viommu_flags: get vIOMMU flags
-+ *
-+ * Optional callback, if not implemented, then vIOMMU doesn't support
-+ * exposing flags to other sub-system, e.g., VFIO.
-+ *
-+ * @opaque: the data passed to pci_setup_iommu().
-+ *
-+ * Returns: bitmap with each bit representing a vIOMMU flag defined in
-+ * enum viommu_flags.
-+ */
-+ uint64_t (*get_viommu_flags)(void *opaque);
- /**
- * @get_iotlb_info: get properties required to initialize a device IOTLB.
- *
-@@ -663,6 +675,16 @@ bool pci_device_set_iommu_device(PCIDevice *dev, HostIOMMUDevice *hiod,
- Error **errp);
- void pci_device_unset_iommu_device(PCIDevice *dev);
-
-+/**
-+ * pci_device_get_viommu_flags: get vIOMMU flags.
-+ *
-+ * Returns: bitmap with each bit representing a vIOMMU flag defined in
-+ * enum viommu_flags. Or 0 if vIOMMU doesn't report any.
-+ *
-+ * @dev: PCI device pointer.
-+ */
-+uint64_t pci_device_get_viommu_flags(PCIDevice *dev);
-+
- /**
- * pci_iommu_get_iotlb_info: get properties required to initialize a
- * device IOTLB.
---
-2.52.0
-
diff --git a/kvm-hw-pci-Introduce-pci_setup_iommu_per_bus-for-per-bus.patch b/kvm-hw-pci-Introduce-pci_setup_iommu_per_bus-for-per-bus.patch
deleted file mode 100644
index b22c39f..0000000
--- a/kvm-hw-pci-Introduce-pci_setup_iommu_per_bus-for-per-bus.patch
+++ /dev/null
@@ -1,150 +0,0 @@
-From 34d06db7ea02cd3a0a07082fef93e08bfbf0b06a Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 29 Aug 2025 09:25:28 +0100
-Subject: [PATCH 10/16] hw/pci: Introduce pci_setup_iommu_per_bus() for per-bus
- IOMMU ops retrieval
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 423: hw/arm/virt: Add support for user creatable SMMUv3 device
-RH-Jira: RHEL-73800
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Donald Dutile <None>
-RH-Commit: [6/11] 0c41f77254cd66a3648c14c5d4ba2dfdbd396665 (eauger1/centos-qemu-kvm)
-
-Currently, pci_setup_iommu() registers IOMMU ops for a given PCIBus.
-However, when retrieving IOMMU ops for a device using
-pci_device_get_iommu_bus_devfn(), the function checks the parent_dev
-and fetches IOMMU ops from the parent device, even if the current
-bus does not have any associated IOMMU ops.
-
-This behavior works for now because QEMU's IOMMU implementations are
-globally scoped, and host bridges rely on the bypass_iommu property
-to skip IOMMU translation when needed.
-
-However, this model will break with the soon to be introduced
-arm-smmuv3 device, which allows users to associate the IOMMU
-with a specific PCIe root complex (e.g., the default pcie.0
-or a pxb-pcie root complex).
-
-For example, consider the following setup with multiple root
-complexes:
-
--device arm-smmuv3,primary-bus=pcie.0,id=smmuv3.0 \
-...
--device pxb-pcie,id=pcie.1,bus_nr=8,bus=pcie.0 \
--device pcie-root-port,id=pcie.port1,bus=pcie.1 \
--device virtio-net-pci,bus=pcie.port1
-
-In Qemu, pxb-pcie acts as a special root complex whose parent is
-effectively the default root complex(pcie.0). Hence, though pcie.1
-has no associated SMMUv3 as per above, pci_device_get_iommu_bus_devfn()
-will incorrectly return the IOMMU ops from pcie.0 due to the fallback
-via parent_dev.
-
-To fix this, introduce a new helper pci_setup_iommu_per_bus() that
-explicitly sets the new iommu_per_bus field in the PCIBus structure.
-This helper will be used in a subsequent patch that adds support for
-the new arm-smmuv3 device.
-
-Update pci_device_get_iommu_bus_devfn() to use iommu_per_bus when
-determining the correct IOMMU ops, ensuring accurate behavior for
-per-bus IOMMUs.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nathan Chen <nathanc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Donald Dutile <ddutile@redhat.com>
-Message-id: 20250829082543.7680-7-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 951bc76fb669eab96cc60e38a50097ad4435163e)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/pci/pci.c | 31 +++++++++++++++++++++++++++++++
- include/hw/pci/pci.h | 2 ++
- include/hw/pci/pci_bus.h | 1 +
- 3 files changed, 34 insertions(+)
-
-diff --git a/hw/pci/pci.c b/hw/pci/pci.c
-index c70b5ceeba..0012cc12e7 100644
---- a/hw/pci/pci.c
-+++ b/hw/pci/pci.c
-@@ -2909,6 +2909,19 @@ static void pci_device_get_iommu_bus_devfn(PCIDevice *dev,
- }
- }
-
-+ /*
-+ * When multiple PCI Express Root Buses are defined using pxb-pcie,
-+ * the IOMMU configuration may be specific to each root bus. However,
-+ * pxb-pcie acts as a special root complex whose parent is effectively
-+ * the default root complex(pcie.0). Ensure that we retrieve the
-+ * correct IOMMU ops(if any) in such cases.
-+ */
-+ if (pci_bus_is_express(iommu_bus) && pci_bus_is_root(iommu_bus)) {
-+ if (parent_bus->iommu_per_bus) {
-+ break;
-+ }
-+ }
-+
- iommu_bus = parent_bus;
- }
-
-@@ -3169,6 +3182,24 @@ void pci_setup_iommu(PCIBus *bus, const PCIIOMMUOps *ops, void *opaque)
- bus->iommu_opaque = opaque;
- }
-
-+/*
-+ * Similar to pci_setup_iommu(), but sets iommu_per_bus to true,
-+ * indicating that the IOMMU is specific to this bus. This is used by
-+ * IOMMU implementations that are tied to a specific PCIe root complex.
-+ *
-+ * In QEMU, pxb-pcie behaves as a special root complex whose parent is
-+ * effectively the default root complex (pcie.0). The iommu_per_bus
-+ * is checked in pci_device_get_iommu_bus_devfn() to ensure the correct
-+ * IOMMU ops are returned, avoiding the use of the parent’s IOMMU when
-+ * it's not appropriate.
-+ */
-+void pci_setup_iommu_per_bus(PCIBus *bus, const PCIIOMMUOps *ops,
-+ void *opaque)
-+{
-+ pci_setup_iommu(bus, ops, opaque);
-+ bus->iommu_per_bus = true;
-+}
-+
- static void pci_dev_get_w64(PCIBus *b, PCIDevice *dev, void *opaque)
- {
- Range *range = opaque;
-diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
-index 6b7d3ac8a3..6bccb25ac2 100644
---- a/include/hw/pci/pci.h
-+++ b/include/hw/pci/pci.h
-@@ -773,6 +773,8 @@ int pci_iommu_unregister_iotlb_notifier(PCIDevice *dev, uint32_t pasid,
- */
- void pci_setup_iommu(PCIBus *bus, const PCIIOMMUOps *ops, void *opaque);
-
-+void pci_setup_iommu_per_bus(PCIBus *bus, const PCIIOMMUOps *ops, void *opaque);
-+
- pcibus_t pci_bar_address(PCIDevice *d,
- int reg, uint8_t type, pcibus_t size);
-
-diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h
-index 2261312546..c738446788 100644
---- a/include/hw/pci/pci_bus.h
-+++ b/include/hw/pci/pci_bus.h
-@@ -35,6 +35,7 @@ struct PCIBus {
- enum PCIBusFlags flags;
- const PCIIOMMUOps *iommu_ops;
- void *iommu_opaque;
-+ bool iommu_per_bus;
- uint8_t devfn_min;
- uint32_t slot_reserved_mask;
- pci_set_irq_fn set_irq;
---
-2.47.3
-
diff --git a/kvm-hw-pci-bridge-pci_expander_bridge-Move-TYPE_PXB_PCIE.patch b/kvm-hw-pci-bridge-pci_expander_bridge-Move-TYPE_PXB_PCIE.patch
deleted file mode 100644
index 3aed736..0000000
--- a/kvm-hw-pci-bridge-pci_expander_bridge-Move-TYPE_PXB_PCIE.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From 16975cee959e7e130f3caae2e49cfadbded02456 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 012/111] hw/pci-bridge/pci_expander_bridge: Move
- TYPE_PXB_PCIE_DEV to header
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [12/111] 22baeb4ca100fdc45bfc11e947d95e0737ba152c (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Move the TYPE_PXB_PCIE_DEV definition to header so that it can be
-referenced by other code in subsequent patch.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Message-id: 20260126104342.253965-10-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit d1c585db8bb0a65107f1e5903133bc56b29c46f2)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/pci-bridge/pci_expander_bridge.c | 1 -
- include/hw/pci/pci_bridge.h | 1 +
- 2 files changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
-index 1bcceddbc4..a8eb2d2426 100644
---- a/hw/pci-bridge/pci_expander_bridge.c
-+++ b/hw/pci-bridge/pci_expander_bridge.c
-@@ -48,7 +48,6 @@ struct PXBBus {
- char bus_path[8];
- };
-
--#define TYPE_PXB_PCIE_DEV "pxb-pcie"
- OBJECT_DECLARE_SIMPLE_TYPE(PXBPCIEDev, PXB_PCIE_DEV)
-
- static GList *pxb_dev_list;
-diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
-index a055fd8d32..b61360b900 100644
---- a/include/hw/pci/pci_bridge.h
-+++ b/include/hw/pci/pci_bridge.h
-@@ -106,6 +106,7 @@ typedef struct PXBPCIEDev {
-
- #define TYPE_PXB_PCIE_BUS "pxb-pcie-bus"
- #define TYPE_PXB_CXL_BUS "pxb-cxl-bus"
-+#define TYPE_PXB_PCIE_DEV "pxb-pcie"
- #define TYPE_PXB_DEV "pxb"
- OBJECT_DECLARE_SIMPLE_TYPE(PXBDev, PXB_DEV)
-
---
-2.52.0
-
diff --git a/kvm-hw-pci-host-gpex-Allow-to-generate-preserve-boot-con.patch b/kvm-hw-pci-host-gpex-Allow-to-generate-preserve-boot-con.patch
deleted file mode 100644
index ccf0ef1..0000000
--- a/kvm-hw-pci-host-gpex-Allow-to-generate-preserve-boot-con.patch
+++ /dev/null
@@ -1,193 +0,0 @@
-From 65626b163011d8db55a94e31a35ac5cdda951e0d Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 030/111] hw/pci-host/gpex: Allow to generate preserve boot
- config DSM #5
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [30/111] b597678920fc66163d769bb6800576ff8da82083 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Add a 'preserve_config' field in struct GPEXConfig and, if set, generate
-the _DSM function #5 for preserving PCI boot configurations.
-
-This will be used for SMMUv3 accel=on support in subsequent patch. When
-SMMUv3 acceleration (accel=on) is enabled, QEMU exposes IORT Reserved
-Memory Region (RMR) nodes to support MSI doorbell translations. As per
-the Arm IORT specification, using IORT RMRs mandates the presence of
-_DSM function #5 so that the OS retains the firmware-assigned PCI
-configuration. Hence, this patch adds conditional support for generating
-_DSM #5.
-
-According to the ACPI Specification, Revision 6.6, Section 9.1.1 -
-“_DSM (Device Specific Method)”,
-
-"
-If Function Index is zero, the return is a buffer containing one bit for
-each function index, starting with zero. Bit 0 indicates whether there
-is support for any functions other than function 0 for the specified
-UUID and Revision ID. If set to zero, no functions are supported (other
-than function zero) for the specified UUID and Revision ID. If set to
-one, at least one additional function is supported. For all other bits
-in the buffer, a bit is set to zero to indicate if that function index
-is not supported for the specific UUID and Revision ID. (For example,
-bit 1 set to 0 indicates that function index 1 is not supported for the
-specific UUID and Revision ID.)
-"
-
-Please refer PCI Firmware Specification, Revision 3.3, Section 4.6.5 —
-"_DSM for Preserving PCI Boot Configurations" for Function 5 of _DSM
-method.
-
-Also, while at it, move the byte_list declaration to the top of the
-function for clarity.
-
-At the moment, DSM generation is not yet enabled.
-
-The resulting AML when preserve_config=true is:
-
- Method (_DSM, 4, NotSerialized)
- {
- If ((Arg0 == ToUUID ("e5c937d0-3553-4d7a-9117-ea4d19c3434d")))
- {
- If ((Arg2 == Zero))
- {
- Return (Buffer (One)
- {
- 0x21
- })
- }
-
- If ((Arg2 == 0x05))
- {
- Return (Zero)
- }
- }
- ...
- }
-
-Cc: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-id: 20260126104342.253965-23-skolothumtho@nvidia.com
-[Shameer: Removed possible duplicate _DSM creations]
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 59a5c80623abbb7f5f52fc227cfe0c142858858c)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/pci-host/gpex-acpi.c | 29 +++++++++++++++++++++++------
- include/hw/pci-host/gpex.h | 1 +
- 2 files changed, 24 insertions(+), 6 deletions(-)
-
-diff --git a/hw/pci-host/gpex-acpi.c b/hw/pci-host/gpex-acpi.c
-index 4587baeb78..d9820f9b41 100644
---- a/hw/pci-host/gpex-acpi.c
-+++ b/hw/pci-host/gpex-acpi.c
-@@ -51,10 +51,11 @@ static void acpi_dsdt_add_pci_route_table(Aml *dev, uint32_t irq,
- }
- }
-
--static Aml *build_pci_host_bridge_dsm_method(void)
-+static Aml *build_pci_host_bridge_dsm_method(bool preserve_config)
- {
- Aml *method = aml_method("_DSM", 4, AML_NOTSERIALIZED);
- Aml *UUID, *ifctx, *ifctx1, *buf;
-+ uint8_t byte_list[1] = {0};
-
- /* PCI Firmware Specification 3.0
- * 4.6.1. _DSM for PCI Express Slot Information
-@@ -64,10 +65,23 @@ static Aml *build_pci_host_bridge_dsm_method(void)
- UUID = aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D");
- ifctx = aml_if(aml_equal(aml_arg(0), UUID));
- ifctx1 = aml_if(aml_equal(aml_arg(2), aml_int(0)));
-- uint8_t byte_list[1] = {0};
-+ if (preserve_config) {
-+ /* support functions other than 0, specifically function 5 */
-+ byte_list[0] = 0x21;
-+ }
- buf = aml_buffer(1, byte_list);
- aml_append(ifctx1, aml_return(buf));
- aml_append(ifctx, ifctx1);
-+ if (preserve_config) {
-+ Aml *ifctx2 = aml_if(aml_equal(aml_arg(2), aml_int(5)));
-+ /*
-+ * 0 - The operating system must not ignore the PCI configuration that
-+ * firmware has done at boot time.
-+ */
-+ aml_append(ifctx2, aml_return(aml_int(0)));
-+ aml_append(ifctx, ifctx2);
-+ }
-+
- aml_append(method, ifctx);
-
- byte_list[0] = 0;
-@@ -77,12 +91,13 @@ static Aml *build_pci_host_bridge_dsm_method(void)
- }
-
- static void acpi_dsdt_add_host_bridge_methods(Aml *dev,
-- bool enable_native_pcie_hotplug)
-+ bool enable_native_pcie_hotplug,
-+ bool preserve_config)
- {
- /* Declare an _OSC (OS Control Handoff) method */
- aml_append(dev,
- build_pci_host_bridge_osc_method(enable_native_pcie_hotplug));
-- aml_append(dev, build_pci_host_bridge_dsm_method());
-+ aml_append(dev, build_pci_host_bridge_dsm_method(preserve_config));
- }
-
- void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig *cfg)
-@@ -152,7 +167,8 @@ void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig *cfg)
- build_cxl_osc_method(dev);
- } else {
- /* pxb bridges do not have ACPI PCI Hot-plug enabled */
-- acpi_dsdt_add_host_bridge_methods(dev, true);
-+ acpi_dsdt_add_host_bridge_methods(dev, true,
-+ cfg->preserve_config);
- }
-
- aml_append(scope, dev);
-@@ -227,7 +243,8 @@ void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig *cfg)
- }
- aml_append(dev, aml_name_decl("_CRS", rbuf));
-
-- acpi_dsdt_add_host_bridge_methods(dev, cfg->pci_native_hotplug);
-+ acpi_dsdt_add_host_bridge_methods(dev, cfg->pci_native_hotplug,
-+ cfg->preserve_config);
-
- Aml *dev_res0 = aml_device("%s", "RES0");
- aml_append(dev_res0, aml_name_decl("_HID", aml_string("PNP0C02")));
-diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h
-index feaf827474..7eea16e728 100644
---- a/include/hw/pci-host/gpex.h
-+++ b/include/hw/pci-host/gpex.h
-@@ -46,6 +46,7 @@ struct GPEXConfig {
- int irq;
- PCIBus *bus;
- bool pci_native_hotplug;
-+ bool preserve_config;
- };
-
- typedef struct GPEXIrq GPEXIrq;
---
-2.52.0
-
diff --git a/kvm-hw-pci-host-gpex-acpi-Fix-_DSM-function-0-support-re.patch b/kvm-hw-pci-host-gpex-acpi-Fix-_DSM-function-0-support-re.patch
deleted file mode 100644
index 51a3a9e..0000000
--- a/kvm-hw-pci-host-gpex-acpi-Fix-_DSM-function-0-support-re.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 5cbfc281e40af4411dbdac94fe704385c473b485 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Wed, 22 Oct 2025 09:06:38 +0100
-Subject: [PATCH 017/116] hw/pci-host/gpex-acpi: Fix _DSM function 0 support
- return value
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [1/100] 08174a592249c33057c131aa6ff2d49f346e3fe6 (rovick1/qemu-kvm)
-
-Currently, only function 0 is supported. According to the ACPI
-Specification, Revision 6.6, Section 9.1.1 “_DSM (Device Specific
-Method)”, bit 0 should be 0 to indicate that no other functions
-are supported beyond function 0.
-
-The resulting AML change looks like this:
-
-Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method
-{
- If ((Arg0 == ToUUID ("e5c937d0-3553-4d7a-9117-ea4d19c3434d")
- {
- If ((Arg2 == Zero))
- {
- Return (Buffer (One)
- {
-- 0x01 // .
-+ 0x00 // .
- })
- }
- }
-}
-
-Fixes: 5b85eabe68f9 ("acpi: add acpi_dsdt_add_gpex")
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-Message-Id: <20251022080639.243965-3-skolothumtho@nvidia.com>
-(cherry picked from commit 325aa2d86a20786c308b0874d15a60d1b924bd0e)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/pci-host/gpex-acpi.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/pci-host/gpex-acpi.c b/hw/pci-host/gpex-acpi.c
-index 952a0ace19..4587baeb78 100644
---- a/hw/pci-host/gpex-acpi.c
-+++ b/hw/pci-host/gpex-acpi.c
-@@ -64,7 +64,7 @@ static Aml *build_pci_host_bridge_dsm_method(void)
- UUID = aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D");
- ifctx = aml_if(aml_equal(aml_arg(0), UUID));
- ifctx1 = aml_if(aml_equal(aml_arg(2), aml_int(0)));
-- uint8_t byte_list[1] = {1};
-+ uint8_t byte_list[1] = {0};
- buf = aml_buffer(1, byte_list);
- aml_append(ifctx1, aml_return(buf));
- aml_append(ifctx, ifctx1);
---
-2.52.0
-
diff --git a/kvm-hw-pci-pci-Add-optional-supports_address_space-callb.patch b/kvm-hw-pci-pci-Add-optional-supports_address_space-callb.patch
deleted file mode 100644
index 67c5522..0000000
--- a/kvm-hw-pci-pci-Add-optional-supports_address_space-callb.patch
+++ /dev/null
@@ -1,121 +0,0 @@
-From 0eeecd2bc75468d6a046ae603b21403ca879e779 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 011/111] hw/pci/pci: Add optional supports_address_space()
- callback
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [11/111] 21143011cab792cbd353b19b5ceb25b02f2ec689 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Introduce an optional supports_address_space() callback in PCIIOMMUOps to
-allow a vIOMMU implementation to reject devices that should not be attached
-to it.
-
-Currently, get_address_space() is the first and mandatory callback into the
-vIOMMU layer, which always returns an address space. For certain setups, such
-as hardware accelerated vIOMMUs (e.g. ARM SMMUv3 with accel=on), attaching
-emulated endpoint devices is undesirable as it may impact the behavior or
-performance of VFIO passthrough devices, for example, by triggering
-unnecessary invalidations on the host IOMMU.
-
-The new callback allows a vIOMMU to check and reject unsupported devices
-early during PCI device registration.
-
-Cc: Michael S. Tsirkin <mst@redhat.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Message-id: 20260126104342.253965-9-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 84ce97290c198a36efc596aefb78f5d3b0e86f6c)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/pci/pci.c | 20 ++++++++++++++++++++
- include/hw/pci/pci.h | 19 +++++++++++++++++++
- 2 files changed, 39 insertions(+)
-
-diff --git a/hw/pci/pci.c b/hw/pci/pci.c
-index 15dd232cf8..141b7ad1f8 100644
---- a/hw/pci/pci.c
-+++ b/hw/pci/pci.c
-@@ -135,6 +135,21 @@ static void pci_set_master(PCIDevice *d, bool enable)
- d->is_master = enable; /* cache the status */
- }
-
-+static bool
-+pci_device_supports_iommu_address_space(PCIDevice *dev, Error **errp)
-+{
-+ PCIBus *bus;
-+ PCIBus *iommu_bus;
-+ int devfn;
-+
-+ pci_device_get_iommu_bus_devfn(dev, &iommu_bus, &bus, &devfn);
-+ if (iommu_bus && iommu_bus->iommu_ops->supports_address_space) {
-+ return iommu_bus->iommu_ops->supports_address_space(bus,
-+ iommu_bus->iommu_opaque, devfn, errp);
-+ }
-+ return true;
-+}
-+
- static void pci_init_bus_master(PCIDevice *pci_dev)
- {
- AddressSpace *dma_as = pci_device_iommu_address_space(pci_dev);
-@@ -1412,6 +1427,11 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev,
- pci_dev->config_write = config_write;
- bus->devices[devfn] = pci_dev;
- pci_dev->version_id = 2; /* Current pci device vmstate version */
-+ if (!pci_device_supports_iommu_address_space(pci_dev, errp)) {
-+ do_pci_unregister_device(pci_dev);
-+ bus->devices[devfn] = NULL;
-+ return NULL;
-+ }
- if (phase_check(PHASE_MACHINE_READY)) {
- pci_init_bus_master(pci_dev);
- }
-diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
-index bde9dca8e2..a19773d0f9 100644
---- a/include/hw/pci/pci.h
-+++ b/include/hw/pci/pci.h
-@@ -417,6 +417,25 @@ typedef struct IOMMUPRINotifier {
- * framework for a set of devices on a PCI bus.
- */
- typedef struct PCIIOMMUOps {
-+ /**
-+ * @supports_address_space: Optional pre-check to determine whether a PCI
-+ * device can be associated with an IOMMU. If this callback returns true,
-+ * the IOMMU accepts the device association and get_address_space() can be
-+ * called to obtain the address_space to be used.
-+ *
-+ * @bus: the #PCIBus being accessed.
-+ *
-+ * @opaque: the data passed to pci_setup_iommu().
-+ *
-+ * @devfn: device and function number.
-+ *
-+ * @errp: pass an Error out only when return false
-+ *
-+ * Returns: true if the device can be associated with an IOMMU, false
-+ * otherwise with errp set.
-+ */
-+ bool (*supports_address_space)(PCIBus *bus, void *opaque, int devfn,
-+ Error **errp);
- /**
- * @get_address_space: get the address space for a set of devices
- * on a PCI bus.
---
-2.52.0
-
diff --git a/kvm-hw-pci-pci-Enforce-pci_setup_iommu_per_bus-is-called.patch b/kvm-hw-pci-pci-Enforce-pci_setup_iommu_per_bus-is-called.patch
deleted file mode 100644
index 3c8aa7a..0000000
--- a/kvm-hw-pci-pci-Enforce-pci_setup_iommu_per_bus-is-called.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From ad829395fcfb2567599adb5d945698b3f91ae2ab Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Wed, 3 Jun 2026 14:44:13 +0200
-Subject: [PATCH 075/111] hw/pci/pci: Enforce pci_setup_iommu_per_bus() is
- called only once per bus
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [75/111] 4ea1111d7a8ba80c4c3f793d8ddef8f26ebd640c (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-142465
-
-Currently it is possible to attach several arm-smmuv3 devices to the
-same bus although it is a wrong setup.
-
-Change the prototype of pci_setup_iommu_per_bus to pass an error
-handle. This latter is set when iommu_per_bus is already set and
-used by the single caller (smmu_base_realize) to report a useful
-error to the end-user.
-
-While at it document pci_setup_iommu_per_bus callback in the header.
-
-Fixes: 66d2f665e163 ("hw/arm/virt: Allow user-creatable SMMUv3 dev instantiation")
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nathan Chen <nathanc@nvidia.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@mailo.com>
-Message-id: 20260603124415.1120808-1-eric.auger@redhat.com
-Acked-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 17b9f38982c10cb0696bce73fcedb927aee52de1)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmu-common.c | 4 +++-
- hw/pci/pci.c | 9 +++++++--
- include/hw/pci/pci.h | 16 +++++++++++++++-
- 3 files changed, 25 insertions(+), 4 deletions(-)
-
-diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
-index d70ca81775..d8c16752d5 100644
---- a/hw/arm/smmu-common.c
-+++ b/hw/arm/smmu-common.c
-@@ -981,7 +981,9 @@ static void smmu_base_realize(DeviceState *dev, Error **errp)
- }
-
- if (s->smmu_per_bus) {
-- pci_setup_iommu_per_bus(pci_bus, s->iommu_ops, s);
-+ if (!pci_setup_iommu_per_bus(pci_bus, s->iommu_ops, s, errp)) {
-+ return;
-+ }
- } else {
- pci_setup_iommu(pci_bus, s->iommu_ops, s);
- }
-diff --git a/hw/pci/pci.c b/hw/pci/pci.c
-index 344914424c..4fd8afceed 100644
---- a/hw/pci/pci.c
-+++ b/hw/pci/pci.c
-@@ -3255,11 +3255,16 @@ void pci_setup_iommu(PCIBus *bus, const PCIIOMMUOps *ops, void *opaque)
- * IOMMU ops are returned, avoiding the use of the parent’s IOMMU when
- * it's not appropriate.
- */
--void pci_setup_iommu_per_bus(PCIBus *bus, const PCIIOMMUOps *ops,
-- void *opaque)
-+bool pci_setup_iommu_per_bus(PCIBus *bus, const PCIIOMMUOps *ops,
-+ void *opaque, Error **errp)
- {
-+ if (bus->iommu_per_bus) {
-+ error_setg(errp, "An iommu is already attached to this bus");
-+ return false;
-+ }
- pci_setup_iommu(bus, ops, opaque);
- bus->iommu_per_bus = true;
-+ return true;
- }
-
- static void pci_dev_get_w64(PCIBus *b, PCIDevice *dev, void *opaque)
-diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
-index e672c92348..f1ad29f0df 100644
---- a/include/hw/pci/pci.h
-+++ b/include/hw/pci/pci.h
-@@ -864,7 +864,21 @@ int pci_iommu_unregister_iotlb_notifier(PCIDevice *dev, uint32_t pasid,
- */
- void pci_setup_iommu(PCIBus *bus, const PCIIOMMUOps *ops, void *opaque);
-
--void pci_setup_iommu_per_bus(PCIBus *bus, const PCIIOMMUOps *ops, void *opaque);
-+/**
-+ * pci_setup_iommu_per_bus: Initialize specific IOMMU handlers for a PCIBus
-+ *
-+ * Similar to pci_setup_iommu but enforces that the iommu only protects
-+ * @bus downstream end points and no other bus hierarchy
-+ *
-+ * @bus: the #PCIBus being updated.
-+ * @ops: the #PCIIOMMUOps
-+ * @opaque: passed to callbacks of the @ops structure.
-+ * @errp: error handle
-+ *
-+ * Returns false on failure with @errp set, true on success
-+ */
-+bool pci_setup_iommu_per_bus(PCIBus *bus, const PCIIOMMUOps *ops,
-+ void *opaque, Error **errp);
-
- pcibus_t pci_bar_address(PCIDevice *d,
- int reg, uint8_t type, pcibus_t size);
---
-2.52.0
-
diff --git a/kvm-hw-pci-pci-Introduce-a-callback-to-retrieve-the-MSI-.patch b/kvm-hw-pci-pci-Introduce-a-callback-to-retrieve-the-MSI-.patch
deleted file mode 100644
index 02b21d7..0000000
--- a/kvm-hw-pci-pci-Introduce-a-callback-to-retrieve-the-MSI-.patch
+++ /dev/null
@@ -1,182 +0,0 @@
-From 4408abc5514a43de2448a7e649e283d2407a50eb Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 024/111] hw/pci/pci: Introduce a callback to retrieve the MSI
- doorbell GPA directly
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [24/111] 48db9de84081aaab07118f3b4ba23caa735e5ebd (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-For certain vIOMMU implementations, such as SMMUv3 in accelerated mode,
-the translation tables are programmed directly into the physical SMMUv3
-in a nested configuration. While QEMU knows where the guest tables live,
-safely walking them in software would require trapping and ordering all
-guest invalidations on every command queue. Without this, QEMU could race
-with guest updates and walk stale or freed page tables.
-
-This constraint is fundamental to the design of HW-accelerated vSMMU when
-used with downstream vfio-pci endpoint devices, where QEMU must never walk
-guest translation tables and must rely on the physical SMMU for
-translation. Future accelerated vSMMU features, such as virtual CMDQ, will
-also prevent trapping invalidations, reinforcing this restriction.
-
-For vfio-pci endpoints behind such a vSMMU, the only translation QEMU
-needs is for the MSI doorbell used when setting up KVM MSI route tables.
-Instead of attempting a software walk, introduce an optional vIOMMU
-callback that returns the MSI doorbell GPA directly.
-
-kvm_arch_fixup_msi_route() uses this callback when available and ignores
-the guest provided IOVA in that case.
-
-If the vIOMMU does not implement the callback, we fall back to the
-existing IOMMU based address space translation path.
-
-This ensures correct MSI routing for accelerated SMMUv3 + VFIO passthrough
-while avoiding unsafe software walks of guest translation tables.
-
-As a related change, replace RCU_READ_LOCK_GUARD() with explicit
-rcu_read_lock()/rcu_read_unlock(). The introduction of an early goto
-(set_doorbell) path means the RCU read side critical section can no longer
-be safely scoped using RCU_READ_LOCK_GUARD().
-
-Cc: Michael S. Tsirkin <mst@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-17-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 5c921b29c9898bc44b86b88127b9e9bef76dc2ef)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/pci/pci.c | 17 +++++++++++++++++
- include/hw/pci/pci.h | 17 +++++++++++++++++
- target/arm/kvm.c | 18 +++++++++++++++++-
- 3 files changed, 51 insertions(+), 1 deletion(-)
-
-diff --git a/hw/pci/pci.c b/hw/pci/pci.c
-index 1f2d4d76f9..344914424c 100644
---- a/hw/pci/pci.c
-+++ b/hw/pci/pci.c
-@@ -2965,6 +2965,23 @@ bool pci_device_get_iommu_bus_devfn(PCIDevice *dev, PCIBus **piommu_bus,
- return aliased;
- }
-
-+bool pci_device_iommu_msi_direct_gpa(PCIDevice *dev, hwaddr *out_doorbell)
-+{
-+ PCIBus *bus;
-+ PCIBus *iommu_bus;
-+ int devfn;
-+
-+ pci_device_get_iommu_bus_devfn(dev, &iommu_bus, &bus, &devfn);
-+ if (iommu_bus) {
-+ if (iommu_bus->iommu_ops->get_msi_direct_gpa) {
-+ *out_doorbell = iommu_bus->iommu_ops->get_msi_direct_gpa(bus,
-+ iommu_bus->iommu_opaque, devfn);
-+ return true;
-+ }
-+ }
-+ return false;
-+}
-+
- AddressSpace *pci_device_iommu_address_space(PCIDevice *dev)
- {
- PCIBus *bus;
-diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
-index 528faafad2..e672c92348 100644
---- a/include/hw/pci/pci.h
-+++ b/include/hw/pci/pci.h
-@@ -683,6 +683,22 @@ typedef struct PCIIOMMUOps {
- uint32_t pasid, bool priv_req, bool exec_req,
- hwaddr addr, bool lpig, uint16_t prgi, bool is_read,
- bool is_write);
-+ /**
-+ * @get_msi_direct_gpa: get the guest physical address of MSI doorbell
-+ * for the device on a PCI bus.
-+ *
-+ * Optional callback. If implemented, it must return a valid guest
-+ * physical address for the MSI doorbell
-+ *
-+ * @bus: the #PCIBus being accessed.
-+ *
-+ * @opaque: the data passed to pci_setup_iommu().
-+ *
-+ * @devfn: device and function number
-+ *
-+ * Returns: the guest physical address of the MSI doorbell.
-+ */
-+ uint64_t (*get_msi_direct_gpa)(PCIBus *bus, void *opaque, int devfn);
- } PCIIOMMUOps;
-
- bool pci_device_get_iommu_bus_devfn(PCIDevice *dev, PCIBus **piommu_bus,
-@@ -691,6 +707,7 @@ AddressSpace *pci_device_iommu_address_space(PCIDevice *dev);
- bool pci_device_set_iommu_device(PCIDevice *dev, HostIOMMUDevice *hiod,
- Error **errp);
- void pci_device_unset_iommu_device(PCIDevice *dev);
-+bool pci_device_iommu_msi_direct_gpa(PCIDevice *dev, hwaddr *out_doorbell);
-
- /**
- * pci_device_get_viommu_flags: get vIOMMU flags.
-diff --git a/target/arm/kvm.c b/target/arm/kvm.c
-index ccf0fc501a..fe731cc49f 100644
---- a/target/arm/kvm.c
-+++ b/target/arm/kvm.c
-@@ -1614,26 +1614,42 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
- return 0;
- }
-
-+ /*
-+ * We do have an IOMMU address space, but for some vIOMMU implementations
-+ * (e.g. accelerated SMMUv3) the translation tables are programmed into
-+ * the physical SMMUv3 in the host (nested S1=guest, S2=host). QEMU cannot
-+ * walk these tables in a safe way, so in that case we obtain the MSI
-+ * doorbell GPA directly from the vIOMMU backend and ignore the gIOVA
-+ * @address.
-+ */
-+ if (pci_device_iommu_msi_direct_gpa(dev, &doorbell_gpa)) {
-+ goto set_doorbell;
-+ }
-+
- /* MSI doorbell address is translated by an IOMMU */
-
-- RCU_READ_LOCK_GUARD();
-+ rcu_read_lock();
-
- mr = address_space_translate(as, address, &xlat, &len, true,
- MEMTXATTRS_UNSPECIFIED);
-
- if (!mr) {
-+ rcu_read_unlock();
- return 1;
- }
-
- mrs = memory_region_find(mr, xlat, 1);
-
- if (!mrs.mr) {
-+ rcu_read_unlock();
- return 1;
- }
-
- doorbell_gpa = mrs.offset_within_address_space;
- memory_region_unref(mrs.mr);
-+ rcu_read_unlock();
-
-+set_doorbell:
- route->u.msi.address_lo = doorbell_gpa;
- route->u.msi.address_hi = doorbell_gpa >> 32;
-
---
-2.52.0
-
diff --git a/kvm-hw-pci-pci-Move-pci_init_bus_master-after-adding-dev.patch b/kvm-hw-pci-pci-Move-pci_init_bus_master-after-adding-dev.patch
deleted file mode 100644
index d65dda9..0000000
--- a/kvm-hw-pci-pci-Move-pci_init_bus_master-after-adding-dev.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From 0213083c1d84149b5447d6153aa064cdda39952e Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:04 +0000
-Subject: [PATCH 009/111] hw/pci/pci: Move pci_init_bus_master() after adding
- device to bus
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [9/111] 0b322e9469e1c9b526028631ba972cdea6c71028 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-During PCI hotplug, in do_pci_register_device(), pci_init_bus_master()
-is called before storing the pci_dev pointer in bus->devices[devfn].
-
-This causes a problem if pci_init_bus_master() (via its
-get_address_space() callback) attempts to retrieve the device using
-pci_find_device(), since the PCI device is not yet visible on the bus.
-
-Fix this by moving the pci_init_bus_master() call to after the device
-has been added to bus->devices[devfn].
-
-This prepares for a subsequent patch where the accel SMMUv3
-get_address_space() callback retrieves the pci_dev to identify the
-attached device type.
-
-No functional change intended.
-
-Cc: Michael S. Tsirkin <mst@redhat.com>
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Message-id: 20260126104342.253965-8-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit e4eab7d4a1480016876e74081ffef10ab495210b)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/pci/pci.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/hw/pci/pci.c b/hw/pci/pci.c
-index d1c22999b9..a8eeafd3b2 100644
---- a/hw/pci/pci.c
-+++ b/hw/pci/pci.c
-@@ -1369,9 +1369,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev,
- pci_dev->bus_master_as.max_bounce_buffer_size =
- pci_dev->max_bounce_buffer_size;
-
-- if (phase_check(PHASE_MACHINE_READY)) {
-- pci_init_bus_master(pci_dev);
-- }
- pci_dev->irq_state = 0;
- pci_config_alloc(pci_dev);
-
-@@ -1415,6 +1412,9 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev,
- pci_dev->config_write = config_write;
- bus->devices[devfn] = pci_dev;
- pci_dev->version_id = 2; /* Current pci device vmstate version */
-+ if (phase_check(PHASE_MACHINE_READY)) {
-+ pci_init_bus_master(pci_dev);
-+ }
- return pci_dev;
- }
-
---
-2.52.0
-
diff --git a/kvm-hw-s390x-Fix-a-possible-crash-with-passed-through-vi.patch b/kvm-hw-s390x-Fix-a-possible-crash-with-passed-through-vi.patch
deleted file mode 100644
index 709d857..0000000
--- a/kvm-hw-s390x-Fix-a-possible-crash-with-passed-through-vi.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From f607a40a84b80b2cb33ef3bb42b60b84af596cc9 Mon Sep 17 00:00:00 2001
-From: Thomas Huth <thuth@redhat.com>
-Date: Tue, 18 Nov 2025 18:40:47 +0100
-Subject: [PATCH 3/4] hw/s390x: Fix a possible crash with passed-through virtio
- devices
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Thomas Huth <thuth@redhat.com>
-RH-MergeRequest: 427: s390x: Fix a possible crash with passed-through virtio devices
-RH-Jira: RHEL-128085
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Commit: [1/1] a368a65a46a8d85f7ae83cfb5af23b1a341ea9d4 (thuth/qemu-kvm-cs)
-
-JIRA: https://issues.redhat.com/browse/RHEL-128085
-
-Consider the following nested setup: An L1 host uses some virtio device
-(e.g. virtio-keyboard) for the L2 guest, and this L2 guest passes this
-device through to the L3 guest. Since the L3 guest sees a virtio device,
-it might send virtio notifications to the QEMU in L2 for that device.
-But since the QEMU in L2 defined this device as vfio-ccw, the function
-handle_virtio_ccw_notify() cannot handle this and crashes: It calls
-virtio_ccw_get_vdev() that casts sch->driver_data into a VirtioCcwDevice,
-but since "sch" belongs to a vfio-ccw device, that driver_data rather
-points to a CcwDevice instead. So as soon as QEMU tries to use some
-VirtioCcwDevice specific data from that device, we've lost.
-
-We must not take virtio notifications for such devices. Thus fix the
-issue by adding a check to the handle_virtio_ccw_notify() handler to
-refuse all devices that are not our own virtio devices. Like in the
-other branches that detect wrong settings, we return -EINVAL from the
-function, which will later be placed in GPR2 to inform the guest about
-the error.
-
-Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
-Reviewed-by: Eric Farman <farman@linux.ibm.com>
-Tested-by: Eric Farman <farman@linux.ibm.com>
-Reviewed-by: Cornelia Huck <cohuck@redhat.com>
-Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
-Message-ID: <20251118174047.73103-1-thuth@redhat.com>
-(cherry picked from commit e5cb62e7b6f99d45a42f0cd358d76d6ee2cef5cd)
----
- hw/s390x/s390-hypercall.c | 14 ++++++++++++++
- 1 file changed, 14 insertions(+)
-
-diff --git a/hw/s390x/s390-hypercall.c b/hw/s390x/s390-hypercall.c
-index ac1b08b2cd..508dd97ca0 100644
---- a/hw/s390x/s390-hypercall.c
-+++ b/hw/s390x/s390-hypercall.c
-@@ -10,6 +10,7 @@
- */
-
- #include "qemu/osdep.h"
-+#include "qemu/error-report.h"
- #include "cpu.h"
- #include "hw/s390x/s390-virtio-ccw.h"
- #include "hw/s390x/s390-hypercall.h"
-@@ -42,6 +43,19 @@ static int handle_virtio_ccw_notify(uint64_t subch_id, uint64_t data)
- if (!sch || !css_subch_visible(sch)) {
- return -EINVAL;
- }
-+ if (sch->id.cu_type != VIRTIO_CCW_CU_TYPE) {
-+ /*
-+ * This might happen in nested setups: If the L1 host defined the
-+ * L2 guest with a virtio device (e.g. virtio-keyboard), and the
-+ * L2 guest passes this device through to the L3 guest, the L3 guest
-+ * might send virtio notifications to the QEMU in L2 for that device.
-+ * But since the QEMU in L2 defined this device as vfio-ccw, it's not
-+ * a VirtIODevice that we can handle here!
-+ */
-+ warn_report_once("Got virtio notification for unsupported device "
-+ "on subchannel %02x.%1x.%04x!", cssid, ssid, schid);
-+ return -EINVAL;
-+ }
-
- vdev = virtio_ccw_get_vdev(sch);
- if (vq_idx >= VIRTIO_QUEUE_MAX || !virtio_queue_get_num(vdev, vq_idx)) {
---
-2.47.3
-
diff --git a/kvm-hw-s390x-sclp-Use-address_space_memory_is_io-in-sclp.patch b/kvm-hw-s390x-sclp-Use-address_space_memory_is_io-in-sclp.patch
deleted file mode 100644
index 1a7980b..0000000
--- a/kvm-hw-s390x-sclp-Use-address_space_memory_is_io-in-sclp.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From c4f79c1b51e39dfc06c696507ec6ac8686b454b6 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
-Date: Mon, 29 Sep 2025 15:28:06 +0200
-Subject: [PATCH 048/111] hw/s390x/sclp: Use address_space_memory_is_io() in
- sclp_service_call()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [48/111] 50444ceccb7dc9e66ddd8c103be99adc6b7bb4b2 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73796
-
-When cpu_address_space_init() isn't called during vCPU creation,
-its single address space is the global &address_space_memory.
-
-As s390x boards don't call cpu_address_space_init(), cpu->as
-points to &address_space_memory.
-
-We can then replace cpu_physical_memory_is_io() by the semantically
-equivalent address_space_memory_is_io() call.
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Thomas Huth <thuth@redhat.com>
-Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-Reviewed-by: Eric Farman <farman@linux.ibm.com>
-Message-Id: <20251002084203.63899-5-philmd@linaro.org>
-(cherry picked from commit 1e440937d699514207946c36c353a7a616f8b805)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/s390x/sclp.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
-index 9718564fa4..16057356b1 100644
---- a/hw/s390x/sclp.c
-+++ b/hw/s390x/sclp.c
-@@ -16,6 +16,7 @@
- #include "qemu/units.h"
- #include "qapi/error.h"
- #include "hw/boards.h"
-+#include "system/memory.h"
- #include "hw/s390x/sclp.h"
- #include "hw/s390x/event-facility.h"
- #include "hw/s390x/s390-pci-bus.h"
-@@ -308,7 +309,7 @@ int sclp_service_call(S390CPU *cpu, uint64_t sccb, uint32_t code)
- if (env->psw.mask & PSW_MASK_PSTATE) {
- return -PGM_PRIVILEGED;
- }
-- if (cpu_physical_memory_is_io(sccb)) {
-+ if (address_space_is_io(CPU(cpu)->as, sccb)) {
- return -PGM_ADDRESSING;
- }
- if ((sccb & ~0x1fffUL) == 0 || (sccb & ~0x1fffUL) == env->psa
---
-2.52.0
-
diff --git a/kvm-hw-scsi-avoid-deadlock-upon-TMF-request-cancelling-w.patch b/kvm-hw-scsi-avoid-deadlock-upon-TMF-request-cancelling-w.patch
deleted file mode 100644
index 9d3076d..0000000
--- a/kvm-hw-scsi-avoid-deadlock-upon-TMF-request-cancelling-w.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From 71535e86e4aa44d7a2eefe15c0aaba1bbc0c1a10 Mon Sep 17 00:00:00 2001
-From: Fiona Ebner <f.ebner@proxmox.com>
-Date: Fri, 17 Oct 2025 11:43:30 +0200
-Subject: [PATCH 39/52] hw/scsi: avoid deadlock upon TMF request cancelling
- with VirtIO
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [32/45] 16f2462f42bd9a0205f40426a94a87448aae2292 (kmwolf/centos-qemu-kvm)
-
-When scsi_req_dequeue() is reached via
-scsi_req_cancel_async()
-virtio_scsi_tmf_cancel_req()
-virtio_scsi_do_tmf_aio_context(),
-there is a deadlock when trying to acquire the SCSI device's requests
-lock, because it was already acquired in
-virtio_scsi_do_tmf_aio_context().
-
-In particular, the issue happens with a FreeBSD guest (13, 14, 15,
-maybe more), when it cancels SCSI requests, because of timeout.
-
-This is a regression caused by commit da6eebb33b ("virtio-scsi:
-perform TMFs in appropriate AioContexts") and the introduction of the
-requests_lock earlier.
-
-To fix the issue, only cancel the requests after releasing the
-requests_lock. For this, the SCSI device's requests are iterated while
-holding the requests_lock and the requests to be cancelled are
-collected in a list. Then, the collected requests are cancelled
-one by one while not holding the requests_lock. This is safe, because
-only requests from the current AioContext are collected and acted
-upon.
-
-Originally reported by Proxmox VE users:
-https://bugzilla.proxmox.com/show_bug.cgi?id=6810
-https://forum.proxmox.com/threads/173914/
-
-Fixes: da6eebb33b ("virtio-scsi: perform TMFs in appropriate AioContexts")
-Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
-Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
-Message-id: 20251017094518.328905-1-f.ebner@proxmox.com
-[Changed g_list_append() to g_list_prepend() to avoid traversing the
-list each time.
---Stefan]
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-(cherry picked from commit 6910f04aa646f63a0257f77201ad8ea15992b816)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- hw/scsi/virtio-scsi.c | 14 +++++++++++++-
- 1 file changed, 13 insertions(+), 1 deletion(-)
-
-diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
-index 0ce4718407..a632feedcb 100644
---- a/hw/scsi/virtio-scsi.c
-+++ b/hw/scsi/virtio-scsi.c
-@@ -343,6 +343,7 @@ static void virtio_scsi_do_tmf_aio_context(void *opaque)
- SCSIDevice *d = virtio_scsi_device_get(s, tmf->req.tmf.lun);
- SCSIRequest *r;
- bool match_tag;
-+ g_autoptr(GList) reqs = NULL;
-
- if (!d) {
- tmf->resp.tmf.response = VIRTIO_SCSI_S_BAD_TARGET;
-@@ -378,10 +379,21 @@ static void virtio_scsi_do_tmf_aio_context(void *opaque)
- if (match_tag && cmd_req->req.cmd.tag != tmf->req.tmf.tag) {
- continue;
- }
-- virtio_scsi_tmf_cancel_req(tmf, r);
-+ /*
-+ * Cannot cancel directly, because scsi_req_dequeue() would deadlock
-+ * when attempting to acquire the request_lock a second time. Taking
-+ * a reference here is paired with an unref after cancelling below.
-+ */
-+ scsi_req_ref(r);
-+ reqs = g_list_prepend(reqs, r);
- }
- }
-
-+ for (GList *elem = g_list_first(reqs); elem; elem = g_list_next(elem)) {
-+ virtio_scsi_tmf_cancel_req(tmf, elem->data);
-+ scsi_req_unref(elem->data);
-+ }
-+
- /* Incremented by virtio_scsi_do_tmf() */
- virtio_scsi_tmf_dec_remaining(tmf);
-
---
-2.52.0
-
diff --git a/kvm-hw-tpm-Add-TPMIfClass-ppi_enabled-field.patch b/kvm-hw-tpm-Add-TPMIfClass-ppi_enabled-field.patch
deleted file mode 100644
index 3f2473b..0000000
--- a/kvm-hw-tpm-Add-TPMIfClass-ppi_enabled-field.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 63f69cde15a373b9423f7b57663e6907031e4d4d Mon Sep 17 00:00:00 2001
-From: Mohammadfaiz Bawa <mbawa@redhat.com>
-Date: Thu, 7 May 2026 15:36:51 +0530
-Subject: [PATCH 3/9] hw/tpm: Add TPMIfClass::ppi_enabled field
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Mohammadfaiz Bawa <None>
-RH-MergeRequest: 485: hw/tpm: add PPI support to tpm-tis-device for ARM64 virt
-RH-Jira: RHEL-112608
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [2/8] 04bf1203950bf118ef75cdfd0954b194fc761359 (faizb/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-112608
-
-Each TPM derived device has a @ppi_enabled field, itself
-exposed as a QOM property. External layers (like the ACPI
-subsystem) wanting to know whether a device implements PPI
-has to check for the QOM property available. This can be
-simplified by declaring a single field in the TPM interface.
-
-Here we add such field to TPMIfClass, before converting each
-TPM devices to use it in the following commits.
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
-Message-Id: <20260317120241.16320-3-philmd@linaro.org>
-(cherry picked from commit 6f4a9599521a9a2feded3e0eaa000546fc9d9e77)
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
----
- include/system/tpm.h | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/include/system/tpm.h b/include/system/tpm.h
-index b90dd4e8cb..9458ad6668 100644
---- a/include/system/tpm.h
-+++ b/include/system/tpm.h
-@@ -43,6 +43,7 @@ struct TPMIfClass {
- enum TpmModel model;
- void (*request_completed)(TPMIf *obj, int ret);
- enum TPMVersion (*get_version)(TPMIf *obj);
-+ bool ppi_enabled;
- };
-
- #define TYPE_TPM_TIS_ISA "tpm-tis"
-@@ -84,6 +85,9 @@ static inline bool tpm_ppi_enabled(TPMIf *ti)
- if (!ti) {
- return false;
- }
-+ if (TPM_IF_GET_CLASS(ti)->ppi_enabled) {
-+ return true;
-+ }
- return object_property_get_bool(OBJECT(ti), "ppi", &error_abort);
- }
-
---
-2.52.0
-
diff --git a/kvm-hw-tpm-Factor-tpm_ppi_enabled-out.patch b/kvm-hw-tpm-Factor-tpm_ppi_enabled-out.patch
deleted file mode 100644
index a882390..0000000
--- a/kvm-hw-tpm-Factor-tpm_ppi_enabled-out.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-From 90f8689a9e63aa1bc2e5fc1513c1a83dad59b8bb Mon Sep 17 00:00:00 2001
-From: Mohammadfaiz Bawa <mbawa@redhat.com>
-Date: Thu, 7 May 2026 15:36:48 +0530
-Subject: [PATCH 2/9] hw/tpm: Factor tpm_ppi_enabled() out
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Mohammadfaiz Bawa <None>
-RH-MergeRequest: 485: hw/tpm: add PPI support to tpm-tis-device for ARM64 virt
-RH-Jira: RHEL-112608
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [1/8] cd42765aadffad8c155789613f604ab32ff51b9a (faizb/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-112608
-
-Factor out tpm_ppi_enabled() before modifying it in a unique place.
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
-Message-Id: <20260317120241.16320-2-philmd@linaro.org>
-(cherry picked from commit 60ab4a04379632294a57ed1878371bbfba418568)
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
----
- hw/acpi/tpm.c | 2 +-
- hw/i386/acpi-build.c | 2 +-
- include/system/tpm.h | 9 +++++++++
- 3 files changed, 11 insertions(+), 2 deletions(-)
-
-diff --git a/hw/acpi/tpm.c b/hw/acpi/tpm.c
-index cdc0227536..5fe95f2e3f 100644
---- a/hw/acpi/tpm.c
-+++ b/hw/acpi/tpm.c
-@@ -25,7 +25,7 @@ void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev)
- Aml *method, *field, *ifctx, *ifctx2, *ifctx3, *func_mask,
- *not_implemented, *pak, *tpm2, *tpm3, *pprm, *pprq, *zero, *one;
-
-- if (!object_property_get_bool(OBJECT(tpm), "ppi", &error_abort)) {
-+ if (!tpm_ppi_enabled(tpm)) {
- return;
- }
-
-diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
-index 423c4959fe..f97d7b9f0c 100644
---- a/hw/i386/acpi-build.c
-+++ b/hw/i386/acpi-build.c
-@@ -2215,7 +2215,7 @@ void acpi_setup(void)
- tables.tcpalog->data, acpi_data_len(tables.tcpalog));
-
- tpm = tpm_find();
-- if (tpm && object_property_get_bool(OBJECT(tpm), "ppi", &error_abort)) {
-+ if (tpm_ppi_enabled(tpm)) {
- tpm_config = (FwCfgTPMConfig) {
- .tpmppi_address = cpu_to_le32(TPM_PPI_ADDR_BASE),
- .tpm_version = tpm_get_version(tpm),
-diff --git a/include/system/tpm.h b/include/system/tpm.h
-index 1ee568b3b6..b90dd4e8cb 100644
---- a/include/system/tpm.h
-+++ b/include/system/tpm.h
-@@ -13,6 +13,7 @@
- #define QEMU_TPM_H
-
- #include "qapi/qapi-types-tpm.h"
-+#include "qapi/error.h"
- #include "qom/object.h"
-
- #ifdef CONFIG_TPM
-@@ -78,6 +79,14 @@ static inline TPMVersion tpm_get_version(TPMIf *ti)
- return TPM_IF_GET_CLASS(ti)->get_version(ti);
- }
-
-+static inline bool tpm_ppi_enabled(TPMIf *ti)
-+{
-+ if (!ti) {
-+ return false;
-+ }
-+ return object_property_get_bool(OBJECT(ti), "ppi", &error_abort);
-+}
-+
- #else /* CONFIG_TPM */
-
- #define tpm_init() (0)
---
-2.52.0
-
diff --git a/kvm-hw-tpm-Propagate-ppi_enabled-to-tpm_tis_reset-and-re.patch b/kvm-hw-tpm-Propagate-ppi_enabled-to-tpm_tis_reset-and-re.patch
deleted file mode 100644
index 84696ea..0000000
--- a/kvm-hw-tpm-Propagate-ppi_enabled-to-tpm_tis_reset-and-re.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-From 1e4ed1782cf15da3b302150d70b8f2b6cd005d10 Mon Sep 17 00:00:00 2001
-From: Mohammadfaiz Bawa <mbawa@redhat.com>
-Date: Thu, 7 May 2026 15:36:55 +0530
-Subject: [PATCH 5/9] hw/tpm: Propagate @ppi_enabled to tpm_tis_reset() and
- remove in TPMState
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Mohammadfaiz Bawa <None>
-RH-MergeRequest: 485: hw/tpm: add PPI support to tpm-tis-device for ARM64 virt
-RH-Jira: RHEL-112608
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [4/8] b49b1b914105cc87d79823c2f97712e81a17983b (faizb/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-112608
-
-Of the TPM devices using FIFO mode, only the ISA variant has
-PPI, and calls tpm_ppi_init() to initialize the PPI state.
-Propagate @ppi_enabled to tpm_tis_reset() so it only resets
-the PPI part when requested (ISA case) otherwise the PPI is in
-uninitialized state. Remove the now unused TPMState::ppi_enabled
-field. Set the generic TPMIfClass::ppi_enabled so ACPI subsystem
-can keep checking its availability.
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
-Message-Id: <20260317120241.16320-5-philmd@linaro.org>
-(cherry picked from commit 0a4682368b75bdc584bc3aae99c1fd3f6d735546)
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
----
- hw/tpm/tpm_tis.h | 3 +--
- hw/tpm/tpm_tis_common.c | 4 ++--
- hw/tpm/tpm_tis_i2c.c | 2 +-
- hw/tpm/tpm_tis_isa.c | 10 ++++------
- hw/tpm/tpm_tis_sysbus.c | 2 +-
- 5 files changed, 9 insertions(+), 12 deletions(-)
-
-diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h
-index 184632ff66..1531620bf9 100644
---- a/hw/tpm/tpm_tis.h
-+++ b/hw/tpm/tpm_tis.h
-@@ -75,7 +75,6 @@ typedef struct TPMState {
-
- size_t be_buffer_size;
-
-- bool ppi_enabled;
- TPMPPI ppi;
- } TPMState;
-
-@@ -83,7 +82,7 @@ extern const VMStateDescription vmstate_locty;
- extern const MemoryRegionOps tpm_tis_memory_ops;
-
- int tpm_tis_pre_save(TPMState *s);
--void tpm_tis_reset(TPMState *s);
-+void tpm_tis_reset(TPMState *s, bool ppi_enabled);
- enum TPMVersion tpm_tis_get_tpm_version(TPMState *s);
- void tpm_tis_request_completed(TPMState *s, int ret);
- uint32_t tpm_tis_read_data(TPMState *s, hwaddr addr, unsigned size);
-diff --git a/hw/tpm/tpm_tis_common.c b/hw/tpm/tpm_tis_common.c
-index cdd0df1137..bbed8726ae 100644
---- a/hw/tpm/tpm_tis_common.c
-+++ b/hw/tpm/tpm_tis_common.c
-@@ -813,7 +813,7 @@ enum TPMVersion tpm_tis_get_tpm_version(TPMState *s)
- * This function is called when the machine starts, resets or due to
- * S3 resume.
- */
--void tpm_tis_reset(TPMState *s)
-+void tpm_tis_reset(TPMState *s, bool ppi_enabled)
- {
- int c;
-
-@@ -821,7 +821,7 @@ void tpm_tis_reset(TPMState *s)
- s->be_buffer_size = MIN(tpm_backend_get_buffer_size(s->be_driver),
- TPM_TIS_BUFFER_MAX);
-
-- if (s->ppi_enabled) {
-+ if (ppi_enabled) {
- tpm_ppi_reset(&s->ppi);
- }
- tpm_backend_reset(s->be_driver);
-diff --git a/hw/tpm/tpm_tis_i2c.c b/hw/tpm/tpm_tis_i2c.c
-index 5ce84dc7a4..737f288f00 100644
---- a/hw/tpm/tpm_tis_i2c.c
-+++ b/hw/tpm/tpm_tis_i2c.c
-@@ -523,7 +523,7 @@ static void tpm_tis_i2c_reset(DeviceState *dev)
- i2cst->csum_enable = 0;
- i2cst->loc_sel = 0x00;
-
-- return tpm_tis_reset(s);
-+ return tpm_tis_reset(s, false);
- }
-
- static void tpm_tis_i2c_class_init(ObjectClass *klass, const void *data)
-diff --git a/hw/tpm/tpm_tis_isa.c b/hw/tpm/tpm_tis_isa.c
-index dce83057a9..e481c174e1 100644
---- a/hw/tpm/tpm_tis_isa.c
-+++ b/hw/tpm/tpm_tis_isa.c
-@@ -88,13 +88,12 @@ static void tpm_tis_isa_reset(DeviceState *dev)
- TPMStateISA *isadev = TPM_TIS_ISA(dev);
- TPMState *s = &isadev->state;
-
-- return tpm_tis_reset(s);
-+ return tpm_tis_reset(s, true);
- }
-
- static const Property tpm_tis_isa_properties[] = {
- DEFINE_PROP_UINT32("irq", TPMStateISA, state.irq_num, TPM_TIS_IRQ),
- DEFINE_PROP_TPMBE("tpmdev", TPMStateISA, state.be_driver),
-- DEFINE_PROP_BOOL("ppi", TPMStateISA, state.ppi_enabled, true),
- };
-
- static void tpm_tis_isa_initfn(Object *obj)
-@@ -132,10 +131,8 @@ static void tpm_tis_isa_realizefn(DeviceState *dev, Error **errp)
- memory_region_add_subregion(isa_address_space(ISA_DEVICE(dev)),
- TPM_TIS_ADDR_BASE, &s->mmio);
-
-- if (s->ppi_enabled) {
-- tpm_ppi_init(&s->ppi, isa_address_space(ISA_DEVICE(dev)),
-- TPM_PPI_ADDR_BASE, OBJECT(dev));
-- }
-+ tpm_ppi_init(&s->ppi, isa_address_space(ISA_DEVICE(dev)),
-+ TPM_PPI_ADDR_BASE, OBJECT(dev));
- }
-
- static void build_tpm_tis_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
-@@ -175,6 +172,7 @@ static void tpm_tis_isa_class_init(ObjectClass *klass, const void *data)
- device_class_set_props(dc, tpm_tis_isa_properties);
- dc->vmsd = &vmstate_tpm_tis_isa;
- tc->model = TPM_MODEL_TPM_TIS;
-+ tc->ppi_enabled = true;
- dc->realize = tpm_tis_isa_realizefn;
- device_class_set_legacy_reset(dc, tpm_tis_isa_reset);
- tc->request_completed = tpm_tis_isa_request_completed;
-diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
-index 2ffa85852a..287380c676 100644
---- a/hw/tpm/tpm_tis_sysbus.c
-+++ b/hw/tpm/tpm_tis_sysbus.c
-@@ -87,7 +87,7 @@ static void tpm_tis_sysbus_reset(DeviceState *dev)
- TPMStateSysBus *sbdev = TPM_TIS_SYSBUS(dev);
- TPMState *s = &sbdev->state;
-
-- return tpm_tis_reset(s);
-+ return tpm_tis_reset(s, false);
- }
-
- static const Property tpm_tis_sysbus_properties[] = {
---
-2.52.0
-
diff --git a/kvm-hw-tpm-Remove-CRBState-ppi_enabled-field.patch b/kvm-hw-tpm-Remove-CRBState-ppi_enabled-field.patch
deleted file mode 100644
index 5425f36..0000000
--- a/kvm-hw-tpm-Remove-CRBState-ppi_enabled-field.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From 76abf2879263ce6e8c1a08441fc62d88be8d3f58 Mon Sep 17 00:00:00 2001
-From: Mohammadfaiz Bawa <mbawa@redhat.com>
-Date: Thu, 7 May 2026 15:36:52 +0530
-Subject: [PATCH 4/9] hw/tpm: Remove CRBState::ppi_enabled field
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Mohammadfaiz Bawa <None>
-RH-MergeRequest: 485: hw/tpm: add PPI support to tpm-tis-device for ARM64 virt
-RH-Jira: RHEL-112608
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [3/8] be4e2dfd89f6b5c07f0418c7e339b91b295057ce (faizb/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-112608
-
-The CRBState::ppi_enabled boolean was only set in the
-hw_compat_3_1[] array, via the 'ppi=false' property.
-We removed all machines using that array, and the array
-itself in commit a861ffef237 ("hw/core/machine: Remove
-the hw_compat_3_1[] array"). We can safely remove the
-now unused property. Since CRB devices always use PPI,
-simplify removing the CRBState::ppi_enabled field.
-Set the generic TPMIfClass::ppi_enabled so ACPI subsystem
-can keep checking its availability.
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
-Message-Id: <20260317120241.16320-4-philmd@linaro.org>
-(cherry picked from commit 46427d53eb9551e947242fd10451acc4000c5cac)
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
----
- hw/tpm/tpm_crb.c | 13 ++++---------
- 1 file changed, 4 insertions(+), 9 deletions(-)
-
-diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
-index bc7a78f898..3c4c97eccd 100644
---- a/hw/tpm/tpm_crb.c
-+++ b/hw/tpm/tpm_crb.c
-@@ -43,7 +43,6 @@ struct CRBState {
-
- size_t be_buffer_size;
-
-- bool ppi_enabled;
- TPMPPI ppi;
- };
- typedef struct CRBState CRBState;
-@@ -228,16 +227,13 @@ static const VMStateDescription vmstate_tpm_crb = {
-
- static const Property tpm_crb_properties[] = {
- DEFINE_PROP_TPMBE("tpmdev", CRBState, tpmbe),
-- DEFINE_PROP_BOOL("ppi", CRBState, ppi_enabled, true),
- };
-
- static void tpm_crb_reset(void *dev)
- {
- CRBState *s = CRB(dev);
-
-- if (s->ppi_enabled) {
-- tpm_ppi_reset(&s->ppi);
-- }
-+ tpm_ppi_reset(&s->ppi);
- tpm_backend_reset(s->tpmbe);
-
- memset(s->regs, 0, sizeof(s->regs));
-@@ -303,10 +299,8 @@ static void tpm_crb_realize(DeviceState *dev, Error **errp)
- memory_region_add_subregion(get_system_memory(),
- TPM_CRB_ADDR_BASE + sizeof(s->regs), &s->cmdmem);
-
-- if (s->ppi_enabled) {
-- tpm_ppi_init(&s->ppi, get_system_memory(),
-- TPM_PPI_ADDR_BASE, OBJECT(s));
-- }
-+ tpm_ppi_init(&s->ppi, get_system_memory(),
-+ TPM_PPI_ADDR_BASE, OBJECT(s));
-
- if (xen_enabled()) {
- tpm_crb_reset(dev);
-@@ -325,6 +319,7 @@ static void tpm_crb_class_init(ObjectClass *klass, const void *data)
- dc->vmsd = &vmstate_tpm_crb;
- dc->user_creatable = true;
- tc->model = TPM_MODEL_TPM_CRB;
-+ tc->ppi_enabled = true;
- tc->get_version = tpm_crb_get_version;
- tc->request_completed = tpm_crb_request_completed;
-
---
-2.52.0
-
diff --git a/kvm-hw-tpm-Simplify-tpm_ppi_enabled.patch b/kvm-hw-tpm-Simplify-tpm_ppi_enabled.patch
deleted file mode 100644
index 4625aed..0000000
--- a/kvm-hw-tpm-Simplify-tpm_ppi_enabled.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 79d4b64857908d6e54c633c1d81fb9fd36ebb4fa Mon Sep 17 00:00:00 2001
-From: Mohammadfaiz Bawa <mbawa@redhat.com>
-Date: Thu, 7 May 2026 15:36:57 +0530
-Subject: [PATCH 6/9] hw/tpm: Simplify tpm_ppi_enabled()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Mohammadfaiz Bawa <None>
-RH-MergeRequest: 485: hw/tpm: add PPI support to tpm-tis-device for ARM64 virt
-RH-Jira: RHEL-112608
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [5/8] f8acb6c9d4307caa23c2da28f09212f09c3a0832 (faizb/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-112608
-
-TPM instances don't expose any "ppi" property anymore,
-remove that dead code.
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
-Message-Id: <20260317120241.16320-6-philmd@linaro.org>
-(cherry picked from commit 3912e312ae8486eb00bf4c4a1e0048dbc976e19e)
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
----
- include/system/tpm.h | 6 +-----
- 1 file changed, 1 insertion(+), 5 deletions(-)
-
-diff --git a/include/system/tpm.h b/include/system/tpm.h
-index 9458ad6668..874068d19a 100644
---- a/include/system/tpm.h
-+++ b/include/system/tpm.h
-@@ -13,7 +13,6 @@
- #define QEMU_TPM_H
-
- #include "qapi/qapi-types-tpm.h"
--#include "qapi/error.h"
- #include "qom/object.h"
-
- #ifdef CONFIG_TPM
-@@ -85,10 +84,7 @@ static inline bool tpm_ppi_enabled(TPMIf *ti)
- if (!ti) {
- return false;
- }
-- if (TPM_IF_GET_CLASS(ti)->ppi_enabled) {
-- return true;
-- }
-- return object_property_get_bool(OBJECT(ti), "ppi", &error_abort);
-+ return TPM_IF_GET_CLASS(ti)->ppi_enabled;
- }
-
- #else /* CONFIG_TPM */
---
-2.52.0
-
diff --git a/kvm-hw-tpm-add-PPI-support-to-tpm-tis-device-for-ARM64-v.patch b/kvm-hw-tpm-add-PPI-support-to-tpm-tis-device-for-ARM64-v.patch
deleted file mode 100644
index 3f189ec..0000000
--- a/kvm-hw-tpm-add-PPI-support-to-tpm-tis-device-for-ARM64-v.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From dd4cb34048d74a0d3adb1bd5f3f2c27ef4b60517 Mon Sep 17 00:00:00 2001
-From: Mohammadfaiz Bawa <mbawa@redhat.com>
-Date: Thu, 7 May 2026 15:37:01 +0530
-Subject: [PATCH 9/9] hw/tpm: add PPI support to tpm-tis-device for ARM64 virt
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Mohammadfaiz Bawa <None>
-RH-MergeRequest: 485: hw/tpm: add PPI support to tpm-tis-device for ARM64 virt
-RH-Jira: RHEL-112608
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [8/8] ea524a056891d87697427d7d05f7b5ffa58eb5c5 (faizb/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-112608
-
-Add PPI memory region and ACPI _STA, _DSM to tpm-tis-sysbus so
-Windows 11 ARM64 guests no longer log Event ID 15 errors from
-tpm.sys on every boot.
-
-Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Message-ID: <20260327173209.148180-4-mbawa@redhat.com>
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-(cherry picked from commit 46cd2c1050f0fde1a384234264ff8afdcb42d82f)
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
----
- hw/arm/virt-acpi-build.c | 9 ++++++++-
- hw/tpm/tpm_tis_sysbus.c | 11 +++++++++++
- 2 files changed, 19 insertions(+), 1 deletion(-)
-
-diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
-index 96830f7c4e..5a642abac6 100644
---- a/hw/arm/virt-acpi-build.c
-+++ b/hw/arm/virt-acpi-build.c
-@@ -231,7 +231,8 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
- Aml *dev = aml_device("TPM0");
- aml_append(dev, aml_name_decl("_HID", aml_string("MSFT0101")));
- aml_append(dev, aml_name_decl("_STR", aml_string("TPM 2.0 Device")));
-- aml_append(dev, aml_name_decl("_UID", aml_int(0)));
-+ aml_append(dev, aml_name_decl("_UID", aml_int(1)));
-+ aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
-
- Aml *crs = aml_resource_template();
- aml_append(crs,
-@@ -239,6 +240,12 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
- (uint32_t)memory_region_size(sbdev_mr),
- AML_READ_WRITE));
- aml_append(dev, aml_name_decl("_CRS", crs));
-+
-+ hwaddr ppi_base = platform_bus_get_mmio_addr(pbus, sbdev, 1);
-+ if (ppi_base != -1) {
-+ ppi_base += pbus_base;
-+ tpm_build_ppi_acpi(TPM_IF(sbdev), dev, ppi_base);
-+ }
- aml_append(scope, dev);
- }
- #endif
-diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
-index 287380c676..3bea7cd16c 100644
---- a/hw/tpm/tpm_tis_sysbus.c
-+++ b/hw/tpm/tpm_tis_sysbus.c
-@@ -30,6 +30,7 @@
- #include "hw/sysbus.h"
- #include "tpm_tis.h"
- #include "qom/object.h"
-+#include "qemu/memalign.h"
-
- struct TPMStateSysBus {
- /*< private >*/
-@@ -99,6 +100,7 @@ static void tpm_tis_sysbus_initfn(Object *obj)
- {
- TPMStateSysBus *sbdev = TPM_TIS_SYSBUS(obj);
- TPMState *s = &sbdev->state;
-+ size_t host_page_size = qemu_real_host_page_size();
-
- memory_region_init_io(&s->mmio, obj, &tpm_tis_memory_ops,
- s, "tpm-tis-mmio",
-@@ -106,6 +108,12 @@ static void tpm_tis_sysbus_initfn(Object *obj)
-
- sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
- sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
-+
-+ s->ppi.buf = qemu_memalign(host_page_size,
-+ ROUND_UP(TPM_PPI_ADDR_SIZE, host_page_size));
-+ memory_region_init_ram_device_ptr(&s->ppi.ram, obj, "tpm-ppi",
-+ TPM_PPI_ADDR_SIZE, s->ppi.buf);
-+ sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->ppi.ram);
- }
-
- static void tpm_tis_sysbus_realizefn(DeviceState *dev, Error **errp)
-@@ -122,6 +130,8 @@ static void tpm_tis_sysbus_realizefn(DeviceState *dev, Error **errp)
- error_setg(errp, "'tpmdev' property is required");
- return;
- }
-+
-+ vmstate_register_ram(&s->ppi.ram, dev);
- }
-
- static void tpm_tis_sysbus_class_init(ObjectClass *klass, const void *data)
-@@ -132,6 +142,7 @@ static void tpm_tis_sysbus_class_init(ObjectClass *klass, const void *data)
- device_class_set_props(dc, tpm_tis_sysbus_properties);
- dc->vmsd = &vmstate_tpm_tis_sysbus;
- tc->model = TPM_MODEL_TPM_TIS;
-+ tc->ppi_enabled = true;
- dc->realize = tpm_tis_sysbus_realizefn;
- device_class_set_legacy_reset(dc, tpm_tis_sysbus_reset);
- tc->request_completed = tpm_tis_sysbus_request_completed;
---
-2.52.0
-
diff --git a/kvm-hw-tpm-default-tpm-tis-device-PPI-to-disabled.patch b/kvm-hw-tpm-default-tpm-tis-device-PPI-to-disabled.patch
deleted file mode 100644
index add4867..0000000
--- a/kvm-hw-tpm-default-tpm-tis-device-PPI-to-disabled.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From fa2f8fe2dda08627add2104d534c2c375705514f Mon Sep 17 00:00:00 2001
-From: Mohammadfaiz Bawa <mbawa@redhat.com>
-Date: Thu, 16 Jul 2026 14:19:40 +0530
-Subject: [PATCH 03/12] hw/tpm: default tpm-tis-device PPI to disabled
-
-RH-Author: Mohammadfaiz Bawa <None>
-RH-MergeRequest: 511: hw/tpm: fix tpm-ppi migration failure for older machine types
-RH-Jira: RHEL-180837
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [3/3] 848b5a32d209187bc7e59e69fde0743d9476d419 (faizb/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-180837
-UPSTREAM: RHEL-only
-
-Migration is currently broken between 10.3 and earlier qemu versions
-that do not implement tpm PPI (including 10.2) with "Unknown ramblock
-tpm-ppi" error. Upstream 5e33de4f00c2 ("hw/core/machine: disable
-tpm-tis-device PPI for machine type <= 11.0") uses a compat setting
-to turn the PPI feature off for older machine types and change the
-default for 11.1. However, downstream, we do not have a new machine
-type for 10.3 when the feature was introduced so we cannot
-discriminate between 10.2 and 10.3. So turn the feature off for now.
-We will change the default for next machine type.
-
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
----
- hw/tpm/tpm_tis_sysbus.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
-index 253c394087..63e126e360 100644
---- a/hw/tpm/tpm_tis_sysbus.c
-+++ b/hw/tpm/tpm_tis_sysbus.c
-@@ -94,7 +94,7 @@ static void tpm_tis_sysbus_reset(DeviceState *dev)
- static const Property tpm_tis_sysbus_properties[] = {
- DEFINE_PROP_UINT32("irq", TPMStateSysBus, state.irq_num, TPM_TIS_IRQ),
- DEFINE_PROP_TPMBE("tpmdev", TPMStateSysBus, state.be_driver),
-- DEFINE_PROP_BOOL("ppi", TPMStateSysBus, state.ppi_enabled, true),
-+ DEFINE_PROP_BOOL("ppi", TPMStateSysBus, state.ppi_enabled, false),
- };
-
- static void tpm_tis_sysbus_initfn(Object *obj)
---
-2.52.0
-
diff --git a/kvm-hw-tpm-gate-PPI-support-on-tpm-tis-device-behind-a-d.patch b/kvm-hw-tpm-gate-PPI-support-on-tpm-tis-device-behind-a-d.patch
deleted file mode 100644
index 368b0ed..0000000
--- a/kvm-hw-tpm-gate-PPI-support-on-tpm-tis-device-behind-a-d.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-From 2aa010ee971b6323018033536d8bc192641d253e Mon Sep 17 00:00:00 2001
-From: Mohammadfaiz Bawa <mbawa@redhat.com>
-Date: Tue, 14 Jul 2026 22:01:45 +0530
-Subject: [PATCH 02/12] hw/tpm: gate PPI support on tpm-tis-device behind a
- device property
-
-RH-Author: Mohammadfaiz Bawa <None>
-RH-MergeRequest: 511: hw/tpm: fix tpm-ppi migration failure for older machine types
-RH-Jira: RHEL-180837
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [2/3] ab0f19971bae0c49870a92e7e75c4cc0fa96a66d (faizb/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-180837
-
-Add a "ppi" boolean property (default: true) to tpm-tis-device.
-When ppi=off the RAMBlock is never registered and the migration
-stream omits "tpm-ppi", restoring backward compatibility.
-
-Move sysbus_init_mmio() calls from instance_init to realizefn so
-the memory regions are initialized before being registered. When
-ppi=off, the PPI MMIO region is simply not exposed.
-
-Fixes: 46cd2c1050f0 ("hw/tpm: add PPI support to tpm-tis-device for ARM64 virt")
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
-Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
-Link: https://lore.kernel.org/qemu-devel/20260619093140.832136-3-mbawa@redhat.com
-Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
-(cherry picked from commit 5f0348bf6ca17707475c5ccb10909b7a4407513b)
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
----
- hw/tpm/tpm_tis.h | 1 +
- hw/tpm/tpm_tis_sysbus.c | 18 +++++++++++-------
- 2 files changed, 12 insertions(+), 7 deletions(-)
-
-diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h
-index 1531620bf9..6ac9804050 100644
---- a/hw/tpm/tpm_tis.h
-+++ b/hw/tpm/tpm_tis.h
-@@ -76,6 +76,7 @@ typedef struct TPMState {
- size_t be_buffer_size;
-
- TPMPPI ppi;
-+ bool ppi_enabled;
- } TPMState;
-
- extern const VMStateDescription vmstate_locty;
-diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
-index 65ef59edd8..253c394087 100644
---- a/hw/tpm/tpm_tis_sysbus.c
-+++ b/hw/tpm/tpm_tis_sysbus.c
-@@ -94,6 +94,7 @@ static void tpm_tis_sysbus_reset(DeviceState *dev)
- static const Property tpm_tis_sysbus_properties[] = {
- DEFINE_PROP_UINT32("irq", TPMStateSysBus, state.irq_num, TPM_TIS_IRQ),
- DEFINE_PROP_TPMBE("tpmdev", TPMStateSysBus, state.be_driver),
-+ DEFINE_PROP_BOOL("ppi", TPMStateSysBus, state.ppi_enabled, true),
- };
-
- static void tpm_tis_sysbus_initfn(Object *obj)
-@@ -101,9 +102,7 @@ static void tpm_tis_sysbus_initfn(Object *obj)
- TPMStateSysBus *sbdev = TPM_TIS_SYSBUS(obj);
- TPMState *s = &sbdev->state;
-
-- sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
- sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
-- sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->ppi.ram);
- }
-
- static void tpm_tis_sysbus_realizefn(DeviceState *dev, Error **errp)
-@@ -122,14 +121,19 @@ static void tpm_tis_sysbus_realizefn(DeviceState *dev, Error **errp)
- return;
- }
-
-- s->ppi.buf = qemu_memalign(host_page_size,
-- ROUND_UP(TPM_PPI_ADDR_SIZE, host_page_size));
- memory_region_init_io(&s->mmio, OBJECT(dev), &tpm_tis_memory_ops,
- s, "tpm-tis-mmio",
- TPM_TIS_NUM_LOCALITIES << TPM_TIS_LOCALITY_SHIFT);
-- memory_region_init_ram_device_ptr(&s->ppi.ram, OBJECT(dev), "tpm-ppi",
-- TPM_PPI_ADDR_SIZE, s->ppi.buf);
-- vmstate_register_ram(&s->ppi.ram, dev);
-+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio);
-+
-+ if (s->ppi_enabled) {
-+ s->ppi.buf = qemu_memalign(host_page_size,
-+ ROUND_UP(TPM_PPI_ADDR_SIZE, host_page_size));
-+ memory_region_init_ram_device_ptr(&s->ppi.ram, OBJECT(dev), "tpm-ppi",
-+ TPM_PPI_ADDR_SIZE, s->ppi.buf);
-+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->ppi.ram);
-+ vmstate_register_ram(&s->ppi.ram, dev);
-+ }
- }
-
- static void tpm_tis_sysbus_class_init(ObjectClass *klass, const void *data)
---
-2.52.0
-
diff --git a/kvm-hw-tpm-tpm_tis_sysbus-defer-resource-allocation-to-r.patch b/kvm-hw-tpm-tpm_tis_sysbus-defer-resource-allocation-to-r.patch
deleted file mode 100644
index 74e206c..0000000
--- a/kvm-hw-tpm-tpm_tis_sysbus-defer-resource-allocation-to-r.patch
+++ /dev/null
@@ -1,109 +0,0 @@
-From 6526d78b916e57e08393da88124df3adfb40604d Mon Sep 17 00:00:00 2001
-From: Mohammadfaiz Bawa <mbawa@redhat.com>
-Date: Wed, 3 Jun 2026 14:05:52 +0530
-Subject: [PATCH 6/9] hw/tpm/tpm_tis_sysbus: defer resource allocation to
- realize
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Mohammadfaiz Bawa <None>
-RH-MergeRequest: 496: hw/tpm/tpm_tis_sysbus: defer resource allocation to realize
-RH-Jira: RHEL-178846
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [1/1] 934e0f23755aa7d675486deb8e57a94ae9f77251 (faizb/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-178846
-
-Calling memory_region_init_ram_device_ptr() and
-memory_region_init_io() from tpm_tis_sysbus_initfn() crashes
-when the device is introspected without being realized, because
-the memory subsystem has not been initialized at that point.
-
-So running:
- $ qemu-system-aarch64 -device tpm-tis-device,help
-
-triggers qdev_device_help() which creates the device object
-to list its properties, calling instance_init, but never
-realizefn. The memory region calls in instance_init then hit
-uninitialized subsystems:
-
-With CONFIG_DEBUG_TCG:
- Assertion 'target_page.decided' failed. (physmem.c:2524)
-
-Without CONFIG_DEBUG_TCG:
- Assertion 'mutex->initialized' failed. (qemu-thread-posix.c:107)
-
-Since realizefn is only called when the device is actually
-used in a running VM, moving resource allocation there avoids
-the crash without breaking introspection.
-
-This also fixes a memory leak that is reported by the address
-sanitizer during 'make check', because we currently allocate
-ppi.buf during instance_init and never free it. "Allocate in
-realize and never free" is less bad, because we don't currently
-support "unrealize and destroy a sysbus device".
-
-Fixes: 46cd2c1050f ("hw/tpm: add PPI support to tpm-tis-device for ARM64 virt")
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Message-ID: <20260528093123.55403-1-mbawa@redhat.com>
-Message-ID: <CAFEAcA8fEYODmPhbh1W=oPGvju-P=qWvN_dyWrPqAr-E9FK7UA@mail.gmail.com>
-[PMD: Amend Peter comment from previous mail in description]
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-(cherry picked from commit dc6444b9c595dc40d7ead0837b930b83ec966e1f)
-Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
----
- hw/tpm/tpm_tis_sysbus.c | 18 ++++++++----------
- 1 file changed, 8 insertions(+), 10 deletions(-)
-
-diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
-index 3bea7cd16c..65ef59edd8 100644
---- a/hw/tpm/tpm_tis_sysbus.c
-+++ b/hw/tpm/tpm_tis_sysbus.c
-@@ -100,19 +100,9 @@ static void tpm_tis_sysbus_initfn(Object *obj)
- {
- TPMStateSysBus *sbdev = TPM_TIS_SYSBUS(obj);
- TPMState *s = &sbdev->state;
-- size_t host_page_size = qemu_real_host_page_size();
--
-- memory_region_init_io(&s->mmio, obj, &tpm_tis_memory_ops,
-- s, "tpm-tis-mmio",
-- TPM_TIS_NUM_LOCALITIES << TPM_TIS_LOCALITY_SHIFT);
-
- sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
- sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
--
-- s->ppi.buf = qemu_memalign(host_page_size,
-- ROUND_UP(TPM_PPI_ADDR_SIZE, host_page_size));
-- memory_region_init_ram_device_ptr(&s->ppi.ram, obj, "tpm-ppi",
-- TPM_PPI_ADDR_SIZE, s->ppi.buf);
- sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->ppi.ram);
- }
-
-@@ -120,6 +110,7 @@ static void tpm_tis_sysbus_realizefn(DeviceState *dev, Error **errp)
- {
- TPMStateSysBus *sbdev = TPM_TIS_SYSBUS(dev);
- TPMState *s = &sbdev->state;
-+ const size_t host_page_size = qemu_real_host_page_size();
-
- if (!tpm_find()) {
- error_setg(errp, "at most one TPM device is permitted");
-@@ -131,6 +122,13 @@ static void tpm_tis_sysbus_realizefn(DeviceState *dev, Error **errp)
- return;
- }
-
-+ s->ppi.buf = qemu_memalign(host_page_size,
-+ ROUND_UP(TPM_PPI_ADDR_SIZE, host_page_size));
-+ memory_region_init_io(&s->mmio, OBJECT(dev), &tpm_tis_memory_ops,
-+ s, "tpm-tis-mmio",
-+ TPM_TIS_NUM_LOCALITIES << TPM_TIS_LOCALITY_SHIFT);
-+ memory_region_init_ram_device_ptr(&s->ppi.ram, OBJECT(dev), "tpm-ppi",
-+ TPM_PPI_ADDR_SIZE, s->ppi.buf);
- vmstate_register_ram(&s->ppi.ram, dev);
- }
-
---
-2.52.0
-
diff --git a/kvm-hw-uefi-add-variable-digest-to-vmstate.patch b/kvm-hw-uefi-add-variable-digest-to-vmstate.patch
deleted file mode 100644
index d9c8a13..0000000
--- a/kvm-hw-uefi-add-variable-digest-to-vmstate.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-From b12eac2c22066ee4ff568a4108b38d7bdcd958cc Mon Sep 17 00:00:00 2001
-From: Gerd Hoffmann <kraxel@redhat.com>
-Date: Wed, 4 Mar 2026 08:05:34 +0100
-Subject: [PATCH 1/2] hw/uefi: add variable digest to vmstate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Gerd Hoffmann <kraxel@redhat.com>
-RH-MergeRequest: 471: hw/uefi: add variable digest to vmstate
-RH-Jira: RHEL-153058
-RH-Acked-by: Peter Xu <peterx@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/1] c300b30db6bafaacd11b8383531f04873bc8b428 (kraxel.rh/centos-src-qemu-kvm)
-
-Add digest to vmstate if needed. Also clear digest before loading
-to make sure it is initialized.
-
-Fixes: db1ecfb473ac ("hw/uefi: add var-service-vars.c")
-Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Message-ID: <20260304075954.584423-1-kraxel@redhat.com>
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-(cherry picked from commit b28c3ad1d63c2fe167b6f93fad1616ecd769e599)
-
-Resolves: RHEL-153058
----
- hw/uefi/var-service-vars.c | 36 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 36 insertions(+)
-
-diff --git a/hw/uefi/var-service-vars.c b/hw/uefi/var-service-vars.c
-index 8533533ea5..ed4e0a6494 100644
---- a/hw/uefi/var-service-vars.c
-+++ b/hw/uefi/var-service-vars.c
-@@ -37,8 +37,40 @@ const VMStateDescription vmstate_uefi_time = {
- },
- };
-
-+static int uefi_vars_pre_load(void *opaque)
-+{
-+ uefi_variable *var = opaque;
-+
-+ /* clear digest which is optional in the live migration data stream */
-+ var->digest = NULL;
-+ var->digest_size = 0;
-+ return 0;
-+}
-+
-+static bool uefi_vars_digest_is_needed(void *opaque)
-+{
-+ uefi_variable *var = opaque;
-+
-+ if ((var->attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) &&
-+ !uefi_vars_is_sb_any(var)) {
-+ return true;
-+ }
-+ return false;
-+}
-+
-+const VMStateDescription vmstate_uefi_variable_digest = {
-+ .name = "uefi-variable-digest",
-+ .needed = uefi_vars_digest_is_needed,
-+ .fields = (VMStateField[]) {
-+ VMSTATE_UINT32(digest_size, uefi_variable),
-+ VMSTATE_VBUFFER_ALLOC_UINT32(digest, uefi_variable, 0, NULL, digest_size),
-+ VMSTATE_END_OF_LIST()
-+ },
-+};
-+
- const VMStateDescription vmstate_uefi_variable = {
- .name = "uefi-variable",
-+ .pre_load = uefi_vars_pre_load,
- .fields = (VMStateField[]) {
- VMSTATE_UINT8_ARRAY_V(guid.data, uefi_variable, sizeof(QemuUUID), 0),
- VMSTATE_UINT32(name_size, uefi_variable),
-@@ -49,6 +81,10 @@ const VMStateDescription vmstate_uefi_variable = {
- VMSTATE_STRUCT(time, uefi_variable, 0, vmstate_uefi_time, efi_time),
- VMSTATE_END_OF_LIST()
- },
-+ .subsections = (const VMStateDescription * const []) {
-+ &vmstate_uefi_variable_digest,
-+ NULL
-+ }
- };
-
- uefi_variable *uefi_vars_find_variable(uefi_vars_state *uv, QemuUUID guid,
---
-2.47.3
-
diff --git a/kvm-hw-vfio-Add-helper-to-retrieve-device-feature.patch b/kvm-hw-vfio-Add-helper-to-retrieve-device-feature.patch
deleted file mode 100644
index 4cec952..0000000
--- a/kvm-hw-vfio-Add-helper-to-retrieve-device-feature.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From 35f299ce5e5e3d665ab3d9ce323ed375d45e1a80 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Wed, 21 Jan 2026 11:41:10 +0000
-Subject: [PATCH 115/116] hw/vfio: Add helper to retrieve device feature
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [99/100] a043c8344cededd1eb7eed7ac82cfd14aecebbe1 (rovick1/qemu-kvm)
-
-Add vfio_device_get_feature() as a common helper to retrieve
-VFIO device features.
-
-No functional change intended.
-
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20260121114111.34045-3-skolothumtho@nvidia.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit de36da106dcfd42ee79779a25713e86500276382)
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
----
- hw/vfio/container.c | 2 +-
- hw/vfio/device.c | 9 +++++++++
- hw/vfio/listener.c | 4 ++--
- include/hw/vfio/vfio-device.h | 3 +++
- 4 files changed, 15 insertions(+), 3 deletions(-)
-
-diff --git a/hw/vfio/container.c b/hw/vfio/container.c
-index cc0367ecc4..1b8569d36a 100644
---- a/hw/vfio/container.c
-+++ b/hw/vfio/container.c
-@@ -207,7 +207,7 @@ static int vfio_device_dma_logging_report(VFIODevice *vbasedev, hwaddr iova,
- feature->flags = VFIO_DEVICE_FEATURE_GET |
- VFIO_DEVICE_FEATURE_DMA_LOGGING_REPORT;
-
-- return vbasedev->io_ops->device_feature(vbasedev, feature);
-+ return vfio_device_get_feature(vbasedev, feature);
- }
-
- static int vfio_container_iommu_query_dirty_bitmap(
-diff --git a/hw/vfio/device.c b/hw/vfio/device.c
-index 8b63e765ac..330f2598ff 100644
---- a/hw/vfio/device.c
-+++ b/hw/vfio/device.c
-@@ -515,6 +515,15 @@ void vfio_device_unprepare(VFIODevice *vbasedev)
- vbasedev->bcontainer = NULL;
- }
-
-+int vfio_device_get_feature(VFIODevice *vbasedev,
-+ struct vfio_device_feature *feature)
-+{
-+ if (!vbasedev->io_ops || !vbasedev->io_ops->device_feature) {
-+ return -EINVAL;
-+ }
-+ return vbasedev->io_ops->device_feature(vbasedev, feature);
-+}
-+
- /*
- * Traditional ioctl() based io
- */
-diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
-index 27174bf87c..afcf518f56 100644
---- a/hw/vfio/listener.c
-+++ b/hw/vfio/listener.c
-@@ -880,7 +880,7 @@ static void vfio_devices_dma_logging_stop(VFIOContainer *bcontainer)
- continue;
- }
-
-- ret = vbasedev->io_ops->device_feature(vbasedev, feature);
-+ ret = vfio_device_get_feature(vbasedev, feature);
-
- if (ret != 0) {
- warn_report("%s: Failed to stop DMA logging, err %d (%s)",
-@@ -985,7 +985,7 @@ static bool vfio_devices_dma_logging_start(VFIOContainer *bcontainer,
- continue;
- }
-
-- ret = vbasedev->io_ops->device_feature(vbasedev, feature);
-+ ret = vfio_device_get_feature(vbasedev, feature);
- if (ret) {
- error_setg_errno(errp, -ret, "%s: Failed to start DMA logging",
- vbasedev->name);
-diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h
-index dac305fc6f..fc28f580ba 100644
---- a/include/hw/vfio/vfio-device.h
-+++ b/include/hw/vfio/vfio-device.h
-@@ -258,6 +258,9 @@ void vfio_device_prepare(VFIODevice *vbasedev, VFIOContainer *bcontainer,
-
- void vfio_device_unprepare(VFIODevice *vbasedev);
-
-+int vfio_device_get_feature(VFIODevice *vbasedev,
-+ struct vfio_device_feature *feature);
-+
- int vfio_device_get_region_info(VFIODevice *vbasedev, int index,
- struct vfio_region_info **info);
- int vfio_device_get_region_info_type(VFIODevice *vbasedev, uint32_t type,
---
-2.52.0
-
diff --git a/kvm-hw-vfio-Avoid-ram_addr_t-in-vfio_container_query_dir.patch b/kvm-hw-vfio-Avoid-ram_addr_t-in-vfio_container_query_dir.patch
deleted file mode 100644
index 7f458f5..0000000
--- a/kvm-hw-vfio-Avoid-ram_addr_t-in-vfio_container_query_dir.patch
+++ /dev/null
@@ -1,168 +0,0 @@
-From e8cf6a0ce9dff5c6868d3fb9ee6fc20160c6c31a Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
-Date: Tue, 30 Sep 2025 14:35:27 +0200
-Subject: [PATCH 083/116] hw/vfio: Avoid ram_addr_t in
- vfio_container_query_dirty_bitmap()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [67/100] 37966a76b51c15dbe4afed7f224e6347f2fd153f (rovick1/qemu-kvm)
-
-The 'ram_addr_t' type is described as:
-
- a QEMU internal address space that maps guest RAM physical
- addresses into an intermediate address space that can map
- to host virtual address spaces.
-
-vfio_container_query_dirty_bitmap() doesn't expect such QEMU
-intermediate address, but a guest physical addresses. Use the
-appropriate 'hwaddr' type, rename as @translated_addr for
-clarity.
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250930123528.42878-4-philmd@linaro.org
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 0ca70d3bf722a94c53f254670e6a642e77aa077c)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/container.c | 11 ++++++-----
- hw/vfio/listener.c | 18 +++++++++---------
- hw/vfio/trace-events | 2 +-
- include/hw/vfio/vfio-container.h | 3 ++-
- 4 files changed, 18 insertions(+), 16 deletions(-)
-
-diff --git a/hw/vfio/container.c b/hw/vfio/container.c
-index 250b20f424..9d69439371 100644
---- a/hw/vfio/container.c
-+++ b/hw/vfio/container.c
-@@ -246,7 +246,7 @@ static int vfio_container_devices_query_dirty_bitmap(
-
- int vfio_container_query_dirty_bitmap(const VFIOContainer *bcontainer,
- uint64_t iova, uint64_t size,
-- ram_addr_t ram_addr, Error **errp)
-+ hwaddr translated_addr, Error **errp)
- {
- bool all_device_dirty_tracking =
- vfio_container_devices_dirty_tracking_is_supported(bcontainer);
-@@ -255,7 +255,7 @@ int vfio_container_query_dirty_bitmap(const VFIOContainer *bcontainer,
- int ret;
-
- if (!bcontainer->dirty_pages_supported && !all_device_dirty_tracking) {
-- cpu_physical_memory_set_dirty_range(ram_addr, size,
-+ cpu_physical_memory_set_dirty_range(translated_addr, size,
- tcg_enabled() ? DIRTY_CLIENTS_ALL :
- DIRTY_CLIENTS_NOCODE);
- return 0;
-@@ -280,11 +280,12 @@ int vfio_container_query_dirty_bitmap(const VFIOContainer *bcontainer,
- goto out;
- }
-
-- dirty_pages = cpu_physical_memory_set_dirty_lebitmap(vbmap.bitmap, ram_addr,
-+ dirty_pages = cpu_physical_memory_set_dirty_lebitmap(vbmap.bitmap,
-+ translated_addr,
- vbmap.pages);
-
-- trace_vfio_container_query_dirty_bitmap(iova, size, vbmap.size, ram_addr,
-- dirty_pages);
-+ trace_vfio_container_query_dirty_bitmap(iova, size, vbmap.size,
-+ translated_addr, dirty_pages);
- out:
- g_free(vbmap.bitmap);
-
-diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
-index 3b6f17f0c3..a2c19a3cec 100644
---- a/hw/vfio/listener.c
-+++ b/hw/vfio/listener.c
-@@ -1059,7 +1059,7 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
- VFIOGuestIOMMU *giommu = gdn->giommu;
- VFIOContainer *bcontainer = giommu->bcontainer;
- hwaddr iova = iotlb->iova + giommu->iommu_offset;
-- ram_addr_t translated_addr;
-+ hwaddr translated_addr;
- Error *local_err = NULL;
- int ret = -EINVAL;
- MemoryRegion *mr;
-@@ -1108,8 +1108,8 @@ static int vfio_ram_discard_query_dirty_bitmap(MemoryRegionSection *section,
- {
- const hwaddr size = int128_get64(section->size);
- const hwaddr iova = section->offset_within_address_space;
-- const ram_addr_t ram_addr = memory_region_get_ram_addr(section->mr) +
-- section->offset_within_region;
-+ const hwaddr translated_addr = memory_region_get_ram_addr(section->mr) +
-+ section->offset_within_region;
- VFIORamDiscardListener *vrdl = opaque;
- Error *local_err = NULL;
- int ret;
-@@ -1118,8 +1118,8 @@ static int vfio_ram_discard_query_dirty_bitmap(MemoryRegionSection *section,
- * Sync the whole mapped region (spanning multiple individual mappings)
- * in one go.
- */
-- ret = vfio_container_query_dirty_bitmap(vrdl->bcontainer, iova, size, ram_addr,
-- &local_err);
-+ ret = vfio_container_query_dirty_bitmap(vrdl->bcontainer, iova, size,
-+ translated_addr, &local_err);
- if (ret) {
- error_report_err(local_err);
- }
-@@ -1183,7 +1183,7 @@ static int vfio_sync_iommu_dirty_bitmap(VFIOContainer *bcontainer,
- static int vfio_sync_dirty_bitmap(VFIOContainer *bcontainer,
- MemoryRegionSection *section, Error **errp)
- {
-- ram_addr_t ram_addr;
-+ hwaddr translated_addr;
-
- if (memory_region_is_iommu(section->mr)) {
- return vfio_sync_iommu_dirty_bitmap(bcontainer, section);
-@@ -1198,12 +1198,12 @@ static int vfio_sync_dirty_bitmap(VFIOContainer *bcontainer,
- return ret;
- }
-
-- ram_addr = memory_region_get_ram_addr(section->mr) +
-- section->offset_within_region;
-+ translated_addr = memory_region_get_ram_addr(section->mr) +
-+ section->offset_within_region;
-
- return vfio_container_query_dirty_bitmap(bcontainer,
- REAL_HOST_PAGE_ALIGN(section->offset_within_address_space),
-- int128_get64(section->size), ram_addr, errp);
-+ int128_get64(section->size), translated_addr, errp);
- }
-
- static void vfio_listener_log_sync(MemoryListener *listener,
-diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
-index b1b470cc29..1e895448cd 100644
---- a/hw/vfio/trace-events
-+++ b/hw/vfio/trace-events
-@@ -105,7 +105,7 @@ vfio_device_dirty_tracking_start(int nr_ranges, uint64_t min32, uint64_t max32,
- vfio_iommu_map_dirty_notify(uint64_t iova_start, uint64_t iova_end) "iommu dirty @ 0x%"PRIx64" - 0x%"PRIx64
-
- # container.c
--vfio_container_query_dirty_bitmap(uint64_t iova, uint64_t size, uint64_t bitmap_size, uint64_t start, uint64_t dirty_pages) "iova=0x%"PRIx64" size= 0x%"PRIx64" bitmap_size=0x%"PRIx64" start=0x%"PRIx64" dirty_pages=%"PRIu64
-+vfio_container_query_dirty_bitmap(uint64_t iova, uint64_t size, uint64_t bitmap_size, uint64_t translated_addr, uint64_t dirty_pages) "iova=0x%"PRIx64" size= 0x%"PRIx64" bitmap_size=0x%"PRIx64" gpa=0x%"PRIx64" dirty_pages=%"PRIu64
-
- # container-legacy.c
- vfio_container_disconnect(int fd) "close container->fd=%d"
-diff --git a/include/hw/vfio/vfio-container.h b/include/hw/vfio/vfio-container.h
-index b8fb2b8b5d..093c360f0e 100644
---- a/include/hw/vfio/vfio-container.h
-+++ b/include/hw/vfio/vfio-container.h
-@@ -98,7 +98,8 @@ bool vfio_container_dirty_tracking_is_started(
- bool vfio_container_devices_dirty_tracking_is_supported(
- const VFIOContainer *bcontainer);
- int vfio_container_query_dirty_bitmap(const VFIOContainer *bcontainer,
-- uint64_t iova, uint64_t size, ram_addr_t ram_addr, Error **errp);
-+ uint64_t iova, uint64_t size,
-+ hwaddr translated_addr, Error **errp);
-
- GList *vfio_container_get_iova_ranges(const VFIOContainer *bcontainer);
-
---
-2.52.0
-
diff --git a/kvm-hw-vfio-Reorder-vfio_container_query_dirty_bitmap-tr.patch b/kvm-hw-vfio-Reorder-vfio_container_query_dirty_bitmap-tr.patch
deleted file mode 100644
index 0dcc3ce..0000000
--- a/kvm-hw-vfio-Reorder-vfio_container_query_dirty_bitmap-tr.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 0f58afac81fd3fcf07e130d359eb54b754d7b6e0 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
-Date: Tue, 30 Sep 2025 14:35:26 +0200
-Subject: [PATCH 082/116] hw/vfio: Reorder vfio_container_query_dirty_bitmap()
- trace format
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [66/100] 4b0f19201e5684ab27d2fb46e55a65a965ce45da (rovick1/qemu-kvm)
-
-Update the trace-events comments after the changes from
-commit dcce51b1938 ("hw/vfio/container-base.c: rename file
-to container.c") and commit a3bcae62b6a ("hw/vfio/container.c:
-rename file to container-legacy.c").
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250930123528.42878-3-philmd@linaro.org
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 5764a715277afc4d6076fbf2bae1697dbd2fa182)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/trace-events | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
-index 7496e1b64b..b1b470cc29 100644
---- a/hw/vfio/trace-events
-+++ b/hw/vfio/trace-events
-@@ -104,10 +104,10 @@ vfio_device_dirty_tracking_update(uint64_t start, uint64_t end, uint64_t min, ui
- vfio_device_dirty_tracking_start(int nr_ranges, uint64_t min32, uint64_t max32, uint64_t min64, uint64_t max64, uint64_t minpci, uint64_t maxpci) "nr_ranges %d 32:[0x%"PRIx64" - 0x%"PRIx64"], 64:[0x%"PRIx64" - 0x%"PRIx64"], pci64:[0x%"PRIx64" - 0x%"PRIx64"]"
- vfio_iommu_map_dirty_notify(uint64_t iova_start, uint64_t iova_end) "iommu dirty @ 0x%"PRIx64" - 0x%"PRIx64
-
--# container-base.c
-+# container.c
- vfio_container_query_dirty_bitmap(uint64_t iova, uint64_t size, uint64_t bitmap_size, uint64_t start, uint64_t dirty_pages) "iova=0x%"PRIx64" size= 0x%"PRIx64" bitmap_size=0x%"PRIx64" start=0x%"PRIx64" dirty_pages=%"PRIu64
-
--# container.c
-+# container-legacy.c
- vfio_container_disconnect(int fd) "close container->fd=%d"
- vfio_group_put(int fd) "close group->fd=%d"
- vfio_device_get(const char * name, unsigned int flags, unsigned int num_regions, unsigned int num_irqs) "Device %s flags: %u, regions: %u, irqs: %u"
---
-2.52.0
-
diff --git a/kvm-hw-vfio-Use-uint64_t-for-IOVA-mapping-size-in-vfio_c.patch b/kvm-hw-vfio-Use-uint64_t-for-IOVA-mapping-size-in-vfio_c.patch
deleted file mode 100644
index 6372e0b..0000000
--- a/kvm-hw-vfio-Use-uint64_t-for-IOVA-mapping-size-in-vfio_c.patch
+++ /dev/null
@@ -1,229 +0,0 @@
-From 4b7e28827bbe71127a7847040b5b92140fd411ad Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
-Date: Tue, 30 Sep 2025 14:35:28 +0200
-Subject: [PATCH 084/116] hw/vfio: Use uint64_t for IOVA mapping size in
- vfio_container_dma_*map
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [68/100] f8b00f9ff83c4438173efed13b0b336459541877 (rovick1/qemu-kvm)
-
-The 'ram_addr_t' type is described as:
-
- a QEMU internal address space that maps guest RAM physical
- addresses into an intermediate address space that can map
- to host virtual address spaces.
-
-This doesn't represent well an IOVA mapping size. Simply use
-the uint64_t type.
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250930123528.42878-5-philmd@linaro.org
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit f0b52aa08ab0868c18d881381a8fda4b59b37517)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/container.c | 4 ++--
- hw/vfio/container-legacy.c | 8 ++++----
- hw/vfio/container.c | 4 ++--
- hw/vfio/cpr-legacy.c | 2 +-
- hw/vfio/iommufd.c | 6 +++---
- include/hw/vfio/vfio-container.h | 10 +++++-----
- include/hw/vfio/vfio-cpr.h | 2 +-
- 7 files changed, 18 insertions(+), 18 deletions(-)
-
-diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c
-index 411eb7b28b..e45192fef6 100644
---- a/hw/vfio-user/container.c
-+++ b/hw/vfio-user/container.c
-@@ -39,7 +39,7 @@ static void vfio_user_listener_commit(VFIOContainer *bcontainer)
- }
-
- static int vfio_user_dma_unmap(const VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all)
- {
- VFIOUserContainer *container = VFIO_IOMMU_USER(bcontainer);
-@@ -81,7 +81,7 @@ static int vfio_user_dma_unmap(const VFIOContainer *bcontainer,
- }
-
- static int vfio_user_dma_map(const VFIOContainer *bcontainer, hwaddr iova,
-- ram_addr_t size, void *vaddr, bool readonly,
-+ uint64_t size, void *vaddr, bool readonly,
- MemoryRegion *mrp)
- {
- VFIOUserContainer *container = VFIO_IOMMU_USER(bcontainer);
-diff --git a/hw/vfio/container-legacy.c b/hw/vfio/container-legacy.c
-index 2d19d97e2d..1394dd6fe8 100644
---- a/hw/vfio/container-legacy.c
-+++ b/hw/vfio/container-legacy.c
-@@ -83,7 +83,7 @@ static int vfio_ram_block_discard_disable(VFIOLegacyContainer *container,
- }
-
- static int vfio_dma_unmap_bitmap(const VFIOLegacyContainer *container,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- IOMMUTLBEntry *iotlb)
- {
- const VFIOContainer *bcontainer = VFIO_IOMMU(container);
-@@ -136,7 +136,7 @@ unmap_exit:
- }
-
- static int vfio_legacy_dma_unmap_one(const VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- IOMMUTLBEntry *iotlb)
- {
- const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-@@ -181,7 +181,7 @@ static int vfio_legacy_dma_unmap_one(const VFIOContainer *bcontainer,
- * DMA - Mapping and unmapping for the "type1" IOMMU interface used on x86
- */
- static int vfio_legacy_dma_unmap(const VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all)
- {
- int ret;
-@@ -206,7 +206,7 @@ static int vfio_legacy_dma_unmap(const VFIOContainer *bcontainer,
- }
-
- static int vfio_legacy_dma_map(const VFIOContainer *bcontainer, hwaddr iova,
-- ram_addr_t size, void *vaddr, bool readonly,
-+ uint64_t size, void *vaddr, bool readonly,
- MemoryRegion *mr)
- {
- const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-diff --git a/hw/vfio/container.c b/hw/vfio/container.c
-index 9d69439371..41de343924 100644
---- a/hw/vfio/container.c
-+++ b/hw/vfio/container.c
-@@ -74,7 +74,7 @@ void vfio_address_space_insert(VFIOAddressSpace *space,
- }
-
- int vfio_container_dma_map(VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- void *vaddr, bool readonly, MemoryRegion *mr)
- {
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
-@@ -93,7 +93,7 @@ int vfio_container_dma_map(VFIOContainer *bcontainer,
- }
-
- int vfio_container_dma_unmap(VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all)
- {
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
-diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
-index bbf7a0d35f..3a1d126556 100644
---- a/hw/vfio/cpr-legacy.c
-+++ b/hw/vfio/cpr-legacy.c
-@@ -39,7 +39,7 @@ static bool vfio_dma_unmap_vaddr_all(VFIOLegacyContainer *container,
- * The incoming state is cleared thereafter.
- */
- static int vfio_legacy_cpr_dma_map(const VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size, void *vaddr,
-+ hwaddr iova, uint64_t size, void *vaddr,
- bool readonly, MemoryRegion *mr)
- {
- const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index 76f0806ec0..10fc065d20 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -35,7 +35,7 @@
- TYPE_HOST_IOMMU_DEVICE_IOMMUFD "-vfio"
-
- static int iommufd_cdev_map(const VFIOContainer *bcontainer, hwaddr iova,
-- ram_addr_t size, void *vaddr, bool readonly,
-+ uint64_t size, void *vaddr, bool readonly,
- MemoryRegion *mr)
- {
- const VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
-@@ -46,7 +46,7 @@ static int iommufd_cdev_map(const VFIOContainer *bcontainer, hwaddr iova,
- }
-
- static int iommufd_cdev_map_file(const VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- int fd, unsigned long start, bool readonly)
- {
- const VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
-@@ -57,7 +57,7 @@ static int iommufd_cdev_map_file(const VFIOContainer *bcontainer,
- }
-
- static int iommufd_cdev_unmap(const VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all)
- {
- const VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
-diff --git a/include/hw/vfio/vfio-container.h b/include/hw/vfio/vfio-container.h
-index 093c360f0e..c4b58d664b 100644
---- a/include/hw/vfio/vfio-container.h
-+++ b/include/hw/vfio/vfio-container.h
-@@ -81,10 +81,10 @@ void vfio_address_space_insert(VFIOAddressSpace *space,
- VFIOContainer *bcontainer);
-
- int vfio_container_dma_map(VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- void *vaddr, bool readonly, MemoryRegion *mr);
- int vfio_container_dma_unmap(VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all);
- bool vfio_container_add_section_window(VFIOContainer *bcontainer,
- MemoryRegionSection *section,
-@@ -167,7 +167,7 @@ struct VFIOIOMMUClass {
- * Returns 0 to indicate success and -errno otherwise.
- */
- int (*dma_map)(const VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- void *vaddr, bool readonly, MemoryRegion *mr);
- /**
- * @dma_map_file
-@@ -182,7 +182,7 @@ struct VFIOIOMMUClass {
- * @readonly: map read only if true
- */
- int (*dma_map_file)(const VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- int fd, unsigned long start, bool readonly);
- /**
- * @dma_unmap
-@@ -198,7 +198,7 @@ struct VFIOIOMMUClass {
- * Returns 0 to indicate success and -errno otherwise.
- */
- int (*dma_unmap)(const VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all);
-
-
-diff --git a/include/hw/vfio/vfio-cpr.h b/include/hw/vfio/vfio-cpr.h
-index 26ee0c4fe1..81f4e24e22 100644
---- a/include/hw/vfio/vfio-cpr.h
-+++ b/include/hw/vfio/vfio-cpr.h
-@@ -21,7 +21,7 @@ struct VFIOIOMMUFDContainer;
- struct IOMMUFDBackend;
-
- typedef int (*dma_map_fn)(const struct VFIOContainer *bcontainer,
-- hwaddr iova, ram_addr_t size, void *vaddr,
-+ hwaddr iova, uint64_t size, void *vaddr,
- bool readonly, MemoryRegion *mr);
-
- typedef struct VFIOContainerCPR {
---
-2.52.0
-
diff --git a/kvm-hw-vfio-align-mmap-to-power-of-2-of-region-size-for-.patch b/kvm-hw-vfio-align-mmap-to-power-of-2-of-region-size-for-.patch
deleted file mode 100644
index 5a21526..0000000
--- a/kvm-hw-vfio-align-mmap-to-power-of-2-of-region-size-for-.patch
+++ /dev/null
@@ -1,186 +0,0 @@
-From 3107adc6f949c4e6b92d78c3311f2aad3e3bdc85 Mon Sep 17 00:00:00 2001
-From: Ankit Agrawal <ankita@nvidia.com>
-Date: Tue, 17 Feb 2026 15:30:10 +0000
-Subject: [PATCH 3/4] hw/vfio: align mmap to power-of-2 of region size for
- hugepfnmap
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Cédric Le Goater <clg@redhat.com>
-RH-MergeRequest: 500: NVIDIA:Grace:Backport hw/vfio: Enable hugepfnmap for non-power-of-2 device memory regions - GB200
-RH-Jira: RHEL-150900
-RH-Acked-by: Rodolfo Vick <None>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [3/3] 34c31321e6c6613b7de013250a7f2927046b831d (clegoate/qemu-kvm-centos)
-
-On Grace-based systems such as GB200, device memory is exposed as a
-BAR but the actual mappable size is not power-of-2 aligned. The
-previous algorithm aligned each sparse mmap area based on its
-individual size using ctz64() which prevented efficient huge page
-usage by the kernel.
-
-Adjust VFIO region mapping alignment to use the next power-of-2 of
-the total region size and place the sparse subregions at their
-appropriate offset. This provides better opportunities to get huge
-alignment allowing the kernel to use larger page sizes for the VMA.
-
-This enables the use of PMD-level huge pages which can significantly
-improve memory access performance and reduce TLB pressure for large
-device memory regions.
-
-With this change:
-- Create a single aligned base mapping for the entire region
-- Change Alignment to be based on pow2ceil(region->size), capped at 1GiB
-- Unmap gaps between sparse regions
-- Use MAP_FIXED to overlay sparse mmap areas at their offsets
-
-Example VMA for device memory of size 0x2F00F00000 on GB200:
-
-Before (misaligned, no hugepfnmap):
-ff88ff000000-ffb7fff00000 rw-s 400000000000 00:06 727 /dev/vfio/devices/vfio1
-
-After (aligned to 1GiB boundary, hugepfnmap enabled):
-ff8ac0000000-ffb9c0f00000 rw-s 400000000000 00:06 727 /dev/vfio/devices/vfio1
-
-Requires sparse regions to be sorted by offset (done in previous
-patch) to correctly identify and handle gaps.
-
-cc: Alex Williamson <alex@shazbot.org>
-Reviewed-by: Alex Williamson <alex@shazbot.org>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
-Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20260217153010.408739-4-ankita@nvidia.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 3863e47828d5bda1776fb7588a2187c7fba1d0c2)
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
----
- hw/vfio/region.c | 86 +++++++++++++++++++++++++++++++++---------------
- 1 file changed, 59 insertions(+), 27 deletions(-)
-
-diff --git a/hw/vfio/region.c b/hw/vfio/region.c
-index 055033a79e..1e9915fdd3 100644
---- a/hw/vfio/region.c
-+++ b/hw/vfio/region.c
-@@ -344,8 +344,11 @@ static bool vfio_region_create_dma_buf(VFIORegion *region, Error **errp)
-
- int vfio_region_mmap(VFIORegion *region)
- {
-- int i, ret, prot = 0;
-+ void *map_base, *map_align;
- Error *local_err = NULL;
-+ int i, ret, prot = 0;
-+ off_t map_offset = 0;
-+ size_t align;
- char *name;
- int fd;
-
-@@ -356,41 +359,61 @@ int vfio_region_mmap(VFIORegion *region)
- prot |= region->flags & VFIO_REGION_INFO_FLAG_READ ? PROT_READ : 0;
- prot |= region->flags & VFIO_REGION_INFO_FLAG_WRITE ? PROT_WRITE : 0;
-
-- for (i = 0; i < region->nr_mmaps; i++) {
-- size_t align = MIN(1ULL << ctz64(region->mmaps[i].size), 1 * GiB);
-- void *map_base, *map_align;
-+ /*
-+ * Align the mmap for more efficient mapping in the kernel. Ideally
-+ * we'd know the PMD and PUD mapping sizes to use as discrete alignment
-+ * intervals, but we don't. As of Linux v6.19, the largest PUD size
-+ * supporting huge pfnmap is 1GiB (ARCH_SUPPORTS_PUD_PFNMAP is only set
-+ * on x86_64).
-+ *
-+ * Align by power-of-two of the size of the entire region - capped
-+ * by 1G - and place the sparse subregions at their appropriate offset.
-+ * This will get maximum alignment.
-+ *
-+ * NB. qemu_memalign() and friends actually allocate memory, whereas
-+ * the region size here can exceed host memory, therefore we manually
-+ * create an oversized anonymous mapping and clean it up for alignment.
-+ */
-
-- /*
-- * Align the mmap for more efficient mapping in the kernel. Ideally
-- * we'd know the PMD and PUD mapping sizes to use as discrete alignment
-- * intervals, but we don't. As of Linux v6.12, the largest PUD size
-- * supporting huge pfnmap is 1GiB (ARCH_SUPPORTS_PUD_PFNMAP is only set
-- * on x86_64). Align by power-of-two size, capped at 1GiB.
-- *
-- * NB. qemu_memalign() and friends actually allocate memory, whereas
-- * the region size here can exceed host memory, therefore we manually
-- * create an oversized anonymous mapping and clean it up for alignment.
-- */
-- map_base = mmap(0, region->mmaps[i].size + align, PROT_NONE,
-- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-- if (map_base == MAP_FAILED) {
-- ret = -errno;
-- goto no_mmap;
-- }
-+ align = MIN(pow2ceil(region->size), 1 * GiB);
-
-- fd = vfio_device_get_region_fd(region->vbasedev, region->nr);
-+ map_base = mmap(0, region->size + align, PROT_NONE,
-+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-+ if (map_base == MAP_FAILED) {
-+ ret = -errno;
-+ trace_vfio_region_mmap_fault(memory_region_name(region->mem), -1,
-+ region->fd_offset,
-+ region->fd_offset + region->size - 1, ret);
-+ return ret;
-+ }
-+
-+ fd = vfio_device_get_region_fd(region->vbasedev, region->nr);
-
-- map_align = (void *)ROUND_UP((uintptr_t)map_base, (uintptr_t)align);
-- munmap(map_base, map_align - map_base);
-- munmap(map_align + region->mmaps[i].size,
-- align - (map_align - map_base));
-+ map_align = (void *)ROUND_UP((uintptr_t)map_base, (uintptr_t)align);
-+ munmap(map_base, map_align - map_base);
-+ munmap(map_align + region->size,
-+ align - (map_align - map_base));
-
-- region->mmaps[i].mmap = mmap(map_align, region->mmaps[i].size, prot,
-+ /*
-+ * Regions should already be sorted by vfio_setup_region_sparse_mmaps().
-+ * This is critical for the following algorithm which relies on range
-+ * offsets being in ascending order.
-+ */
-+ for (i = 0; i < region->nr_mmaps; i++) {
-+ munmap(map_align + map_offset, region->mmaps[i].offset - map_offset);
-+ region->mmaps[i].mmap = mmap(map_align + region->mmaps[i].offset,
-+ region->mmaps[i].size, prot,
- MAP_SHARED | MAP_FIXED, fd,
- region->fd_offset +
- region->mmaps[i].offset);
- if (region->mmaps[i].mmap == MAP_FAILED) {
- ret = -errno;
-+ /*
-+ * Only unmap the rest of the region. Any mmaps that were successful
-+ * will be unmapped in no_mmap.
-+ */
-+ munmap(map_align + region->mmaps[i].offset,
-+ region->size - region->mmaps[i].offset);
- goto no_mmap;
- }
-
-@@ -408,6 +431,15 @@ int vfio_region_mmap(VFIORegion *region)
- region->mmaps[i].offset,
- region->mmaps[i].offset +
- region->mmaps[i].size - 1);
-+
-+ map_offset = region->mmaps[i].offset + region->mmaps[i].size;
-+ }
-+
-+ /*
-+ * Unmap the rest of the region not covered by sparse mmap.
-+ */
-+ if (map_offset < region->size) {
-+ munmap(map_align + map_offset, region->size - map_offset);
- }
-
- if (!vfio_region_create_dma_buf(region, &local_err)) {
---
-2.52.0
-
diff --git a/kvm-hw-vfio-container-base.c-rename-file-to-container.c.patch b/kvm-hw-vfio-container-base.c-rename-file-to-container.c.patch
deleted file mode 100644
index 9d6c893..0000000
--- a/kvm-hw-vfio-container-base.c-rename-file-to-container.c.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From c02ac939008f965072aeeba93c540fcedbd85422 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:14 +0100
-Subject: [PATCH 056/116] hw/vfio/container-base.c: rename file to container.c
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [40/100] dfbd85fffb2e87d12dc0e426c5b7e054b02ab6a5 (rovick1/qemu-kvm)
-
-Rename the file to reflect the previous rename of VFIOContainerBase to
-VFIOContainer.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-7-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit dcce51b19385ea65ac6db295204716a9eb311fbf)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/{container-base.c => container.c} | 0
- hw/vfio/meson.build | 2 +-
- 2 files changed, 1 insertion(+), 1 deletion(-)
- rename hw/vfio/{container-base.c => container.c} (100%)
-
-diff --git a/hw/vfio/container-base.c b/hw/vfio/container.c
-similarity index 100%
-rename from hw/vfio/container-base.c
-rename to hw/vfio/container.c
-diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
-index 62b7a7eaac..82f68698fb 100644
---- a/hw/vfio/meson.build
-+++ b/hw/vfio/meson.build
-@@ -3,7 +3,7 @@
- vfio_ss = ss.source_set()
- vfio_ss.add(files(
- 'listener.c',
-- 'container-base.c',
-+ 'container.c',
- 'container-legacy.c',
- 'helpers.c',
- ))
---
-2.52.0
-
diff --git a/kvm-hw-vfio-container.c-rename-file-to-container-legacy..patch b/kvm-hw-vfio-container.c-rename-file-to-container-legacy..patch
deleted file mode 100644
index b77e643..0000000
--- a/kvm-hw-vfio-container.c-rename-file-to-container-legacy..patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 039f7c0cfeef7e5e7194d73659dad82bd1919443 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:13 +0100
-Subject: [PATCH 055/116] hw/vfio/container.c: rename file to
- container-legacy.c
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [39/100] 6075f31c1e5d6bbb311f53e27578ba07da404e3e (rovick1/qemu-kvm)
-
-This file is mostly concerned with the VFIOLegacyContainer implementation so
-rename it to reflect the previous rename of VFIOContainer to
-VFIOLegacyContainer.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-6-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit a3bcae62b6a161dea4521f254f19c5a8551c28af)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/{container.c => container-legacy.c} | 0
- hw/vfio/meson.build | 2 +-
- 2 files changed, 1 insertion(+), 1 deletion(-)
- rename hw/vfio/{container.c => container-legacy.c} (100%)
-
-diff --git a/hw/vfio/container.c b/hw/vfio/container-legacy.c
-similarity index 100%
-rename from hw/vfio/container.c
-rename to hw/vfio/container-legacy.c
-diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
-index d3ed3cb7ac..62b7a7eaac 100644
---- a/hw/vfio/meson.build
-+++ b/hw/vfio/meson.build
-@@ -4,7 +4,7 @@ vfio_ss = ss.source_set()
- vfio_ss.add(files(
- 'listener.c',
- 'container-base.c',
-- 'container.c',
-+ 'container-legacy.c',
- 'helpers.c',
- ))
- vfio_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr.c'))
---
-2.52.0
-
diff --git a/kvm-hw-vfio-container.c-use-QOM-casts-where-appropriate.patch b/kvm-hw-vfio-container.c-use-QOM-casts-where-appropriate.patch
deleted file mode 100644
index be56647..0000000
--- a/kvm-hw-vfio-container.c-use-QOM-casts-where-appropriate.patch
+++ /dev/null
@@ -1,157 +0,0 @@
-From ba4501f8c8795401824e3c0dc52fe847d1518525 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:44 +0100
-Subject: [PATCH 032/116] hw/vfio/container.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [16/100] 3d3b2f56e36aae0e24b84ac733de5ac82c12ebf7 (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOContainer and VFIOContainerBase instead
-of accessing bcontainer directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-5-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 5947f69b63639b54f02db1727c559f8aae32d849)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/container.c | 31 +++++++++++++------------------
- 1 file changed, 13 insertions(+), 18 deletions(-)
-
-diff --git a/hw/vfio/container.c b/hw/vfio/container.c
-index c1554c1fd1..860d1aebda 100644
---- a/hw/vfio/container.c
-+++ b/hw/vfio/container.c
-@@ -85,7 +85,7 @@ static int vfio_dma_unmap_bitmap(const VFIOContainer *container,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb)
- {
-- const VFIOContainerBase *bcontainer = &container->bcontainer;
-+ const VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
- struct vfio_iommu_type1_dma_unmap *unmap;
- struct vfio_bitmap *bitmap;
- VFIOBitmap vbmap;
-@@ -138,8 +138,7 @@ static int vfio_legacy_dma_unmap_one(const VFIOContainerBase *bcontainer,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb)
- {
-- const VFIOContainer *container = container_of(bcontainer, VFIOContainer,
-- bcontainer);
-+ const VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- struct vfio_iommu_type1_dma_unmap unmap = {
- .argsz = sizeof(unmap),
- .flags = 0,
-@@ -227,8 +226,7 @@ static int vfio_legacy_dma_map(const VFIOContainerBase *bcontainer, hwaddr iova,
- ram_addr_t size, void *vaddr, bool readonly,
- MemoryRegion *mr)
- {
-- const VFIOContainer *container = container_of(bcontainer, VFIOContainer,
-- bcontainer);
-+ const VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- struct vfio_iommu_type1_dma_map map = {
- .argsz = sizeof(map),
- .flags = VFIO_DMA_MAP_FLAG_READ,
-@@ -260,8 +258,7 @@ static int
- vfio_legacy_set_dirty_page_tracking(const VFIOContainerBase *bcontainer,
- bool start, Error **errp)
- {
-- const VFIOContainer *container = container_of(bcontainer, VFIOContainer,
-- bcontainer);
-+ const VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- int ret;
- struct vfio_iommu_type1_dirty_bitmap dirty = {
- .argsz = sizeof(dirty),
-@@ -286,8 +283,7 @@ vfio_legacy_set_dirty_page_tracking(const VFIOContainerBase *bcontainer,
- static int vfio_legacy_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
- VFIOBitmap *vbmap, hwaddr iova, hwaddr size, Error **errp)
- {
-- const VFIOContainer *container = container_of(bcontainer, VFIOContainer,
-- bcontainer);
-+ const VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- struct vfio_iommu_type1_dirty_bitmap *dbitmap;
- struct vfio_iommu_type1_dirty_bitmap_get *range;
- int ret;
-@@ -509,7 +505,7 @@ static void vfio_get_iommu_info_migration(VFIOContainer *container,
- {
- struct vfio_info_cap_header *hdr;
- struct vfio_iommu_type1_info_cap_migration *cap_mig;
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-
- hdr = vfio_get_iommu_info_cap(info, VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION);
- if (!hdr) {
-@@ -532,8 +528,7 @@ static void vfio_get_iommu_info_migration(VFIOContainer *container,
-
- static bool vfio_legacy_setup(VFIOContainerBase *bcontainer, Error **errp)
- {
-- VFIOContainer *container = container_of(bcontainer, VFIOContainer,
-- bcontainer);
-+ VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- g_autofree struct vfio_iommu_type1_info *info = NULL;
- int ret;
-
-@@ -648,7 +643,7 @@ static bool vfio_container_connect(VFIOGroup *group, AddressSpace *as,
-
- if (!cpr_is_incoming()) {
- QLIST_FOREACH(bcontainer, &space->containers, next) {
-- container = container_of(bcontainer, VFIOContainer, bcontainer);
-+ container = VFIO_IOMMU_LEGACY(bcontainer);
- if (!ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &container->fd)) {
- return vfio_container_group_add(container, group, errp);
- }
-@@ -666,7 +661,7 @@ static bool vfio_container_connect(VFIOGroup *group, AddressSpace *as,
- * create the container struct and group list.
- */
- QLIST_FOREACH(bcontainer, &space->containers, next) {
-- container = container_of(bcontainer, VFIOContainer, bcontainer);
-+ container = VFIO_IOMMU_LEGACY(bcontainer);
-
- if (vfio_cpr_container_match(container, group, fd)) {
- return vfio_container_group_add(container, group, errp);
-@@ -686,7 +681,7 @@ static bool vfio_container_connect(VFIOGroup *group, AddressSpace *as,
- goto fail;
- }
- new_container = true;
-- bcontainer = &container->bcontainer;
-+ bcontainer = VFIO_IOMMU(container);
-
- if (!vfio_legacy_cpr_register_container(container, errp)) {
- goto fail;
-@@ -749,7 +744,7 @@ fail:
- static void vfio_container_disconnect(VFIOGroup *group)
- {
- VFIOContainer *container = group->container;
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
-
- QLIST_REMOVE(group, container_next);
-@@ -795,7 +790,7 @@ static VFIOGroup *vfio_group_get(int groupid, AddressSpace *as, Error **errp)
- QLIST_FOREACH(group, &vfio_group_list, next) {
- if (group->groupid == groupid) {
- /* Found it. Now is it already in the right context? */
-- if (group->container->bcontainer.space->as == as) {
-+ if (VFIO_IOMMU(group->container)->space->as == as) {
- return group;
- } else {
- error_setg(errp, "group %d used in multiple address spaces",
-@@ -909,7 +904,7 @@ static bool vfio_device_get(VFIOGroup *group, const char *name,
- }
- }
-
-- vfio_device_prepare(vbasedev, &group->container->bcontainer, info);
-+ vfio_device_prepare(vbasedev, VFIO_IOMMU(group->container), info);
-
- vbasedev->fd = fd;
- vbasedev->group = group;
---
-2.52.0
-
diff --git a/kvm-hw-vfio-cpr-legacy.c-use-QOM-casts-where-appropriate.patch b/kvm-hw-vfio-cpr-legacy.c-use-QOM-casts-where-appropriate.patch
deleted file mode 100644
index 830797c..0000000
--- a/kvm-hw-vfio-cpr-legacy.c-use-QOM-casts-where-appropriate.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From 2e971be1abd843adc6b2c44319fcbcfd449fbcdc Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:43 +0100
-Subject: [PATCH 031/116] hw/vfio/cpr-legacy.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [15/100] 370450fb93e7f95c8c47bfce6dbe3842e5278f17 (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOContainer and VFIOContainerBase instead
-of accessing bcontainer directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-4-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 5255ba39b16539bd4b28a961d196812af1684c02)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/cpr-legacy.c | 14 +++++++-------
- 1 file changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
-index 553b203e9b..8f437194fa 100644
---- a/hw/vfio/cpr-legacy.c
-+++ b/hw/vfio/cpr-legacy.c
-@@ -41,8 +41,8 @@ static int vfio_legacy_cpr_dma_map(const VFIOContainerBase *bcontainer,
- hwaddr iova, ram_addr_t size, void *vaddr,
- bool readonly, MemoryRegion *mr)
- {
-- const VFIOContainer *container = container_of(bcontainer, VFIOContainer,
-- bcontainer);
-+ const VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+
- struct vfio_iommu_type1_dma_map map = {
- .argsz = sizeof(map),
- .flags = VFIO_DMA_MAP_FLAG_VADDR,
-@@ -65,7 +65,7 @@ static void vfio_region_remap(MemoryListener *listener,
- {
- VFIOContainer *container = container_of(listener, VFIOContainer,
- cpr.remap_listener);
-- vfio_container_region_add(&container->bcontainer, section, true);
-+ vfio_container_region_add(VFIO_IOMMU(container), section, true);
- }
-
- static bool vfio_cpr_supported(VFIOContainer *container, Error **errp)
-@@ -98,7 +98,7 @@ static int vfio_container_pre_save(void *opaque)
- static int vfio_container_post_load(void *opaque, int version_id)
- {
- VFIOContainer *container = opaque;
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
- dma_map_fn saved_dma_map = vioc->dma_map;
- Error *local_err = NULL;
-@@ -135,7 +135,7 @@ static int vfio_cpr_fail_notifier(NotifierWithReturn *notifier,
- {
- VFIOContainer *container =
- container_of(notifier, VFIOContainer, cpr.transfer_notifier);
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-
- if (e->type != MIG_EVENT_PRECOPY_FAILED) {
- return 0;
-@@ -167,7 +167,7 @@ static int vfio_cpr_fail_notifier(NotifierWithReturn *notifier,
-
- bool vfio_legacy_cpr_register_container(VFIOContainer *container, Error **errp)
- {
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
- Error **cpr_blocker = &container->cpr.blocker;
-
- migration_add_notifier_mode(&bcontainer->cpr_reboot_notifier,
-@@ -191,7 +191,7 @@ bool vfio_legacy_cpr_register_container(VFIOContainer *container, Error **errp)
-
- void vfio_legacy_cpr_unregister_container(VFIOContainer *container)
- {
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-
- migration_remove_notifier(&bcontainer->cpr_reboot_notifier);
- migrate_del_blocker(&container->cpr.blocker);
---
-2.52.0
-
diff --git a/kvm-hw-vfio-iommufd-Control-dirty-tracking-for-nesting-p.patch b/kvm-hw-vfio-iommufd-Control-dirty-tracking-for-nesting-p.patch
deleted file mode 100644
index a269407..0000000
--- a/kvm-hw-vfio-iommufd-Control-dirty-tracking-for-nesting-p.patch
+++ /dev/null
@@ -1,143 +0,0 @@
-From 8b71f97dfda4e0df08b3a8b83657b7c6ccfea6e1 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Wed, 1 Apr 2026 09:41:33 +0100
-Subject: [PATCH 077/111] hw/vfio/iommufd: Control dirty tracking for nesting
- parent HWPT
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [77/111] 74b083b2e35b690c32dc01ec37abe76f2f7a63cb (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Conflicts: contextual in all changed files. In hw/i386/intel_iommu.c
-we do not have nested intel iommu downstream, so impacted code does not
-exist. In hw/vfio/device.c and include/hw/vfio/vfio-device.h this is
-due to out of order de36da106dcf hw/vfio: Add helper to retrieve device feature
-backport
-
-QEMU smmuv3 accel does not support live migration yet, so dirty
-tracking for the nesting parent HWPT is not useful.
-
-Also, nested vIOMMU use cases can break on some platforms. For
-example, SMMUv3 with HTTU may advertise dirty tracking capability,
-but the kernel supports it only for stage-1. Requesting dirty
-tracking for a nesting parent HWPT (stage-2) can fail.
-
-Add a vIOMMU flag to explicitly request dirty tracking for the
-nesting parent HWPT. For nested cases, dirty tracking is enabled
-only when requested by the vIOMMU.
-
-Non-nested cases and Intel vIOMMU keep the existing behavior.
-
-Fixes: fc6dafb98cec ("hw/arm/smmuv3: Implement get_viommu_cap() callback")
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Link: https://lore.kernel.org/qemu-devel/20260401084133.56266-1-skolothumtho@nvidia.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 659275f84694e7b06d67d877137905d371a3fde4)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/device.c | 11 +++++++++++
- hw/vfio/iommufd.c | 11 +++++++++--
- include/hw/core/iommu.h | 2 ++
- include/hw/vfio/vfio-device.h | 3 ++-
- 4 files changed, 24 insertions(+), 3 deletions(-)
-
-diff --git a/hw/vfio/device.c b/hw/vfio/device.c
-index c01eb72ee7..4bd2476464 100644
---- a/hw/vfio/device.c
-+++ b/hw/vfio/device.c
-@@ -526,6 +526,17 @@ int vfio_device_get_feature(VFIODevice *vbasedev,
- return vbasedev->io_ops->device_feature(vbasedev, feature);
- }
-
-+bool vfio_device_get_viommu_flags_want_nesting_dirty(VFIODevice *vbasedev)
-+{
-+ VFIOPCIDevice *vdev = vfio_pci_from_vfio_device(vbasedev);
-+
-+ if (vdev) {
-+ return !!(pci_device_get_viommu_flags(PCI_DEVICE(vdev)) &
-+ VIOMMU_FLAG_WANT_NESTING_DIRTY_TRACKING);
-+ }
-+ return false;
-+}
-+
- bool vfio_device_get_viommu_flags_want_nesting(VFIODevice *vbasedev)
- {
- VFIOPCIDevice *vdev = vfio_pci_from_vfio_device(vbasedev);
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index 59dc17b166..7e0287f814 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -306,6 +306,7 @@ static bool iommufd_cdev_autodomains_get(VFIODevice *vbasedev,
- ERRP_GUARD();
- IOMMUFDBackend *iommufd = vbasedev->iommufd;
- VFIOContainer *bcontainer = VFIO_IOMMU(container);
-+ bool viommu_nesting, viommu_nesting_dirty;
- uint32_t type, flags = 0;
- uint64_t hw_caps;
- VendorCaps caps;
-@@ -359,8 +360,14 @@ static bool iommufd_cdev_autodomains_get(VFIODevice *vbasedev,
- return false;
- }
-
-+ viommu_nesting = vfio_device_get_viommu_flags_want_nesting(vbasedev);
-+ viommu_nesting_dirty =
-+ vfio_device_get_viommu_flags_want_nesting_dirty(vbasedev);
-+
- if (hw_caps & IOMMU_HW_CAP_DIRTY_TRACKING) {
-- flags = IOMMU_HWPT_ALLOC_DIRTY_TRACKING;
-+ if (!viommu_nesting || viommu_nesting_dirty) {
-+ flags |= IOMMU_HWPT_ALLOC_DIRTY_TRACKING;
-+ }
- }
-
- /*
-@@ -368,7 +375,7 @@ static bool iommufd_cdev_autodomains_get(VFIODevice *vbasedev,
- * force to create it so that it could be reused by vIOMMU to create
- * nested HWPT.
- */
-- if (vfio_device_get_viommu_flags_want_nesting(vbasedev)) {
-+ if (viommu_nesting) {
- flags |= IOMMU_HWPT_ALLOC_NEST_PARENT;
- }
-
-diff --git a/include/hw/core/iommu.h b/include/hw/core/iommu.h
-index 86af315c15..cd59a367ce 100644
---- a/include/hw/core/iommu.h
-+++ b/include/hw/core/iommu.h
-@@ -21,6 +21,8 @@ enum viommu_flags {
- /* vIOMMU needs nesting parent HWPT to create nested HWPT */
- VIOMMU_FLAG_WANT_NESTING_PARENT = BIT_ULL(0),
- VIOMMU_FLAG_PASID_SUPPORTED = BIT_ULL(1),
-+ /* vIOMMU needs dirty tracking on the nesting parent HWPT for nested use */
-+ VIOMMU_FLAG_WANT_NESTING_DIRTY_TRACKING = BIT_ULL(2),
- };
-
- /* Host IOMMU quirks. Extracted from host IOMMU capabilities */
-diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h
-index 27e2976593..82c8fce0ef 100644
---- a/include/hw/vfio/vfio-device.h
-+++ b/include/hw/vfio/vfio-device.h
-@@ -258,9 +258,10 @@ void vfio_device_prepare(VFIODevice *vbasedev, VFIOContainer *bcontainer,
-
- void vfio_device_unprepare(VFIODevice *vbasedev);
-
-+bool vfio_device_get_viommu_flags_want_nesting(VFIODevice *vbasedev);
-+bool vfio_device_get_viommu_flags_want_nesting_dirty(VFIODevice *vbasedev);
- int vfio_device_get_feature(VFIODevice *vbasedev,
- struct vfio_device_feature *feature);
--bool vfio_device_get_viommu_flags_want_nesting(VFIODevice *vbasedev);
-
- int vfio_device_get_region_info(VFIODevice *vbasedev, int index,
- struct vfio_region_info **info);
---
-2.52.0
-
diff --git a/kvm-hw-vfio-listener-Include-missing-exec-target_page.h-.patch b/kvm-hw-vfio-listener-Include-missing-exec-target_page.h-.patch
deleted file mode 100644
index d6c13a3..0000000
--- a/kvm-hw-vfio-listener-Include-missing-exec-target_page.h-.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 411f31528a9ae2a04914634b5bf412ccc40e49f7 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
-Date: Wed, 1 Oct 2025 09:56:41 +0200
-Subject: [PATCH 096/116] hw/vfio/listener: Include missing
- 'exec/target_page.h' header
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [80/100] 3343efdd3a369dd5dcd7ae2102ff68fc55e88f22 (rovick1/qemu-kvm)
-
-The "exec/target_page.h" header is indirectly pulled from
-"system/ram_addr.h". Include it explicitly, in order to
-avoid unrelated issues when refactoring "system/ram_addr.h":
-
- hw/vfio/listener.c: In function ‘vfio_ram_discard_register_listener’:
- hw/vfio/listener.c:258:28: error: implicit declaration of function ‘qemu_target_page_size’; did you mean ‘qemu_ram_pagesize’?
- 258 | int target_page_size = qemu_target_page_size();
- | ^~~~~~~~~~~~~~~~~~~~~
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Message-Id: <20251001175448.18933-5-philmd@linaro.org>
-(cherry picked from commit edd1f91d38dfc341cac02529fcd315609e959763)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/listener.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
-index a2c19a3cec..b5cefc9395 100644
---- a/hw/vfio/listener.c
-+++ b/hw/vfio/listener.c
-@@ -25,6 +25,7 @@
- #endif
- #include <linux/vfio.h>
-
-+#include "exec/target_page.h"
- #include "hw/vfio/vfio-device.h"
- #include "hw/vfio/pci.h"
- #include "system/address-spaces.h"
---
-2.52.0
-
diff --git a/kvm-hw-vfio-pci-Synthesize-PASID-capability-for-vfio-pci.patch b/kvm-hw-vfio-pci-Synthesize-PASID-capability-for-vfio-pci.patch
deleted file mode 100644
index 0d696d5..0000000
--- a/kvm-hw-vfio-pci-Synthesize-PASID-capability-for-vfio-pci.patch
+++ /dev/null
@@ -1,214 +0,0 @@
-From b3bb7119db21bdc9cd2018b9f9518497a8e90715 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 044/111] hw/vfio/pci: Synthesize PASID capability for vfio-pci
- devices
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [44/111] ce06dcd543f388a70071785ce3cadd620c900e5b (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Conflicts: hw/vfio/pci.c keep using hw/hw.h instead of hw/core/hw-error.h
-because we don't have 048a23851cd4 ("include: move hw/hw.h to hw/core/,
-rename")
-
-Add support for synthesizing a PCIe PASID extended capability for
-vfio-pci devices when PASID is enabled via a vIOMMU and supported by
-the host IOMMU backend.
-
-PASID capability parameters are retrieved via IOMMUFD APIs and the
-capability is inserted into the PCIe extended capability list using
-the insertion helper. A new x-vpasid-cap-offset property allows
-explicit control over the placement; by default the capability is
-placed at the end of the PCIe extended configuration space.
-
-If the kernel does not expose PASID information or insertion fails,
-the device continues without PASID support.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Message-id: 20260126104342.253965-37-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 06b38473cda8cbeb5f4aa0c2480c3b8c06a8d500)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 75 +++++++++++++++++++++++++++++++++++++++++
- hw/vfio/pci.h | 1 +
- hw/vfio/trace-events | 1 +
- include/hw/core/iommu.h | 1 +
- 4 files changed, 78 insertions(+)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 1ba66699dc..6e0714a630 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -24,6 +24,7 @@
- #include <sys/ioctl.h>
-
- #include "hw/hw.h"
-+#include "hw/core/iommu.h"
- #include "hw/pci/msi.h"
- #include "hw/pci/msix.h"
- #include "hw/pci/pci_bridge.h"
-@@ -2501,9 +2502,62 @@ static int vfio_setup_rebar_ecap(VFIOPCIDevice *vdev, uint16_t pos)
- return 0;
- }
-
-+/*
-+ * Try to retrieve PASID capability information via IOMMUFD APIs and,
-+ * if supported, synthesize a PASID PCIe extended capability for the
-+ * VFIO device.
-+ *
-+ * Use user-specified PASID capability offset if provided, otherwise
-+ * place it at the end of the PCIe extended configuration space.
-+ */
-+static bool vfio_pci_synthesize_pasid_cap(VFIOPCIDevice *vdev, Error **errp)
-+{
-+ HostIOMMUDevice *hiod = vdev->vbasedev.hiod;
-+ HostIOMMUDeviceClass *hiodc;
-+ PasidInfo pasid_info;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+ uint16_t pasid_offset;
-+
-+ if (!hiod) {
-+ return true;
-+ }
-+
-+ hiodc = HOST_IOMMU_DEVICE_GET_CLASS(hiod);
-+ if (!hiodc || !hiodc->get_pasid_info ||
-+ !hiodc->get_pasid_info(hiod, &pasid_info) ||
-+ !(pci_device_get_viommu_flags(pdev) & VIOMMU_FLAG_PASID_SUPPORTED)) {
-+ return true;
-+ }
-+
-+ /* Use user-specified offset if set, otherwise place PASID at the end. */
-+ if (vdev->vpasid_cap_offset) {
-+ pasid_offset = vdev->vpasid_cap_offset;
-+ } else {
-+ pasid_offset = PCIE_CONFIG_SPACE_SIZE - PCI_EXT_CAP_PASID_SIZEOF;
-+ }
-+
-+ if (!pcie_insert_capability(pdev, PCI_EXT_CAP_ID_PASID, PCI_PASID_VER,
-+ pasid_offset, PCI_EXT_CAP_PASID_SIZEOF)) {
-+ error_setg(errp, "vfio: Placing PASID capability at offset 0x%x failed",
-+ pasid_offset);
-+ return false;
-+ }
-+ trace_vfio_pci_synthesize_pasid_cap(vdev->vbasedev.name, pasid_offset);
-+
-+ pcie_pasid_common_init(pdev, pasid_offset, pasid_info.max_pasid_log2,
-+ pasid_info.exec_perm, pasid_info.priv_mod);
-+
-+ /* PASID capability is fully emulated by QEMU */
-+ memset(vdev->emulated_config_bits + pdev->exp.pasid_cap, 0xff,
-+ PCI_EXT_CAP_PASID_SIZEOF);
-+ return true;
-+}
-+
- static void vfio_add_ext_cap(VFIOPCIDevice *vdev)
- {
- PCIDevice *pdev = PCI_DEVICE(vdev);
-+ bool pasid_cap_added = false;
-+ Error *err = NULL;
- uint32_t header;
- uint16_t cap_id, next, size;
- uint8_t cap_ver;
-@@ -2581,12 +2635,24 @@ static void vfio_add_ext_cap(VFIOPCIDevice *vdev)
- pcie_add_capability(pdev, cap_id, cap_ver, next, size);
- }
- break;
-+ /*
-+ * VFIO kernel does not expose the PASID CAP today. We may synthesize
-+ * one later through IOMMUFD APIs. If VFIO ever starts exposing it,
-+ * record its presence here so we do not create a duplicate CAP.
-+ */
-+ case PCI_EXT_CAP_ID_PASID:
-+ pasid_cap_added = true;
-+ /* fallthrough */
- default:
- pcie_add_capability(pdev, cap_id, cap_ver, next, size);
- }
-
- }
-
-+ if (!pasid_cap_added && !vfio_pci_synthesize_pasid_cap(vdev, &err)) {
-+ error_report_err(err);
-+ }
-+
- /* Cleanup chain head ID if necessary */
- if (pci_get_word(pdev->config + PCI_CONFIG_SPACE_SIZE) == 0xFFFF) {
- pci_set_word(pdev->config + PCI_CONFIG_SPACE_SIZE, 0);
-@@ -3777,6 +3843,8 @@ static const Property vfio_pci_properties[] = {
- TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
- #endif
- DEFINE_PROP_BOOL("skip-vsc-check", VFIOPCIDevice, skip_vsc_check, true),
-+ DEFINE_PROP_UINT16("x-vpasid-cap-offset", VFIOPCIDevice,
-+ vpasid_cap_offset, 0),
- };
-
- #ifdef CONFIG_IOMMUFD
-@@ -3934,6 +4002,13 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data)
- "destination when doing live "
- "migration of device state via "
- "multifd channels");
-+ object_class_property_set_description(klass, /* 11.0 */
-+ "x-vpasid-cap-offset",
-+ "PCIe extended configuration space offset at which to place a "
-+ "synthetic PASID extended capability when PASID is enabled via "
-+ "a vIOMMU. A value of 0 (default) places the capability at the "
-+ "end of the extended configuration space. The offset must be "
-+ "4-byte aligned and within the PCIe extended configuration space");
- }
-
- static const TypeInfo vfio_pci_info = {
-diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
-index 975836945a..c1c59e4092 100644
---- a/hw/vfio/pci.h
-+++ b/hw/vfio/pci.h
-@@ -188,6 +188,7 @@ struct VFIOPCIDevice {
- bool defer_kvm_irq_routing;
- bool clear_parent_atomics_on_exit;
- bool skip_vsc_check;
-+ uint16_t vpasid_cap_offset;
- VFIODisplay *dpy;
- Notifier irqchip_change_notifier;
- VFIOPCICPR cpr;
-diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
-index 592a0349d4..82abfc99ae 100644
---- a/hw/vfio/trace-events
-+++ b/hw/vfio/trace-events
-@@ -40,6 +40,7 @@ vfio_pci_hot_reset_result(const char *name, const char *result) "%s hot reset: %
- vfio_pci_populate_device_config(const char *name, unsigned long size, unsigned long offset, unsigned long flags) "Device '%s' config: size: 0x%lx, offset: 0x%lx, flags: 0x%lx"
- vfio_pci_populate_device_get_irq_info_failure(const char *errstr) "VFIO_DEVICE_GET_IRQ_INFO failure: %s"
- vfio_mdev(const char *name, bool is_mdev) " (%s) is_mdev %d"
-+vfio_pci_synthesize_pasid_cap(const char *name, uint16_t offset) "%s offset: 0x%x"
- vfio_add_ext_cap_dropped(const char *name, uint16_t cap, uint16_t offset) "%s 0x%x@0x%x"
- vfio_pci_reset(const char *name) " (%s)"
- vfio_pci_reset_flr(const char *name) "%s FLR/VFIO_DEVICE_RESET"
-diff --git a/include/hw/core/iommu.h b/include/hw/core/iommu.h
-index d5401a397b..86af315c15 100644
---- a/include/hw/core/iommu.h
-+++ b/include/hw/core/iommu.h
-@@ -20,6 +20,7 @@
- enum viommu_flags {
- /* vIOMMU needs nesting parent HWPT to create nested HWPT */
- VIOMMU_FLAG_WANT_NESTING_PARENT = BIT_ULL(0),
-+ VIOMMU_FLAG_PASID_SUPPORTED = BIT_ULL(1),
- };
-
- /* Host IOMMU quirks. Extracted from host IOMMU capabilities */
---
-2.52.0
-
diff --git a/kvm-hw-vfio-region-Create-dmabuf-for-PCI-BAR-per-region.patch b/kvm-hw-vfio-region-Create-dmabuf-for-PCI-BAR-per-region.patch
deleted file mode 100644
index 88bc266..0000000
--- a/kvm-hw-vfio-region-Create-dmabuf-for-PCI-BAR-per-region.patch
+++ /dev/null
@@ -1,152 +0,0 @@
-From b414b8f5cae43b89c7915ba10f0a3c970aacd1fd Mon Sep 17 00:00:00 2001
-From: Nicolin Chen <nicolinc@nvidia.com>
-Date: Wed, 21 Jan 2026 11:41:11 +0000
-Subject: [PATCH 116/116] hw/vfio/region: Create dmabuf for PCI BAR per region
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [100/100] 6be849602d64e38f7ccb3f3f89f33dae804ae494 (rovick1/qemu-kvm)
-
-Linux now provides a VFIO dmabuf exporter to expose PCI BAR memory for P2P
-use cases. Create a dmabuf for each mapped BAR region after the mmap is set
-up, and store the returned fd in the region’s RAMBlock. This allows QEMU to
-pass the fd to dma_map_file(), enabling iommufd to import the dmabuf and map
-the BAR correctly in the host IOMMU page table.
-
-If the kernel lacks support or dmabuf setup fails, QEMU skips the setup
-and continues with normal mmap handling.
-
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20260121114111.34045-4-skolothumtho@nvidia.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 8cfaf22668c7a9ed79f8b8f0910a2f69b4cfaae6)
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
----
- hw/vfio/region.c | 65 +++++++++++++++++++++++++++++++++++++++++++-
- hw/vfio/trace-events | 1 +
- 2 files changed, 65 insertions(+), 1 deletion(-)
-
-diff --git a/hw/vfio/region.c b/hw/vfio/region.c
-index b165ab0b93..1deaef12fd 100644
---- a/hw/vfio/region.c
-+++ b/hw/vfio/region.c
-@@ -29,6 +29,7 @@
- #include "qemu/error-report.h"
- #include "qemu/units.h"
- #include "monitor/monitor.h"
-+#include "system/ramblock.h"
- #include "vfio-helpers.h"
-
- /*
-@@ -238,13 +239,71 @@ static void vfio_subregion_unmap(VFIORegion *region, int index)
- region->mmaps[index].mmap = NULL;
- }
-
-+static bool vfio_region_create_dma_buf(VFIORegion *region, Error **errp)
-+{
-+ g_autofree struct vfio_device_feature *feature = NULL;
-+ VFIODevice *vbasedev = region->vbasedev;
-+ struct vfio_device_feature_dma_buf *dma_buf;
-+ size_t total_size;
-+ int i, ret;
-+
-+ total_size = sizeof(*feature) + sizeof(*dma_buf) +
-+ sizeof(struct vfio_region_dma_range) * region->nr_mmaps;
-+ feature = g_malloc0(total_size);
-+ *feature = (struct vfio_device_feature) {
-+ .argsz = total_size,
-+ .flags = VFIO_DEVICE_FEATURE_GET | VFIO_DEVICE_FEATURE_DMA_BUF,
-+ };
-+
-+ dma_buf = (void *)feature->data;
-+ *dma_buf = (struct vfio_device_feature_dma_buf) {
-+ .region_index = region->nr,
-+ .open_flags = O_RDWR,
-+ .nr_ranges = region->nr_mmaps,
-+ };
-+
-+ for (i = 0; i < region->nr_mmaps; i++) {
-+ dma_buf->dma_ranges[i].offset = region->mmaps[i].offset;
-+ dma_buf->dma_ranges[i].length = region->mmaps[i].size;
-+ }
-+
-+ ret = vfio_device_get_feature(vbasedev, feature);
-+ if (ret < 0) {
-+ if (ret == -ENOTTY) {
-+ warn_report_once("VFIO dma-buf not supported in kernel: "
-+ "PCI BAR IOMMU mappings may fail");
-+ return true;
-+ }
-+ /* P2P DMA or exposing device memory use cases are not supported. */
-+ error_setg_errno(errp, -ret, "%s: failed to create dma-buf: "
-+ "PCI BAR IOMMU mappings may fail",
-+ memory_region_name(region->mem));
-+ return false;
-+ }
-+
-+ /* Assign the dmabuf fd to associated RAMBlock */
-+ for (i = 0; i < region->nr_mmaps; i++) {
-+ MemoryRegion *mr = ®ion->mmaps[i].mem;
-+ RAMBlock *ram_block = mr->ram_block;
-+
-+ ram_block->fd = ret;
-+ ram_block->fd_offset = region->mmaps[i].offset;
-+ trace_vfio_region_dmabuf(region->vbasedev->name, ret, region->nr,
-+ memory_region_name(region->mem),
-+ region->mmaps[i].offset,
-+ region->mmaps[i].size);
-+ }
-+ return true;
-+}
-+
- int vfio_region_mmap(VFIORegion *region)
- {
- int i, ret, prot = 0;
-+ Error *local_err = NULL;
- char *name;
- int fd;
-
-- if (!region->mem) {
-+ if (!region->mem || !region->nr_mmaps) {
- return 0;
- }
-
-@@ -305,6 +364,10 @@ int vfio_region_mmap(VFIORegion *region)
- region->mmaps[i].size - 1);
- }
-
-+ if (!vfio_region_create_dma_buf(region, &local_err)) {
-+ error_report_err(local_err);
-+ }
-+
- return 0;
-
- no_mmap:
-diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
-index 1e895448cd..592a0349d4 100644
---- a/hw/vfio/trace-events
-+++ b/hw/vfio/trace-events
-@@ -117,6 +117,7 @@ vfio_device_put(int fd) "close vdev->fd=%d"
- vfio_region_write(const char *name, int index, uint64_t addr, uint64_t data, unsigned size) " (%s:region%d+0x%"PRIx64", 0x%"PRIx64 ", %d)"
- vfio_region_read(char *name, int index, uint64_t addr, unsigned size, uint64_t data) " (%s:region%d+0x%"PRIx64", %d) = 0x%"PRIx64
- vfio_region_setup(const char *dev, int index, const char *name, unsigned long flags, unsigned long offset, unsigned long size) "Device %s, region %d \"%s\", flags: 0x%lx, offset: 0x%lx, size: 0x%lx"
-+vfio_region_dmabuf(const char *dev, int fd, int index, const char *name, unsigned long offset, unsigned long size) "Device %s, dmabuf fd %d region %d \"%s\", offset: 0x%lx, size: 0x%lx"
- vfio_region_mmap_fault(const char *name, int index, unsigned long offset, unsigned long size, int fault) "Region %s mmaps[%d], [0x%lx - 0x%lx], fault: %d"
- vfio_region_mmap(const char *name, unsigned long offset, unsigned long end) "Region %s [0x%lx - 0x%lx]"
- vfio_region_exit(const char *name, int index) "Device %s, region %d"
---
-2.52.0
-
diff --git a/kvm-hw-vfio-sort-and-validate-sparse-mmap-regions-by-off.patch b/kvm-hw-vfio-sort-and-validate-sparse-mmap-regions-by-off.patch
deleted file mode 100644
index 8d4aea5..0000000
--- a/kvm-hw-vfio-sort-and-validate-sparse-mmap-regions-by-off.patch
+++ /dev/null
@@ -1,121 +0,0 @@
-From d0ac3ec4e1dc8ede0d4ea9bba020aa42845d2b0e Mon Sep 17 00:00:00 2001
-From: Ankit Agrawal <ankita@nvidia.com>
-Date: Tue, 17 Feb 2026 15:30:08 +0000
-Subject: [PATCH 1/4] hw/vfio: sort and validate sparse mmap regions by offset
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Cédric Le Goater <clg@redhat.com>
-RH-MergeRequest: 500: NVIDIA:Grace:Backport hw/vfio: Enable hugepfnmap for non-power-of-2 device memory regions - GB200
-RH-Jira: RHEL-150900
-RH-Acked-by: Rodolfo Vick <None>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/3] d3a69bde63db8369e77d3703771fab637c9157a7 (clegoate/qemu-kvm-centos)
-
-Sort sparse mmap regions by offset during region setup to ensure
-predictable mapping order, avoid overlaps and a proper handling
-of the gaps between sub-regions.
-
-Add validation to detect overlapping sparse regions early during
-setup before any mapping operations begin.
-
-The sorting is performed on the subregions ranges during
-vfio_setup_region_sparse_mmaps(). This also ensures that subsequent
-mapping code can rely on subregions being in ascending offset order.
-
-This is preparatory work for alignment adjustments needed to support
-hugepfnmap on systems where device memory (e.g., Grace-based systems)
-may have non-power-of-2 sizes.
-
-cc: Alex Williamson <alex@shazbot.org>
-Reviewed-by: Alex Williamson <alex@shazbot.org>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20260217153010.408739-2-ankita@nvidia.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit da02b21cc70ef04a9ad15198f33551f17c94dff5)
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
----
- hw/vfio/region.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 45 insertions(+), 1 deletion(-)
-
-diff --git a/hw/vfio/region.c b/hw/vfio/region.c
-index 1deaef12fd..a61e47a79c 100644
---- a/hw/vfio/region.c
-+++ b/hw/vfio/region.c
-@@ -149,6 +149,19 @@ static const MemoryRegionOps vfio_region_ops = {
- },
- };
-
-+static int vfio_mmap_compare_offset(const void *a, const void *b)
-+{
-+ const VFIOMmap *mmap_a = a;
-+ const VFIOMmap *mmap_b = b;
-+
-+ if (mmap_a->offset < mmap_b->offset) {
-+ return -1;
-+ } else if (mmap_a->offset > mmap_b->offset) {
-+ return 1;
-+ }
-+ return 0;
-+}
-+
- static int vfio_setup_region_sparse_mmaps(VFIORegion *region,
- struct vfio_region_info *info)
- {
-@@ -182,6 +195,35 @@ static int vfio_setup_region_sparse_mmaps(VFIORegion *region,
- region->nr_mmaps = j;
- region->mmaps = g_realloc(region->mmaps, j * sizeof(VFIOMmap));
-
-+ /*
-+ * Sort sparse mmaps by offset to ensure proper handling of gaps
-+ * and predictable mapping order in vfio_region_mmap().
-+ */
-+ if (region->nr_mmaps > 1) {
-+ qsort(region->mmaps, region->nr_mmaps, sizeof(VFIOMmap),
-+ vfio_mmap_compare_offset);
-+
-+ /*
-+ * Validate that sparse regions don't overlap after sorting.
-+ */
-+ for (i = 1; i < region->nr_mmaps; i++) {
-+ off_t prev_end = region->mmaps[i - 1].offset +
-+ region->mmaps[i - 1].size;
-+ if (prev_end > region->mmaps[i].offset) {
-+ error_report("%s: overlapping sparse mmap regions detected "
-+ "in region %d: [0x%"PRIx64"-0x%"PRIx64"] overlaps "
-+ "with [0x%"PRIx64"-0x%"PRIx64"]",
-+ __func__, region->nr, region->mmaps[i - 1].offset,
-+ prev_end - 1, region->mmaps[i].offset,
-+ region->mmaps[i].offset + region->mmaps[i].size - 1);
-+ g_free(region->mmaps);
-+ region->mmaps = NULL;
-+ region->nr_mmaps = 0;
-+ return -EINVAL;
-+ }
-+ }
-+ }
-+
- return 0;
- }
-
-@@ -213,11 +255,13 @@ int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region,
-
- ret = vfio_setup_region_sparse_mmaps(region, info);
-
-- if (ret) {
-+ if (ret == -ENODEV) {
- region->nr_mmaps = 1;
- region->mmaps = g_new0(VFIOMmap, region->nr_mmaps);
- region->mmaps[0].offset = 0;
- region->mmaps[0].size = region->size;
-+ } else if (ret) {
-+ return ret;
- }
- }
- }
---
-2.52.0
-
diff --git a/kvm-hw-vfio-types.h-rename-TYPE_VFIO_PCI_BASE-to-TYPE_VF.patch b/kvm-hw-vfio-types.h-rename-TYPE_VFIO_PCI_BASE-to-TYPE_VF.patch
deleted file mode 100644
index faeecc1..0000000
--- a/kvm-hw-vfio-types.h-rename-TYPE_VFIO_PCI_BASE-to-TYPE_VF.patch
+++ /dev/null
@@ -1,337 +0,0 @@
-From ea749e5fe5c3337af25560b5c36476c611a6420a Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:24 +0100
-Subject: [PATCH 067/116] hw/vfio/types.h: rename TYPE_VFIO_PCI_BASE to
- TYPE_VFIO_PCI_DEVICE
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [51/100] 4690d24398c7169d39d8254012faaf8576bb10e9 (rovick1/qemu-kvm)
-
-This brings the QOM type name in line with the underlying VFIOPCIDevice structure.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-17-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit af2a8bfb3cd38cceb39a152ff33c7daa4c81c506)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/s390x/s390-pci-vfio.c | 14 +++++++-------
- hw/vfio-user/pci.c | 13 +++++++------
- hw/vfio/device.c | 2 +-
- hw/vfio/pci.c | 28 ++++++++++++++--------------
- hw/vfio/pci.h | 2 +-
- hw/vfio/types.h | 4 ++--
- 6 files changed, 32 insertions(+), 31 deletions(-)
-
-diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c
-index 7760780aff..9e31029d7a 100644
---- a/hw/s390x/s390-pci-vfio.c
-+++ b/hw/s390x/s390-pci-vfio.c
-@@ -62,7 +62,7 @@ S390PCIDMACount *s390_pci_start_dma_count(S390pciState *s,
- {
- S390PCIDMACount *cnt;
- uint32_t avail;
-- VFIOPCIDevice *vpdev = VFIO_PCI_BASE(pbdev->pdev);
-+ VFIOPCIDevice *vpdev = VFIO_PCI_DEVICE(pbdev->pdev);
- int id;
-
- assert(vpdev);
-@@ -108,7 +108,7 @@ static void s390_pci_read_base(S390PCIBusDevice *pbdev,
- {
- struct vfio_info_cap_header *hdr;
- struct vfio_device_info_cap_zpci_base *cap;
-- VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
-+ VFIOPCIDevice *vpci = VFIO_PCI_DEVICE(pbdev->pdev);
- uint64_t vfio_size;
-
- hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_BASE);
-@@ -162,7 +162,7 @@ static bool get_host_fh(S390PCIBusDevice *pbdev, struct vfio_device_info *info,
- {
- struct vfio_info_cap_header *hdr;
- struct vfio_device_info_cap_zpci_base *cap;
-- VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
-+ VFIOPCIDevice *vpci = VFIO_PCI_DEVICE(pbdev->pdev);
-
- hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_BASE);
-
-@@ -185,7 +185,7 @@ static void s390_pci_read_group(S390PCIBusDevice *pbdev,
- struct vfio_device_info_cap_zpci_group *cap;
- S390pciState *s = s390_get_phb();
- ClpRspQueryPciGrp *resgrp;
-- VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
-+ VFIOPCIDevice *vpci = VFIO_PCI_DEVICE(pbdev->pdev);
- uint8_t start_gid = pbdev->zpci_fn.pfgid;
-
- hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_GROUP);
-@@ -264,7 +264,7 @@ static void s390_pci_read_util(S390PCIBusDevice *pbdev,
- {
- struct vfio_info_cap_header *hdr;
- struct vfio_device_info_cap_zpci_util *cap;
-- VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
-+ VFIOPCIDevice *vpci = VFIO_PCI_DEVICE(pbdev->pdev);
-
- hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_UTIL);
-
-@@ -291,7 +291,7 @@ static void s390_pci_read_pfip(S390PCIBusDevice *pbdev,
- {
- struct vfio_info_cap_header *hdr;
- struct vfio_device_info_cap_zpci_pfip *cap;
-- VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
-+ VFIOPCIDevice *vpci = VFIO_PCI_DEVICE(pbdev->pdev);
-
- hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_PFIP);
-
-@@ -314,7 +314,7 @@ static void s390_pci_read_pfip(S390PCIBusDevice *pbdev,
-
- static struct vfio_device_info *get_device_info(S390PCIBusDevice *pbdev)
- {
-- VFIOPCIDevice *vfio_pci = VFIO_PCI_BASE(pbdev->pdev);
-+ VFIOPCIDevice *vfio_pci = VFIO_PCI_DEVICE(pbdev->pdev);
-
- return vfio_get_device_info(vfio_pci->vbasedev.fd);
- }
-diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
-index e2c309784f..efceae69de 100644
---- a/hw/vfio-user/pci.c
-+++ b/hw/vfio-user/pci.c
-@@ -234,9 +234,10 @@ static void vfio_user_pci_realize(PCIDevice *pdev, Error **errp)
- {
- ERRP_GUARD();
- VFIOUserPCIDevice *udev = VFIO_USER_PCI(pdev);
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev);
- VFIODevice *vbasedev = &vdev->vbasedev;
- const char *sock_name;
-+
- AddressSpace *as;
- SocketAddress addr;
- VFIOUserProxy *proxy;
-@@ -346,7 +347,7 @@ error:
- static void vfio_user_instance_init(Object *obj)
- {
- PCIDevice *pci_dev = PCI_DEVICE(obj);
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(obj);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(obj);
- VFIODevice *vbasedev = &vdev->vbasedev;
-
- device_add_bootindex_property(obj, &vdev->bootindex,
-@@ -371,7 +372,7 @@ static void vfio_user_instance_init(Object *obj)
-
- static void vfio_user_instance_finalize(Object *obj)
- {
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(obj);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(obj);
- VFIODevice *vbasedev = &vdev->vbasedev;
-
- if (vdev->msix != NULL) {
-@@ -387,7 +388,7 @@ static void vfio_user_instance_finalize(Object *obj)
-
- static void vfio_user_pci_reset(DeviceState *dev)
- {
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(dev);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(dev);
- VFIODevice *vbasedev = &vdev->vbasedev;
-
- vfio_pci_pre_reset(vdev);
-@@ -421,7 +422,7 @@ static void vfio_user_pci_set_socket(Object *obj, Visitor *v, const char *name,
- VFIOUserPCIDevice *udev = VFIO_USER_PCI(obj);
- bool success;
-
-- if (VFIO_PCI_BASE(udev)->vbasedev.proxy) {
-+ if (VFIO_PCI_DEVICE(udev)->vbasedev.proxy) {
- error_setg(errp, "Proxy is connected");
- return;
- }
-@@ -464,7 +465,7 @@ static void vfio_user_pci_dev_class_init(ObjectClass *klass, const void *data)
-
- static const TypeInfo vfio_user_pci_dev_info = {
- .name = TYPE_VFIO_USER_PCI,
-- .parent = TYPE_VFIO_PCI_BASE,
-+ .parent = TYPE_VFIO_PCI_DEVICE,
- .instance_size = sizeof(VFIOUserPCIDevice),
- .class_init = vfio_user_pci_dev_class_init,
- .instance_init = vfio_user_instance_init,
-diff --git a/hw/vfio/device.c b/hw/vfio/device.c
-index 931a949c08..8b63e765ac 100644
---- a/hw/vfio/device.c
-+++ b/hw/vfio/device.c
-@@ -434,7 +434,7 @@ bool vfio_device_hiod_create_and_realize(VFIODevice *vbasedev,
- VFIODevice *vfio_get_vfio_device(Object *obj)
- {
- if (object_dynamic_cast(obj, TYPE_VFIO_PCI)) {
-- return &VFIO_PCI_BASE(obj)->vbasedev;
-+ return &VFIO_PCI_DEVICE(obj)->vbasedev;
- } else {
- return NULL;
- }
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index fd8d8f7e32..937283bcc6 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -308,7 +308,7 @@ static void vfio_intx_update(VFIOPCIDevice *vdev, PCIINTxRoute *route)
-
- static void vfio_intx_routing_notifier(PCIDevice *pdev)
- {
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev);
- PCIINTxRoute route;
-
- if (vdev->interrupt != VFIO_INT_INTx) {
-@@ -663,7 +663,7 @@ void vfio_pci_vector_init(VFIOPCIDevice *vdev, int nr)
- static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
- MSIMessage *msg, IOHandler *handler)
- {
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev);
- VFIOMSIVector *vector;
- int ret;
- bool resizing = !!(vdev->nr_vectors < nr + 1);
-@@ -758,7 +758,7 @@ static int vfio_msix_vector_use(PCIDevice *pdev,
-
- static void vfio_msix_vector_release(PCIDevice *pdev, unsigned int nr)
- {
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev);
- VFIOMSIVector *vector = &vdev->msi_vectors[nr];
-
- trace_vfio_msix_vector_release(vdev->vbasedev.name, nr);
-@@ -1349,7 +1349,7 @@ static const MemoryRegionOps vfio_vga_ops = {
- */
- static void vfio_sub_page_bar_update_mapping(PCIDevice *pdev, int bar)
- {
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev);
- VFIORegion *region = &vdev->bars[bar].region;
- MemoryRegion *mmap_mr, *region_mr, *base_mr;
- PCIIORegion *r;
-@@ -1395,7 +1395,7 @@ static void vfio_sub_page_bar_update_mapping(PCIDevice *pdev, int bar)
- */
- uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len)
- {
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev);
- VFIODevice *vbasedev = &vdev->vbasedev;
- uint32_t emu_bits = 0, emu_val = 0, phys_val = 0, val;
-
-@@ -1429,7 +1429,7 @@ uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len)
- void vfio_pci_write_config(PCIDevice *pdev,
- uint32_t addr, uint32_t val, int len)
- {
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev);
- VFIODevice *vbasedev = &vdev->vbasedev;
- uint32_t val_le = cpu_to_le32(val);
- int ret;
-@@ -3395,7 +3395,7 @@ bool vfio_pci_interrupt_setup(VFIOPCIDevice *vdev, Error **errp)
- static void vfio_pci_realize(PCIDevice *pdev, Error **errp)
- {
- ERRP_GUARD();
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev);
- VFIODevice *vbasedev = &vdev->vbasedev;
- int i;
- char uuid[UUID_STR_LEN];
-@@ -3570,14 +3570,14 @@ error:
-
- static void vfio_pci_finalize(Object *obj)
- {
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(obj);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(obj);
-
- vfio_pci_put_device(vdev);
- }
-
- static void vfio_exitfn(PCIDevice *pdev)
- {
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(pdev);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(pdev);
- VFIODevice *vbasedev = &vdev->vbasedev;
-
- vfio_unregister_req_notifier(vdev);
-@@ -3601,7 +3601,7 @@ static void vfio_exitfn(PCIDevice *pdev)
-
- static void vfio_pci_reset(DeviceState *dev)
- {
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(dev);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(dev);
-
- /* Do not reset the device during qemu_system_reset prior to cpr load */
- if (cpr_is_incoming()) {
-@@ -3646,7 +3646,7 @@ post_reset:
- static void vfio_pci_init(Object *obj)
- {
- PCIDevice *pci_dev = PCI_DEVICE(obj);
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(obj);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(obj);
- VFIODevice *vbasedev = &vdev->vbasedev;
-
- device_add_bootindex_property(obj, &vdev->bootindex,
-@@ -3687,7 +3687,7 @@ static void vfio_pci_base_dev_class_init(ObjectClass *klass, const void *data)
- }
-
- static const TypeInfo vfio_pci_base_dev_info = {
-- .name = TYPE_VFIO_PCI_BASE,
-+ .name = TYPE_VFIO_PCI_DEVICE,
- .parent = TYPE_PCI_DEVICE,
- .instance_size = sizeof(VFIOPCIDevice),
- .abstract = true,
-@@ -3780,7 +3780,7 @@ static const Property vfio_pci_dev_properties[] = {
- #ifdef CONFIG_IOMMUFD
- static void vfio_pci_set_fd(Object *obj, const char *str, Error **errp)
- {
-- VFIOPCIDevice *vdev = VFIO_PCI_BASE(obj);
-+ VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(obj);
- vfio_device_set_fd(&vdev->vbasedev, str, errp);
- }
- #endif
-@@ -3936,7 +3936,7 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data)
-
- static const TypeInfo vfio_pci_info = {
- .name = TYPE_VFIO_PCI,
-- .parent = TYPE_VFIO_PCI_BASE,
-+ .parent = TYPE_VFIO_PCI_DEVICE,
- .class_init = vfio_pci_class_init,
- .instance_init = vfio_pci_init,
- .instance_finalize = vfio_pci_finalize,
-diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
-index dd419f9147..975836945a 100644
---- a/hw/vfio/pci.h
-+++ b/hw/vfio/pci.h
-@@ -120,7 +120,7 @@ typedef struct VFIOMSIXInfo {
- MemoryRegion *pba_region;
- } VFIOMSIXInfo;
-
--OBJECT_DECLARE_SIMPLE_TYPE(VFIOPCIDevice, VFIO_PCI_BASE)
-+OBJECT_DECLARE_SIMPLE_TYPE(VFIOPCIDevice, VFIO_PCI_DEVICE)
-
- struct VFIOPCIDevice {
- PCIDevice parent_obj;
-diff --git a/hw/vfio/types.h b/hw/vfio/types.h
-index c19334ff25..5482d90808 100644
---- a/hw/vfio/types.h
-+++ b/hw/vfio/types.h
-@@ -9,11 +9,11 @@
- #define HW_VFIO_VFIO_TYPES_H
-
- /*
-- * TYPE_VFIO_PCI_BASE is an abstract type used to share code
-+ * TYPE_VFIO_PCI_DEVICE is an abstract type used to share code
- * between VFIO implementations that use a kernel driver
- * with those that use user sockets.
- */
--#define TYPE_VFIO_PCI_BASE "vfio-pci-base"
-+#define TYPE_VFIO_PCI_DEVICE "vfio-pci-device"
-
- #define TYPE_VFIO_PCI "vfio-pci"
- /* TYPE_VFIO_PCI shares struct VFIOPCIDevice. */
---
-2.52.0
-
diff --git a/kvm-hw-vfio-user-add-x-pci-class-code.patch b/kvm-hw-vfio-user-add-x-pci-class-code.patch
deleted file mode 100644
index ac3378a..0000000
--- a/kvm-hw-vfio-user-add-x-pci-class-code.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From f1d0896d9b0b7742ea5a9803c1eeb14b558b29bd Mon Sep 17 00:00:00 2001
-From: John Levon <john.levon@nutanix.com>
-Date: Wed, 27 Aug 2025 20:08:10 +0100
-Subject: [PATCH 027/116] hw/vfio-user: add x-pci-class-code
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [11/100] 2adb19c08b826a8db8665a47524fe813e8f91af1 (rovick1/qemu-kvm)
-
-This new option was not added to vfio_user_pci_dev_properties, which
-caused an incorrect class code for vfio-user devices.
-
-Fixes: a59d06305fff ("vfio/pci: Introduce x-pci-class-code option")
-Signed-off-by: John Levon <john.levon@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250827190810.1645340-1-john.levon@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 1b50621881241ac5bc75ae7f8aa4c278ada8a668)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/pci.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
-index be71c77729..dfaa89498d 100644
---- a/hw/vfio-user/pci.c
-+++ b/hw/vfio-user/pci.c
-@@ -406,6 +406,8 @@ static const Property vfio_user_pci_dev_properties[] = {
- sub_vendor_id, PCI_ANY_ID),
- DEFINE_PROP_UINT32("x-pci-sub-device-id", VFIOPCIDevice,
- sub_device_id, PCI_ANY_ID),
-+ DEFINE_PROP_UINT32("x-pci-class-code", VFIOPCIDevice,
-+ class_code, PCI_ANY_ID),
- DEFINE_PROP_BOOL("x-send-queued", VFIOUserPCIDevice, send_queued, false),
- DEFINE_PROP_UINT32("x-msg-timeout", VFIOUserPCIDevice, wait_time, 5000),
- DEFINE_PROP_BOOL("x-no-posted-writes", VFIOUserPCIDevice, no_post, false),
---
-2.52.0
-
diff --git a/kvm-ide-Clean-up-ide_trim_co_entry-to-be-idiomatic-corou.patch b/kvm-ide-Clean-up-ide_trim_co_entry-to-be-idiomatic-corou.patch
deleted file mode 100644
index 82fba34..0000000
--- a/kvm-ide-Clean-up-ide_trim_co_entry-to-be-idiomatic-corou.patch
+++ /dev/null
@@ -1,163 +0,0 @@
-From 377ac72f84cb83972c65a190cc5bc4fdf9bdab9b Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Tue, 21 Apr 2026 18:11:30 +0200
-Subject: [PATCH 05/52] ide: Clean up ide_trim_co_entry() to be idiomatic
- coroutine code
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 503: ide: Fix deadlock between TRIM and drain
-RH-Jira: RHEL-121686
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [5/7] 8d798543f3052121940fe208e13c710734b7c88c (kmwolf/centos-qemu-kvm)
-
-The previous commit did a minimal conversion of the callback based state
-machine for TRIM to a coroutine in order to fix a bug. Refactor it to
-actually look like normal coroutine based code, which improves its
-readability.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260421161132.99878-6-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit c1c71a7e167fdabaa9827d00c0be3aeafebdd921)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- hw/ide/core.c | 87 +++++++++++++++++++++++----------------------------
- 1 file changed, 39 insertions(+), 48 deletions(-)
-
-diff --git a/hw/ide/core.c b/hw/ide/core.c
-index 82c3ada14a..8b9f06547b 100644
---- a/hw/ide/core.c
-+++ b/hw/ide/core.c
-@@ -420,18 +420,15 @@ typedef struct TrimAIOCB {
- QEMUBH *bh;
- int ret;
- QEMUIOVector *qiov;
-- int i, j;
-+ bool canceled;
- } TrimAIOCB;
-
- static void trim_aio_cancel(BlockAIOCB *acb)
- {
- TrimAIOCB *iocb = container_of(acb, TrimAIOCB, common);
-
-- /* Exit the loop so ide_issue_trim_cb will not continue */
-- iocb->j = iocb->qiov->niov - 1;
-- iocb->i = (iocb->qiov->iov[iocb->j].iov_len / 8) - 1;
--
-- iocb->ret = -ECANCELED;
-+ /* Exit the loop so ide_trim_co_entry will not continue */
-+ iocb->canceled = true;
- }
-
- static const AIOCBInfo trim_aiocb_info = {
-@@ -458,60 +455,55 @@ static void coroutine_fn ide_trim_co_entry(void *opaque)
- {
- TrimAIOCB *iocb = opaque;
- IDEState *s = iocb->s;
-- int ret = 0;
-+ int i, j;
-+ int ret;
-
- /* Paired with blk_end_request in ide_trim_bh_cb() */
- blk_co_start_request(s->blk);
-
--loop:
-- if (iocb->i >= 0) {
-- if (ret >= 0) {
-- block_acct_done(blk_get_stats(s->blk), &s->acct);
-- } else {
-- block_acct_failed(blk_get_stats(s->blk), &s->acct);
-- }
-- }
-+ for (j = 0; j < iocb->qiov->niov; j++) {
-+ for (i = 0; i < iocb->qiov->iov[j].iov_len / 8; i++) {
-+ uint64_t *buffer = iocb->qiov->iov[j].iov_base;
-
-- if (ret >= 0) {
-- while (iocb->j < iocb->qiov->niov) {
-- int j = iocb->j;
-- while (++iocb->i < iocb->qiov->iov[j].iov_len / 8) {
-- int i = iocb->i;
-- uint64_t *buffer = iocb->qiov->iov[j].iov_base;
-+ /* 6-byte LBA + 2-byte range per entry */
-+ uint64_t entry = le64_to_cpu(buffer[i]);
-+ uint64_t sector = entry & 0x0000ffffffffffffULL;
-+ uint16_t count = entry >> 48;
-
-- /* 6-byte LBA + 2-byte range per entry */
-- uint64_t entry = le64_to_cpu(buffer[i]);
-- uint64_t sector = entry & 0x0000ffffffffffffULL;
-- uint16_t count = entry >> 48;
-+ if (count == 0) {
-+ continue;
-+ }
-
-- if (count == 0) {
-- continue;
-- }
-+ if (iocb->canceled) {
-+ iocb->ret = -ECANCELED;
-+ goto done;
-+ }
-
-- if (!ide_sect_range_ok(s, sector, count)) {
-- block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_UNMAP);
-- iocb->ret = -EINVAL;
-- goto done;
-- }
-+ if (!ide_sect_range_ok(s, sector, count)) {
-+ block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_UNMAP);
-+ iocb->ret = -EINVAL;
-+ goto done;
-+ }
-
-- block_acct_start(blk_get_stats(s->blk), &s->acct,
-- count << BDRV_SECTOR_BITS, BLOCK_ACCT_UNMAP);
-+ block_acct_start(blk_get_stats(s->blk), &s->acct,
-+ count << BDRV_SECTOR_BITS, BLOCK_ACCT_UNMAP);
-
-- /* Got an entry! Submit and exit. */
-- ret = blk_co_pdiscard(s->blk,
-- sector << BDRV_SECTOR_BITS,
-- count << BDRV_SECTOR_BITS,
-- BDRV_REQ_NO_QUEUE);
-- goto loop;
-+ /* Got an entry! Submit and exit. */
-+ ret = blk_co_pdiscard(s->blk,
-+ sector << BDRV_SECTOR_BITS,
-+ count << BDRV_SECTOR_BITS,
-+ BDRV_REQ_NO_QUEUE);
-+ if (ret >= 0) {
-+ block_acct_done(blk_get_stats(s->blk), &s->acct);
-+ } else {
-+ iocb->ret = ret;
-+ block_acct_failed(blk_get_stats(s->blk), &s->acct);
-+ goto done;
- }
--
-- iocb->j++;
-- iocb->i = -1;
- }
-- } else {
-- iocb->ret = ret;
- }
-
-+ iocb->ret = 0;
- done:
- if (iocb->bh) {
- replay_bh_schedule_event(iocb->bh);
-@@ -533,8 +525,7 @@ BlockAIOCB *ide_issue_trim(
- &DEVICE(dev)->mem_reentrancy_guard);
- iocb->ret = 0;
- iocb->qiov = qiov;
-- iocb->i = -1;
-- iocb->j = 0;
-+ iocb->canceled = false;
-
- co = qemu_coroutine_create(ide_trim_co_entry, iocb);
- aio_co_enter(qemu_get_current_aio_context(), co);
---
-2.52.0
-
diff --git a/kvm-ide-Fix-potential-assertion-failure-on-VM-stop-for-P.patch b/kvm-ide-Fix-potential-assertion-failure-on-VM-stop-for-P.patch
deleted file mode 100644
index ae7c295..0000000
--- a/kvm-ide-Fix-potential-assertion-failure-on-VM-stop-for-P.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From ba430cce181388723ec2d3174195e1d468ed18b2 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Thu, 26 Mar 2026 17:51:24 +0100
-Subject: [PATCH 41/52] ide: Fix potential assertion failure on VM stop for PIO
- read error
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [34/45] 4a6db09841ffa4323e11a9e47e170c919d292b3e (kmwolf/centos-qemu-kvm)
-
-ide_sector_read() as well as its callers neglect to call ide_set_retry()
-before starting I/O. If the I/O fails, this means that the retry
-information is stale. In particular, ide_handle_rw_error() has an
-assertion that s->bus->retry_unit == s->unit, which can fail if either
-there was no previous request or it came from another device on the bus.
-If the assertion weren't there, a wrong request would be retried after
-resuming the VM.
-
-Fix this by adding a ide_set_retry() call to ide_sector_read().
-
-This affects only reads because ide_transfer_start() does call
-ide_set_retry(). For writes, the data transfer comes first and the I/O
-is only started when the data has been read into s->io_buffer, so by
-that time, ide_set_retry() has been called. For reads, however, the I/O
-comes first and only then the data is transferred to the guest, so the
-call in ide_transfer_start() is too late.
-
-Buglink: https://redhat.atlassian.net/browse/RHEL-153537
-Reported-by: Tingting Mao <timao@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260326165124.138593-1-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 59c1d31136688415e5d682a87942292dbb3caaeb)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- hw/ide/core.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/hw/ide/core.c b/hw/ide/core.c
-index 8b9f06547b..bf616b7703 100644
---- a/hw/ide/core.c
-+++ b/hw/ide/core.c
-@@ -789,6 +789,7 @@ static void ide_sector_read(IDEState *s)
- s->error = 0; /* not needed by IDE spec, but needed by Windows */
- sector_num = ide_get_sector(s);
- n = s->nsector;
-+ ide_set_retry(s);
-
- if (n == 0) {
- ide_transfer_stop(s);
---
-2.52.0
-
diff --git a/kvm-ide-Minimal-fix-for-deadlock-between-TRIM-and-drain.patch b/kvm-ide-Minimal-fix-for-deadlock-between-TRIM-and-drain.patch
deleted file mode 100644
index e7296a5..0000000
--- a/kvm-ide-Minimal-fix-for-deadlock-between-TRIM-and-drain.patch
+++ /dev/null
@@ -1,141 +0,0 @@
-From b2cc73c49eeee7f25626c4fdbb9aeaf561ffcdfd Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Tue, 21 Apr 2026 18:11:29 +0200
-Subject: [PATCH 04/52] ide: Minimal fix for deadlock between TRIM and drain
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 503: ide: Fix deadlock between TRIM and drain
-RH-Jira: RHEL-121686
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [4/7] 4324446f87c1e7d56ca13b3740d10bf5ed64e8c6 (kmwolf/centos-qemu-kvm)
-
-The implementation of TRIM in IDE can chain multiple discard requests
-and uses blk_inc/dec_in_flight() to make sure that the whole TRIM
-operation has completed when the device needs to be quiescent (e.g. for
-the drain when performing an IDE reset, it would be bad if an IDE
-request like TRIM were still in flight).
-
-The problem is that each drain request calls blk_wait_while_drained()
-and when draining, it waits until the drained section ends. At the same
-time, drain_begin can only return if the whole TRIM operation has
-completed. This is a classic deadlock.
-
-Use blk_co_start/end_request() and BDRV_REQ_NO_QUEUE to avoid the
-problem. This requires moving the TRIM state machine to a coroutine.
-This commit does the minimal conversion so that we do have a coroutine
-that works for the fix, but it still looks much like a callback-based
-implementation. This will be cleaned up in the next patch.
-
-Cc: qemu-stable@nongnu.org
-Fixes: 7e5cdb345f77 ('ide: Increment BB in-flight counter for TRIM BH')
-Buglink: https://redhat.atlassian.net/browse/RHEL-121686
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260421161132.99878-5-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 095c08a7ba68cabaa6e0ce7a8a0804a949542c4c)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- hw/ide/core.c | 37 ++++++++++++++++++-------------------
- 1 file changed, 18 insertions(+), 19 deletions(-)
-
-diff --git a/hw/ide/core.c b/hw/ide/core.c
-index b14983ec54..82c3ada14a 100644
---- a/hw/ide/core.c
-+++ b/hw/ide/core.c
-@@ -420,7 +420,6 @@ typedef struct TrimAIOCB {
- QEMUBH *bh;
- int ret;
- QEMUIOVector *qiov;
-- BlockAIOCB *aiocb;
- int i, j;
- } TrimAIOCB;
-
-@@ -433,11 +432,6 @@ static void trim_aio_cancel(BlockAIOCB *acb)
- iocb->i = (iocb->qiov->iov[iocb->j].iov_len / 8) - 1;
-
- iocb->ret = -ECANCELED;
--
-- if (iocb->aiocb) {
-- blk_aio_cancel_async(iocb->aiocb);
-- iocb->aiocb = NULL;
-- }
- }
-
- static const AIOCBInfo trim_aiocb_info = {
-@@ -456,15 +450,20 @@ static void ide_trim_bh_cb(void *opaque)
- iocb->bh = NULL;
- qemu_aio_unref(iocb);
-
-- /* Paired with an increment in ide_issue_trim() */
-- blk_dec_in_flight(blk);
-+ /* Paired with blk_co_start_request in ide_trim_co_entry() */
-+ blk_end_request(blk);
- }
-
--static void ide_issue_trim_cb(void *opaque, int ret)
-+static void coroutine_fn ide_trim_co_entry(void *opaque)
- {
- TrimAIOCB *iocb = opaque;
- IDEState *s = iocb->s;
-+ int ret = 0;
-+
-+ /* Paired with blk_end_request in ide_trim_bh_cb() */
-+ blk_co_start_request(s->blk);
-
-+loop:
- if (iocb->i >= 0) {
- if (ret >= 0) {
- block_acct_done(blk_get_stats(s->blk), &s->acct);
-@@ -499,11 +498,11 @@ static void ide_issue_trim_cb(void *opaque, int ret)
- count << BDRV_SECTOR_BITS, BLOCK_ACCT_UNMAP);
-
- /* Got an entry! Submit and exit. */
-- iocb->aiocb = blk_aio_pdiscard(s->blk,
-- sector << BDRV_SECTOR_BITS,
-- count << BDRV_SECTOR_BITS,
-- ide_issue_trim_cb, opaque);
-- return;
-+ ret = blk_co_pdiscard(s->blk,
-+ sector << BDRV_SECTOR_BITS,
-+ count << BDRV_SECTOR_BITS,
-+ BDRV_REQ_NO_QUEUE);
-+ goto loop;
- }
-
- iocb->j++;
-@@ -514,7 +513,6 @@ static void ide_issue_trim_cb(void *opaque, int ret)
- }
-
- done:
-- iocb->aiocb = NULL;
- if (iocb->bh) {
- replay_bh_schedule_event(iocb->bh);
- }
-@@ -527,9 +525,7 @@ BlockAIOCB *ide_issue_trim(
- IDEState *s = opaque;
- IDEDevice *dev = s->unit ? s->bus->slave : s->bus->master;
- TrimAIOCB *iocb;
--
-- /* Paired with a decrement in ide_trim_bh_cb() */
-- blk_inc_in_flight(s->blk);
-+ Coroutine *co;
-
- iocb = blk_aio_get(&trim_aiocb_info, s->blk, cb, cb_opaque);
- iocb->s = s;
-@@ -539,7 +535,10 @@ BlockAIOCB *ide_issue_trim(
- iocb->qiov = qiov;
- iocb->i = -1;
- iocb->j = 0;
-- ide_issue_trim_cb(iocb, 0);
-+
-+ co = qemu_coroutine_create(ide_trim_co_entry, iocb);
-+ aio_co_enter(qemu_get_current_aio_context(), co);
-+
- return &iocb->common;
- }
-
---
-2.52.0
-
diff --git a/kvm-ide-test-Factor-out-wait_dma_completion.patch b/kvm-ide-test-Factor-out-wait_dma_completion.patch
deleted file mode 100644
index 18107b6..0000000
--- a/kvm-ide-test-Factor-out-wait_dma_completion.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From 03274f77317b494c8a5b29c0b3bf7112592d5d8a Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Tue, 21 Apr 2026 18:11:31 +0200
-Subject: [PATCH 06/52] ide-test: Factor out wait_dma_completion()
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 503: ide: Fix deadlock between TRIM and drain
-RH-Jira: RHEL-121686
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [6/7] 640daa938349847f3531cfc90e9c9d4d2b05fcc7 (kmwolf/centos-qemu-kvm)
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260421161132.99878-7-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 92854c9c7539bdbf4f9c1abb33dd3ba59ff91e58)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- tests/qtest/ide-test.c | 48 +++++++++++++++++++++++++-----------------
- 1 file changed, 29 insertions(+), 19 deletions(-)
-
-diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c
-index ceee444a9e..c6dcb2c074 100644
---- a/tests/qtest/ide-test.c
-+++ b/tests/qtest/ide-test.c
-@@ -200,6 +200,34 @@ static uint64_t trim_range_le(uint64_t sector, uint16_t count)
- return cpu_to_le64(((uint64_t)count << 48) + sector);
- }
-
-+static uint8_t wait_dma_completion(QTestState *qts, QPCIDevice *dev,
-+ QPCIBar bmdma_bar, QPCIBar ide_bar)
-+{
-+ uint8_t status;
-+
-+ /* Wait for the DMA transfer to complete */
-+ do {
-+ status = qpci_io_readb(dev, bmdma_bar, bmreg_status);
-+ } while ((status & (BM_STS_ACTIVE | BM_STS_INTR)) == BM_STS_ACTIVE);
-+
-+ g_assert_cmpint(qtest_get_irq(qts, IDE_PRIMARY_IRQ), ==,
-+ !!(status & BM_STS_INTR));
-+
-+ /* Check IDE status code */
-+ assert_bit_set(qpci_io_readb(dev, ide_bar, reg_status), DRDY);
-+ assert_bit_clear(qpci_io_readb(dev, ide_bar, reg_status), BSY | DRQ);
-+
-+ /* Reading the status register clears the IRQ */
-+ g_assert(!qtest_get_irq(qts, IDE_PRIMARY_IRQ));
-+
-+ /* Stop DMA transfer if still active */
-+ if (status & BM_STS_ACTIVE) {
-+ qpci_io_writeb(dev, bmdma_bar, bmreg_cmd, 0);
-+ }
-+
-+ return status;
-+}
-+
- static int send_dma_request(QTestState *qts, int cmd, uint64_t sector,
- int nb_sectors, PrdtEntry *prdt, int prdt_entries,
- void(*post_exec)(QPCIDevice *dev, QPCIBar ide_bar,
-@@ -280,25 +308,7 @@ static int send_dma_request(QTestState *qts, int cmd, uint64_t sector,
- qpci_io_writeb(dev, bmdma_bar, bmreg_cmd, 0);
- }
-
-- /* Wait for the DMA transfer to complete */
-- do {
-- status = qpci_io_readb(dev, bmdma_bar, bmreg_status);
-- } while ((status & (BM_STS_ACTIVE | BM_STS_INTR)) == BM_STS_ACTIVE);
--
-- g_assert_cmpint(qtest_get_irq(qts, IDE_PRIMARY_IRQ), ==,
-- !!(status & BM_STS_INTR));
--
-- /* Check IDE status code */
-- assert_bit_set(qpci_io_readb(dev, ide_bar, reg_status), DRDY);
-- assert_bit_clear(qpci_io_readb(dev, ide_bar, reg_status), BSY | DRQ);
--
-- /* Reading the status register clears the IRQ */
-- g_assert(!qtest_get_irq(qts, IDE_PRIMARY_IRQ));
--
-- /* Stop DMA transfer if still active */
-- if (status & BM_STS_ACTIVE) {
-- qpci_io_writeb(dev, bmdma_bar, bmreg_cmd, 0);
-- }
-+ status = wait_dma_completion(qts, dev, bmdma_bar, ide_bar);
-
- free_pci_device(dev);
-
---
-2.52.0
-
diff --git a/kvm-ide-test-Test-reset-during-TRIM.patch b/kvm-ide-test-Test-reset-during-TRIM.patch
deleted file mode 100644
index 995ea60..0000000
--- a/kvm-ide-test-Test-reset-during-TRIM.patch
+++ /dev/null
@@ -1,181 +0,0 @@
-From 1d7ff7d45d25d64fc17087a7efadca12fb9ee4e9 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Tue, 21 Apr 2026 18:11:32 +0200
-Subject: [PATCH 07/52] ide-test: Test reset during TRIM
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 503: ide: Fix deadlock between TRIM and drain
-RH-Jira: RHEL-121686
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [7/7] ce0ab448a920d91472da7c89080eeafa3d9cf830 (kmwolf/centos-qemu-kvm)
-
-This is a regression test for the bug fixed in the previous commits, a
-deadlock between the drain issued by an IDE reset and the TRIM state
-machine.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260421161132.99878-8-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 2fa24e9755994f76f08ea2452215eb50f26f4c21)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- tests/qtest/ide-test.c | 95 ++++++++++++++++++++++++++++++++++++++----
- 1 file changed, 87 insertions(+), 8 deletions(-)
-
-diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c
-index c6dcb2c074..721e78170b 100644
---- a/tests/qtest/ide-test.c
-+++ b/tests/qtest/ide-test.c
-@@ -41,8 +41,11 @@
- #define IDE_PCI_FUNC 1
-
- #define IDE_BASE 0x1f0
-+#define IDE_BASE2 0x3f6
- #define IDE_PRIMARY_IRQ 14
-
-+#define IDE_CTRL_RESET 0x04
-+
- #define ATAPI_BLOCK_SIZE 2048
-
- /* How many bytes to receive via ATAPI PIO at one time.
-@@ -99,6 +102,7 @@ enum {
-
- CMDF_ABORT = 0x100,
- CMDF_NO_BM = 0x200,
-+ CMDF_NO_WAIT = 0x400,
- };
-
- enum {
-@@ -228,21 +232,21 @@ static uint8_t wait_dma_completion(QTestState *qts, QPCIDevice *dev,
- return status;
- }
-
--static int send_dma_request(QTestState *qts, int cmd, uint64_t sector,
-- int nb_sectors, PrdtEntry *prdt, int prdt_entries,
-- void(*post_exec)(QPCIDevice *dev, QPCIBar ide_bar,
-- uint64_t sector, int nb_sectors))
-+static int send_dma_request_dev(QTestState *qts, QPCIDevice *dev,
-+ QPCIBar bmdma_bar, QPCIBar ide_bar, int cmd,
-+ uint64_t sector, int nb_sectors,
-+ PrdtEntry *prdt, int prdt_entries,
-+ void(*post_exec)(QPCIDevice *dev,
-+ QPCIBar ide_bar,
-+ uint64_t sector,
-+ int nb_sectors))
- {
-- QPCIDevice *dev;
-- QPCIBar bmdma_bar, ide_bar;
- uintptr_t guest_prdt;
- size_t len;
- bool from_dev;
- uint8_t status;
- int flags;
-
-- dev = get_pci_device(qts, &bmdma_bar, &ide_bar);
--
- flags = cmd & ~0xff;
- cmd &= 0xff;
-
-@@ -308,8 +312,28 @@ static int send_dma_request(QTestState *qts, int cmd, uint64_t sector,
- qpci_io_writeb(dev, bmdma_bar, bmreg_cmd, 0);
- }
-
-+ if (flags & CMDF_NO_WAIT) {
-+ return 0;
-+ }
-+
- status = wait_dma_completion(qts, dev, bmdma_bar, ide_bar);
-
-+ return status;
-+}
-+
-+static int send_dma_request(QTestState *qts, int cmd, uint64_t sector,
-+ int nb_sectors, PrdtEntry *prdt, int prdt_entries,
-+ void(*post_exec)(QPCIDevice *dev, QPCIBar ide_bar,
-+ uint64_t sector, int nb_sectors))
-+{
-+ QPCIDevice *dev;
-+ QPCIBar bmdma_bar, ide_bar;
-+ uint8_t status;
-+
-+ dev = get_pci_device(qts, &bmdma_bar, &ide_bar);
-+ status = send_dma_request_dev(qts, dev, bmdma_bar, ide_bar,
-+ cmd, sector, nb_sectors, prdt, prdt_entries,
-+ post_exec);
- free_pci_device(dev);
-
- return status;
-@@ -457,6 +481,60 @@ static void test_bmdma_trim(void)
- test_bmdma_teardown(qts);
- }
-
-+static void test_bmdma_trim_reset(void)
-+{
-+ QTestState *qts;
-+ QPCIDevice *dev;
-+ QPCIBar bmdma_bar, ide_bar, ide_bar2;
-+ uint8_t status;
-+ const uint64_t trim_range[] = {
-+ trim_range_le(0, 2),
-+ trim_range_le(6, 8),
-+ };
-+ size_t len = 512;
-+ uint8_t *buf;
-+ uintptr_t guest_buf;
-+ PrdtEntry prdt[1];
-+
-+ qts = ide_test_start(
-+ "-blockdev file,filename=%s,node-name=img "
-+ "-blockdev blkdebug,image=img,node-name=dbg,discard=unmap,"
-+ "inject-error.0.event=none,inject-error.0.iotype=discard,"
-+ "inject-error.0.errno=0,inject-error.0.delay-ns=1000000 "
-+ "-device ide-hd,drive=dbg,bus=ide.0",
-+ tmp_path[0]);
-+ qtest_irq_intercept_in(qts, "ioapic");
-+
-+ guest_buf = guest_alloc(&guest_malloc, len);
-+ prdt[0].addr = cpu_to_le32(guest_buf),
-+ prdt[0].size = cpu_to_le32(len | PRDT_EOT),
-+
-+ dev = get_pci_device(qts, &bmdma_bar, &ide_bar);
-+ ide_bar2 = qpci_legacy_iomap(dev, IDE_BASE2);
-+
-+ buf = g_malloc(len);
-+
-+ /* TRIM request with two segments */
-+ *((uint64_t *)buf) = trim_range[0];
-+ *((uint64_t *)buf + 1) = trim_range[1];
-+
-+ qtest_memwrite(qts, guest_buf, buf, 2 * sizeof(uint64_t));
-+
-+ send_dma_request_dev(qts, dev, bmdma_bar, ide_bar, CMD_DSM | CMDF_NO_WAIT, 0, 1, prdt,
-+ ARRAY_SIZE(prdt), NULL);
-+
-+ /* Reset the device while the first segment is in flight */
-+ qpci_io_writeb(dev, ide_bar2, 0, IDE_CTRL_RESET);
-+
-+ status = wait_dma_completion(qts, dev, bmdma_bar, ide_bar);
-+ g_assert_cmphex(status, ==, BM_STS_INTR);
-+ assert_bit_clear(qpci_io_readb(dev, ide_bar, reg_status), DF | ERR);
-+
-+ free_pci_device(dev);
-+ g_free(buf);
-+ test_bmdma_teardown(qts);
-+}
-+
- /*
- * This test is developed according to the Programming Interface for
- * Bus Master IDE Controller (Revision 1.0 5/16/94)
-@@ -1138,6 +1216,7 @@ int main(int argc, char **argv)
-
- qtest_add_func("/ide/bmdma/simple_rw", test_bmdma_simple_rw);
- qtest_add_func("/ide/bmdma/trim", test_bmdma_trim);
-+ qtest_add_func("/ide/bmdma/trim_reset", test_bmdma_trim_reset);
- qtest_add_func("/ide/bmdma/various_prdts", test_bmdma_various_prdts);
- qtest_add_func("/ide/bmdma/no_busmaster", test_bmdma_no_busmaster);
-
---
-2.52.0
-
diff --git a/kvm-include-hw-hyperv-Add-MSHV-ABI-header-definitions.patch b/kvm-include-hw-hyperv-Add-MSHV-ABI-header-definitions.patch
deleted file mode 100644
index a7351ea..0000000
--- a/kvm-include-hw-hyperv-Add-MSHV-ABI-header-definitions.patch
+++ /dev/null
@@ -1,1264 +0,0 @@
-From 28c5559bcd0f99ca2f361705f7cada968c83eb49 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:25 +0200
-Subject: [PATCH 07/32] include/hw/hyperv: Add MSHV ABI header definitions
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [5/30] 61968a1149ddbc713982cac62fa09e327590fb47
-
-Introduce headers for the Microsoft Hypervisor (MSHV) userspace ABI,
-including IOCTLs and structures used to interface with the hypervisor.
-
-These definitions are based on the upstream Linux MSHV interface and
-will be used by the MSHV accelerator backend in later patches.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-6-magnuskulke@linux.microsoft.com
-[Do not use __uN types. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 7db6086287502ad5a015ccc31e85ec9cac7e2716)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- include/hw/hyperv/hvgdk.h | 20 +
- include/hw/hyperv/hvgdk_mini.h | 817 ++++++++++++++++++++++++++++++++
- include/hw/hyperv/hvhdk.h | 249 ++++++++++
- include/hw/hyperv/hvhdk_mini.h | 102 ++++
- scripts/update-linux-headers.sh | 2 +-
- 5 files changed, 1189 insertions(+), 1 deletion(-)
- create mode 100644 include/hw/hyperv/hvgdk.h
- create mode 100644 include/hw/hyperv/hvgdk_mini.h
- create mode 100644 include/hw/hyperv/hvhdk.h
- create mode 100644 include/hw/hyperv/hvhdk_mini.h
-
-diff --git a/include/hw/hyperv/hvgdk.h b/include/hw/hyperv/hvgdk.h
-new file mode 100644
-index 0000000000..71161f477c
---- /dev/null
-+++ b/include/hw/hyperv/hvgdk.h
-@@ -0,0 +1,20 @@
-+/*
-+ * Type definitions for the mshv guest interface.
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#ifndef HW_HYPERV_HVGDK_H
-+#define HW_HYPERV_HVGDK_H
-+
-+#define HVGDK_H_VERSION (25125)
-+
-+enum hv_unimplemented_msr_action {
-+ HV_UNIMPLEMENTED_MSR_ACTION_FAULT = 0,
-+ HV_UNIMPLEMENTED_MSR_ACTION_IGNORE_WRITE_READ_ZERO = 1,
-+ HV_UNIMPLEMENTED_MSR_ACTION_COUNT = 2,
-+};
-+
-+#endif /* HW_HYPERV_HVGDK_H */
-diff --git a/include/hw/hyperv/hvgdk_mini.h b/include/hw/hyperv/hvgdk_mini.h
-new file mode 100644
-index 0000000000..d89315f545
---- /dev/null
-+++ b/include/hw/hyperv/hvgdk_mini.h
-@@ -0,0 +1,817 @@
-+/*
-+ * Userspace interfaces for /dev/mshv* devices and derived fds
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#ifndef HW_HYPERV_HVGDK_MINI_H
-+#define HW_HYPERV_HVGDK_MINI_H
-+
-+#define MSHV_IOCTL 0xB8
-+
-+typedef enum hv_register_name {
-+ /* Pending Interruption Register */
-+ HV_REGISTER_PENDING_INTERRUPTION = 0x00010002,
-+
-+ /* X64 User-Mode Registers */
-+ HV_X64_REGISTER_RAX = 0x00020000,
-+ HV_X64_REGISTER_RCX = 0x00020001,
-+ HV_X64_REGISTER_RDX = 0x00020002,
-+ HV_X64_REGISTER_RBX = 0x00020003,
-+ HV_X64_REGISTER_RSP = 0x00020004,
-+ HV_X64_REGISTER_RBP = 0x00020005,
-+ HV_X64_REGISTER_RSI = 0x00020006,
-+ HV_X64_REGISTER_RDI = 0x00020007,
-+ HV_X64_REGISTER_R8 = 0x00020008,
-+ HV_X64_REGISTER_R9 = 0x00020009,
-+ HV_X64_REGISTER_R10 = 0x0002000A,
-+ HV_X64_REGISTER_R11 = 0x0002000B,
-+ HV_X64_REGISTER_R12 = 0x0002000C,
-+ HV_X64_REGISTER_R13 = 0x0002000D,
-+ HV_X64_REGISTER_R14 = 0x0002000E,
-+ HV_X64_REGISTER_R15 = 0x0002000F,
-+ HV_X64_REGISTER_RIP = 0x00020010,
-+ HV_X64_REGISTER_RFLAGS = 0x00020011,
-+
-+ /* X64 Floating Point and Vector Registers */
-+ HV_X64_REGISTER_XMM0 = 0x00030000,
-+ HV_X64_REGISTER_XMM1 = 0x00030001,
-+ HV_X64_REGISTER_XMM2 = 0x00030002,
-+ HV_X64_REGISTER_XMM3 = 0x00030003,
-+ HV_X64_REGISTER_XMM4 = 0x00030004,
-+ HV_X64_REGISTER_XMM5 = 0x00030005,
-+ HV_X64_REGISTER_XMM6 = 0x00030006,
-+ HV_X64_REGISTER_XMM7 = 0x00030007,
-+ HV_X64_REGISTER_XMM8 = 0x00030008,
-+ HV_X64_REGISTER_XMM9 = 0x00030009,
-+ HV_X64_REGISTER_XMM10 = 0x0003000A,
-+ HV_X64_REGISTER_XMM11 = 0x0003000B,
-+ HV_X64_REGISTER_XMM12 = 0x0003000C,
-+ HV_X64_REGISTER_XMM13 = 0x0003000D,
-+ HV_X64_REGISTER_XMM14 = 0x0003000E,
-+ HV_X64_REGISTER_XMM15 = 0x0003000F,
-+ HV_X64_REGISTER_FP_MMX0 = 0x00030010,
-+ HV_X64_REGISTER_FP_MMX1 = 0x00030011,
-+ HV_X64_REGISTER_FP_MMX2 = 0x00030012,
-+ HV_X64_REGISTER_FP_MMX3 = 0x00030013,
-+ HV_X64_REGISTER_FP_MMX4 = 0x00030014,
-+ HV_X64_REGISTER_FP_MMX5 = 0x00030015,
-+ HV_X64_REGISTER_FP_MMX6 = 0x00030016,
-+ HV_X64_REGISTER_FP_MMX7 = 0x00030017,
-+ HV_X64_REGISTER_FP_CONTROL_STATUS = 0x00030018,
-+ HV_X64_REGISTER_XMM_CONTROL_STATUS = 0x00030019,
-+
-+ /* X64 Control Registers */
-+ HV_X64_REGISTER_CR0 = 0x00040000,
-+ HV_X64_REGISTER_CR2 = 0x00040001,
-+ HV_X64_REGISTER_CR3 = 0x00040002,
-+ HV_X64_REGISTER_CR4 = 0x00040003,
-+ HV_X64_REGISTER_CR8 = 0x00040004,
-+ HV_X64_REGISTER_XFEM = 0x00040005,
-+
-+ /* X64 Segment Registers */
-+ HV_X64_REGISTER_ES = 0x00060000,
-+ HV_X64_REGISTER_CS = 0x00060001,
-+ HV_X64_REGISTER_SS = 0x00060002,
-+ HV_X64_REGISTER_DS = 0x00060003,
-+ HV_X64_REGISTER_FS = 0x00060004,
-+ HV_X64_REGISTER_GS = 0x00060005,
-+ HV_X64_REGISTER_LDTR = 0x00060006,
-+ HV_X64_REGISTER_TR = 0x00060007,
-+
-+ /* X64 Table Registers */
-+ HV_X64_REGISTER_IDTR = 0x00070000,
-+ HV_X64_REGISTER_GDTR = 0x00070001,
-+
-+ /* X64 Virtualized MSRs */
-+ HV_X64_REGISTER_TSC = 0x00080000,
-+ HV_X64_REGISTER_EFER = 0x00080001,
-+ HV_X64_REGISTER_KERNEL_GS_BASE = 0x00080002,
-+ HV_X64_REGISTER_APIC_BASE = 0x00080003,
-+ HV_X64_REGISTER_PAT = 0x00080004,
-+ HV_X64_REGISTER_SYSENTER_CS = 0x00080005,
-+ HV_X64_REGISTER_SYSENTER_EIP = 0x00080006,
-+ HV_X64_REGISTER_SYSENTER_ESP = 0x00080007,
-+ HV_X64_REGISTER_STAR = 0x00080008,
-+ HV_X64_REGISTER_LSTAR = 0x00080009,
-+ HV_X64_REGISTER_CSTAR = 0x0008000A,
-+ HV_X64_REGISTER_SFMASK = 0x0008000B,
-+ HV_X64_REGISTER_INITIAL_APIC_ID = 0x0008000C,
-+
-+ /* X64 Cache control MSRs */
-+ HV_X64_REGISTER_MSR_MTRR_CAP = 0x0008000D,
-+ HV_X64_REGISTER_MSR_MTRR_DEF_TYPE = 0x0008000E,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASE0 = 0x00080010,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASE1 = 0x00080011,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASE2 = 0x00080012,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASE3 = 0x00080013,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASE4 = 0x00080014,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASE5 = 0x00080015,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASE6 = 0x00080016,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASE7 = 0x00080017,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASE8 = 0x00080018,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASE9 = 0x00080019,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASEA = 0x0008001A,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASEB = 0x0008001B,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASEC = 0x0008001C,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASED = 0x0008001D,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASEE = 0x0008001E,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_BASEF = 0x0008001F,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASK0 = 0x00080040,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASK1 = 0x00080041,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASK2 = 0x00080042,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASK3 = 0x00080043,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASK4 = 0x00080044,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASK5 = 0x00080045,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASK6 = 0x00080046,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASK7 = 0x00080047,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASK8 = 0x00080048,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASK9 = 0x00080049,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASKA = 0x0008004A,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASKB = 0x0008004B,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASKC = 0x0008004C,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASKD = 0x0008004D,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASKE = 0x0008004E,
-+ HV_X64_REGISTER_MSR_MTRR_PHYS_MASKF = 0x0008004F,
-+ HV_X64_REGISTER_MSR_MTRR_FIX64K00000 = 0x00080070,
-+ HV_X64_REGISTER_MSR_MTRR_FIX16K80000 = 0x00080071,
-+ HV_X64_REGISTER_MSR_MTRR_FIX16KA0000 = 0x00080072,
-+ HV_X64_REGISTER_MSR_MTRR_FIX4KC0000 = 0x00080073,
-+ HV_X64_REGISTER_MSR_MTRR_FIX4KC8000 = 0x00080074,
-+ HV_X64_REGISTER_MSR_MTRR_FIX4KD0000 = 0x00080075,
-+ HV_X64_REGISTER_MSR_MTRR_FIX4KD8000 = 0x00080076,
-+ HV_X64_REGISTER_MSR_MTRR_FIX4KE0000 = 0x00080077,
-+ HV_X64_REGISTER_MSR_MTRR_FIX4KE8000 = 0x00080078,
-+ HV_X64_REGISTER_MSR_MTRR_FIX4KF0000 = 0x00080079,
-+ HV_X64_REGISTER_MSR_MTRR_FIX4KF8000 = 0x0008007A,
-+
-+ HV_X64_REGISTER_TSC_AUX = 0x0008007B,
-+ HV_X64_REGISTER_BNDCFGS = 0x0008007C,
-+ HV_X64_REGISTER_DEBUG_CTL = 0x0008007D,
-+
-+ /* Available */
-+
-+ HV_X64_REGISTER_SPEC_CTRL = 0x00080084,
-+ HV_X64_REGISTER_TSC_ADJUST = 0x00080096,
-+
-+ /* Other MSRs */
-+ HV_X64_REGISTER_MSR_IA32_MISC_ENABLE = 0x000800A0,
-+
-+ /* Misc */
-+ HV_REGISTER_GUEST_OS_ID = 0x00090002,
-+ HV_REGISTER_REFERENCE_TSC = 0x00090017,
-+
-+ /* Hypervisor-defined Registers (Synic) */
-+ HV_REGISTER_SINT0 = 0x000A0000,
-+ HV_REGISTER_SINT1 = 0x000A0001,
-+ HV_REGISTER_SINT2 = 0x000A0002,
-+ HV_REGISTER_SINT3 = 0x000A0003,
-+ HV_REGISTER_SINT4 = 0x000A0004,
-+ HV_REGISTER_SINT5 = 0x000A0005,
-+ HV_REGISTER_SINT6 = 0x000A0006,
-+ HV_REGISTER_SINT7 = 0x000A0007,
-+ HV_REGISTER_SINT8 = 0x000A0008,
-+ HV_REGISTER_SINT9 = 0x000A0009,
-+ HV_REGISTER_SINT10 = 0x000A000A,
-+ HV_REGISTER_SINT11 = 0x000A000B,
-+ HV_REGISTER_SINT12 = 0x000A000C,
-+ HV_REGISTER_SINT13 = 0x000A000D,
-+ HV_REGISTER_SINT14 = 0x000A000E,
-+ HV_REGISTER_SINT15 = 0x000A000F,
-+ HV_REGISTER_SCONTROL = 0x000A0010,
-+ HV_REGISTER_SVERSION = 0x000A0011,
-+ HV_REGISTER_SIEFP = 0x000A0012,
-+ HV_REGISTER_SIMP = 0x000A0013,
-+ HV_REGISTER_EOM = 0x000A0014,
-+ HV_REGISTER_SIRBP = 0x000A0015,
-+} hv_register_name;
-+
-+enum hv_intercept_type {
-+ HV_INTERCEPT_TYPE_X64_IO_PORT = 0X00000000,
-+ HV_INTERCEPT_TYPE_X64_MSR = 0X00000001,
-+ HV_INTERCEPT_TYPE_X64_CPUID = 0X00000002,
-+ HV_INTERCEPT_TYPE_EXCEPTION = 0X00000003,
-+
-+ /* Used to be HV_INTERCEPT_TYPE_REGISTER */
-+ HV_INTERCEPT_TYPE_RESERVED0 = 0X00000004,
-+ HV_INTERCEPT_TYPE_MMIO = 0X00000005,
-+ HV_INTERCEPT_TYPE_X64_GLOBAL_CPUID = 0X00000006,
-+ HV_INTERCEPT_TYPE_X64_APIC_SMI = 0X00000007,
-+ HV_INTERCEPT_TYPE_HYPERCALL = 0X00000008,
-+
-+ HV_INTERCEPT_TYPE_X64_APIC_INIT_SIPI = 0X00000009,
-+ HV_INTERCEPT_MC_UPDATE_PATCH_LEVEL_MSR_READ = 0X0000000A,
-+
-+ HV_INTERCEPT_TYPE_X64_APIC_WRITE = 0X0000000B,
-+ HV_INTERCEPT_TYPE_X64_MSR_INDEX = 0X0000000C,
-+ HV_INTERCEPT_TYPE_MAX,
-+ HV_INTERCEPT_TYPE_INVALID = 0XFFFFFFFF,
-+};
-+
-+struct hv_u128 {
-+ uint64_t low_part;
-+ uint64_t high_part;
-+};
-+
-+union hv_x64_xmm_control_status_register {
-+ struct hv_u128 as_uint128;
-+ struct {
-+ union {
-+ /* long mode */
-+ uint64_t last_fp_rdp;
-+ /* 32 bit mode */
-+ struct {
-+ uint32_t last_fp_dp;
-+ uint16_t last_fp_ds;
-+ uint16_t padding;
-+ };
-+ };
-+ uint32_t xmm_status_control;
-+ uint32_t xmm_status_control_mask;
-+ };
-+};
-+
-+union hv_x64_fp_register {
-+ struct hv_u128 as_uint128;
-+ struct {
-+ uint64_t mantissa;
-+ uint64_t biased_exponent:15;
-+ uint64_t sign:1;
-+ uint64_t reserved:48;
-+ };
-+};
-+
-+union hv_x64_pending_exception_event {
-+ uint64_t as_uint64[2];
-+ struct {
-+ uint32_t event_pending:1;
-+ uint32_t event_type:3;
-+ uint32_t reserved0:4;
-+ uint32_t deliver_error_code:1;
-+ uint32_t reserved1:7;
-+ uint32_t vector:16;
-+ uint32_t error_code;
-+ uint64_t exception_parameter;
-+ };
-+};
-+
-+union hv_x64_pending_virtualization_fault_event {
-+ uint64_t as_uint64[2];
-+ struct {
-+ uint32_t event_pending:1;
-+ uint32_t event_type:3;
-+ uint32_t reserved0:4;
-+ uint32_t reserved1:8;
-+ uint32_t parameter0:16;
-+ uint32_t code;
-+ uint64_t parameter1;
-+ };
-+};
-+
-+union hv_x64_pending_interruption_register {
-+ uint64_t as_uint64;
-+ struct {
-+ uint32_t interruption_pending:1;
-+ uint32_t interruption_type:3;
-+ uint32_t deliver_error_code:1;
-+ uint32_t instruction_length:4;
-+ uint32_t nested_event:1;
-+ uint32_t reserved:6;
-+ uint32_t interruption_vector:16;
-+ uint32_t error_code;
-+ };
-+};
-+
-+union hv_x64_register_sev_control {
-+ uint64_t as_uint64;
-+ struct {
-+ uint64_t enable_encrypted_state:1;
-+ uint64_t reserved_z:11;
-+ uint64_t vmsa_gpa_page_number:52;
-+ };
-+};
-+
-+union hv_x64_msr_npiep_config_contents {
-+ uint64_t as_uint64;
-+ struct {
-+ /*
-+ * These bits enable instruction execution prevention for
-+ * specific instructions.
-+ */
-+ uint64_t prevents_gdt:1;
-+ uint64_t prevents_idt:1;
-+ uint64_t prevents_ldt:1;
-+ uint64_t prevents_tr:1;
-+
-+ /* The reserved bits must always be 0. */
-+ uint64_t reserved:60;
-+ };
-+};
-+
-+typedef struct hv_x64_segment_register {
-+ uint64_t base;
-+ uint32_t limit;
-+ uint16_t selector;
-+ union {
-+ struct {
-+ uint16_t segment_type:4;
-+ uint16_t non_system_segment:1;
-+ uint16_t descriptor_privilege_level:2;
-+ uint16_t present:1;
-+ uint16_t reserved:4;
-+ uint16_t available:1;
-+ uint16_t _long:1;
-+ uint16_t _default:1;
-+ uint16_t granularity:1;
-+ };
-+ uint16_t attributes;
-+ };
-+} hv_x64_segment_register;
-+
-+typedef struct hv_x64_table_register {
-+ uint16_t pad[3];
-+ uint16_t limit;
-+ uint64_t base;
-+} hv_x64_table_register;
-+
-+union hv_x64_fp_control_status_register {
-+ struct hv_u128 as_uint128;
-+ struct {
-+ uint16_t fp_control;
-+ uint16_t fp_status;
-+ uint8_t fp_tag;
-+ uint8_t reserved;
-+ uint16_t last_fp_op;
-+ union {
-+ /* long mode */
-+ uint64_t last_fp_rip;
-+ /* 32 bit mode */
-+ struct {
-+ uint32_t last_fp_eip;
-+ uint16_t last_fp_cs;
-+ uint16_t padding;
-+ };
-+ };
-+ };
-+};
-+
-+/* General Hypervisor Register Content Definitions */
-+
-+union hv_explicit_suspend_register {
-+ uint64_t as_uint64;
-+ struct {
-+ uint64_t suspended:1;
-+ uint64_t reserved:63;
-+ };
-+};
-+
-+union hv_internal_activity_register {
-+ uint64_t as_uint64;
-+
-+ struct {
-+ uint64_t startup_suspend:1;
-+ uint64_t halt_suspend:1;
-+ uint64_t idle_suspend:1;
-+ uint64_t rsvd_z:61;
-+ };
-+};
-+
-+union hv_x64_interrupt_state_register {
-+ uint64_t as_uint64;
-+ struct {
-+ uint64_t interrupt_shadow:1;
-+ uint64_t nmi_masked:1;
-+ uint64_t reserved:62;
-+ };
-+};
-+
-+union hv_intercept_suspend_register {
-+ uint64_t as_uint64;
-+ struct {
-+ uint64_t suspended:1;
-+ uint64_t reserved:63;
-+ };
-+};
-+
-+typedef union hv_register_value {
-+ struct hv_u128 reg128;
-+ uint64_t reg64;
-+ uint32_t reg32;
-+ uint16_t reg16;
-+ uint8_t reg8;
-+ union hv_x64_fp_register fp;
-+ union hv_x64_fp_control_status_register fp_control_status;
-+ union hv_x64_xmm_control_status_register xmm_control_status;
-+ struct hv_x64_segment_register segment;
-+ struct hv_x64_table_register table;
-+ union hv_explicit_suspend_register explicit_suspend;
-+ union hv_intercept_suspend_register intercept_suspend;
-+ union hv_internal_activity_register internal_activity;
-+ union hv_x64_interrupt_state_register interrupt_state;
-+ union hv_x64_pending_interruption_register pending_interruption;
-+ union hv_x64_msr_npiep_config_contents npiep_config;
-+ union hv_x64_pending_exception_event pending_exception_event;
-+ union hv_x64_pending_virtualization_fault_event
-+ pending_virtualization_fault_event;
-+ union hv_x64_register_sev_control sev_control;
-+} hv_register_value;
-+
-+typedef struct hv_register_assoc {
-+ uint32_t name; /* enum hv_register_name */
-+ uint32_t reserved1;
-+ uint64_t reserved2;
-+ union hv_register_value value;
-+} hv_register_assoc;
-+
-+union hv_input_vtl {
-+ uint8_t as_uint8;
-+ struct {
-+ uint8_t target_vtl:4;
-+ uint8_t use_target_vtl:1;
-+ uint8_t reserved_z:3;
-+ };
-+};
-+
-+typedef struct hv_input_get_vp_registers {
-+ uint64_t partition_id;
-+ uint32_t vp_index;
-+ union hv_input_vtl input_vtl;
-+ uint8_t rsvd_z8;
-+ uint16_t rsvd_z16;
-+ uint32_t names[];
-+} hv_input_get_vp_registers;
-+
-+typedef struct hv_input_set_vp_registers {
-+ uint64_t partition_id;
-+ uint32_t vp_index;
-+ union hv_input_vtl input_vtl;
-+ uint8_t rsvd_z8;
-+ uint16_t rsvd_z16;
-+ struct hv_register_assoc elements[];
-+} hv_input_set_vp_registers;
-+
-+#define MSHV_VP_MAX_REGISTERS 128
-+
-+struct mshv_vp_registers {
-+ int count; /* at most MSHV_VP_MAX_REGISTERS */
-+ struct hv_register_assoc *regs;
-+};
-+
-+union hv_interrupt_control {
-+ uint64_t as_uint64;
-+ struct {
-+ uint32_t interrupt_type; /* enum hv_interrupt type */
-+ uint32_t level_triggered:1;
-+ uint32_t logical_dest_mode:1;
-+ uint32_t rsvd:30;
-+ };
-+};
-+
-+struct hv_input_assert_virtual_interrupt {
-+ uint64_t partition_id;
-+ union hv_interrupt_control control;
-+ uint64_t dest_addr; /* cpu's apic id */
-+ uint32_t vector;
-+ uint8_t target_vtl;
-+ uint8_t rsvd_z0;
-+ uint16_t rsvd_z1;
-+};
-+
-+/* /dev/mshv */
-+#define MSHV_CREATE_PARTITION _IOW(MSHV_IOCTL, 0x00, struct mshv_create_partition)
-+#define MSHV_CREATE_VP _IOW(MSHV_IOCTL, 0x01, struct mshv_create_vp)
-+
-+/* Partition fds created with MSHV_CREATE_PARTITION */
-+#define MSHV_INITIALIZE_PARTITION _IO(MSHV_IOCTL, 0x00)
-+#define MSHV_SET_GUEST_MEMORY _IOW(MSHV_IOCTL, 0x02, struct mshv_user_mem_region)
-+#define MSHV_IRQFD _IOW(MSHV_IOCTL, 0x03, struct mshv_user_irqfd)
-+#define MSHV_IOEVENTFD _IOW(MSHV_IOCTL, 0x04, struct mshv_user_ioeventfd)
-+#define MSHV_SET_MSI_ROUTING _IOW(MSHV_IOCTL, 0x05, struct mshv_user_irq_table)
-+
-+/*
-+ ********************************
-+ * VP APIs for child partitions *
-+ ********************************
-+ */
-+
-+struct hv_local_interrupt_controller_state {
-+ /* HV_X64_INTERRUPT_CONTROLLER_STATE */
-+ uint32_t apic_id;
-+ uint32_t apic_version;
-+ uint32_t apic_ldr;
-+ uint32_t apic_dfr;
-+ uint32_t apic_spurious;
-+ uint32_t apic_isr[8];
-+ uint32_t apic_tmr[8];
-+ uint32_t apic_irr[8];
-+ uint32_t apic_esr;
-+ uint32_t apic_icr_high;
-+ uint32_t apic_icr_low;
-+ uint32_t apic_lvt_timer;
-+ uint32_t apic_lvt_thermal;
-+ uint32_t apic_lvt_perfmon;
-+ uint32_t apic_lvt_lint0;
-+ uint32_t apic_lvt_lint1;
-+ uint32_t apic_lvt_error;
-+ uint32_t apic_lvt_cmci;
-+ uint32_t apic_error_status;
-+ uint32_t apic_initial_count;
-+ uint32_t apic_counter_value;
-+ uint32_t apic_divide_configuration;
-+ uint32_t apic_remote_read;
-+};
-+
-+/* Generic hypercall */
-+#define MSHV_ROOT_HVCALL _IOWR(MSHV_IOCTL, 0x07, struct mshv_root_hvcall)
-+
-+/* From hvgdk_mini.h */
-+
-+#define HV_X64_MSR_GUEST_OS_ID 0x40000000
-+#define HV_X64_MSR_SINT0 0x40000090
-+#define HV_X64_MSR_SINT1 0x40000091
-+#define HV_X64_MSR_SINT2 0x40000092
-+#define HV_X64_MSR_SINT3 0x40000093
-+#define HV_X64_MSR_SINT4 0x40000094
-+#define HV_X64_MSR_SINT5 0x40000095
-+#define HV_X64_MSR_SINT6 0x40000096
-+#define HV_X64_MSR_SINT7 0x40000097
-+#define HV_X64_MSR_SINT8 0x40000098
-+#define HV_X64_MSR_SINT9 0x40000099
-+#define HV_X64_MSR_SINT10 0x4000009A
-+#define HV_X64_MSR_SINT11 0x4000009B
-+#define HV_X64_MSR_SINT12 0x4000009C
-+#define HV_X64_MSR_SINT13 0x4000009D
-+#define HV_X64_MSR_SINT14 0x4000009E
-+#define HV_X64_MSR_SINT15 0x4000009F
-+#define HV_X64_MSR_SCONTROL 0x40000080
-+#define HV_X64_MSR_SIEFP 0x40000082
-+#define HV_X64_MSR_SIMP 0x40000083
-+#define HV_X64_MSR_REFERENCE_TSC 0x40000021
-+#define HV_X64_MSR_EOM 0x40000084
-+
-+/* Define port identifier type. */
-+union hv_port_id {
-+ uint32_t asuint32_t;
-+ struct {
-+ uint32_t id:24;
-+ uint32_t reserved:8;
-+ };
-+};
-+
-+#define HV_MESSAGE_SIZE (256)
-+#define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240)
-+#define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30)
-+
-+/* Define hypervisor message types. */
-+enum hv_message_type {
-+ HVMSG_NONE = 0x00000000,
-+
-+ /* Memory access messages. */
-+ HVMSG_UNMAPPED_GPA = 0x80000000,
-+ HVMSG_GPA_INTERCEPT = 0x80000001,
-+ HVMSG_UNACCEPTED_GPA = 0x80000003,
-+ HVMSG_GPA_ATTRIBUTE_INTERCEPT = 0x80000004,
-+
-+ /* Timer notification messages. */
-+ HVMSG_TIMER_EXPIRED = 0x80000010,
-+
-+ /* Error messages. */
-+ HVMSG_INVALID_VP_REGISTER_VALUE = 0x80000020,
-+ HVMSG_UNRECOVERABLE_EXCEPTION = 0x80000021,
-+ HVMSG_UNSUPPORTED_FEATURE = 0x80000022,
-+
-+ /*
-+ * Opaque intercept message. The original intercept message is only
-+ * accessible from the mapped intercept message page.
-+ */
-+ HVMSG_OPAQUE_INTERCEPT = 0x8000003F,
-+
-+ /* Trace buffer complete messages. */
-+ HVMSG_EVENTLOG_BUFFERCOMPLETE = 0x80000040,
-+
-+ /* Hypercall intercept */
-+ HVMSG_HYPERCALL_INTERCEPT = 0x80000050,
-+
-+ /* SynIC intercepts */
-+ HVMSG_SYNIC_EVENT_INTERCEPT = 0x80000060,
-+ HVMSG_SYNIC_SINT_INTERCEPT = 0x80000061,
-+ HVMSG_SYNIC_SINT_DELIVERABLE = 0x80000062,
-+
-+ /* Async call completion intercept */
-+ HVMSG_ASYNC_CALL_COMPLETION = 0x80000070,
-+
-+ /* Root scheduler messages */
-+ HVMSG_SCHEDULER_VP_SIGNAL_BITSE = 0x80000100,
-+ HVMSG_SCHEDULER_VP_SIGNAL_PAIR = 0x80000101,
-+
-+ /* Platform-specific processor intercept messages. */
-+ HVMSG_X64_IO_PORT_INTERCEPT = 0x80010000,
-+ HVMSG_X64_MSR_INTERCEPT = 0x80010001,
-+ HVMSG_X64_CPUID_INTERCEPT = 0x80010002,
-+ HVMSG_X64_EXCEPTION_INTERCEPT = 0x80010003,
-+ HVMSG_X64_APIC_EOI = 0x80010004,
-+ HVMSG_X64_LEGACY_FP_ERROR = 0x80010005,
-+ HVMSG_X64_IOMMU_PRQ = 0x80010006,
-+ HVMSG_X64_HALT = 0x80010007,
-+ HVMSG_X64_INTERRUPTION_DELIVERABLE = 0x80010008,
-+ HVMSG_X64_SIPI_INTERCEPT = 0x80010009,
-+ HVMSG_X64_SEV_VMGEXIT_INTERCEPT = 0x80010013,
-+};
-+
-+union hv_x64_vp_execution_state {
-+ uint16_t as_uint16;
-+ struct {
-+ uint16_t cpl:2;
-+ uint16_t cr0_pe:1;
-+ uint16_t cr0_am:1;
-+ uint16_t efer_lma:1;
-+ uint16_t debug_active:1;
-+ uint16_t interruption_pending:1;
-+ uint16_t vtl:4;
-+ uint16_t enclave_mode:1;
-+ uint16_t interrupt_shadow:1;
-+ uint16_t virtualization_fault_active:1;
-+ uint16_t reserved:2;
-+ };
-+};
-+
-+/* From openvmm::hvdef */
-+enum hv_x64_intercept_access_type {
-+ HV_X64_INTERCEPT_ACCESS_TYPE_READ = 0,
-+ HV_X64_INTERCEPT_ACCESS_TYPE_WRITE = 1,
-+ HV_X64_INTERCEPT_ACCESS_TYPE_EXECUTE = 2,
-+};
-+
-+struct hv_x64_intercept_message_header {
-+ uint32_t vp_index;
-+ uint8_t instruction_length:4;
-+ uint8_t cr8:4; /* Only set for exo partitions */
-+ uint8_t intercept_access_type;
-+ union hv_x64_vp_execution_state execution_state;
-+ struct hv_x64_segment_register cs_segment;
-+ uint64_t rip;
-+ uint64_t rflags;
-+};
-+
-+union hv_x64_io_port_access_info {
-+ uint8_t as_uint8;
-+ struct {
-+ uint8_t access_size:3;
-+ uint8_t string_op:1;
-+ uint8_t rep_prefix:1;
-+ uint8_t reserved:3;
-+ };
-+};
-+
-+typedef struct hv_x64_io_port_intercept_message {
-+ struct hv_x64_intercept_message_header header;
-+ uint16_t port_number;
-+ union hv_x64_io_port_access_info access_info;
-+ uint8_t instruction_byte_count;
-+ uint32_t reserved;
-+ uint64_t rax;
-+ uint8_t instruction_bytes[16];
-+ struct hv_x64_segment_register ds_segment;
-+ struct hv_x64_segment_register es_segment;
-+ uint64_t rcx;
-+ uint64_t rsi;
-+ uint64_t rdi;
-+} hv_x64_io_port_intercept_message;
-+
-+union hv_x64_memory_access_info {
-+ uint8_t as_uint8;
-+ struct {
-+ uint8_t gva_valid:1;
-+ uint8_t gva_gpa_valid:1;
-+ uint8_t hypercall_output_pending:1;
-+ uint8_t tlb_locked_no_overlay:1;
-+ uint8_t reserved:4;
-+ };
-+};
-+
-+struct hv_x64_memory_intercept_message {
-+ struct hv_x64_intercept_message_header header;
-+ uint32_t cache_type; /* enum hv_cache_type */
-+ uint8_t instruction_byte_count;
-+ union hv_x64_memory_access_info memory_access_info;
-+ uint8_t tpr_priority;
-+ uint8_t reserved1;
-+ uint64_t guest_virtual_address;
-+ uint64_t guest_physical_address;
-+ uint8_t instruction_bytes[16];
-+};
-+
-+union hv_message_flags {
-+ uint8_t asu8;
-+ struct {
-+ uint8_t msg_pending:1;
-+ uint8_t reserved:7;
-+ };
-+};
-+
-+struct hv_message_header {
-+ uint32_t message_type;
-+ uint8_t payload_size;
-+ union hv_message_flags message_flags;
-+ uint8_t reserved[2];
-+ union {
-+ uint64_t sender;
-+ union hv_port_id port;
-+ };
-+};
-+
-+struct hv_message {
-+ struct hv_message_header header;
-+ union {
-+ uint64_t payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
-+ } u;
-+};
-+
-+/* From github.com/rust-vmm/mshv-bindings/src/x86_64/regs.rs */
-+
-+struct hv_cpuid_entry {
-+ uint32_t function;
-+ uint32_t index;
-+ uint32_t flags;
-+ uint32_t eax;
-+ uint32_t ebx;
-+ uint32_t ecx;
-+ uint32_t edx;
-+ uint32_t padding[3];
-+};
-+
-+struct hv_cpuid {
-+ uint32_t nent;
-+ uint32_t padding;
-+ struct hv_cpuid_entry entries[0];
-+};
-+
-+#define IA32_MSR_TSC 0x00000010
-+#define IA32_MSR_EFER 0xC0000080
-+#define IA32_MSR_KERNEL_GS_BASE 0xC0000102
-+#define IA32_MSR_APIC_BASE 0x0000001B
-+#define IA32_MSR_PAT 0x0277
-+#define IA32_MSR_SYSENTER_CS 0x00000174
-+#define IA32_MSR_SYSENTER_ESP 0x00000175
-+#define IA32_MSR_SYSENTER_EIP 0x00000176
-+#define IA32_MSR_STAR 0xC0000081
-+#define IA32_MSR_LSTAR 0xC0000082
-+#define IA32_MSR_CSTAR 0xC0000083
-+#define IA32_MSR_SFMASK 0xC0000084
-+
-+#define IA32_MSR_MTRR_CAP 0x00FE
-+#define IA32_MSR_MTRR_DEF_TYPE 0x02FF
-+#define IA32_MSR_MTRR_PHYSBASE0 0x0200
-+#define IA32_MSR_MTRR_PHYSMASK0 0x0201
-+#define IA32_MSR_MTRR_PHYSBASE1 0x0202
-+#define IA32_MSR_MTRR_PHYSMASK1 0x0203
-+#define IA32_MSR_MTRR_PHYSBASE2 0x0204
-+#define IA32_MSR_MTRR_PHYSMASK2 0x0205
-+#define IA32_MSR_MTRR_PHYSBASE3 0x0206
-+#define IA32_MSR_MTRR_PHYSMASK3 0x0207
-+#define IA32_MSR_MTRR_PHYSBASE4 0x0208
-+#define IA32_MSR_MTRR_PHYSMASK4 0x0209
-+#define IA32_MSR_MTRR_PHYSBASE5 0x020A
-+#define IA32_MSR_MTRR_PHYSMASK5 0x020B
-+#define IA32_MSR_MTRR_PHYSBASE6 0x020C
-+#define IA32_MSR_MTRR_PHYSMASK6 0x020D
-+#define IA32_MSR_MTRR_PHYSBASE7 0x020E
-+#define IA32_MSR_MTRR_PHYSMASK7 0x020F
-+
-+#define IA32_MSR_MTRR_FIX64K_00000 0x0250
-+#define IA32_MSR_MTRR_FIX16K_80000 0x0258
-+#define IA32_MSR_MTRR_FIX16K_A0000 0x0259
-+#define IA32_MSR_MTRR_FIX4K_C0000 0x0268
-+#define IA32_MSR_MTRR_FIX4K_C8000 0x0269
-+#define IA32_MSR_MTRR_FIX4K_D0000 0x026A
-+#define IA32_MSR_MTRR_FIX4K_D8000 0x026B
-+#define IA32_MSR_MTRR_FIX4K_E0000 0x026C
-+#define IA32_MSR_MTRR_FIX4K_E8000 0x026D
-+#define IA32_MSR_MTRR_FIX4K_F0000 0x026E
-+#define IA32_MSR_MTRR_FIX4K_F8000 0x026F
-+
-+#define IA32_MSR_TSC_AUX 0xC0000103
-+#define IA32_MSR_BNDCFGS 0x00000d90
-+#define IA32_MSR_DEBUG_CTL 0x1D9
-+#define IA32_MSR_SPEC_CTRL 0x00000048
-+#define IA32_MSR_TSC_ADJUST 0x0000003b
-+
-+#define IA32_MSR_MISC_ENABLE 0x000001a0
-+
-+#define HV_TRANSLATE_GVA_VALIDATE_READ (0x0001)
-+#define HV_TRANSLATE_GVA_VALIDATE_WRITE (0x0002)
-+#define HV_TRANSLATE_GVA_VALIDATE_EXECUTE (0x0004)
-+
-+#define HV_HYP_PAGE_SHIFT 12
-+#define HV_HYP_PAGE_SIZE BIT(HV_HYP_PAGE_SHIFT)
-+#define HV_HYP_PAGE_MASK (~(HV_HYP_PAGE_SIZE - 1))
-+
-+#define HVCALL_GET_PARTITION_PROPERTY 0x0044
-+#define HVCALL_SET_PARTITION_PROPERTY 0x0045
-+#define HVCALL_GET_VP_REGISTERS 0x0050
-+#define HVCALL_SET_VP_REGISTERS 0x0051
-+#define HVCALL_TRANSLATE_VIRTUAL_ADDRESS 0x0052
-+#define HVCALL_REGISTER_INTERCEPT_RESULT 0x0091
-+#define HVCALL_ASSERT_VIRTUAL_INTERRUPT 0x0094
-+
-+#endif /* HW_HYPERV_HVGDK_MINI_H */
-diff --git a/include/hw/hyperv/hvhdk.h b/include/hw/hyperv/hvhdk.h
-new file mode 100644
-index 0000000000..866c8211bf
---- /dev/null
-+++ b/include/hw/hyperv/hvhdk.h
-@@ -0,0 +1,249 @@
-+/*
-+ * Type definitions for the mshv host.
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#ifndef HW_HYPERV_HVHDK_H
-+#define HW_HYPERV_HVHDK_H
-+
-+#define HV_PARTITION_SYNTHETIC_PROCESSOR_FEATURES_BANKS 1
-+
-+struct hv_input_set_partition_property {
-+ uint64_t partition_id;
-+ uint32_t property_code; /* enum hv_partition_property_code */
-+ uint32_t padding;
-+ uint64_t property_value;
-+};
-+
-+union hv_partition_synthetic_processor_features {
-+ uint64_t as_uint64[HV_PARTITION_SYNTHETIC_PROCESSOR_FEATURES_BANKS];
-+
-+ struct {
-+ /*
-+ * Report a hypervisor is present. CPUID leaves
-+ * 0x40000000 and 0x40000001 are supported.
-+ */
-+ uint64_t hypervisor_present:1;
-+
-+ /*
-+ * Features associated with HV#1:
-+ */
-+
-+ /* Report support for Hv1 (CPUID leaves 0x40000000 - 0x40000006). */
-+ uint64_t hv1:1;
-+
-+ /*
-+ * Access to HV_X64_MSR_VP_RUNTIME.
-+ * Corresponds to access_vp_run_time_reg privilege.
-+ */
-+ uint64_t access_vp_run_time_reg:1;
-+
-+ /*
-+ * Access to HV_X64_MSR_TIME_REF_COUNT.
-+ * Corresponds to access_partition_reference_counter privilege.
-+ */
-+ uint64_t access_partition_reference_counter:1;
-+
-+ /*
-+ * Access to SINT-related registers (HV_X64_MSR_SCONTROL through
-+ * HV_X64_MSR_EOM and HV_X64_MSR_SINT0 through HV_X64_MSR_SINT15).
-+ * Corresponds to access_synic_regs privilege.
-+ */
-+ uint64_t access_synic_regs:1;
-+
-+ /*
-+ * Access to synthetic timers and associated MSRs
-+ * (HV_X64_MSR_STIMER0_CONFIG through HV_X64_MSR_STIMER3_COUNT).
-+ * Corresponds to access_synthetic_timer_regs privilege.
-+ */
-+ uint64_t access_synthetic_timer_regs:1;
-+
-+ /*
-+ * Access to APIC MSRs (HV_X64_MSR_EOI, HV_X64_MSR_ICR and
-+ * HV_X64_MSR_TPR) as well as the VP assist page.
-+ * Corresponds to access_intr_ctrl_regs privilege.
-+ */
-+ uint64_t access_intr_ctrl_regs:1;
-+
-+ /*
-+ * Access to registers associated with hypercalls
-+ * (HV_X64_MSR_GUEST_OS_ID and HV_X64_MSR_HYPERCALL).
-+ * Corresponds to access_hypercall_msrs privilege.
-+ */
-+ uint64_t access_hypercall_regs:1;
-+
-+ /* VP index can be queried. corresponds to access_vp_index privilege. */
-+ uint64_t access_vp_index:1;
-+
-+ /*
-+ * Access to the reference TSC. Corresponds to
-+ * access_partition_reference_tsc privilege.
-+ */
-+ uint64_t access_partition_reference_tsc:1;
-+
-+ /*
-+ * Partition has access to the guest idle reg. Corresponds to
-+ * access_guest_idle_reg privilege.
-+ */
-+ uint64_t access_guest_idle_reg:1;
-+
-+ /*
-+ * Partition has access to frequency regs. corresponds to
-+ * access_frequency_regs privilege.
-+ */
-+ uint64_t access_frequency_regs:1;
-+
-+ uint64_t reserved_z12:1; /* Reserved for access_reenlightenment_controls */
-+ uint64_t reserved_z13:1; /* Reserved for access_root_scheduler_reg */
-+ uint64_t reserved_z14:1; /* Reserved for access_tsc_invariant_controls */
-+
-+ /*
-+ * Extended GVA ranges for HvCallFlushVirtualAddressList hypercall.
-+ * Corresponds to privilege.
-+ */
-+ uint64_t enable_extended_gva_ranges_for_flush_virtual_address_list:1;
-+
-+ uint64_t reserved_z16:1; /* Reserved for access_vsm. */
-+ uint64_t reserved_z17:1; /* Reserved for access_vp_registers. */
-+
-+ /* Use fast hypercall output. Corresponds to privilege. */
-+ uint64_t fast_hypercall_output:1;
-+
-+ uint64_t reserved_z19:1; /* Reserved for enable_extended_hypercalls. */
-+
-+ /*
-+ * HvStartVirtualProcessor can be used to start virtual processors.
-+ * Corresponds to privilege.
-+ */
-+ uint64_t start_virtual_processor:1;
-+
-+ uint64_t reserved_z21:1; /* Reserved for Isolation. */
-+
-+ /* Synthetic timers in direct mode. */
-+ uint64_t direct_synthetic_timers:1;
-+
-+ uint64_t reserved_z23:1; /* Reserved for synthetic time unhalted timer */
-+
-+ /* Use extended processor masks. */
-+ uint64_t extended_processor_masks:1;
-+
-+ /*
-+ * HvCallFlushVirtualAddressSpace / HvCallFlushVirtualAddressList are
-+ * supported.
-+ */
-+ uint64_t tb_flush_hypercalls:1;
-+
-+ /* HvCallSendSyntheticClusterIpi is supported. */
-+ uint64_t synthetic_cluster_ipi:1;
-+
-+ /* HvCallNotifyLongSpinWait is supported. */
-+ uint64_t notify_long_spin_wait:1;
-+
-+ /* HvCallQueryNumaDistance is supported. */
-+ uint64_t query_numa_distance:1;
-+
-+ /* HvCallSignalEvent is supported. Corresponds to privilege. */
-+ uint64_t signal_events:1;
-+
-+ /* HvCallRetargetDeviceInterrupt is supported. */
-+ uint64_t retarget_device_interrupt:1;
-+
-+ /* HvCallRestorePartitionTime is supported. */
-+ uint64_t restore_time:1;
-+
-+ /* EnlightenedVmcs nested enlightenment is supported. */
-+ uint64_t enlightened_vmcs:1;
-+
-+ uint64_t reserved:30;
-+ };
-+};
-+
-+enum hv_translate_gva_result_code {
-+ HV_TRANSLATE_GVA_SUCCESS = 0,
-+
-+ /* Translation failures. */
-+ HV_TRANSLATE_GVA_PAGE_NOT_PRESENT = 1,
-+ HV_TRANSLATE_GVA_PRIVILEGE_VIOLATION = 2,
-+ HV_TRANSLATE_GVA_INVALIDE_PAGE_TABLE_FLAGS = 3,
-+
-+ /* GPA access failures. */
-+ HV_TRANSLATE_GVA_GPA_UNMAPPED = 4,
-+ HV_TRANSLATE_GVA_GPA_NO_READ_ACCESS = 5,
-+ HV_TRANSLATE_GVA_GPA_NO_WRITE_ACCESS = 6,
-+ HV_TRANSLATE_GVA_GPA_ILLEGAL_OVERLAY_ACCESS = 7,
-+
-+ /*
-+ * Intercept for memory access by either
-+ * - a higher VTL
-+ * - a nested hypervisor (due to a violation of the nested page table)
-+ */
-+ HV_TRANSLATE_GVA_INTERCEPT = 8,
-+
-+ HV_TRANSLATE_GVA_GPA_UNACCEPTED = 9,
-+};
-+
-+union hv_translate_gva_result {
-+ uint64_t as_uint64;
-+ struct {
-+ uint32_t result_code; /* enum hv_translate_hva_result_code */
-+ uint32_t cache_type:8;
-+ uint32_t overlay_page:1;
-+ uint32_t reserved:23;
-+ };
-+};
-+
-+typedef struct hv_input_translate_virtual_address {
-+ uint64_t partition_id;
-+ uint32_t vp_index;
-+ uint32_t padding;
-+ uint64_t control_flags;
-+ uint64_t gva_page;
-+} hv_input_translate_virtual_address;
-+
-+typedef struct hv_output_translate_virtual_address {
-+ union hv_translate_gva_result translation_result;
-+ uint64_t gpa_page;
-+} hv_output_translate_virtual_address;
-+
-+typedef struct hv_register_x64_cpuid_result_parameters {
-+ struct {
-+ uint32_t eax;
-+ uint32_t ecx;
-+ uint8_t subleaf_specific;
-+ uint8_t always_override;
-+ uint16_t padding;
-+ } input;
-+ struct {
-+ uint32_t eax;
-+ uint32_t eax_mask;
-+ uint32_t ebx;
-+ uint32_t ebx_mask;
-+ uint32_t ecx;
-+ uint32_t ecx_mask;
-+ uint32_t edx;
-+ uint32_t edx_mask;
-+ } result;
-+} hv_register_x64_cpuid_result_parameters;
-+
-+typedef struct hv_register_x64_msr_result_parameters {
-+ uint32_t msr_index;
-+ uint32_t access_type;
-+ uint32_t action; /* enum hv_unimplemented_msr_action */
-+} hv_register_x64_msr_result_parameters;
-+
-+union hv_register_intercept_result_parameters {
-+ struct hv_register_x64_cpuid_result_parameters cpuid;
-+ struct hv_register_x64_msr_result_parameters msr;
-+};
-+
-+typedef struct hv_input_register_intercept_result {
-+ uint64_t partition_id;
-+ uint32_t vp_index;
-+ uint32_t intercept_type; /* enum hv_intercept_type */
-+ union hv_register_intercept_result_parameters parameters;
-+} hv_input_register_intercept_result;
-+
-+#endif /* HW_HYPERV_HVHDK_H */
-diff --git a/include/hw/hyperv/hvhdk_mini.h b/include/hw/hyperv/hvhdk_mini.h
-new file mode 100644
-index 0000000000..9c2f3cf5ae
---- /dev/null
-+++ b/include/hw/hyperv/hvhdk_mini.h
-@@ -0,0 +1,102 @@
-+/*
-+ * Type definitions for the mshv host interface.
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#ifndef HW_HYPERV_HVHDK_MINI_H
-+#define HW_HYPERV_HVHDK_MINI_H
-+
-+#define HVHVK_MINI_VERSION (25294)
-+
-+/* Each generic set contains 64 elements */
-+#define HV_GENERIC_SET_SHIFT (6)
-+#define HV_GENERIC_SET_MASK (63)
-+
-+enum hv_generic_set_format {
-+ HV_GENERIC_SET_SPARSE_4K,
-+ HV_GENERIC_SET_ALL,
-+};
-+
-+enum hv_partition_property_code {
-+ /* Privilege properties */
-+ HV_PARTITION_PROPERTY_PRIVILEGE_FLAGS = 0x00010000,
-+ HV_PARTITION_PROPERTY_SYNTHETIC_PROC_FEATURES = 0x00010001,
-+
-+ /* Scheduling properties */
-+ HV_PARTITION_PROPERTY_SUSPEND = 0x00020000,
-+ HV_PARTITION_PROPERTY_CPU_RESERVE = 0x00020001,
-+ HV_PARTITION_PROPERTY_CPU_CAP = 0x00020002,
-+ HV_PARTITION_PROPERTY_CPU_WEIGHT = 0x00020003,
-+ HV_PARTITION_PROPERTY_CPU_GROUP_ID = 0x00020004,
-+
-+ /* Time properties */
-+ HV_PARTITION_PROPERTY_TIME_FREEZE = 0x00030003,
-+ HV_PARTITION_PROPERTY_REFERENCE_TIME = 0x00030005,
-+
-+ /* Debugging properties */
-+ HV_PARTITION_PROPERTY_DEBUG_CHANNEL_ID = 0x00040000,
-+
-+ /* Resource properties */
-+ HV_PARTITION_PROPERTY_VIRTUAL_TLB_PAGE_COUNT = 0x00050000,
-+ HV_PARTITION_PROPERTY_VSM_CONFIG = 0x00050001,
-+ HV_PARTITION_PROPERTY_ZERO_MEMORY_ON_RESET = 0x00050002,
-+ HV_PARTITION_PROPERTY_PROCESSORS_PER_SOCKET = 0x00050003,
-+ HV_PARTITION_PROPERTY_NESTED_TLB_SIZE = 0x00050004,
-+ HV_PARTITION_PROPERTY_GPA_PAGE_ACCESS_TRACKING = 0x00050005,
-+ HV_PARTITION_PROPERTY_VSM_PERMISSIONS_DIRTY_SINCE_LAST_QUERY = 0x00050006,
-+ HV_PARTITION_PROPERTY_SGX_LAUNCH_CONTROL_CONFIG = 0x00050007,
-+ HV_PARTITION_PROPERTY_DEFAULT_SGX_LAUNCH_CONTROL0 = 0x00050008,
-+ HV_PARTITION_PROPERTY_DEFAULT_SGX_LAUNCH_CONTROL1 = 0x00050009,
-+ HV_PARTITION_PROPERTY_DEFAULT_SGX_LAUNCH_CONTROL2 = 0x0005000a,
-+ HV_PARTITION_PROPERTY_DEFAULT_SGX_LAUNCH_CONTROL3 = 0x0005000b,
-+ HV_PARTITION_PROPERTY_ISOLATION_STATE = 0x0005000c,
-+ HV_PARTITION_PROPERTY_ISOLATION_CONTROL = 0x0005000d,
-+ HV_PARTITION_PROPERTY_ALLOCATION_ID = 0x0005000e,
-+ HV_PARTITION_PROPERTY_MONITORING_ID = 0x0005000f,
-+ HV_PARTITION_PROPERTY_IMPLEMENTED_PHYSICAL_ADDRESS_BITS = 0x00050010,
-+ HV_PARTITION_PROPERTY_NON_ARCHITECTURAL_CORE_SHARING = 0x00050011,
-+ HV_PARTITION_PROPERTY_HYPERCALL_DOORBELL_PAGE = 0x00050012,
-+ HV_PARTITION_PROPERTY_ISOLATION_POLICY = 0x00050014,
-+ HV_PARTITION_PROPERTY_UNIMPLEMENTED_MSR_ACTION = 0x00050017,
-+ HV_PARTITION_PROPERTY_SEV_VMGEXIT_OFFLOADS = 0x00050022,
-+
-+ /* Compatibility properties */
-+ HV_PARTITION_PROPERTY_PROCESSOR_VENDOR = 0x00060000,
-+ HV_PARTITION_PROPERTY_PROCESSOR_FEATURES_DEPRECATED = 0x00060001,
-+ HV_PARTITION_PROPERTY_PROCESSOR_XSAVE_FEATURES = 0x00060002,
-+ HV_PARTITION_PROPERTY_PROCESSOR_CL_FLUSH_SIZE = 0x00060003,
-+ HV_PARTITION_PROPERTY_ENLIGHTENMENT_MODIFICATIONS = 0x00060004,
-+ HV_PARTITION_PROPERTY_COMPATIBILITY_VERSION = 0x00060005,
-+ HV_PARTITION_PROPERTY_PHYSICAL_ADDRESS_WIDTH = 0x00060006,
-+ HV_PARTITION_PROPERTY_XSAVE_STATES = 0x00060007,
-+ HV_PARTITION_PROPERTY_MAX_XSAVE_DATA_SIZE = 0x00060008,
-+ HV_PARTITION_PROPERTY_PROCESSOR_CLOCK_FREQUENCY = 0x00060009,
-+ HV_PARTITION_PROPERTY_PROCESSOR_FEATURES0 = 0x0006000a,
-+ HV_PARTITION_PROPERTY_PROCESSOR_FEATURES1 = 0x0006000b,
-+
-+ /* Guest software properties */
-+ HV_PARTITION_PROPERTY_GUEST_OS_ID = 0x00070000,
-+
-+ /* Nested virtualization properties */
-+ HV_PARTITION_PROPERTY_PROCESSOR_VIRTUALIZATION_FEATURES = 0x00080000,
-+};
-+
-+/* HV Map GPA (Guest Physical Address) Flags */
-+#define HV_MAP_GPA_PERMISSIONS_NONE 0x0
-+#define HV_MAP_GPA_READABLE 0x1
-+#define HV_MAP_GPA_WRITABLE 0x2
-+#define HV_MAP_GPA_KERNEL_EXECUTABLE 0x4
-+#define HV_MAP_GPA_USER_EXECUTABLE 0x8
-+#define HV_MAP_GPA_EXECUTABLE 0xC
-+#define HV_MAP_GPA_PERMISSIONS_MASK 0xF
-+#define HV_MAP_GPA_ADJUSTABLE 0x8000
-+#define HV_MAP_GPA_NO_ACCESS 0x10000
-+#define HV_MAP_GPA_NOT_CACHED 0x200000
-+#define HV_MAP_GPA_LARGE_PAGE 0x80000000
-+
-+#define HV_PFN_RNG_PAGEBITS 24 /* HV_SPA_PAGE_RANGE_ADDITIONAL_PAGES_BITS */
-+
-+#endif /* HW_HYPERV_HVHDK_MINI_H */
-diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
-index 717c379f9e..828a7809f7 100755
---- a/scripts/update-linux-headers.sh
-+++ b/scripts/update-linux-headers.sh
-@@ -195,7 +195,7 @@ rm -rf "$output/linux-headers/linux"
- mkdir -p "$output/linux-headers/linux"
- for header in const.h stddef.h kvm.h vfio.h vfio_ccw.h vfio_zdev.h vhost.h \
- psci.h psp-sev.h userfaultfd.h memfd.h mman.h nvme_ioctl.h \
-- vduse.h iommufd.h bits.h; do
-+ vduse.h iommufd.h bits.h mshv.h; do
- cp "$hdrdir/include/linux/$header" "$output/linux-headers/linux"
- done
-
---
-2.47.3
-
diff --git a/kvm-include-hw-hyperv-Remove-unused-struct-mshv_vp_regis.patch b/kvm-include-hw-hyperv-Remove-unused-struct-mshv_vp_regis.patch
deleted file mode 100644
index 8697483..0000000
--- a/kvm-include-hw-hyperv-Remove-unused-struct-mshv_vp_regis.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 065c3fd90a5ee90d1ccd02e71c5eb2b2ac714912 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
-Date: Thu, 8 Jan 2026 19:50:12 +0100
-Subject: [PATCH 112/116] include/hw/hyperv: Remove unused 'struct
- mshv_vp_registers' definition
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [96/100] eb6aa396d9565bc13a0ace5a2b20a845a2444a91 (rovick1/qemu-kvm)
-
-The 'struct mshv_vp_registers' definition in hvgdk_mini.h is unused in
-QEMU and conflicts with the canonical definition in
-linux-headers/linux/mshv.h.
-
-Remove the duplicate definition to avoid build conflicts when the Linux
-headers are updated.
-
-Cc: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Reviewed-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/qemu-devel/20260108185012.2568277-1-clg@redhat.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit ec7109999af691d84e8d2b518d7a4f30d8fa6d62)
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
----
- include/hw/hyperv/hvgdk_mini.h | 7 -------
- 1 file changed, 7 deletions(-)
-
-diff --git a/include/hw/hyperv/hvgdk_mini.h b/include/hw/hyperv/hvgdk_mini.h
-index d89315f545..cb52cc9de2 100644
---- a/include/hw/hyperv/hvgdk_mini.h
-+++ b/include/hw/hyperv/hvgdk_mini.h
-@@ -450,13 +450,6 @@ typedef struct hv_input_set_vp_registers {
- struct hv_register_assoc elements[];
- } hv_input_set_vp_registers;
-
--#define MSHV_VP_MAX_REGISTERS 128
--
--struct mshv_vp_registers {
-- int count; /* at most MSHV_VP_MAX_REGISTERS */
-- struct hv_register_assoc *regs;
--};
--
- union hv_interrupt_control {
- uint64_t as_uint64;
- struct {
---
-2.52.0
-
diff --git a/kvm-include-hw-vfio-vfio-container-base.h-rename-VFIOCon.patch b/kvm-include-hw-vfio-vfio-container-base.h-rename-VFIOCon.patch
deleted file mode 100644
index 33cd5ff..0000000
--- a/kvm-include-hw-vfio-vfio-container-base.h-rename-VFIOCon.patch
+++ /dev/null
@@ -1,1268 +0,0 @@
-From 715642e841794c46267e4744844ba44eadb8f1fc Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:10 +0100
-Subject: [PATCH 052/116] include/hw/vfio/vfio-container-base.h: rename
- VFIOContainerBase to VFIOContainer
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [36/100] 9ba07faa3dbb2895de68213696b504c346967f70 (rovick1/qemu-kvm)
-
-Now that the VFIOContainer struct name is available, rename VFIOContainerBase
-to VFIOContainer to better indicate that it is the superclass of other
-VFIOFooContainer structs.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-3-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit e2e269d580947fe9b1b5735c8cb659277ac67996)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/ppc/spapr_pci_vfio.c | 2 +-
- hw/vfio-user/container.c | 18 +++----
- hw/vfio-user/container.h | 2 +-
- hw/vfio/container-base.c | 41 ++++++++-------
- hw/vfio/container.c | 22 ++++----
- hw/vfio/cpr-iommufd.c | 4 +-
- hw/vfio/cpr-legacy.c | 14 ++---
- hw/vfio/device.c | 2 +-
- hw/vfio/iommufd.c | 18 +++----
- hw/vfio/listener.c | 74 +++++++++++++-------------
- hw/vfio/spapr.c | 12 ++---
- hw/vfio/vfio-iommufd.h | 2 +-
- hw/vfio/vfio-listener.h | 4 +-
- include/hw/vfio/vfio-container-base.h | 76 +++++++++++++--------------
- include/hw/vfio/vfio-container.h | 2 +-
- include/hw/vfio/vfio-cpr.h | 8 +--
- include/hw/vfio/vfio-device.h | 4 +-
- 17 files changed, 154 insertions(+), 151 deletions(-)
-
-diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c
-index b658eb372c..48fa98c199 100644
---- a/hw/ppc/spapr_pci_vfio.c
-+++ b/hw/ppc/spapr_pci_vfio.c
-@@ -86,7 +86,7 @@ static int vfio_eeh_container_op(VFIOLegacyContainer *container, uint32_t op)
- static VFIOLegacyContainer *vfio_eeh_as_container(AddressSpace *as)
- {
- VFIOAddressSpace *space = vfio_address_space_get(as);
-- VFIOContainerBase *bcontainer = NULL;
-+ VFIOContainer *bcontainer = NULL;
-
- if (QLIST_EMPTY(&space->containers)) {
- /* No containers to act on */
-diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c
-index 3cdbd44c1a..411eb7b28b 100644
---- a/hw/vfio-user/container.c
-+++ b/hw/vfio-user/container.c
-@@ -22,14 +22,14 @@
- * will fire during memory update transactions. These depend on BQL being held,
- * so do any resulting map/demap ops async while keeping BQL.
- */
--static void vfio_user_listener_begin(VFIOContainerBase *bcontainer)
-+static void vfio_user_listener_begin(VFIOContainer *bcontainer)
- {
- VFIOUserContainer *container = VFIO_IOMMU_USER(bcontainer);
-
- container->proxy->async_ops = true;
- }
-
--static void vfio_user_listener_commit(VFIOContainerBase *bcontainer)
-+static void vfio_user_listener_commit(VFIOContainer *bcontainer)
- {
- VFIOUserContainer *container = VFIO_IOMMU_USER(bcontainer);
-
-@@ -38,7 +38,7 @@ static void vfio_user_listener_commit(VFIOContainerBase *bcontainer)
- vfio_user_wait_reqs(container->proxy);
- }
-
--static int vfio_user_dma_unmap(const VFIOContainerBase *bcontainer,
-+static int vfio_user_dma_unmap(const VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all)
- {
-@@ -80,7 +80,7 @@ static int vfio_user_dma_unmap(const VFIOContainerBase *bcontainer,
- return ret;
- }
-
--static int vfio_user_dma_map(const VFIOContainerBase *bcontainer, hwaddr iova,
-+static int vfio_user_dma_map(const VFIOContainer *bcontainer, hwaddr iova,
- ram_addr_t size, void *vaddr, bool readonly,
- MemoryRegion *mrp)
- {
-@@ -154,14 +154,14 @@ static int vfio_user_dma_map(const VFIOContainerBase *bcontainer, hwaddr iova,
- }
-
- static int
--vfio_user_set_dirty_page_tracking(const VFIOContainerBase *bcontainer,
-+vfio_user_set_dirty_page_tracking(const VFIOContainer *bcontainer,
- bool start, Error **errp)
- {
- error_setg_errno(errp, ENOTSUP, "Not supported");
- return -ENOTSUP;
- }
-
--static int vfio_user_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
-+static int vfio_user_query_dirty_bitmap(const VFIOContainer *bcontainer,
- VFIOBitmap *vbmap, hwaddr iova,
- hwaddr size, Error **errp)
- {
-@@ -169,7 +169,7 @@ static int vfio_user_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
- return -ENOTSUP;
- }
-
--static bool vfio_user_setup(VFIOContainerBase *bcontainer, Error **errp)
-+static bool vfio_user_setup(VFIOContainer *bcontainer, Error **errp)
- {
- VFIOUserContainer *container = VFIO_IOMMU_USER(bcontainer);
-
-@@ -202,7 +202,7 @@ static VFIOUserContainer *
- vfio_user_container_connect(AddressSpace *as, VFIODevice *vbasedev,
- Error **errp)
- {
-- VFIOContainerBase *bcontainer;
-+ VFIOContainer *bcontainer;
- VFIOUserContainer *container;
- VFIOAddressSpace *space;
- VFIOIOMMUClass *vioc;
-@@ -260,7 +260,7 @@ put_space_exit:
-
- static void vfio_user_container_disconnect(VFIOUserContainer *container)
- {
-- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
- VFIOAddressSpace *space = bcontainer->space;
-
-diff --git a/hw/vfio-user/container.h b/hw/vfio-user/container.h
-index 96aa6785d9..241863ef97 100644
---- a/hw/vfio-user/container.h
-+++ b/hw/vfio-user/container.h
-@@ -14,7 +14,7 @@
-
- /* MMU container sub-class for vfio-user. */
- struct VFIOUserContainer {
-- VFIOContainerBase parent_obj;
-+ VFIOContainer parent_obj;
-
- VFIOUserProxy *proxy;
- };
-diff --git a/hw/vfio/container-base.c b/hw/vfio/container-base.c
-index 56304978e1..98c5198e50 100644
---- a/hw/vfio/container-base.c
-+++ b/hw/vfio/container-base.c
-@@ -67,13 +67,13 @@ void vfio_address_space_put(VFIOAddressSpace *space)
- }
-
- void vfio_address_space_insert(VFIOAddressSpace *space,
-- VFIOContainerBase *bcontainer)
-+ VFIOContainer *bcontainer)
- {
- QLIST_INSERT_HEAD(&space->containers, bcontainer, next);
- bcontainer->space = space;
- }
-
--int vfio_container_dma_map(VFIOContainerBase *bcontainer,
-+int vfio_container_dma_map(VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- void *vaddr, bool readonly, MemoryRegion *mr)
- {
-@@ -92,7 +92,7 @@ int vfio_container_dma_map(VFIOContainerBase *bcontainer,
- return vioc->dma_map(bcontainer, iova, size, vaddr, readonly, mr);
- }
-
--int vfio_container_dma_unmap(VFIOContainerBase *bcontainer,
-+int vfio_container_dma_unmap(VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all)
- {
-@@ -102,7 +102,7 @@ int vfio_container_dma_unmap(VFIOContainerBase *bcontainer,
- return vioc->dma_unmap(bcontainer, iova, size, iotlb, unmap_all);
- }
-
--bool vfio_container_add_section_window(VFIOContainerBase *bcontainer,
-+bool vfio_container_add_section_window(VFIOContainer *bcontainer,
- MemoryRegionSection *section,
- Error **errp)
- {
-@@ -115,7 +115,7 @@ bool vfio_container_add_section_window(VFIOContainerBase *bcontainer,
- return vioc->add_window(bcontainer, section, errp);
- }
-
--void vfio_container_del_section_window(VFIOContainerBase *bcontainer,
-+void vfio_container_del_section_window(VFIOContainer *bcontainer,
- MemoryRegionSection *section)
- {
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
-@@ -127,7 +127,7 @@ void vfio_container_del_section_window(VFIOContainerBase *bcontainer,
- return vioc->del_window(bcontainer, section);
- }
-
--int vfio_container_set_dirty_page_tracking(VFIOContainerBase *bcontainer,
-+int vfio_container_set_dirty_page_tracking(VFIOContainer *bcontainer,
- bool start, Error **errp)
- {
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
-@@ -151,7 +151,7 @@ int vfio_container_set_dirty_page_tracking(VFIOContainerBase *bcontainer,
- }
-
- static bool vfio_container_devices_dirty_tracking_is_started(
-- const VFIOContainerBase *bcontainer)
-+ const VFIOContainer *bcontainer)
- {
- VFIODevice *vbasedev;
-
-@@ -165,14 +165,14 @@ static bool vfio_container_devices_dirty_tracking_is_started(
- }
-
- bool vfio_container_dirty_tracking_is_started(
-- const VFIOContainerBase *bcontainer)
-+ const VFIOContainer *bcontainer)
- {
- return vfio_container_devices_dirty_tracking_is_started(bcontainer) ||
- bcontainer->dirty_pages_started;
- }
-
- bool vfio_container_devices_dirty_tracking_is_supported(
-- const VFIOContainerBase *bcontainer)
-+ const VFIOContainer *bcontainer)
- {
- VFIODevice *vbasedev;
-
-@@ -210,8 +210,9 @@ static int vfio_device_dma_logging_report(VFIODevice *vbasedev, hwaddr iova,
- return vbasedev->io_ops->device_feature(vbasedev, feature);
- }
-
--static int vfio_container_iommu_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
-- VFIOBitmap *vbmap, hwaddr iova, hwaddr size, Error **errp)
-+static int vfio_container_iommu_query_dirty_bitmap(
-+ const VFIOContainer *bcontainer, VFIOBitmap *vbmap, hwaddr iova,
-+ hwaddr size, Error **errp)
- {
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
-
-@@ -220,8 +221,9 @@ static int vfio_container_iommu_query_dirty_bitmap(const VFIOContainerBase *bcon
- errp);
- }
-
--static int vfio_container_devices_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
-- VFIOBitmap *vbmap, hwaddr iova, hwaddr size, Error **errp)
-+static int vfio_container_devices_query_dirty_bitmap(
-+ const VFIOContainer *bcontainer, VFIOBitmap *vbmap, hwaddr iova,
-+ hwaddr size, Error **errp)
- {
- VFIODevice *vbasedev;
- int ret;
-@@ -242,8 +244,9 @@ static int vfio_container_devices_query_dirty_bitmap(const VFIOContainerBase *bc
- return 0;
- }
-
--int vfio_container_query_dirty_bitmap(const VFIOContainerBase *bcontainer, uint64_t iova,
-- uint64_t size, ram_addr_t ram_addr, Error **errp)
-+int vfio_container_query_dirty_bitmap(const VFIOContainer *bcontainer,
-+ uint64_t iova, uint64_t size,
-+ ram_addr_t ram_addr, Error **errp)
- {
- bool all_device_dirty_tracking =
- vfio_container_devices_dirty_tracking_is_supported(bcontainer);
-@@ -297,7 +300,7 @@ static gpointer copy_iova_range(gconstpointer src, gpointer data)
- return dest;
- }
-
--GList *vfio_container_get_iova_ranges(const VFIOContainerBase *bcontainer)
-+GList *vfio_container_get_iova_ranges(const VFIOContainer *bcontainer)
- {
- assert(bcontainer);
- return g_list_copy_deep(bcontainer->iova_ranges, copy_iova_range, NULL);
-@@ -305,7 +308,7 @@ GList *vfio_container_get_iova_ranges(const VFIOContainerBase *bcontainer)
-
- static void vfio_container_instance_finalize(Object *obj)
- {
-- VFIOContainerBase *bcontainer = VFIO_IOMMU(obj);
-+ VFIOContainer *bcontainer = VFIO_IOMMU(obj);
- VFIOGuestIOMMU *giommu, *tmp;
-
- QLIST_SAFE_REMOVE(bcontainer, next);
-@@ -322,7 +325,7 @@ static void vfio_container_instance_finalize(Object *obj)
-
- static void vfio_container_instance_init(Object *obj)
- {
-- VFIOContainerBase *bcontainer = VFIO_IOMMU(obj);
-+ VFIOContainer *bcontainer = VFIO_IOMMU(obj);
-
- bcontainer->error = NULL;
- bcontainer->dirty_pages_supported = false;
-@@ -338,7 +341,7 @@ static const TypeInfo types[] = {
- .parent = TYPE_OBJECT,
- .instance_init = vfio_container_instance_init,
- .instance_finalize = vfio_container_instance_finalize,
-- .instance_size = sizeof(VFIOContainerBase),
-+ .instance_size = sizeof(VFIOContainer),
- .class_size = sizeof(VFIOIOMMUClass),
- .abstract = true,
- },
-diff --git a/hw/vfio/container.c b/hw/vfio/container.c
-index 76a09be941..84f5a5fdee 100644
---- a/hw/vfio/container.c
-+++ b/hw/vfio/container.c
-@@ -86,7 +86,7 @@ static int vfio_dma_unmap_bitmap(const VFIOLegacyContainer *container,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb)
- {
-- const VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-+ const VFIOContainer *bcontainer = VFIO_IOMMU(container);
- struct vfio_iommu_type1_dma_unmap *unmap;
- struct vfio_bitmap *bitmap;
- VFIOBitmap vbmap;
-@@ -135,7 +135,7 @@ unmap_exit:
- return ret;
- }
-
--static int vfio_legacy_dma_unmap_one(const VFIOContainerBase *bcontainer,
-+static int vfio_legacy_dma_unmap_one(const VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb)
- {
-@@ -198,7 +198,7 @@ static int vfio_legacy_dma_unmap_one(const VFIOContainerBase *bcontainer,
- /*
- * DMA - Mapping and unmapping for the "type1" IOMMU interface used on x86
- */
--static int vfio_legacy_dma_unmap(const VFIOContainerBase *bcontainer,
-+static int vfio_legacy_dma_unmap(const VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all)
- {
-@@ -223,7 +223,7 @@ static int vfio_legacy_dma_unmap(const VFIOContainerBase *bcontainer,
- return ret;
- }
-
--static int vfio_legacy_dma_map(const VFIOContainerBase *bcontainer, hwaddr iova,
-+static int vfio_legacy_dma_map(const VFIOContainer *bcontainer, hwaddr iova,
- ram_addr_t size, void *vaddr, bool readonly,
- MemoryRegion *mr)
- {
-@@ -256,7 +256,7 @@ static int vfio_legacy_dma_map(const VFIOContainerBase *bcontainer, hwaddr iova,
- }
-
- static int
--vfio_legacy_set_dirty_page_tracking(const VFIOContainerBase *bcontainer,
-+vfio_legacy_set_dirty_page_tracking(const VFIOContainer *bcontainer,
- bool start, Error **errp)
- {
- const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-@@ -281,7 +281,7 @@ vfio_legacy_set_dirty_page_tracking(const VFIOContainerBase *bcontainer,
- return ret;
- }
-
--static int vfio_legacy_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
-+static int vfio_legacy_query_dirty_bitmap(const VFIOContainer *bcontainer,
- VFIOBitmap *vbmap, hwaddr iova, hwaddr size, Error **errp)
- {
- const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-@@ -321,7 +321,7 @@ static int vfio_legacy_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
- }
-
- static bool vfio_get_info_iova_range(struct vfio_iommu_type1_info *info,
-- VFIOContainerBase *bcontainer)
-+ VFIOContainer *bcontainer)
- {
- struct vfio_info_cap_header *hdr;
- struct vfio_iommu_type1_info_cap_iova_range *cap;
-@@ -506,7 +506,7 @@ static void vfio_get_iommu_info_migration(VFIOLegacyContainer *container,
- {
- struct vfio_info_cap_header *hdr;
- struct vfio_iommu_type1_info_cap_migration *cap_mig;
-- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
-
- hdr = vfio_get_iommu_info_cap(info, VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION);
- if (!hdr) {
-@@ -527,7 +527,7 @@ static void vfio_get_iommu_info_migration(VFIOLegacyContainer *container,
- }
- }
-
--static bool vfio_legacy_setup(VFIOContainerBase *bcontainer, Error **errp)
-+static bool vfio_legacy_setup(VFIOContainer *bcontainer, Error **errp)
- {
- VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- g_autofree struct vfio_iommu_type1_info *info = NULL;
-@@ -633,7 +633,7 @@ static bool vfio_container_connect(VFIOGroup *group, AddressSpace *as,
- Error **errp)
- {
- VFIOLegacyContainer *container;
-- VFIOContainerBase *bcontainer;
-+ VFIOContainer *bcontainer;
- int ret, fd = -1;
- VFIOAddressSpace *space;
- VFIOIOMMUClass *vioc = NULL;
-@@ -746,7 +746,7 @@ fail:
- static void vfio_container_disconnect(VFIOGroup *group)
- {
- VFIOLegacyContainer *container = group->container;
-- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
-
- QLIST_REMOVE(group, container_next);
-diff --git a/hw/vfio/cpr-iommufd.c b/hw/vfio/cpr-iommufd.c
-index 148a06d552..6aaf6f77a2 100644
---- a/hw/vfio/cpr-iommufd.c
-+++ b/hw/vfio/cpr-iommufd.c
-@@ -176,7 +176,7 @@ void vfio_iommufd_cpr_unregister_iommufd(IOMMUFDBackend *be)
- bool vfio_iommufd_cpr_register_container(VFIOIOMMUFDContainer *container,
- Error **errp)
- {
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainer *bcontainer = &container->bcontainer;
-
- migration_add_notifier_mode(&bcontainer->cpr_reboot_notifier,
- vfio_cpr_reboot_notifier,
-@@ -189,7 +189,7 @@ bool vfio_iommufd_cpr_register_container(VFIOIOMMUFDContainer *container,
-
- void vfio_iommufd_cpr_unregister_container(VFIOIOMMUFDContainer *container)
- {
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainer *bcontainer = &container->bcontainer;
-
- migration_remove_notifier(&bcontainer->cpr_reboot_notifier);
- }
-diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
-index 12bf920a7d..bd3f6fc3d3 100644
---- a/hw/vfio/cpr-legacy.c
-+++ b/hw/vfio/cpr-legacy.c
-@@ -38,7 +38,7 @@ static bool vfio_dma_unmap_vaddr_all(VFIOLegacyContainer *container,
- * Set the new @vaddr for any mappings registered during cpr load.
- * The incoming state is cleared thereafter.
- */
--static int vfio_legacy_cpr_dma_map(const VFIOContainerBase *bcontainer,
-+static int vfio_legacy_cpr_dma_map(const VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size, void *vaddr,
- bool readonly, MemoryRegion *mr)
- {
-@@ -100,7 +100,7 @@ static int vfio_container_pre_save(void *opaque)
- static int vfio_container_post_load(void *opaque, int version_id)
- {
- VFIOLegacyContainer *container = opaque;
-- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
- dma_map_fn saved_dma_map = vioc->dma_map;
- Error *local_err = NULL;
-@@ -137,7 +137,7 @@ static int vfio_cpr_fail_notifier(NotifierWithReturn *notifier,
- {
- VFIOLegacyContainer *container =
- container_of(notifier, VFIOLegacyContainer, cpr.transfer_notifier);
-- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
-
- if (e->type != MIG_EVENT_PRECOPY_FAILED) {
- return 0;
-@@ -170,7 +170,7 @@ static int vfio_cpr_fail_notifier(NotifierWithReturn *notifier,
- bool vfio_legacy_cpr_register_container(VFIOLegacyContainer *container,
- Error **errp)
- {
-- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
- Error **cpr_blocker = &container->cpr.blocker;
-
- migration_add_notifier_mode(&bcontainer->cpr_reboot_notifier,
-@@ -194,7 +194,7 @@ bool vfio_legacy_cpr_register_container(VFIOLegacyContainer *container,
-
- void vfio_legacy_cpr_unregister_container(VFIOLegacyContainer *container)
- {
-- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
-
- migration_remove_notifier(&bcontainer->cpr_reboot_notifier);
- migrate_del_blocker(&container->cpr.blocker);
-@@ -210,7 +210,7 @@ void vfio_legacy_cpr_unregister_container(VFIOLegacyContainer *container)
- * The giommu already exists. Find it and replay it, which calls
- * vfio_legacy_cpr_dma_map further down the stack.
- */
--void vfio_cpr_giommu_remap(VFIOContainerBase *bcontainer,
-+void vfio_cpr_giommu_remap(VFIOContainer *bcontainer,
- MemoryRegionSection *section)
- {
- VFIOGuestIOMMU *giommu = NULL;
-@@ -235,7 +235,7 @@ void vfio_cpr_giommu_remap(VFIOContainerBase *bcontainer,
- * The ram discard listener already exists. Call its populate function
- * directly, which calls vfio_legacy_cpr_dma_map.
- */
--bool vfio_cpr_ram_discard_register_listener(VFIOContainerBase *bcontainer,
-+bool vfio_cpr_ram_discard_register_listener(VFIOContainer *bcontainer,
- MemoryRegionSection *section)
- {
- VFIORamDiscardListener *vrdl =
-diff --git a/hw/vfio/device.c b/hw/vfio/device.c
-index 412678a1f6..931a949c08 100644
---- a/hw/vfio/device.c
-+++ b/hw/vfio/device.c
-@@ -471,7 +471,7 @@ void vfio_device_detach(VFIODevice *vbasedev)
- VFIO_IOMMU_GET_CLASS(vbasedev->bcontainer)->detach_device(vbasedev);
- }
-
--void vfio_device_prepare(VFIODevice *vbasedev, VFIOContainerBase *bcontainer,
-+void vfio_device_prepare(VFIODevice *vbasedev, VFIOContainer *bcontainer,
- struct vfio_device_info *info)
- {
- int i;
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index 65b94aaa00..2ebd87ec8f 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -34,7 +34,7 @@
- #define TYPE_HOST_IOMMU_DEVICE_IOMMUFD_VFIO \
- TYPE_HOST_IOMMU_DEVICE_IOMMUFD "-vfio"
-
--static int iommufd_cdev_map(const VFIOContainerBase *bcontainer, hwaddr iova,
-+static int iommufd_cdev_map(const VFIOContainer *bcontainer, hwaddr iova,
- ram_addr_t size, void *vaddr, bool readonly,
- MemoryRegion *mr)
- {
-@@ -46,7 +46,7 @@ static int iommufd_cdev_map(const VFIOContainerBase *bcontainer, hwaddr iova,
- iova, size, vaddr, readonly);
- }
-
--static int iommufd_cdev_map_file(const VFIOContainerBase *bcontainer,
-+static int iommufd_cdev_map_file(const VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- int fd, unsigned long start, bool readonly)
- {
-@@ -58,7 +58,7 @@ static int iommufd_cdev_map_file(const VFIOContainerBase *bcontainer,
- iova, size, fd, start, readonly);
- }
-
--static int iommufd_cdev_unmap(const VFIOContainerBase *bcontainer,
-+static int iommufd_cdev_unmap(const VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all)
- {
-@@ -159,7 +159,7 @@ static bool iommufd_hwpt_dirty_tracking(VFIOIOASHwpt *hwpt)
- return hwpt && hwpt->hwpt_flags & IOMMU_HWPT_ALLOC_DIRTY_TRACKING;
- }
-
--static int iommufd_set_dirty_page_tracking(const VFIOContainerBase *bcontainer,
-+static int iommufd_set_dirty_page_tracking(const VFIOContainer *bcontainer,
- bool start, Error **errp)
- {
- const VFIOIOMMUFDContainer *container =
-@@ -190,7 +190,7 @@ err:
- return -EINVAL;
- }
-
--static int iommufd_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
-+static int iommufd_query_dirty_bitmap(const VFIOContainer *bcontainer,
- VFIOBitmap *vbmap, hwaddr iova,
- hwaddr size, Error **errp)
- {
-@@ -464,7 +464,7 @@ static void iommufd_cdev_detach_container(VFIODevice *vbasedev,
-
- static void iommufd_cdev_container_destroy(VFIOIOMMUFDContainer *container)
- {
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainer *bcontainer = &container->bcontainer;
-
- if (!QLIST_EMPTY(&bcontainer->device_list)) {
- return;
-@@ -486,7 +486,7 @@ static int iommufd_cdev_ram_block_discard_disable(bool state)
- static bool iommufd_cdev_get_info_iova_range(VFIOIOMMUFDContainer *container,
- uint32_t ioas_id, Error **errp)
- {
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainer *bcontainer = &container->bcontainer;
- g_autofree struct iommu_ioas_iova_ranges *info = NULL;
- struct iommu_iova_range *iova_ranges;
- int sz, fd = container->be->fd;
-@@ -528,7 +528,7 @@ error:
- static bool iommufd_cdev_attach(const char *name, VFIODevice *vbasedev,
- AddressSpace *as, Error **errp)
- {
-- VFIOContainerBase *bcontainer;
-+ VFIOContainer *bcontainer;
- VFIOIOMMUFDContainer *container;
- VFIOAddressSpace *space;
- struct vfio_device_info dev_info = { .argsz = sizeof(dev_info) };
-@@ -688,7 +688,7 @@ err_connect_bind:
-
- static void iommufd_cdev_detach(VFIODevice *vbasedev)
- {
-- VFIOContainerBase *bcontainer = vbasedev->bcontainer;
-+ VFIOContainer *bcontainer = vbasedev->bcontainer;
- VFIOAddressSpace *space = bcontainer->space;
- VFIOIOMMUFDContainer *container = container_of(bcontainer,
- VFIOIOMMUFDContainer,
-diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
-index e093833165..3b6f17f0c3 100644
---- a/hw/vfio/listener.c
-+++ b/hw/vfio/listener.c
-@@ -52,7 +52,7 @@
- */
-
-
--static bool vfio_log_sync_needed(const VFIOContainerBase *bcontainer)
-+static bool vfio_log_sync_needed(const VFIOContainer *bcontainer)
- {
- VFIODevice *vbasedev;
-
-@@ -125,7 +125,7 @@ static MemoryRegion *vfio_translate_iotlb(IOMMUTLBEntry *iotlb, hwaddr *xlat_p,
- static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
- {
- VFIOGuestIOMMU *giommu = container_of(n, VFIOGuestIOMMU, n);
-- VFIOContainerBase *bcontainer = giommu->bcontainer;
-+ VFIOContainer *bcontainer = giommu->bcontainer;
- hwaddr iova = iotlb->iova + giommu->iommu_offset;
- MemoryRegion *mr;
- hwaddr xlat;
-@@ -202,7 +202,7 @@ static void vfio_ram_discard_notify_discard(RamDiscardListener *rdl,
- {
- VFIORamDiscardListener *vrdl = container_of(rdl, VFIORamDiscardListener,
- listener);
-- VFIOContainerBase *bcontainer = vrdl->bcontainer;
-+ VFIOContainer *bcontainer = vrdl->bcontainer;
- const hwaddr size = int128_get64(section->size);
- const hwaddr iova = section->offset_within_address_space;
- int ret;
-@@ -220,7 +220,7 @@ static int vfio_ram_discard_notify_populate(RamDiscardListener *rdl,
- {
- VFIORamDiscardListener *vrdl = container_of(rdl, VFIORamDiscardListener,
- listener);
-- VFIOContainerBase *bcontainer = vrdl->bcontainer;
-+ VFIOContainer *bcontainer = vrdl->bcontainer;
- const hwaddr end = section->offset_within_region +
- int128_get64(section->size);
- hwaddr start, next, iova;
-@@ -250,7 +250,7 @@ static int vfio_ram_discard_notify_populate(RamDiscardListener *rdl,
- return 0;
- }
-
--static bool vfio_ram_discard_register_listener(VFIOContainerBase *bcontainer,
-+static bool vfio_ram_discard_register_listener(VFIOContainer *bcontainer,
- MemoryRegionSection *section,
- Error **errp)
- {
-@@ -328,7 +328,7 @@ static bool vfio_ram_discard_register_listener(VFIOContainerBase *bcontainer,
- return true;
- }
-
--static void vfio_ram_discard_unregister_listener(VFIOContainerBase *bcontainer,
-+static void vfio_ram_discard_unregister_listener(VFIOContainer *bcontainer,
- MemoryRegionSection *section)
- {
- RamDiscardManager *rdm = memory_region_get_ram_discard_manager(section->mr);
-@@ -396,7 +396,7 @@ static bool vfio_listener_valid_section(MemoryRegionSection *section,
- return true;
- }
-
--static bool vfio_get_section_iova_range(VFIOContainerBase *bcontainer,
-+static bool vfio_get_section_iova_range(VFIOContainer *bcontainer,
- MemoryRegionSection *section,
- hwaddr *out_iova, hwaddr *out_end,
- Int128 *out_llend)
-@@ -423,9 +423,9 @@ static bool vfio_get_section_iova_range(VFIOContainerBase *bcontainer,
-
- static void vfio_listener_begin(MemoryListener *listener)
- {
-- VFIOContainerBase *bcontainer = container_of(listener, VFIOContainerBase,
-- listener);
-- void (*listener_begin)(VFIOContainerBase *bcontainer);
-+ VFIOContainer *bcontainer = container_of(listener, VFIOContainer,
-+ listener);
-+ void (*listener_begin)(VFIOContainer *bcontainer);
-
- listener_begin = VFIO_IOMMU_GET_CLASS(bcontainer)->listener_begin;
-
-@@ -436,9 +436,9 @@ static void vfio_listener_begin(MemoryListener *listener)
-
- static void vfio_listener_commit(MemoryListener *listener)
- {
-- VFIOContainerBase *bcontainer = container_of(listener, VFIOContainerBase,
-- listener);
-- void (*listener_commit)(VFIOContainerBase *bcontainer);
-+ VFIOContainer *bcontainer = container_of(listener, VFIOContainer,
-+ listener);
-+ void (*listener_commit)(VFIOContainer *bcontainer);
-
- listener_commit = VFIO_IOMMU_GET_CLASS(bcontainer)->listener_commit;
-
-@@ -460,7 +460,7 @@ static void vfio_device_error_append(VFIODevice *vbasedev, Error **errp)
- }
-
- VFIORamDiscardListener *vfio_find_ram_discard_listener(
-- VFIOContainerBase *bcontainer, MemoryRegionSection *section)
-+ VFIOContainer *bcontainer, MemoryRegionSection *section)
- {
- VFIORamDiscardListener *vrdl = NULL;
-
-@@ -482,12 +482,12 @@ VFIORamDiscardListener *vfio_find_ram_discard_listener(
- static void vfio_listener_region_add(MemoryListener *listener,
- MemoryRegionSection *section)
- {
-- VFIOContainerBase *bcontainer = container_of(listener, VFIOContainerBase,
-- listener);
-+ VFIOContainer *bcontainer = container_of(listener, VFIOContainer,
-+ listener);
- vfio_container_region_add(bcontainer, section, false);
- }
-
--void vfio_container_region_add(VFIOContainerBase *bcontainer,
-+void vfio_container_region_add(VFIOContainer *bcontainer,
- MemoryRegionSection *section,
- bool cpr_remap)
- {
-@@ -656,8 +656,8 @@ fail:
- static void vfio_listener_region_del(MemoryListener *listener,
- MemoryRegionSection *section)
- {
-- VFIOContainerBase *bcontainer = container_of(listener, VFIOContainerBase,
-- listener);
-+ VFIOContainer *bcontainer = container_of(listener, VFIOContainer,
-+ listener);
- hwaddr iova, end;
- Int128 llend, llsize;
- int ret;
-@@ -744,13 +744,13 @@ typedef struct VFIODirtyRanges {
- } VFIODirtyRanges;
-
- typedef struct VFIODirtyRangesListener {
-- VFIOContainerBase *bcontainer;
-+ VFIOContainer *bcontainer;
- VFIODirtyRanges ranges;
- MemoryListener listener;
- } VFIODirtyRangesListener;
-
- static bool vfio_section_is_vfio_pci(MemoryRegionSection *section,
-- VFIOContainerBase *bcontainer)
-+ VFIOContainer *bcontainer)
- {
- VFIOPCIDevice *pcidev;
- VFIODevice *vbasedev;
-@@ -835,7 +835,7 @@ static const MemoryListener vfio_dirty_tracking_listener = {
- .region_add = vfio_dirty_tracking_update,
- };
-
--static void vfio_dirty_tracking_init(VFIOContainerBase *bcontainer,
-+static void vfio_dirty_tracking_init(VFIOContainer *bcontainer,
- VFIODirtyRanges *ranges)
- {
- VFIODirtyRangesListener dirty;
-@@ -860,7 +860,7 @@ static void vfio_dirty_tracking_init(VFIOContainerBase *bcontainer,
- memory_listener_unregister(&dirty.listener);
- }
-
--static void vfio_devices_dma_logging_stop(VFIOContainerBase *bcontainer)
-+static void vfio_devices_dma_logging_stop(VFIOContainer *bcontainer)
- {
- uint64_t buf[DIV_ROUND_UP(sizeof(struct vfio_device_feature),
- sizeof(uint64_t))] = {};
-@@ -889,7 +889,7 @@ static void vfio_devices_dma_logging_stop(VFIOContainerBase *bcontainer)
- }
-
- static struct vfio_device_feature *
--vfio_device_feature_dma_logging_start_create(VFIOContainerBase *bcontainer,
-+vfio_device_feature_dma_logging_start_create(VFIOContainer *bcontainer,
- VFIODirtyRanges *tracking)
- {
- struct vfio_device_feature *feature;
-@@ -962,7 +962,7 @@ static void vfio_device_feature_dma_logging_start_destroy(
- g_free(feature);
- }
-
--static bool vfio_devices_dma_logging_start(VFIOContainerBase *bcontainer,
-+static bool vfio_devices_dma_logging_start(VFIOContainer *bcontainer,
- Error **errp)
- {
- struct vfio_device_feature *feature;
-@@ -1006,8 +1006,8 @@ static bool vfio_listener_log_global_start(MemoryListener *listener,
- Error **errp)
- {
- ERRP_GUARD();
-- VFIOContainerBase *bcontainer = container_of(listener, VFIOContainerBase,
-- listener);
-+ VFIOContainer *bcontainer = container_of(listener, VFIOContainer,
-+ listener);
- bool ret;
-
- if (vfio_container_devices_dirty_tracking_is_supported(bcontainer)) {
-@@ -1024,8 +1024,8 @@ static bool vfio_listener_log_global_start(MemoryListener *listener,
-
- static void vfio_listener_log_global_stop(MemoryListener *listener)
- {
-- VFIOContainerBase *bcontainer = container_of(listener, VFIOContainerBase,
-- listener);
-+ VFIOContainer *bcontainer = container_of(listener, VFIOContainer,
-+ listener);
- Error *local_err = NULL;
- int ret = 0;
-
-@@ -1057,7 +1057,7 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
- vfio_giommu_dirty_notifier *gdn = container_of(n,
- vfio_giommu_dirty_notifier, n);
- VFIOGuestIOMMU *giommu = gdn->giommu;
-- VFIOContainerBase *bcontainer = giommu->bcontainer;
-+ VFIOContainer *bcontainer = giommu->bcontainer;
- hwaddr iova = iotlb->iova + giommu->iommu_offset;
- ram_addr_t translated_addr;
- Error *local_err = NULL;
-@@ -1127,7 +1127,7 @@ static int vfio_ram_discard_query_dirty_bitmap(MemoryRegionSection *section,
- }
-
- static int
--vfio_sync_ram_discard_listener_dirty_bitmap(VFIOContainerBase *bcontainer,
-+vfio_sync_ram_discard_listener_dirty_bitmap(VFIOContainer *bcontainer,
- MemoryRegionSection *section)
- {
- RamDiscardManager *rdm = memory_region_get_ram_discard_manager(section->mr);
-@@ -1143,7 +1143,7 @@ vfio_sync_ram_discard_listener_dirty_bitmap(VFIOContainerBase *bcontainer,
- &vrdl);
- }
-
--static int vfio_sync_iommu_dirty_bitmap(VFIOContainerBase *bcontainer,
-+static int vfio_sync_iommu_dirty_bitmap(VFIOContainer *bcontainer,
- MemoryRegionSection *section)
- {
- VFIOGuestIOMMU *giommu;
-@@ -1180,7 +1180,7 @@ static int vfio_sync_iommu_dirty_bitmap(VFIOContainerBase *bcontainer,
- return 0;
- }
-
--static int vfio_sync_dirty_bitmap(VFIOContainerBase *bcontainer,
-+static int vfio_sync_dirty_bitmap(VFIOContainer *bcontainer,
- MemoryRegionSection *section, Error **errp)
- {
- ram_addr_t ram_addr;
-@@ -1209,8 +1209,8 @@ static int vfio_sync_dirty_bitmap(VFIOContainerBase *bcontainer,
- static void vfio_listener_log_sync(MemoryListener *listener,
- MemoryRegionSection *section)
- {
-- VFIOContainerBase *bcontainer = container_of(listener, VFIOContainerBase,
-- listener);
-+ VFIOContainer *bcontainer = container_of(listener, VFIOContainer,
-+ listener);
- int ret;
- Error *local_err = NULL;
-
-@@ -1241,7 +1241,7 @@ static const MemoryListener vfio_memory_listener = {
- .log_sync = vfio_listener_log_sync,
- };
-
--bool vfio_listener_register(VFIOContainerBase *bcontainer, Error **errp)
-+bool vfio_listener_register(VFIOContainer *bcontainer, Error **errp)
- {
- bcontainer->listener = vfio_memory_listener;
- memory_listener_register(&bcontainer->listener, bcontainer->space->as);
-@@ -1255,7 +1255,7 @@ bool vfio_listener_register(VFIOContainerBase *bcontainer, Error **errp)
- return true;
- }
-
--void vfio_listener_unregister(VFIOContainerBase *bcontainer)
-+void vfio_listener_unregister(VFIOContainer *bcontainer)
- {
- memory_listener_unregister(&bcontainer->listener);
- }
-diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c
-index b8bade90d7..6d462aa13c 100644
---- a/hw/vfio/spapr.c
-+++ b/hw/vfio/spapr.c
-@@ -62,7 +62,7 @@ static void vfio_prereg_listener_region_add(MemoryListener *listener,
- VFIOSpaprContainer *scontainer = container_of(listener, VFIOSpaprContainer,
- prereg_listener);
- VFIOLegacyContainer *container = &scontainer->container;
-- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
- const hwaddr gpa = section->offset_within_address_space;
- hwaddr end;
- int ret;
-@@ -244,7 +244,7 @@ static bool vfio_spapr_create_window(VFIOLegacyContainer *container,
- hwaddr *pgsize, Error **errp)
- {
- int ret = 0;
-- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
- container);
- IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
-@@ -348,7 +348,7 @@ static bool vfio_spapr_create_window(VFIOLegacyContainer *container,
- }
-
- static bool
--vfio_spapr_container_add_section_window(VFIOContainerBase *bcontainer,
-+vfio_spapr_container_add_section_window(VFIOContainer *bcontainer,
- MemoryRegionSection *section,
- Error **errp)
- {
-@@ -439,7 +439,7 @@ vfio_spapr_container_add_section_window(VFIOContainerBase *bcontainer,
- }
-
- static void
--vfio_spapr_container_del_section_window(VFIOContainerBase *bcontainer,
-+vfio_spapr_container_del_section_window(VFIOContainer *bcontainer,
- MemoryRegionSection *section)
- {
- VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-@@ -461,7 +461,7 @@ vfio_spapr_container_del_section_window(VFIOContainerBase *bcontainer,
- }
- }
-
--static void vfio_spapr_container_release(VFIOContainerBase *bcontainer)
-+static void vfio_spapr_container_release(VFIOContainer *bcontainer)
- {
- VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
-@@ -478,7 +478,7 @@ static void vfio_spapr_container_release(VFIOContainerBase *bcontainer)
- }
- }
-
--static bool vfio_spapr_container_setup(VFIOContainerBase *bcontainer,
-+static bool vfio_spapr_container_setup(VFIOContainer *bcontainer,
- Error **errp)
- {
- VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-diff --git a/hw/vfio/vfio-iommufd.h b/hw/vfio/vfio-iommufd.h
-index 07ea0f4304..6c049d9257 100644
---- a/hw/vfio/vfio-iommufd.h
-+++ b/hw/vfio/vfio-iommufd.h
-@@ -23,7 +23,7 @@ typedef struct VFIOIOASHwpt {
- typedef struct IOMMUFDBackend IOMMUFDBackend;
-
- typedef struct VFIOIOMMUFDContainer {
-- VFIOContainerBase bcontainer;
-+ VFIOContainer bcontainer;
- IOMMUFDBackend *be;
- uint32_t ioas_id;
- QLIST_HEAD(, VFIOIOASHwpt) hwpt_list;
-diff --git a/hw/vfio/vfio-listener.h b/hw/vfio/vfio-listener.h
-index eb69ddd374..a90674ca96 100644
---- a/hw/vfio/vfio-listener.h
-+++ b/hw/vfio/vfio-listener.h
-@@ -9,7 +9,7 @@
- #ifndef HW_VFIO_VFIO_LISTENER_H
- #define HW_VFIO_VFIO_LISTENER_H
-
--bool vfio_listener_register(VFIOContainerBase *bcontainer, Error **errp);
--void vfio_listener_unregister(VFIOContainerBase *bcontainer);
-+bool vfio_listener_register(VFIOContainer *bcontainer, Error **errp);
-+void vfio_listener_unregister(VFIOContainer *bcontainer);
-
- #endif /* HW_VFIO_VFIO_LISTENER_H */
-diff --git a/include/hw/vfio/vfio-container-base.h b/include/hw/vfio/vfio-container-base.h
-index acbd48a18a..b580f4a02d 100644
---- a/include/hw/vfio/vfio-container-base.h
-+++ b/include/hw/vfio/vfio-container-base.h
-@@ -26,14 +26,14 @@ typedef struct {
-
- typedef struct VFIOAddressSpace {
- AddressSpace *as;
-- QLIST_HEAD(, VFIOContainerBase) containers;
-+ QLIST_HEAD(, VFIOContainer) containers;
- QLIST_ENTRY(VFIOAddressSpace) list;
- } VFIOAddressSpace;
-
- /*
- * This is the base object for vfio container backends
- */
--struct VFIOContainerBase {
-+struct VFIOContainer {
- Object parent_obj;
-
- VFIOAddressSpace *space;
-@@ -48,17 +48,17 @@ struct VFIOContainerBase {
- bool dirty_pages_started; /* Protected by BQL */
- QLIST_HEAD(, VFIOGuestIOMMU) giommu_list;
- QLIST_HEAD(, VFIORamDiscardListener) vrdl_list;
-- QLIST_ENTRY(VFIOContainerBase) next;
-+ QLIST_ENTRY(VFIOContainer) next;
- QLIST_HEAD(, VFIODevice) device_list;
- GList *iova_ranges;
- NotifierWithReturn cpr_reboot_notifier;
- };
-
- #define TYPE_VFIO_IOMMU "vfio-iommu"
--OBJECT_DECLARE_TYPE(VFIOContainerBase, VFIOIOMMUClass, VFIO_IOMMU)
-+OBJECT_DECLARE_TYPE(VFIOContainer, VFIOIOMMUClass, VFIO_IOMMU)
-
- typedef struct VFIOGuestIOMMU {
-- VFIOContainerBase *bcontainer;
-+ VFIOContainer *bcontainer;
- IOMMUMemoryRegion *iommu_mr;
- hwaddr iommu_offset;
- IOMMUNotifier n;
-@@ -66,7 +66,7 @@ typedef struct VFIOGuestIOMMU {
- } VFIOGuestIOMMU;
-
- typedef struct VFIORamDiscardListener {
-- VFIOContainerBase *bcontainer;
-+ VFIOContainer *bcontainer;
- MemoryRegion *mr;
- hwaddr offset_within_address_space;
- hwaddr size;
-@@ -78,32 +78,32 @@ typedef struct VFIORamDiscardListener {
- VFIOAddressSpace *vfio_address_space_get(AddressSpace *as);
- void vfio_address_space_put(VFIOAddressSpace *space);
- void vfio_address_space_insert(VFIOAddressSpace *space,
-- VFIOContainerBase *bcontainer);
-+ VFIOContainer *bcontainer);
-
--int vfio_container_dma_map(VFIOContainerBase *bcontainer,
-+int vfio_container_dma_map(VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- void *vaddr, bool readonly, MemoryRegion *mr);
--int vfio_container_dma_unmap(VFIOContainerBase *bcontainer,
-+int vfio_container_dma_unmap(VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all);
--bool vfio_container_add_section_window(VFIOContainerBase *bcontainer,
-+bool vfio_container_add_section_window(VFIOContainer *bcontainer,
- MemoryRegionSection *section,
- Error **errp);
--void vfio_container_del_section_window(VFIOContainerBase *bcontainer,
-+void vfio_container_del_section_window(VFIOContainer *bcontainer,
- MemoryRegionSection *section);
--int vfio_container_set_dirty_page_tracking(VFIOContainerBase *bcontainer,
-+int vfio_container_set_dirty_page_tracking(VFIOContainer *bcontainer,
- bool start, Error **errp);
- bool vfio_container_dirty_tracking_is_started(
-- const VFIOContainerBase *bcontainer);
-+ const VFIOContainer *bcontainer);
- bool vfio_container_devices_dirty_tracking_is_supported(
-- const VFIOContainerBase *bcontainer);
--int vfio_container_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
-+ const VFIOContainer *bcontainer);
-+int vfio_container_query_dirty_bitmap(const VFIOContainer *bcontainer,
- uint64_t iova, uint64_t size, ram_addr_t ram_addr, Error **errp);
-
--GList *vfio_container_get_iova_ranges(const VFIOContainerBase *bcontainer);
-+GList *vfio_container_get_iova_ranges(const VFIOContainer *bcontainer);
-
- static inline uint64_t
--vfio_container_get_page_size_mask(const VFIOContainerBase *bcontainer)
-+vfio_container_get_page_size_mask(const VFIOContainer *bcontainer)
- {
- assert(bcontainer);
- return bcontainer->pgsizes;
-@@ -123,12 +123,12 @@ struct VFIOIOMMUClass {
- * Perform basic setup of the container, including configuring IOMMU
- * capabilities, IOVA ranges, supported page sizes, etc.
- *
-- * @bcontainer: #VFIOContainerBase
-+ * @bcontainer: #VFIOContainer
- * @errp: pointer to Error*, to store an error if it happens.
- *
- * Returns true to indicate success and false for error.
- */
-- bool (*setup)(VFIOContainerBase *bcontainer, Error **errp);
-+ bool (*setup)(VFIOContainer *bcontainer, Error **errp);
-
- /**
- * @listener_begin
-@@ -136,9 +136,9 @@ struct VFIOIOMMUClass {
- * Called at the beginning of an address space update transaction.
- * See #MemoryListener.
- *
-- * @bcontainer: #VFIOContainerBase
-+ * @bcontainer: #VFIOContainer
- */
-- void (*listener_begin)(VFIOContainerBase *bcontainer);
-+ void (*listener_begin)(VFIOContainer *bcontainer);
-
- /**
- * @listener_commit
-@@ -146,9 +146,9 @@ struct VFIOIOMMUClass {
- * Called at the end of an address space update transaction,
- * See #MemoryListener.
- *
-- * @bcontainer: #VFIOContainerBase
-+ * @bcontainer: #VFIOContainer
- */
-- void (*listener_commit)(VFIOContainerBase *bcontainer);
-+ void (*listener_commit)(VFIOContainer *bcontainer);
-
- /**
- * @dma_map
-@@ -156,7 +156,7 @@ struct VFIOIOMMUClass {
- * Map an address range into the container. Note that the memory region is
- * referenced within an RCU read lock region across this call.
- *
-- * @bcontainer: #VFIOContainerBase to use
-+ * @bcontainer: #VFIOContainer to use
- * @iova: start address to map
- * @size: size of the range to map
- * @vaddr: process virtual address of mapping
-@@ -165,7 +165,7 @@ struct VFIOIOMMUClass {
- *
- * Returns 0 to indicate success and -errno otherwise.
- */
-- int (*dma_map)(const VFIOContainerBase *bcontainer,
-+ int (*dma_map)(const VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- void *vaddr, bool readonly, MemoryRegion *mr);
- /**
-@@ -173,14 +173,14 @@ struct VFIOIOMMUClass {
- *
- * Map a file range for the container.
- *
-- * @bcontainer: #VFIOContainerBase to use for map
-+ * @bcontainer: #VFIOContainer to use for map
- * @iova: start address to map
- * @size: size of the range to map
- * @fd: descriptor of the file to map
- * @start: starting file offset of the range to map
- * @readonly: map read only if true
- */
-- int (*dma_map_file)(const VFIOContainerBase *bcontainer,
-+ int (*dma_map_file)(const VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- int fd, unsigned long start, bool readonly);
- /**
-@@ -188,7 +188,7 @@ struct VFIOIOMMUClass {
- *
- * Unmap an address range from the container.
- *
-- * @bcontainer: #VFIOContainerBase to use for unmap
-+ * @bcontainer: #VFIOContainer to use for unmap
- * @iova: start address to unmap
- * @size: size of the range to unmap
- * @iotlb: The IOMMU TLB mapping entry (or NULL)
-@@ -196,7 +196,7 @@ struct VFIOIOMMUClass {
- *
- * Returns 0 to indicate success and -errno otherwise.
- */
-- int (*dma_unmap)(const VFIOContainerBase *bcontainer,
-+ int (*dma_unmap)(const VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all);
-
-@@ -234,21 +234,21 @@ struct VFIOIOMMUClass {
- *
- * Start or stop dirty pages tracking on VFIO container
- *
-- * @bcontainer: #VFIOContainerBase on which to de/activate dirty
-+ * @bcontainer: #VFIOContainer on which to de/activate dirty
- * page tracking
- * @start: indicates whether to start or stop dirty pages tracking
- * @errp: pointer to Error*, to store an error if it happens.
- *
- * Returns zero to indicate success and negative for error.
- */
-- int (*set_dirty_page_tracking)(const VFIOContainerBase *bcontainer,
-+ int (*set_dirty_page_tracking)(const VFIOContainer *bcontainer,
- bool start, Error **errp);
- /**
- * @query_dirty_bitmap
- *
- * Get bitmap of dirty pages from container
- *
-- * @bcontainer: #VFIOContainerBase from which to get dirty pages
-+ * @bcontainer: #VFIOContainer from which to get dirty pages
- * @vbmap: #VFIOBitmap internal bitmap structure
- * @iova: iova base address
- * @size: size of iova range
-@@ -256,24 +256,24 @@ struct VFIOIOMMUClass {
- *
- * Returns zero to indicate success and negative for error.
- */
-- int (*query_dirty_bitmap)(const VFIOContainerBase *bcontainer,
-+ int (*query_dirty_bitmap)(const VFIOContainer *bcontainer,
- VFIOBitmap *vbmap, hwaddr iova, hwaddr size, Error **errp);
- /* PCI specific */
- int (*pci_hot_reset)(VFIODevice *vbasedev, bool single);
-
- /* SPAPR specific */
-- bool (*add_window)(VFIOContainerBase *bcontainer,
-+ bool (*add_window)(VFIOContainer *bcontainer,
- MemoryRegionSection *section,
- Error **errp);
-- void (*del_window)(VFIOContainerBase *bcontainer,
-+ void (*del_window)(VFIOContainer *bcontainer,
- MemoryRegionSection *section);
-- void (*release)(VFIOContainerBase *bcontainer);
-+ void (*release)(VFIOContainer *bcontainer);
- };
-
- VFIORamDiscardListener *vfio_find_ram_discard_listener(
-- VFIOContainerBase *bcontainer, MemoryRegionSection *section);
-+ VFIOContainer *bcontainer, MemoryRegionSection *section);
-
--void vfio_container_region_add(VFIOContainerBase *bcontainer,
-+void vfio_container_region_add(VFIOContainer *bcontainer,
- MemoryRegionSection *section, bool cpr_remap);
-
- #endif /* HW_VFIO_VFIO_CONTAINER_BASE_H */
-diff --git a/include/hw/vfio/vfio-container.h b/include/hw/vfio/vfio-container.h
-index 712a691400..a84dfb0dee 100644
---- a/include/hw/vfio/vfio-container.h
-+++ b/include/hw/vfio/vfio-container.h
-@@ -26,7 +26,7 @@ typedef struct VFIOGroup {
- } VFIOGroup;
-
- struct VFIOLegacyContainer {
-- VFIOContainerBase parent_obj;
-+ VFIOContainer parent_obj;
-
- int fd; /* /dev/vfio/vfio, empowered by the attached groups */
- unsigned iommu_type;
-diff --git a/include/hw/vfio/vfio-cpr.h b/include/hw/vfio/vfio-cpr.h
-index 04e9872587..26ee0c4fe1 100644
---- a/include/hw/vfio/vfio-cpr.h
-+++ b/include/hw/vfio/vfio-cpr.h
-@@ -13,14 +13,14 @@
- #include "system/memory.h"
-
- struct VFIOLegacyContainer;
--struct VFIOContainerBase;
-+struct VFIOContainer;
- struct VFIOGroup;
- struct VFIODevice;
- struct VFIOPCIDevice;
- struct VFIOIOMMUFDContainer;
- struct IOMMUFDBackend;
-
--typedef int (*dma_map_fn)(const struct VFIOContainerBase *bcontainer,
-+typedef int (*dma_map_fn)(const struct VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size, void *vaddr,
- bool readonly, MemoryRegion *mr);
-
-@@ -65,11 +65,11 @@ int vfio_cpr_group_get_device_fd(int d, const char *name);
- bool vfio_cpr_container_match(struct VFIOLegacyContainer *container,
- struct VFIOGroup *group, int fd);
-
--void vfio_cpr_giommu_remap(struct VFIOContainerBase *bcontainer,
-+void vfio_cpr_giommu_remap(struct VFIOContainer *bcontainer,
- MemoryRegionSection *section);
-
- bool vfio_cpr_ram_discard_register_listener(
-- struct VFIOContainerBase *bcontainer, MemoryRegionSection *section);
-+ struct VFIOContainer *bcontainer, MemoryRegionSection *section);
-
- void vfio_cpr_save_vector_fd(struct VFIOPCIDevice *vdev, const char *name,
- int nr, int fd);
-diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h
-index 2bc16a1a2e..d20186327f 100644
---- a/include/hw/vfio/vfio-device.h
-+++ b/include/hw/vfio/vfio-device.h
-@@ -54,7 +54,7 @@ typedef struct VFIODevice {
- QLIST_ENTRY(VFIODevice) container_next;
- QLIST_ENTRY(VFIODevice) global_next;
- struct VFIOGroup *group;
-- VFIOContainerBase *bcontainer;
-+ VFIOContainer *bcontainer;
- char *sysfsdev;
- char *name;
- DeviceState *dev;
-@@ -253,7 +253,7 @@ struct VFIODeviceIOOps {
- void *data, bool post);
- };
-
--void vfio_device_prepare(VFIODevice *vbasedev, VFIOContainerBase *bcontainer,
-+void vfio_device_prepare(VFIODevice *vbasedev, VFIOContainer *bcontainer,
- struct vfio_device_info *info);
-
- void vfio_device_unprepare(VFIODevice *vbasedev);
---
-2.52.0
-
diff --git a/kvm-include-hw-vfio-vfio-container-base.h-rename-file-to.patch b/kvm-include-hw-vfio-vfio-container-base.h-rename-file-to.patch
deleted file mode 100644
index a0d6b93..0000000
--- a/kvm-include-hw-vfio-vfio-container-base.h-rename-file-to.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-From b2f885bec7e4dc0b1618063a7c1220bc235c55eb Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:12 +0100
-Subject: [PATCH 054/116] include/hw/vfio/vfio-container-base.h: rename file to
- vfio-container.h
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [38/100] 8f997c2726be98dd8083f32305a20aa992bbc46d (rovick1/qemu-kvm)
-
-With the rename of VFIOContainerBase to VFIOContainer, the vfio-container-base.h
-header file containing the struct definition is misleading. Rename it from
-vfio-container-base.h to vfio-container.h accordingly, fixing up the name
-of the include guard at the same time.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-5-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit ef70eb32b8a15abea6af8180ba03e771ae041169)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/container.h | 2 +-
- hw/vfio/container-base.c | 2 +-
- hw/vfio/vfio-iommufd.h | 2 +-
- include/hw/vfio/vfio-container-legacy.h | 2 +-
- include/hw/vfio/{vfio-container-base.h => vfio-container.h} | 6 +++---
- include/hw/vfio/vfio-device.h | 2 +-
- 6 files changed, 8 insertions(+), 8 deletions(-)
- rename include/hw/vfio/{vfio-container-base.h => vfio-container.h} (98%)
-
-diff --git a/hw/vfio-user/container.h b/hw/vfio-user/container.h
-index 241863ef97..a2b42e3169 100644
---- a/hw/vfio-user/container.h
-+++ b/hw/vfio-user/container.h
-@@ -9,7 +9,7 @@
-
- #include "qemu/osdep.h"
-
--#include "hw/vfio/vfio-container-base.h"
-+#include "hw/vfio/vfio-container.h"
- #include "hw/vfio-user/proxy.h"
-
- /* MMU container sub-class for vfio-user. */
-diff --git a/hw/vfio/container-base.c b/hw/vfio/container-base.c
-index 98c5198e50..250b20f424 100644
---- a/hw/vfio/container-base.c
-+++ b/hw/vfio/container-base.c
-@@ -18,7 +18,7 @@
- #include "system/ram_addr.h"
- #include "qapi/error.h"
- #include "qemu/error-report.h"
--#include "hw/vfio/vfio-container-base.h"
-+#include "hw/vfio/vfio-container.h"
- #include "hw/vfio/vfio-device.h" /* vfio_device_reset_handler */
- #include "system/reset.h"
- #include "vfio-helpers.h"
-diff --git a/hw/vfio/vfio-iommufd.h b/hw/vfio/vfio-iommufd.h
-index 6c049d9257..13f412aad7 100644
---- a/hw/vfio/vfio-iommufd.h
-+++ b/hw/vfio/vfio-iommufd.h
-@@ -9,7 +9,7 @@
- #ifndef HW_VFIO_VFIO_IOMMUFD_H
- #define HW_VFIO_VFIO_IOMMUFD_H
-
--#include "hw/vfio/vfio-container-base.h"
-+#include "hw/vfio/vfio-container.h"
-
- typedef struct VFIODevice VFIODevice;
-
-diff --git a/include/hw/vfio/vfio-container-legacy.h b/include/hw/vfio/vfio-container-legacy.h
-index ab5130d26e..74a72df018 100644
---- a/include/hw/vfio/vfio-container-legacy.h
-+++ b/include/hw/vfio/vfio-container-legacy.h
-@@ -9,7 +9,7 @@
- #ifndef HW_VFIO_CONTAINER_LEGACY_H
- #define HW_VFIO_CONTAINER_LEGACY_H
-
--#include "hw/vfio/vfio-container-base.h"
-+#include "hw/vfio/vfio-container.h"
- #include "hw/vfio/vfio-cpr.h"
-
- typedef struct VFIOLegacyContainer VFIOLegacyContainer;
-diff --git a/include/hw/vfio/vfio-container-base.h b/include/hw/vfio/vfio-container.h
-similarity index 98%
-rename from include/hw/vfio/vfio-container-base.h
-rename to include/hw/vfio/vfio-container.h
-index b580f4a02d..b8fb2b8b5d 100644
---- a/include/hw/vfio/vfio-container-base.h
-+++ b/include/hw/vfio/vfio-container.h
-@@ -10,8 +10,8 @@
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
--#ifndef HW_VFIO_VFIO_CONTAINER_BASE_H
--#define HW_VFIO_VFIO_CONTAINER_BASE_H
-+#ifndef HW_VFIO_VFIO_CONTAINER_H
-+#define HW_VFIO_VFIO_CONTAINER_H
-
- #include "system/memory.h"
-
-@@ -276,4 +276,4 @@ VFIORamDiscardListener *vfio_find_ram_discard_listener(
- void vfio_container_region_add(VFIOContainer *bcontainer,
- MemoryRegionSection *section, bool cpr_remap);
-
--#endif /* HW_VFIO_VFIO_CONTAINER_BASE_H */
-+#endif /* HW_VFIO_VFIO_CONTAINER_H */
-diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h
-index d20186327f..28047a6339 100644
---- a/include/hw/vfio/vfio-device.h
-+++ b/include/hw/vfio/vfio-device.h
-@@ -27,7 +27,7 @@
- #include <linux/vfio.h>
- #endif
- #include "system/system.h"
--#include "hw/vfio/vfio-container-base.h"
-+#include "hw/vfio/vfio-container.h"
- #include "hw/vfio/vfio-cpr.h"
- #include "system/host_iommu_device.h"
- #include "system/iommufd.h"
---
-2.52.0
-
diff --git a/kvm-include-hw-vfio-vfio-container.h-rename-VFIOContaine.patch b/kvm-include-hw-vfio-vfio-container.h-rename-VFIOContaine.patch
deleted file mode 100644
index 2150d51..0000000
--- a/kvm-include-hw-vfio-vfio-container.h-rename-VFIOContaine.patch
+++ /dev/null
@@ -1,513 +0,0 @@
-From 3e5a48ee28a9ecc28f27e34e4bdea3f30cb07154 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:09 +0100
-Subject: [PATCH 051/116] include/hw/vfio/vfio-container.h: rename
- VFIOContainer to VFIOLegacyContainer
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [35/100] 76092b57b3839acd6627010e30b7d7ce90db524f (rovick1/qemu-kvm)
-
-Conflicts:
- hw/vfio/container.c: contextual conflict: downstream we
- have vfio_device_count
-
-The VFIOContainer struct represents the legacy VFIO container even though the
-name suggests it may be the common superclass of all VFIO containers. Rename it
-to VFIOLegacyContainer to make this clearer, which is also a better match for
-its VFIO_IOMMU_LEGACY QOM type name.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-2-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit da9211f28e280bc9809b116fc186727a01b0f267)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/ppc/spapr_pci_vfio.c | 10 ++++----
- hw/vfio/container.c | 42 +++++++++++++++++---------------
- hw/vfio/cpr-legacy.c | 27 +++++++++++---------
- hw/vfio/spapr.c | 18 +++++++-------
- include/hw/vfio/vfio-container.h | 8 +++---
- include/hw/vfio/vfio-cpr.h | 9 ++++---
- 6 files changed, 60 insertions(+), 54 deletions(-)
-
-diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c
-index e318d0d912..b658eb372c 100644
---- a/hw/ppc/spapr_pci_vfio.c
-+++ b/hw/ppc/spapr_pci_vfio.c
-@@ -32,7 +32,7 @@
- * Interfaces for IBM EEH (Enhanced Error Handling)
- */
- #ifdef CONFIG_VFIO_PCI
--static bool vfio_eeh_container_ok(VFIOContainer *container)
-+static bool vfio_eeh_container_ok(VFIOLegacyContainer *container)
- {
- /*
- * As of 2016-03-04 (linux-4.5) the host kernel EEH/VFIO
-@@ -60,7 +60,7 @@ static bool vfio_eeh_container_ok(VFIOContainer *container)
- return true;
- }
-
--static int vfio_eeh_container_op(VFIOContainer *container, uint32_t op)
-+static int vfio_eeh_container_op(VFIOLegacyContainer *container, uint32_t op)
- {
- struct vfio_eeh_pe_op pe_op = {
- .argsz = sizeof(pe_op),
-@@ -83,7 +83,7 @@ static int vfio_eeh_container_op(VFIOContainer *container, uint32_t op)
- return ret;
- }
-
--static VFIOContainer *vfio_eeh_as_container(AddressSpace *as)
-+static VFIOLegacyContainer *vfio_eeh_as_container(AddressSpace *as)
- {
- VFIOAddressSpace *space = vfio_address_space_get(as);
- VFIOContainerBase *bcontainer = NULL;
-@@ -111,14 +111,14 @@ out:
-
- static bool vfio_eeh_as_ok(AddressSpace *as)
- {
-- VFIOContainer *container = vfio_eeh_as_container(as);
-+ VFIOLegacyContainer *container = vfio_eeh_as_container(as);
-
- return (container != NULL) && vfio_eeh_container_ok(container);
- }
-
- static int vfio_eeh_as_op(AddressSpace *as, uint32_t op)
- {
-- VFIOContainer *container = vfio_eeh_as_container(as);
-+ VFIOLegacyContainer *container = vfio_eeh_as_container(as);
-
- if (!container) {
- return -ENODEV;
-diff --git a/hw/vfio/container.c b/hw/vfio/container.c
-index 860d1aebda..76a09be941 100644
---- a/hw/vfio/container.c
-+++ b/hw/vfio/container.c
-@@ -58,7 +58,8 @@ int vfio_device_count(void)
- return i;
- }
-
--static int vfio_ram_block_discard_disable(VFIOContainer *container, bool state)
-+static int vfio_ram_block_discard_disable(VFIOLegacyContainer *container,
-+ bool state)
- {
- switch (container->iommu_type) {
- case VFIO_TYPE1v2_IOMMU:
-@@ -81,7 +82,7 @@ static int vfio_ram_block_discard_disable(VFIOContainer *container, bool state)
- }
- }
-
--static int vfio_dma_unmap_bitmap(const VFIOContainer *container,
-+static int vfio_dma_unmap_bitmap(const VFIOLegacyContainer *container,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb)
- {
-@@ -138,7 +139,7 @@ static int vfio_legacy_dma_unmap_one(const VFIOContainerBase *bcontainer,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb)
- {
-- const VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+ const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- struct vfio_iommu_type1_dma_unmap unmap = {
- .argsz = sizeof(unmap),
- .flags = 0,
-@@ -226,7 +227,7 @@ static int vfio_legacy_dma_map(const VFIOContainerBase *bcontainer, hwaddr iova,
- ram_addr_t size, void *vaddr, bool readonly,
- MemoryRegion *mr)
- {
-- const VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+ const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- struct vfio_iommu_type1_dma_map map = {
- .argsz = sizeof(map),
- .flags = VFIO_DMA_MAP_FLAG_READ,
-@@ -258,7 +259,7 @@ static int
- vfio_legacy_set_dirty_page_tracking(const VFIOContainerBase *bcontainer,
- bool start, Error **errp)
- {
-- const VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+ const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- int ret;
- struct vfio_iommu_type1_dirty_bitmap dirty = {
- .argsz = sizeof(dirty),
-@@ -283,7 +284,7 @@ vfio_legacy_set_dirty_page_tracking(const VFIOContainerBase *bcontainer,
- static int vfio_legacy_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
- VFIOBitmap *vbmap, hwaddr iova, hwaddr size, Error **errp)
- {
-- const VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+ const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- struct vfio_iommu_type1_dirty_bitmap *dbitmap;
- struct vfio_iommu_type1_dirty_bitmap_get *range;
- int ret;
-@@ -427,12 +428,12 @@ static bool vfio_set_iommu(int container_fd, int group_fd,
- return true;
- }
-
--static VFIOContainer *vfio_create_container(int fd, VFIOGroup *group,
-+static VFIOLegacyContainer *vfio_create_container(int fd, VFIOGroup *group,
- Error **errp)
- {
- int iommu_type;
- const char *vioc_name;
-- VFIOContainer *container;
-+ VFIOLegacyContainer *container;
-
- iommu_type = vfio_get_iommu_type(fd, errp);
- if (iommu_type < 0) {
-@@ -456,7 +457,7 @@ static VFIOContainer *vfio_create_container(int fd, VFIOGroup *group,
- return container;
- }
-
--static int vfio_get_iommu_info(VFIOContainer *container,
-+static int vfio_get_iommu_info(VFIOLegacyContainer *container,
- struct vfio_iommu_type1_info **info)
- {
-
-@@ -500,7 +501,7 @@ vfio_get_iommu_info_cap(struct vfio_iommu_type1_info *info, uint16_t id)
- return NULL;
- }
-
--static void vfio_get_iommu_info_migration(VFIOContainer *container,
-+static void vfio_get_iommu_info_migration(VFIOLegacyContainer *container,
- struct vfio_iommu_type1_info *info)
- {
- struct vfio_info_cap_header *hdr;
-@@ -528,7 +529,7 @@ static void vfio_get_iommu_info_migration(VFIOContainer *container,
-
- static bool vfio_legacy_setup(VFIOContainerBase *bcontainer, Error **errp)
- {
-- VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+ VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- g_autofree struct vfio_iommu_type1_info *info = NULL;
- int ret;
-
-@@ -554,8 +555,8 @@ static bool vfio_legacy_setup(VFIOContainerBase *bcontainer, Error **errp)
- return true;
- }
-
--static bool vfio_container_attach_discard_disable(VFIOContainer *container,
-- VFIOGroup *group, Error **errp)
-+static bool vfio_container_attach_discard_disable(
-+ VFIOLegacyContainer *container, VFIOGroup *group, Error **errp)
- {
- int ret;
-
-@@ -601,8 +602,8 @@ static bool vfio_container_attach_discard_disable(VFIOContainer *container,
- return !ret;
- }
-
--static bool vfio_container_group_add(VFIOContainer *container, VFIOGroup *group,
-- Error **errp)
-+static bool vfio_container_group_add(VFIOLegacyContainer *container,
-+ VFIOGroup *group, Error **errp)
- {
- if (!vfio_container_attach_discard_disable(container, group, errp)) {
- return false;
-@@ -618,7 +619,8 @@ static bool vfio_container_group_add(VFIOContainer *container, VFIOGroup *group,
- return true;
- }
-
--static void vfio_container_group_del(VFIOContainer *container, VFIOGroup *group)
-+static void vfio_container_group_del(VFIOLegacyContainer *container,
-+ VFIOGroup *group)
- {
- QLIST_REMOVE(group, container_next);
- group->container = NULL;
-@@ -630,7 +632,7 @@ static void vfio_container_group_del(VFIOContainer *container, VFIOGroup *group)
- static bool vfio_container_connect(VFIOGroup *group, AddressSpace *as,
- Error **errp)
- {
-- VFIOContainer *container;
-+ VFIOLegacyContainer *container;
- VFIOContainerBase *bcontainer;
- int ret, fd = -1;
- VFIOAddressSpace *space;
-@@ -743,7 +745,7 @@ fail:
-
- static void vfio_container_disconnect(VFIOGroup *group)
- {
-- VFIOContainer *container = group->container;
-+ VFIOLegacyContainer *container = group->container;
- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
-
-@@ -1257,7 +1259,7 @@ hiod_legacy_vfio_get_page_size_mask(HostIOMMUDevice *hiod)
-
- static void vfio_iommu_legacy_instance_init(Object *obj)
- {
-- VFIOContainer *container = VFIO_IOMMU_LEGACY(obj);
-+ VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(obj);
-
- QLIST_INIT(&container->group_list);
- }
-@@ -1277,7 +1279,7 @@ static const TypeInfo types[] = {
- .name = TYPE_VFIO_IOMMU_LEGACY,
- .parent = TYPE_VFIO_IOMMU,
- .instance_init = vfio_iommu_legacy_instance_init,
-- .instance_size = sizeof(VFIOContainer),
-+ .instance_size = sizeof(VFIOLegacyContainer),
- .class_init = vfio_iommu_legacy_class_init,
- }, {
- .name = TYPE_HOST_IOMMU_DEVICE_LEGACY_VFIO,
-diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
-index 8f437194fa..12bf920a7d 100644
---- a/hw/vfio/cpr-legacy.c
-+++ b/hw/vfio/cpr-legacy.c
-@@ -17,7 +17,8 @@
- #include "qapi/error.h"
- #include "qemu/error-report.h"
-
--static bool vfio_dma_unmap_vaddr_all(VFIOContainer *container, Error **errp)
-+static bool vfio_dma_unmap_vaddr_all(VFIOLegacyContainer *container,
-+ Error **errp)
- {
- struct vfio_iommu_type1_dma_unmap unmap = {
- .argsz = sizeof(unmap),
-@@ -41,7 +42,7 @@ static int vfio_legacy_cpr_dma_map(const VFIOContainerBase *bcontainer,
- hwaddr iova, ram_addr_t size, void *vaddr,
- bool readonly, MemoryRegion *mr)
- {
-- const VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+ const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-
- struct vfio_iommu_type1_dma_map map = {
- .argsz = sizeof(map),
-@@ -63,12 +64,13 @@ static int vfio_legacy_cpr_dma_map(const VFIOContainerBase *bcontainer,
- static void vfio_region_remap(MemoryListener *listener,
- MemoryRegionSection *section)
- {
-- VFIOContainer *container = container_of(listener, VFIOContainer,
-- cpr.remap_listener);
-+ VFIOLegacyContainer *container = container_of(listener,
-+ VFIOLegacyContainer,
-+ cpr.remap_listener);
- vfio_container_region_add(VFIO_IOMMU(container), section, true);
- }
-
--static bool vfio_cpr_supported(VFIOContainer *container, Error **errp)
-+static bool vfio_cpr_supported(VFIOLegacyContainer *container, Error **errp)
- {
- if (!ioctl(container->fd, VFIO_CHECK_EXTENSION, VFIO_UPDATE_VADDR)) {
- error_setg(errp, "VFIO container does not support VFIO_UPDATE_VADDR");
-@@ -85,7 +87,7 @@ static bool vfio_cpr_supported(VFIOContainer *container, Error **errp)
-
- static int vfio_container_pre_save(void *opaque)
- {
-- VFIOContainer *container = opaque;
-+ VFIOLegacyContainer *container = opaque;
- Error *local_err = NULL;
-
- if (!vfio_dma_unmap_vaddr_all(container, &local_err)) {
-@@ -97,7 +99,7 @@ static int vfio_container_pre_save(void *opaque)
-
- static int vfio_container_post_load(void *opaque, int version_id)
- {
-- VFIOContainer *container = opaque;
-+ VFIOLegacyContainer *container = opaque;
- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
- dma_map_fn saved_dma_map = vioc->dma_map;
-@@ -133,8 +135,8 @@ static const VMStateDescription vfio_container_vmstate = {
- static int vfio_cpr_fail_notifier(NotifierWithReturn *notifier,
- MigrationEvent *e, Error **errp)
- {
-- VFIOContainer *container =
-- container_of(notifier, VFIOContainer, cpr.transfer_notifier);
-+ VFIOLegacyContainer *container =
-+ container_of(notifier, VFIOLegacyContainer, cpr.transfer_notifier);
- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-
- if (e->type != MIG_EVENT_PRECOPY_FAILED) {
-@@ -165,7 +167,8 @@ static int vfio_cpr_fail_notifier(NotifierWithReturn *notifier,
- return 0;
- }
-
--bool vfio_legacy_cpr_register_container(VFIOContainer *container, Error **errp)
-+bool vfio_legacy_cpr_register_container(VFIOLegacyContainer *container,
-+ Error **errp)
- {
- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
- Error **cpr_blocker = &container->cpr.blocker;
-@@ -189,7 +192,7 @@ bool vfio_legacy_cpr_register_container(VFIOContainer *container, Error **errp)
- return true;
- }
-
--void vfio_legacy_cpr_unregister_container(VFIOContainer *container)
-+void vfio_legacy_cpr_unregister_container(VFIOLegacyContainer *container)
- {
- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
-
-@@ -263,7 +266,7 @@ static bool same_device(int fd1, int fd2)
- return !fstat(fd1, &st1) && !fstat(fd2, &st2) && st1.st_dev == st2.st_dev;
- }
-
--bool vfio_cpr_container_match(VFIOContainer *container, VFIOGroup *group,
-+bool vfio_cpr_container_match(VFIOLegacyContainer *container, VFIOGroup *group,
- int fd)
- {
- if (container->fd == fd) {
-diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c
-index c41e4588d6..b8bade90d7 100644
---- a/hw/vfio/spapr.c
-+++ b/hw/vfio/spapr.c
-@@ -31,7 +31,7 @@ typedef struct VFIOHostDMAWindow {
- } VFIOHostDMAWindow;
-
- typedef struct VFIOSpaprContainer {
-- VFIOContainer container;
-+ VFIOLegacyContainer container;
- MemoryListener prereg_listener;
- QLIST_HEAD(, VFIOHostDMAWindow) hostwin_list;
- unsigned int levels;
-@@ -61,7 +61,7 @@ static void vfio_prereg_listener_region_add(MemoryListener *listener,
- {
- VFIOSpaprContainer *scontainer = container_of(listener, VFIOSpaprContainer,
- prereg_listener);
-- VFIOContainer *container = &scontainer->container;
-+ VFIOLegacyContainer *container = &scontainer->container;
- VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
- const hwaddr gpa = section->offset_within_address_space;
- hwaddr end;
-@@ -121,7 +121,7 @@ static void vfio_prereg_listener_region_del(MemoryListener *listener,
- {
- VFIOSpaprContainer *scontainer = container_of(listener, VFIOSpaprContainer,
- prereg_listener);
-- VFIOContainer *container = &scontainer->container;
-+ VFIOLegacyContainer *container = &scontainer->container;
- const hwaddr gpa = section->offset_within_address_space;
- hwaddr end;
- int ret;
-@@ -218,7 +218,7 @@ static VFIOHostDMAWindow *vfio_find_hostwin(VFIOSpaprContainer *container,
- return hostwin_found ? hostwin : NULL;
- }
-
--static int vfio_spapr_remove_window(VFIOContainer *container,
-+static int vfio_spapr_remove_window(VFIOLegacyContainer *container,
- hwaddr offset_within_address_space)
- {
- struct vfio_iommu_spapr_tce_remove remove = {
-@@ -239,7 +239,7 @@ static int vfio_spapr_remove_window(VFIOContainer *container,
- return 0;
- }
-
--static bool vfio_spapr_create_window(VFIOContainer *container,
-+static bool vfio_spapr_create_window(VFIOLegacyContainer *container,
- MemoryRegionSection *section,
- hwaddr *pgsize, Error **errp)
- {
-@@ -352,7 +352,7 @@ vfio_spapr_container_add_section_window(VFIOContainerBase *bcontainer,
- MemoryRegionSection *section,
- Error **errp)
- {
-- VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+ VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
- container);
- VFIOHostDMAWindow *hostwin;
-@@ -442,7 +442,7 @@ static void
- vfio_spapr_container_del_section_window(VFIOContainerBase *bcontainer,
- MemoryRegionSection *section)
- {
-- VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+ VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
- container);
-
-@@ -463,7 +463,7 @@ vfio_spapr_container_del_section_window(VFIOContainerBase *bcontainer,
-
- static void vfio_spapr_container_release(VFIOContainerBase *bcontainer)
- {
-- VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+ VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
- container);
- VFIOHostDMAWindow *hostwin, *next;
-@@ -481,7 +481,7 @@ static void vfio_spapr_container_release(VFIOContainerBase *bcontainer)
- static bool vfio_spapr_container_setup(VFIOContainerBase *bcontainer,
- Error **errp)
- {
-- VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+ VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
- container);
- struct vfio_iommu_spapr_tce_info info;
-diff --git a/include/hw/vfio/vfio-container.h b/include/hw/vfio/vfio-container.h
-index 240f566993..712a691400 100644
---- a/include/hw/vfio/vfio-container.h
-+++ b/include/hw/vfio/vfio-container.h
-@@ -12,20 +12,20 @@
- #include "hw/vfio/vfio-container-base.h"
- #include "hw/vfio/vfio-cpr.h"
-
--typedef struct VFIOContainer VFIOContainer;
-+typedef struct VFIOLegacyContainer VFIOLegacyContainer;
- typedef struct VFIODevice VFIODevice;
-
- typedef struct VFIOGroup {
- int fd;
- int groupid;
-- VFIOContainer *container;
-+ VFIOLegacyContainer *container;
- QLIST_HEAD(, VFIODevice) device_list;
- QLIST_ENTRY(VFIOGroup) next;
- QLIST_ENTRY(VFIOGroup) container_next;
- bool ram_block_discard_allowed;
- } VFIOGroup;
-
--struct VFIOContainer {
-+struct VFIOLegacyContainer {
- VFIOContainerBase parent_obj;
-
- int fd; /* /dev/vfio/vfio, empowered by the attached groups */
-@@ -34,6 +34,6 @@ struct VFIOContainer {
- VFIOContainerCPR cpr;
- };
-
--OBJECT_DECLARE_SIMPLE_TYPE(VFIOContainer, VFIO_IOMMU_LEGACY);
-+OBJECT_DECLARE_SIMPLE_TYPE(VFIOLegacyContainer, VFIO_IOMMU_LEGACY);
-
- #endif /* HW_VFIO_CONTAINER_H */
-diff --git a/include/hw/vfio/vfio-cpr.h b/include/hw/vfio/vfio-cpr.h
-index d37daffbc5..04e9872587 100644
---- a/include/hw/vfio/vfio-cpr.h
-+++ b/include/hw/vfio/vfio-cpr.h
-@@ -12,7 +12,7 @@
- #include "migration/misc.h"
- #include "system/memory.h"
-
--struct VFIOContainer;
-+struct VFIOLegacyContainer;
- struct VFIOContainerBase;
- struct VFIOGroup;
- struct VFIODevice;
-@@ -42,9 +42,10 @@ typedef struct VFIOPCICPR {
- NotifierWithReturn transfer_notifier;
- } VFIOPCICPR;
-
--bool vfio_legacy_cpr_register_container(struct VFIOContainer *container,
-+bool vfio_legacy_cpr_register_container(struct VFIOLegacyContainer *container,
- Error **errp);
--void vfio_legacy_cpr_unregister_container(struct VFIOContainer *container);
-+void vfio_legacy_cpr_unregister_container(
-+ struct VFIOLegacyContainer *container);
-
- int vfio_cpr_reboot_notifier(NotifierWithReturn *notifier, MigrationEvent *e,
- Error **errp);
-@@ -61,7 +62,7 @@ void vfio_cpr_load_device(struct VFIODevice *vbasedev);
-
- int vfio_cpr_group_get_device_fd(int d, const char *name);
-
--bool vfio_cpr_container_match(struct VFIOContainer *container,
-+bool vfio_cpr_container_match(struct VFIOLegacyContainer *container,
- struct VFIOGroup *group, int fd);
-
- void vfio_cpr_giommu_remap(struct VFIOContainerBase *bcontainer,
---
-2.52.0
-
diff --git a/kvm-include-hw-vfio-vfio-container.h-rename-file-to-vfio.patch b/kvm-include-hw-vfio-vfio-container.h-rename-file-to-vfio.patch
deleted file mode 100644
index 5e4318f..0000000
--- a/kvm-include-hw-vfio-vfio-container.h-rename-file-to-vfio.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-From f07bd6689ca57fe08bf730ee8265ce33c769023b Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:11 +0100
-Subject: [PATCH 053/116] include/hw/vfio/vfio-container.h: rename file to
- vfio-container-legacy.h
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [37/100] 6f06ff3f512c9d55da838566fbc7b907be5acef6 (rovick1/qemu-kvm)
-
-With the rename of VFIOContainer to VFIOLegacyContainer, the vfio-container.h
-header file containing the struct definition is misleading. Rename it from
-vfio-container.h to vfio-container-legacy.h accordingly, fixing up the name
-of the include guard at the same time.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-4-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 07cbbfb108586a03059975aa0e093b833cb9bf56)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/ppc/spapr_pci_vfio.c | 2 +-
- hw/s390x/s390-pci-vfio.c | 2 +-
- hw/vfio/container.c | 2 +-
- hw/vfio/cpr-legacy.c | 2 +-
- hw/vfio/spapr.c | 2 +-
- .../hw/vfio/{vfio-container.h => vfio-container-legacy.h} | 6 +++---
- 6 files changed, 8 insertions(+), 8 deletions(-)
- rename include/hw/vfio/{vfio-container.h => vfio-container-legacy.h} (88%)
-
-diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c
-index 48fa98c199..18c5059262 100644
---- a/hw/ppc/spapr_pci_vfio.c
-+++ b/hw/ppc/spapr_pci_vfio.c
-@@ -24,7 +24,7 @@
- #include "hw/pci-host/spapr.h"
- #include "hw/pci/msix.h"
- #include "hw/pci/pci_device.h"
--#include "hw/vfio/vfio-container.h"
-+#include "hw/vfio/vfio-container-legacy.h"
- #include "qemu/error-report.h"
- #include CONFIG_DEVICES /* CONFIG_VFIO_PCI */
-
-diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c
-index aaf91319b4..c51bcea5fc 100644
---- a/hw/s390x/s390-pci-vfio.c
-+++ b/hw/s390x/s390-pci-vfio.c
-@@ -20,7 +20,7 @@
- #include "hw/s390x/s390-pci-clp.h"
- #include "hw/s390x/s390-pci-vfio.h"
- #include "hw/vfio/pci.h"
--#include "hw/vfio/vfio-container.h"
-+#include "hw/vfio/vfio-container-legacy.h"
- #include "hw/vfio/vfio-helpers.h"
-
- /*
-diff --git a/hw/vfio/container.c b/hw/vfio/container.c
-index 84f5a5fdee..0101a72f53 100644
---- a/hw/vfio/container.c
-+++ b/hw/vfio/container.c
-@@ -34,7 +34,7 @@
- #include "migration/cpr.h"
- #include "migration/blocker.h"
- #include "pci.h"
--#include "hw/vfio/vfio-container.h"
-+#include "hw/vfio/vfio-container-legacy.h"
- #include "vfio-helpers.h"
- #include "vfio-listener.h"
-
-diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
-index bd3f6fc3d3..bbf7a0d35f 100644
---- a/hw/vfio/cpr-legacy.c
-+++ b/hw/vfio/cpr-legacy.c
-@@ -7,7 +7,7 @@
- #include <sys/ioctl.h>
- #include <linux/vfio.h>
- #include "qemu/osdep.h"
--#include "hw/vfio/vfio-container.h"
-+#include "hw/vfio/vfio-container-legacy.h"
- #include "hw/vfio/vfio-device.h"
- #include "hw/vfio/vfio-listener.h"
- #include "migration/blocker.h"
-diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c
-index 6d462aa13c..acaa9c1419 100644
---- a/hw/vfio/spapr.c
-+++ b/hw/vfio/spapr.c
-@@ -15,7 +15,7 @@
- #include "system/hostmem.h"
- #include "system/address-spaces.h"
-
--#include "hw/vfio/vfio-container.h"
-+#include "hw/vfio/vfio-container-legacy.h"
- #include "hw/hw.h"
- #include "system/ram_addr.h"
- #include "qemu/error-report.h"
-diff --git a/include/hw/vfio/vfio-container.h b/include/hw/vfio/vfio-container-legacy.h
-similarity index 88%
-rename from include/hw/vfio/vfio-container.h
-rename to include/hw/vfio/vfio-container-legacy.h
-index a84dfb0dee..ab5130d26e 100644
---- a/include/hw/vfio/vfio-container.h
-+++ b/include/hw/vfio/vfio-container-legacy.h
-@@ -6,8 +6,8 @@
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
--#ifndef HW_VFIO_CONTAINER_H
--#define HW_VFIO_CONTAINER_H
-+#ifndef HW_VFIO_CONTAINER_LEGACY_H
-+#define HW_VFIO_CONTAINER_LEGACY_H
-
- #include "hw/vfio/vfio-container-base.h"
- #include "hw/vfio/vfio-cpr.h"
-@@ -36,4 +36,4 @@ struct VFIOLegacyContainer {
-
- OBJECT_DECLARE_SIMPLE_TYPE(VFIOLegacyContainer, VFIO_IOMMU_LEGACY);
-
--#endif /* HW_VFIO_CONTAINER_H */
-+#endif /* HW_VFIO_CONTAINER_LEGACY_H */
---
-2.52.0
-
diff --git a/kvm-include-hw-vfio-vfio-device.h-fix-include-header-gua.patch b/kvm-include-hw-vfio-vfio-device.h-fix-include-header-gua.patch
deleted file mode 100644
index b3c470f..0000000
--- a/kvm-include-hw-vfio-vfio-device.h-fix-include-header-gua.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 0ef36c50a10a90628980e19df4affe14deca26b9 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:36 +0100
-Subject: [PATCH 079/116] include/hw/vfio/vfio-device.h: fix include header
- guard name
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [63/100] e6ec128a610db62fe58971f5b15f01924e74a3a1 (rovick1/qemu-kvm)
-
-The header guard was incorrectly called HW_VFIO_VFIO_COMMON_H instead of
-HW_VFIO_VFIO_DEVICE_H.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-29-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 7c773b4267ae10820ed5e3ec6b15219b39dbcebd)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- include/hw/vfio/vfio-device.h | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h
-index 28047a6339..dac305fc6f 100644
---- a/include/hw/vfio/vfio-device.h
-+++ b/include/hw/vfio/vfio-device.h
-@@ -18,8 +18,8 @@
- * Copyright (C) 2008, IBM, Muli Ben-Yehuda (muli@il.ibm.com)
- */
-
--#ifndef HW_VFIO_VFIO_COMMON_H
--#define HW_VFIO_VFIO_COMMON_H
-+#ifndef HW_VFIO_VFIO_DEVICE_H
-+#define HW_VFIO_VFIO_DEVICE_H
-
- #include "system/memory.h"
- #include "qemu/queue.h"
-@@ -289,4 +289,4 @@ void vfio_device_init(VFIODevice *vbasedev, int type, VFIODeviceOps *ops,
- int vfio_device_get_aw_bits(VFIODevice *vdev);
-
- void vfio_kvm_device_close(void);
--#endif /* HW_VFIO_VFIO_COMMON_H */
-+#endif /* HW_VFIO_VFIO_DEVICE_H */
---
-2.52.0
-
diff --git a/kvm-io-fix-use-after-free-in-websocket-handshake-code.patch b/kvm-io-fix-use-after-free-in-websocket-handshake-code.patch
deleted file mode 100644
index 5c59ad0..0000000
--- a/kvm-io-fix-use-after-free-in-websocket-handshake-code.patch
+++ /dev/null
@@ -1,189 +0,0 @@
-From 728cf99416aaaae2cc0fca6ee88f28ccec33d697 Mon Sep 17 00:00:00 2001
-From: Jon Maloy <jmaloy@redhat.com>
-Date: Tue, 4 Nov 2025 17:28:47 -0500
-Subject: [PATCH 02/16] io: fix use after free in websocket handshake code
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Jon Maloy <jmaloy@redhat.com>
-RH-MergeRequest: 419: io: move websock resource release to close method
-RH-Jira: RHEL-120116
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/2] acdb5414387815a8b2f0a84a151990875947e855 (jmaloy/jmaloy-qemu-kvm-2)
-
-JIRA: https://issues.redhat.com/browse/RHEL-120116
-CVE: CVE-2025-11234
-
-commit b7a1f2ca45c7865b9e98e02ae605a65fc9458ae9
-Author: Daniel P. Berrangé <berrange@redhat.com>
-Date: Tue Sep 30 12:03:15 2025 +0100
-
- io: fix use after free in websocket handshake code
-
- If the QIOChannelWebsock object is freed while it is waiting to
- complete a handshake, a GSource is leaked. This can lead to the
- callback firing later on and triggering a use-after-free in the
- use of the channel. This was observed in the VNC server with the
- following trace from valgrind:
-
- ==2523108== Invalid read of size 4
- ==2523108== at 0x4054A24: vnc_disconnect_start (vnc.c:1296)
- ==2523108== by 0x4054A24: vnc_client_error (vnc.c:1392)
- ==2523108== by 0x4068A09: vncws_handshake_done (vnc-ws.c:105)
- ==2523108== by 0x44863B4: qio_task_complete (task.c:197)
- ==2523108== by 0x448343D: qio_channel_websock_handshake_io (channel-websock.c:588)
- ==2523108== by 0x6EDB862: UnknownInlinedFun (gmain.c:3398)
- ==2523108== by 0x6EDB862: g_main_context_dispatch_unlocked.lto_priv.0 (gmain.c:4249)
- ==2523108== by 0x6EDBAE4: g_main_context_dispatch (gmain.c:4237)
- ==2523108== by 0x45EC79F: glib_pollfds_poll (main-loop.c:287)
- ==2523108== by 0x45EC79F: os_host_main_loop_wait (main-loop.c:310)
- ==2523108== by 0x45EC79F: main_loop_wait (main-loop.c:589)
- ==2523108== by 0x423A56D: qemu_main_loop (runstate.c:835)
- ==2523108== by 0x454F300: qemu_default_main (main.c:37)
- ==2523108== by 0x73D6574: (below main) (libc_start_call_main.h:58)
- ==2523108== Address 0x57a6e0dc is 28 bytes inside a block of size 103,608 free'd
- ==2523108== at 0x5F2FE43: free (vg_replace_malloc.c:989)
- ==2523108== by 0x6EDC444: g_free (gmem.c:208)
- ==2523108== by 0x4053F23: vnc_update_client (vnc.c:1153)
- ==2523108== by 0x4053F23: vnc_refresh (vnc.c:3225)
- ==2523108== by 0x4042881: dpy_refresh (console.c:880)
- ==2523108== by 0x4042881: gui_update (console.c:90)
- ==2523108== by 0x45EFA1B: timerlist_run_timers.part.0 (qemu-timer.c:562)
- ==2523108== by 0x45EFC8F: timerlist_run_timers (qemu-timer.c:495)
- ==2523108== by 0x45EFC8F: qemu_clock_run_timers (qemu-timer.c:576)
- ==2523108== by 0x45EFC8F: qemu_clock_run_all_timers (qemu-timer.c:663)
- ==2523108== by 0x45EC765: main_loop_wait (main-loop.c:600)
- ==2523108== by 0x423A56D: qemu_main_loop (runstate.c:835)
- ==2523108== by 0x454F300: qemu_default_main (main.c:37)
- ==2523108== by 0x73D6574: (below main) (libc_start_call_main.h:58)
- ==2523108== Block was alloc'd at
- ==2523108== at 0x5F343F3: calloc (vg_replace_malloc.c:1675)
- ==2523108== by 0x6EE2F81: g_malloc0 (gmem.c:133)
- ==2523108== by 0x4057DA3: vnc_connect (vnc.c:3245)
- ==2523108== by 0x448591B: qio_net_listener_channel_func (net-listener.c:54)
- ==2523108== by 0x6EDB862: UnknownInlinedFun (gmain.c:3398)
- ==2523108== by 0x6EDB862: g_main_context_dispatch_unlocked.lto_priv.0 (gmain.c:4249)
- ==2523108== by 0x6EDBAE4: g_main_context_dispatch (gmain.c:4237)
- ==2523108== by 0x45EC79F: glib_pollfds_poll (main-loop.c:287)
- ==2523108== by 0x45EC79F: os_host_main_loop_wait (main-loop.c:310)
- ==2523108== by 0x45EC79F: main_loop_wait (main-loop.c:589)
- ==2523108== by 0x423A56D: qemu_main_loop (runstate.c:835)
- ==2523108== by 0x454F300: qemu_default_main (main.c:37)
- ==2523108== by 0x73D6574: (below main) (libc_start_call_main.h:58)
- ==2523108==
-
- The above can be reproduced by launching QEMU with
-
- $ qemu-system-x86_64 -vnc localhost:0,websocket=5700
-
- and then repeatedly running:
-
- for i in {1..100}; do
- (echo -n "GET / HTTP/1.1" && sleep 0.05) | nc -w 1 localhost 5700 &
- done
-
- CVE-2025-11234
- Reported-by: Grant Millar | Cylo <rid@cylo.io>
- Reviewed-by: Eric Blake <eblake@redhat.com>
- Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-
-Signed-off-by: Jon Maloy <jmaloy@redhat.com>
----
- include/io/channel-websock.h | 3 ++-
- io/channel-websock.c | 22 ++++++++++++++++------
- 2 files changed, 18 insertions(+), 7 deletions(-)
-
-diff --git a/include/io/channel-websock.h b/include/io/channel-websock.h
-index e180827c57..6700cf8946 100644
---- a/include/io/channel-websock.h
-+++ b/include/io/channel-websock.h
-@@ -61,7 +61,8 @@ struct QIOChannelWebsock {
- size_t payload_remain;
- size_t pong_remain;
- QIOChannelWebsockMask mask;
-- guint io_tag;
-+ guint hs_io_tag; /* tracking handshake task */
-+ guint io_tag; /* tracking watch task */
- Error *io_err;
- gboolean io_eof;
- uint8_t opcode;
-diff --git a/io/channel-websock.c b/io/channel-websock.c
-index a19b902ff9..ec5e09f9ab 100644
---- a/io/channel-websock.c
-+++ b/io/channel-websock.c
-@@ -545,6 +545,7 @@ static gboolean qio_channel_websock_handshake_send(QIOChannel *ioc,
- trace_qio_channel_websock_handshake_fail(ioc, error_get_pretty(err));
- qio_task_set_error(task, err);
- qio_task_complete(task);
-+ wioc->hs_io_tag = 0;
- return FALSE;
- }
-
-@@ -560,6 +561,7 @@ static gboolean qio_channel_websock_handshake_send(QIOChannel *ioc,
- trace_qio_channel_websock_handshake_complete(ioc);
- qio_task_complete(task);
- }
-+ wioc->hs_io_tag = 0;
- return FALSE;
- }
- trace_qio_channel_websock_handshake_pending(ioc, G_IO_OUT);
-@@ -586,6 +588,7 @@ static gboolean qio_channel_websock_handshake_io(QIOChannel *ioc,
- trace_qio_channel_websock_handshake_fail(ioc, error_get_pretty(err));
- qio_task_set_error(task, err);
- qio_task_complete(task);
-+ wioc->hs_io_tag = 0;
- return FALSE;
- }
- if (ret == 0) {
-@@ -597,7 +600,7 @@ static gboolean qio_channel_websock_handshake_io(QIOChannel *ioc,
- error_propagate(&wioc->io_err, err);
-
- trace_qio_channel_websock_handshake_reply(ioc);
-- qio_channel_add_watch(
-+ wioc->hs_io_tag = qio_channel_add_watch(
- wioc->master,
- G_IO_OUT,
- qio_channel_websock_handshake_send,
-@@ -907,11 +910,12 @@ void qio_channel_websock_handshake(QIOChannelWebsock *ioc,
-
- trace_qio_channel_websock_handshake_start(ioc);
- trace_qio_channel_websock_handshake_pending(ioc, G_IO_IN);
-- qio_channel_add_watch(ioc->master,
-- G_IO_IN,
-- qio_channel_websock_handshake_io,
-- task,
-- NULL);
-+ ioc->hs_io_tag = qio_channel_add_watch(
-+ ioc->master,
-+ G_IO_IN,
-+ qio_channel_websock_handshake_io,
-+ task,
-+ NULL);
- }
-
-
-@@ -922,6 +926,9 @@ static void qio_channel_websock_finalize(Object *obj)
- buffer_free(&ioc->encinput);
- buffer_free(&ioc->encoutput);
- buffer_free(&ioc->rawinput);
-+ if (ioc->hs_io_tag) {
-+ g_source_remove(ioc->hs_io_tag);
-+ }
- if (ioc->io_tag) {
- g_source_remove(ioc->io_tag);
- }
-@@ -1222,6 +1229,9 @@ static int qio_channel_websock_close(QIOChannel *ioc,
- buffer_free(&wioc->encinput);
- buffer_free(&wioc->encoutput);
- buffer_free(&wioc->rawinput);
-+ if (wioc->hs_io_tag) {
-+ g_clear_handle_id(&wioc->hs_io_tag, g_source_remove);
-+ }
- if (wioc->io_tag) {
- g_clear_handle_id(&wioc->io_tag, g_source_remove);
- }
---
-2.47.3
-
diff --git a/kvm-io-move-websock-resource-release-to-close-method.patch b/kvm-io-move-websock-resource-release-to-close-method.patch
deleted file mode 100644
index 052a53e..0000000
--- a/kvm-io-move-websock-resource-release-to-close-method.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From 9aaede253bb55035f0a1171fb1c4eda847ca9493 Mon Sep 17 00:00:00 2001
-From: Jon Maloy <jmaloy@redhat.com>
-Date: Tue, 4 Nov 2025 17:23:29 -0500
-Subject: [PATCH 01/16] io: move websock resource release to close method
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Jon Maloy <jmaloy@redhat.com>
-RH-MergeRequest: 419: io: move websock resource release to close method
-RH-Jira: RHEL-120116
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/2] ca3067b2afed8d770626436b77fdd90bd5cb22e7 (jmaloy/jmaloy-qemu-kvm-2)
-
-JIRA: https://issues.redhat.com/browse/RHEL-120116
-CVE: CVE-2025-11234
-
-commit 322c3c4f3abee616a18b3bfe563ec29dd67eae63
-Author: Daniel P. Berrangé <berrange@redhat.com>
-Date: Tue Sep 30 11:58:35 2025 +0100
-
- io: move websock resource release to close method
-
- The QIOChannelWebsock object releases all its resources in the
- finalize callback. This is later than desired, as callers expect
- to be able to call qio_channel_close() to fully close a channel
- and release resources related to I/O.
-
- The logic in the finalize method is at most a failsafe to handle
- cases where a consumer forgets to call qio_channel_close.
-
- This adds equivalent logic to the close method to release the
- resources, using g_clear_handle_id/g_clear_pointer to be robust
- against repeated invocations. The finalize method is tweaked
- so that the GSource is removed before releasing the underlying
- channel.
-
- Reviewed-by: Eric Blake <eblake@redhat.com>
- Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-
-Signed-off-by: Jon Maloy <jmaloy@redhat.com>
----
- io/channel-websock.c | 11 ++++++++++-
- 1 file changed, 10 insertions(+), 1 deletion(-)
-
-diff --git a/io/channel-websock.c b/io/channel-websock.c
-index 08ddb274f0..a19b902ff9 100644
---- a/io/channel-websock.c
-+++ b/io/channel-websock.c
-@@ -922,13 +922,13 @@ static void qio_channel_websock_finalize(Object *obj)
- buffer_free(&ioc->encinput);
- buffer_free(&ioc->encoutput);
- buffer_free(&ioc->rawinput);
-- object_unref(OBJECT(ioc->master));
- if (ioc->io_tag) {
- g_source_remove(ioc->io_tag);
- }
- if (ioc->io_err) {
- error_free(ioc->io_err);
- }
-+ object_unref(OBJECT(ioc->master));
- }
-
-
-@@ -1219,6 +1219,15 @@ static int qio_channel_websock_close(QIOChannel *ioc,
- QIOChannelWebsock *wioc = QIO_CHANNEL_WEBSOCK(ioc);
-
- trace_qio_channel_websock_close(ioc);
-+ buffer_free(&wioc->encinput);
-+ buffer_free(&wioc->encoutput);
-+ buffer_free(&wioc->rawinput);
-+ if (wioc->io_tag) {
-+ g_clear_handle_id(&wioc->io_tag, g_source_remove);
-+ }
-+ if (wioc->io_err) {
-+ g_clear_pointer(&wioc->io_err, error_free);
-+ }
- return qio_channel_close(wioc->master, errp);
- }
-
---
-2.47.3
-
diff --git a/kvm-io-uring-Resubmit-tails-of-short-writes.patch b/kvm-io-uring-Resubmit-tails-of-short-writes.patch
deleted file mode 100644
index 378e5af..0000000
--- a/kvm-io-uring-Resubmit-tails-of-short-writes.patch
+++ /dev/null
@@ -1,278 +0,0 @@
-From 1bdac2a8c4ac77133cb0c2b4d40819bff1a35fc4 Mon Sep 17 00:00:00 2001
-From: Hanna Czenczek <hreitz@redhat.com>
-Date: Tue, 24 Mar 2026 09:43:36 +0100
-Subject: [PATCH 4/4] io-uring: Resubmit tails of short writes
-
-RH-Author: Hanna Czenczek <hreitz@redhat.com>
-RH-MergeRequest: 479: linux-aio/io-uring: Resubmit tails of short requests
-RH-Jira: RHEL-158224
-RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [4/4] 7ff66622acbb5dbdbacafe71bffd0a277ac919d9 (hreitz/qemu-kvm-c-9-s)
-
-Short writes can happen, too, not just short reads. The difference to
-aio=native is that the kernel will actually retry the tail of short
-requests internally already -- so it is harder to reproduce. But if the
-tail of a short request returns an error to the kernel, we will see it
-in userspace still. To reproduce this, apply the following patch on top
-of the one shown in HEAD^ (again %s/escaped // to apply):
-
-escaped diff --git a/block/export/fuse.c b/block/export/fuse.c
-escaped index 67dc50a412..2b98489a32 100644
-escaped --- a/block/export/fuse.c
-escaped +++ b/block/export/fuse.c
-@@ -1059,8 +1059,15 @@ fuse_co_read(FuseExport *exp, void **bufptr, uint64_t offset, uint32_t size)
- int64_t blk_len;
- void *buf;
- int ret;
-+ static uint32_t error_size;
-
-- size = MIN(size, 4096);
-+ if (error_size == size) {
-+ error_size = 0;
-+ return -EIO;
-+ } else if (size > 4096) {
-+ error_size = size - 4096;
-+ size = 4096;
-+ }
-
- /* Limited by max_read, should not happen */
- if (size > FUSE_MAX_READ_BYTES) {
-@@ -1111,8 +1118,15 @@ fuse_co_write(FuseExport *exp, struct fuse_write_out *out,
- {
- int64_t blk_len;
- int ret;
-+ static uint32_t error_size;
-
-- size = MIN(size, 4096);
-+ if (error_size == size) {
-+ error_size = 0;
-+ return -EIO;
-+ } else if (size > 4096) {
-+ error_size = size - 4096;
-+ size = 4096;
-+ }
-
- QEMU_BUILD_BUG_ON(FUSE_MAX_WRITE_BYTES > BDRV_REQUEST_MAX_BYTES);
- /* Limited by max_write, should not happen */
-
-I know this is a bit artificial because to produce this, there must be
-an I/O error somewhere anyway, but if it does happen, qemu will
-understand it to mean ENOSPC for short writes, which is incorrect. So I
-believe we need to resubmit the tail to maybe have it succeed now, or at
-least get the correct error code.
-
-Reproducer as before:
-$ ./qemu-img create -f raw test.raw 8k
-Formatting 'test.raw', fmt=raw size=8192
-$ ./qemu-io -f raw -c 'write -P 42 0 8k' test.raw
-wrote 8192/8192 bytes at offset 0
-8 KiB, 1 ops; 00.00 sec (64.804 MiB/sec and 8294.9003 ops/sec)
-$ hexdump -C test.raw
-00000000 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |****************|
-*
-00002000
-$ storage-daemon/qemu-storage-daemon \
- --blockdev file,node-name=test,filename=test.raw \
- --export fuse,id=exp,node-name=test,mountpoint=test.raw,writable=true
-
-$ ./qemu-io --image-opts -c 'read -P 23 0 8k' \
- driver=file,filename=test.raw,cache.direct=on,aio=io_uring
-read 8192/8192 bytes at offset 0
-8 KiB, 1 ops; 00.00 sec (58.481 MiB/sec and 7485.5342 ops/sec)
-$ ./qemu-io --image-opts -c 'write -P 23 0 8k' \
- driver=file,filename=test.raw,cache.direct=on,aio=io_uring
-write failed: No space left on device
-$ hexdump -C test.raw
-00000000 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 |................|
-*
-00001000 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |****************|
-*
-00002000
-
-So short reads already work (because there is code for that), but short
-writes incorrectly produce ENOSPC. This patch fixes that by
-resubmitting not only the tail of short reads but short writes also.
-
-(And this patch uses the opportunity to make it so qemu_iovec_destroy()
-is called only if req->resubmit_qiov.iov is non-NULL. Functionally a
-non-op, but this is how the code generally checks whether the
-resubmit_qiov has been set up or not.)
-
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-Message-ID: <20260324084338.37453-4-hreitz@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit cf9cdaea6e24d13dfdf8402f6829d2ca4dca864b)
-
-Conflicts:
-- block/io_uring.c, block/trace-events
- Missing 047dabef97bd0c4af3c3dc453b19e20345de3602 ("block/io_uring: use
- aio_add_sqe()") downstream, which changed quite a few things about the
- io-uring code. Backporting it seems excessive, though, especially
- given that it would pull in even more dependencies (general aio and
- aio-posix changes that come right before 047dabef).
-
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
----
- block/io_uring.c | 77 +++++++++++++++++++++++++---------------------
- block/trace-events | 2 +-
- 2 files changed, 43 insertions(+), 36 deletions(-)
-
-diff --git a/block/io_uring.c b/block/io_uring.c
-index 5dbafc8f7b..582550f8e9 100644
---- a/block/io_uring.c
-+++ b/block/io_uring.c
-@@ -31,14 +31,14 @@ typedef struct LuringAIOCB {
- struct io_uring_sqe sqeq;
- ssize_t ret;
- QEMUIOVector *qiov;
-- bool is_read;
-+ int type;
- QSIMPLEQ_ENTRY(LuringAIOCB) next;
-
- /*
-- * Buffered reads may require resubmission, see
-- * luring_resubmit_short_read().
-+ * Short reads/writes require resubmission, see
-+ * luring_resubmit_short_io().
- */
-- int total_read;
-+ int total_done;
- QEMUIOVector resubmit_qiov;
- } LuringAIOCB;
-
-@@ -73,22 +73,27 @@ static void luring_resubmit(LuringState *s, LuringAIOCB *luringcb)
- }
-
- /**
-- * luring_resubmit_short_read:
-+ * luring_resubmit_short_io:
- *
-- * Short reads are rare but may occur. The remaining read request needs to be
-- * resubmitted.
-+ * Short reads and writes are rare but may occur. The remaining request needs
-+ * to be resubmitted.
-+ *
-+ * For example, short reads can be reproduced by a FUSE export deliberately
-+ * executing short reads. The tail of short writes is generally resubmitted by
-+ * io-uring in the kernel, but if that resubmission encounters an I/O error, the
-+ * already submitted portion will be returned as a short write.
- */
--static void luring_resubmit_short_read(LuringState *s, LuringAIOCB *luringcb,
-- int nread)
-+static void luring_resubmit_short_io(LuringState *s, LuringAIOCB *luringcb,
-+ int ndone)
- {
- QEMUIOVector *resubmit_qiov;
- size_t remaining;
-
-- trace_luring_resubmit_short_read(s, luringcb, nread);
-+ trace_luring_resubmit_short_io(s, luringcb, ndone);
-
-- /* Update read position */
-- luringcb->total_read += nread;
-- remaining = luringcb->qiov->size - luringcb->total_read;
-+ /* Update I/O position */
-+ luringcb->total_done += ndone;
-+ remaining = luringcb->qiov->size - luringcb->total_done;
-
- /* Shorten qiov */
- resubmit_qiov = &luringcb->resubmit_qiov;
-@@ -97,11 +102,11 @@ static void luring_resubmit_short_read(LuringState *s, LuringAIOCB *luringcb,
- } else {
- qemu_iovec_reset(resubmit_qiov);
- }
-- qemu_iovec_concat(resubmit_qiov, luringcb->qiov, luringcb->total_read,
-+ qemu_iovec_concat(resubmit_qiov, luringcb->qiov, luringcb->total_done,
- remaining);
-
- /* Update sqe */
-- luringcb->sqeq.off += nread;
-+ luringcb->sqeq.off += ndone;
- luringcb->sqeq.addr = (uintptr_t)luringcb->resubmit_qiov.iov;
- luringcb->sqeq.len = luringcb->resubmit_qiov.niov;
-
-@@ -165,8 +170,8 @@ static bool luring_process_completions(LuringState *s)
- s->io_q.in_flight--;
- trace_luring_process_completion(s, luringcb, ret);
-
-- /* total_read is non-zero only for resubmitted read requests */
-- total_bytes = ret + luringcb->total_read;
-+ /* total_done is non-zero only for resubmitted requests */
-+ total_bytes = ret + luringcb->total_done;
-
- if (ret < 0) {
- /*
-@@ -192,27 +197,29 @@ static bool luring_process_completions(LuringState *s)
- goto end;
- } else if (total_bytes == luringcb->qiov->size) {
- ret = 0;
-- /* Only read/write */
-+ } else if (ret > 0 && (luringcb->type == QEMU_AIO_READ ||
-+ luringcb->type == QEMU_AIO_WRITE)) {
-+ luring_resubmit_short_io(s, luringcb, ret);
-+ resubmit = true;
-+ continue;
-+ } else if (luringcb->type == QEMU_AIO_READ) {
-+ /* Read ret == 0: EOF, pad with zeroes */
-+ qemu_iovec_memset(luringcb->qiov, total_bytes, 0,
-+ luringcb->qiov->size - total_bytes);
-+ ret = 0;
- } else {
-- /* Short Read/Write */
-- if (luringcb->is_read) {
-- if (ret > 0) {
-- luring_resubmit_short_read(s, luringcb, ret);
-- resubmit = true;
-- continue;
-- } else {
-- /* Pad with zeroes */
-- qemu_iovec_memset(luringcb->qiov, total_bytes, 0,
-- luringcb->qiov->size - total_bytes);
-- ret = 0;
-- }
-- } else {
-- ret = -ENOSPC;
-- }
-+ /*
-+ * Normal write ret == 0 means ENOSPC.
-+ * For zone-append, we treat any 0 <= ret < qiov->size as ENOSPC,
-+ * too, because resubmitting the tail seems a little unsafe.
-+ */
-+ ret = -ENOSPC;
- }
- end:
- luringcb->ret = ret;
-- qemu_iovec_destroy(&luringcb->resubmit_qiov);
-+ if (luringcb->resubmit_qiov.iov) {
-+ qemu_iovec_destroy(&luringcb->resubmit_qiov);
-+ }
-
- /*
- * If the coroutine is already entered it must be in ioq_submit()
-@@ -409,7 +416,7 @@ int coroutine_fn luring_co_submit(BlockDriverState *bs, int fd, uint64_t offset,
- .co = qemu_coroutine_self(),
- .ret = -EINPROGRESS,
- .qiov = qiov,
-- .is_read = (type == QEMU_AIO_READ),
-+ .type = type,
- };
- trace_luring_co_submit(bs, s, &luringcb, fd, offset, qiov ? qiov->size : 0,
- type);
-diff --git a/block/trace-events b/block/trace-events
-index 8e789e1f12..99b8c12bc8 100644
---- a/block/trace-events
-+++ b/block/trace-events
-@@ -70,7 +70,7 @@ luring_do_submit_done(void *s, int ret) "LuringState %p submitted to kernel %d"
- luring_co_submit(void *bs, void *s, void *luringcb, int fd, uint64_t offset, size_t nbytes, int type) "bs %p s %p luringcb %p fd %d offset %" PRId64 " nbytes %zd type %d"
- luring_process_completion(void *s, void *aiocb, int ret) "LuringState %p luringcb %p ret %d"
- luring_io_uring_submit(void *s, int ret) "LuringState %p ret %d"
--luring_resubmit_short_read(void *s, void *luringcb, int nread) "LuringState %p luringcb %p nread %d"
-+luring_resubmit_short_io(void *s, void *luringcb, int ndone) "LuringState %p luringcb %p ndone %d"
-
- # qcow2.c
- qcow2_add_task(void *co, void *bs, void *pool, const char *action, int cluster_type, uint64_t host_offset, uint64_t offset, uint64_t bytes, void *qiov, size_t qiov_offset) "co %p bs %p pool %p: %s: cluster_type %d file_cluster_offset %" PRIu64 " offset %" PRIu64 " bytes %" PRIu64 " qiov %p qiov_offset %zu"
---
-2.47.3
-
diff --git a/kvm-iommufd-Introduce-handler-for-device-ATS-support.patch b/kvm-iommufd-Introduce-handler-for-device-ATS-support.patch
deleted file mode 100644
index 3a1f333..0000000
--- a/kvm-iommufd-Introduce-handler-for-device-ATS-support.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From 16aab08bd11689bf6dc24007586b7de17b47c517 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Tue, 23 Jun 2026 13:49:41 -0700
-Subject: [PATCH 29/30] iommufd: Introduce handler for device ATS support
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 508: ATS support backport
-RH-Jira: RHEL-184675
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/2] 1cd2956e8fc0254ed437ee63807309803b23b4c6 (rovick1/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-184675
-
-Additional changes: Added IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED to headers.
-
-Introduce a support_ats() handler that returns whether ATS is supported
-for a device associated with a host IOMMU device, checking if the
-IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED capability bit is set.
-
-Implement this handler in a new function for iommufd.
-
-Suggested-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Link: https://lore.kernel.org/qemu-devel/20260623204943.989903-2-nathanc@nvidia.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 6befa5527418bcece6a81adb5e047bae43b733bf)
-Signed-off-by: Rodolfo Vick <rovick@redhat.com>
----
- backends/iommufd.c | 8 ++++++++
- include/system/host_iommu_device.h | 9 +++++++++
- linux-headers/linux/iommufd.h | 4 ++++
- 3 files changed, 21 insertions(+)
-
-diff --git a/backends/iommufd.c b/backends/iommufd.c
-index e457173da5..3fe18d0fa9 100644
---- a/backends/iommufd.c
-+++ b/backends/iommufd.c
-@@ -633,6 +633,13 @@ static int hiod_iommufd_get_cap(HostIOMMUDevice *hiod, int cap, Error **errp)
- }
- }
-
-+static bool hiod_iommufd_support_ats(HostIOMMUDevice *hiod)
-+{
-+ HostIOMMUDeviceCaps *caps = &hiod->caps;
-+
-+ return !(caps->hw_caps & IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED);
-+}
-+
- static bool hiod_iommufd_get_pasid_info(HostIOMMUDevice *hiod,
- PasidInfo *pasid_info)
- {
-@@ -655,6 +662,7 @@ static void hiod_iommufd_class_init(ObjectClass *oc, const void *data)
-
- hiodc->get_cap = hiod_iommufd_get_cap;
- hiodc->get_pasid_info = hiod_iommufd_get_pasid_info;
-+ hiodc->support_ats = hiod_iommufd_support_ats;
- };
-
- static const TypeInfo types[] = {
-diff --git a/include/system/host_iommu_device.h b/include/system/host_iommu_device.h
-index f000301583..2cb5365340 100644
---- a/include/system/host_iommu_device.h
-+++ b/include/system/host_iommu_device.h
-@@ -133,6 +133,15 @@ struct HostIOMMUDeviceClass {
- * Returns: true on success, false on failure.
- */
- bool (*get_pasid_info)(HostIOMMUDevice *hiod, PasidInfo *pasid_info);
-+ /**
-+ * @support_ats: Returns true if ATS can be used by the device,
-+ * false if the host IOMMU reports it is unavailable.
-+ *
-+ * @hiod: handle to the host IOMMU device
-+ *
-+ * Returns: true if ATS is supported, false otherwise
-+ */
-+ bool (*support_ats)(HostIOMMUDevice *hiod);
- };
-
- /*
-diff --git a/linux-headers/linux/iommufd.h b/linux-headers/linux/iommufd.h
-index 384183a403..8ca467b380 100644
---- a/linux-headers/linux/iommufd.h
-+++ b/linux-headers/linux/iommufd.h
-@@ -656,11 +656,15 @@ enum iommu_hw_info_type {
- * @IOMMU_HW_CAP_PCI_PASID_PRIV: Privileged Mode Supported, user ignores it
- * when the struct
- * iommu_hw_info::out_max_pasid_log2 is zero.
-+ * @IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED: ATS is not supported or cannot be used
-+ * on this device (absence implies ATS
-+ * may be enabled)
- */
- enum iommufd_hw_capabilities {
- IOMMU_HW_CAP_DIRTY_TRACKING = 1 << 0,
- IOMMU_HW_CAP_PCI_PASID_EXEC = 1 << 1,
- IOMMU_HW_CAP_PCI_PASID_PRIV = 1 << 2,
-+ IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED = 1 << 3,
- };
-
- /**
---
-2.52.0
-
diff --git a/kvm-iommufd-Rename-all-the-idev-and-idevc-variables-to-h.patch b/kvm-iommufd-Rename-all-the-idev-and-idevc-variables-to-h.patch
deleted file mode 100644
index e59912d..0000000
--- a/kvm-iommufd-Rename-all-the-idev-and-idevc-variables-to-h.patch
+++ /dev/null
@@ -1,541 +0,0 @@
-From dfeee0ad5c9325945c72b82155e0cc883c102807 Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Wed, 1 Apr 2026 04:03:53 -0400
-Subject: [PATCH 079/111] iommufd: Rename all the idev and idevc variables to
- hiod and hiodc
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [79/111] 70fe97a5913b2acb2888d3e45ef07226716f37a3 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Conflicts: contextual conflict in hw/i386/intel_iommu_accel.c since
-we do not have accel intel iommu. Ignore changes in this file.
-
-We used idev and idevc naming for HostIOMMUDeviceIOMMUFD and corresponding
-class variables which followed the iommufd_device naming in linux kernel.
-
-This is mixed with the hiod naming for base type HostIOMMUDevice. Rename
-HostIOMMUDeviceIOMMUFD* to hiodi* for consistency in QEMU.
-
-No functional change intended.
-
-Suggested-by: Cédric Le Goater <clg@redhat.com>
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20260401080354.1347212-1-zhenzhong.duan@intel.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit e2b7310276087351fadd6afbe9e5a3fff9c25f8d)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- backends/iommufd.c | 26 +++++------
- hw/arm/smmuv3-accel.c | 93 +++++++++++++++++++-------------------
- hw/arm/smmuv3-accel.h | 2 +-
- hw/vfio/container-legacy.c | 10 ++--
- hw/vfio/iommufd.c | 24 +++++-----
- include/system/iommufd.h | 12 ++---
- 6 files changed, 84 insertions(+), 83 deletions(-)
-
-diff --git a/backends/iommufd.c b/backends/iommufd.c
-index 416e193751..b328f89699 100644
---- a/backends/iommufd.c
-+++ b/backends/iommufd.c
-@@ -541,24 +541,24 @@ bool iommufd_backend_alloc_veventq(IOMMUFDBackend *be, uint32_t viommu_id,
- return true;
- }
-
--bool host_iommu_device_iommufd_attach_hwpt(HostIOMMUDeviceIOMMUFD *idev,
-+bool host_iommu_device_iommufd_attach_hwpt(HostIOMMUDeviceIOMMUFD *hiodi,
- uint32_t hwpt_id, Error **errp)
- {
-- HostIOMMUDeviceIOMMUFDClass *idevc =
-- HOST_IOMMU_DEVICE_IOMMUFD_GET_CLASS(idev);
-+ HostIOMMUDeviceIOMMUFDClass *hiodic =
-+ HOST_IOMMU_DEVICE_IOMMUFD_GET_CLASS(hiodi);
-
-- g_assert(idevc->attach_hwpt);
-- return idevc->attach_hwpt(idev, hwpt_id, errp);
-+ g_assert(hiodic->attach_hwpt);
-+ return hiodic->attach_hwpt(hiodi, hwpt_id, errp);
- }
-
--bool host_iommu_device_iommufd_detach_hwpt(HostIOMMUDeviceIOMMUFD *idev,
-+bool host_iommu_device_iommufd_detach_hwpt(HostIOMMUDeviceIOMMUFD *hiodi,
- Error **errp)
- {
-- HostIOMMUDeviceIOMMUFDClass *idevc =
-- HOST_IOMMU_DEVICE_IOMMUFD_GET_CLASS(idev);
-+ HostIOMMUDeviceIOMMUFDClass *hiodic =
-+ HOST_IOMMU_DEVICE_IOMMUFD_GET_CLASS(hiodi);
-
-- g_assert(idevc->detach_hwpt);
-- return idevc->detach_hwpt(idev, errp);
-+ g_assert(hiodic->detach_hwpt);
-+ return hiodic->detach_hwpt(hiodi, errp);
- }
-
- static int hiod_iommufd_get_cap(HostIOMMUDevice *hiod, int cap, Error **errp)
-@@ -594,10 +594,10 @@ static bool hiod_iommufd_get_pasid_info(HostIOMMUDevice *hiod,
-
- static void hiod_iommufd_class_init(ObjectClass *oc, const void *data)
- {
-- HostIOMMUDeviceClass *hioc = HOST_IOMMU_DEVICE_CLASS(oc);
-+ HostIOMMUDeviceClass *hiodc = HOST_IOMMU_DEVICE_CLASS(oc);
-
-- hioc->get_cap = hiod_iommufd_get_cap;
-- hioc->get_pasid_info = hiod_iommufd_get_pasid_info;
-+ hiodc->get_cap = hiod_iommufd_get_cap;
-+ hiodc->get_pasid_info = hiod_iommufd_get_pasid_info;
- };
-
- static const TypeInfo types[] = {
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index f97129388f..163d3e7279 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -172,16 +172,16 @@ smmuv3_accel_check_hw_compatible(SMMUv3State *s,
- }
-
- static bool
--smmuv3_accel_hw_compatible(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
-+smmuv3_accel_hw_compatible(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *hiodi,
- Error **errp)
- {
- struct iommu_hw_info_arm_smmuv3 info;
- uint32_t data_type = IOMMU_HW_INFO_TYPE_DEFAULT;
- uint64_t caps;
-
-- if (!iommufd_backend_get_device_info(idev->iommufd, idev->devid, &data_type,
-- &info, sizeof(info), &caps, NULL,
-- errp)) {
-+ if (!iommufd_backend_get_device_info(hiodi->iommufd, hiodi->devid,
-+ &data_type, &info, sizeof(info), &caps,
-+ NULL, errp)) {
- return false;
- }
-
-@@ -225,15 +225,15 @@ static bool
- smmuv3_accel_alloc_vdev(SMMUv3AccelDevice *accel_dev, int sid, Error **errp)
- {
- SMMUv3AccelState *accel = accel_dev->s_accel;
-- HostIOMMUDeviceIOMMUFD *idev = accel_dev->idev;
-+ HostIOMMUDeviceIOMMUFD *hiodi = accel_dev->hiodi;
- IOMMUFDVdev *vdev = accel_dev->vdev;
- uint32_t vdevice_id;
-
-- if (!idev || vdev) {
-+ if (!hiodi || vdev) {
- return true;
- }
-
-- if (!iommufd_backend_alloc_vdev(idev->iommufd, idev->devid,
-+ if (!iommufd_backend_alloc_vdev(hiodi->iommufd, hiodi->devid,
- accel->viommu->viommu_id, sid,
- &vdevice_id, errp)) {
- return false;
-@@ -252,7 +252,7 @@ smmuv3_accel_dev_alloc_translate(SMMUv3AccelDevice *accel_dev, STE *ste,
- {
- uint64_t ste_0 = (uint64_t)ste->word[0] | (uint64_t)ste->word[1] << 32;
- uint64_t ste_1 = (uint64_t)ste->word[2] | (uint64_t)ste->word[3] << 32;
-- HostIOMMUDeviceIOMMUFD *idev = accel_dev->idev;
-+ HostIOMMUDeviceIOMMUFD *hiodi = accel_dev->hiodi;
- SMMUv3AccelState *accel = accel_dev->s_accel;
- struct iommu_hwpt_arm_smmuv3 nested_data = {
- .ste = {
-@@ -263,7 +263,7 @@ smmuv3_accel_dev_alloc_translate(SMMUv3AccelDevice *accel_dev, STE *ste,
- uint32_t hwpt_id = 0, flags = 0;
- SMMUS1Hwpt *s1_hwpt;
-
-- if (!iommufd_backend_alloc_hwpt(idev->iommufd, idev->devid,
-+ if (!iommufd_backend_alloc_hwpt(hiodi->iommufd, hiodi->devid,
- accel->viommu->viommu_id, flags,
- IOMMU_HWPT_DATA_ARM_SMMUV3,
- sizeof(nested_data), &nested_data,
-@@ -285,7 +285,7 @@ bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
- .inval_ste_allowed = true};
- SMMUv3AccelState *accel = s->s_accel;
- SMMUv3AccelDevice *accel_dev;
-- HostIOMMUDeviceIOMMUFD *idev;
-+ HostIOMMUDeviceIOMMUFD *hiodi;
- uint32_t config, hwpt_id = 0;
- SMMUS1Hwpt *s1_hwpt = NULL;
- const char *type;
-@@ -300,7 +300,7 @@ bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
- return true;
- }
-
-- idev = accel_dev->idev;
-+ hiodi = accel_dev->hiodi;
- if (!smmuv3_accel_alloc_vdev(accel_dev, sid, errp)) {
- return false;
- }
-@@ -343,9 +343,9 @@ bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
- return false;
- }
-
-- if (!host_iommu_device_iommufd_attach_hwpt(idev, hwpt_id, errp)) {
-+ if (!host_iommu_device_iommufd_attach_hwpt(hiodi, hwpt_id, errp)) {
- if (s1_hwpt) {
-- iommufd_backend_free_id(idev->iommufd, s1_hwpt->hwpt_id);
-+ iommufd_backend_free_id(hiodi->iommufd, s1_hwpt->hwpt_id);
- g_free(s1_hwpt);
- }
- return false;
-@@ -353,7 +353,7 @@ bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
-
- /* Free the previous s1_hwpt */
- if (accel_dev->s1_hwpt) {
-- iommufd_backend_free_id(idev->iommufd, accel_dev->s1_hwpt->hwpt_id);
-+ iommufd_backend_free_id(hiodi->iommufd, accel_dev->s1_hwpt->hwpt_id);
- g_free(accel_dev->s1_hwpt);
- }
-
-@@ -567,7 +567,7 @@ free_veventq:
- }
-
- static bool
--smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
-+smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *hiodi,
- Error **errp)
- {
- SMMUv3AccelState *accel = s->s_accel;
-@@ -577,11 +577,11 @@ smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- struct iommu_hwpt_arm_smmuv3 abort_data = {
- .ste = { SMMU_STE_VALID, 0x0ULL },
- };
-- uint32_t s2_hwpt_id = idev->hwpt_id;
-+ uint32_t s2_hwpt_id = hiodi->hwpt_id;
- uint32_t viommu_id, hwpt_id;
- IOMMUFDViommu *viommu;
-
-- if (!iommufd_backend_alloc_viommu(idev->iommufd, idev->devid,
-+ if (!iommufd_backend_alloc_viommu(hiodi->iommufd, hiodi->devid,
- IOMMU_VIOMMU_TYPE_ARM_SMMUV3,
- s2_hwpt_id, &viommu_id, errp)) {
- return false;
-@@ -590,21 +590,21 @@ smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- viommu = g_new0(IOMMUFDViommu, 1);
- viommu->viommu_id = viommu_id;
- viommu->s2_hwpt_id = s2_hwpt_id;
-- viommu->iommufd = idev->iommufd;
-+ viommu->iommufd = hiodi->iommufd;
- accel->viommu = viommu;
-
- /*
- * Pre-allocate HWPTs for S1 bypass and abort cases. These will be attached
- * later for guest STEs or GBPAs that require bypass or abort configuration.
- */
-- if (!iommufd_backend_alloc_hwpt(idev->iommufd, idev->devid, viommu_id,
-+ if (!iommufd_backend_alloc_hwpt(hiodi->iommufd, hiodi->devid, viommu_id,
- 0, IOMMU_HWPT_DATA_ARM_SMMUV3,
- sizeof(abort_data), &abort_data,
- &accel->abort_hwpt_id, errp)) {
- goto free_viommu;
- }
-
-- if (!iommufd_backend_alloc_hwpt(idev->iommufd, idev->devid, viommu_id,
-+ if (!iommufd_backend_alloc_hwpt(hiodi->iommufd, hiodi->devid, viommu_id,
- 0, IOMMU_HWPT_DATA_ARM_SMMUV3,
- sizeof(bypass_data), &bypass_data,
- &accel->bypass_hwpt_id, errp)) {
-@@ -618,7 +618,7 @@ smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
-
- /* Attach a HWPT based on SMMUv3 GBPA.ABORT value */
- hwpt_id = smmuv3_accel_gbpa_hwpt(s, accel);
-- if (!host_iommu_device_iommufd_attach_hwpt(idev, hwpt_id, errp)) {
-+ if (!host_iommu_device_iommufd_attach_hwpt(hiodi, hwpt_id, errp)) {
- goto free_veventq;
- }
- return true;
-@@ -626,11 +626,11 @@ smmuv3_accel_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
- free_veventq:
- smmuv3_accel_free_veventq(accel);
- free_bypass_hwpt:
-- iommufd_backend_free_id(idev->iommufd, accel->bypass_hwpt_id);
-+ iommufd_backend_free_id(hiodi->iommufd, accel->bypass_hwpt_id);
- free_abort_hwpt:
-- iommufd_backend_free_id(idev->iommufd, accel->abort_hwpt_id);
-+ iommufd_backend_free_id(hiodi->iommufd, accel->abort_hwpt_id);
- free_viommu:
-- iommufd_backend_free_id(idev->iommufd, viommu->viommu_id);
-+ iommufd_backend_free_id(hiodi->iommufd, viommu->viommu_id);
- g_free(viommu);
- accel->viommu = NULL;
- return false;
-@@ -639,20 +639,20 @@ free_viommu:
- static bool smmuv3_accel_set_iommu_device(PCIBus *bus, void *opaque, int devfn,
- HostIOMMUDevice *hiod, Error **errp)
- {
-- HostIOMMUDeviceIOMMUFD *idev = HOST_IOMMU_DEVICE_IOMMUFD(hiod);
-+ HostIOMMUDeviceIOMMUFD *hiodi = HOST_IOMMU_DEVICE_IOMMUFD(hiod);
- SMMUState *bs = opaque;
- SMMUv3State *s = ARM_SMMUV3(bs);
- SMMUPciBus *sbus = smmu_get_sbus(bs, bus);
- SMMUv3AccelDevice *accel_dev = smmuv3_accel_get_dev(bs, sbus, bus, devfn);
-
-- if (!idev) {
-+ if (!hiodi) {
- return true;
- }
-
-- if (accel_dev->idev) {
-- if (accel_dev->idev != idev) {
-- error_setg(errp, "Device already has an associated idev 0x%x",
-- idev->devid);
-+ if (accel_dev->hiodi) {
-+ if (accel_dev->hiodi != hiodi) {
-+ error_setg(errp, "Device already has an associated hiodi 0x%x",
-+ hiodi->devid);
- return false;
- }
- return true;
-@@ -662,7 +662,7 @@ static bool smmuv3_accel_set_iommu_device(PCIBus *bus, void *opaque, int devfn,
- * Check the host SMMUv3 associated with the dev is compatible with the
- * QEMU SMMUv3 accel.
- */
-- if (!smmuv3_accel_hw_compatible(s, idev, errp)) {
-+ if (!smmuv3_accel_hw_compatible(s, hiodi, errp)) {
- return false;
- }
-
-@@ -670,17 +670,17 @@ static bool smmuv3_accel_set_iommu_device(PCIBus *bus, void *opaque, int devfn,
- goto done;
- }
-
-- if (!smmuv3_accel_alloc_viommu(s, idev, errp)) {
-- error_append_hint(errp, "Unable to alloc vIOMMU: idev devid 0x%x: ",
-- idev->devid);
-+ if (!smmuv3_accel_alloc_viommu(s, hiodi, errp)) {
-+ error_append_hint(errp, "Unable to alloc vIOMMU: hiodi devid 0x%x: ",
-+ hiodi->devid);
- return false;
- }
-
- done:
-- accel_dev->idev = idev;
-+ accel_dev->hiodi = hiodi;
- accel_dev->s_accel = s->s_accel;
- QLIST_INSERT_HEAD(&s->s_accel->device_list, accel_dev, next);
-- trace_smmuv3_accel_set_iommu_device(devfn, idev->devid);
-+ trace_smmuv3_accel_set_iommu_device(devfn, hiodi->devid);
- return true;
- }
-
-@@ -689,7 +689,7 @@ static void smmuv3_accel_unset_iommu_device(PCIBus *bus, void *opaque,
- {
- SMMUState *bs = opaque;
- SMMUPciBus *sbus = g_hash_table_lookup(bs->smmu_pcibus_by_busptr, bus);
-- HostIOMMUDeviceIOMMUFD *idev;
-+ HostIOMMUDeviceIOMMUFD *hiodi;
- SMMUv3AccelDevice *accel_dev;
- SMMUv3AccelState *accel;
- IOMMUFDVdev *vdev;
-@@ -705,16 +705,16 @@ static void smmuv3_accel_unset_iommu_device(PCIBus *bus, void *opaque,
- }
-
- accel_dev = container_of(sdev, SMMUv3AccelDevice, sdev);
-- idev = accel_dev->idev;
-+ hiodi = accel_dev->hiodi;
- accel = accel_dev->s_accel;
- /* Re-attach the default s2 hwpt id */
-- if (!host_iommu_device_iommufd_attach_hwpt(idev, idev->hwpt_id, NULL)) {
-- error_report("Unable to attach the default HW pagetable: idev devid "
-- "0x%x", idev->devid);
-+ if (!host_iommu_device_iommufd_attach_hwpt(hiodi, hiodi->hwpt_id, NULL)) {
-+ error_report("Unable to attach the default HW pagetable: hiodi devid "
-+ "0x%x", hiodi->devid);
- }
-
- if (accel_dev->s1_hwpt) {
-- iommufd_backend_free_id(accel_dev->idev->iommufd,
-+ iommufd_backend_free_id(accel_dev->hiodi->iommufd,
- accel_dev->s1_hwpt->hwpt_id);
- g_free(accel_dev->s1_hwpt);
- accel_dev->s1_hwpt = NULL;
-@@ -727,10 +727,10 @@ static void smmuv3_accel_unset_iommu_device(PCIBus *bus, void *opaque,
- accel_dev->vdev = NULL;
- }
-
-- accel_dev->idev = NULL;
-+ accel_dev->hiodi = NULL;
- accel_dev->s_accel = NULL;
- QLIST_REMOVE(accel_dev, next);
-- trace_smmuv3_accel_unset_iommu_device(devfn, idev->devid);
-+ trace_smmuv3_accel_unset_iommu_device(devfn, hiodi->devid);
-
- if (QLIST_EMPTY(&accel->device_list)) {
- smmuv3_accel_free_viommu(accel);
-@@ -929,10 +929,11 @@ bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp)
-
- hwpt_id = smmuv3_accel_gbpa_hwpt(s, accel);
- QLIST_FOREACH(accel_dev, &accel->device_list, next) {
-- if (!host_iommu_device_iommufd_attach_hwpt(accel_dev->idev, hwpt_id,
-+ if (!host_iommu_device_iommufd_attach_hwpt(accel_dev->hiodi, hwpt_id,
- &local_err)) {
- error_append_hint(&local_err, "Failed to attach GBPA hwpt %u for "
-- "idev devid %u", hwpt_id, accel_dev->idev->devid);
-+ "hiodi devid %u", hwpt_id,
-+ accel_dev->hiodi->devid);
- error_report_err(local_err);
- local_err = NULL;
- all_ok = false;
-diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
-index d7b9f8a8e6..d89c117fd1 100644
---- a/hw/arm/smmuv3-accel.h
-+++ b/hw/arm/smmuv3-accel.h
-@@ -36,7 +36,7 @@ typedef struct SMMUS1Hwpt {
-
- typedef struct SMMUv3AccelDevice {
- SMMUDevice sdev;
-- HostIOMMUDeviceIOMMUFD *idev;
-+ HostIOMMUDeviceIOMMUFD *hiodi;
- SMMUS1Hwpt *s1_hwpt;
- IOMMUFDVdev *vdev;
- QLIST_ENTRY(SMMUv3AccelDevice) next;
-diff --git a/hw/vfio/container-legacy.c b/hw/vfio/container-legacy.c
-index e639760381..05b8ebef4b 100644
---- a/hw/vfio/container-legacy.c
-+++ b/hw/vfio/container-legacy.c
-@@ -1255,12 +1255,12 @@ static void vfio_iommu_legacy_instance_init(Object *obj)
-
- static void hiod_legacy_vfio_class_init(ObjectClass *oc, const void *data)
- {
-- HostIOMMUDeviceClass *hioc = HOST_IOMMU_DEVICE_CLASS(oc);
-+ HostIOMMUDeviceClass *hiodc = HOST_IOMMU_DEVICE_CLASS(oc);
-
-- hioc->realize = hiod_legacy_vfio_realize;
-- hioc->get_cap = hiod_legacy_vfio_get_cap;
-- hioc->get_iova_ranges = hiod_legacy_vfio_get_iova_ranges;
-- hioc->get_page_size_mask = hiod_legacy_vfio_get_page_size_mask;
-+ hiodc->realize = hiod_legacy_vfio_realize;
-+ hiodc->get_cap = hiod_legacy_vfio_get_cap;
-+ hiodc->get_iova_ranges = hiod_legacy_vfio_get_iova_ranges;
-+ hiodc->get_page_size_mask = hiod_legacy_vfio_get_page_size_mask;
- };
-
- static const TypeInfo types[] = {
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index 93703a0036..191cf80068 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -873,19 +873,19 @@ static void vfio_iommu_iommufd_class_init(ObjectClass *klass, const void *data)
- };
-
- static bool
--host_iommu_device_iommufd_vfio_attach_hwpt(HostIOMMUDeviceIOMMUFD *idev,
-+host_iommu_device_iommufd_vfio_attach_hwpt(HostIOMMUDeviceIOMMUFD *hiodi,
- uint32_t hwpt_id, Error **errp)
- {
-- VFIODevice *vbasedev = HOST_IOMMU_DEVICE(idev)->agent;
-+ VFIODevice *vbasedev = HOST_IOMMU_DEVICE(hiodi)->agent;
-
- return !iommufd_cdev_attach_ioas_hwpt(vbasedev, hwpt_id, errp);
- }
-
- static bool
--host_iommu_device_iommufd_vfio_detach_hwpt(HostIOMMUDeviceIOMMUFD *idev,
-+host_iommu_device_iommufd_vfio_detach_hwpt(HostIOMMUDeviceIOMMUFD *hiodi,
- Error **errp)
- {
-- VFIODevice *vbasedev = HOST_IOMMU_DEVICE(idev)->agent;
-+ VFIODevice *vbasedev = HOST_IOMMU_DEVICE(hiodi)->agent;
-
- return iommufd_cdev_detach_ioas_hwpt(vbasedev, errp);
- }
-@@ -894,7 +894,7 @@ static bool hiod_iommufd_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
- Error **errp)
- {
- VFIODevice *vdev = opaque;
-- HostIOMMUDeviceIOMMUFD *idev;
-+ HostIOMMUDeviceIOMMUFD *hiodi;
- HostIOMMUDeviceCaps *caps = &hiod->caps;
- VendorCaps *vendor_caps = &caps->vendor_caps;
- uint32_t type = IOMMU_HW_INFO_TYPE_DEFAULT;
-@@ -914,10 +914,10 @@ static bool hiod_iommufd_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
- caps->hw_caps = hw_caps;
- caps->max_pasid_log2 = max_pasid_log2;
-
-- idev = HOST_IOMMU_DEVICE_IOMMUFD(hiod);
-- idev->iommufd = vdev->iommufd;
-- idev->devid = vdev->devid;
-- idev->hwpt_id = vdev->hwpt->hwpt_id;
-+ hiodi = HOST_IOMMU_DEVICE_IOMMUFD(hiod);
-+ hiodi->iommufd = vdev->iommufd;
-+ hiodi->devid = vdev->devid;
-+ hiodi->hwpt_id = vdev->hwpt->hwpt_id;
-
- return true;
- }
-@@ -944,14 +944,14 @@ hiod_iommufd_vfio_get_page_size_mask(HostIOMMUDevice *hiod)
- static void hiod_iommufd_vfio_class_init(ObjectClass *oc, const void *data)
- {
- HostIOMMUDeviceClass *hiodc = HOST_IOMMU_DEVICE_CLASS(oc);
-- HostIOMMUDeviceIOMMUFDClass *idevc = HOST_IOMMU_DEVICE_IOMMUFD_CLASS(oc);
-+ HostIOMMUDeviceIOMMUFDClass *hiodic = HOST_IOMMU_DEVICE_IOMMUFD_CLASS(oc);
-
- hiodc->realize = hiod_iommufd_vfio_realize;
- hiodc->get_iova_ranges = hiod_iommufd_vfio_get_iova_ranges;
- hiodc->get_page_size_mask = hiod_iommufd_vfio_get_page_size_mask;
-
-- idevc->attach_hwpt = host_iommu_device_iommufd_vfio_attach_hwpt;
-- idevc->detach_hwpt = host_iommu_device_iommufd_vfio_detach_hwpt;
-+ hiodic->attach_hwpt = host_iommu_device_iommufd_vfio_attach_hwpt;
-+ hiodic->detach_hwpt = host_iommu_device_iommufd_vfio_detach_hwpt;
- };
-
- static const TypeInfo types[] = {
-diff --git a/include/system/iommufd.h b/include/system/iommufd.h
-index 25da754434..e45f4a5e87 100644
---- a/include/system/iommufd.h
-+++ b/include/system/iommufd.h
-@@ -136,7 +136,7 @@ struct HostIOMMUDeviceIOMMUFDClass {
- *
- * Mandatory callback.
- *
-- * @idev: host IOMMU device backed by IOMMUFD backend.
-+ * @hiodi: host IOMMU device backed by IOMMUFD backend.
- *
- * @hwpt_id: ID of IOMMUFD hardware page table.
- *
-@@ -144,7 +144,7 @@ struct HostIOMMUDeviceIOMMUFDClass {
- *
- * Returns: true on success, false on failure.
- */
-- bool (*attach_hwpt)(HostIOMMUDeviceIOMMUFD *idev, uint32_t hwpt_id,
-+ bool (*attach_hwpt)(HostIOMMUDeviceIOMMUFD *hiodi, uint32_t hwpt_id,
- Error **errp);
- /**
- * @detach_hwpt: detach host IOMMU device from IOMMUFD hardware page table.
-@@ -152,17 +152,17 @@ struct HostIOMMUDeviceIOMMUFDClass {
- *
- * Mandatory callback.
- *
-- * @idev: host IOMMU device backed by IOMMUFD backend.
-+ * @hiodi: host IOMMU device backed by IOMMUFD backend.
- *
- * @errp: pass an Error out when attachment fails.
- *
- * Returns: true on success, false on failure.
- */
-- bool (*detach_hwpt)(HostIOMMUDeviceIOMMUFD *idev, Error **errp);
-+ bool (*detach_hwpt)(HostIOMMUDeviceIOMMUFD *hiodi, Error **errp);
- };
-
--bool host_iommu_device_iommufd_attach_hwpt(HostIOMMUDeviceIOMMUFD *idev,
-+bool host_iommu_device_iommufd_attach_hwpt(HostIOMMUDeviceIOMMUFD *hiodi,
- uint32_t hwpt_id, Error **errp);
--bool host_iommu_device_iommufd_detach_hwpt(HostIOMMUDeviceIOMMUFD *idev,
-+bool host_iommu_device_iommufd_detach_hwpt(HostIOMMUDeviceIOMMUFD *hiodi,
- Error **errp);
- #endif
---
-2.52.0
-
diff --git a/kvm-iotests-046-Test-that-discard-write_zeroes-wait-for-.patch b/kvm-iotests-046-Test-that-discard-write_zeroes-wait-for-.patch
deleted file mode 100644
index 61846cc..0000000
--- a/kvm-iotests-046-Test-that-discard-write_zeroes-wait-for-.patch
+++ /dev/null
@@ -1,153 +0,0 @@
-From 37596bc8c96fb8261c13fc4f78d0f95ea8ab1397 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Sat, 13 Jun 2026 23:03:38 +0300
-Subject: [PATCH 50/52] iotests/046: Test that discard/write_zeroes wait for
- dependencies
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [43/45] 7548e248ef6195c061c197e13865a49ab4586678 (kmwolf/centos-qemu-kvm)
-
-This is a regression test for the bug fixed in the previous commit where
-discard and write_zeroes operations wouldn't consider their dependencies
-in s->cluster_allocs. Without the fix, this results in a corrupted
-image.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260427170520.101242-5-kwolf@redhat.com>
-Reviewed-by: Denis V. Lunev <den@openvz.org>
-Tested-by: Denis V. Lunev <den@openvz.org>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 389f5bcc744d3ddc127d550a57261aed9bbba1f3)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-
-Message-ID: <20260613200411.1808021-55-mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- tests/qemu-iotests/046 | 46 ++++++++++++++++++++++++++++++++++++++
- tests/qemu-iotests/046.out | 36 +++++++++++++++++++++++++++++
- 2 files changed, 82 insertions(+)
-
-diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046
-index 4c9ed4d26e..e03dd40147 100755
---- a/tests/qemu-iotests/046
-+++ b/tests/qemu-iotests/046
-@@ -184,6 +184,48 @@ aio_write -P 160 0x104000 0x18000
- resume A
- aio_flush
- EOF
-+
-+# Create a pre-allocated zero cluster, then start a write on it and discard it
-+# before the L2 update is made
-+cat <<EOF
-+write -P 181 0x120000 0x10000
-+write -z 0x120000 0x10000
-+
-+break write_aio A
-+aio_write -P 180 0x120000 0x10000
-+wait_break A
-+aio_discard 0x120000 0x10000
-+resume A
-+aio_flush
-+EOF
-+
-+# Create a pre-allocated zero cluster, then start a write on it and a
-+# concurrent zero write with MAY_UNMAP before the L2 update is made
-+cat <<EOF
-+write -P 181 0x130000 0x10000
-+write -z 0x130000 0x10000
-+
-+break write_aio A
-+aio_write -P 180 0x130000 0x10000
-+wait_break A
-+aio_write -z -u 0x130000 0x10000
-+resume A
-+aio_flush
-+EOF
-+
-+# Create a pre-allocated zero cluster, then start a write on it and a
-+# concurrent zero write without MAY_UNMAP before the L2 update is made
-+cat <<EOF
-+write -P 181 0x140000 0x10000
-+write -z 0x140000 0x10000
-+
-+break write_aio A
-+aio_write -P 180 0x140000 0x10000
-+wait_break A
-+aio_write -z 0x140000 0x10000
-+resume A
-+aio_flush
-+EOF
- }
-
- overlay_io | $QEMU_IO blkdebug::"$TEST_IMG" | _filter_qemu_io |\
-@@ -264,6 +306,10 @@ verify_io()
- # Undefined content for 0x10c000 0x8000
- echo read -P 160 0x114000 0x8000
- echo read -P 17 0x11c000 0x4000
-+
-+ echo read -P 0 0x120000 0x10000
-+ echo read -P 0 0x130000 0x10000
-+ echo read -P 0 0x140000 0x10000
- }
-
- verify_io | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
-diff --git a/tests/qemu-iotests/046.out b/tests/qemu-iotests/046.out
-index b1a03f4041..6341df335c 100644
---- a/tests/qemu-iotests/046.out
-+++ b/tests/qemu-iotests/046.out
-@@ -139,6 +139,36 @@ wrote XXX/XXX bytes at offset XXX
- XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
- wrote XXX/XXX bytes at offset XXX
- XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+blkdebug: Suspended request 'A'
-+blkdebug: Resuming request 'A'
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+discarded XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+blkdebug: Suspended request 'A'
-+blkdebug: Resuming request 'A'
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+blkdebug: Suspended request 'A'
-+blkdebug: Resuming request 'A'
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-
- == Verify image content ==
- read 65536/65536 bytes at offset 0
-@@ -239,5 +269,11 @@ read 32768/32768 bytes at offset 1130496
- 32 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
- read 16384/16384 bytes at offset 1163264
- 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+read 65536/65536 bytes at offset 1179648
-+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+read 65536/65536 bytes at offset 1245184
-+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+read 65536/65536 bytes at offset 1310720
-+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
- No errors were found on the image.
- *** done
---
-2.52.0
-
diff --git a/kvm-iotests-147-ensure-temporary-sockets-are-closed-befo.patch b/kvm-iotests-147-ensure-temporary-sockets-are-closed-befo.patch
deleted file mode 100644
index 167474c..0000000
--- a/kvm-iotests-147-ensure-temporary-sockets-are-closed-befo.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From a25d168305434f211fded8dc89c3b849dcf759e0 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Tue, 15 Jul 2025 15:30:21 +0100
-Subject: [PATCH 27/52] iotests/147: ensure temporary sockets are closed before
- exiting
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [20/45] 80c29c667a333d72e60c403ad8c4e07bf42db189 (kmwolf/centos-qemu-kvm)
-
-This avoids the python resource leak detector from issuing warnings
-in the iotests.
-
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit d4d0ebfcc926c11d16320d0d5accf22e3441c115)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- tests/qemu-iotests/147 | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/tests/qemu-iotests/147 b/tests/qemu-iotests/147
-index 6d6f077a14..3e14bd389a 100755
---- a/tests/qemu-iotests/147
-+++ b/tests/qemu-iotests/147
-@@ -277,6 +277,7 @@ class BuiltinNBD(NBDBlockdevAddBase):
- } }
- self.client_test(filename, flatten_sock_addr(address), 'nbd-export')
-
-+ sockfd.close()
- self._server_down()
-
-
---
-2.52.0
-
diff --git a/kvm-iotests-151-ensure-subprocesses-are-cleaned-up.patch b/kvm-iotests-151-ensure-subprocesses-are-cleaned-up.patch
deleted file mode 100644
index 58dc1b1..0000000
--- a/kvm-iotests-151-ensure-subprocesses-are-cleaned-up.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 45efe35d9113cbd76d4652ee56a805cbde58f6b1 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
-Date: Tue, 15 Jul 2025 15:30:22 +0100
-Subject: [PATCH 28/52] iotests/151: ensure subprocesses are cleaned up
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [21/45] 58ae050da1f3c7bfee87daad073dcc99b8eec51b (kmwolf/centos-qemu-kvm)
-
-The iotest 151 creates a bunch of subprocesses, with their stdout
-connected to a pipe but never reads any data from them and does
-not gurantee the processes are killed on cleanup.
-
-This triggers resource leak warnings from python when the
-subprocess.Popen object is garbage collected.
-
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 2b2fb25c2aaf5b2e8172d845db39cc50a951a12e)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- tests/qemu-iotests/151 | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151
-index f2ff9c5dac..06ee3585db 100755
---- a/tests/qemu-iotests/151
-+++ b/tests/qemu-iotests/151
-@@ -263,6 +263,11 @@ class TestThrottledWithNbdExportBase(iotests.QMPTestCase):
- break
- except subprocess.TimeoutExpired:
- self.vm.qtest(f'clock_step {1 * 1000 * 1000 * 1000}')
-+ try:
-+ p.kill()
-+ p.stdout.close()
-+ except:
-+ pass
- except IndexError:
- pass
-
---
-2.52.0
-
diff --git a/kvm-iotests-add-Linux-loop-device-image-creation-test.patch b/kvm-iotests-add-Linux-loop-device-image-creation-test.patch
deleted file mode 100644
index 8d38be2..0000000
--- a/kvm-iotests-add-Linux-loop-device-image-creation-test.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From 915f7779592a69d1243427ed8e5e95285b6daa4f Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Tue, 7 Oct 2025 10:17:00 -0400
-Subject: [PATCH 36/52] iotests: add Linux loop device image creation test
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [29/45] b46da09b4329cc3b3c3263f2ac62b3386035de8d (kmwolf/centos-qemu-kvm)
-
-This qemu-iotests test case is based on the reproducer that Jean-Louis
-Dupond <jean-louis@dupond.be> shared in
-https://gitlab.com/qemu-project/qemu/-/issues/3127.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Message-ID: <20251007141700.71891-4-stefanha@redhat.com>
-Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-Tested-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-Tested-by: Fiona Ebner <f.ebner@proxmox.com>
-Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 59a1cf0cd31597d2f6e2c18dc400a1de8427d47d)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- tests/qemu-iotests/tests/loop-create-file | 59 +++++++++++++++++++
- tests/qemu-iotests/tests/loop-create-file.out | 8 +++
- 2 files changed, 67 insertions(+)
- create mode 100755 tests/qemu-iotests/tests/loop-create-file
- create mode 100644 tests/qemu-iotests/tests/loop-create-file.out
-
-diff --git a/tests/qemu-iotests/tests/loop-create-file b/tests/qemu-iotests/tests/loop-create-file
-new file mode 100755
-index 0000000000..5ec75b046b
---- /dev/null
-+++ b/tests/qemu-iotests/tests/loop-create-file
-@@ -0,0 +1,59 @@
-+#!/usr/bin/env bash
-+# group: quick
-+#
-+# SPDX-License-Identifier: GPL-2.0-or-later
-+#
-+# Copyright Red Hat, Inc.
-+#
-+# Test Linux loop device image creation
-+#
-+# This test verifies #3127 "qemu-img create fails on loop device with sector size 4096"
-+# https://gitlab.com/qemu-project/qemu/-/issues/3127
-+
-+seq="$(basename $0)"
-+echo "QA output created by $seq"
-+
-+status=1 # failure is the default!
-+
-+_cleanup() {
-+ if [ -n "$loopdev" ]; then
-+ sudo losetup --detach "$loopdev"
-+ fi
-+
-+ _cleanup_test_img
-+}
-+
-+trap "_cleanup; exit \$status" 0 1 2 3 15
-+
-+# get standard environment, filters and checks
-+cd ..
-+. ./common.rc
-+. ./common.filter
-+
-+_supported_fmt raw
-+_supported_proto file
-+_supported_os Linux
-+
-+if ! sudo -n losetup &>/dev/null; then
-+ _notrun "sudo losetup not available"
-+fi
-+
-+echo
-+echo "=== Create image on a 4 KB sector size loop device ==="
-+echo
-+
-+_make_test_img -f $IMGFMT 1M
-+
-+loopdev=$(sudo losetup --sector-size 4096 --find --show "$TEST_IMG")
-+if [ -z "$loopdev" ]; then
-+ _fail
-+fi
-+
-+sudo $QEMU_IMG_PROG create -f raw "$loopdev" 1M | \
-+ sed -e "s#/dev/loop[0-9]\\+#LOOPDEV#g"
-+
-+# success, all done
-+echo
-+echo '*** done'
-+rm -f $seq.full
-+status=0
-diff --git a/tests/qemu-iotests/tests/loop-create-file.out b/tests/qemu-iotests/tests/loop-create-file.out
-new file mode 100644
-index 0000000000..32d4155695
---- /dev/null
-+++ b/tests/qemu-iotests/tests/loop-create-file.out
-@@ -0,0 +1,8 @@
-+QA output created by loop-create-file
-+
-+=== Create image on a 4 KB sector size loop device ===
-+
-+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
-+Formatting 'LOOPDEV', fmt=raw size=1048576
-+
-+*** done
---
-2.52.0
-
diff --git a/kvm-iotests-test-active-mirror-with-unaligned-small-writ.patch b/kvm-iotests-test-active-mirror-with-unaligned-small-writ.patch
deleted file mode 100644
index d7f101f..0000000
--- a/kvm-iotests-test-active-mirror-with-unaligned-small-writ.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From 86d893766713ddb454a9e7bf9e3069a41cf77b1e Mon Sep 17 00:00:00 2001
-From: Fiona Ebner <f.ebner@proxmox.com>
-Date: Tue, 20 Jan 2026 12:38:57 +0100
-Subject: [PATCH 45/52] iotests: test active mirror with unaligned, small write
- zeroes op
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [38/45] 39a5ae389b5bd6ee71ee61fb45fb8456e7068511 (kmwolf/centos-qemu-kvm)
-
-This tests the scenario fixed by "block/mirror: check range
-when setting zero bitmap for sync write" [0].
-
-[0] https://lore.kernel.org/qemu-devel/20260112152544.261923-1-f.ebner@proxmox.com/
-
-Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
-Message-ID: <20260120113859.251743-1-f.ebner@proxmox.com>
-Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-Tested-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-(cherry picked from commit 267d7ae99a1d3b5be9d3421db3bdf651cc18c7ab)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- tests/qemu-iotests/151 | 20 ++++++++++++++++++++
- tests/qemu-iotests/151.out | 4 ++--
- 2 files changed, 22 insertions(+), 2 deletions(-)
-
-diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151
-index 06ee3585db..9b9c815db5 100755
---- a/tests/qemu-iotests/151
-+++ b/tests/qemu-iotests/151
-@@ -191,6 +191,26 @@ class TestActiveMirror(iotests.QMPTestCase):
-
- self.potential_writes_in_flight = False
-
-+ def testUnalignedSmallerThanGranularityWriteZeroes(self):
-+ # Fill the source image
-+ self.vm.hmp_qemu_io('source', 'write -P 1 0 %i' % self.image_len);
-+
-+ # Start the block job
-+ self.vm.cmd('blockdev-mirror',
-+ job_id='mirror',
-+ filter_node_name='mirror-node',
-+ device='source-node',
-+ target='target-node',
-+ sync='full',
-+ copy_mode='write-blocking')
-+
-+ # Wait for the READY event
-+ self.wait_ready(drive='mirror')
-+
-+ for offset in range(6 * self.image_len // 8, 7 * self.image_len // 8, 1024 * 1024):
-+ self.vm.hmp_qemu_io('source', 'aio_write -z %i 512' % (offset + 512))
-+
-+ self.complete_and_wait(drive='mirror', wait_ready=False)
-
- class TestThrottledWithNbdExportBase(iotests.QMPTestCase):
- image_len = 128 * 1024 * 1024 # MB
-diff --git a/tests/qemu-iotests/151.out b/tests/qemu-iotests/151.out
-index 3f8a935a08..2f7d3902f2 100644
---- a/tests/qemu-iotests/151.out
-+++ b/tests/qemu-iotests/151.out
-@@ -1,5 +1,5 @@
--......
-+.......
- ----------------------------------------------------------------------
--Ran 6 tests
-+Ran 7 tests
-
- OK
---
-2.52.0
-
diff --git a/kvm-linux-aio-Put-all-parameters-into-qemu_laiocb.patch b/kvm-linux-aio-Put-all-parameters-into-qemu_laiocb.patch
deleted file mode 100644
index b458e78..0000000
--- a/kvm-linux-aio-Put-all-parameters-into-qemu_laiocb.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-From 30c3962bbef6ce083f326988f35741dd21aaf09d Mon Sep 17 00:00:00 2001
-From: Hanna Czenczek <hreitz@redhat.com>
-Date: Tue, 24 Mar 2026 09:43:34 +0100
-Subject: [PATCH 1/4] linux-aio: Put all parameters into qemu_laiocb
-
-RH-Author: Hanna Czenczek <hreitz@redhat.com>
-RH-MergeRequest: 479: linux-aio/io-uring: Resubmit tails of short requests
-RH-Jira: RHEL-158224
-RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [1/4] f449ea0c49a093bbec59b24fb44308e7f58c9ed2 (hreitz/qemu-kvm-c-9-s)
-
-Put all request parameters into the qemu_laiocb struct, which will allow
-re-submitting the tail of short reads/writes.
-
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-Message-ID: <20260324084338.37453-2-hreitz@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit cc03b62df47a09c507e199cc043f57bdc941cc67)
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
----
- block/linux-aio.c | 34 ++++++++++++++++++++++------------
- 1 file changed, 22 insertions(+), 12 deletions(-)
-
-diff --git a/block/linux-aio.c b/block/linux-aio.c
-index c200e7ad20..c2c5e11946 100644
---- a/block/linux-aio.c
-+++ b/block/linux-aio.c
-@@ -41,9 +41,15 @@ struct qemu_laiocb {
- LinuxAioState *ctx;
- struct iocb iocb;
- ssize_t ret;
-+ off_t offset;
- size_t nbytes;
- QEMUIOVector *qiov;
-- bool is_read;
-+
-+ int fd;
-+ int type;
-+ BdrvRequestFlags flags;
-+
-+ uint64_t dev_max_batch;
- QSIMPLEQ_ENTRY(qemu_laiocb) next;
- };
-
-@@ -87,7 +93,7 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)
- ret = 0;
- } else if (ret >= 0) {
- /* Short reads mean EOF, pad with zeros. */
-- if (laiocb->is_read) {
-+ if (laiocb->type == QEMU_AIO_READ) {
- qemu_iovec_memset(laiocb->qiov, ret, 0,
- laiocb->qiov->size - ret);
- } else {
-@@ -367,23 +373,23 @@ static void laio_deferred_fn(void *opaque)
- }
- }
-
--static int laio_do_submit(int fd, struct qemu_laiocb *laiocb, off_t offset,
-- int type, BdrvRequestFlags flags,
-- uint64_t dev_max_batch)
-+static int laio_do_submit(struct qemu_laiocb *laiocb)
- {
- LinuxAioState *s = laiocb->ctx;
- struct iocb *iocbs = &laiocb->iocb;
- QEMUIOVector *qiov = laiocb->qiov;
-+ int fd = laiocb->fd;
-+ off_t offset = laiocb->offset;
-
-- switch (type) {
-+ switch (laiocb->type) {
- case QEMU_AIO_WRITE:
- #ifdef HAVE_IO_PREP_PWRITEV2
- {
-- int laio_flags = (flags & BDRV_REQ_FUA) ? RWF_DSYNC : 0;
-+ int laio_flags = (laiocb->flags & BDRV_REQ_FUA) ? RWF_DSYNC : 0;
- io_prep_pwritev2(iocbs, fd, qiov->iov, qiov->niov, offset, laio_flags);
- }
- #else
-- assert(flags == 0);
-+ assert(laiocb->flags == 0);
- io_prep_pwritev(iocbs, fd, qiov->iov, qiov->niov, offset);
- #endif
- break;
-@@ -399,7 +405,7 @@ static int laio_do_submit(int fd, struct qemu_laiocb *laiocb, off_t offset,
- /* Currently Linux kernel does not support other operations */
- default:
- fprintf(stderr, "%s: invalid AIO request type 0x%x.\n",
-- __func__, type);
-+ __func__, laiocb->type);
- return -EIO;
- }
- io_set_eventfd(&laiocb->iocb, event_notifier_get_fd(&s->e));
-@@ -407,7 +413,7 @@ static int laio_do_submit(int fd, struct qemu_laiocb *laiocb, off_t offset,
- QSIMPLEQ_INSERT_TAIL(&s->io_q.pending, laiocb, next);
- s->io_q.in_queue++;
- if (!s->io_q.blocked) {
-- if (s->io_q.in_queue >= laio_max_batch(s, dev_max_batch)) {
-+ if (s->io_q.in_queue >= laio_max_batch(s, laiocb->dev_max_batch)) {
- ioq_submit(s);
- } else {
- defer_call(laio_deferred_fn, s);
-@@ -425,14 +431,18 @@ int coroutine_fn laio_co_submit(int fd, uint64_t offset, QEMUIOVector *qiov,
- AioContext *ctx = qemu_get_current_aio_context();
- struct qemu_laiocb laiocb = {
- .co = qemu_coroutine_self(),
-+ .offset = offset,
- .nbytes = qiov ? qiov->size : 0,
- .ctx = aio_get_linux_aio(ctx),
- .ret = -EINPROGRESS,
-- .is_read = (type == QEMU_AIO_READ),
- .qiov = qiov,
-+ .fd = fd,
-+ .type = type,
-+ .flags = flags,
-+ .dev_max_batch = dev_max_batch,
- };
-
-- ret = laio_do_submit(fd, &laiocb, offset, type, flags, dev_max_batch);
-+ ret = laio_do_submit(&laiocb);
- if (ret < 0) {
- return ret;
- }
---
-2.47.3
-
diff --git a/kvm-linux-aio-Resubmit-tails-of-short-reads-writes.patch b/kvm-linux-aio-Resubmit-tails-of-short-reads-writes.patch
deleted file mode 100644
index 2da3b76..0000000
--- a/kvm-linux-aio-Resubmit-tails-of-short-reads-writes.patch
+++ /dev/null
@@ -1,215 +0,0 @@
-From ad3a6c9b3487226d9622120eaea8218bd6050a04 Mon Sep 17 00:00:00 2001
-From: Hanna Czenczek <hreitz@redhat.com>
-Date: Tue, 24 Mar 2026 09:43:35 +0100
-Subject: [PATCH 2/4] linux-aio: Resubmit tails of short reads/writes
-
-RH-Author: Hanna Czenczek <hreitz@redhat.com>
-RH-MergeRequest: 479: linux-aio/io-uring: Resubmit tails of short requests
-RH-Jira: RHEL-158224
-RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [2/4] f97271e609a150acc04a15ffc85c40e7bcb00060 (hreitz/qemu-kvm-c-9-s)
-
-Short reads/writes can happen. One way to reproduce them is via our
-FUSE export, with the following diff applied (%s/escaped // to apply --
-if you put plain diffs in commit messages, git-am will apply them, and I
-would rather avoid breaking FUSE accidentally via this patch):
-
-escaped diff --git a/block/export/fuse.c b/block/export/fuse.c
-escaped index a2a478d293..67dc50a412 100644
-escaped --- a/block/export/fuse.c
-escaped +++ b/block/export/fuse.c
-@@ -828,7 +828,7 @@ static ssize_t coroutine_fn GRAPH_RDLOCK
- fuse_co_init(FuseExport *exp, struct fuse_init_out *out,
- const struct fuse_init_in_compat *in)
- {
-- const uint32_t supported_flags = FUSE_ASYNC_READ | FUSE_ASYNC_DIO;
-+ const uint32_t supported_flags = FUSE_ASYNC_READ;
-
- if (in->major != 7) {
- error_report("FUSE major version mismatch: We have 7, but kernel has %"
-@@ -1060,6 +1060,8 @@ fuse_co_read(FuseExport *exp, void **bufptr, uint64_t offset, uint32_t size)
- void *buf;
- int ret;
-
-+ size = MIN(size, 4096);
-+
- /* Limited by max_read, should not happen */
- if (size > FUSE_MAX_READ_BYTES) {
- return -EINVAL;
-@@ -1110,6 +1112,8 @@ fuse_co_write(FuseExport *exp, struct fuse_write_out *out,
- int64_t blk_len;
- int ret;
-
-+ size = MIN(size, 4096);
-+
- QEMU_BUILD_BUG_ON(FUSE_MAX_WRITE_BYTES > BDRV_REQUEST_MAX_BYTES);
- /* Limited by max_write, should not happen */
- if (size > FUSE_MAX_WRITE_BYTES) {
-
-Then:
-$ ./qemu-img create -f raw test.raw 8k
-Formatting 'test.raw', fmt=raw size=8192
-$ ./qemu-io -f raw -c 'write -P 42 0 8k' test.raw
-wrote 8192/8192 bytes at offset 0
-8 KiB, 1 ops; 00.00 sec (64.804 MiB/sec and 8294.9003 ops/sec)
-$ hexdump -C test.raw
-00000000 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |****************|
-*
-00002000
-
-With aio=threads, short I/O works:
-$ storage-daemon/qemu-storage-daemon \
- --blockdev file,node-name=test,filename=test.raw \
- --export fuse,id=exp,node-name=test,mountpoint=test.raw,writable=true
-
-Other shell:
-$ ./qemu-io --image-opts -c 'read -P 42 0 8k' \
- driver=file,filename=test.raw,cache.direct=on,aio=threads
-read 8192/8192 bytes at offset 0
-8 KiB, 1 ops; 00.00 sec (36.563 MiB/sec and 4680.0923 ops/sec)
-$ ./qemu-io --image-opts -c 'write -P 23 0 8k' \
- driver=file,filename=test.raw,cache.direct=on,aio=threads
-wrote 8192/8192 bytes at offset 0
-8 KiB, 1 ops; 00.00 sec (35.995 MiB/sec and 4607.2970 ops/sec)
-$ hexdump -C test.raw
-00000000 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 |................|
-*
-00002000
-
-But with aio=native, it does not:
-$ ./qemu-io --image-opts -c 'read -P 23 0 8k' \
- driver=file,filename=test.raw,cache.direct=on,aio=native
-Pattern verification failed at offset 0, 8192 bytes
-read 8192/8192 bytes at offset 0
-8 KiB, 1 ops; 00.00 sec (86.155 MiB/sec and 11027.7900 ops/sec)
-$ ./qemu-io --image-opts -c 'write -P 42 0 8k' \
- driver=file,filename=test.raw,cache.direct=on,aio=native
-write failed: No space left on device
-$ hexdump -C test.raw
-00000000 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |****************|
-*
-00001000 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 |................|
-*
-00002000
-
-This patch fixes that.
-
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-Message-ID: <20260324084338.37453-3-hreitz@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 7eca3d4883be8d328377001a9ea7ae9882b00f3c)
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
----
- block/linux-aio.c | 56 ++++++++++++++++++++++++++++++++++++++++++-----
- 1 file changed, 50 insertions(+), 6 deletions(-)
-
-diff --git a/block/linux-aio.c b/block/linux-aio.c
-index c2c5e11946..84397de54c 100644
---- a/block/linux-aio.c
-+++ b/block/linux-aio.c
-@@ -45,6 +45,10 @@ struct qemu_laiocb {
- size_t nbytes;
- QEMUIOVector *qiov;
-
-+ /* For handling short reads/writes */
-+ size_t total_done;
-+ QEMUIOVector resubmit_qiov;
-+
- int fd;
- int type;
- BdrvRequestFlags flags;
-@@ -74,28 +78,61 @@ struct LinuxAioState {
- };
-
- static void ioq_submit(LinuxAioState *s);
-+static int laio_do_submit(struct qemu_laiocb *laiocb);
-
- static inline ssize_t io_event_ret(struct io_event *ev)
- {
- return (ssize_t)(((uint64_t)ev->res2 << 32) | ev->res);
- }
-
-+/**
-+ * Retry tail of short requests.
-+ */
-+static int laio_resubmit_short_io(struct qemu_laiocb *laiocb, size_t done)
-+{
-+ QEMUIOVector *resubmit_qiov = &laiocb->resubmit_qiov;
-+
-+ laiocb->total_done += done;
-+
-+ if (!resubmit_qiov->iov) {
-+ qemu_iovec_init(resubmit_qiov, laiocb->qiov->niov);
-+ } else {
-+ qemu_iovec_reset(resubmit_qiov);
-+ }
-+ qemu_iovec_concat(resubmit_qiov, laiocb->qiov,
-+ laiocb->total_done, laiocb->nbytes - laiocb->total_done);
-+
-+ return laio_do_submit(laiocb);
-+}
-+
- /*
- * Completes an AIO request.
- */
- static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)
- {
-- int ret;
-+ ssize_t ret;
-
- ret = laiocb->ret;
- if (ret != -ECANCELED) {
-- if (ret == laiocb->nbytes) {
-+ if (ret == laiocb->nbytes - laiocb->total_done) {
- ret = 0;
-+ } else if (ret > 0 && (laiocb->type == QEMU_AIO_READ ||
-+ laiocb->type == QEMU_AIO_WRITE)) {
-+ ret = laio_resubmit_short_io(laiocb, ret);
-+ if (!ret) {
-+ return;
-+ }
- } else if (ret >= 0) {
-- /* Short reads mean EOF, pad with zeros. */
-+ /*
-+ * For normal reads and writes, we only get here if ret == 0, which
-+ * means EOF for reads and ENOSPC for writes.
-+ * For zone-append, we get here with any ret >= 0, which we just
-+ * treat as ENOSPC, too (safer than resubmitting, probably, but not
-+ * 100 % clear).
-+ */
- if (laiocb->type == QEMU_AIO_READ) {
-- qemu_iovec_memset(laiocb->qiov, ret, 0,
-- laiocb->qiov->size - ret);
-+ qemu_iovec_memset(laiocb->qiov, laiocb->total_done, 0,
-+ laiocb->qiov->size - laiocb->total_done);
- } else {
- ret = -ENOSPC;
- }
-@@ -103,6 +140,9 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)
- }
-
- laiocb->ret = ret;
-+ if (laiocb->resubmit_qiov.iov) {
-+ qemu_iovec_destroy(&laiocb->resubmit_qiov);
-+ }
-
- /*
- * If the coroutine is already entered it must be in ioq_submit() and
-@@ -379,7 +419,11 @@ static int laio_do_submit(struct qemu_laiocb *laiocb)
- struct iocb *iocbs = &laiocb->iocb;
- QEMUIOVector *qiov = laiocb->qiov;
- int fd = laiocb->fd;
-- off_t offset = laiocb->offset;
-+ off_t offset = laiocb->offset + laiocb->total_done;
-+
-+ if (laiocb->resubmit_qiov.iov) {
-+ qiov = &laiocb->resubmit_qiov;
-+ }
-
- switch (laiocb->type) {
- case QEMU_AIO_WRITE:
---
-2.47.3
-
diff --git a/kvm-linux-headers-Update-to-Linux-v6.17-rc1.patch b/kvm-linux-headers-Update-to-Linux-v6.17-rc1.patch
deleted file mode 100644
index efc0d20..0000000
--- a/kvm-linux-headers-Update-to-Linux-v6.17-rc1.patch
+++ /dev/null
@@ -1,941 +0,0 @@
-From b5bbab573e01c1225e7368dba469086a78bc1570 Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:17 +0200
-Subject: [PATCH 08/19] linux-headers: Update to Linux v6.17-rc1
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [3/14] 5b5aab965427deef98614bcfc99c4b3b9818b46d (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-Update headers to include the virtio GSO over UDP tunnel features
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <0b1f3c011f90583ab52aa4fef04df6db35cc4a69.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit 8de6cd5452eb9c58c0d105dbc9718bd0e83cc70f)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- include/standard-headers/drm/drm_fourcc.h | 56 ++++++-
- include/standard-headers/linux/ethtool.h | 4 +-
- .../linux/input-event-codes.h | 8 +
- include/standard-headers/linux/input.h | 1 +
- include/standard-headers/linux/pci_regs.h | 9 +
- include/standard-headers/linux/vhost_types.h | 5 +
- include/standard-headers/linux/virtio_net.h | 33 ++++
- linux-headers/LICENSES/preferred/GPL-2.0 | 10 +-
- linux-headers/asm-arm64/unistd_64.h | 2 +
- linux-headers/asm-generic/unistd.h | 8 +-
- linux-headers/asm-loongarch/unistd_64.h | 2 +
- linux-headers/asm-mips/unistd_n32.h | 2 +
- linux-headers/asm-mips/unistd_n64.h | 2 +
- linux-headers/asm-mips/unistd_o32.h | 2 +
- linux-headers/asm-powerpc/kvm.h | 13 --
- linux-headers/asm-powerpc/unistd_32.h | 2 +
- linux-headers/asm-powerpc/unistd_64.h | 2 +
- linux-headers/asm-riscv/kvm.h | 1 +
- linux-headers/asm-riscv/unistd_32.h | 2 +
- linux-headers/asm-riscv/unistd_64.h | 2 +
- linux-headers/asm-s390/unistd_32.h | 2 +
- linux-headers/asm-s390/unistd_64.h | 2 +
- linux-headers/asm-x86/unistd_32.h | 2 +
- linux-headers/asm-x86/unistd_64.h | 2 +
- linux-headers/asm-x86/unistd_x32.h | 2 +
- linux-headers/linux/iommufd.h | 154 +++++++++++++++++-
- linux-headers/linux/kvm.h | 2 +
- linux-headers/linux/vfio.h | 12 +-
- linux-headers/linux/vhost.h | 35 ++++
- 29 files changed, 352 insertions(+), 27 deletions(-)
-
-diff --git a/include/standard-headers/drm/drm_fourcc.h b/include/standard-headers/drm/drm_fourcc.h
-index c8309d378b..cef077dfb3 100644
---- a/include/standard-headers/drm/drm_fourcc.h
-+++ b/include/standard-headers/drm/drm_fourcc.h
-@@ -209,6 +209,10 @@ extern "C" {
- #define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
- #define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
-
-+/* 48 bpp RGB */
-+#define DRM_FORMAT_RGB161616 fourcc_code('R', 'G', '4', '8') /* [47:0] R:G:B 16:16:16 little endian */
-+#define DRM_FORMAT_BGR161616 fourcc_code('B', 'G', '4', '8') /* [47:0] B:G:R 16:16:16 little endian */
-+
- /* 64 bpp RGB */
- #define DRM_FORMAT_XRGB16161616 fourcc_code('X', 'R', '4', '8') /* [63:0] x:R:G:B 16:16:16:16 little endian */
- #define DRM_FORMAT_XBGR16161616 fourcc_code('X', 'B', '4', '8') /* [63:0] x:B:G:R 16:16:16:16 little endian */
-@@ -217,7 +221,7 @@ extern "C" {
- #define DRM_FORMAT_ABGR16161616 fourcc_code('A', 'B', '4', '8') /* [63:0] A:B:G:R 16:16:16:16 little endian */
-
- /*
-- * Floating point 64bpp RGB
-+ * Half-Floating point - 16b/component
- * IEEE 754-2008 binary16 half-precision float
- * [15:0] sign:exponent:mantissa 1:5:10
- */
-@@ -227,6 +231,20 @@ extern "C" {
- #define DRM_FORMAT_ARGB16161616F fourcc_code('A', 'R', '4', 'H') /* [63:0] A:R:G:B 16:16:16:16 little endian */
- #define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H') /* [63:0] A:B:G:R 16:16:16:16 little endian */
-
-+#define DRM_FORMAT_R16F fourcc_code('R', ' ', ' ', 'H') /* [15:0] R 16 little endian */
-+#define DRM_FORMAT_GR1616F fourcc_code('G', 'R', ' ', 'H') /* [31:0] G:R 16:16 little endian */
-+#define DRM_FORMAT_BGR161616F fourcc_code('B', 'G', 'R', 'H') /* [47:0] B:G:R 16:16:16 little endian */
-+
-+/*
-+ * Floating point - 32b/component
-+ * IEEE 754-2008 binary32 float
-+ * [31:0] sign:exponent:mantissa 1:8:23
-+ */
-+#define DRM_FORMAT_R32F fourcc_code('R', ' ', ' ', 'F') /* [31:0] R 32 little endian */
-+#define DRM_FORMAT_GR3232F fourcc_code('G', 'R', ' ', 'F') /* [63:0] R:G 32:32 little endian */
-+#define DRM_FORMAT_BGR323232F fourcc_code('B', 'G', 'R', 'F') /* [95:0] R:G:B 32:32:32 little endian */
-+#define DRM_FORMAT_ABGR32323232F fourcc_code('A', 'B', '8', 'F') /* [127:0] R:G:B:A 32:32:32:32 little endian */
-+
- /*
- * RGBA format with 10-bit components packed in 64-bit per pixel, with 6 bits
- * of unused padding per component:
-@@ -376,6 +394,42 @@ extern "C" {
- */
- #define DRM_FORMAT_Q401 fourcc_code('Q', '4', '0', '1')
-
-+/*
-+ * 3 plane YCbCr LSB aligned
-+ * In order to use these formats in a similar fashion to MSB aligned ones
-+ * implementation can multiply the values by 2^6=64. For that reason the padding
-+ * must only contain zeros.
-+ * index 0 = Y plane, [15:0] z:Y [6:10] little endian
-+ * index 1 = Cr plane, [15:0] z:Cr [6:10] little endian
-+ * index 2 = Cb plane, [15:0] z:Cb [6:10] little endian
-+ */
-+#define DRM_FORMAT_S010 fourcc_code('S', '0', '1', '0') /* 2x2 subsampled Cb (1) and Cr (2) planes 10 bits per channel */
-+#define DRM_FORMAT_S210 fourcc_code('S', '2', '1', '0') /* 2x1 subsampled Cb (1) and Cr (2) planes 10 bits per channel */
-+#define DRM_FORMAT_S410 fourcc_code('S', '4', '1', '0') /* non-subsampled Cb (1) and Cr (2) planes 10 bits per channel */
-+
-+/*
-+ * 3 plane YCbCr LSB aligned
-+ * In order to use these formats in a similar fashion to MSB aligned ones
-+ * implementation can multiply the values by 2^4=16. For that reason the padding
-+ * must only contain zeros.
-+ * index 0 = Y plane, [15:0] z:Y [4:12] little endian
-+ * index 1 = Cr plane, [15:0] z:Cr [4:12] little endian
-+ * index 2 = Cb plane, [15:0] z:Cb [4:12] little endian
-+ */
-+#define DRM_FORMAT_S012 fourcc_code('S', '0', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes 12 bits per channel */
-+#define DRM_FORMAT_S212 fourcc_code('S', '2', '1', '2') /* 2x1 subsampled Cb (1) and Cr (2) planes 12 bits per channel */
-+#define DRM_FORMAT_S412 fourcc_code('S', '4', '1', '2') /* non-subsampled Cb (1) and Cr (2) planes 12 bits per channel */
-+
-+/*
-+ * 3 plane YCbCr
-+ * index 0 = Y plane, [15:0] Y little endian
-+ * index 1 = Cr plane, [15:0] Cr little endian
-+ * index 2 = Cb plane, [15:0] Cb little endian
-+ */
-+#define DRM_FORMAT_S016 fourcc_code('S', '0', '1', '6') /* 2x2 subsampled Cb (1) and Cr (2) planes 16 bits per channel */
-+#define DRM_FORMAT_S216 fourcc_code('S', '2', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes 16 bits per channel */
-+#define DRM_FORMAT_S416 fourcc_code('S', '4', '1', '6') /* non-subsampled Cb (1) and Cr (2) planes 16 bits per channel */
-+
- /*
- * 3 plane YCbCr
- * index 0: Y plane, [7:0] Y
-diff --git a/include/standard-headers/linux/ethtool.h b/include/standard-headers/linux/ethtool.h
-index cef0d207a6..eb80314028 100644
---- a/include/standard-headers/linux/ethtool.h
-+++ b/include/standard-headers/linux/ethtool.h
-@@ -2314,7 +2314,7 @@ enum {
- IPV6_USER_FLOW = 0x0e, /* spec only (usr_ip6_spec; nfc only) */
- IPV4_FLOW = 0x10, /* hash only */
- IPV6_FLOW = 0x11, /* hash only */
-- ETHER_FLOW = 0x12, /* spec only (ether_spec) */
-+ ETHER_FLOW = 0x12, /* hash or spec (ether_spec) */
-
- /* Used for GTP-U IPv4 and IPv6.
- * The format of GTP packets only includes
-@@ -2371,7 +2371,7 @@ enum {
- /* Flag to enable RSS spreading of traffic matching rule (nfc only) */
- #define FLOW_RSS 0x20000000
-
--/* L3-L4 network traffic flow hash options */
-+/* L2-L4 network traffic flow hash options */
- #define RXH_L2DA (1 << 1)
- #define RXH_VLAN (1 << 2)
- #define RXH_L3_PROTO (1 << 3)
-diff --git a/include/standard-headers/linux/input-event-codes.h b/include/standard-headers/linux/input-event-codes.h
-index a82ff795e0..00dc9caac9 100644
---- a/include/standard-headers/linux/input-event-codes.h
-+++ b/include/standard-headers/linux/input-event-codes.h
-@@ -601,6 +601,11 @@
- #define BTN_DPAD_LEFT 0x222
- #define BTN_DPAD_RIGHT 0x223
-
-+#define BTN_GRIPL 0x224
-+#define BTN_GRIPR 0x225
-+#define BTN_GRIPL2 0x226
-+#define BTN_GRIPR2 0x227
-+
- #define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
- #define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
- #define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */
-@@ -765,6 +770,9 @@
- #define KEY_KBD_LCD_MENU4 0x2bb
- #define KEY_KBD_LCD_MENU5 0x2bc
-
-+/* Performance Boost key (Alienware)/G-Mode key (Dell) */
-+#define KEY_PERFORMANCE 0x2bd
-+
- #define BTN_TRIGGER_HAPPY 0x2c0
- #define BTN_TRIGGER_HAPPY1 0x2c0
- #define BTN_TRIGGER_HAPPY2 0x2c1
-diff --git a/include/standard-headers/linux/input.h b/include/standard-headers/linux/input.h
-index 942ea6aaa9..d4512c20b5 100644
---- a/include/standard-headers/linux/input.h
-+++ b/include/standard-headers/linux/input.h
-@@ -272,6 +272,7 @@ struct input_mask {
- #define BUS_CEC 0x1E
- #define BUS_INTEL_ISHTP 0x1F
- #define BUS_AMD_SFH 0x20
-+#define BUS_SDW 0x21
-
- /*
- * MT_TOOL types
-diff --git a/include/standard-headers/linux/pci_regs.h b/include/standard-headers/linux/pci_regs.h
-index a3a3e942de..f5b17745de 100644
---- a/include/standard-headers/linux/pci_regs.h
-+++ b/include/standard-headers/linux/pci_regs.h
-@@ -745,6 +745,7 @@
- #define PCI_EXT_CAP_ID_L1SS 0x1E /* L1 PM Substates */
- #define PCI_EXT_CAP_ID_PTM 0x1F /* Precision Time Measurement */
- #define PCI_EXT_CAP_ID_DVSEC 0x23 /* Designated Vendor-Specific */
-+#define PCI_EXT_CAP_ID_VF_REBAR 0x24 /* VF Resizable BAR */
- #define PCI_EXT_CAP_ID_DLF 0x25 /* Data Link Feature */
- #define PCI_EXT_CAP_ID_PL_16GT 0x26 /* Physical Layer 16.0 GT/s */
- #define PCI_EXT_CAP_ID_NPEM 0x29 /* Native PCIe Enclosure Management */
-@@ -1141,6 +1142,14 @@
- #define PCI_DVSEC_HEADER2 0x8 /* Designated Vendor-Specific Header2 */
- #define PCI_DVSEC_HEADER2_ID(x) ((x) & 0xffff)
-
-+/* VF Resizable BARs, same layout as PCI_REBAR */
-+#define PCI_VF_REBAR_CAP PCI_REBAR_CAP
-+#define PCI_VF_REBAR_CAP_SIZES PCI_REBAR_CAP_SIZES
-+#define PCI_VF_REBAR_CTRL PCI_REBAR_CTRL
-+#define PCI_VF_REBAR_CTRL_BAR_IDX PCI_REBAR_CTRL_BAR_IDX
-+#define PCI_VF_REBAR_CTRL_NBAR_MASK PCI_REBAR_CTRL_NBAR_MASK
-+#define PCI_VF_REBAR_CTRL_BAR_SIZE PCI_REBAR_CTRL_BAR_SIZE
-+
- /* Data Link Feature */
- #define PCI_DLF_CAP 0x04 /* Capabilities Register */
- #define PCI_DLF_EXCHANGE_ENABLE 0x80000000 /* Data Link Feature Exchange Enable */
-diff --git a/include/standard-headers/linux/vhost_types.h b/include/standard-headers/linux/vhost_types.h
-index fd54044936..79b53a931a 100644
---- a/include/standard-headers/linux/vhost_types.h
-+++ b/include/standard-headers/linux/vhost_types.h
-@@ -110,6 +110,11 @@ struct vhost_msg_v2 {
- };
- };
-
-+struct vhost_features_array {
-+ uint64_t count; /* number of entries present in features array */
-+ uint64_t features[] ;
-+};
-+
- struct vhost_memory_region {
- uint64_t guest_phys_addr;
- uint64_t memory_size; /* bytes */
-diff --git a/include/standard-headers/linux/virtio_net.h b/include/standard-headers/linux/virtio_net.h
-index 982e854f14..93abaae0b9 100644
---- a/include/standard-headers/linux/virtio_net.h
-+++ b/include/standard-headers/linux/virtio_net.h
-@@ -70,6 +70,28 @@
- * with the same MAC.
- */
- #define VIRTIO_NET_F_SPEED_DUPLEX 63 /* Device set linkspeed and duplex */
-+#define VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO 65 /* Driver can receive
-+ * GSO-over-UDP-tunnel packets
-+ */
-+#define VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM 66 /* Driver handles
-+ * GSO-over-UDP-tunnel
-+ * packets with partial csum
-+ * for the outer header
-+ */
-+#define VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO 67 /* Device can receive
-+ * GSO-over-UDP-tunnel packets
-+ */
-+#define VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO_CSUM 68 /* Device handles
-+ * GSO-over-UDP-tunnel
-+ * packets with partial csum
-+ * for the outer header
-+ */
-+
-+/* Offloads bits corresponding to VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO{,_CSUM}
-+ * features
-+ */
-+#define VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_MAPPED 46
-+#define VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM_MAPPED 47
-
- #ifndef VIRTIO_NET_NO_LEGACY
- #define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
-@@ -131,12 +153,17 @@ struct virtio_net_hdr_v1 {
- #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 /* Use csum_start, csum_offset */
- #define VIRTIO_NET_HDR_F_DATA_VALID 2 /* Csum is valid */
- #define VIRTIO_NET_HDR_F_RSC_INFO 4 /* rsc info in csum_ fields */
-+#define VIRTIO_NET_HDR_F_UDP_TUNNEL_CSUM 8 /* UDP tunnel csum offload */
- uint8_t flags;
- #define VIRTIO_NET_HDR_GSO_NONE 0 /* Not a GSO frame */
- #define VIRTIO_NET_HDR_GSO_TCPV4 1 /* GSO frame, IPv4 TCP (TSO) */
- #define VIRTIO_NET_HDR_GSO_UDP 3 /* GSO frame, IPv4 UDP (UFO) */
- #define VIRTIO_NET_HDR_GSO_TCPV6 4 /* GSO frame, IPv6 TCP */
- #define VIRTIO_NET_HDR_GSO_UDP_L4 5 /* GSO frame, IPv4& IPv6 UDP (USO) */
-+#define VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV4 0x20 /* UDPv4 tunnel present */
-+#define VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV6 0x40 /* UDPv6 tunnel present */
-+#define VIRTIO_NET_HDR_GSO_UDP_TUNNEL (VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV4 | \
-+ VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV6)
- #define VIRTIO_NET_HDR_GSO_ECN 0x80 /* TCP has ECN set */
- uint8_t gso_type;
- __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
-@@ -181,6 +208,12 @@ struct virtio_net_hdr_v1_hash {
- uint16_t padding;
- };
-
-+struct virtio_net_hdr_v1_hash_tunnel {
-+ struct virtio_net_hdr_v1_hash hash_hdr;
-+ uint16_t outer_th_offset;
-+ uint16_t inner_nh_offset;
-+};
-+
- #ifndef VIRTIO_NET_NO_LEGACY
- /* This header comes first in the scatter-gather list.
- * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must
-diff --git a/linux-headers/LICENSES/preferred/GPL-2.0 b/linux-headers/LICENSES/preferred/GPL-2.0
-index ff0812fd89..ea8e93dc44 100644
---- a/linux-headers/LICENSES/preferred/GPL-2.0
-+++ b/linux-headers/LICENSES/preferred/GPL-2.0
-@@ -20,8 +20,8 @@ License-Text:
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
-- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
-+ <https://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-@@ -322,10 +322,8 @@ the "copyright" line and a pointer to where the full notice is found.
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--
-+ You should have received a copy of the GNU General Public License along
-+ with this program; if not, see <https://www.gnu.org/licenses/>.
-
- Also add information on how to contact you by electronic and paper mail.
-
-diff --git a/linux-headers/asm-arm64/unistd_64.h b/linux-headers/asm-arm64/unistd_64.h
-index ee9aaebdf3..4ae25c2b91 100644
---- a/linux-headers/asm-arm64/unistd_64.h
-+++ b/linux-headers/asm-arm64/unistd_64.h
-@@ -324,6 +324,8 @@
- #define __NR_listxattrat 465
- #define __NR_removexattrat 466
- #define __NR_open_tree_attr 467
-+#define __NR_file_getattr 468
-+#define __NR_file_setattr 469
-
-
- #endif /* _ASM_UNISTD_64_H */
-diff --git a/linux-headers/asm-generic/unistd.h b/linux-headers/asm-generic/unistd.h
-index 2892a45023..04e0077fb4 100644
---- a/linux-headers/asm-generic/unistd.h
-+++ b/linux-headers/asm-generic/unistd.h
-@@ -852,8 +852,14 @@ __SYSCALL(__NR_removexattrat, sys_removexattrat)
- #define __NR_open_tree_attr 467
- __SYSCALL(__NR_open_tree_attr, sys_open_tree_attr)
-
-+/* fs/inode.c */
-+#define __NR_file_getattr 468
-+__SYSCALL(__NR_file_getattr, sys_file_getattr)
-+#define __NR_file_setattr 469
-+__SYSCALL(__NR_file_setattr, sys_file_setattr)
-+
- #undef __NR_syscalls
--#define __NR_syscalls 468
-+#define __NR_syscalls 470
-
- /*
- * 32 bit systems traditionally used different
-diff --git a/linux-headers/asm-loongarch/unistd_64.h b/linux-headers/asm-loongarch/unistd_64.h
-index 50d22df8f7..5033fc8f2f 100644
---- a/linux-headers/asm-loongarch/unistd_64.h
-+++ b/linux-headers/asm-loongarch/unistd_64.h
-@@ -320,6 +320,8 @@
- #define __NR_listxattrat 465
- #define __NR_removexattrat 466
- #define __NR_open_tree_attr 467
-+#define __NR_file_getattr 468
-+#define __NR_file_setattr 469
-
-
- #endif /* _ASM_UNISTD_64_H */
-diff --git a/linux-headers/asm-mips/unistd_n32.h b/linux-headers/asm-mips/unistd_n32.h
-index bdcc2f460b..c99c10e5bf 100644
---- a/linux-headers/asm-mips/unistd_n32.h
-+++ b/linux-headers/asm-mips/unistd_n32.h
-@@ -396,5 +396,7 @@
- #define __NR_listxattrat (__NR_Linux + 465)
- #define __NR_removexattrat (__NR_Linux + 466)
- #define __NR_open_tree_attr (__NR_Linux + 467)
-+#define __NR_file_getattr (__NR_Linux + 468)
-+#define __NR_file_setattr (__NR_Linux + 469)
-
- #endif /* _ASM_UNISTD_N32_H */
-diff --git a/linux-headers/asm-mips/unistd_n64.h b/linux-headers/asm-mips/unistd_n64.h
-index 3b6b0193b6..0d975bb185 100644
---- a/linux-headers/asm-mips/unistd_n64.h
-+++ b/linux-headers/asm-mips/unistd_n64.h
-@@ -372,5 +372,7 @@
- #define __NR_listxattrat (__NR_Linux + 465)
- #define __NR_removexattrat (__NR_Linux + 466)
- #define __NR_open_tree_attr (__NR_Linux + 467)
-+#define __NR_file_getattr (__NR_Linux + 468)
-+#define __NR_file_setattr (__NR_Linux + 469)
-
- #endif /* _ASM_UNISTD_N64_H */
-diff --git a/linux-headers/asm-mips/unistd_o32.h b/linux-headers/asm-mips/unistd_o32.h
-index 4609a4b4d3..86ac0ac84b 100644
---- a/linux-headers/asm-mips/unistd_o32.h
-+++ b/linux-headers/asm-mips/unistd_o32.h
-@@ -442,5 +442,7 @@
- #define __NR_listxattrat (__NR_Linux + 465)
- #define __NR_removexattrat (__NR_Linux + 466)
- #define __NR_open_tree_attr (__NR_Linux + 467)
-+#define __NR_file_getattr (__NR_Linux + 468)
-+#define __NR_file_setattr (__NR_Linux + 469)
-
- #endif /* _ASM_UNISTD_O32_H */
-diff --git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kvm.h
-index eaeda00178..077c5437f5 100644
---- a/linux-headers/asm-powerpc/kvm.h
-+++ b/linux-headers/asm-powerpc/kvm.h
-@@ -1,18 +1,5 @@
- /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
- /*
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License, version 2, as
-- * published by the Free Software Foundation.
-- *
-- * This program is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- * GNU General Public License for more details.
-- *
-- * You should have received a copy of the GNU General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-- *
- * Copyright IBM Corp. 2007
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
-diff --git a/linux-headers/asm-powerpc/unistd_32.h b/linux-headers/asm-powerpc/unistd_32.h
-index 5d38a427e0..d7a32c5e06 100644
---- a/linux-headers/asm-powerpc/unistd_32.h
-+++ b/linux-headers/asm-powerpc/unistd_32.h
-@@ -449,6 +449,8 @@
- #define __NR_listxattrat 465
- #define __NR_removexattrat 466
- #define __NR_open_tree_attr 467
-+#define __NR_file_getattr 468
-+#define __NR_file_setattr 469
-
-
- #endif /* _ASM_UNISTD_32_H */
-diff --git a/linux-headers/asm-powerpc/unistd_64.h b/linux-headers/asm-powerpc/unistd_64.h
-index 860a488e4d..ff35c51fc6 100644
---- a/linux-headers/asm-powerpc/unistd_64.h
-+++ b/linux-headers/asm-powerpc/unistd_64.h
-@@ -421,6 +421,8 @@
- #define __NR_listxattrat 465
- #define __NR_removexattrat 466
- #define __NR_open_tree_attr 467
-+#define __NR_file_getattr 468
-+#define __NR_file_setattr 469
-
-
- #endif /* _ASM_UNISTD_64_H */
-diff --git a/linux-headers/asm-riscv/kvm.h b/linux-headers/asm-riscv/kvm.h
-index 5f59fd226c..ef27d4289d 100644
---- a/linux-headers/asm-riscv/kvm.h
-+++ b/linux-headers/asm-riscv/kvm.h
-@@ -18,6 +18,7 @@
- #define __KVM_HAVE_IRQ_LINE
-
- #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
-+#define KVM_DIRTY_LOG_PAGE_OFFSET 64
-
- #define KVM_INTERRUPT_SET -1U
- #define KVM_INTERRUPT_UNSET -2U
-diff --git a/linux-headers/asm-riscv/unistd_32.h b/linux-headers/asm-riscv/unistd_32.h
-index a5e769f1d9..6083373e88 100644
---- a/linux-headers/asm-riscv/unistd_32.h
-+++ b/linux-headers/asm-riscv/unistd_32.h
-@@ -315,6 +315,8 @@
- #define __NR_listxattrat 465
- #define __NR_removexattrat 466
- #define __NR_open_tree_attr 467
-+#define __NR_file_getattr 468
-+#define __NR_file_setattr 469
-
-
- #endif /* _ASM_UNISTD_32_H */
-diff --git a/linux-headers/asm-riscv/unistd_64.h b/linux-headers/asm-riscv/unistd_64.h
-index 8df4d64841..f0c7585c60 100644
---- a/linux-headers/asm-riscv/unistd_64.h
-+++ b/linux-headers/asm-riscv/unistd_64.h
-@@ -325,6 +325,8 @@
- #define __NR_listxattrat 465
- #define __NR_removexattrat 466
- #define __NR_open_tree_attr 467
-+#define __NR_file_getattr 468
-+#define __NR_file_setattr 469
-
-
- #endif /* _ASM_UNISTD_64_H */
-diff --git a/linux-headers/asm-s390/unistd_32.h b/linux-headers/asm-s390/unistd_32.h
-index 85eedbd18e..37b8f6f358 100644
---- a/linux-headers/asm-s390/unistd_32.h
-+++ b/linux-headers/asm-s390/unistd_32.h
-@@ -440,5 +440,7 @@
- #define __NR_listxattrat 465
- #define __NR_removexattrat 466
- #define __NR_open_tree_attr 467
-+#define __NR_file_getattr 468
-+#define __NR_file_setattr 469
-
- #endif /* _ASM_S390_UNISTD_32_H */
-diff --git a/linux-headers/asm-s390/unistd_64.h b/linux-headers/asm-s390/unistd_64.h
-index c03b1b9701..0652ba6331 100644
---- a/linux-headers/asm-s390/unistd_64.h
-+++ b/linux-headers/asm-s390/unistd_64.h
-@@ -388,5 +388,7 @@
- #define __NR_listxattrat 465
- #define __NR_removexattrat 466
- #define __NR_open_tree_attr 467
-+#define __NR_file_getattr 468
-+#define __NR_file_setattr 469
-
- #endif /* _ASM_S390_UNISTD_64_H */
-diff --git a/linux-headers/asm-x86/unistd_32.h b/linux-headers/asm-x86/unistd_32.h
-index 491d6b4eb6..8f784a5634 100644
---- a/linux-headers/asm-x86/unistd_32.h
-+++ b/linux-headers/asm-x86/unistd_32.h
-@@ -458,6 +458,8 @@
- #define __NR_listxattrat 465
- #define __NR_removexattrat 466
- #define __NR_open_tree_attr 467
-+#define __NR_file_getattr 468
-+#define __NR_file_setattr 469
-
-
- #endif /* _ASM_UNISTD_32_H */
-diff --git a/linux-headers/asm-x86/unistd_64.h b/linux-headers/asm-x86/unistd_64.h
-index 7cf88bf9bd..2f55bebb81 100644
---- a/linux-headers/asm-x86/unistd_64.h
-+++ b/linux-headers/asm-x86/unistd_64.h
-@@ -381,6 +381,8 @@
- #define __NR_listxattrat 465
- #define __NR_removexattrat 466
- #define __NR_open_tree_attr 467
-+#define __NR_file_getattr 468
-+#define __NR_file_setattr 469
-
-
- #endif /* _ASM_UNISTD_64_H */
-diff --git a/linux-headers/asm-x86/unistd_x32.h b/linux-headers/asm-x86/unistd_x32.h
-index 82959111e6..8cc8673f15 100644
---- a/linux-headers/asm-x86/unistd_x32.h
-+++ b/linux-headers/asm-x86/unistd_x32.h
-@@ -334,6 +334,8 @@
- #define __NR_listxattrat (__X32_SYSCALL_BIT + 465)
- #define __NR_removexattrat (__X32_SYSCALL_BIT + 466)
- #define __NR_open_tree_attr (__X32_SYSCALL_BIT + 467)
-+#define __NR_file_getattr (__X32_SYSCALL_BIT + 468)
-+#define __NR_file_setattr (__X32_SYSCALL_BIT + 469)
- #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
- #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
- #define __NR_ioctl (__X32_SYSCALL_BIT + 514)
-diff --git a/linux-headers/linux/iommufd.h b/linux-headers/linux/iommufd.h
-index cb0f7d6b4d..2105a03955 100644
---- a/linux-headers/linux/iommufd.h
-+++ b/linux-headers/linux/iommufd.h
-@@ -56,6 +56,7 @@ enum {
- IOMMUFD_CMD_VDEVICE_ALLOC = 0x91,
- IOMMUFD_CMD_IOAS_CHANGE_PROCESS = 0x92,
- IOMMUFD_CMD_VEVENTQ_ALLOC = 0x93,
-+ IOMMUFD_CMD_HW_QUEUE_ALLOC = 0x94,
- };
-
- /**
-@@ -590,17 +591,44 @@ struct iommu_hw_info_arm_smmuv3 {
- __u32 aidr;
- };
-
-+/**
-+ * struct iommu_hw_info_tegra241_cmdqv - NVIDIA Tegra241 CMDQV Hardware
-+ * Information (IOMMU_HW_INFO_TYPE_TEGRA241_CMDQV)
-+ *
-+ * @flags: Must be 0
-+ * @version: Version number for the CMDQ-V HW for PARAM bits[03:00]
-+ * @log2vcmdqs: Log2 of the total number of VCMDQs for PARAM bits[07:04]
-+ * @log2vsids: Log2 of the total number of SID replacements for PARAM bits[15:12]
-+ * @__reserved: Must be 0
-+ *
-+ * VMM can use these fields directly in its emulated global PARAM register. Note
-+ * that only one Virtual Interface (VINTF) should be exposed to a VM, i.e. PARAM
-+ * bits[11:08] should be set to 0 for log2 of the total number of VINTFs.
-+ */
-+struct iommu_hw_info_tegra241_cmdqv {
-+ __u32 flags;
-+ __u8 version;
-+ __u8 log2vcmdqs;
-+ __u8 log2vsids;
-+ __u8 __reserved;
-+};
-+
- /**
- * enum iommu_hw_info_type - IOMMU Hardware Info Types
-- * @IOMMU_HW_INFO_TYPE_NONE: Used by the drivers that do not report hardware
-+ * @IOMMU_HW_INFO_TYPE_NONE: Output by the drivers that do not report hardware
- * info
-+ * @IOMMU_HW_INFO_TYPE_DEFAULT: Input to request for a default type
- * @IOMMU_HW_INFO_TYPE_INTEL_VTD: Intel VT-d iommu info type
- * @IOMMU_HW_INFO_TYPE_ARM_SMMUV3: ARM SMMUv3 iommu info type
-+ * @IOMMU_HW_INFO_TYPE_TEGRA241_CMDQV: NVIDIA Tegra241 CMDQV (extension for ARM
-+ * SMMUv3) info type
- */
- enum iommu_hw_info_type {
- IOMMU_HW_INFO_TYPE_NONE = 0,
-+ IOMMU_HW_INFO_TYPE_DEFAULT = 0,
- IOMMU_HW_INFO_TYPE_INTEL_VTD = 1,
- IOMMU_HW_INFO_TYPE_ARM_SMMUV3 = 2,
-+ IOMMU_HW_INFO_TYPE_TEGRA241_CMDQV = 3,
- };
-
- /**
-@@ -625,6 +653,15 @@ enum iommufd_hw_capabilities {
- IOMMU_HW_CAP_PCI_PASID_PRIV = 1 << 2,
- };
-
-+/**
-+ * enum iommufd_hw_info_flags - Flags for iommu_hw_info
-+ * @IOMMU_HW_INFO_FLAG_INPUT_TYPE: If set, @in_data_type carries an input type
-+ * for user space to request for a specific info
-+ */
-+enum iommufd_hw_info_flags {
-+ IOMMU_HW_INFO_FLAG_INPUT_TYPE = 1 << 0,
-+};
-+
- /**
- * struct iommu_hw_info - ioctl(IOMMU_GET_HW_INFO)
- * @size: sizeof(struct iommu_hw_info)
-@@ -634,6 +671,12 @@ enum iommufd_hw_capabilities {
- * data that kernel supports
- * @data_uptr: User pointer to a user-space buffer used by the kernel to fill
- * the iommu type specific hardware information data
-+ * @in_data_type: This shares the same field with @out_data_type, making it be
-+ * a bidirectional field. When IOMMU_HW_INFO_FLAG_INPUT_TYPE is
-+ * set, an input type carried via this @in_data_type field will
-+ * be valid, requesting for the info data to the given type. If
-+ * IOMMU_HW_INFO_FLAG_INPUT_TYPE is unset, any input value will
-+ * be seen as IOMMU_HW_INFO_TYPE_DEFAULT
- * @out_data_type: Output the iommu hardware info type as defined in the enum
- * iommu_hw_info_type.
- * @out_capabilities: Output the generic iommu capability info type as defined
-@@ -663,7 +706,10 @@ struct iommu_hw_info {
- __u32 dev_id;
- __u32 data_len;
- __aligned_u64 data_uptr;
-- __u32 out_data_type;
-+ union {
-+ __u32 in_data_type;
-+ __u32 out_data_type;
-+ };
- __u8 out_max_pasid_log2;
- __u8 __reserved[3];
- __aligned_u64 out_capabilities;
-@@ -951,10 +997,29 @@ struct iommu_fault_alloc {
- * enum iommu_viommu_type - Virtual IOMMU Type
- * @IOMMU_VIOMMU_TYPE_DEFAULT: Reserved for future use
- * @IOMMU_VIOMMU_TYPE_ARM_SMMUV3: ARM SMMUv3 driver specific type
-+ * @IOMMU_VIOMMU_TYPE_TEGRA241_CMDQV: NVIDIA Tegra241 CMDQV (extension for ARM
-+ * SMMUv3) enabled ARM SMMUv3 type
- */
- enum iommu_viommu_type {
- IOMMU_VIOMMU_TYPE_DEFAULT = 0,
- IOMMU_VIOMMU_TYPE_ARM_SMMUV3 = 1,
-+ IOMMU_VIOMMU_TYPE_TEGRA241_CMDQV = 2,
-+};
-+
-+/**
-+ * struct iommu_viommu_tegra241_cmdqv - NVIDIA Tegra241 CMDQV Virtual Interface
-+ * (IOMMU_VIOMMU_TYPE_TEGRA241_CMDQV)
-+ * @out_vintf_mmap_offset: mmap offset argument for VINTF's page0
-+ * @out_vintf_mmap_length: mmap length argument for VINTF's page0
-+ *
-+ * Both @out_vintf_mmap_offset and @out_vintf_mmap_length are reported by kernel
-+ * for user space to mmap the VINTF page0 from the host physical address space
-+ * to the guest physical address space so that a guest kernel can directly R/W
-+ * access to the VINTF page0 in order to control its virtual command queues.
-+ */
-+struct iommu_viommu_tegra241_cmdqv {
-+ __aligned_u64 out_vintf_mmap_offset;
-+ __aligned_u64 out_vintf_mmap_length;
- };
-
- /**
-@@ -965,6 +1030,9 @@ enum iommu_viommu_type {
- * @dev_id: The device's physical IOMMU will be used to back the virtual IOMMU
- * @hwpt_id: ID of a nesting parent HWPT to associate to
- * @out_viommu_id: Output virtual IOMMU ID for the allocated object
-+ * @data_len: Length of the type specific data
-+ * @__reserved: Must be 0
-+ * @data_uptr: User pointer to a driver-specific virtual IOMMU data
- *
- * Allocate a virtual IOMMU object, representing the underlying physical IOMMU's
- * virtualization support that is a security-isolated slice of the real IOMMU HW
-@@ -985,6 +1053,9 @@ struct iommu_viommu_alloc {
- __u32 dev_id;
- __u32 hwpt_id;
- __u32 out_viommu_id;
-+ __u32 data_len;
-+ __u32 __reserved;
-+ __aligned_u64 data_uptr;
- };
- #define IOMMU_VIOMMU_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_VIOMMU_ALLOC)
-
-@@ -995,10 +1066,15 @@ struct iommu_viommu_alloc {
- * @dev_id: The physical device to allocate a virtual instance on the vIOMMU
- * @out_vdevice_id: Object handle for the vDevice. Pass to IOMMU_DESTORY
- * @virt_id: Virtual device ID per vIOMMU, e.g. vSID of ARM SMMUv3, vDeviceID
-- * of AMD IOMMU, and vRID of a nested Intel VT-d to a Context Table
-+ * of AMD IOMMU, and vRID of Intel VT-d
- *
- * Allocate a virtual device instance (for a physical device) against a vIOMMU.
- * This instance holds the device's information (related to its vIOMMU) in a VM.
-+ * User should use IOMMU_DESTROY to destroy the virtual device before
-+ * destroying the physical device (by closing vfio_cdev fd). Otherwise the
-+ * virtual device would be forcibly destroyed on physical device destruction,
-+ * its vdevice_id would be permanently leaked (unremovable & unreusable) until
-+ * iommu fd closed.
- */
- struct iommu_vdevice_alloc {
- __u32 size;
-@@ -1075,10 +1151,12 @@ struct iommufd_vevent_header {
- * enum iommu_veventq_type - Virtual Event Queue Type
- * @IOMMU_VEVENTQ_TYPE_DEFAULT: Reserved for future use
- * @IOMMU_VEVENTQ_TYPE_ARM_SMMUV3: ARM SMMUv3 Virtual Event Queue
-+ * @IOMMU_VEVENTQ_TYPE_TEGRA241_CMDQV: NVIDIA Tegra241 CMDQV Extension IRQ
- */
- enum iommu_veventq_type {
- IOMMU_VEVENTQ_TYPE_DEFAULT = 0,
- IOMMU_VEVENTQ_TYPE_ARM_SMMUV3 = 1,
-+ IOMMU_VEVENTQ_TYPE_TEGRA241_CMDQV = 2,
- };
-
- /**
-@@ -1102,6 +1180,19 @@ struct iommu_vevent_arm_smmuv3 {
- __aligned_le64 evt[4];
- };
-
-+/**
-+ * struct iommu_vevent_tegra241_cmdqv - Tegra241 CMDQV IRQ
-+ * (IOMMU_VEVENTQ_TYPE_TEGRA241_CMDQV)
-+ * @lvcmdq_err_map: 128-bit logical vcmdq error map, little-endian.
-+ * (Refer to register LVCMDQ_ERR_MAPs per VINTF )
-+ *
-+ * The 128-bit register value from HW exclusively reflect the error bits for a
-+ * Virtual Interface represented by a vIOMMU object. Read and report directly.
-+ */
-+struct iommu_vevent_tegra241_cmdqv {
-+ __aligned_le64 lvcmdq_err_map[2];
-+};
-+
- /**
- * struct iommu_veventq_alloc - ioctl(IOMMU_VEVENTQ_ALLOC)
- * @size: sizeof(struct iommu_veventq_alloc)
-@@ -1141,4 +1232,61 @@ struct iommu_veventq_alloc {
- __u32 __reserved;
- };
- #define IOMMU_VEVENTQ_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_VEVENTQ_ALLOC)
-+
-+/**
-+ * enum iommu_hw_queue_type - HW Queue Type
-+ * @IOMMU_HW_QUEUE_TYPE_DEFAULT: Reserved for future use
-+ * @IOMMU_HW_QUEUE_TYPE_TEGRA241_CMDQV: NVIDIA Tegra241 CMDQV (extension for ARM
-+ * SMMUv3) Virtual Command Queue (VCMDQ)
-+ */
-+enum iommu_hw_queue_type {
-+ IOMMU_HW_QUEUE_TYPE_DEFAULT = 0,
-+ /*
-+ * TEGRA241_CMDQV requirements (otherwise, allocation will fail)
-+ * - alloc starts from the lowest @index=0 in ascending order
-+ * - destroy starts from the last allocated @index in descending order
-+ * - @base_addr must be aligned to @length in bytes and mapped in IOAS
-+ * - @length must be a power of 2, with a minimum 32 bytes and a maximum
-+ * 2 ^ idr[1].CMDQS * 16 bytes (use GET_HW_INFO call to read idr[1]
-+ * from struct iommu_hw_info_arm_smmuv3)
-+ * - suggest to back the queue memory with contiguous physical pages or
-+ * a single huge page with alignment of the queue size, and limit the
-+ * emulated vSMMU's IDR1.CMDQS to log2(huge page size / 16 bytes)
-+ */
-+ IOMMU_HW_QUEUE_TYPE_TEGRA241_CMDQV = 1,
-+};
-+
-+/**
-+ * struct iommu_hw_queue_alloc - ioctl(IOMMU_HW_QUEUE_ALLOC)
-+ * @size: sizeof(struct iommu_hw_queue_alloc)
-+ * @flags: Must be 0
-+ * @viommu_id: Virtual IOMMU ID to associate the HW queue with
-+ * @type: One of enum iommu_hw_queue_type
-+ * @index: The logical index to the HW queue per virtual IOMMU for a multi-queue
-+ * model
-+ * @out_hw_queue_id: The ID of the new HW queue
-+ * @nesting_parent_iova: Base address of the queue memory in the guest physical
-+ * address space
-+ * @length: Length of the queue memory
-+ *
-+ * Allocate a HW queue object for a vIOMMU-specific HW-accelerated queue, which
-+ * allows HW to access a guest queue memory described using @nesting_parent_iova
-+ * and @length.
-+ *
-+ * A vIOMMU can allocate multiple queues, but it must use a different @index per
-+ * type to separate each allocation, e.g::
-+ *
-+ * Type1 HW queue0, Type1 HW queue1, Type2 HW queue0, ...
-+ */
-+struct iommu_hw_queue_alloc {
-+ __u32 size;
-+ __u32 flags;
-+ __u32 viommu_id;
-+ __u32 type;
-+ __u32 index;
-+ __u32 out_hw_queue_id;
-+ __aligned_u64 nesting_parent_iova;
-+ __aligned_u64 length;
-+};
-+#define IOMMU_HW_QUEUE_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_HW_QUEUE_ALLOC)
- #endif
-diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
-index 32c5885a3c..be704965d8 100644
---- a/linux-headers/linux/kvm.h
-+++ b/linux-headers/linux/kvm.h
-@@ -636,6 +636,7 @@ struct kvm_ioeventfd {
- #define KVM_X86_DISABLE_EXITS_HLT (1 << 1)
- #define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2)
- #define KVM_X86_DISABLE_EXITS_CSTATE (1 << 3)
-+#define KVM_X86_DISABLE_EXITS_APERFMPERF (1 << 4)
-
- /* for KVM_ENABLE_CAP */
- struct kvm_enable_cap {
-@@ -952,6 +953,7 @@ struct kvm_enable_cap {
- #define KVM_CAP_ARM_EL2 240
- #define KVM_CAP_ARM_EL2_E2H0 241
- #define KVM_CAP_RISCV_MP_STATE_RESET 242
-+#define KVM_CAP_ARM_CACHEABLE_PFNMAP_SUPPORTED 243
-
- struct kvm_irq_routing_irqchip {
- __u32 irqchip;
-diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h
-index 79bf8c0cc5..4d96d1fc12 100644
---- a/linux-headers/linux/vfio.h
-+++ b/linux-headers/linux/vfio.h
-@@ -905,10 +905,12 @@ struct vfio_device_feature {
- * VFIO_DEVICE_BIND_IOMMUFD - _IOR(VFIO_TYPE, VFIO_BASE + 18,
- * struct vfio_device_bind_iommufd)
- * @argsz: User filled size of this data.
-- * @flags: Must be 0.
-+ * @flags: Must be 0 or a bit flags of VFIO_DEVICE_BIND_*
- * @iommufd: iommufd to bind.
- * @out_devid: The device id generated by this bind. devid is a handle for
- * this device/iommufd bond and can be used in IOMMUFD commands.
-+ * @token_uuid_ptr: Valid if VFIO_DEVICE_BIND_FLAG_TOKEN. Points to a 16 byte
-+ * UUID in the same format as VFIO_DEVICE_FEATURE_PCI_VF_TOKEN.
- *
- * Bind a vfio_device to the specified iommufd.
- *
-@@ -917,13 +919,21 @@ struct vfio_device_feature {
- *
- * Unbind is automatically conducted when device fd is closed.
- *
-+ * A token is sometimes required to open the device, unless this is known to be
-+ * needed VFIO_DEVICE_BIND_FLAG_TOKEN should not be set and token_uuid_ptr is
-+ * ignored. The only case today is a PF/VF relationship where the VF bind must
-+ * be provided the same token as VFIO_DEVICE_FEATURE_PCI_VF_TOKEN provided to
-+ * the PF.
-+ *
- * Return: 0 on success, -errno on failure.
- */
- struct vfio_device_bind_iommufd {
- __u32 argsz;
- __u32 flags;
-+#define VFIO_DEVICE_BIND_FLAG_TOKEN (1 << 0)
- __s32 iommufd;
- __u32 out_devid;
-+ __aligned_u64 token_uuid_ptr;
- };
-
- #define VFIO_DEVICE_BIND_IOMMUFD _IO(VFIO_TYPE, VFIO_BASE + 18)
-diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h
-index d4b3e2ae13..283348b64a 100644
---- a/linux-headers/linux/vhost.h
-+++ b/linux-headers/linux/vhost.h
-@@ -235,4 +235,39 @@
- */
- #define VHOST_VDPA_GET_VRING_SIZE _IOWR(VHOST_VIRTIO, 0x82, \
- struct vhost_vring_state)
-+
-+/* Extended features manipulation */
-+#define VHOST_GET_FEATURES_ARRAY _IOR(VHOST_VIRTIO, 0x83, \
-+ struct vhost_features_array)
-+#define VHOST_SET_FEATURES_ARRAY _IOW(VHOST_VIRTIO, 0x83, \
-+ struct vhost_features_array)
-+
-+/* fork_owner values for vhost */
-+#define VHOST_FORK_OWNER_KTHREAD 0
-+#define VHOST_FORK_OWNER_TASK 1
-+
-+/**
-+ * VHOST_SET_FORK_FROM_OWNER - Set the fork_owner flag for the vhost device,
-+ * This ioctl must called before VHOST_SET_OWNER.
-+ * Only available when CONFIG_VHOST_ENABLE_FORK_OWNER_CONTROL=y
-+ *
-+ * @param fork_owner: An 8-bit value that determines the vhost thread mode
-+ *
-+ * When fork_owner is set to VHOST_FORK_OWNER_TASK(default value):
-+ * - Vhost will create vhost worker as tasks forked from the owner,
-+ * inheriting all of the owner's attributes.
-+ *
-+ * When fork_owner is set to VHOST_FORK_OWNER_KTHREAD:
-+ * - Vhost will create vhost workers as kernel threads.
-+ */
-+#define VHOST_SET_FORK_FROM_OWNER _IOW(VHOST_VIRTIO, 0x83, __u8)
-+
-+/**
-+ * VHOST_GET_FORK_OWNER - Get the current fork_owner flag for the vhost device.
-+ * Only available when CONFIG_VHOST_ENABLE_FORK_OWNER_CONTROL=y
-+ *
-+ * @return: An 8-bit value indicating the current thread mode.
-+ */
-+#define VHOST_GET_FORK_FROM_OWNER _IOR(VHOST_VIRTIO, 0x84, __u8)
-+
- #endif
---
-2.47.3
-
diff --git a/kvm-linux-headers-Update-to-Linux-v6.18-rc3.patch b/kvm-linux-headers-Update-to-Linux-v6.18-rc3.patch
deleted file mode 100644
index a9bb075..0000000
--- a/kvm-linux-headers-Update-to-Linux-v6.18-rc3.patch
+++ /dev/null
@@ -1,518 +0,0 @@
-From 4834172d31633fc2df58673656236db0b07129ae Mon Sep 17 00:00:00 2001
-From: Bibo Mao <maobibo@loongson.cn>
-Date: Mon, 27 Oct 2025 09:43:32 +0800
-Subject: [PATCH 113/116] linux-headers: Update to Linux v6.18-rc3
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [97/100] 8ff3487a78ecfae2cf9c6751a8437c044321def7 (rovick1/qemu-kvm)
-
-Update headers to retrieve the latest KVM caps for LoongArch. It is added
-to the tree by running `update-linux-headers.sh` on linux v6.18-rc3.
-
-Signed-off-by: Bibo Mao <maobibo@loongson.cn>
-Reviewed-by: Song Gao <gaosong@loongson.cn>
-(cherry picked from commit 2e0096a2b6a5a7e3cde1dd13704cc71af6b9bdd7)
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
----
- include/standard-headers/linux/ethtool.h | 1 +
- include/standard-headers/linux/fuse.h | 22 ++++++++++--
- .../linux/input-event-codes.h | 1 +
- include/standard-headers/linux/input.h | 22 +++++++++++-
- include/standard-headers/linux/pci_regs.h | 10 ++++++
- include/standard-headers/linux/virtio_ids.h | 1 +
- linux-headers/asm-loongarch/kvm.h | 1 +
- linux-headers/asm-riscv/kvm.h | 23 ++++++++++++-
- linux-headers/asm-riscv/ptrace.h | 4 +--
- linux-headers/asm-x86/kvm.h | 34 +++++++++++++++++++
- linux-headers/asm-x86/unistd_64.h | 1 +
- linux-headers/asm-x86/unistd_x32.h | 1 +
- linux-headers/linux/kvm.h | 3 ++
- linux-headers/linux/psp-sev.h | 10 +++++-
- linux-headers/linux/stddef.h | 1 -
- linux-headers/linux/vduse.h | 2 +-
- linux-headers/linux/vhost.h | 4 +--
- 17 files changed, 130 insertions(+), 11 deletions(-)
-
-diff --git a/include/standard-headers/linux/ethtool.h b/include/standard-headers/linux/ethtool.h
-index eb80314028..dc24512d28 100644
---- a/include/standard-headers/linux/ethtool.h
-+++ b/include/standard-headers/linux/ethtool.h
-@@ -2380,6 +2380,7 @@ enum {
- #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
- #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
- #define RXH_GTP_TEID (1 << 8) /* teid in case of GTP */
-+#define RXH_IP6_FL (1 << 9) /* IPv6 flow label */
- #define RXH_DISCARD (1 << 31)
-
- #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
-diff --git a/include/standard-headers/linux/fuse.h b/include/standard-headers/linux/fuse.h
-index d8b2fd67e1..abf3a78858 100644
---- a/include/standard-headers/linux/fuse.h
-+++ b/include/standard-headers/linux/fuse.h
-@@ -235,6 +235,11 @@
- *
- * 7.44
- * - add FUSE_NOTIFY_INC_EPOCH
-+ *
-+ * 7.45
-+ * - add FUSE_COPY_FILE_RANGE_64
-+ * - add struct fuse_copy_file_range_out
-+ * - add FUSE_NOTIFY_PRUNE
- */
-
- #ifndef _LINUX_FUSE_H
-@@ -266,7 +271,7 @@
- #define FUSE_KERNEL_VERSION 7
-
- /** Minor version number of this interface */
--#define FUSE_KERNEL_MINOR_VERSION 44
-+#define FUSE_KERNEL_MINOR_VERSION 45
-
- /** The node ID of the root inode */
- #define FUSE_ROOT_ID 1
-@@ -653,6 +658,7 @@ enum fuse_opcode {
- FUSE_SYNCFS = 50,
- FUSE_TMPFILE = 51,
- FUSE_STATX = 52,
-+ FUSE_COPY_FILE_RANGE_64 = 53,
-
- /* CUSE specific operations */
- CUSE_INIT = 4096,
-@@ -671,7 +677,7 @@ enum fuse_notify_code {
- FUSE_NOTIFY_DELETE = 6,
- FUSE_NOTIFY_RESEND = 7,
- FUSE_NOTIFY_INC_EPOCH = 8,
-- FUSE_NOTIFY_CODE_MAX,
-+ FUSE_NOTIFY_PRUNE = 9,
- };
-
- /* The read buffer is required to be at least 8k, but may be much larger */
-@@ -1110,6 +1116,12 @@ struct fuse_notify_retrieve_in {
- uint64_t dummy4;
- };
-
-+struct fuse_notify_prune_out {
-+ uint32_t count;
-+ uint32_t padding;
-+ uint64_t spare;
-+};
-+
- struct fuse_backing_map {
- int32_t fd;
- uint32_t flags;
-@@ -1122,6 +1134,7 @@ struct fuse_backing_map {
- #define FUSE_DEV_IOC_BACKING_OPEN _IOW(FUSE_DEV_IOC_MAGIC, 1, \
- struct fuse_backing_map)
- #define FUSE_DEV_IOC_BACKING_CLOSE _IOW(FUSE_DEV_IOC_MAGIC, 2, uint32_t)
-+#define FUSE_DEV_IOC_SYNC_INIT _IO(FUSE_DEV_IOC_MAGIC, 3)
-
- struct fuse_lseek_in {
- uint64_t fh;
-@@ -1144,6 +1157,11 @@ struct fuse_copy_file_range_in {
- uint64_t flags;
- };
-
-+/* For FUSE_COPY_FILE_RANGE_64 */
-+struct fuse_copy_file_range_out {
-+ uint64_t bytes_copied;
-+};
-+
- #define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0)
- #define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1)
- struct fuse_setupmapping_in {
-diff --git a/include/standard-headers/linux/input-event-codes.h b/include/standard-headers/linux/input-event-codes.h
-index 00dc9caac9..c914ccd723 100644
---- a/include/standard-headers/linux/input-event-codes.h
-+++ b/include/standard-headers/linux/input-event-codes.h
-@@ -27,6 +27,7 @@
- #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
- #define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
- #define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
-+#define INPUT_PROP_HAPTIC_TOUCHPAD 0x07 /* is a haptic touchpad */
-
- #define INPUT_PROP_MAX 0x1f
- #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
-diff --git a/include/standard-headers/linux/input.h b/include/standard-headers/linux/input.h
-index d4512c20b5..9aff211dd5 100644
---- a/include/standard-headers/linux/input.h
-+++ b/include/standard-headers/linux/input.h
-@@ -426,6 +426,24 @@ struct ff_rumble_effect {
- uint16_t weak_magnitude;
- };
-
-+/**
-+ * struct ff_haptic_effect
-+ * @hid_usage: hid_usage according to Haptics page (WAVEFORM_CLICK, etc.)
-+ * @vendor_id: the waveform vendor ID if hid_usage is in the vendor-defined range
-+ * @vendor_waveform_page: the vendor waveform page if hid_usage is in the vendor-defined range
-+ * @intensity: strength of the effect as percentage
-+ * @repeat_count: number of times to retrigger effect
-+ * @retrigger_period: time before effect is retriggered (in ms)
-+ */
-+struct ff_haptic_effect {
-+ uint16_t hid_usage;
-+ uint16_t vendor_id;
-+ uint8_t vendor_waveform_page;
-+ uint16_t intensity;
-+ uint16_t repeat_count;
-+ uint16_t retrigger_period;
-+};
-+
- /**
- * struct ff_effect - defines force feedback effect
- * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
-@@ -462,6 +480,7 @@ struct ff_effect {
- struct ff_periodic_effect periodic;
- struct ff_condition_effect condition[2]; /* One for each axis */
- struct ff_rumble_effect rumble;
-+ struct ff_haptic_effect haptic;
- } u;
- };
-
-@@ -469,6 +488,7 @@ struct ff_effect {
- * Force feedback effect types
- */
-
-+#define FF_HAPTIC 0x4f
- #define FF_RUMBLE 0x50
- #define FF_PERIODIC 0x51
- #define FF_CONSTANT 0x52
-@@ -478,7 +498,7 @@ struct ff_effect {
- #define FF_INERTIA 0x56
- #define FF_RAMP 0x57
-
--#define FF_EFFECT_MIN FF_RUMBLE
-+#define FF_EFFECT_MIN FF_HAPTIC
- #define FF_EFFECT_MAX FF_RAMP
-
- /*
-diff --git a/include/standard-headers/linux/pci_regs.h b/include/standard-headers/linux/pci_regs.h
-index f5b17745de..07e06aafec 100644
---- a/include/standard-headers/linux/pci_regs.h
-+++ b/include/standard-headers/linux/pci_regs.h
-@@ -207,6 +207,9 @@
-
- /* Capability lists */
-
-+#define PCI_CAP_ID_MASK 0x00ff /* Capability ID mask */
-+#define PCI_CAP_LIST_NEXT_MASK 0xff00 /* Next Capability Pointer mask */
-+
- #define PCI_CAP_LIST_ID 0 /* Capability ID */
- #define PCI_CAP_ID_PM 0x01 /* Power Management */
- #define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */
-@@ -776,6 +779,12 @@
- #define PCI_ERR_UNC_MCBTLP 0x00800000 /* MC blocked TLP */
- #define PCI_ERR_UNC_ATOMEG 0x01000000 /* Atomic egress blocked */
- #define PCI_ERR_UNC_TLPPRE 0x02000000 /* TLP prefix blocked */
-+#define PCI_ERR_UNC_POISON_BLK 0x04000000 /* Poisoned TLP Egress Blocked */
-+#define PCI_ERR_UNC_DMWR_BLK 0x08000000 /* DMWr Request Egress Blocked */
-+#define PCI_ERR_UNC_IDE_CHECK 0x10000000 /* IDE Check Failed */
-+#define PCI_ERR_UNC_MISR_IDE 0x20000000 /* Misrouted IDE TLP */
-+#define PCI_ERR_UNC_PCRC_CHECK 0x40000000 /* PCRC Check Failed */
-+#define PCI_ERR_UNC_XLAT_BLK 0x80000000 /* TLP Translation Egress Blocked */
- #define PCI_ERR_UNCOR_MASK 0x08 /* Uncorrectable Error Mask */
- /* Same bits as above */
- #define PCI_ERR_UNCOR_SEVER 0x0c /* Uncorrectable Error Severity */
-@@ -798,6 +807,7 @@
- #define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */
- #define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */
- #define PCI_ERR_CAP_PREFIX_LOG_PRESENT 0x00000800 /* TLP Prefix Log Present */
-+#define PCI_ERR_CAP_COMP_TIME_LOG 0x00001000 /* Completion Timeout Prefix/Header Log Capable */
- #define PCI_ERR_CAP_TLP_LOG_FLIT 0x00040000 /* TLP was logged in Flit Mode */
- #define PCI_ERR_CAP_TLP_LOG_SIZE 0x00f80000 /* Logged TLP Size (only in Flit mode) */
- #define PCI_ERR_HEADER_LOG 0x1c /* Header Log Register (16 bytes) */
-diff --git a/include/standard-headers/linux/virtio_ids.h b/include/standard-headers/linux/virtio_ids.h
-index 7aa2eb7662..6c12db16fa 100644
---- a/include/standard-headers/linux/virtio_ids.h
-+++ b/include/standard-headers/linux/virtio_ids.h
-@@ -68,6 +68,7 @@
- #define VIRTIO_ID_AUDIO_POLICY 39 /* virtio audio policy */
- #define VIRTIO_ID_BT 40 /* virtio bluetooth */
- #define VIRTIO_ID_GPIO 41 /* virtio gpio */
-+#define VIRTIO_ID_SPI 45 /* virtio spi */
-
- /*
- * Virtio Transitional IDs
-diff --git a/linux-headers/asm-loongarch/kvm.h b/linux-headers/asm-loongarch/kvm.h
-index 5f354f5c68..57ba1a563b 100644
---- a/linux-headers/asm-loongarch/kvm.h
-+++ b/linux-headers/asm-loongarch/kvm.h
-@@ -103,6 +103,7 @@ struct kvm_fpu {
- #define KVM_LOONGARCH_VM_FEAT_PMU 5
- #define KVM_LOONGARCH_VM_FEAT_PV_IPI 6
- #define KVM_LOONGARCH_VM_FEAT_PV_STEALTIME 7
-+#define KVM_LOONGARCH_VM_FEAT_PTW 8
-
- /* Device Control API on vcpu fd */
- #define KVM_LOONGARCH_VCPU_CPUCFG 0
-diff --git a/linux-headers/asm-riscv/kvm.h b/linux-headers/asm-riscv/kvm.h
-index ef27d4289d..759a4852c0 100644
---- a/linux-headers/asm-riscv/kvm.h
-+++ b/linux-headers/asm-riscv/kvm.h
-@@ -9,7 +9,7 @@
- #ifndef __LINUX_KVM_RISCV_H
- #define __LINUX_KVM_RISCV_H
-
--#ifndef __ASSEMBLY__
-+#ifndef __ASSEMBLER__
-
- #include <linux/types.h>
- #include <asm/bitsperlong.h>
-@@ -56,6 +56,7 @@ struct kvm_riscv_config {
- unsigned long mimpid;
- unsigned long zicboz_block_size;
- unsigned long satp_mode;
-+ unsigned long zicbop_block_size;
- };
-
- /* CORE registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */
-@@ -185,6 +186,10 @@ enum KVM_RISCV_ISA_EXT_ID {
- KVM_RISCV_ISA_EXT_ZICCRSE,
- KVM_RISCV_ISA_EXT_ZAAMO,
- KVM_RISCV_ISA_EXT_ZALRSC,
-+ KVM_RISCV_ISA_EXT_ZICBOP,
-+ KVM_RISCV_ISA_EXT_ZFBFMIN,
-+ KVM_RISCV_ISA_EXT_ZVFBFMIN,
-+ KVM_RISCV_ISA_EXT_ZVFBFWMA,
- KVM_RISCV_ISA_EXT_MAX,
- };
-
-@@ -205,6 +210,7 @@ enum KVM_RISCV_SBI_EXT_ID {
- KVM_RISCV_SBI_EXT_DBCN,
- KVM_RISCV_SBI_EXT_STA,
- KVM_RISCV_SBI_EXT_SUSP,
-+ KVM_RISCV_SBI_EXT_FWFT,
- KVM_RISCV_SBI_EXT_MAX,
- };
-
-@@ -214,6 +220,18 @@ struct kvm_riscv_sbi_sta {
- unsigned long shmem_hi;
- };
-
-+struct kvm_riscv_sbi_fwft_feature {
-+ unsigned long enable;
-+ unsigned long flags;
-+ unsigned long value;
-+};
-+
-+/* SBI FWFT extension registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */
-+struct kvm_riscv_sbi_fwft {
-+ struct kvm_riscv_sbi_fwft_feature misaligned_deleg;
-+ struct kvm_riscv_sbi_fwft_feature pointer_masking;
-+};
-+
- /* Possible states for kvm_riscv_timer */
- #define KVM_RISCV_TIMER_STATE_OFF 0
- #define KVM_RISCV_TIMER_STATE_ON 1
-@@ -297,6 +315,9 @@ struct kvm_riscv_sbi_sta {
- #define KVM_REG_RISCV_SBI_STA (0x0 << KVM_REG_RISCV_SUBTYPE_SHIFT)
- #define KVM_REG_RISCV_SBI_STA_REG(name) \
- (offsetof(struct kvm_riscv_sbi_sta, name) / sizeof(unsigned long))
-+#define KVM_REG_RISCV_SBI_FWFT (0x1 << KVM_REG_RISCV_SUBTYPE_SHIFT)
-+#define KVM_REG_RISCV_SBI_FWFT_REG(name) \
-+ (offsetof(struct kvm_riscv_sbi_fwft, name) / sizeof(unsigned long))
-
- /* Device Control API: RISC-V AIA */
- #define KVM_DEV_RISCV_APLIC_ALIGN 0x1000
-diff --git a/linux-headers/asm-riscv/ptrace.h b/linux-headers/asm-riscv/ptrace.h
-index 1e3166caca..a3f8211ede 100644
---- a/linux-headers/asm-riscv/ptrace.h
-+++ b/linux-headers/asm-riscv/ptrace.h
-@@ -6,7 +6,7 @@
- #ifndef _ASM_RISCV_PTRACE_H
- #define _ASM_RISCV_PTRACE_H
-
--#ifndef __ASSEMBLY__
-+#ifndef __ASSEMBLER__
-
- #include <linux/types.h>
-
-@@ -127,6 +127,6 @@ struct __riscv_v_regset_state {
- */
- #define RISCV_MAX_VLENB (8192)
-
--#endif /* __ASSEMBLY__ */
-+#endif /* __ASSEMBLER__ */
-
- #endif /* _ASM_RISCV_PTRACE_H */
-diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
-index f0c1a730d9..3bb38f6c3a 100644
---- a/linux-headers/asm-x86/kvm.h
-+++ b/linux-headers/asm-x86/kvm.h
-@@ -35,6 +35,11 @@
- #define MC_VECTOR 18
- #define XM_VECTOR 19
- #define VE_VECTOR 20
-+#define CP_VECTOR 21
-+
-+#define HV_VECTOR 28
-+#define VC_VECTOR 29
-+#define SX_VECTOR 30
-
- /* Select x86 specific features in <linux/kvm.h> */
- #define __KVM_HAVE_PIT
-@@ -409,6 +414,35 @@ struct kvm_xcrs {
- __u64 padding[16];
- };
-
-+#define KVM_X86_REG_TYPE_MSR 2
-+#define KVM_X86_REG_TYPE_KVM 3
-+
-+#define KVM_X86_KVM_REG_SIZE(reg) \
-+({ \
-+ reg == KVM_REG_GUEST_SSP ? KVM_REG_SIZE_U64 : 0; \
-+})
-+
-+#define KVM_X86_REG_TYPE_SIZE(type, reg) \
-+({ \
-+ __u64 type_size = (__u64)type << 32; \
-+ \
-+ type_size |= type == KVM_X86_REG_TYPE_MSR ? KVM_REG_SIZE_U64 : \
-+ type == KVM_X86_REG_TYPE_KVM ? KVM_X86_KVM_REG_SIZE(reg) : \
-+ 0; \
-+ type_size; \
-+})
-+
-+#define KVM_X86_REG_ID(type, index) \
-+ (KVM_REG_X86 | KVM_X86_REG_TYPE_SIZE(type, index) | index)
-+
-+#define KVM_X86_REG_MSR(index) \
-+ KVM_X86_REG_ID(KVM_X86_REG_TYPE_MSR, index)
-+#define KVM_X86_REG_KVM(index) \
-+ KVM_X86_REG_ID(KVM_X86_REG_TYPE_KVM, index)
-+
-+/* KVM-defined registers starting from 0 */
-+#define KVM_REG_GUEST_SSP 0
-+
- #define KVM_SYNC_X86_REGS (1UL << 0)
- #define KVM_SYNC_X86_SREGS (1UL << 1)
- #define KVM_SYNC_X86_EVENTS (1UL << 2)
-diff --git a/linux-headers/asm-x86/unistd_64.h b/linux-headers/asm-x86/unistd_64.h
-index 2f55bebb81..26c258d1a6 100644
---- a/linux-headers/asm-x86/unistd_64.h
-+++ b/linux-headers/asm-x86/unistd_64.h
-@@ -337,6 +337,7 @@
- #define __NR_io_pgetevents 333
- #define __NR_rseq 334
- #define __NR_uretprobe 335
-+#define __NR_uprobe 336
- #define __NR_pidfd_send_signal 424
- #define __NR_io_uring_setup 425
- #define __NR_io_uring_enter 426
-diff --git a/linux-headers/asm-x86/unistd_x32.h b/linux-headers/asm-x86/unistd_x32.h
-index 8cc8673f15..65c2aed946 100644
---- a/linux-headers/asm-x86/unistd_x32.h
-+++ b/linux-headers/asm-x86/unistd_x32.h
-@@ -290,6 +290,7 @@
- #define __NR_io_pgetevents (__X32_SYSCALL_BIT + 333)
- #define __NR_rseq (__X32_SYSCALL_BIT + 334)
- #define __NR_uretprobe (__X32_SYSCALL_BIT + 335)
-+#define __NR_uprobe (__X32_SYSCALL_BIT + 336)
- #define __NR_pidfd_send_signal (__X32_SYSCALL_BIT + 424)
- #define __NR_io_uring_setup (__X32_SYSCALL_BIT + 425)
- #define __NR_io_uring_enter (__X32_SYSCALL_BIT + 426)
-diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
-index be704965d8..4ea28ef7ca 100644
---- a/linux-headers/linux/kvm.h
-+++ b/linux-headers/linux/kvm.h
-@@ -954,6 +954,7 @@ struct kvm_enable_cap {
- #define KVM_CAP_ARM_EL2_E2H0 241
- #define KVM_CAP_RISCV_MP_STATE_RESET 242
- #define KVM_CAP_ARM_CACHEABLE_PFNMAP_SUPPORTED 243
-+#define KVM_CAP_GUEST_MEMFD_FLAGS 244
-
- struct kvm_irq_routing_irqchip {
- __u32 irqchip;
-@@ -1590,6 +1591,8 @@ struct kvm_memory_attributes {
- #define KVM_MEMORY_ATTRIBUTE_PRIVATE (1ULL << 3)
-
- #define KVM_CREATE_GUEST_MEMFD _IOWR(KVMIO, 0xd4, struct kvm_create_guest_memfd)
-+#define GUEST_MEMFD_FLAG_MMAP (1ULL << 0)
-+#define GUEST_MEMFD_FLAG_INIT_SHARED (1ULL << 1)
-
- struct kvm_create_guest_memfd {
- __u64 size;
-diff --git a/linux-headers/linux/psp-sev.h b/linux-headers/linux/psp-sev.h
-index 113c4ceb78..c525125ea8 100644
---- a/linux-headers/linux/psp-sev.h
-+++ b/linux-headers/linux/psp-sev.h
-@@ -185,6 +185,10 @@ struct sev_user_data_get_id2 {
- * @mask_chip_id: whether chip id is present in attestation reports or not
- * @mask_chip_key: whether attestation reports are signed or not
- * @vlek_en: VLEK (Version Loaded Endorsement Key) hashstick is loaded
-+ * @feature_info: whether SNP_FEATURE_INFO command is available
-+ * @rapl_dis: whether RAPL is disabled
-+ * @ciphertext_hiding_cap: whether platform has ciphertext hiding capability
-+ * @ciphertext_hiding_en: whether ciphertext hiding is enabled
- * @rsvd1: reserved
- * @guest_count: the number of guest currently managed by the firmware
- * @current_tcb_version: current TCB version
-@@ -200,7 +204,11 @@ struct sev_user_data_snp_status {
- __u32 mask_chip_id:1; /* Out */
- __u32 mask_chip_key:1; /* Out */
- __u32 vlek_en:1; /* Out */
-- __u32 rsvd1:29;
-+ __u32 feature_info:1; /* Out */
-+ __u32 rapl_dis:1; /* Out */
-+ __u32 ciphertext_hiding_cap:1; /* Out */
-+ __u32 ciphertext_hiding_en:1; /* Out */
-+ __u32 rsvd1:25;
- __u32 guest_count; /* Out */
- __u64 current_tcb_version; /* Out */
- __u64 reported_tcb_version; /* Out */
-diff --git a/linux-headers/linux/stddef.h b/linux-headers/linux/stddef.h
-index e1fcfcf3b3..48ee4438e0 100644
---- a/linux-headers/linux/stddef.h
-+++ b/linux-headers/linux/stddef.h
-@@ -3,7 +3,6 @@
- #define _LINUX_STDDEF_H
-
-
--
- #ifndef __always_inline
- #define __always_inline __inline__
- #endif
-diff --git a/linux-headers/linux/vduse.h b/linux-headers/linux/vduse.h
-index f46269af34..da6ac89af1 100644
---- a/linux-headers/linux/vduse.h
-+++ b/linux-headers/linux/vduse.h
-@@ -237,7 +237,7 @@ struct vduse_iova_umem {
- * struct vduse_iova_info - information of one IOVA region
- * @start: start of the IOVA region
- * @last: last of the IOVA region
-- * @capability: capability of the IOVA regsion
-+ * @capability: capability of the IOVA region
- * @reserved: for future use, needs to be initialized to zero
- *
- * Structure used by VDUSE_IOTLB_GET_INFO ioctl to get information of
-diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h
-index 283348b64a..c57674a6aa 100644
---- a/linux-headers/linux/vhost.h
-+++ b/linux-headers/linux/vhost.h
-@@ -260,7 +260,7 @@
- * When fork_owner is set to VHOST_FORK_OWNER_KTHREAD:
- * - Vhost will create vhost workers as kernel threads.
- */
--#define VHOST_SET_FORK_FROM_OWNER _IOW(VHOST_VIRTIO, 0x83, __u8)
-+#define VHOST_SET_FORK_FROM_OWNER _IOW(VHOST_VIRTIO, 0x84, __u8)
-
- /**
- * VHOST_GET_FORK_OWNER - Get the current fork_owner flag for the vhost device.
-@@ -268,6 +268,6 @@
- *
- * @return: An 8-bit value indicating the current thread mode.
- */
--#define VHOST_GET_FORK_FROM_OWNER _IOR(VHOST_VIRTIO, 0x84, __u8)
-+#define VHOST_GET_FORK_FROM_OWNER _IOR(VHOST_VIRTIO, 0x85, __u8)
-
- #endif
---
-2.52.0
-
diff --git a/kvm-linux-headers-Update-to-Linux-v6.19-rc1.patch b/kvm-linux-headers-Update-to-Linux-v6.19-rc1.patch
deleted file mode 100644
index f1b7cd4..0000000
--- a/kvm-linux-headers-Update-to-Linux-v6.19-rc1.patch
+++ /dev/null
@@ -1,984 +0,0 @@
-From 5c7e99a166ac5d0c5ca5ef27dc2873f09d3bb00d Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Wed, 21 Jan 2026 11:41:09 +0000
-Subject: [PATCH 114/116] linux-headers: Update to Linux v6.19-rc1
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [98/100] 5fcb1379dac08fcfd8b686404b616a197911b4b4 (rovick1/qemu-kvm)
-
-Mainly for adding support for VFIO DMABUF. While at it, update all
-headers.
-
-The header update breaks virtio-net due to virtio_net_hdr_v1_hash
-changes. Include the virtio-net changes to avoid build and bisect
-failures.
-
-Cc: Michael S. Tsirkin <mst@redhat.com>
-Cc: Jason Wang <jasowang@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20260121114111.34045-2-skolothumtho@nvidia.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 49f6b93d0752b91c233ae8097d00a986cb8482c3)
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
----
- hw/net/virtio-net.c | 11 +-
- include/standard-headers/drm/drm_fourcc.h | 25 ++--
- include/standard-headers/linux/ethtool.h | 5 +
- .../linux/input-event-codes.h | 14 ++-
- include/standard-headers/linux/pci_regs.h | 89 ++++++++++++++
- include/standard-headers/linux/virtio_net.h | 3 +-
- include/standard-headers/linux/virtio_pci.h | 2 +-
- linux-headers/asm-arm64/kvm.h | 2 +-
- linux-headers/asm-arm64/unistd_64.h | 1 +
- linux-headers/asm-generic/unistd.h | 4 +-
- linux-headers/asm-loongarch/kvm.h | 1 +
- linux-headers/asm-loongarch/unistd.h | 6 +
- linux-headers/asm-loongarch/unistd_64.h | 1 +
- linux-headers/asm-mips/unistd_n32.h | 1 +
- linux-headers/asm-mips/unistd_n64.h | 1 +
- linux-headers/asm-mips/unistd_o32.h | 1 +
- linux-headers/asm-powerpc/unistd_32.h | 1 +
- linux-headers/asm-powerpc/unistd_64.h | 1 +
- linux-headers/asm-riscv/kvm.h | 3 +
- linux-headers/asm-riscv/unistd_32.h | 1 +
- linux-headers/asm-riscv/unistd_64.h | 1 +
- linux-headers/asm-s390/bitsperlong.h | 4 -
- linux-headers/asm-s390/unistd.h | 4 -
- linux-headers/asm-s390/unistd_64.h | 9 +-
- linux-headers/asm-x86/kvm.h | 1 +
- linux-headers/asm-x86/unistd_32.h | 1 +
- linux-headers/asm-x86/unistd_64.h | 1 +
- linux-headers/asm-x86/unistd_x32.h | 1 +
- linux-headers/linux/iommufd.h | 10 ++
- linux-headers/linux/kvm.h | 11 ++
- linux-headers/linux/mshv.h | 116 +++++++++++++++++-
- linux-headers/linux/psp-sev.h | 66 ++++++----
- linux-headers/linux/vfio.h | 28 +++++
- 33 files changed, 370 insertions(+), 56 deletions(-)
-
-diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
-index f021663f92..16e748c2c5 100644
---- a/hw/net/virtio-net.c
-+++ b/hw/net/virtio-net.c
-@@ -1875,7 +1875,8 @@ static int virtio_net_process_rss(NetClientState *nc, const uint8_t *buf,
- n->rss_data.runtime_hash_types);
- if (net_hash_type > NetPktRssIpV6UdpEx) {
- if (n->rss_data.populate_hash) {
-- hdr->hash_value = VIRTIO_NET_HASH_REPORT_NONE;
-+ hdr->hash_value_lo = VIRTIO_NET_HASH_REPORT_NONE;
-+ hdr->hash_value_hi = VIRTIO_NET_HASH_REPORT_NONE;
- hdr->hash_report = 0;
- }
- return n->rss_data.redirect ? n->rss_data.default_queue : -1;
-@@ -1884,7 +1885,8 @@ static int virtio_net_process_rss(NetClientState *nc, const uint8_t *buf,
- hash = net_rx_pkt_calc_rss_hash(pkt, net_hash_type, n->rss_data.key);
-
- if (n->rss_data.populate_hash) {
-- hdr->hash_value = hash;
-+ hdr->hash_value_lo = cpu_to_le16(hash & 0xffff);
-+ hdr->hash_value_hi = cpu_to_le16((hash >> 16) & 0xffff);
- hdr->hash_report = reports[net_hash_type];
- }
-
-@@ -1986,10 +1988,11 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
-
- receive_header(n, sg, elem->in_num, buf, size);
- if (n->rss_data.populate_hash) {
-- offset = offsetof(typeof(extra_hdr), hash_value);
-+ offset = offsetof(typeof(extra_hdr), hash_value_lo);
- iov_from_buf(sg, elem->in_num, offset,
- (char *)&extra_hdr + offset,
-- sizeof(extra_hdr.hash_value) +
-+ sizeof(extra_hdr.hash_value_lo) +
-+ sizeof(extra_hdr.hash_value_hi) +
- sizeof(extra_hdr.hash_report));
- }
- offset = n->host_hdr_len;
-diff --git a/include/standard-headers/drm/drm_fourcc.h b/include/standard-headers/drm/drm_fourcc.h
-index cef077dfb3..b39e197cc7 100644
---- a/include/standard-headers/drm/drm_fourcc.h
-+++ b/include/standard-headers/drm/drm_fourcc.h
-@@ -978,14 +978,20 @@ extern "C" {
- * 2 = Gob Height 8, Turing+ Page Kind mapping
- * 3 = Reserved for future use.
- *
-- * 22:22 s Sector layout. On Tegra GPUs prior to Xavier, there is a further
-- * bit remapping step that occurs at an even lower level than the
-- * page kind and block linear swizzles. This causes the layout of
-- * surfaces mapped in those SOC's GPUs to be incompatible with the
-- * equivalent mapping on other GPUs in the same system.
-- *
-- * 0 = Tegra K1 - Tegra Parker/TX2 Layout.
-- * 1 = Desktop GPU and Tegra Xavier+ Layout
-+ * 22:22 s Sector layout. There is a further bit remapping step that occurs
-+ * 26:27 at an even lower level than the page kind and block linear
-+ * swizzles. This causes the bit arrangement of surfaces in memory
-+ * to differ subtly, and prevents direct sharing of surfaces between
-+ * GPUs with different layouts.
-+ *
-+ * 0 = Tegra K1 - Tegra Parker/TX2 Layout
-+ * 1 = Pre-GB20x, GB20x 32+ bpp, GB10, Tegra Xavier-Orin Layout
-+ * 2 = GB20x(Blackwell 2)+ 8 bpp surface layout
-+ * 3 = GB20x(Blackwell 2)+ 16 bpp surface layout
-+ * 4 = Reserved for future use.
-+ * 5 = Reserved for future use.
-+ * 6 = Reserved for future use.
-+ * 7 = Reserved for future use.
- *
- * 25:23 c Lossless Framebuffer Compression type.
- *
-@@ -1000,7 +1006,7 @@ extern "C" {
- * 6 = Reserved for future use
- * 7 = Reserved for future use
- *
-- * 55:25 - Reserved for future use. Must be zero.
-+ * 55:28 - Reserved for future use. Must be zero.
- */
- #define DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(c, s, g, k, h) \
- fourcc_mod_code(NVIDIA, (0x10 | \
-@@ -1008,6 +1014,7 @@ extern "C" {
- (((k) & 0xff) << 12) | \
- (((g) & 0x3) << 20) | \
- (((s) & 0x1) << 22) | \
-+ (((s) & 0x6) << 25) | \
- (((c) & 0x7) << 23)))
-
- /* To grandfather in prior block linear format modifiers to the above layout,
-diff --git a/include/standard-headers/linux/ethtool.h b/include/standard-headers/linux/ethtool.h
-index dc24512d28..d0f7a63f10 100644
---- a/include/standard-headers/linux/ethtool.h
-+++ b/include/standard-headers/linux/ethtool.h
-@@ -2077,6 +2077,10 @@ enum ethtool_link_mode_bit_indices {
- ETHTOOL_LINK_MODE_800000baseDR4_2_Full_BIT = 118,
- ETHTOOL_LINK_MODE_800000baseSR4_Full_BIT = 119,
- ETHTOOL_LINK_MODE_800000baseVR4_Full_BIT = 120,
-+ ETHTOOL_LINK_MODE_1600000baseCR8_Full_BIT = 121,
-+ ETHTOOL_LINK_MODE_1600000baseKR8_Full_BIT = 122,
-+ ETHTOOL_LINK_MODE_1600000baseDR8_Full_BIT = 123,
-+ ETHTOOL_LINK_MODE_1600000baseDR8_2_Full_BIT = 124,
-
- /* must be last entry */
- __ETHTOOL_LINK_MODE_MASK_NBITS
-@@ -2190,6 +2194,7 @@ enum ethtool_link_mode_bit_indices {
- #define SPEED_200000 200000
- #define SPEED_400000 400000
- #define SPEED_800000 800000
-+#define SPEED_1600000 1600000
-
- #define SPEED_UNKNOWN -1
-
-diff --git a/include/standard-headers/linux/input-event-codes.h b/include/standard-headers/linux/input-event-codes.h
-index c914ccd723..ede79c6ae4 100644
---- a/include/standard-headers/linux/input-event-codes.h
-+++ b/include/standard-headers/linux/input-event-codes.h
-@@ -27,7 +27,7 @@
- #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
- #define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
- #define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
--#define INPUT_PROP_HAPTIC_TOUCHPAD 0x07 /* is a haptic touchpad */
-+#define INPUT_PROP_PRESSUREPAD 0x07 /* pressure triggers clicks */
-
- #define INPUT_PROP_MAX 0x1f
- #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
-@@ -631,6 +631,18 @@
- #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
- #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
-
-+/*
-+ * Keycodes for hotkeys toggling the electronic privacy screen found on some
-+ * laptops on/off. Note when the embedded-controller turns on/off the eprivacy
-+ * screen itself then the state should be reported through drm connecter props:
-+ * https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties
-+ * Except when implementing the drm connecter properties API is not possible
-+ * because e.g. the firmware does not allow querying the presence and/or status
-+ * of the eprivacy screen at boot.
-+ */
-+#define KEY_EPRIVACY_SCREEN_ON 0x252
-+#define KEY_EPRIVACY_SCREEN_OFF 0x253
-+
- #define KEY_KBDINPUTASSIST_PREV 0x260
- #define KEY_KBDINPUTASSIST_NEXT 0x261
- #define KEY_KBDINPUTASSIST_PREVGROUP 0x262
-diff --git a/include/standard-headers/linux/pci_regs.h b/include/standard-headers/linux/pci_regs.h
-index 07e06aafec..3add74ae25 100644
---- a/include/standard-headers/linux/pci_regs.h
-+++ b/include/standard-headers/linux/pci_regs.h
-@@ -503,6 +503,7 @@
- #define PCI_EXP_DEVCAP_PWR_VAL 0x03fc0000 /* Slot Power Limit Value */
- #define PCI_EXP_DEVCAP_PWR_SCL 0x0c000000 /* Slot Power Limit Scale */
- #define PCI_EXP_DEVCAP_FLR 0x10000000 /* Function Level Reset */
-+#define PCI_EXP_DEVCAP_TEE 0x40000000 /* TEE I/O (TDISP) Support */
- #define PCI_EXP_DEVCTL 0x08 /* Device Control */
- #define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */
- #define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */
-@@ -754,6 +755,8 @@
- #define PCI_EXT_CAP_ID_NPEM 0x29 /* Native PCIe Enclosure Management */
- #define PCI_EXT_CAP_ID_PL_32GT 0x2A /* Physical Layer 32.0 GT/s */
- #define PCI_EXT_CAP_ID_DOE 0x2E /* Data Object Exchange */
-+#define PCI_EXT_CAP_ID_DEV3 0x2F /* Device 3 Capability/Control/Status */
-+#define PCI_EXT_CAP_ID_IDE 0x30 /* Integrity and Data Encryption */
- #define PCI_EXT_CAP_ID_PL_64GT 0x31 /* Physical Layer 64.0 GT/s */
- #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_64GT
-
-@@ -1244,9 +1247,95 @@
- /* Deprecated old name, replaced with PCI_DOE_DATA_OBJECT_DISC_RSP_3_TYPE */
- #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL PCI_DOE_DATA_OBJECT_DISC_RSP_3_TYPE
-
-+/* Device 3 Extended Capability */
-+#define PCI_DEV3_CAP 0x04 /* Device 3 Capabilities Register */
-+#define PCI_DEV3_CTL 0x08 /* Device 3 Control Register */
-+#define PCI_DEV3_STA 0x0c /* Device 3 Status Register */
-+#define PCI_DEV3_STA_SEGMENT 0x8 /* Segment Captured (end-to-end flit-mode detected) */
-+
- /* Compute Express Link (CXL r3.1, sec 8.1.5) */
- #define PCI_DVSEC_CXL_PORT 3
- #define PCI_DVSEC_CXL_PORT_CTL 0x0c
- #define PCI_DVSEC_CXL_PORT_CTL_UNMASK_SBR 0x00000001
-
-+/* Integrity and Data Encryption Extended Capability */
-+#define PCI_IDE_CAP 0x04
-+#define PCI_IDE_CAP_LINK 0x1 /* Link IDE Stream Supported */
-+#define PCI_IDE_CAP_SELECTIVE 0x2 /* Selective IDE Streams Supported */
-+#define PCI_IDE_CAP_FLOWTHROUGH 0x4 /* Flow-Through IDE Stream Supported */
-+#define PCI_IDE_CAP_PARTIAL_HEADER_ENC 0x8 /* Partial Header Encryption Supported */
-+#define PCI_IDE_CAP_AGGREGATION 0x10 /* Aggregation Supported */
-+#define PCI_IDE_CAP_PCRC 0x20 /* PCRC Supported */
-+#define PCI_IDE_CAP_IDE_KM 0x40 /* IDE_KM Protocol Supported */
-+#define PCI_IDE_CAP_SEL_CFG 0x80 /* Selective IDE for Config Request Support */
-+#define PCI_IDE_CAP_ALG __GENMASK(12, 8) /* Supported Algorithms */
-+#define PCI_IDE_CAP_ALG_AES_GCM_256 0 /* AES-GCM 256 key size, 96b MAC */
-+#define PCI_IDE_CAP_LINK_TC_NUM __GENMASK(15, 13) /* Link IDE TCs */
-+#define PCI_IDE_CAP_SEL_NUM __GENMASK(23, 16) /* Supported Selective IDE Streams */
-+#define PCI_IDE_CAP_TEE_LIMITED 0x1000000 /* TEE-Limited Stream Supported */
-+#define PCI_IDE_CTL 0x08
-+#define PCI_IDE_CTL_FLOWTHROUGH_IDE 0x4 /* Flow-Through IDE Stream Enabled */
-+
-+#define PCI_IDE_LINK_STREAM_0 0xc /* First Link Stream Register Block */
-+#define PCI_IDE_LINK_BLOCK_SIZE 8
-+/* Link IDE Stream block, up to PCI_IDE_CAP_LINK_TC_NUM */
-+#define PCI_IDE_LINK_CTL_0 0x00 /* First Link Control Register Offset in block */
-+#define PCI_IDE_LINK_CTL_EN 0x1 /* Link IDE Stream Enable */
-+#define PCI_IDE_LINK_CTL_TX_AGGR_NPR __GENMASK(3, 2) /* Tx Aggregation Mode NPR */
-+#define PCI_IDE_LINK_CTL_TX_AGGR_PR __GENMASK(5, 4) /* Tx Aggregation Mode PR */
-+#define PCI_IDE_LINK_CTL_TX_AGGR_CPL __GENMASK(7, 6) /* Tx Aggregation Mode CPL */
-+#define PCI_IDE_LINK_CTL_PCRC_EN 0x100 /* PCRC Enable */
-+#define PCI_IDE_LINK_CTL_PART_ENC __GENMASK(13, 10) /* Partial Header Encryption Mode */
-+#define PCI_IDE_LINK_CTL_ALG __GENMASK(18, 14) /* Selection from PCI_IDE_CAP_ALG */
-+#define PCI_IDE_LINK_CTL_TC __GENMASK(21, 19) /* Traffic Class */
-+#define PCI_IDE_LINK_CTL_ID __GENMASK(31, 24) /* Stream ID */
-+#define PCI_IDE_LINK_STS_0 0x4 /* First Link Status Register Offset in block */
-+#define PCI_IDE_LINK_STS_STATE __GENMASK(3, 0) /* Link IDE Stream State */
-+#define PCI_IDE_LINK_STS_IDE_FAIL 0x80000000 /* IDE fail message received */
-+
-+/* Selective IDE Stream block, up to PCI_IDE_CAP_SELECTIVE_STREAMS_NUM */
-+/* Selective IDE Stream Capability Register */
-+#define PCI_IDE_SEL_CAP 0x00
-+#define PCI_IDE_SEL_CAP_ASSOC_NUM __GENMASK(3, 0)
-+/* Selective IDE Stream Control Register */
-+#define PCI_IDE_SEL_CTL 0x04
-+#define PCI_IDE_SEL_CTL_EN 0x1 /* Selective IDE Stream Enable */
-+#define PCI_IDE_SEL_CTL_TX_AGGR_NPR __GENMASK(3, 2) /* Tx Aggregation Mode NPR */
-+#define PCI_IDE_SEL_CTL_TX_AGGR_PR __GENMASK(5, 4) /* Tx Aggregation Mode PR */
-+#define PCI_IDE_SEL_CTL_TX_AGGR_CPL __GENMASK(7, 6) /* Tx Aggregation Mode CPL */
-+#define PCI_IDE_SEL_CTL_PCRC_EN 0x100 /* PCRC Enable */
-+#define PCI_IDE_SEL_CTL_CFG_EN 0x200 /* Selective IDE for Configuration Requests */
-+#define PCI_IDE_SEL_CTL_PART_ENC __GENMASK(13, 10) /* Partial Header Encryption Mode */
-+#define PCI_IDE_SEL_CTL_ALG __GENMASK(18, 14) /* Selection from PCI_IDE_CAP_ALG */
-+#define PCI_IDE_SEL_CTL_TC __GENMASK(21, 19) /* Traffic Class */
-+#define PCI_IDE_SEL_CTL_DEFAULT 0x400000 /* Default Stream */
-+#define PCI_IDE_SEL_CTL_TEE_LIMITED 0x800000 /* TEE-Limited Stream */
-+#define PCI_IDE_SEL_CTL_ID __GENMASK(31, 24) /* Stream ID */
-+#define PCI_IDE_SEL_CTL_ID_MAX 255
-+/* Selective IDE Stream Status Register */
-+#define PCI_IDE_SEL_STS 0x08
-+#define PCI_IDE_SEL_STS_STATE __GENMASK(3, 0) /* Selective IDE Stream State */
-+#define PCI_IDE_SEL_STS_STATE_INSECURE 0
-+#define PCI_IDE_SEL_STS_STATE_SECURE 2
-+#define PCI_IDE_SEL_STS_IDE_FAIL 0x80000000 /* IDE fail message received */
-+/* IDE RID Association Register 1 */
-+#define PCI_IDE_SEL_RID_1 0x0c
-+#define PCI_IDE_SEL_RID_1_LIMIT __GENMASK(23, 8)
-+/* IDE RID Association Register 2 */
-+#define PCI_IDE_SEL_RID_2 0x10
-+#define PCI_IDE_SEL_RID_2_VALID 0x1
-+#define PCI_IDE_SEL_RID_2_BASE __GENMASK(23, 8)
-+#define PCI_IDE_SEL_RID_2_SEG __GENMASK(31, 24)
-+/* Selective IDE Address Association Register Block, up to PCI_IDE_SEL_CAP_ASSOC_NUM */
-+#define PCI_IDE_SEL_ADDR_BLOCK_SIZE 12
-+#define PCI_IDE_SEL_ADDR_1(x) (20 + (x) * PCI_IDE_SEL_ADDR_BLOCK_SIZE)
-+#define PCI_IDE_SEL_ADDR_1_VALID 0x1
-+#define PCI_IDE_SEL_ADDR_1_BASE_LOW __GENMASK(19, 8)
-+#define PCI_IDE_SEL_ADDR_1_LIMIT_LOW __GENMASK(31, 20)
-+/* IDE Address Association Register 2 is "Memory Limit Upper" */
-+#define PCI_IDE_SEL_ADDR_2(x) (24 + (x) * PCI_IDE_SEL_ADDR_BLOCK_SIZE)
-+/* IDE Address Association Register 3 is "Memory Base Upper" */
-+#define PCI_IDE_SEL_ADDR_3(x) (28 + (x) * PCI_IDE_SEL_ADDR_BLOCK_SIZE)
-+#define PCI_IDE_SEL_BLOCK_SIZE(nr_assoc) (20 + PCI_IDE_SEL_ADDR_BLOCK_SIZE * (nr_assoc))
-+
- #endif /* LINUX_PCI_REGS_H */
-diff --git a/include/standard-headers/linux/virtio_net.h b/include/standard-headers/linux/virtio_net.h
-index 93abaae0b9..17a0174d6c 100644
---- a/include/standard-headers/linux/virtio_net.h
-+++ b/include/standard-headers/linux/virtio_net.h
-@@ -193,7 +193,8 @@ struct virtio_net_hdr_v1 {
-
- struct virtio_net_hdr_v1_hash {
- struct virtio_net_hdr_v1 hdr;
-- uint32_t hash_value;
-+ uint16_t hash_value_lo;
-+ uint16_t hash_value_hi;
- #define VIRTIO_NET_HASH_REPORT_NONE 0
- #define VIRTIO_NET_HASH_REPORT_IPv4 1
- #define VIRTIO_NET_HASH_REPORT_TCPv4 2
-diff --git a/include/standard-headers/linux/virtio_pci.h b/include/standard-headers/linux/virtio_pci.h
-index 09e964e6ee..4c82513df2 100644
---- a/include/standard-headers/linux/virtio_pci.h
-+++ b/include/standard-headers/linux/virtio_pci.h
-@@ -40,7 +40,7 @@
- #define _LINUX_VIRTIO_PCI_H
-
- #include "standard-headers/linux/types.h"
--#include "standard-headers/linux/kernel.h"
-+#include "standard-headers/linux/const.h"
-
- #ifndef VIRTIO_PCI_NO_LEGACY
-
-diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h
-index f4d9baafa1..46ffbddab5 100644
---- a/linux-headers/asm-arm64/kvm.h
-+++ b/linux-headers/asm-arm64/kvm.h
-@@ -31,7 +31,7 @@
- #define KVM_SPSR_FIQ 4
- #define KVM_NR_SPSR 5
-
--#ifndef __ASSEMBLY__
-+#ifndef __ASSEMBLER__
- #include <linux/psci.h>
- #include <linux/types.h>
- #include <asm/ptrace.h>
-diff --git a/linux-headers/asm-arm64/unistd_64.h b/linux-headers/asm-arm64/unistd_64.h
-index 4ae25c2b91..1ef9c40813 100644
---- a/linux-headers/asm-arm64/unistd_64.h
-+++ b/linux-headers/asm-arm64/unistd_64.h
-@@ -326,6 +326,7 @@
- #define __NR_open_tree_attr 467
- #define __NR_file_getattr 468
- #define __NR_file_setattr 469
-+#define __NR_listns 470
-
-
- #endif /* _ASM_UNISTD_64_H */
-diff --git a/linux-headers/asm-generic/unistd.h b/linux-headers/asm-generic/unistd.h
-index 04e0077fb4..942370b3f5 100644
---- a/linux-headers/asm-generic/unistd.h
-+++ b/linux-headers/asm-generic/unistd.h
-@@ -857,9 +857,11 @@ __SYSCALL(__NR_open_tree_attr, sys_open_tree_attr)
- __SYSCALL(__NR_file_getattr, sys_file_getattr)
- #define __NR_file_setattr 469
- __SYSCALL(__NR_file_setattr, sys_file_setattr)
-+#define __NR_listns 470
-+__SYSCALL(__NR_listns, sys_listns)
-
- #undef __NR_syscalls
--#define __NR_syscalls 470
-+#define __NR_syscalls 471
-
- /*
- * 32 bit systems traditionally used different
-diff --git a/linux-headers/asm-loongarch/kvm.h b/linux-headers/asm-loongarch/kvm.h
-index 57ba1a563b..de6c3f18e4 100644
---- a/linux-headers/asm-loongarch/kvm.h
-+++ b/linux-headers/asm-loongarch/kvm.h
-@@ -104,6 +104,7 @@ struct kvm_fpu {
- #define KVM_LOONGARCH_VM_FEAT_PV_IPI 6
- #define KVM_LOONGARCH_VM_FEAT_PV_STEALTIME 7
- #define KVM_LOONGARCH_VM_FEAT_PTW 8
-+#define KVM_LOONGARCH_VM_FEAT_MSGINT 9
-
- /* Device Control API on vcpu fd */
- #define KVM_LOONGARCH_VCPU_CPUCFG 0
-diff --git a/linux-headers/asm-loongarch/unistd.h b/linux-headers/asm-loongarch/unistd.h
-index 1f01980f9c..e19c7f2f9f 100644
---- a/linux-headers/asm-loongarch/unistd.h
-+++ b/linux-headers/asm-loongarch/unistd.h
-@@ -1,3 +1,9 @@
- /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-
-+#include <asm/bitsperlong.h>
-+
-+#if __BITS_PER_LONG == 32
-+#include <asm/unistd_32.h>
-+#else
- #include <asm/unistd_64.h>
-+#endif
-diff --git a/linux-headers/asm-loongarch/unistd_64.h b/linux-headers/asm-loongarch/unistd_64.h
-index 5033fc8f2f..aa5daac4ef 100644
---- a/linux-headers/asm-loongarch/unistd_64.h
-+++ b/linux-headers/asm-loongarch/unistd_64.h
-@@ -322,6 +322,7 @@
- #define __NR_open_tree_attr 467
- #define __NR_file_getattr 468
- #define __NR_file_setattr 469
-+#define __NR_listns 470
-
-
- #endif /* _ASM_UNISTD_64_H */
-diff --git a/linux-headers/asm-mips/unistd_n32.h b/linux-headers/asm-mips/unistd_n32.h
-index c99c10e5bf..a33d106dca 100644
---- a/linux-headers/asm-mips/unistd_n32.h
-+++ b/linux-headers/asm-mips/unistd_n32.h
-@@ -398,5 +398,6 @@
- #define __NR_open_tree_attr (__NR_Linux + 467)
- #define __NR_file_getattr (__NR_Linux + 468)
- #define __NR_file_setattr (__NR_Linux + 469)
-+#define __NR_listns (__NR_Linux + 470)
-
- #endif /* _ASM_UNISTD_N32_H */
-diff --git a/linux-headers/asm-mips/unistd_n64.h b/linux-headers/asm-mips/unistd_n64.h
-index 0d975bb185..1bc251e450 100644
---- a/linux-headers/asm-mips/unistd_n64.h
-+++ b/linux-headers/asm-mips/unistd_n64.h
-@@ -374,5 +374,6 @@
- #define __NR_open_tree_attr (__NR_Linux + 467)
- #define __NR_file_getattr (__NR_Linux + 468)
- #define __NR_file_setattr (__NR_Linux + 469)
-+#define __NR_listns (__NR_Linux + 470)
-
- #endif /* _ASM_UNISTD_N64_H */
-diff --git a/linux-headers/asm-mips/unistd_o32.h b/linux-headers/asm-mips/unistd_o32.h
-index 86ac0ac84b..c57175d496 100644
---- a/linux-headers/asm-mips/unistd_o32.h
-+++ b/linux-headers/asm-mips/unistd_o32.h
-@@ -444,5 +444,6 @@
- #define __NR_open_tree_attr (__NR_Linux + 467)
- #define __NR_file_getattr (__NR_Linux + 468)
- #define __NR_file_setattr (__NR_Linux + 469)
-+#define __NR_listns (__NR_Linux + 470)
-
- #endif /* _ASM_UNISTD_O32_H */
-diff --git a/linux-headers/asm-powerpc/unistd_32.h b/linux-headers/asm-powerpc/unistd_32.h
-index d7a32c5e06..a3f4aa2fe2 100644
---- a/linux-headers/asm-powerpc/unistd_32.h
-+++ b/linux-headers/asm-powerpc/unistd_32.h
-@@ -451,6 +451,7 @@
- #define __NR_open_tree_attr 467
- #define __NR_file_getattr 468
- #define __NR_file_setattr 469
-+#define __NR_listns 470
-
-
- #endif /* _ASM_UNISTD_32_H */
-diff --git a/linux-headers/asm-powerpc/unistd_64.h b/linux-headers/asm-powerpc/unistd_64.h
-index ff35c51fc6..d4444557f1 100644
---- a/linux-headers/asm-powerpc/unistd_64.h
-+++ b/linux-headers/asm-powerpc/unistd_64.h
-@@ -423,6 +423,7 @@
- #define __NR_open_tree_attr 467
- #define __NR_file_getattr 468
- #define __NR_file_setattr 469
-+#define __NR_listns 470
-
-
- #endif /* _ASM_UNISTD_64_H */
-diff --git a/linux-headers/asm-riscv/kvm.h b/linux-headers/asm-riscv/kvm.h
-index 759a4852c0..54f3ad7ed2 100644
---- a/linux-headers/asm-riscv/kvm.h
-+++ b/linux-headers/asm-riscv/kvm.h
-@@ -23,6 +23,8 @@
- #define KVM_INTERRUPT_SET -1U
- #define KVM_INTERRUPT_UNSET -2U
-
-+#define KVM_EXIT_FAIL_ENTRY_NO_VSFILE (1ULL << 0)
-+
- /* for KVM_GET_REGS and KVM_SET_REGS */
- struct kvm_regs {
- };
-@@ -211,6 +213,7 @@ enum KVM_RISCV_SBI_EXT_ID {
- KVM_RISCV_SBI_EXT_STA,
- KVM_RISCV_SBI_EXT_SUSP,
- KVM_RISCV_SBI_EXT_FWFT,
-+ KVM_RISCV_SBI_EXT_MPXY,
- KVM_RISCV_SBI_EXT_MAX,
- };
-
-diff --git a/linux-headers/asm-riscv/unistd_32.h b/linux-headers/asm-riscv/unistd_32.h
-index 6083373e88..9f33956246 100644
---- a/linux-headers/asm-riscv/unistd_32.h
-+++ b/linux-headers/asm-riscv/unistd_32.h
-@@ -317,6 +317,7 @@
- #define __NR_open_tree_attr 467
- #define __NR_file_getattr 468
- #define __NR_file_setattr 469
-+#define __NR_listns 470
-
-
- #endif /* _ASM_UNISTD_32_H */
-diff --git a/linux-headers/asm-riscv/unistd_64.h b/linux-headers/asm-riscv/unistd_64.h
-index f0c7585c60..c2e7258916 100644
---- a/linux-headers/asm-riscv/unistd_64.h
-+++ b/linux-headers/asm-riscv/unistd_64.h
-@@ -327,6 +327,7 @@
- #define __NR_open_tree_attr 467
- #define __NR_file_getattr 468
- #define __NR_file_setattr 469
-+#define __NR_listns 470
-
-
- #endif /* _ASM_UNISTD_64_H */
-diff --git a/linux-headers/asm-s390/bitsperlong.h b/linux-headers/asm-s390/bitsperlong.h
-index cceaf47b02..7af27a985f 100644
---- a/linux-headers/asm-s390/bitsperlong.h
-+++ b/linux-headers/asm-s390/bitsperlong.h
-@@ -2,11 +2,7 @@
- #ifndef __ASM_S390_BITSPERLONG_H
- #define __ASM_S390_BITSPERLONG_H
-
--#ifndef __s390x__
--#define __BITS_PER_LONG 32
--#else
- #define __BITS_PER_LONG 64
--#endif
-
- #include <asm-generic/bitsperlong.h>
-
-diff --git a/linux-headers/asm-s390/unistd.h b/linux-headers/asm-s390/unistd.h
-index 27b8b211c8..1484618877 100644
---- a/linux-headers/asm-s390/unistd.h
-+++ b/linux-headers/asm-s390/unistd.h
-@@ -8,10 +8,6 @@
- #ifndef _ASM_S390_UNISTD_H_
- #define _ASM_S390_UNISTD_H_
-
--#ifdef __s390x__
- #include <asm/unistd_64.h>
--#else
--#include <asm/unistd_32.h>
--#endif
-
- #endif /* _ASM_S390_UNISTD_H_ */
-diff --git a/linux-headers/asm-s390/unistd_64.h b/linux-headers/asm-s390/unistd_64.h
-index 0652ba6331..8d9e579ef5 100644
---- a/linux-headers/asm-s390/unistd_64.h
-+++ b/linux-headers/asm-s390/unistd_64.h
-@@ -1,6 +1,5 @@
--/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
--#ifndef _ASM_S390_UNISTD_64_H
--#define _ASM_S390_UNISTD_64_H
-+#ifndef _ASM_UNISTD_64_H
-+#define _ASM_UNISTD_64_H
-
- #define __NR_exit 1
- #define __NR_fork 2
-@@ -390,5 +389,7 @@
- #define __NR_open_tree_attr 467
- #define __NR_file_getattr 468
- #define __NR_file_setattr 469
-+#define __NR_listns 470
-
--#endif /* _ASM_S390_UNISTD_64_H */
-+
-+#endif /* _ASM_UNISTD_64_H */
-diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
-index 3bb38f6c3a..b804fd25a2 100644
---- a/linux-headers/asm-x86/kvm.h
-+++ b/linux-headers/asm-x86/kvm.h
-@@ -500,6 +500,7 @@ struct kvm_sync_regs {
- /* vendor-specific groups and attributes for system fd */
- #define KVM_X86_GRP_SEV 1
- # define KVM_X86_SEV_VMSA_FEATURES 0
-+# define KVM_X86_SNP_POLICY_BITS 1
-
- struct kvm_vmx_nested_state_data {
- __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
-diff --git a/linux-headers/asm-x86/unistd_32.h b/linux-headers/asm-x86/unistd_32.h
-index 8f784a5634..34255aac64 100644
---- a/linux-headers/asm-x86/unistd_32.h
-+++ b/linux-headers/asm-x86/unistd_32.h
-@@ -460,6 +460,7 @@
- #define __NR_open_tree_attr 467
- #define __NR_file_getattr 468
- #define __NR_file_setattr 469
-+#define __NR_listns 470
-
-
- #endif /* _ASM_UNISTD_32_H */
-diff --git a/linux-headers/asm-x86/unistd_64.h b/linux-headers/asm-x86/unistd_64.h
-index 26c258d1a6..07f242a5fa 100644
---- a/linux-headers/asm-x86/unistd_64.h
-+++ b/linux-headers/asm-x86/unistd_64.h
-@@ -384,6 +384,7 @@
- #define __NR_open_tree_attr 467
- #define __NR_file_getattr 468
- #define __NR_file_setattr 469
-+#define __NR_listns 470
-
-
- #endif /* _ASM_UNISTD_64_H */
-diff --git a/linux-headers/asm-x86/unistd_x32.h b/linux-headers/asm-x86/unistd_x32.h
-index 65c2aed946..08fc9da2fa 100644
---- a/linux-headers/asm-x86/unistd_x32.h
-+++ b/linux-headers/asm-x86/unistd_x32.h
-@@ -337,6 +337,7 @@
- #define __NR_open_tree_attr (__X32_SYSCALL_BIT + 467)
- #define __NR_file_getattr (__X32_SYSCALL_BIT + 468)
- #define __NR_file_setattr (__X32_SYSCALL_BIT + 469)
-+#define __NR_listns (__X32_SYSCALL_BIT + 470)
- #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
- #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
- #define __NR_ioctl (__X32_SYSCALL_BIT + 514)
-diff --git a/linux-headers/linux/iommufd.h b/linux-headers/linux/iommufd.h
-index 2105a03955..384183a403 100644
---- a/linux-headers/linux/iommufd.h
-+++ b/linux-headers/linux/iommufd.h
-@@ -450,6 +450,16 @@ struct iommu_hwpt_vtd_s1 {
- * nested domain will translate the same as the nesting parent. The S1 will
- * install a Context Descriptor Table pointing at userspace memory translated
- * by the nesting parent.
-+ *
-+ * It's suggested to allocate a vDEVICE object carrying vSID and then re-attach
-+ * the nested domain, as soon as the vSID is available in the VMM level:
-+ *
-+ * - when Cfg=translate, a vDEVICE must be allocated prior to attaching to the
-+ * allocated nested domain, as CD/ATS invalidations and vevents need a vSID.
-+ * - when Cfg=bypass/abort, a vDEVICE is not enforced during the nested domain
-+ * attachment, to support a GBPA case where VM sets CR0.SMMUEN=0. However, if
-+ * VM sets CR0.SMMUEN=1 while missing a vDEVICE object, kernel would fail to
-+ * report events to the VM. E.g. F_TRANSLATION when guest STE.Cfg=abort.
- */
- struct iommu_hwpt_arm_smmuv3 {
- __aligned_le64 ste[2];
-diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
-index 4ea28ef7ca..a4ab42dcba 100644
---- a/linux-headers/linux/kvm.h
-+++ b/linux-headers/linux/kvm.h
-@@ -179,6 +179,7 @@ struct kvm_xen_exit {
- #define KVM_EXIT_LOONGARCH_IOCSR 38
- #define KVM_EXIT_MEMORY_FAULT 39
- #define KVM_EXIT_TDX 40
-+#define KVM_EXIT_ARM_SEA 41
-
- /* For KVM_EXIT_INTERNAL_ERROR */
- /* Emulate instruction failed. */
-@@ -465,6 +466,14 @@ struct kvm_run {
- } setup_event_notify;
- };
- } tdx;
-+ /* KVM_EXIT_ARM_SEA */
-+ struct {
-+#define KVM_EXIT_ARM_SEA_FLAG_GPA_VALID (1ULL << 0)
-+ __u64 flags;
-+ __u64 esr;
-+ __u64 gva;
-+ __u64 gpa;
-+ } arm_sea;
- /* Fix the size of the union. */
- char padding[256];
- };
-@@ -955,6 +964,8 @@ struct kvm_enable_cap {
- #define KVM_CAP_RISCV_MP_STATE_RESET 242
- #define KVM_CAP_ARM_CACHEABLE_PFNMAP_SUPPORTED 243
- #define KVM_CAP_GUEST_MEMFD_FLAGS 244
-+#define KVM_CAP_ARM_SEA_TO_USER 245
-+#define KVM_CAP_S390_USER_OPEREXEC 246
-
- struct kvm_irq_routing_irqchip {
- __u32 irqchip;
-diff --git a/linux-headers/linux/mshv.h b/linux-headers/linux/mshv.h
-index 5bc83db6a3..acceeddc1c 100644
---- a/linux-headers/linux/mshv.h
-+++ b/linux-headers/linux/mshv.h
-@@ -26,6 +26,7 @@ enum {
- MSHV_PT_BIT_LAPIC,
- MSHV_PT_BIT_X2APIC,
- MSHV_PT_BIT_GPA_SUPER_PAGES,
-+ MSHV_PT_BIT_CPU_AND_XSAVE_FEATURES,
- MSHV_PT_BIT_COUNT,
- };
-
-@@ -41,6 +42,8 @@ enum {
- * @pt_flags: Bitmask of 1 << MSHV_PT_BIT_*
- * @pt_isolation: MSHV_PT_ISOLATION_*
- *
-+ * This is the initial/v1 version for backward compatibility.
-+ *
- * Returns a file descriptor to act as a handle to a guest partition.
- * At this point the partition is not yet initialized in the hypervisor.
- * Some operations must be done with the partition in this state, e.g. setting
-@@ -52,6 +55,37 @@ struct mshv_create_partition {
- __u64 pt_isolation;
- };
-
-+#define MSHV_NUM_CPU_FEATURES_BANKS 2
-+
-+/**
-+ * struct mshv_create_partition_v2
-+ *
-+ * This is extended version of the above initial MSHV_CREATE_PARTITION
-+ * ioctl and allows for following additional parameters:
-+ *
-+ * @pt_num_cpu_fbanks: Must be set to MSHV_NUM_CPU_FEATURES_BANKS.
-+ * @pt_cpu_fbanks: Disabled processor feature banks array.
-+ * @pt_disabled_xsave: Disabled xsave feature bits.
-+ *
-+ * pt_cpu_fbanks and pt_disabled_xsave are passed through as-is to the create
-+ * partition hypercall.
-+ *
-+ * Returns : same as above original mshv_create_partition
-+ */
-+struct mshv_create_partition_v2 {
-+ __u64 pt_flags;
-+ __u64 pt_isolation;
-+ __u16 pt_num_cpu_fbanks;
-+ __u8 pt_rsvd[6]; /* MBZ */
-+ __u64 pt_cpu_fbanks[MSHV_NUM_CPU_FEATURES_BANKS];
-+ __u64 pt_rsvd1[2]; /* MBZ */
-+#if defined(__x86_64__)
-+ __u64 pt_disabled_xsave;
-+#else
-+ __u64 pt_rsvd2; /* MBZ */
-+#endif
-+} __attribute__((packed));
-+
- /* /dev/mshv */
- #define MSHV_CREATE_PARTITION _IOW(MSHV_IOCTL, 0x00, struct mshv_create_partition)
-
-@@ -89,7 +123,7 @@ enum {
- * @rsvd: MBZ
- *
- * Map or unmap a region of userspace memory to Guest Physical Addresses (GPA).
-- * Mappings can't overlap in GPA space or userspace.
-+ * Mappings can't overlap in GPA space.
- * To unmap, these fields must match an existing mapping.
- */
- struct mshv_user_mem_region {
-@@ -288,4 +322,84 @@ struct mshv_get_set_vp_state {
- * #define MSHV_ROOT_HVCALL _IOWR(MSHV_IOCTL, 0x07, struct mshv_root_hvcall)
- */
-
-+/* Structure definitions, macros and IOCTLs for mshv_vtl */
-+
-+#define MSHV_CAP_CORE_API_STABLE 0x0
-+#define MSHV_CAP_REGISTER_PAGE 0x1
-+#define MSHV_CAP_VTL_RETURN_ACTION 0x2
-+#define MSHV_CAP_DR6_SHARED 0x3
-+#define MSHV_MAX_RUN_MSG_SIZE 256
-+
-+struct mshv_vp_registers {
-+ __u32 count; /* supports only 1 register at a time */
-+ __u32 reserved; /* Reserved for alignment or future use */
-+ __u64 regs_ptr; /* pointer to struct hv_register_assoc */
-+};
-+
-+struct mshv_vtl_set_eventfd {
-+ __s32 fd;
-+ __u32 flag;
-+};
-+
-+struct mshv_vtl_signal_event {
-+ __u32 connection_id;
-+ __u32 flag;
-+};
-+
-+struct mshv_vtl_sint_post_msg {
-+ __u64 message_type;
-+ __u32 connection_id;
-+ __u32 payload_size; /* Must not exceed HV_MESSAGE_PAYLOAD_BYTE_COUNT */
-+ __u64 payload_ptr; /* pointer to message payload (bytes) */
-+};
-+
-+struct mshv_vtl_ram_disposition {
-+ __u64 start_pfn;
-+ __u64 last_pfn;
-+};
-+
-+struct mshv_vtl_set_poll_file {
-+ __u32 cpu;
-+ __u32 fd;
-+};
-+
-+struct mshv_vtl_hvcall_setup {
-+ __u64 bitmap_array_size; /* stores number of bytes */
-+ __u64 allow_bitmap_ptr;
-+};
-+
-+struct mshv_vtl_hvcall {
-+ __u64 control; /* Hypercall control code */
-+ __u64 input_size; /* Size of the input data */
-+ __u64 input_ptr; /* Pointer to the input struct */
-+ __u64 status; /* Status of the hypercall (output) */
-+ __u64 output_size; /* Size of the output data */
-+ __u64 output_ptr; /* Pointer to the output struct */
-+};
-+
-+struct mshv_sint_mask {
-+ __u8 mask;
-+ __u8 reserved[7];
-+};
-+
-+/* /dev/mshv device IOCTL */
-+#define MSHV_CHECK_EXTENSION _IOW(MSHV_IOCTL, 0x00, __u32)
-+
-+/* vtl device */
-+#define MSHV_CREATE_VTL _IOR(MSHV_IOCTL, 0x1D, char)
-+#define MSHV_ADD_VTL0_MEMORY _IOW(MSHV_IOCTL, 0x21, struct mshv_vtl_ram_disposition)
-+#define MSHV_SET_POLL_FILE _IOW(MSHV_IOCTL, 0x25, struct mshv_vtl_set_poll_file)
-+#define MSHV_RETURN_TO_LOWER_VTL _IO(MSHV_IOCTL, 0x27)
-+#define MSHV_GET_VP_REGISTERS _IOWR(MSHV_IOCTL, 0x05, struct mshv_vp_registers)
-+#define MSHV_SET_VP_REGISTERS _IOW(MSHV_IOCTL, 0x06, struct mshv_vp_registers)
-+
-+/* VMBus device IOCTLs */
-+#define MSHV_SINT_SIGNAL_EVENT _IOW(MSHV_IOCTL, 0x22, struct mshv_vtl_signal_event)
-+#define MSHV_SINT_POST_MESSAGE _IOW(MSHV_IOCTL, 0x23, struct mshv_vtl_sint_post_msg)
-+#define MSHV_SINT_SET_EVENTFD _IOW(MSHV_IOCTL, 0x24, struct mshv_vtl_set_eventfd)
-+#define MSHV_SINT_PAUSE_MESSAGE_STREAM _IOW(MSHV_IOCTL, 0x25, struct mshv_sint_mask)
-+
-+/* hv_hvcall device */
-+#define MSHV_HVCALL_SETUP _IOW(MSHV_IOCTL, 0x1E, struct mshv_vtl_hvcall_setup)
-+#define MSHV_HVCALL _IOWR(MSHV_IOCTL, 0x1F, struct mshv_vtl_hvcall)
- #endif
-diff --git a/linux-headers/linux/psp-sev.h b/linux-headers/linux/psp-sev.h
-index c525125ea8..9479928a4a 100644
---- a/linux-headers/linux/psp-sev.h
-+++ b/linux-headers/linux/psp-sev.h
-@@ -47,32 +47,32 @@ typedef enum {
- * with possible values from the specification.
- */
- SEV_RET_NO_FW_CALL = -1,
-- SEV_RET_SUCCESS = 0,
-- SEV_RET_INVALID_PLATFORM_STATE,
-- SEV_RET_INVALID_GUEST_STATE,
-- SEV_RET_INAVLID_CONFIG,
-+ SEV_RET_SUCCESS = 0,
-+ SEV_RET_INVALID_PLATFORM_STATE = 0x0001,
-+ SEV_RET_INVALID_GUEST_STATE = 0x0002,
-+ SEV_RET_INAVLID_CONFIG = 0x0003,
- SEV_RET_INVALID_CONFIG = SEV_RET_INAVLID_CONFIG,
-- SEV_RET_INVALID_LEN,
-- SEV_RET_ALREADY_OWNED,
-- SEV_RET_INVALID_CERTIFICATE,
-- SEV_RET_POLICY_FAILURE,
-- SEV_RET_INACTIVE,
-- SEV_RET_INVALID_ADDRESS,
-- SEV_RET_BAD_SIGNATURE,
-- SEV_RET_BAD_MEASUREMENT,
-- SEV_RET_ASID_OWNED,
-- SEV_RET_INVALID_ASID,
-- SEV_RET_WBINVD_REQUIRED,
-- SEV_RET_DFFLUSH_REQUIRED,
-- SEV_RET_INVALID_GUEST,
-- SEV_RET_INVALID_COMMAND,
-- SEV_RET_ACTIVE,
-- SEV_RET_HWSEV_RET_PLATFORM,
-- SEV_RET_HWSEV_RET_UNSAFE,
-- SEV_RET_UNSUPPORTED,
-- SEV_RET_INVALID_PARAM,
-- SEV_RET_RESOURCE_LIMIT,
-- SEV_RET_SECURE_DATA_INVALID,
-+ SEV_RET_INVALID_LEN = 0x0004,
-+ SEV_RET_ALREADY_OWNED = 0x0005,
-+ SEV_RET_INVALID_CERTIFICATE = 0x0006,
-+ SEV_RET_POLICY_FAILURE = 0x0007,
-+ SEV_RET_INACTIVE = 0x0008,
-+ SEV_RET_INVALID_ADDRESS = 0x0009,
-+ SEV_RET_BAD_SIGNATURE = 0x000A,
-+ SEV_RET_BAD_MEASUREMENT = 0x000B,
-+ SEV_RET_ASID_OWNED = 0x000C,
-+ SEV_RET_INVALID_ASID = 0x000D,
-+ SEV_RET_WBINVD_REQUIRED = 0x000E,
-+ SEV_RET_DFFLUSH_REQUIRED = 0x000F,
-+ SEV_RET_INVALID_GUEST = 0x0010,
-+ SEV_RET_INVALID_COMMAND = 0x0011,
-+ SEV_RET_ACTIVE = 0x0012,
-+ SEV_RET_HWSEV_RET_PLATFORM = 0x0013,
-+ SEV_RET_HWSEV_RET_UNSAFE = 0x0014,
-+ SEV_RET_UNSUPPORTED = 0x0015,
-+ SEV_RET_INVALID_PARAM = 0x0016,
-+ SEV_RET_RESOURCE_LIMIT = 0x0017,
-+ SEV_RET_SECURE_DATA_INVALID = 0x0018,
- SEV_RET_INVALID_PAGE_SIZE = 0x0019,
- SEV_RET_INVALID_PAGE_STATE = 0x001A,
- SEV_RET_INVALID_MDATA_ENTRY = 0x001B,
-@@ -87,6 +87,22 @@ typedef enum {
- SEV_RET_RESTORE_REQUIRED = 0x0025,
- SEV_RET_RMP_INITIALIZATION_FAILED = 0x0026,
- SEV_RET_INVALID_KEY = 0x0027,
-+ SEV_RET_SHUTDOWN_INCOMPLETE = 0x0028,
-+ SEV_RET_INCORRECT_BUFFER_LENGTH = 0x0030,
-+ SEV_RET_EXPAND_BUFFER_LENGTH_REQUEST = 0x0031,
-+ SEV_RET_SPDM_REQUEST = 0x0032,
-+ SEV_RET_SPDM_ERROR = 0x0033,
-+ SEV_RET_SEV_STATUS_ERR_IN_DEV_CONN = 0x0035,
-+ SEV_RET_SEV_STATUS_INVALID_DEV_CTX = 0x0036,
-+ SEV_RET_SEV_STATUS_INVALID_TDI_CTX = 0x0037,
-+ SEV_RET_SEV_STATUS_INVALID_TDI = 0x0038,
-+ SEV_RET_SEV_STATUS_RECLAIM_REQUIRED = 0x0039,
-+ SEV_RET_IN_USE = 0x003A,
-+ SEV_RET_SEV_STATUS_INVALID_DEV_STATE = 0x003B,
-+ SEV_RET_SEV_STATUS_INVALID_TDI_STATE = 0x003C,
-+ SEV_RET_SEV_STATUS_DEV_CERT_CHANGED = 0x003D,
-+ SEV_RET_SEV_STATUS_RESYNC_REQ = 0x003E,
-+ SEV_RET_SEV_STATUS_RESPONSE_TOO_LARGE = 0x003F,
- SEV_RET_MAX,
- } sev_ret_code;
-
-diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h
-index 4d96d1fc12..720edfee7a 100644
---- a/linux-headers/linux/vfio.h
-+++ b/linux-headers/linux/vfio.h
-@@ -14,6 +14,7 @@
-
- #include <linux/types.h>
- #include <linux/ioctl.h>
-+#include <linux/stddef.h>
-
- #define VFIO_API_VERSION 0
-
-@@ -1478,6 +1479,33 @@ struct vfio_device_feature_bus_master {
- };
- #define VFIO_DEVICE_FEATURE_BUS_MASTER 10
-
-+/**
-+ * Upon VFIO_DEVICE_FEATURE_GET create a dma_buf fd for the
-+ * regions selected.
-+ *
-+ * open_flags are the typical flags passed to open(2), eg O_RDWR, O_CLOEXEC,
-+ * etc. offset/length specify a slice of the region to create the dmabuf from.
-+ * nr_ranges is the total number of (P2P DMA) ranges that comprise the dmabuf.
-+ *
-+ * flags should be 0.
-+ *
-+ * Return: The fd number on success, -1 and errno is set on failure.
-+ */
-+#define VFIO_DEVICE_FEATURE_DMA_BUF 11
-+
-+struct vfio_region_dma_range {
-+ __u64 offset;
-+ __u64 length;
-+};
-+
-+struct vfio_device_feature_dma_buf {
-+ __u32 region_index;
-+ __u32 open_flags;
-+ __u32 flags;
-+ __u32 nr_ranges;
-+ struct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges);
-+};
-+
- /* -------- API for Type1 VFIO IOMMU -------- */
-
- /**
---
-2.52.0
-
diff --git a/kvm-linux-headers-deal-with-counted_by-annotation.patch b/kvm-linux-headers-deal-with-counted_by-annotation.patch
deleted file mode 100644
index eb0be84..0000000
--- a/kvm-linux-headers-deal-with-counted_by-annotation.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From aa56db1a8eb6ede62e58ab4827fc8a7ba8a2ec4a Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:16 +0200
-Subject: [PATCH 07/19] linux-headers: deal with counted_by annotation
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [2/14] dacb8059a0de06a0b9665152e0725da7da08467e (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-Such annotation is present into the kernel uAPI headers since
-v6.7, and will be used soon by the vhost_type.h. Deal with it
-just stripping it.
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <a1430f43cc954d2a931fa60581bda6d6af4bc771.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit c3d9dcd87f0d228ea3ac5a42076da829cff401f0)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- scripts/update-linux-headers.sh | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
-index 828a7809f7..844d9cb9f5 100755
---- a/scripts/update-linux-headers.sh
-+++ b/scripts/update-linux-headers.sh
-@@ -90,6 +90,7 @@ cp_portable() {
- -e 's/<linux\/\([^>]*\)>/"standard-headers\/linux\/\1"/' \
- -e "$arch_cmd" \
- -e 's/__bitwise//' \
-+ -e 's/__counted_by(\w*)//' \
- -e 's/__attribute__((packed))/QEMU_PACKED/' \
- -e 's/__inline__/inline/' \
- -e 's/__BITS_PER_LONG/HOST_LONG_BITS/' \
---
-2.47.3
-
diff --git a/kvm-linux-headers-linux-Add-mshv.h-headers.patch b/kvm-linux-headers-linux-Add-mshv.h-headers.patch
deleted file mode 100644
index 1c389db..0000000
--- a/kvm-linux-headers-linux-Add-mshv.h-headers.patch
+++ /dev/null
@@ -1,329 +0,0 @@
-From 38642c3d90746f63ecc1f961ac7ef52b019c1132 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:26 +0200
-Subject: [PATCH 08/32] linux-headers/linux: Add mshv.h headers
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [6/30] ef60621970d29f626815bdeb68bc8bdfe0061d0e
-
-This file has been added to the tree by running `update-linux-header.sh`
-on linux v6.16.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-7-magnuskulke@linux.microsoft.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit a6d6878650a0f4982918e8cd9d7ea6c3c3c681f7)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- linux-headers/linux/mshv.h | 291 +++++++++++++++++++++++++++++++++++++
- 1 file changed, 291 insertions(+)
- create mode 100644 linux-headers/linux/mshv.h
-
-diff --git a/linux-headers/linux/mshv.h b/linux-headers/linux/mshv.h
-new file mode 100644
-index 0000000000..5bc83db6a3
---- /dev/null
-+++ b/linux-headers/linux/mshv.h
-@@ -0,0 +1,291 @@
-+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-+/*
-+ * Userspace interfaces for /dev/mshv* devices and derived fds
-+ *
-+ * This file is divided into sections containing data structures and IOCTLs for
-+ * a particular set of related devices or derived file descriptors.
-+ *
-+ * The IOCTL definitions are at the end of each section. They are grouped by
-+ * device/fd, so that new IOCTLs can easily be added with a monotonically
-+ * increasing number.
-+ */
-+#ifndef _LINUX_MSHV_H
-+#define _LINUX_MSHV_H
-+
-+#include <linux/types.h>
-+
-+#define MSHV_IOCTL 0xB8
-+
-+/*
-+ *******************************************
-+ * Entry point to main VMM APIs: /dev/mshv *
-+ *******************************************
-+ */
-+
-+enum {
-+ MSHV_PT_BIT_LAPIC,
-+ MSHV_PT_BIT_X2APIC,
-+ MSHV_PT_BIT_GPA_SUPER_PAGES,
-+ MSHV_PT_BIT_COUNT,
-+};
-+
-+#define MSHV_PT_FLAGS_MASK ((1 << MSHV_PT_BIT_COUNT) - 1)
-+
-+enum {
-+ MSHV_PT_ISOLATION_NONE,
-+ MSHV_PT_ISOLATION_COUNT,
-+};
-+
-+/**
-+ * struct mshv_create_partition - arguments for MSHV_CREATE_PARTITION
-+ * @pt_flags: Bitmask of 1 << MSHV_PT_BIT_*
-+ * @pt_isolation: MSHV_PT_ISOLATION_*
-+ *
-+ * Returns a file descriptor to act as a handle to a guest partition.
-+ * At this point the partition is not yet initialized in the hypervisor.
-+ * Some operations must be done with the partition in this state, e.g. setting
-+ * so-called "early" partition properties. The partition can then be
-+ * initialized with MSHV_INITIALIZE_PARTITION.
-+ */
-+struct mshv_create_partition {
-+ __u64 pt_flags;
-+ __u64 pt_isolation;
-+};
-+
-+/* /dev/mshv */
-+#define MSHV_CREATE_PARTITION _IOW(MSHV_IOCTL, 0x00, struct mshv_create_partition)
-+
-+/*
-+ ************************
-+ * Child partition APIs *
-+ ************************
-+ */
-+
-+struct mshv_create_vp {
-+ __u32 vp_index;
-+};
-+
-+enum {
-+ MSHV_SET_MEM_BIT_WRITABLE,
-+ MSHV_SET_MEM_BIT_EXECUTABLE,
-+ MSHV_SET_MEM_BIT_UNMAP,
-+ MSHV_SET_MEM_BIT_COUNT
-+};
-+
-+#define MSHV_SET_MEM_FLAGS_MASK ((1 << MSHV_SET_MEM_BIT_COUNT) - 1)
-+
-+/* The hypervisor's "native" page size */
-+#define MSHV_HV_PAGE_SIZE 0x1000
-+
-+/**
-+ * struct mshv_user_mem_region - arguments for MSHV_SET_GUEST_MEMORY
-+ * @size: Size of the memory region (bytes). Must be aligned to
-+ * MSHV_HV_PAGE_SIZE
-+ * @guest_pfn: Base guest page number to map
-+ * @userspace_addr: Base address of userspace memory. Must be aligned to
-+ * MSHV_HV_PAGE_SIZE
-+ * @flags: Bitmask of 1 << MSHV_SET_MEM_BIT_*. If (1 << MSHV_SET_MEM_BIT_UNMAP)
-+ * is set, ignore other bits.
-+ * @rsvd: MBZ
-+ *
-+ * Map or unmap a region of userspace memory to Guest Physical Addresses (GPA).
-+ * Mappings can't overlap in GPA space or userspace.
-+ * To unmap, these fields must match an existing mapping.
-+ */
-+struct mshv_user_mem_region {
-+ __u64 size;
-+ __u64 guest_pfn;
-+ __u64 userspace_addr;
-+ __u8 flags;
-+ __u8 rsvd[7];
-+};
-+
-+enum {
-+ MSHV_IRQFD_BIT_DEASSIGN,
-+ MSHV_IRQFD_BIT_RESAMPLE,
-+ MSHV_IRQFD_BIT_COUNT,
-+};
-+
-+#define MSHV_IRQFD_FLAGS_MASK ((1 << MSHV_IRQFD_BIT_COUNT) - 1)
-+
-+struct mshv_user_irqfd {
-+ __s32 fd;
-+ __s32 resamplefd;
-+ __u32 gsi;
-+ __u32 flags;
-+};
-+
-+enum {
-+ MSHV_IOEVENTFD_BIT_DATAMATCH,
-+ MSHV_IOEVENTFD_BIT_PIO,
-+ MSHV_IOEVENTFD_BIT_DEASSIGN,
-+ MSHV_IOEVENTFD_BIT_COUNT,
-+};
-+
-+#define MSHV_IOEVENTFD_FLAGS_MASK ((1 << MSHV_IOEVENTFD_BIT_COUNT) - 1)
-+
-+struct mshv_user_ioeventfd {
-+ __u64 datamatch;
-+ __u64 addr; /* legal pio/mmio address */
-+ __u32 len; /* 1, 2, 4, or 8 bytes */
-+ __s32 fd;
-+ __u32 flags;
-+ __u8 rsvd[4];
-+};
-+
-+struct mshv_user_irq_entry {
-+ __u32 gsi;
-+ __u32 address_lo;
-+ __u32 address_hi;
-+ __u32 data;
-+};
-+
-+struct mshv_user_irq_table {
-+ __u32 nr;
-+ __u32 rsvd; /* MBZ */
-+ struct mshv_user_irq_entry entries[];
-+};
-+
-+enum {
-+ MSHV_GPAP_ACCESS_TYPE_ACCESSED,
-+ MSHV_GPAP_ACCESS_TYPE_DIRTY,
-+ MSHV_GPAP_ACCESS_TYPE_COUNT /* Count of enum members */
-+};
-+
-+enum {
-+ MSHV_GPAP_ACCESS_OP_NOOP,
-+ MSHV_GPAP_ACCESS_OP_CLEAR,
-+ MSHV_GPAP_ACCESS_OP_SET,
-+ MSHV_GPAP_ACCESS_OP_COUNT /* Count of enum members */
-+};
-+
-+/**
-+ * struct mshv_gpap_access_bitmap - arguments for MSHV_GET_GPAP_ACCESS_BITMAP
-+ * @access_type: MSHV_GPAP_ACCESS_TYPE_* - The type of access to record in the
-+ * bitmap
-+ * @access_op: MSHV_GPAP_ACCESS_OP_* - Allows an optional clear or set of all
-+ * the access states in the range, after retrieving the current
-+ * states.
-+ * @rsvd: MBZ
-+ * @page_count: Number of pages
-+ * @gpap_base: Base gpa page number
-+ * @bitmap_ptr: Output buffer for bitmap, at least (page_count + 7) / 8 bytes
-+ *
-+ * Retrieve a bitmap of either ACCESSED or DIRTY bits for a given range of guest
-+ * memory, and optionally clear or set the bits.
-+ */
-+struct mshv_gpap_access_bitmap {
-+ __u8 access_type;
-+ __u8 access_op;
-+ __u8 rsvd[6];
-+ __u64 page_count;
-+ __u64 gpap_base;
-+ __u64 bitmap_ptr;
-+};
-+
-+/**
-+ * struct mshv_root_hvcall - arguments for MSHV_ROOT_HVCALL
-+ * @code: Hypercall code (HVCALL_*)
-+ * @reps: in: Rep count ('repcount')
-+ * out: Reps completed ('repcomp'). MBZ unless rep hvcall
-+ * @in_sz: Size of input incl rep data. <= MSHV_HV_PAGE_SIZE
-+ * @out_sz: Size of output buffer. <= MSHV_HV_PAGE_SIZE. MBZ if out_ptr is 0
-+ * @status: in: MBZ
-+ * out: HV_STATUS_* from hypercall
-+ * @rsvd: MBZ
-+ * @in_ptr: Input data buffer (struct hv_input_*). If used with partition or
-+ * vp fd, partition id field is populated by kernel.
-+ * @out_ptr: Output data buffer (optional)
-+ */
-+struct mshv_root_hvcall {
-+ __u16 code;
-+ __u16 reps;
-+ __u16 in_sz;
-+ __u16 out_sz;
-+ __u16 status;
-+ __u8 rsvd[6];
-+ __u64 in_ptr;
-+ __u64 out_ptr;
-+};
-+
-+/* Partition fds created with MSHV_CREATE_PARTITION */
-+#define MSHV_INITIALIZE_PARTITION _IO(MSHV_IOCTL, 0x00)
-+#define MSHV_CREATE_VP _IOW(MSHV_IOCTL, 0x01, struct mshv_create_vp)
-+#define MSHV_SET_GUEST_MEMORY _IOW(MSHV_IOCTL, 0x02, struct mshv_user_mem_region)
-+#define MSHV_IRQFD _IOW(MSHV_IOCTL, 0x03, struct mshv_user_irqfd)
-+#define MSHV_IOEVENTFD _IOW(MSHV_IOCTL, 0x04, struct mshv_user_ioeventfd)
-+#define MSHV_SET_MSI_ROUTING _IOW(MSHV_IOCTL, 0x05, struct mshv_user_irq_table)
-+#define MSHV_GET_GPAP_ACCESS_BITMAP _IOWR(MSHV_IOCTL, 0x06, struct mshv_gpap_access_bitmap)
-+/* Generic hypercall */
-+#define MSHV_ROOT_HVCALL _IOWR(MSHV_IOCTL, 0x07, struct mshv_root_hvcall)
-+
-+/*
-+ ********************************
-+ * VP APIs for child partitions *
-+ ********************************
-+ */
-+
-+#define MSHV_RUN_VP_BUF_SZ 256
-+
-+/*
-+ * VP state pages may be mapped to userspace via mmap().
-+ * To specify which state page, use MSHV_VP_MMAP_OFFSET_ values multiplied by
-+ * the system page size.
-+ * e.g.
-+ * long page_size = sysconf(_SC_PAGE_SIZE);
-+ * void *reg_page = mmap(NULL, MSHV_HV_PAGE_SIZE, PROT_READ|PROT_WRITE,
-+ * MAP_SHARED, vp_fd,
-+ * MSHV_VP_MMAP_OFFSET_REGISTERS * page_size);
-+ */
-+enum {
-+ MSHV_VP_MMAP_OFFSET_REGISTERS,
-+ MSHV_VP_MMAP_OFFSET_INTERCEPT_MESSAGE,
-+ MSHV_VP_MMAP_OFFSET_GHCB,
-+ MSHV_VP_MMAP_OFFSET_COUNT
-+};
-+
-+/**
-+ * struct mshv_run_vp - argument for MSHV_RUN_VP
-+ * @msg_buf: On success, the intercept message is copied here. It can be
-+ * interpreted using the relevant hypervisor definitions.
-+ */
-+struct mshv_run_vp {
-+ __u8 msg_buf[MSHV_RUN_VP_BUF_SZ];
-+};
-+
-+enum {
-+ MSHV_VP_STATE_LAPIC, /* Local interrupt controller state (either arch) */
-+ MSHV_VP_STATE_XSAVE, /* XSAVE data in compacted form (x86_64) */
-+ MSHV_VP_STATE_SIMP,
-+ MSHV_VP_STATE_SIEFP,
-+ MSHV_VP_STATE_SYNTHETIC_TIMERS,
-+ MSHV_VP_STATE_COUNT,
-+};
-+
-+/**
-+ * struct mshv_get_set_vp_state - arguments for MSHV_[GET,SET]_VP_STATE
-+ * @type: MSHV_VP_STATE_*
-+ * @rsvd: MBZ
-+ * @buf_sz: in: 4k page-aligned size of buffer
-+ * out: Actual size of data (on EINVAL, check this to see if buffer
-+ * was too small)
-+ * @buf_ptr: 4k page-aligned data buffer
-+ */
-+struct mshv_get_set_vp_state {
-+ __u8 type;
-+ __u8 rsvd[3];
-+ __u32 buf_sz;
-+ __u64 buf_ptr;
-+};
-+
-+/* VP fds created with MSHV_CREATE_VP */
-+#define MSHV_RUN_VP _IOR(MSHV_IOCTL, 0x00, struct mshv_run_vp)
-+#define MSHV_GET_VP_STATE _IOWR(MSHV_IOCTL, 0x01, struct mshv_get_set_vp_state)
-+#define MSHV_SET_VP_STATE _IOWR(MSHV_IOCTL, 0x02, struct mshv_get_set_vp_state)
-+/*
-+ * Generic hypercall
-+ * Defined above in partition IOCTLs, avoid redefining it here
-+ * #define MSHV_ROOT_HVCALL _IOWR(MSHV_IOCTL, 0x07, struct mshv_root_hvcall)
-+ */
-+
-+#endif
---
-2.47.3
-
diff --git a/kvm-memory-Allow-RAM-device-regions-to-skip-IOMMU-mappin.patch b/kvm-memory-Allow-RAM-device-regions-to-skip-IOMMU-mappin.patch
deleted file mode 100644
index 7b5d902..0000000
--- a/kvm-memory-Allow-RAM-device-regions-to-skip-IOMMU-mappin.patch
+++ /dev/null
@@ -1,148 +0,0 @@
-From 38481d1bcb08e5652e949ce60ba5dd46e95dc766 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:41 +0100
-Subject: [PATCH 099/111] memory: Allow RAM device regions to skip IOMMU
- mapping
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [99/111] 0f2dac574eb1c2042ca4f0c2ea22e5493f6dc174 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Conflicts: system/memory.c. We don't have 5a525dcb4d60
-("system/memory: Constify various MemoryRegion arguments") so
-we get a contextual conflict wrt memory_region_has_guest_memfd
-which does not take a const MemoryRegion * arg downstream. Also
-forced to remove the const for memory_region_skip_iommu_map().
-Also impacts include/system/memory.h declaration.
-5a525dcb4d60 would draw more dependencies so better to skip it.
-
-Some RAM device regions created with memory_region_init_ram_device_ptr()
-are not intended to be P2P DMA targets.
-
-The VFIO listener currently treats all RAM device regions as DMA
-capable and attempts to map them into the IOMMU. For regions without
-dma-buf backing this fails and prints warnings such as:
-
- IOMMU_IOAS_MAP failed: Bad address, PCI BAR?
-
-Introduce a MemoryRegion flag (ram_device_skip_iommu_map) to mark RAM
-device regions that should not be IOMMU mapped, paired with
-memory_region_skip_iommu_map() / memory_region_set_skip_iommu_map()
-accessors. When the flag is set, the VFIO listener skips DMA mapping
-for that region.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260609112552.378999-21-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 11b9798c7b524762b98ea62b1c3fbc6304699784)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/listener.c | 6 ++++++
- hw/vfio/trace-events | 1 +
- include/system/memory.h | 21 +++++++++++++++++++++
- system/memory.c | 10 ++++++++++
- 4 files changed, 38 insertions(+)
-
-diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
-index afcf518f56..60249a7252 100644
---- a/hw/vfio/listener.c
-+++ b/hw/vfio/listener.c
-@@ -609,6 +609,12 @@ void vfio_container_region_add(VFIOContainer *bcontainer,
- }
- }
-
-+ if (memory_region_skip_iommu_map(section->mr)) {
-+ trace_vfio_listener_region_skip_dma_map(memory_region_name(section->mr),
-+ iova, int128_get64(llsize));
-+ return;
-+ }
-+
- ret = vfio_container_dma_map(bcontainer, iova, int128_get64(llsize),
- vaddr, section->readonly, section->mr);
- if (ret) {
-diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
-index 82abfc99ae..d98fa5cefb 100644
---- a/hw/vfio/trace-events
-+++ b/hw/vfio/trace-events
-@@ -100,6 +100,7 @@ vfio_listener_region_del_iommu(const char *name) "region_del [iommu] %s"
- vfio_listener_region_add_ram(uint64_t iova_start, uint64_t iova_end, void *vaddr) "region_add [ram] 0x%"PRIx64" - 0x%"PRIx64" [%p]"
- vfio_known_safe_misalignment(const char *name, uint64_t iova, uint64_t offset_within_region, uintptr_t page_size) "Region \"%s\" iova=0x%"PRIx64" offset_within_region=0x%"PRIx64" qemu_real_host_page_size=0x%"PRIxPTR
- vfio_listener_region_add_no_dma_map(const char *name, uint64_t iova, uint64_t size, uint64_t page_size) "Region \"%s\" 0x%"PRIx64" size=0x%"PRIx64" is not aligned to 0x%"PRIx64" and cannot be mapped for DMA"
-+vfio_listener_region_skip_dma_map(const char *name, uint64_t iova, uint64_t size) "Region \"%s\" 0x%"PRIx64" size=0x%"PRIx64" marked to skip IOMMU mapping"
- vfio_listener_region_del(uint64_t start, uint64_t end) "region_del 0x%"PRIx64" - 0x%"PRIx64
- vfio_device_dirty_tracking_update(uint64_t start, uint64_t end, uint64_t min, uint64_t max) "section 0x%"PRIx64" - 0x%"PRIx64" -> update [0x%"PRIx64" - 0x%"PRIx64"]"
- vfio_device_dirty_tracking_start(int nr_ranges, uint64_t min32, uint64_t max32, uint64_t min64, uint64_t max64, uint64_t minpci, uint64_t maxpci) "nr_ranges %d 32:[0x%"PRIx64" - 0x%"PRIx64"], 64:[0x%"PRIx64" - 0x%"PRIx64"], pci64:[0x%"PRIx64" - 0x%"PRIx64"]"
-diff --git a/include/system/memory.h b/include/system/memory.h
-index 4913206c8c..8e60f03d44 100644
---- a/include/system/memory.h
-+++ b/include/system/memory.h
-@@ -866,6 +866,8 @@ struct MemoryRegion {
-
- /* For devices designed to perform re-entrant IO into their own IO MRs */
- bool disable_reentrancy_guard;
-+ /* RAM device region that does not require IOMMU mapping for P2P */
-+ bool ram_device_skip_iommu_map;
- };
-
- struct IOMMUMemoryRegion {
-@@ -1821,6 +1823,25 @@ static inline bool memory_region_is_romd(MemoryRegion *mr)
- */
- bool memory_region_is_protected(MemoryRegion *mr);
-
-+/**
-+ * memory_region_skip_iommu_map: check whether a memory region is excluded
-+ * from IOMMU mapping
-+ *
-+ * Returns %true if @mr is a RAM device region marked to skip IOMMU mapping.
-+ *
-+ * @mr: the memory region being queried
-+ */
-+bool memory_region_skip_iommu_map(MemoryRegion *mr);
-+
-+/**
-+ * memory_region_set_skip_iommu_map: mark a RAM device region to skip IOMMU
-+ * mapping
-+ *
-+ * @mr: the memory region being modified
-+ * @skip: %true to skip IOMMU mapping, %false to allow it
-+ */
-+void memory_region_set_skip_iommu_map(MemoryRegion *mr, bool skip);
-+
- /**
- * memory_region_has_guest_memfd: check whether a memory region has guest_memfd
- * associated
-diff --git a/system/memory.c b/system/memory.c
-index 5646547940..bdd53369a9 100644
---- a/system/memory.c
-+++ b/system/memory.c
-@@ -1875,6 +1875,16 @@ bool memory_region_is_protected(MemoryRegion *mr)
- return mr->ram && (mr->ram_block->flags & RAM_PROTECTED);
- }
-
-+bool memory_region_skip_iommu_map(MemoryRegion *mr)
-+{
-+ return memory_region_is_ram_device(mr) && mr->ram_device_skip_iommu_map;
-+}
-+
-+void memory_region_set_skip_iommu_map(MemoryRegion *mr, bool skip)
-+{
-+ mr->ram_device_skip_iommu_map = skip;
-+}
-+
- bool memory_region_has_guest_memfd(MemoryRegion *mr)
- {
- return mr->ram_block && mr->ram_block->guest_memfd >= 0;
---
-2.52.0
-
diff --git a/kvm-migration-Remove-error-variant-of-vmstate_save_state.patch b/kvm-migration-Remove-error-variant-of-vmstate_save_state.patch
deleted file mode 100644
index 1d2aeec..0000000
--- a/kvm-migration-Remove-error-variant-of-vmstate_save_state.patch
+++ /dev/null
@@ -1,446 +0,0 @@
-From 673399c8d3ee747c11071589bcbff5e30496e490 Mon Sep 17 00:00:00 2001
-From: Arun Menon <armenon@redhat.com>
-Date: Thu, 18 Sep 2025 20:53:41 +0530
-Subject: [PATCH 087/116] migration: Remove error variant of
- vmstate_save_state() function
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [71/100] ba229c51e673198fe4c2082b2f8b598ee80839ae (rovick1/qemu-kvm)
-
-This commit removes the redundant vmstate_save_state_with_err()
-function.
-
-Previously, commit 969298f9d7 introduced vmstate_save_state_with_err()
-to handle error propagation, while vmstate_save_state() existed for
-non-error scenarios.
-This is because there were code paths where vmstate_save_state_v()
-(called internally by vmstate_save_state) did not explicitly set
-errors on failure.
-
-This change unifies error handling by
- - updating vmstate_save_state() to accept an Error **errp argument.
- - vmstate_save_state_v() ensures errors are set directly within the errp
- object, eliminating the need for two separate functions.
-
-All calls to vmstate_save_state_with_err() are replaced with
-vmstate_save_state(). This simplifies the API and improves code
-maintainability.
-
-vmstate_save_state() that only calls vmstate_save_state_v(),
-by inference, also has errors set in errp in case of failure.
-The errors are reported using error_report_err().
-If we want the function to exit on error, then &error_fatal is
-passed.
-
-Reviewed-by: Fabiano Rosas <farosas@suse.de>
-Signed-off-by: Arun Menon <armenon@redhat.com>
-Tested-by: Fabiano Rosas <farosas@suse.de>
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Link: https://lore.kernel.org/r/20250918-propagate_tpm_error-v14-24-36f11a6fb9d3@redhat.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
-(cherry picked from commit 6f9fc6f5012344292f7014e079e5225b8988383d)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/display/virtio-gpu.c | 3 ++-
- hw/pci/pci.c | 2 +-
- hw/s390x/virtio-ccw.c | 2 +-
- hw/scsi/spapr_vscsi.c | 2 +-
- hw/vfio/pci.c | 4 ++--
- hw/virtio/virtio-mmio.c | 2 +-
- hw/virtio/virtio-pci.c | 2 +-
- hw/virtio/virtio.c | 6 ++++--
- include/migration/vmstate.h | 2 --
- migration/cpr.c | 3 +--
- migration/savevm.c | 11 ++++++++---
- migration/vmstate-types.c | 25 ++++++++++++++++++-------
- migration/vmstate.c | 10 ++--------
- tests/unit/test-vmstate.c | 20 +++++++++++++++++---
- ui/vdagent.c | 3 ++-
- 15 files changed, 61 insertions(+), 36 deletions(-)
-
-diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
-index 5dc31bc6bf..477ec700a1 100644
---- a/hw/display/virtio-gpu.c
-+++ b/hw/display/virtio-gpu.c
-@@ -1246,7 +1246,8 @@ static int virtio_gpu_save(QEMUFile *f, void *opaque, size_t size,
- }
- qemu_put_be32(f, 0); /* end of list */
-
-- return vmstate_save_state(f, &vmstate_virtio_gpu_scanouts, g, NULL);
-+ return vmstate_save_state(f, &vmstate_virtio_gpu_scanouts, g, NULL,
-+ &error_fatal);
- }
-
- static bool virtio_gpu_load_restore_mapping(VirtIOGPU *g,
-diff --git a/hw/pci/pci.c b/hw/pci/pci.c
-index 5b37b70815..d1c22999b9 100644
---- a/hw/pci/pci.c
-+++ b/hw/pci/pci.c
-@@ -926,7 +926,7 @@ void pci_device_save(PCIDevice *s, QEMUFile *f)
- * This makes us compatible with old devices
- * which never set or clear this bit. */
- s->config[PCI_STATUS] &= ~PCI_STATUS_INTERRUPT;
-- vmstate_save_state(f, &vmstate_pci_device, s, NULL);
-+ vmstate_save_state(f, &vmstate_pci_device, s, NULL, &error_fatal);
- /* Restore the interrupt status bit. */
- pci_update_irq_status(s);
- }
-diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
-index 6a9641a03d..4cb1ced001 100644
---- a/hw/s390x/virtio-ccw.c
-+++ b/hw/s390x/virtio-ccw.c
-@@ -1130,7 +1130,7 @@ static int virtio_ccw_load_queue(DeviceState *d, int n, QEMUFile *f)
- static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f)
- {
- VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
-- vmstate_save_state(f, &vmstate_virtio_ccw_dev, dev, NULL);
-+ vmstate_save_state(f, &vmstate_virtio_ccw_dev, dev, NULL, &error_fatal);
- }
-
- static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
-diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
-index da173f4867..f0a7dd2b88 100644
---- a/hw/scsi/spapr_vscsi.c
-+++ b/hw/scsi/spapr_vscsi.c
-@@ -630,7 +630,7 @@ static void vscsi_save_request(QEMUFile *f, SCSIRequest *sreq)
- vscsi_req *req = sreq->hba_private;
- assert(req->active);
-
-- vmstate_save_state(f, &vmstate_spapr_vscsi_req, req, NULL);
-+ vmstate_save_state(f, &vmstate_spapr_vscsi_req, req, NULL, &error_fatal);
-
- trace_spapr_vscsi_save_request(req->qtag, req->cur_desc_num,
- req->cur_desc_offset);
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index f696e8116f..378b475b2c 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -2824,8 +2824,8 @@ static int vfio_pci_save_config(VFIODevice *vbasedev, QEMUFile *f, Error **errp)
- {
- VFIOPCIDevice *vdev = container_of(vbasedev, VFIOPCIDevice, vbasedev);
-
-- return vmstate_save_state_with_err(f, &vmstate_vfio_pci_config, vdev, NULL,
-- errp);
-+ return vmstate_save_state(f, &vmstate_vfio_pci_config, vdev, NULL,
-+ errp);
- }
-
- static int vfio_pci_load_config(VFIODevice *vbasedev, QEMUFile *f)
-diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
-index 0a688909fc..fb58c36452 100644
---- a/hw/virtio/virtio-mmio.c
-+++ b/hw/virtio/virtio-mmio.c
-@@ -613,7 +613,7 @@ static void virtio_mmio_save_extra_state(DeviceState *opaque, QEMUFile *f)
- {
- VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque);
-
-- vmstate_save_state(f, &vmstate_virtio_mmio, proxy, NULL);
-+ vmstate_save_state(f, &vmstate_virtio_mmio, proxy, NULL, &error_fatal);
- }
-
- static int virtio_mmio_load_extra_state(DeviceState *opaque, QEMUFile *f)
-diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
-index ae875bd108..937e22f08a 100644
---- a/hw/virtio/virtio-pci.c
-+++ b/hw/virtio/virtio-pci.c
-@@ -188,7 +188,7 @@ static void virtio_pci_save_extra_state(DeviceState *d, QEMUFile *f)
- {
- VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
-
-- vmstate_save_state(f, &vmstate_virtio_pci, proxy, NULL);
-+ vmstate_save_state(f, &vmstate_virtio_pci, proxy, NULL, &error_fatal);
- }
-
- static int virtio_pci_load_extra_state(DeviceState *d, QEMUFile *f)
-diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
-index e6cbbc8624..a7063d5555 100644
---- a/hw/virtio/virtio.c
-+++ b/hw/virtio/virtio.c
-@@ -3017,6 +3017,7 @@ int virtio_save(VirtIODevice *vdev, QEMUFile *f)
- VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
- uint32_t guest_features_lo = (vdev->guest_features & 0xffffffff);
- int i;
-+ Error *local_err = NULL;
-
- if (k->save_config) {
- k->save_config(qbus->parent, f);
-@@ -3060,14 +3061,15 @@ int virtio_save(VirtIODevice *vdev, QEMUFile *f)
- }
-
- if (vdc->vmsd) {
-- int ret = vmstate_save_state(f, vdc->vmsd, vdev, NULL);
-+ int ret = vmstate_save_state(f, vdc->vmsd, vdev, NULL, &local_err);
- if (ret) {
-+ error_report_err(local_err);
- return ret;
- }
- }
-
- /* Subsections */
-- return vmstate_save_state(f, &vmstate_virtio, vdev, NULL);
-+ return vmstate_save_state(f, &vmstate_virtio, vdev, NULL, &error_fatal);
- }
-
- /* A wrapper for use as a VMState .put function */
-diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
-index b9a41cc38a..47a1dc1810 100644
---- a/include/migration/vmstate.h
-+++ b/include/migration/vmstate.h
-@@ -1208,8 +1208,6 @@ extern const VMStateInfo vmstate_info_qlist;
- int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
- void *opaque, int version_id, Error **errp);
- int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
-- void *opaque, JSONWriter *vmdesc);
--int vmstate_save_state_with_err(QEMUFile *f, const VMStateDescription *vmsd,
- void *opaque, JSONWriter *vmdesc, Error **errp);
- int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
- void *opaque, JSONWriter *vmdesc,
-diff --git a/migration/cpr.c b/migration/cpr.c
-index 8abb6db76d..038f48f810 100644
---- a/migration/cpr.c
-+++ b/migration/cpr.c
-@@ -182,9 +182,8 @@ int cpr_state_save(MigrationChannel *channel, Error **errp)
- qemu_put_be32(f, QEMU_CPR_FILE_MAGIC);
- qemu_put_be32(f, QEMU_CPR_FILE_VERSION);
-
-- ret = vmstate_save_state(f, &vmstate_cpr_state, &cpr_state, 0);
-+ ret = vmstate_save_state(f, &vmstate_cpr_state, &cpr_state, 0, errp);
- if (ret) {
-- error_setg(errp, "vmstate_save_state error %d", ret);
- qemu_fclose(f);
- return ret;
- }
-diff --git a/migration/savevm.c b/migration/savevm.c
-index f5a1ab9101..1eab91d3ad 100644
---- a/migration/savevm.c
-+++ b/migration/savevm.c
-@@ -1050,8 +1050,8 @@ static int vmstate_save(QEMUFile *f, SaveStateEntry *se, JSONWriter *vmdesc,
- if (!se->vmsd) {
- vmstate_save_old_style(f, se, vmdesc);
- } else {
-- ret = vmstate_save_state_with_err(f, se->vmsd, se->opaque, vmdesc,
-- errp);
-+ ret = vmstate_save_state(f, se->vmsd, se->opaque, vmdesc,
-+ errp);
- if (ret) {
- return ret;
- }
-@@ -1279,6 +1279,7 @@ void qemu_savevm_state_header(QEMUFile *f)
- {
- MigrationState *s = migrate_get_current();
- JSONWriter *vmdesc = s->vmdesc;
-+ Error *local_err = NULL;
-
- trace_savevm_state_header();
- qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
-@@ -1297,7 +1298,11 @@ void qemu_savevm_state_header(QEMUFile *f)
- json_writer_start_object(vmdesc, "configuration");
- }
-
-- vmstate_save_state(f, &vmstate_configuration, &savevm_state, vmdesc);
-+ vmstate_save_state(f, &vmstate_configuration, &savevm_state,
-+ vmdesc, &local_err);
-+ if (local_err) {
-+ error_report_err(local_err);
-+ }
-
- if (vmdesc) {
- json_writer_end_object(vmdesc);
-diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
-index c5cfd861e3..a1cd7a95fa 100644
---- a/migration/vmstate-types.c
-+++ b/migration/vmstate-types.c
-@@ -565,10 +565,14 @@ static int put_tmp(QEMUFile *f, void *pv, size_t size,
- const VMStateDescription *vmsd = field->vmsd;
- void *tmp = g_malloc(size);
- int ret;
-+ Error *local_err = NULL;
-
- /* Writes the parent field which is at the start of the tmp */
- *(void **)tmp = pv;
-- ret = vmstate_save_state(f, vmsd, tmp, vmdesc);
-+ ret = vmstate_save_state(f, vmsd, tmp, vmdesc, &local_err);
-+ if (ret) {
-+ error_report_err(local_err);
-+ }
- g_free(tmp);
-
- return ret;
-@@ -676,13 +680,15 @@ static int put_qtailq(QEMUFile *f, void *pv, size_t unused_size,
- size_t entry_offset = field->start;
- void *elm;
- int ret;
-+ Error *local_err = NULL;
-
- trace_put_qtailq(vmsd->name, vmsd->version_id);
-
- QTAILQ_RAW_FOREACH(elm, pv, entry_offset) {
- qemu_put_byte(f, true);
-- ret = vmstate_save_state(f, vmsd, elm, vmdesc);
-+ ret = vmstate_save_state(f, vmsd, elm, vmdesc, &local_err);
- if (ret) {
-+ error_report_err(local_err);
- return ret;
- }
- }
-@@ -711,6 +717,7 @@ static gboolean put_gtree_elem(gpointer key, gpointer value, gpointer data)
- struct put_gtree_data *capsule = (struct put_gtree_data *)data;
- QEMUFile *f = capsule->f;
- int ret;
-+ Error *local_err = NULL;
-
- qemu_put_byte(f, true);
-
-@@ -718,16 +725,20 @@ static gboolean put_gtree_elem(gpointer key, gpointer value, gpointer data)
- if (!capsule->key_vmsd) {
- qemu_put_be64(f, (uint64_t)(uintptr_t)(key)); /* direct key */
- } else {
-- ret = vmstate_save_state(f, capsule->key_vmsd, key, capsule->vmdesc);
-+ ret = vmstate_save_state(f, capsule->key_vmsd, key, capsule->vmdesc,
-+ &local_err);
- if (ret) {
-+ error_report_err(local_err);
- capsule->ret = ret;
- return true;
- }
- }
-
- /* put the data */
-- ret = vmstate_save_state(f, capsule->val_vmsd, value, capsule->vmdesc);
-+ ret = vmstate_save_state(f, capsule->val_vmsd, value, capsule->vmdesc,
-+ &local_err);
- if (ret) {
-+ error_report_err(local_err);
- capsule->ret = ret;
- return true;
- }
-@@ -857,14 +868,14 @@ static int put_qlist(QEMUFile *f, void *pv, size_t unused_size,
- size_t entry_offset = field->start;
- void *elm;
- int ret;
-+ Error *local_err = NULL;
-
- trace_put_qlist(field->name, vmsd->name, vmsd->version_id);
- QLIST_RAW_FOREACH(elm, pv, entry_offset) {
- qemu_put_byte(f, true);
-- ret = vmstate_save_state(f, vmsd, elm, vmdesc);
-+ ret = vmstate_save_state(f, vmsd, elm, vmdesc, &local_err);
- if (ret) {
-- error_report("%s: failed to save %s (%d)", field->name,
-- vmsd->name, ret);
-+ error_report_err(local_err);
- return ret;
- }
- }
-diff --git a/migration/vmstate.c b/migration/vmstate.c
-index 8d1e9eb62b..ad8e5b71ae 100644
---- a/migration/vmstate.c
-+++ b/migration/vmstate.c
-@@ -406,12 +406,6 @@ bool vmstate_section_needed(const VMStateDescription *vmsd, void *opaque)
-
-
- int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
-- void *opaque, JSONWriter *vmdesc_id)
--{
-- return vmstate_save_state_v(f, vmsd, opaque, vmdesc_id, vmsd->version_id, NULL);
--}
--
--int vmstate_save_state_with_err(QEMUFile *f, const VMStateDescription *vmsd,
- void *opaque, JSONWriter *vmdesc_id, Error **errp)
- {
- return vmstate_save_state_v(f, vmsd, opaque, vmdesc_id, vmsd->version_id, errp);
-@@ -512,7 +506,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
-
- if (inner_field->flags & VMS_STRUCT) {
- ret = vmstate_save_state(f, inner_field->vmsd,
-- curr_elem, vmdesc_loop);
-+ curr_elem, vmdesc_loop, errp);
- } else if (inner_field->flags & VMS_VSTRUCT) {
- ret = vmstate_save_state_v(f, inner_field->vmsd,
- curr_elem, vmdesc_loop,
-@@ -674,7 +668,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
- qemu_put_byte(f, len);
- qemu_put_buffer(f, (uint8_t *)vmsdsub->name, len);
- qemu_put_be32(f, vmsdsub->version_id);
-- ret = vmstate_save_state_with_err(f, vmsdsub, opaque, vmdesc, errp);
-+ ret = vmstate_save_state(f, vmsdsub, opaque, vmdesc, errp);
- if (ret) {
- return ret;
- }
-diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c
-index 4ff0ab632f..cadbab3c5e 100644
---- a/tests/unit/test-vmstate.c
-+++ b/tests/unit/test-vmstate.c
-@@ -67,9 +67,13 @@ static QEMUFile *open_test_file(bool write)
- static void save_vmstate(const VMStateDescription *desc, void *obj)
- {
- QEMUFile *f = open_test_file(true);
-+ Error *local_err = NULL;
-
- /* Save file with vmstate */
-- int ret = vmstate_save_state(f, desc, obj, NULL);
-+ int ret = vmstate_save_state(f, desc, obj, NULL, &local_err);
-+ if (ret) {
-+ error_report_err(local_err);
-+ }
- g_assert(!ret);
- qemu_put_byte(f, QEMU_VM_EOF);
- g_assert(!qemu_file_get_error(f));
-@@ -438,10 +442,15 @@ static const VMStateDescription vmstate_skipping = {
-
- static void test_save_noskip(void)
- {
-+ Error *local_err = NULL;
- QEMUFile *fsave = open_test_file(true);
- TestStruct obj = { .a = 1, .b = 2, .c = 3, .d = 4, .e = 5, .f = 6,
- .skip_c_e = false };
-- int ret = vmstate_save_state(fsave, &vmstate_skipping, &obj, NULL);
-+ int ret = vmstate_save_state(fsave, &vmstate_skipping, &obj, NULL,
-+ &local_err);
-+ if (ret) {
-+ error_report_err(local_err);
-+ }
- g_assert(!ret);
- g_assert(!qemu_file_get_error(fsave));
-
-@@ -460,10 +469,15 @@ static void test_save_noskip(void)
-
- static void test_save_skip(void)
- {
-+ Error *local_err = NULL;
- QEMUFile *fsave = open_test_file(true);
- TestStruct obj = { .a = 1, .b = 2, .c = 3, .d = 4, .e = 5, .f = 6,
- .skip_c_e = true };
-- int ret = vmstate_save_state(fsave, &vmstate_skipping, &obj, NULL);
-+ int ret = vmstate_save_state(fsave, &vmstate_skipping, &obj, NULL,
-+ &local_err);
-+ if (ret) {
-+ error_report_err(local_err);
-+ }
- g_assert(!ret);
- g_assert(!qemu_file_get_error(fsave));
-
-diff --git a/ui/vdagent.c b/ui/vdagent.c
-index bc3c77f013..ddb91e75c6 100644
---- a/ui/vdagent.c
-+++ b/ui/vdagent.c
-@@ -992,7 +992,8 @@ static int put_cbinfo(QEMUFile *f, void *pv, size_t size,
- }
- }
-
-- return vmstate_save_state(f, &vmstate_cbinfo_array, &cbinfo, vmdesc);
-+ return vmstate_save_state(f, &vmstate_cbinfo_array, &cbinfo, vmdesc,
-+ &error_fatal);
- }
-
- static int get_cbinfo(QEMUFile *f, void *pv, size_t size,
---
-2.52.0
-
diff --git a/kvm-migration-add-cpr_walk_fd.patch b/kvm-migration-add-cpr_walk_fd.patch
deleted file mode 100644
index e60ea6b..0000000
--- a/kvm-migration-add-cpr_walk_fd.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From df154d5011af1b33e245031b98a56f91969be66c Mon Sep 17 00:00:00 2001
-From: Steve Sistare <steven.sistare@oracle.com>
-Date: Wed, 1 Oct 2025 08:33:54 -0700
-Subject: [PATCH 089/116] migration: add cpr_walk_fd
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [73/100] 29b4bdb4daddc394a05956ba876d4ab6696d1e0b (rovick1/qemu-kvm)
-
-Add a helper to walk all CPR fd's and run a callback for each.
-
-Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
-Reviewed-by: Peter Xu <peterx@redhat.com>
-Link: https://lore.kernel.org/r/1759332851-370353-3-git-send-email-steven.sistare@oracle.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
----
- include/migration/cpr.h | 3 +++
- migration/cpr.c | 13 +++++++++++++
- 2 files changed, 16 insertions(+)
-
-diff --git a/include/migration/cpr.h b/include/migration/cpr.h
-index 3fc19a74ef..2b074d7a65 100644
---- a/include/migration/cpr.h
-+++ b/include/migration/cpr.h
-@@ -34,6 +34,9 @@ void cpr_resave_fd(const char *name, int id, int fd);
- int cpr_open_fd(const char *path, int flags, const char *name, int id,
- Error **errp);
-
-+typedef bool (*cpr_walk_fd_cb)(int fd);
-+bool cpr_walk_fd(cpr_walk_fd_cb cb);
-+
- MigMode cpr_get_incoming_mode(void);
- void cpr_set_incoming_mode(MigMode mode);
- bool cpr_is_incoming(void);
-diff --git a/migration/cpr.c b/migration/cpr.c
-index 038f48f810..a995b349d9 100644
---- a/migration/cpr.c
-+++ b/migration/cpr.c
-@@ -121,6 +121,19 @@ int cpr_open_fd(const char *path, int flags, const char *name, int id,
- return fd;
- }
-
-+bool cpr_walk_fd(cpr_walk_fd_cb cb)
-+{
-+ CprFd *elem;
-+
-+ QLIST_FOREACH(elem, &cpr_state.fds, next) {
-+ g_assert(elem->fd >= 0);
-+ if (!cb(elem->fd)) {
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
- /*************************************************************************/
- static const VMStateDescription vmstate_cpr_state = {
- .name = CPR_STATE,
---
-2.52.0
-
diff --git a/kvm-migration-cpr-exec-command-parameter.patch b/kvm-migration-cpr-exec-command-parameter.patch
deleted file mode 100644
index b3db725..0000000
--- a/kvm-migration-cpr-exec-command-parameter.patch
+++ /dev/null
@@ -1,218 +0,0 @@
-From b4ff0c555444a8ecd318d269ca662ff8cc6bf4d9 Mon Sep 17 00:00:00 2001
-From: Steve Sistare <steven.sistare@oracle.com>
-Date: Wed, 1 Oct 2025 08:33:56 -0700
-Subject: [PATCH 091/116] migration: cpr-exec-command parameter
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [75/100] f4b9811694a26506dbc5c31c8950f737ec70d3c5 (rovick1/qemu-kvm)
-
-Create the cpr-exec-command migration parameter, defined as a list of
-strings. It will be used for cpr-exec migration mode in a subsequent
-patch, and contains forward references to cpr-exec mode in the qapi
-doc.
-
-No functional change, except that cpr-exec-command is shown by the
-'info migrate' command.
-
-Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
-Acked-by: Markus Armbruster <armbru@redhat.com>
-Link: https://lore.kernel.org/r/1759332851-370353-5-git-send-email-steven.sistare@oracle.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
----
- hmp-commands.hx | 2 +-
- migration/migration-hmp-cmds.c | 30 ++++++++++++++++++++++++++++++
- migration/options.c | 14 ++++++++++++++
- qapi/migration.json | 21 ++++++++++++++++++---
- 4 files changed, 63 insertions(+), 4 deletions(-)
-
-diff --git a/hmp-commands.hx b/hmp-commands.hx
-index d0e4f35a30..3cace8f1f7 100644
---- a/hmp-commands.hx
-+++ b/hmp-commands.hx
-@@ -1009,7 +1009,7 @@ ERST
-
- {
- .name = "migrate_set_parameter",
-- .args_type = "parameter:s,value:s",
-+ .args_type = "parameter:s,value:S",
- .params = "parameter value",
- .help = "Set the parameter for migration",
- .cmd = hmp_migrate_set_parameter,
-diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
-index 0fc21f0647..54df615753 100644
---- a/migration/migration-hmp-cmds.c
-+++ b/migration/migration-hmp-cmds.c
-@@ -306,6 +306,18 @@ void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict)
- qapi_free_MigrationCapabilityStatusList(caps);
- }
-
-+static void monitor_print_cpr_exec_command(Monitor *mon, strList *args)
-+{
-+ monitor_printf(mon, "%s:",
-+ MigrationParameter_str(MIGRATION_PARAMETER_CPR_EXEC_COMMAND));
-+
-+ while (args) {
-+ monitor_printf(mon, " %s", args->value);
-+ args = args->next;
-+ }
-+ monitor_printf(mon, "\n");
-+}
-+
- void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
- {
- MigrationParameters *params;
-@@ -435,6 +447,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
- MIGRATION_PARAMETER_DIRECT_IO),
- params->direct_io ? "on" : "off");
- }
-+
-+ assert(params->has_cpr_exec_command);
-+ monitor_print_cpr_exec_command(mon, params->cpr_exec_command);
- }
-
- qapi_free_MigrationParameters(params);
-@@ -716,6 +731,21 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
- p->has_direct_io = true;
- visit_type_bool(v, param, &p->direct_io, &err);
- break;
-+ case MIGRATION_PARAMETER_CPR_EXEC_COMMAND: {
-+ g_autofree char **strv = NULL;
-+ g_autoptr(GError) gerr = NULL;
-+ strList **tail = &p->cpr_exec_command;
-+
-+ if (!g_shell_parse_argv(valuestr, NULL, &strv, &gerr)) {
-+ error_setg(&err, "%s", gerr->message);
-+ break;
-+ }
-+ for (int i = 0; strv[i]; i++) {
-+ QAPI_LIST_APPEND(tail, strv[i]);
-+ }
-+ p->has_cpr_exec_command = true;
-+ break;
-+ }
- default:
- g_assert_not_reached();
- }
-diff --git a/migration/options.c b/migration/options.c
-index 4e923a2e07..5183112775 100644
---- a/migration/options.c
-+++ b/migration/options.c
-@@ -959,6 +959,9 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
- params->zero_page_detection = s->parameters.zero_page_detection;
- params->has_direct_io = true;
- params->direct_io = s->parameters.direct_io;
-+ params->has_cpr_exec_command = true;
-+ params->cpr_exec_command = QAPI_CLONE(strList,
-+ s->parameters.cpr_exec_command);
-
- return params;
- }
-@@ -993,6 +996,7 @@ void migrate_params_init(MigrationParameters *params)
- params->has_mode = true;
- params->has_zero_page_detection = true;
- params->has_direct_io = true;
-+ params->has_cpr_exec_command = true;
- }
-
- /*
-@@ -1297,6 +1301,10 @@ static void migrate_params_test_apply(MigrateSetParameters *params,
- if (params->has_direct_io) {
- dest->direct_io = params->direct_io;
- }
-+
-+ if (params->has_cpr_exec_command) {
-+ dest->cpr_exec_command = params->cpr_exec_command;
-+ }
- }
-
- static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
-@@ -1429,6 +1437,12 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
- if (params->has_direct_io) {
- s->parameters.direct_io = params->direct_io;
- }
-+
-+ if (params->has_cpr_exec_command) {
-+ qapi_free_strList(s->parameters.cpr_exec_command);
-+ s->parameters.cpr_exec_command =
-+ QAPI_CLONE(strList, params->cpr_exec_command);
-+ }
- }
-
- void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp)
-diff --git a/qapi/migration.json b/qapi/migration.json
-index 2387c21e9c..2be8fa1d16 100644
---- a/qapi/migration.json
-+++ b/qapi/migration.json
-@@ -924,6 +924,10 @@
- # only has effect if the @mapped-ram capability is enabled.
- # (Since 9.1)
- #
-+# @cpr-exec-command: Command to start the new QEMU process when @mode
-+# is @cpr-exec. The first list element is the program's filename,
-+# the remainder its arguments. (Since 10.2)
-+#
- # Features:
- #
- # @unstable: Members @x-checkpoint-delay and
-@@ -950,7 +954,8 @@
- 'vcpu-dirty-limit',
- 'mode',
- 'zero-page-detection',
-- 'direct-io'] }
-+ 'direct-io',
-+ 'cpr-exec-command'] }
-
- ##
- # @MigrateSetParameters:
-@@ -1105,6 +1110,10 @@
- # only has effect if the @mapped-ram capability is enabled.
- # (Since 9.1)
- #
-+# @cpr-exec-command: Command to start the new QEMU process when @mode
-+# is @cpr-exec. The first list element is the program's filename,
-+# the remainder its arguments. (Since 10.2)
-+#
- # Features:
- #
- # @unstable: Members @x-checkpoint-delay and
-@@ -1146,7 +1155,8 @@
- '*vcpu-dirty-limit': 'uint64',
- '*mode': 'MigMode',
- '*zero-page-detection': 'ZeroPageDetection',
-- '*direct-io': 'bool' } }
-+ '*direct-io': 'bool',
-+ '*cpr-exec-command': [ 'str' ]} }
-
- ##
- # @migrate-set-parameters:
-@@ -1315,6 +1325,10 @@
- # only has effect if the @mapped-ram capability is enabled.
- # (Since 9.1)
- #
-+# @cpr-exec-command: Command to start the new QEMU process when @mode
-+# is @cpr-exec. The first list element is the program's filename,
-+# the remainder its arguments. (Since 10.2)
-+#
- # Features:
- #
- # @unstable: Members @x-checkpoint-delay and
-@@ -1353,7 +1367,8 @@
- '*vcpu-dirty-limit': 'uint64',
- '*mode': 'MigMode',
- '*zero-page-detection': 'ZeroPageDetection',
-- '*direct-io': 'bool' } }
-+ '*direct-io': 'bool',
-+ '*cpr-exec-command': [ 'str' ]} }
-
- ##
- # @query-migrate-parameters:
---
-2.52.0
-
diff --git a/kvm-migration-cpr-exec-docs.patch b/kvm-migration-cpr-exec-docs.patch
deleted file mode 100644
index 5204021..0000000
--- a/kvm-migration-cpr-exec-docs.patch
+++ /dev/null
@@ -1,155 +0,0 @@
-From b3c7dae14ab3fad5f9fea955b775084517553518 Mon Sep 17 00:00:00 2001
-From: Steve Sistare <steven.sistare@oracle.com>
-Date: Wed, 1 Oct 2025 08:33:59 -0700
-Subject: [PATCH 094/116] migration: cpr-exec docs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [78/100] e7264165aa8f378494974ca1898ec4bc3aa6e38f (rovick1/qemu-kvm)
-
-Update developer documentation for cpr-exec mode.
-
-Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
-Reviewed-by: Fabiano Rosas <farosas@suse.de>
-Link: https://lore.kernel.org/r/1759332851-370353-8-git-send-email-steven.sistare@oracle.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
----
- docs/devel/migration/CPR.rst | 112 ++++++++++++++++++++++++++++++++++-
- 1 file changed, 111 insertions(+), 1 deletion(-)
-
-diff --git a/docs/devel/migration/CPR.rst b/docs/devel/migration/CPR.rst
-index 0a0fd4f6dc..b6178568a8 100644
---- a/docs/devel/migration/CPR.rst
-+++ b/docs/devel/migration/CPR.rst
-@@ -5,7 +5,7 @@ CPR is the umbrella name for a set of migration modes in which the
- VM is migrated to a new QEMU instance on the same host. It is
- intended for use when the goal is to update host software components
- that run the VM, such as QEMU or even the host kernel. At this time,
--the cpr-reboot and cpr-transfer modes are available.
-+the cpr-reboot, cpr-transfer, and cpr-exec modes are available.
-
- Because QEMU is restarted on the same host, with access to the same
- local devices, CPR is allowed in certain cases where normal migration
-@@ -324,3 +324,113 @@ descriptors from old to new QEMU. In the future, descriptors for
- vhost, and char devices could be transferred,
- preserving those devices and their kernel state without interruption,
- even if they do not explicitly support live migration.
-+
-+cpr-exec mode
-+-------------
-+
-+In this mode, QEMU stops the VM, writes VM state to the migration
-+URI, and directly exec's a new version of QEMU on the same host,
-+replacing the original process while retaining its PID. Guest RAM is
-+preserved in place, albeit with new virtual addresses. The user
-+completes the migration by specifying the ``-incoming`` option, and
-+by issuing the ``migrate-incoming`` command if necessary; see details
-+below.
-+
-+This mode supports VFIO/IOMMUFD devices by preserving device
-+descriptors and hence kernel state across the exec, even for devices
-+that do not support live migration.
-+
-+Because the old and new QEMU instances are not active concurrently,
-+the URI cannot be a type that streams data from one instance to the
-+other.
-+
-+This mode does not require a channel of type ``cpr``. The information
-+that is passed over that channel for cpr-transfer mode is instead
-+serialized to a memfd, the number of the fd is saved in the
-+QEMU_CPR_EXEC_STATE environment variable during the exec of new QEMU.
-+and new QEMU mmaps the memfd.
-+
-+Usage
-+^^^^^
-+
-+Arguments for the new QEMU process are taken from the
-+@cpr-exec-command parameter. The first argument should be the
-+path of a new QEMU binary, or a prefix command that exec's the
-+new QEMU binary, and the arguments should include the ''-incoming''
-+option.
-+
-+Memory backend objects must have the ``share=on`` attribute.
-+The VM must be started with the ``-machine aux-ram-share=on`` option.
-+
-+Outgoing:
-+ * Set the migration mode parameter to ``cpr-exec``.
-+ * Set the ``cpr-exec-command`` parameter.
-+ * Issue the ``migrate`` command. It is recommended that the URI be
-+ a ``file`` type, but one can use other types such as ``exec``,
-+ provided the command captures all the data from the outgoing side,
-+ and provides all the data to the incoming side.
-+
-+Incoming:
-+ * You do not need to explicitly start new QEMU. It is started as
-+ a side effect of the migrate command above.
-+ * If the VM was running when the outgoing ``migrate`` command was
-+ issued, then QEMU automatically resumes VM execution.
-+
-+Example 1: incoming URI
-+^^^^^^^^^^^^^^^^^^^^^^^
-+
-+In these examples, we simply restart the same version of QEMU, but in
-+a real scenario one would set a new QEMU binary path in
-+cpr-exec-command.
-+
-+::
-+
-+ # qemu-kvm -monitor stdio
-+ -object memory-backend-memfd,id=ram0,size=4G
-+ -machine memory-backend=ram0
-+ -machine aux-ram-share=on
-+ ...
-+
-+ QEMU 10.2.50 monitor - type 'help' for more information
-+ (qemu) info status
-+ VM status: running
-+ (qemu) migrate_set_parameter mode cpr-exec
-+ (qemu) migrate_set_parameter cpr-exec-command qemu-kvm ... -incoming file:vm.state
-+ (qemu) migrate -d file:vm.state
-+ (qemu) QEMU 10.2.50 monitor - type 'help' for more information
-+ (qemu) info status
-+ VM status: running
-+
-+Example 2: incoming defer
-+^^^^^^^^^^^^^^^^^^^^^^^^^
-+::
-+
-+ # qemu-kvm -monitor stdio
-+ -object memory-backend-memfd,id=ram0,size=4G
-+ -machine memory-backend=ram0
-+ -machine aux-ram-share=on
-+ ...
-+
-+ QEMU 10.2.50 monitor - type 'help' for more information
-+ (qemu) info status
-+ VM status: running
-+ (qemu) migrate_set_parameter mode cpr-exec
-+ (qemu) migrate_set_parameter cpr-exec-command qemu-kvm ... -incoming defer
-+ (qemu) migrate -d file:vm.state
-+ (qemu) QEMU 10.2.50 monitor - type 'help' for more information
-+ (qemu) info status
-+ status: paused (inmigrate)
-+ (qemu) migrate_incoming file:vm.state
-+ (qemu) info status
-+ VM status: running
-+
-+Caveats
-+^^^^^^^
-+
-+cpr-exec mode may not be used with postcopy, background-snapshot,
-+or COLO.
-+
-+cpr-exec mode requires permission to use the exec system call, which
-+is denied by certain sandbox options, such as spawn.
-+
-+The guest pause time increases for large guest RAM backed by small pages.
---
-2.52.0
-
diff --git a/kvm-migration-cpr-exec-mode.patch b/kvm-migration-cpr-exec-mode.patch
deleted file mode 100644
index 2b48d61..0000000
--- a/kvm-migration-cpr-exec-mode.patch
+++ /dev/null
@@ -1,419 +0,0 @@
-From d233d9745e4519119159aecb4ff7050f20660041 Mon Sep 17 00:00:00 2001
-From: Steve Sistare <steven.sistare@oracle.com>
-Date: Wed, 1 Oct 2025 08:33:58 -0700
-Subject: [PATCH 093/116] migration: cpr-exec mode
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [77/100] bea8a1d3bf0582076d7b81bb4f83e19b9d257a75 (rovick1/qemu-kvm)
-
-Add the cpr-exec migration mode. Usage:
- qemu-system-$arch -machine aux-ram-share=on ...
- migrate_set_parameter mode cpr-exec
- migrate_set_parameter cpr-exec-command \
- <arg1> <arg2> ... -incoming <uri-1> \
- migrate -d <uri-1>
-
-The migrate command stops the VM, saves state to uri-1,
-directly exec's a new version of QEMU on the same host,
-replacing the original process while retaining its PID, and
-loads state from uri-1. Guest RAM is preserved in place,
-albeit with new virtual addresses.
-
-The new QEMU process is started by exec'ing the command
-specified by the @cpr-exec-command parameter. The first word of
-the command is the binary, and the remaining words are its
-arguments. The command may be a direct invocation of new QEMU,
-or may be a non-QEMU command that exec's the new QEMU binary.
-
-This mode creates a second migration channel that is not visible
-to the user. At the start of migration, old QEMU saves CPR state
-to the second channel, and at the end of migration, it tells the
-main loop to call cpr_exec. New QEMU loads CPR state early, before
-objects are created.
-
-Because old QEMU terminates when new QEMU starts, one cannot
-stream data between the two, so uri-1 must be a type,
-such as a file, that accepts all data before old QEMU exits.
-Otherwise, old QEMU may quietly block writing to the channel.
-
-Memory-backend objects must have the share=on attribute, but
-memory-backend-epc is not supported. The VM must be started with
-the '-machine aux-ram-share=on' option, which allows anonymous
-memory to be transferred in place to the new process. The memfds
-are kept open across exec by clearing the close-on-exec flag, their
-values are saved in CPR state, and they are mmap'd in new QEMU.
-
-Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
-Acked-by: Markus Armbruster <armbru@redhat.com>
-Link: https://lore.kernel.org/r/1759332851-370353-7-git-send-email-steven.sistare@oracle.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
----
- include/migration/cpr.h | 2 +
- migration/cpr-exec.c | 95 +++++++++++++++++++++++++++++++++++++++
- migration/cpr.c | 23 +++++++++-
- migration/migration.c | 10 ++++-
- migration/ram.c | 1 +
- migration/trace-events | 1 +
- migration/vmstate-types.c | 8 ++++
- qapi/migration.json | 25 ++++++++++-
- system/vl.c | 4 +-
- 9 files changed, 164 insertions(+), 5 deletions(-)
-
-diff --git a/include/migration/cpr.h b/include/migration/cpr.h
-index b84389ff04..a412d6663c 100644
---- a/include/migration/cpr.h
-+++ b/include/migration/cpr.h
-@@ -53,9 +53,11 @@ int cpr_get_fd_param(const char *name, const char *fdname, int index,
- QEMUFile *cpr_transfer_output(MigrationChannel *channel, Error **errp);
- QEMUFile *cpr_transfer_input(MigrationChannel *channel, Error **errp);
-
-+void cpr_exec_init(void);
- QEMUFile *cpr_exec_output(Error **errp);
- QEMUFile *cpr_exec_input(Error **errp);
- void cpr_exec_persist_state(QEMUFile *f);
- bool cpr_exec_has_state(void);
- void cpr_exec_unpersist_state(void);
-+void cpr_exec_unpreserve_fds(void);
- #endif
-diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c
-index 81d84425e1..d57714bc5d 100644
---- a/migration/cpr-exec.c
-+++ b/migration/cpr-exec.c
-@@ -6,15 +6,21 @@
-
- #include "qemu/osdep.h"
- #include "qemu/cutils.h"
-+#include "qemu/error-report.h"
- #include "qemu/memfd.h"
- #include "qapi/error.h"
-+#include "qapi/type-helpers.h"
- #include "io/channel-file.h"
- #include "io/channel-socket.h"
-+#include "block/block-global-state.h"
-+#include "qemu/main-loop.h"
- #include "migration/cpr.h"
- #include "migration/qemu-file.h"
-+#include "migration/migration.h"
- #include "migration/misc.h"
- #include "migration/vmstate.h"
- #include "system/runstate.h"
-+#include "trace.h"
-
- #define CPR_EXEC_STATE_NAME "QEMU_CPR_EXEC_STATE"
-
-@@ -97,3 +103,92 @@ QEMUFile *cpr_exec_input(Error **errp)
- lseek(mfd, 0, SEEK_SET);
- return qemu_file_new_fd_input(mfd, CPR_EXEC_STATE_NAME);
- }
-+
-+static bool preserve_fd(int fd)
-+{
-+ qemu_clear_cloexec(fd);
-+ return true;
-+}
-+
-+static bool unpreserve_fd(int fd)
-+{
-+ qemu_set_cloexec(fd);
-+ return true;
-+}
-+
-+static void cpr_exec_preserve_fds(void)
-+{
-+ cpr_walk_fd(preserve_fd);
-+}
-+
-+void cpr_exec_unpreserve_fds(void)
-+{
-+ cpr_walk_fd(unpreserve_fd);
-+}
-+
-+static void cpr_exec_cb(void *opaque)
-+{
-+ MigrationState *s = migrate_get_current();
-+ char **argv = strv_from_str_list(s->parameters.cpr_exec_command);
-+ Error *err = NULL;
-+
-+ /*
-+ * Clear the close-on-exec flag for all preserved fd's. We cannot do so
-+ * earlier because they should not persist across miscellaneous fork and
-+ * exec calls that are performed during normal operation.
-+ */
-+ cpr_exec_preserve_fds();
-+
-+ trace_cpr_exec();
-+ execvp(argv[0], argv);
-+
-+ /*
-+ * exec should only fail if argv[0] is bogus, or has a permissions problem,
-+ * or the system is very short on resources.
-+ */
-+ g_strfreev(argv);
-+ cpr_exec_unpreserve_fds();
-+
-+ error_setg_errno(&err, errno, "execvp %s failed", argv[0]);
-+ error_report_err(error_copy(err));
-+ migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED);
-+ migrate_set_error(s, err);
-+
-+ /* Note, we can go from state COMPLETED to FAILED */
-+ migration_call_notifiers(s, MIG_EVENT_PRECOPY_FAILED, NULL);
-+
-+ err = NULL;
-+ if (!migration_block_activate(&err)) {
-+ /* error was already reported */
-+ error_free(err);
-+ return;
-+ }
-+
-+ if (runstate_is_live(s->vm_old_state)) {
-+ vm_start();
-+ }
-+}
-+
-+static int cpr_exec_notifier(NotifierWithReturn *notifier, MigrationEvent *e,
-+ Error **errp)
-+{
-+ MigrationState *s = migrate_get_current();
-+
-+ if (e->type == MIG_EVENT_PRECOPY_DONE) {
-+ QEMUBH *cpr_exec_bh = qemu_bh_new(cpr_exec_cb, NULL);
-+ assert(s->state == MIGRATION_STATUS_COMPLETED);
-+ qemu_bh_schedule(cpr_exec_bh);
-+ qemu_notify_event();
-+ } else if (e->type == MIG_EVENT_PRECOPY_FAILED) {
-+ cpr_exec_unpersist_state();
-+ }
-+ return 0;
-+}
-+
-+void cpr_exec_init(void)
-+{
-+ static NotifierWithReturn exec_notifier;
-+
-+ migration_add_notifier_mode(&exec_notifier, cpr_exec_notifier,
-+ MIG_MODE_CPR_EXEC);
-+}
-diff --git a/migration/cpr.c b/migration/cpr.c
-index a995b349d9..0b87c2343f 100644
---- a/migration/cpr.c
-+++ b/migration/cpr.c
-@@ -6,6 +6,7 @@
- */
-
- #include "qemu/osdep.h"
-+#include "qemu/error-report.h"
- #include "qapi/error.h"
- #include "hw/vfio/vfio-device.h"
- #include "migration/cpr.h"
-@@ -185,6 +186,8 @@ int cpr_state_save(MigrationChannel *channel, Error **errp)
- if (mode == MIG_MODE_CPR_TRANSFER) {
- g_assert(channel);
- f = cpr_transfer_output(channel, errp);
-+ } else if (mode == MIG_MODE_CPR_EXEC) {
-+ f = cpr_exec_output(errp);
- } else {
- return 0;
- }
-@@ -201,6 +204,10 @@ int cpr_state_save(MigrationChannel *channel, Error **errp)
- return ret;
- }
-
-+ if (migrate_mode() == MIG_MODE_CPR_EXEC) {
-+ cpr_exec_persist_state(f);
-+ }
-+
- /*
- * Close the socket only partially so we can later detect when the other
- * end closes by getting a HUP event.
-@@ -219,7 +226,13 @@ int cpr_state_load(MigrationChannel *channel, Error **errp)
- QEMUFile *f;
- MigMode mode = 0;
-
-- if (channel) {
-+ if (cpr_exec_has_state()) {
-+ mode = MIG_MODE_CPR_EXEC;
-+ f = cpr_exec_input(errp);
-+ if (channel) {
-+ warn_report("ignoring cpr channel for migration mode cpr-exec");
-+ }
-+ } else if (channel) {
- mode = MIG_MODE_CPR_TRANSFER;
- cpr_set_incoming_mode(mode);
- f = cpr_transfer_input(channel, errp);
-@@ -231,6 +244,7 @@ int cpr_state_load(MigrationChannel *channel, Error **errp)
- }
-
- trace_cpr_state_load(MigMode_str(mode));
-+ cpr_set_incoming_mode(mode);
-
- v = qemu_get_be32(f);
- if (v != QEMU_CPR_FILE_MAGIC) {
-@@ -251,6 +265,11 @@ int cpr_state_load(MigrationChannel *channel, Error **errp)
- return ret;
- }
-
-+ if (migrate_mode() == MIG_MODE_CPR_EXEC) {
-+ /* Set cloexec to prevent fd leaks from fork until the next cpr-exec */
-+ cpr_exec_unpreserve_fds();
-+ }
-+
- /*
- * Let the caller decide when to close the socket (and generate a HUP event
- * for the sending side).
-@@ -271,7 +290,7 @@ void cpr_state_close(void)
- bool cpr_incoming_needed(void *opaque)
- {
- MigMode mode = migrate_mode();
-- return mode == MIG_MODE_CPR_TRANSFER;
-+ return mode == MIG_MODE_CPR_TRANSFER || mode == MIG_MODE_CPR_EXEC;
- }
-
- /*
-diff --git a/migration/migration.c b/migration/migration.c
-index 08a98f74ef..2515bec48f 100644
---- a/migration/migration.c
-+++ b/migration/migration.c
-@@ -333,6 +333,7 @@ void migration_object_init(void)
-
- ram_mig_init();
- dirty_bitmap_mig_init();
-+ cpr_exec_init();
-
- /* Initialize cpu throttle timers */
- cpu_throttle_init();
-@@ -1796,7 +1797,8 @@ bool migrate_mode_is_cpr(MigrationState *s)
- {
- MigMode mode = s->parameters.mode;
- return mode == MIG_MODE_CPR_REBOOT ||
-- mode == MIG_MODE_CPR_TRANSFER;
-+ mode == MIG_MODE_CPR_TRANSFER ||
-+ mode == MIG_MODE_CPR_EXEC;
- }
-
- int migrate_init(MigrationState *s, Error **errp)
-@@ -2145,6 +2147,12 @@ static bool migrate_prepare(MigrationState *s, bool resume, Error **errp)
- return false;
- }
-
-+ if (migrate_mode() == MIG_MODE_CPR_EXEC &&
-+ !s->parameters.has_cpr_exec_command) {
-+ error_setg(errp, "cpr-exec mode requires setting cpr-exec-command");
-+ return false;
-+ }
-+
- if (migration_is_blocked(errp)) {
- return false;
- }
-diff --git a/migration/ram.c b/migration/ram.c
-index 7208bc114f..6730a41ff5 100644
---- a/migration/ram.c
-+++ b/migration/ram.c
-@@ -228,6 +228,7 @@ bool migrate_ram_is_ignored(RAMBlock *block)
- MigMode mode = migrate_mode();
- return !qemu_ram_is_migratable(block) ||
- mode == MIG_MODE_CPR_TRANSFER ||
-+ mode == MIG_MODE_CPR_EXEC ||
- (migrate_ignore_shared() && qemu_ram_is_shared(block)
- && qemu_ram_is_named_file(block));
- }
-diff --git a/migration/trace-events b/migration/trace-events
-index 706db97def..e8edd1fbba 100644
---- a/migration/trace-events
-+++ b/migration/trace-events
-@@ -354,6 +354,7 @@ cpr_state_save(const char *mode) "%s mode"
- cpr_state_load(const char *mode) "%s mode"
- cpr_transfer_input(const char *path) "%s"
- cpr_transfer_output(const char *path) "%s"
-+cpr_exec(void) ""
-
- # block-dirty-bitmap.c
- send_bitmap_header_enter(void) ""
-diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
-index a1cd7a95fa..4b01dc19c2 100644
---- a/migration/vmstate-types.c
-+++ b/migration/vmstate-types.c
-@@ -322,6 +322,10 @@ static int get_fd(QEMUFile *f, void *pv, size_t size,
- const VMStateField *field)
- {
- int32_t *v = pv;
-+ if (migrate_mode() == MIG_MODE_CPR_EXEC) {
-+ qemu_get_sbe32s(f, v);
-+ return 0;
-+ }
- *v = qemu_file_get_fd(f);
- return 0;
- }
-@@ -330,6 +334,10 @@ static int put_fd(QEMUFile *f, void *pv, size_t size,
- const VMStateField *field, JSONWriter *vmdesc)
- {
- int32_t *v = pv;
-+ if (migrate_mode() == MIG_MODE_CPR_EXEC) {
-+ qemu_put_sbe32s(f, v);
-+ return 0;
-+ }
- return qemu_file_put_fd(f, *v);
- }
-
-diff --git a/qapi/migration.json b/qapi/migration.json
-index 2be8fa1d16..be0f3fcc12 100644
---- a/qapi/migration.json
-+++ b/qapi/migration.json
-@@ -694,9 +694,32 @@
- # until you issue the `migrate-incoming` command.
- #
- # (since 10.0)
-+#
-+# @cpr-exec: The migrate command stops the VM, saves state to the
-+# migration channel, directly exec's a new version of QEMU on the
-+# same host, replacing the original process while retaining its
-+# PID, and loads state from the channel. Guest RAM is preserved
-+# in place. Devices and their pinned pages are also preserved for
-+# VFIO and IOMMUFD.
-+#
-+# Old QEMU starts new QEMU by exec'ing the command specified by
-+# the @cpr-exec-command parameter. The command may be a direct
-+# invocation of new QEMU, or may be a wrapper that exec's the new
-+# QEMU binary.
-+#
-+# Because old QEMU terminates when new QEMU starts, one cannot
-+# stream data between the two, so the channel must be a type,
-+# such as a file, that accepts all data before old QEMU exits.
-+# Otherwise, old QEMU may quietly block writing to the channel.
-+#
-+# Memory-backend objects must have the share=on attribute, but
-+# memory-backend-epc is not supported. The VM must be started
-+# with the '-machine aux-ram-share=on' option.
-+#
-+# (since 10.2)
- ##
- { 'enum': 'MigMode',
-- 'data': [ 'normal', 'cpr-reboot', 'cpr-transfer' ] }
-+ 'data': [ 'normal', 'cpr-reboot', 'cpr-transfer', 'cpr-exec' ] }
-
- ##
- # @ZeroPageDetection:
-diff --git a/system/vl.c b/system/vl.c
-index d3e6158753..7a32043625 100644
---- a/system/vl.c
-+++ b/system/vl.c
-@@ -3850,6 +3850,8 @@ void qemu_init(int argc, char **argv)
- }
- qemu_init_displays();
- accel_setup_post(current_machine);
-- os_setup_post();
-+ if (migrate_mode() != MIG_MODE_CPR_EXEC) {
-+ os_setup_post();
-+ }
- resume_mux_open();
- }
---
-2.52.0
-
diff --git a/kvm-migration-cpr-exec-save-and-load.patch b/kvm-migration-cpr-exec-save-and-load.patch
deleted file mode 100644
index c36e18e..0000000
--- a/kvm-migration-cpr-exec-save-and-load.patch
+++ /dev/null
@@ -1,166 +0,0 @@
-From 9eba869ae9f22f7c9470ca84b01bc775441ffa77 Mon Sep 17 00:00:00 2001
-From: Steve Sistare <steven.sistare@oracle.com>
-Date: Wed, 1 Oct 2025 08:33:57 -0700
-Subject: [PATCH 092/116] migration: cpr-exec save and load
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [76/100] dccfce1a851364d8a3fc15ccc537277fd2f3b55b (rovick1/qemu-kvm)
-
-To preserve CPR state across exec, create a QEMUFile based on a memfd, and
-keep the memfd open across exec. Save the value of the memfd in an
-environment variable so post-exec QEMU can find it.
-
-These new functions are called in a subsequent patch.
-
-Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
-Link: https://lore.kernel.org/r/1759332851-370353-6-git-send-email-steven.sistare@oracle.com
-[peterx: fix build for Windows]
-Signed-off-by: Peter Xu <peterx@redhat.com>
----
- include/migration/cpr.h | 5 +++
- migration/cpr-exec.c | 99 +++++++++++++++++++++++++++++++++++++++++
- migration/meson.build | 1 +
- 3 files changed, 105 insertions(+)
- create mode 100644 migration/cpr-exec.c
-
-diff --git a/include/migration/cpr.h b/include/migration/cpr.h
-index 2b074d7a65..b84389ff04 100644
---- a/include/migration/cpr.h
-+++ b/include/migration/cpr.h
-@@ -53,4 +53,9 @@ int cpr_get_fd_param(const char *name, const char *fdname, int index,
- QEMUFile *cpr_transfer_output(MigrationChannel *channel, Error **errp);
- QEMUFile *cpr_transfer_input(MigrationChannel *channel, Error **errp);
-
-+QEMUFile *cpr_exec_output(Error **errp);
-+QEMUFile *cpr_exec_input(Error **errp);
-+void cpr_exec_persist_state(QEMUFile *f);
-+bool cpr_exec_has_state(void);
-+void cpr_exec_unpersist_state(void);
- #endif
-diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c
-new file mode 100644
-index 0000000000..81d84425e1
---- /dev/null
-+++ b/migration/cpr-exec.c
-@@ -0,0 +1,99 @@
-+/*
-+ * Copyright (c) 2021-2025 Oracle and/or its affiliates.
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#include "qemu/osdep.h"
-+#include "qemu/cutils.h"
-+#include "qemu/memfd.h"
-+#include "qapi/error.h"
-+#include "io/channel-file.h"
-+#include "io/channel-socket.h"
-+#include "migration/cpr.h"
-+#include "migration/qemu-file.h"
-+#include "migration/misc.h"
-+#include "migration/vmstate.h"
-+#include "system/runstate.h"
-+
-+#define CPR_EXEC_STATE_NAME "QEMU_CPR_EXEC_STATE"
-+
-+static QEMUFile *qemu_file_new_fd_input(int fd, const char *name)
-+{
-+ g_autoptr(QIOChannelFile) fioc = qio_channel_file_new_fd(fd);
-+ QIOChannel *ioc = QIO_CHANNEL(fioc);
-+ qio_channel_set_name(ioc, name);
-+ return qemu_file_new_input(ioc);
-+}
-+
-+static QEMUFile *qemu_file_new_fd_output(int fd, const char *name)
-+{
-+ g_autoptr(QIOChannelFile) fioc = qio_channel_file_new_fd(fd);
-+ QIOChannel *ioc = QIO_CHANNEL(fioc);
-+ qio_channel_set_name(ioc, name);
-+ return qemu_file_new_output(ioc);
-+}
-+
-+void cpr_exec_persist_state(QEMUFile *f)
-+{
-+ QIOChannelFile *fioc = QIO_CHANNEL_FILE(qemu_file_get_ioc(f));
-+ int mfd = dup(fioc->fd);
-+ char val[16];
-+
-+ /* Remember mfd in environment for post-exec load */
-+ qemu_clear_cloexec(mfd);
-+ snprintf(val, sizeof(val), "%d", mfd);
-+ g_setenv(CPR_EXEC_STATE_NAME, val, 1);
-+}
-+
-+static int cpr_exec_find_state(void)
-+{
-+ const char *val = g_getenv(CPR_EXEC_STATE_NAME);
-+ int mfd;
-+
-+ assert(val);
-+ g_unsetenv(CPR_EXEC_STATE_NAME);
-+ assert(!qemu_strtoi(val, NULL, 10, &mfd));
-+ return mfd;
-+}
-+
-+bool cpr_exec_has_state(void)
-+{
-+ return g_getenv(CPR_EXEC_STATE_NAME) != NULL;
-+}
-+
-+void cpr_exec_unpersist_state(void)
-+{
-+ int mfd;
-+ const char *val = g_getenv(CPR_EXEC_STATE_NAME);
-+
-+ g_unsetenv(CPR_EXEC_STATE_NAME);
-+ assert(val);
-+ assert(!qemu_strtoi(val, NULL, 10, &mfd));
-+ close(mfd);
-+}
-+
-+QEMUFile *cpr_exec_output(Error **errp)
-+{
-+ int mfd;
-+
-+#ifdef CONFIG_LINUX
-+ mfd = qemu_memfd_create(CPR_EXEC_STATE_NAME, 0, false, 0, 0, errp);
-+#else
-+ mfd = -1;
-+#endif
-+
-+ if (mfd < 0) {
-+ return NULL;
-+ }
-+
-+ return qemu_file_new_fd_output(mfd, CPR_EXEC_STATE_NAME);
-+}
-+
-+QEMUFile *cpr_exec_input(Error **errp)
-+{
-+ int mfd = cpr_exec_find_state();
-+
-+ lseek(mfd, 0, SEEK_SET);
-+ return qemu_file_new_fd_input(mfd, CPR_EXEC_STATE_NAME);
-+}
-diff --git a/migration/meson.build b/migration/meson.build
-index 276da3be5a..6087ccc733 100644
---- a/migration/meson.build
-+++ b/migration/meson.build
-@@ -16,6 +16,7 @@ system_ss.add(files(
- 'channel-block.c',
- 'cpr.c',
- 'cpr-transfer.c',
-+ 'cpr-exec.c',
- 'cpu-throttle.c',
- 'dirtyrate.c',
- 'exec.c',
---
-2.52.0
-
diff --git a/kvm-migration-multi-mode-notifier.patch b/kvm-migration-multi-mode-notifier.patch
deleted file mode 100644
index a812546..0000000
--- a/kvm-migration-multi-mode-notifier.patch
+++ /dev/null
@@ -1,157 +0,0 @@
-From 277f2e9a68f401cf6d9cd95ba79d864f6573cb53 Mon Sep 17 00:00:00 2001
-From: Steve Sistare <steven.sistare@oracle.com>
-Date: Wed, 1 Oct 2025 08:33:53 -0700
-Subject: [PATCH 088/116] migration: multi-mode notifier
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [72/100] 79ea99ab507d32395539eaa44766091af09876aa (rovick1/qemu-kvm)
-
-Allow a notifier to be added for multiple migration modes.
-To allow a notifier to appear on multiple per-node lists, use
-a generic list type. We can no longer use NotifierWithReturnList,
-because it shoe horns the notifier onto a single list.
-
-Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
-Reviewed-by: Fabiano Rosas <farosas@suse.de>
-Link: https://lore.kernel.org/r/1759332851-370353-2-git-send-email-steven.sistare@oracle.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
----
- include/migration/misc.h | 12 ++++++++
- migration/migration.c | 60 +++++++++++++++++++++++++++++++---------
- 2 files changed, 59 insertions(+), 13 deletions(-)
-
-diff --git a/include/migration/misc.h b/include/migration/misc.h
-index a261f99d89..592b93021e 100644
---- a/include/migration/misc.h
-+++ b/include/migration/misc.h
-@@ -95,7 +95,19 @@ void migration_add_notifier(NotifierWithReturn *notify,
- void migration_add_notifier_mode(NotifierWithReturn *notify,
- MigrationNotifyFunc func, MigMode mode);
-
-+/*
-+ * Same as migration_add_notifier, but applies to all @mode in the argument
-+ * list. The list is terminated by -1 or MIG_MODE_ALL. For the latter,
-+ * the notifier is added for all modes.
-+ */
-+void migration_add_notifier_modes(NotifierWithReturn *notify,
-+ MigrationNotifyFunc func, MigMode mode, ...);
-+
-+/*
-+ * Remove a notifier from all modes.
-+ */
- void migration_remove_notifier(NotifierWithReturn *notify);
-+
- void migration_file_set_error(int ret, Error *err);
-
- /* True if incoming migration entered POSTCOPY_INCOMING_DISCARD */
-diff --git a/migration/migration.c b/migration/migration.c
-index 10c216d25d..08a98f74ef 100644
---- a/migration/migration.c
-+++ b/migration/migration.c
-@@ -74,11 +74,7 @@
-
- #define INMIGRATE_DEFAULT_EXIT_ON_ERROR true
-
--static NotifierWithReturnList migration_state_notifiers[] = {
-- NOTIFIER_ELEM_INIT(migration_state_notifiers, MIG_MODE_NORMAL),
-- NOTIFIER_ELEM_INIT(migration_state_notifiers, MIG_MODE_CPR_REBOOT),
-- NOTIFIER_ELEM_INIT(migration_state_notifiers, MIG_MODE_CPR_TRANSFER),
--};
-+static GSList *migration_state_notifiers[MIG_MODE__MAX];
-
- /* Messages sent on the return path from destination to source */
- enum mig_rp_message_type {
-@@ -1665,23 +1661,51 @@ void migration_cancel(void)
- }
- }
-
-+static int get_modes(MigMode mode, va_list ap);
-+
-+static void add_notifiers(NotifierWithReturn *notify, int modes)
-+{
-+ for (MigMode mode = 0; mode < MIG_MODE__MAX; mode++) {
-+ if (modes & BIT(mode)) {
-+ migration_state_notifiers[mode] =
-+ g_slist_prepend(migration_state_notifiers[mode], notify);
-+ }
-+ }
-+}
-+
-+void migration_add_notifier_modes(NotifierWithReturn *notify,
-+ MigrationNotifyFunc func, MigMode mode, ...)
-+{
-+ int modes;
-+ va_list ap;
-+
-+ va_start(ap, mode);
-+ modes = get_modes(mode, ap);
-+ va_end(ap);
-+
-+ notify->notify = (NotifierWithReturnFunc)func;
-+ add_notifiers(notify, modes);
-+}
-+
- void migration_add_notifier_mode(NotifierWithReturn *notify,
- MigrationNotifyFunc func, MigMode mode)
- {
-- notify->notify = (NotifierWithReturnFunc)func;
-- notifier_with_return_list_add(&migration_state_notifiers[mode], notify);
-+ migration_add_notifier_modes(notify, func, mode, -1);
- }
-
- void migration_add_notifier(NotifierWithReturn *notify,
- MigrationNotifyFunc func)
- {
-- migration_add_notifier_mode(notify, func, MIG_MODE_NORMAL);
-+ migration_add_notifier_modes(notify, func, MIG_MODE_NORMAL, -1);
- }
-
- void migration_remove_notifier(NotifierWithReturn *notify)
- {
- if (notify->notify) {
-- notifier_with_return_remove(notify);
-+ for (MigMode mode = 0; mode < MIG_MODE__MAX; mode++) {
-+ migration_blockers[mode] =
-+ g_slist_remove(migration_state_notifiers[mode], notify);
-+ }
- notify->notify = NULL;
- }
- }
-@@ -1691,13 +1715,23 @@ int migration_call_notifiers(MigrationState *s, MigrationEventType type,
- {
- MigMode mode = s->parameters.mode;
- MigrationEvent e;
-+ NotifierWithReturn *notifier;
-+ GSList *elem, *next;
- int ret;
-
- e.type = type;
-- ret = notifier_with_return_list_notify(&migration_state_notifiers[mode],
-- &e, errp);
-- assert(!ret || type == MIG_EVENT_PRECOPY_SETUP);
-- return ret;
-+
-+ for (elem = migration_state_notifiers[mode]; elem; elem = next) {
-+ next = elem->next;
-+ notifier = (NotifierWithReturn *)elem->data;
-+ ret = notifier->notify(notifier, &e, errp);
-+ if (ret) {
-+ assert(type == MIG_EVENT_PRECOPY_SETUP);
-+ return ret;
-+ }
-+ }
-+
-+ return 0;
- }
-
- bool migration_has_failed(MigrationState *s)
---
-2.52.0
-
diff --git a/kvm-migration-push-Error-errp-into-vmstate_load_state.patch b/kvm-migration-push-Error-errp-into-vmstate_load_state.patch
deleted file mode 100644
index e873214..0000000
--- a/kvm-migration-push-Error-errp-into-vmstate_load_state.patch
+++ /dev/null
@@ -1,740 +0,0 @@
-From 0f7971ace7c47bc892f7814e3acada9c3f6ef339 Mon Sep 17 00:00:00 2001
-From: Arun Menon <armenon@redhat.com>
-Date: Thu, 18 Sep 2025 20:53:19 +0530
-Subject: [PATCH 086/116] migration: push Error **errp into
- vmstate_load_state()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [70/100] a8ab3ad230d8f1256d992420f902562e5d39b740 (rovick1/qemu-kvm)
-
-This is an incremental step in converting vmstate loading
-code to report error via Error objects instead of directly
-printing it to console/monitor.
-It is ensured that vmstate_load_state() must report an error
-in errp, in case of failure.
-
-The errors are temporarily reported using error_report_err().
-This is removed in the subsequent patches in this series,
-when we are actually able to propagate the error to the calling
-function using errp. Whereas, if we want the function to exit on
-error, then error_fatal is passed.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Reviewed-by: Fabiano Rosas <farosas@suse.de>
-Signed-off-by: Arun Menon <armenon@redhat.com>
-Tested-by: Fabiano Rosas <farosas@suse.de>
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Link: https://lore.kernel.org/r/20250918-propagate_tpm_error-v14-2-36f11a6fb9d3@redhat.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
-(cherry picked from commit c632ffbd74a497e88bbb4e4d55a357055eae6f47)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/display/virtio-gpu.c | 2 +-
- hw/pci/pci.c | 3 +-
- hw/s390x/virtio-ccw.c | 2 +-
- hw/scsi/spapr_vscsi.c | 4 ++-
- hw/vfio/pci.c | 5 ++-
- hw/virtio/virtio-mmio.c | 3 +-
- hw/virtio/virtio-pci.c | 2 +-
- hw/virtio/virtio.c | 7 +++--
- include/migration/vmstate.h | 2 +-
- migration/cpr.c | 3 +-
- migration/savevm.c | 8 +++--
- migration/vmstate-types.c | 28 ++++++++++-------
- migration/vmstate.c | 61 +++++++++++++++++++++++------------
- tests/unit/test-vmstate.c | 63 +++++++++++++++++++++++++++++++------
- ui/vdagent.c | 5 ++-
- 15 files changed, 143 insertions(+), 55 deletions(-)
-
-diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
-index 0a1a625b0e..5dc31bc6bf 100644
---- a/hw/display/virtio-gpu.c
-+++ b/hw/display/virtio-gpu.c
-@@ -1343,7 +1343,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
- }
-
- /* load & apply scanout state */
-- vmstate_load_state(f, &vmstate_virtio_gpu_scanouts, g, 1);
-+ vmstate_load_state(f, &vmstate_virtio_gpu_scanouts, g, 1, &error_fatal);
-
- return 0;
- }
-diff --git a/hw/pci/pci.c b/hw/pci/pci.c
-index d2ebb066e1..5b37b70815 100644
---- a/hw/pci/pci.c
-+++ b/hw/pci/pci.c
-@@ -934,7 +934,8 @@ void pci_device_save(PCIDevice *s, QEMUFile *f)
- int pci_device_load(PCIDevice *s, QEMUFile *f)
- {
- int ret;
-- ret = vmstate_load_state(f, &vmstate_pci_device, s, s->version_id);
-+ ret = vmstate_load_state(f, &vmstate_pci_device, s, s->version_id,
-+ &error_fatal);
- /* Restore the interrupt status bit. */
- pci_update_irq_status(s);
- return ret;
-diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
-index d2f85b39f3..6a9641a03d 100644
---- a/hw/s390x/virtio-ccw.c
-+++ b/hw/s390x/virtio-ccw.c
-@@ -1136,7 +1136,7 @@ static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f)
- static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
- {
- VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
-- return vmstate_load_state(f, &vmstate_virtio_ccw_dev, dev, 1);
-+ return vmstate_load_state(f, &vmstate_virtio_ccw_dev, dev, 1, &error_fatal);
- }
-
- static void virtio_ccw_pre_plugged(DeviceState *d, Error **errp)
-diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
-index 20f70fb272..da173f4867 100644
---- a/hw/scsi/spapr_vscsi.c
-+++ b/hw/scsi/spapr_vscsi.c
-@@ -642,15 +642,17 @@ static void *vscsi_load_request(QEMUFile *f, SCSIRequest *sreq)
- VSCSIState *s = VIO_SPAPR_VSCSI_DEVICE(bus->qbus.parent);
- vscsi_req *req;
- int rc;
-+ Error *local_err = NULL;
-
- assert(sreq->tag < VSCSI_REQ_LIMIT);
- req = &s->reqs[sreq->tag];
- assert(!req->active);
-
- memset(req, 0, sizeof(*req));
-- rc = vmstate_load_state(f, &vmstate_spapr_vscsi_req, req, 1);
-+ rc = vmstate_load_state(f, &vmstate_spapr_vscsi_req, req, 1, &local_err);
- if (rc) {
- fprintf(stderr, "VSCSI: failed loading request tag#%u\n", sreq->tag);
-+ error_report_err(local_err);
- return NULL;
- }
- assert(req->active);
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index c34ed85d5e..f696e8116f 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -2834,13 +2834,16 @@ static int vfio_pci_load_config(VFIODevice *vbasedev, QEMUFile *f)
- PCIDevice *pdev = PCI_DEVICE(vdev);
- pcibus_t old_addr[PCI_NUM_REGIONS - 1];
- int bar, ret;
-+ Error *local_err = NULL;
-
- for (bar = 0; bar < PCI_ROM_SLOT; bar++) {
- old_addr[bar] = pdev->io_regions[bar].addr;
- }
-
-- ret = vmstate_load_state(f, &vmstate_vfio_pci_config, vdev, 1);
-+ ret = vmstate_load_state(f, &vmstate_vfio_pci_config, vdev, 1,
-+ &local_err);
- if (ret) {
-+ error_report_err(local_err);
- return ret;
- }
-
-diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
-index 532c67107b..0a688909fc 100644
---- a/hw/virtio/virtio-mmio.c
-+++ b/hw/virtio/virtio-mmio.c
-@@ -34,6 +34,7 @@
- #include "qemu/error-report.h"
- #include "qemu/log.h"
- #include "trace.h"
-+#include "qapi/error.h"
-
- static bool virtio_mmio_ioeventfd_enabled(DeviceState *d)
- {
-@@ -619,7 +620,7 @@ static int virtio_mmio_load_extra_state(DeviceState *opaque, QEMUFile *f)
- {
- VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque);
-
-- return vmstate_load_state(f, &vmstate_virtio_mmio, proxy, 1);
-+ return vmstate_load_state(f, &vmstate_virtio_mmio, proxy, 1, &error_fatal);
- }
-
- static bool virtio_mmio_has_extra_state(DeviceState *opaque)
-diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
-index d38d0a5e9a..ae875bd108 100644
---- a/hw/virtio/virtio-pci.c
-+++ b/hw/virtio/virtio-pci.c
-@@ -195,7 +195,7 @@ static int virtio_pci_load_extra_state(DeviceState *d, QEMUFile *f)
- {
- VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
-
-- return vmstate_load_state(f, &vmstate_virtio_pci, proxy, 1);
-+ return vmstate_load_state(f, &vmstate_virtio_pci, proxy, 1, &error_fatal);
- }
-
- static void virtio_pci_save_queue(DeviceState *d, int n, QEMUFile *f)
-diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
-index 34f977a3c9..e6cbbc8624 100644
---- a/hw/virtio/virtio.c
-+++ b/hw/virtio/virtio.c
-@@ -3278,6 +3278,7 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
- BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
- VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
- VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
-+ Error *local_err = NULL;
-
- /*
- * We poison the endianness to ensure it does not get used before
-@@ -3370,15 +3371,17 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
- }
-
- if (vdc->vmsd) {
-- ret = vmstate_load_state(f, vdc->vmsd, vdev, version_id);
-+ ret = vmstate_load_state(f, vdc->vmsd, vdev, version_id, &local_err);
- if (ret) {
-+ error_report_err(local_err);
- return ret;
- }
- }
-
- /* Subsections */
-- ret = vmstate_load_state(f, &vmstate_virtio, vdev, 1);
-+ ret = vmstate_load_state(f, &vmstate_virtio, vdev, 1, &local_err);
- if (ret) {
-+ error_report_err(local_err);
- return ret;
- }
-
-diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
-index ef2f0c5c93..b9a41cc38a 100644
---- a/include/migration/vmstate.h
-+++ b/include/migration/vmstate.h
-@@ -1206,7 +1206,7 @@ extern const VMStateInfo vmstate_info_qlist;
- }
-
- int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
-- void *opaque, int version_id);
-+ void *opaque, int version_id, Error **errp);
- int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
- void *opaque, JSONWriter *vmdesc);
- int vmstate_save_state_with_err(QEMUFile *f, const VMStateDescription *vmsd,
-diff --git a/migration/cpr.c b/migration/cpr.c
-index 42ad0b0d50..8abb6db76d 100644
---- a/migration/cpr.c
-+++ b/migration/cpr.c
-@@ -233,9 +233,8 @@ int cpr_state_load(MigrationChannel *channel, Error **errp)
- return -ENOTSUP;
- }
-
-- ret = vmstate_load_state(f, &vmstate_cpr_state, &cpr_state, 1);
-+ ret = vmstate_load_state(f, &vmstate_cpr_state, &cpr_state, 1, errp);
- if (ret) {
-- error_setg(errp, "vmstate_load_state error %d", ret);
- qemu_fclose(f);
- return ret;
- }
-diff --git a/migration/savevm.c b/migration/savevm.c
-index fabbeb296a..f5a1ab9101 100644
---- a/migration/savevm.c
-+++ b/migration/savevm.c
-@@ -969,7 +969,8 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry *se)
- if (!se->vmsd) { /* Old style */
- return se->ops->load_state(f, se->opaque, se->load_version_id);
- }
-- return vmstate_load_state(f, se->vmsd, se->opaque, se->load_version_id);
-+ return vmstate_load_state(f, se->vmsd, se->opaque, se->load_version_id,
-+ &error_fatal);
- }
-
- static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se,
-@@ -2817,6 +2818,7 @@ static int qemu_loadvm_state_header(QEMUFile *f)
- {
- unsigned int v;
- int ret;
-+ Error *local_err = NULL;
-
- v = qemu_get_be32(f);
- if (v != QEMU_VM_FILE_MAGIC) {
-@@ -2839,9 +2841,11 @@ static int qemu_loadvm_state_header(QEMUFile *f)
- error_report("Configuration section missing");
- return -EINVAL;
- }
-- ret = vmstate_load_state(f, &vmstate_configuration, &savevm_state, 0);
-+ ret = vmstate_load_state(f, &vmstate_configuration, &savevm_state, 0,
-+ &local_err);
-
- if (ret) {
-+ error_report_err(local_err);
- return ret;
- }
- }
-diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
-index 741a588b7e..c5cfd861e3 100644
---- a/migration/vmstate-types.c
-+++ b/migration/vmstate-types.c
-@@ -19,6 +19,7 @@
- #include "qemu/error-report.h"
- #include "qemu/queue.h"
- #include "trace.h"
-+#include "qapi/error.h"
-
- /* bool */
-
-@@ -543,13 +544,17 @@ static int get_tmp(QEMUFile *f, void *pv, size_t size,
- const VMStateField *field)
- {
- int ret;
-+ Error *local_err = NULL;
- const VMStateDescription *vmsd = field->vmsd;
- int version_id = field->version_id;
- void *tmp = g_malloc(size);
-
- /* Writes the parent field which is at the start of the tmp */
- *(void **)tmp = pv;
-- ret = vmstate_load_state(f, vmsd, tmp, version_id);
-+ ret = vmstate_load_state(f, vmsd, tmp, version_id, &local_err);
-+ if (ret < 0) {
-+ error_report_err(local_err);
-+ }
- g_free(tmp);
- return ret;
- }
-@@ -626,6 +631,7 @@ static int get_qtailq(QEMUFile *f, void *pv, size_t unused_size,
- const VMStateField *field)
- {
- int ret = 0;
-+ Error *local_err = NULL;
- const VMStateDescription *vmsd = field->vmsd;
- /* size of a QTAILQ element */
- size_t size = field->size;
-@@ -649,8 +655,9 @@ static int get_qtailq(QEMUFile *f, void *pv, size_t unused_size,
-
- while (qemu_get_byte(f)) {
- elm = g_malloc(size);
-- ret = vmstate_load_state(f, vmsd, elm, version_id);
-+ ret = vmstate_load_state(f, vmsd, elm, version_id, &local_err);
- if (ret) {
-+ error_report_err(local_err);
- return ret;
- }
- QTAILQ_RAW_INSERT_TAIL(pv, elm, entry_offset);
-@@ -772,6 +779,7 @@ static int get_gtree(QEMUFile *f, void *pv, size_t unused_size,
- GTree *tree = *pval;
- void *key, *val;
- int ret = 0;
-+ Error *local_err = NULL;
-
- /* in case of direct key, the key vmsd can be {}, ie. check fields */
- if (!direct_key && version_id > key_vmsd->version_id) {
-@@ -803,18 +811,16 @@ static int get_gtree(QEMUFile *f, void *pv, size_t unused_size,
- key = (void *)(uintptr_t)qemu_get_be64(f);
- } else {
- key = g_malloc0(key_size);
-- ret = vmstate_load_state(f, key_vmsd, key, version_id);
-+ ret = vmstate_load_state(f, key_vmsd, key, version_id, &local_err);
- if (ret) {
-- error_report("%s : failed to load %s (%d)",
-- field->name, key_vmsd->name, ret);
-+ error_report_err(local_err);
- goto key_error;
- }
- }
- val = g_malloc0(val_size);
-- ret = vmstate_load_state(f, val_vmsd, val, version_id);
-+ ret = vmstate_load_state(f, val_vmsd, val, version_id, &local_err);
- if (ret) {
-- error_report("%s : failed to load %s (%d)",
-- field->name, val_vmsd->name, ret);
-+ error_report_err(local_err);
- goto val_error;
- }
- g_tree_insert(tree, key, val);
-@@ -872,6 +878,7 @@ static int get_qlist(QEMUFile *f, void *pv, size_t unused_size,
- const VMStateField *field)
- {
- int ret = 0;
-+ Error *local_err = NULL;
- const VMStateDescription *vmsd = field->vmsd;
- /* size of a QLIST element */
- size_t size = field->size;
-@@ -892,10 +899,9 @@ static int get_qlist(QEMUFile *f, void *pv, size_t unused_size,
-
- while (qemu_get_byte(f)) {
- elm = g_malloc(size);
-- ret = vmstate_load_state(f, vmsd, elm, version_id);
-+ ret = vmstate_load_state(f, vmsd, elm, version_id, &local_err);
- if (ret) {
-- error_report("%s: failed to load %s (%d)", field->name,
-- vmsd->name, ret);
-+ error_report_err(local_err);
- g_free(elm);
- return ret;
- }
-diff --git a/migration/vmstate.c b/migration/vmstate.c
-index 08f2b562e3..8d1e9eb62b 100644
---- a/migration/vmstate.c
-+++ b/migration/vmstate.c
-@@ -132,30 +132,33 @@ static void vmstate_handle_alloc(void *ptr, const VMStateField *field,
- }
-
- int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
-- void *opaque, int version_id)
-+ void *opaque, int version_id, Error **errp)
- {
- const VMStateField *field = vmsd->fields;
- int ret = 0;
-- Error *local_err = NULL;
-
- trace_vmstate_load_state(vmsd->name, version_id);
- if (version_id > vmsd->version_id) {
-- error_report("%s: incoming version_id %d is too new "
-- "for local version_id %d",
-- vmsd->name, version_id, vmsd->version_id);
-+ error_setg(errp, "%s: incoming version_id %d is too new "
-+ "for local version_id %d",
-+ vmsd->name, version_id, vmsd->version_id);
- trace_vmstate_load_state_end(vmsd->name, "too new", -EINVAL);
- return -EINVAL;
- }
- if (version_id < vmsd->minimum_version_id) {
-- error_report("%s: incoming version_id %d is too old "
-- "for local minimum version_id %d",
-- vmsd->name, version_id, vmsd->minimum_version_id);
-+ error_setg(errp, "%s: incoming version_id %d is too old "
-+ "for local minimum version_id %d",
-+ vmsd->name, version_id, vmsd->minimum_version_id);
- trace_vmstate_load_state_end(vmsd->name, "too old", -EINVAL);
- return -EINVAL;
- }
- if (vmsd->pre_load) {
- ret = vmsd->pre_load(opaque);
- if (ret) {
-+ error_setg(errp, "pre load hook failed for: '%s', "
-+ "version_id: %d, minimum version_id: %d, ret: %d",
-+ vmsd->name, vmsd->version_id, vmsd->minimum_version_id,
-+ ret);
- return ret;
- }
- }
-@@ -193,13 +196,21 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
-
- if (inner_field->flags & VMS_STRUCT) {
- ret = vmstate_load_state(f, inner_field->vmsd, curr_elem,
-- inner_field->vmsd->version_id);
-+ inner_field->vmsd->version_id,
-+ errp);
- } else if (inner_field->flags & VMS_VSTRUCT) {
- ret = vmstate_load_state(f, inner_field->vmsd, curr_elem,
-- inner_field->struct_version_id);
-+ inner_field->struct_version_id,
-+ errp);
- } else {
- ret = inner_field->info->get(f, curr_elem, size,
- inner_field);
-+ if (ret < 0) {
-+ error_setg(errp,
-+ "Failed to load element of type %s for %s: "
-+ "%d", inner_field->info->name,
-+ inner_field->name, ret);
-+ }
- }
-
- /* If we used a fake temp field.. free it now */
-@@ -209,31 +220,40 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
-
- if (ret >= 0) {
- ret = qemu_file_get_error(f);
-+ if (ret < 0) {
-+ error_setg(errp,
-+ "Failed to load %s state: stream error: %d",
-+ vmsd->name, ret);
-+ }
- }
- if (ret < 0) {
- qemu_file_set_error(f, ret);
-- error_report("Failed to load %s:%s", vmsd->name,
-- field->name);
- trace_vmstate_load_field_error(field->name, ret);
- return ret;
- }
- }
- } else if (field->flags & VMS_MUST_EXIST) {
-- error_report("Input validation failed: %s/%s",
-- vmsd->name, field->name);
-+ error_setg(errp, "Input validation failed: %s/%s version_id: %d",
-+ vmsd->name, field->name, vmsd->version_id);
- return -1;
- }
- field++;
- }
- assert(field->flags == VMS_END);
-- ret = vmstate_subsection_load(f, vmsd, opaque, &local_err);
-+ ret = vmstate_subsection_load(f, vmsd, opaque, errp);
- if (ret != 0) {
- qemu_file_set_error(f, ret);
-- error_report_err(local_err);
- return ret;
- }
- if (vmsd->post_load) {
- ret = vmsd->post_load(opaque, version_id);
-+ if (ret < 0) {
-+ error_setg(errp,
-+ "post load hook failed for: %s, version_id: %d, "
-+ "minimum_version: %d, ret: %d",
-+ vmsd->name, vmsd->version_id, vmsd->minimum_version_id,
-+ ret);
-+ }
- }
- trace_vmstate_load_state_end(vmsd->name, "end", ret);
- return ret;
-@@ -570,6 +590,7 @@ vmstate_get_subsection(const VMStateDescription * const *sub,
- static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
- void *opaque, Error **errp)
- {
-+ ERRP_GUARD();
- trace_vmstate_subsection_load(vmsd->name);
-
- while (qemu_peek_byte(f, 0) == QEMU_VM_SUBSECTION) {
-@@ -609,12 +630,12 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
- qemu_file_skip(f, len); /* idstr */
- version_id = qemu_get_be32(f);
-
-- ret = vmstate_load_state(f, sub_vmsd, opaque, version_id);
-+ ret = vmstate_load_state(f, sub_vmsd, opaque, version_id, errp);
- if (ret) {
- trace_vmstate_subsection_load_bad(vmsd->name, idstr, "(child)");
-- error_setg(errp,
-- "Loading VM subsection '%s' in '%s' failed: %d",
-- idstr, vmsd->name, ret);
-+ error_prepend(errp,
-+ "Loading VM subsection '%s' in '%s' failed: %d: ",
-+ idstr, vmsd->name, ret);
- return ret;
- }
- }
-diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c
-index 63f28f26f4..4ff0ab632f 100644
---- a/tests/unit/test-vmstate.c
-+++ b/tests/unit/test-vmstate.c
-@@ -30,6 +30,7 @@
- #include "../migration/savevm.h"
- #include "qemu/module.h"
- #include "io/channel-file.h"
-+#include "qapi/error.h"
-
- static int temp_fd;
-
-@@ -108,14 +109,16 @@ static int load_vmstate_one(const VMStateDescription *desc, void *obj,
- {
- QEMUFile *f;
- int ret;
-+ Error *local_err = NULL;
-
- f = open_test_file(true);
- qemu_put_buffer(f, wire, size);
- qemu_fclose(f);
-
- f = open_test_file(false);
-- ret = vmstate_load_state(f, desc, obj, version);
-+ ret = vmstate_load_state(f, desc, obj, version, &local_err);
- if (ret) {
-+ error_report_err(local_err);
- g_assert(qemu_file_get_error(f));
- } else{
- g_assert(!qemu_file_get_error(f));
-@@ -355,6 +358,8 @@ static const VMStateDescription vmstate_versioned = {
-
- static void test_load_v1(void)
- {
-+ Error *local_err = NULL;
-+ int ret;
- uint8_t buf[] = {
- 0, 0, 0, 10, /* a */
- 0, 0, 0, 30, /* c */
-@@ -365,7 +370,10 @@ static void test_load_v1(void)
-
- QEMUFile *loading = open_test_file(false);
- TestStruct obj = { .b = 200, .e = 500, .f = 600 };
-- vmstate_load_state(loading, &vmstate_versioned, &obj, 1);
-+ ret = vmstate_load_state(loading, &vmstate_versioned, &obj, 1, &local_err);
-+ if (ret < 0) {
-+ error_report_err(local_err);
-+ }
- g_assert(!qemu_file_get_error(loading));
- g_assert_cmpint(obj.a, ==, 10);
- g_assert_cmpint(obj.b, ==, 200);
-@@ -378,6 +386,8 @@ static void test_load_v1(void)
-
- static void test_load_v2(void)
- {
-+ Error *local_err = NULL;
-+ int ret;
- uint8_t buf[] = {
- 0, 0, 0, 10, /* a */
- 0, 0, 0, 20, /* b */
-@@ -391,7 +401,10 @@ static void test_load_v2(void)
-
- QEMUFile *loading = open_test_file(false);
- TestStruct obj;
-- vmstate_load_state(loading, &vmstate_versioned, &obj, 2);
-+ ret = vmstate_load_state(loading, &vmstate_versioned, &obj, 2, &local_err);
-+ if (ret < 0) {
-+ error_report_err(local_err);
-+ }
- g_assert_cmpint(obj.a, ==, 10);
- g_assert_cmpint(obj.b, ==, 20);
- g_assert_cmpint(obj.c, ==, 30);
-@@ -467,6 +480,8 @@ static void test_save_skip(void)
-
- static void test_load_noskip(void)
- {
-+ Error *local_err = NULL;
-+ int ret;
- uint8_t buf[] = {
- 0, 0, 0, 10, /* a */
- 0, 0, 0, 20, /* b */
-@@ -480,7 +495,10 @@ static void test_load_noskip(void)
-
- QEMUFile *loading = open_test_file(false);
- TestStruct obj = { .skip_c_e = false };
-- vmstate_load_state(loading, &vmstate_skipping, &obj, 2);
-+ ret = vmstate_load_state(loading, &vmstate_skipping, &obj, 2, &local_err);
-+ if (ret < 0) {
-+ error_report_err(local_err);
-+ }
- g_assert(!qemu_file_get_error(loading));
- g_assert_cmpint(obj.a, ==, 10);
- g_assert_cmpint(obj.b, ==, 20);
-@@ -493,6 +511,8 @@ static void test_load_noskip(void)
-
- static void test_load_skip(void)
- {
-+ Error *local_err = NULL;
-+ int ret;
- uint8_t buf[] = {
- 0, 0, 0, 10, /* a */
- 0, 0, 0, 20, /* b */
-@@ -504,7 +524,10 @@ static void test_load_skip(void)
-
- QEMUFile *loading = open_test_file(false);
- TestStruct obj = { .skip_c_e = true, .c = 300, .e = 500 };
-- vmstate_load_state(loading, &vmstate_skipping, &obj, 2);
-+ ret = vmstate_load_state(loading, &vmstate_skipping, &obj, 2, &local_err);
-+ if (ret < 0) {
-+ error_report_err(local_err);
-+ }
- g_assert(!qemu_file_get_error(loading));
- g_assert_cmpint(obj.a, ==, 10);
- g_assert_cmpint(obj.b, ==, 20);
-@@ -744,6 +767,8 @@ static void test_save_q(void)
-
- static void test_load_q(void)
- {
-+ int ret;
-+ Error *local_err = NULL;
- TestQtailq obj_q = {
- .i16 = -512,
- .i32 = 70000,
-@@ -773,7 +798,10 @@ static void test_load_q(void)
- TestQtailq tgt;
-
- QTAILQ_INIT(&tgt.q);
-- vmstate_load_state(fload, &vmstate_q, &tgt, 1);
-+ ret = vmstate_load_state(fload, &vmstate_q, &tgt, 1, &local_err);
-+ if (ret < 0) {
-+ error_report_err(local_err);
-+ }
- char eof = qemu_get_byte(fload);
- g_assert(!qemu_file_get_error(fload));
- g_assert_cmpint(tgt.i16, ==, obj_q.i16);
-@@ -1115,6 +1143,8 @@ static void diff_iommu(TestGTreeIOMMU *iommu1, TestGTreeIOMMU *iommu2)
-
- static void test_gtree_load_domain(void)
- {
-+ Error *local_err = NULL;
-+ int ret;
- TestGTreeDomain *dest_domain = g_new0(TestGTreeDomain, 1);
- TestGTreeDomain *orig_domain = create_first_domain();
- QEMUFile *fload, *fsave;
-@@ -1127,7 +1157,11 @@ static void test_gtree_load_domain(void)
-
- fload = open_test_file(false);
-
-- vmstate_load_state(fload, &vmstate_domain, dest_domain, 1);
-+ ret = vmstate_load_state(fload, &vmstate_domain, dest_domain, 1,
-+ &local_err);
-+ if (ret < 0) {
-+ error_report_err(local_err);
-+ }
- eof = qemu_get_byte(fload);
- g_assert(!qemu_file_get_error(fload));
- g_assert_cmpint(orig_domain->id, ==, dest_domain->id);
-@@ -1230,6 +1264,8 @@ static void test_gtree_save_iommu(void)
-
- static void test_gtree_load_iommu(void)
- {
-+ Error *local_err = NULL;
-+ int ret;
- TestGTreeIOMMU *dest_iommu = g_new0(TestGTreeIOMMU, 1);
- TestGTreeIOMMU *orig_iommu = create_iommu();
- QEMUFile *fsave, *fload;
-@@ -1241,7 +1277,10 @@ static void test_gtree_load_iommu(void)
- qemu_fclose(fsave);
-
- fload = open_test_file(false);
-- vmstate_load_state(fload, &vmstate_iommu, dest_iommu, 1);
-+ ret = vmstate_load_state(fload, &vmstate_iommu, dest_iommu, 1, &local_err);
-+ if (ret < 0) {
-+ error_report_err(local_err);
-+ }
- eof = qemu_get_byte(fload);
- g_assert(!qemu_file_get_error(fload));
- g_assert_cmpint(orig_iommu->id, ==, dest_iommu->id);
-@@ -1363,6 +1402,8 @@ static void test_save_qlist(void)
-
- static void test_load_qlist(void)
- {
-+ Error *local_err = NULL;
-+ int ret;
- QEMUFile *fsave, *fload;
- TestQListContainer *orig_container = alloc_container();
- TestQListContainer *dest_container = g_new0(TestQListContainer, 1);
-@@ -1376,7 +1417,11 @@ static void test_load_qlist(void)
- qemu_fclose(fsave);
-
- fload = open_test_file(false);
-- vmstate_load_state(fload, &vmstate_container, dest_container, 1);
-+ ret = vmstate_load_state(fload, &vmstate_container, dest_container, 1,
-+ &local_err);
-+ if (ret < 0) {
-+ error_report_err(local_err);
-+ }
- eof = qemu_get_byte(fload);
- g_assert(!qemu_file_get_error(fload));
- g_assert_cmpint(eof, ==, QEMU_VM_EOF);
-diff --git a/ui/vdagent.c b/ui/vdagent.c
-index c0746fe5b1..bc3c77f013 100644
---- a/ui/vdagent.c
-+++ b/ui/vdagent.c
-@@ -1001,6 +1001,7 @@ static int get_cbinfo(QEMUFile *f, void *pv, size_t size,
- VDAgentChardev *vd = QEMU_VDAGENT_CHARDEV(pv);
- struct CBInfoArray cbinfo = {};
- int i, ret;
-+ Error *local_err = NULL;
-
- if (!have_clipboard(vd)) {
- return 0;
-@@ -1008,8 +1009,10 @@ static int get_cbinfo(QEMUFile *f, void *pv, size_t size,
-
- vdagent_clipboard_peer_register(vd);
-
-- ret = vmstate_load_state(f, &vmstate_cbinfo_array, &cbinfo, 0);
-+ ret = vmstate_load_state(f, &vmstate_cbinfo_array, &cbinfo, 0,
-+ &local_err);
- if (ret) {
-+ error_report_err(local_err);
- return ret;
- }
-
---
-2.52.0
-
diff --git a/kvm-migration-push-Error-errp-into-vmstate_subsection_lo.patch b/kvm-migration-push-Error-errp-into-vmstate_subsection_lo.patch
deleted file mode 100644
index dc85919..0000000
--- a/kvm-migration-push-Error-errp-into-vmstate_subsection_lo.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From e11e10cd73c27ae4cc1589846dd3b04f6e99c842 Mon Sep 17 00:00:00 2001
-From: Arun Menon <armenon@redhat.com>
-Date: Thu, 18 Sep 2025 20:53:18 +0530
-Subject: [PATCH 085/116] migration: push Error **errp into
- vmstate_subsection_load()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [69/100] 59881451411ab7db67f43a53706e5bb6c861eef1 (rovick1/qemu-kvm)
-
-This is an incremental step in converting vmstate loading
-code to report error via Error objects instead of directly
-printing it to console/monitor.
-It is ensured that vmstate_subsection_load() must report an error
-in errp, in case of failure.
-
-The errors are temporarily reported using error_report_err().
-This is removed in the subsequent patches in this series,
-when we are actually able to propagate the error to the calling
-function using errp.
-
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Reviewed-by: Fabiano Rosas <farosas@suse.de>
-Signed-off-by: Arun Menon <armenon@redhat.com>
-Tested-by: Fabiano Rosas <farosas@suse.de>
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Link: https://lore.kernel.org/r/20250918-propagate_tpm_error-v14-1-36f11a6fb9d3@redhat.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
-(cherry picked from commit 73b42fc58d035cb2fcfe90083d6b33aeb4fa1b2a)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- migration/vmstate.c | 13 ++++++++++---
- 1 file changed, 10 insertions(+), 3 deletions(-)
-
-diff --git a/migration/vmstate.c b/migration/vmstate.c
-index 5feaa3244d..08f2b562e3 100644
---- a/migration/vmstate.c
-+++ b/migration/vmstate.c
-@@ -25,7 +25,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
- void *opaque, JSONWriter *vmdesc,
- Error **errp);
- static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
-- void *opaque);
-+ void *opaque, Error **errp);
-
- /* Whether this field should exist for either save or load the VM? */
- static bool
-@@ -136,6 +136,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
- {
- const VMStateField *field = vmsd->fields;
- int ret = 0;
-+ Error *local_err = NULL;
-
- trace_vmstate_load_state(vmsd->name, version_id);
- if (version_id > vmsd->version_id) {
-@@ -225,9 +226,10 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
- field++;
- }
- assert(field->flags == VMS_END);
-- ret = vmstate_subsection_load(f, vmsd, opaque);
-+ ret = vmstate_subsection_load(f, vmsd, opaque, &local_err);
- if (ret != 0) {
- qemu_file_set_error(f, ret);
-+ error_report_err(local_err);
- return ret;
- }
- if (vmsd->post_load) {
-@@ -566,7 +568,7 @@ vmstate_get_subsection(const VMStateDescription * const *sub,
- }
-
- static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
-- void *opaque)
-+ void *opaque, Error **errp)
- {
- trace_vmstate_subsection_load(vmsd->name);
-
-@@ -598,6 +600,8 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
- sub_vmsd = vmstate_get_subsection(vmsd->subsections, idstr);
- if (sub_vmsd == NULL) {
- trace_vmstate_subsection_load_bad(vmsd->name, idstr, "(lookup)");
-+ error_setg(errp, "VM subsection '%s' in '%s' does not exist",
-+ idstr, vmsd->name);
- return -ENOENT;
- }
- qemu_file_skip(f, 1); /* subsection */
-@@ -608,6 +612,9 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
- ret = vmstate_load_state(f, sub_vmsd, opaque, version_id);
- if (ret) {
- trace_vmstate_subsection_load_bad(vmsd->name, idstr, "(child)");
-+ error_setg(errp,
-+ "Loading VM subsection '%s' in '%s' failed: %d",
-+ idstr, vmsd->name, ret);
- return ret;
- }
- }
---
-2.52.0
-
diff --git a/kvm-migration-set-correct-list-pointer-when-removing-not.patch b/kvm-migration-set-correct-list-pointer-when-removing-not.patch
deleted file mode 100644
index 9423341..0000000
--- a/kvm-migration-set-correct-list-pointer-when-removing-not.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 780adf4b83ffd4d5280eb7e6602b511195d3d529 Mon Sep 17 00:00:00 2001
-From: Matthew Rosato <mjrosato@linux.ibm.com>
-Date: Thu, 13 Nov 2025 16:35:45 -0500
-Subject: [PATCH 106/116] migration: set correct list pointer when removing
- notifier
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [90/100] 0ab246e3e8922fa6b6eb66ae15b6a861c8b8055c (rovick1/qemu-kvm)
-
-In migration_remove_notifier(), g_slist_remove() will search for and
-potentially remove an entry from the specified list. The return value
-should be used to update the potentially-changed head pointer of the
-list that was just searched (migration_state_notifiers[mode]) instead
-of the migration blockers list.
-
-Fixes: dc79c7d5e1 ("migration: multi-mode notifier")
-Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/r/20251113213545.513453-1-mjrosato@linux.ibm.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
-(cherry picked from commit 911bdd34ca1a3f9e62836e7bc581e7edc57319be)
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
----
- migration/migration.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/migration/migration.c b/migration/migration.c
-index 2515bec48f..0233b25f86 100644
---- a/migration/migration.c
-+++ b/migration/migration.c
-@@ -1704,7 +1704,7 @@ void migration_remove_notifier(NotifierWithReturn *notify)
- {
- if (notify->notify) {
- for (MigMode mode = 0; mode < MIG_MODE__MAX; mode++) {
-- migration_blockers[mode] =
-+ migration_state_notifiers[mode] =
- g_slist_remove(migration_state_notifiers[mode], notify);
- }
- notify->notify = NULL;
---
-2.52.0
-
diff --git a/kvm-mirror-Fix-missed-dirty-bitmap-writes-during-startup.patch b/kvm-mirror-Fix-missed-dirty-bitmap-writes-during-startup.patch
deleted file mode 100644
index 9adf132..0000000
--- a/kvm-mirror-Fix-missed-dirty-bitmap-writes-during-startup.patch
+++ /dev/null
@@ -1,162 +0,0 @@
-From 19a86e8f7e88b47ac40014cd716146f0754939c2 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Thu, 19 Feb 2026 21:24:46 +0100
-Subject: [PATCH] mirror: Fix missed dirty bitmap writes during startup
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 474: mirror: Fix missed dirty bitmap writes during startup
-RH-Jira: RHEL-155601
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Commit: [1/1] a888c4b2085d5fc3639bf6721f1f4e974db65dba (kmwolf/centos-qemu-kvm)
-
-Currently, mirror disables the block layer's dirty bitmap before its own
-replacement is working. This means that during startup, there is a
-window in which the allocation status of blocks in the source has
-already been checked, but new writes coming in aren't tracked yet,
-resulting in a corrupted copy:
-
-1. Dirty bitmap is disabled in mirror_start_job()
-2. Some request are started in mirror_top_bs while s->job == NULL
-3. mirror_dirty_init() -> bdrv_co_is_allocated_above() runs and because
- the request hasn't completed yet, the block isn't allocated
-4. The request completes, still sees s->job == NULL and skips the
- bitmap, and nothing else will mark it dirty either
-
-One ingredient is that mirror_top_opaque->job is only set after the
-job is fully initialized. For the rationale, see commit 32125b1460
-("mirror: Fix access of uninitialised fields during start").
-
-Fix this by giving mirror_top_bs access to dirty_bitmap and enabling it
-to track writes from the beginning. Disabling the block layer's tracking
-and enabling the mirror_top_bs one happens in a drained section, so
-there is no danger of races with in-flight requests any more. All of
-this happens well before the block allocation status is checked, so we
-can be sure that no writes will be missed.
-
-Cc: qemu-stable@nongnu.org
-Closes: https://gitlab.com/qemu-project/qemu/-/issues/3273
-Fixes: 32125b14606a ('mirror: Fix access of uninitialised fields during start')
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260219202446.312493-1-kwolf@redhat.com>
-Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
-Tested-by: Jean-Louis Dupond <jean-louis@dupond.be>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 0f51f9c3420b31bb383e456dd7bf24d3056eeb73)
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/mirror.c | 52 +++++++++++++++++++++++++++++++-------------------
- 1 file changed, 32 insertions(+), 20 deletions(-)
-
-diff --git a/block/mirror.c b/block/mirror.c
-index b344182c74..f01be99b55 100644
---- a/block/mirror.c
-+++ b/block/mirror.c
-@@ -99,6 +99,7 @@ typedef struct MirrorBlockJob {
-
- typedef struct MirrorBDSOpaque {
- MirrorBlockJob *job;
-+ BdrvDirtyBitmap *dirty_bitmap;
- bool stop;
- bool is_commit;
- } MirrorBDSOpaque;
-@@ -1672,9 +1673,11 @@ bdrv_mirror_top_do_write(BlockDriverState *bs, MirrorMethod method,
- abort();
- }
-
-- if (!copy_to_target && s->job && s->job->dirty_bitmap) {
-- qatomic_set(&s->job->actively_synced, false);
-- bdrv_set_dirty_bitmap(s->job->dirty_bitmap, offset, bytes);
-+ if (!copy_to_target) {
-+ if (s->job) {
-+ qatomic_set(&s->job->actively_synced, false);
-+ }
-+ bdrv_set_dirty_bitmap(s->dirty_bitmap, offset, bytes);
- }
-
- if (ret < 0) {
-@@ -1901,13 +1904,35 @@ static BlockJob *mirror_start_job(
-
- bdrv_drained_begin(bs);
- ret = bdrv_append(mirror_top_bs, bs, errp);
-- bdrv_drained_end(bs);
--
- if (ret < 0) {
-+ bdrv_drained_end(bs);
-+ bdrv_unref(mirror_top_bs);
-+ return NULL;
-+ }
-+
-+ bs_opaque->dirty_bitmap = bdrv_create_dirty_bitmap(mirror_top_bs,
-+ granularity,
-+ NULL, errp);
-+ if (!bs_opaque->dirty_bitmap) {
-+ bdrv_drained_end(bs);
- bdrv_unref(mirror_top_bs);
- return NULL;
- }
-
-+ /*
-+ * The mirror job doesn't use the block layer's dirty tracking because it
-+ * needs to be able to switch seemlessly between background copy mode (which
-+ * does need dirty tracking) and write blocking mode (which doesn't) and
-+ * doing that would require draining the node. Instead, mirror_top_bs takes
-+ * care of updating the dirty bitmap as appropriate.
-+ *
-+ * Note that write blocking mode only becomes effective after mirror_run()
-+ * sets mirror_top_opaque->job (see should_copy_to_target()). Until then,
-+ * we're still in background copy mode irrespective of @copy_mode.
-+ */
-+ bdrv_disable_dirty_bitmap(bs_opaque->dirty_bitmap);
-+ bdrv_drained_end(bs);
-+
- /* Make sure that the source is not resized while the job is running */
- s = block_job_create(job_id, driver, NULL, mirror_top_bs,
- BLK_PERM_CONSISTENT_READ,
-@@ -2002,24 +2027,13 @@ static BlockJob *mirror_start_job(
- s->base_overlay = bdrv_find_overlay(bs, base);
- s->granularity = granularity;
- s->buf_size = ROUND_UP(buf_size, granularity);
-+ s->dirty_bitmap = bs_opaque->dirty_bitmap;
- s->unmap = unmap;
- if (auto_complete) {
- s->should_complete = true;
- }
- bdrv_graph_rdunlock_main_loop();
-
-- s->dirty_bitmap = bdrv_create_dirty_bitmap(s->mirror_top_bs, granularity,
-- NULL, errp);
-- if (!s->dirty_bitmap) {
-- goto fail;
-- }
--
-- /*
-- * The dirty bitmap is set by bdrv_mirror_top_do_write() when not in active
-- * mode.
-- */
-- bdrv_disable_dirty_bitmap(s->dirty_bitmap);
--
- bdrv_graph_wrlock_drained();
- ret = block_job_add_bdrv(&s->common, "source", bs, 0,
- BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE |
-@@ -2099,9 +2113,6 @@ fail:
- g_free(s->replaces);
- blk_unref(s->target);
- bs_opaque->job = NULL;
-- if (s->dirty_bitmap) {
-- bdrv_release_dirty_bitmap(s->dirty_bitmap);
-- }
- job_early_fail(&s->common.job);
- }
-
-@@ -2115,6 +2126,7 @@ fail:
- bdrv_graph_wrunlock();
- bdrv_drained_end(bs);
-
-+ bdrv_release_dirty_bitmap(bs_opaque->dirty_bitmap);
- bdrv_unref(mirror_top_bs);
-
- return NULL;
---
-2.47.3
-
diff --git a/kvm-monitor-generalize-query-mshv-info-mshv-to-query-acc.patch b/kvm-monitor-generalize-query-mshv-info-mshv-to-query-acc.patch
deleted file mode 100644
index 3f8cbf7..0000000
--- a/kvm-monitor-generalize-query-mshv-info-mshv-to-query-acc.patch
+++ /dev/null
@@ -1,235 +0,0 @@
-From afb70cb5eea1e9dad7b5414713d2394ef2c88329 Mon Sep 17 00:00:00 2001
-From: Paolo Bonzini <pbonzini@redhat.com>
-Date: Mon, 13 Oct 2025 12:49:04 +0200
-Subject: [PATCH 1/6] monitor: generalize query-mshv/"info mshv" to
- query-accelerators/"info accelerators"
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 443: [REHL10.2] L1HV: monitor: generalize query-mshv/"info mshv" to query-accelerators/"info accelerators"
-RH-Jira: RHEL-134212
-RH-Acked-by: MST <mst@redhat.com>
-RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
-RH-Commit: [1/1] af946c572c3dab34cee6399bf4438e2722dd7e44 (imammedo/qemu-kvm-cs)
-
-The recently-introduced query-mshv command is a duplicate of query-kvm,
-and neither provides a full view of which accelerators are supported
-by a particular binary of QEMU and which is in use.
-
-KVM was the first accelerator added to QEMU, predating QOM and TYPE_ACCEL,
-so it got a pass. But now, instead of adding a badly designed copy, solve
-the problem completely for all accelerators with a command that provides
-the whole picture:
-
- >> {"execute": "query-accelerators"}
- << {"return": {"enabled": "tcg", "present": ["kvm", "mshv", "qtest", "tcg", "xen"]}}
-
-Cc: Praveen K Paladugu <prapal@microsoft.com>
-Cc: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Suggested-by: Markus Armbruster <armbru@redhat.com>
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 71d5babbd6fffc7def1ecbf29f9753e3a2807761)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- hmp-commands-info.hx | 15 ++++++++----
- hw/core/machine-hmp-cmds.c | 23 +++++++++++--------
- hw/core/machine-qmp-cmds.c | 24 +++++++++++++------
- include/monitor/hmp.h | 2 +-
- qapi/accelerator.json | 47 +++++++++++++++++++++++++++++---------
- 5 files changed, 77 insertions(+), 34 deletions(-)
-
-diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
-index eaaa880c1b..3ed636e4e8 100644
---- a/hmp-commands-info.hx
-+++ b/hmp-commands-info.hx
-@@ -308,16 +308,21 @@ SRST
- ERST
-
- {
-- .name = "mshv",
-+ .name = "accelerators",
- .args_type = "",
- .params = "",
-- .help = "show MSHV information",
-- .cmd = hmp_info_mshv,
-+ .help = "show present and enabled information",
-+ .cmd = hmp_info_accelerators,
- },
-
- SRST
-- ``info mshv``
-- Show MSHV information.
-+ ``info accelerators``
-+ Show which accelerators are compiled into a QEMU binary, and what accelerator
-+ is in use. For example::
-+
-+ kvm qtest [tcg]
-+
-+ indicates that TCG in use, and that KVM and qtest are also available.
- ERST
-
- {
-diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
-index 682ed9f49b..74a56600be 100644
---- a/hw/core/machine-hmp-cmds.c
-+++ b/hw/core/machine-hmp-cmds.c
-@@ -163,19 +163,22 @@ void hmp_info_kvm(Monitor *mon, const QDict *qdict)
- qapi_free_KvmInfo(info);
- }
-
--void hmp_info_mshv(Monitor *mon, const QDict *qdict)
-+void hmp_info_accelerators(Monitor *mon, const QDict *qdict)
- {
-- MshvInfo *info;
--
-- info = qmp_query_mshv(NULL);
-- monitor_printf(mon, "mshv support: ");
-- if (info->present) {
-- monitor_printf(mon, "%s\n", info->enabled ? "enabled" : "disabled");
-- } else {
-- monitor_printf(mon, "not compiled\n");
-+ AcceleratorInfo *info;
-+ AcceleratorList *accel;
-+
-+ info = qmp_query_accelerators(NULL);
-+ for (accel = info->present; accel; accel = accel->next) {
-+ char trail = accel->next ? ' ' : '\n';
-+ if (info->enabled == accel->value) {
-+ monitor_printf(mon, "[%s]%c", Accelerator_str(accel->value), trail);
-+ } else {
-+ monitor_printf(mon, "%s%c", Accelerator_str(accel->value), trail);
-+ }
- }
-
-- qapi_free_MshvInfo(info);
-+ qapi_free_AcceleratorInfo(info);
- }
-
- void hmp_info_uuid(Monitor *mon, const QDict *qdict)
-diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
-index e24bf0d97b..51d5c230f7 100644
---- a/hw/core/machine-qmp-cmds.c
-+++ b/hw/core/machine-qmp-cmds.c
-@@ -31,15 +31,25 @@
- #include <sys/stat.h>
-
- /*
-- * QMP query for MSHV
-+ * QMP query for enabled and present accelerators
- */
--MshvInfo *qmp_query_mshv(Error **errp)
-+AcceleratorInfo *qmp_query_accelerators(Error **errp)
- {
-- MshvInfo *info = g_malloc0(sizeof(*info));
--
-- info->enabled = mshv_enabled();
-- info->present = accel_find("mshv");
--
-+ AcceleratorInfo *info = g_malloc0(sizeof(*info));
-+ AccelClass *current_class = ACCEL_GET_CLASS(current_accel());
-+ int i;
-+
-+ for (i = ACCELERATOR__MAX; i-- > 0; ) {
-+ const char *s = Accelerator_str(i);
-+ AccelClass *this_class = accel_find(s);
-+
-+ if (this_class) {
-+ QAPI_LIST_PREPEND(info->present, i);
-+ if (this_class == current_class) {
-+ info->enabled = i;
-+ }
-+ }
-+ }
- return info;
- }
-
-diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
-index 31bd812e5f..897dfaa2b6 100644
---- a/include/monitor/hmp.h
-+++ b/include/monitor/hmp.h
-@@ -24,7 +24,7 @@ strList *hmp_split_at_comma(const char *str);
- void hmp_info_name(Monitor *mon, const QDict *qdict);
- void hmp_info_version(Monitor *mon, const QDict *qdict);
- void hmp_info_kvm(Monitor *mon, const QDict *qdict);
--void hmp_info_mshv(Monitor *mon, const QDict *qdict);
-+void hmp_info_accelerators(Monitor *mon, const QDict *qdict);
- void hmp_info_status(Monitor *mon, const QDict *qdict);
- void hmp_info_uuid(Monitor *mon, const QDict *qdict);
- void hmp_info_chardev(Monitor *mon, const QDict *qdict);
-diff --git a/qapi/accelerator.json b/qapi/accelerator.json
-index 664e027246..2b92060884 100644
---- a/qapi/accelerator.json
-+++ b/qapi/accelerator.json
-@@ -56,30 +56,55 @@
- 'features': [ 'unstable' ] }
-
- ##
--# @MshvInfo:
-+# @Accelerator:
- #
- # Information about support for MSHV acceleration
- #
--# @enabled: true if MSHV acceleration is active
-+# @hvf: Apple Hypervisor.framework
- #
--# @present: true if MSHV acceleration is built into this executable
-+# @kvm: KVM
-+#
-+# @mshv: Hyper-V
-+#
-+# @nvmm: NetBSD NVMM
-+#
-+# @qtest: QTest (dummy accelerator)
-+#
-+# @tcg: TCG (dynamic translation)
-+#
-+# @whpx: Windows Hypervisor Platform
-+#
-+# @xen: Xen
-+#
-+# Since: 10.2.0
-+##
-+{ 'enum': 'Accelerator', 'data': ['hvf', 'kvm', 'mshv', 'nvmm', 'qtest', 'tcg', 'whpx', 'xen'] }
-+
-+##
-+# @AcceleratorInfo:
-+#
-+# Information about support for various accelerators
-+#
-+# @enabled: the accelerator that is in use
-+#
-+# @present: the list of accelerators that are built into this executable
- #
- # Since: 10.2.0
- ##
--{ 'struct': 'MshvInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
-+{ 'struct': 'AcceleratorInfo', 'data': {'enabled': 'Accelerator', 'present': ['Accelerator']} }
-
- ##
--# @query-mshv:
-+# @query-accelerators:
- #
--# Return information about MSHV acceleration
-+# Return information about accelerators
- #
--# Returns: @MshvInfo
-+# Returns: @AcceleratorInfo
- #
--# Since: 10.0.92
-+# Since: 10.2.0
- #
- # .. qmp-example::
- #
--# -> { "execute": "query-mshv" }
--# <- { "return": { "enabled": true, "present": true } }
-+# -> { "execute": "query-accelerators" }
-+# <- { "return": { "enabled": "mshv", "present": ["kvm", "mshv", "qtest", "tcg"] } }
- ##
--{ 'command': 'query-mshv', 'returns': 'MshvInfo' }
-+{ 'command': 'query-accelerators', 'returns': 'AcceleratorInfo' }
---
-2.47.3
-
diff --git a/kvm-net-bundle-all-offloads-in-a-single-struct.patch b/kvm-net-bundle-all-offloads-in-a-single-struct.patch
deleted file mode 100644
index 7d62dd7..0000000
--- a/kvm-net-bundle-all-offloads-in-a-single-struct.patch
+++ /dev/null
@@ -1,366 +0,0 @@
-From e98a5779344e632fab5cce16508fb6fbdb847332 Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:15 +0200
-Subject: [PATCH 06/19] net: bundle all offloads in a single struct
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [1/14] 6895db45d4c3490df93d5156a72fa11f706fa5d2 (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-The set_offload() argument list is already pretty long and
-we are going to introduce soon a bunch of additional offloads.
-
-Replace the offload arguments with a single struct and update
-all the relevant call-sites.
-
-No functional changes intended.
-
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <a9d4dd043b8c71b791e9ff05e17ef06072d9714e.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit e5fd02d8253abdc25c0eb145765734890c256b71)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- hw/net/e1000e_core.c | 5 +++--
- hw/net/igb_core.c | 5 +++--
- hw/net/virtio-net.c | 19 +++++++++++--------
- hw/net/vmxnet3.c | 13 +++++--------
- include/net/net.h | 15 ++++++++++++---
- net/net.c | 5 ++---
- net/netmap.c | 3 +--
- net/tap-bsd.c | 3 +--
- net/tap-linux.c | 21 ++++++++++++---------
- net/tap-solaris.c | 4 ++--
- net/tap-stub.c | 3 +--
- net/tap.c | 8 ++++----
- net/tap_int.h | 4 ++--
- 13 files changed, 59 insertions(+), 49 deletions(-)
-
-diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
-index 06657bb3ac..8fef598b49 100644
---- a/hw/net/e1000e_core.c
-+++ b/hw/net/e1000e_core.c
-@@ -2822,8 +2822,9 @@ e1000e_update_rx_offloads(E1000ECore *core)
- trace_e1000e_rx_set_cso(cso_state);
-
- if (core->has_vnet) {
-- qemu_set_offload(qemu_get_queue(core->owner_nic)->peer,
-- cso_state, 0, 0, 0, 0, 0, 0);
-+ NetOffloads ol = { .csum = cso_state };
-+
-+ qemu_set_offload(qemu_get_queue(core->owner_nic)->peer, &ol);
- }
- }
-
-diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c
-index 39e3ce1c8f..45d8fd795b 100644
---- a/hw/net/igb_core.c
-+++ b/hw/net/igb_core.c
-@@ -3058,8 +3058,9 @@ igb_update_rx_offloads(IGBCore *core)
- trace_e1000e_rx_set_cso(cso_state);
-
- if (core->has_vnet) {
-- qemu_set_offload(qemu_get_queue(core->owner_nic)->peer,
-- cso_state, 0, 0, 0, 0, 0, 0);
-+ NetOffloads ol = {.csum = cso_state };
-+
-+ qemu_set_offload(qemu_get_queue(core->owner_nic)->peer, &ol);
- }
- }
-
-diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
-index 6b5b5dace3..b86ba1fd27 100644
---- a/hw/net/virtio-net.c
-+++ b/hw/net/virtio-net.c
-@@ -773,14 +773,17 @@ static uint64_t virtio_net_bad_features(VirtIODevice *vdev)
-
- static void virtio_net_apply_guest_offloads(VirtIONet *n)
- {
-- qemu_set_offload(qemu_get_queue(n->nic)->peer,
-- !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_CSUM)),
-- !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_TSO4)),
-- !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_TSO6)),
-- !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_ECN)),
-- !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_UFO)),
-- !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_USO4)),
-- !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_USO6)));
-+ NetOffloads ol = {
-+ .csum = !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_CSUM)),
-+ .tso4 = !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_TSO4)),
-+ .tso6 = !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_TSO6)),
-+ .ecn = !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_ECN)),
-+ .ufo = !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_UFO)),
-+ .uso4 = !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_USO4)),
-+ .uso6 = !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_USO6)),
-+ };
-+
-+ qemu_set_offload(qemu_get_queue(n->nic)->peer, &ol);
- }
-
- static uint64_t virtio_net_guest_offloads_by_features(uint64_t features)
-diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
-index af73aa8ef2..03732375a7 100644
---- a/hw/net/vmxnet3.c
-+++ b/hw/net/vmxnet3.c
-@@ -1322,14 +1322,11 @@ static void vmxnet3_update_features(VMXNET3State *s)
- s->lro_supported, rxcso_supported,
- s->rx_vlan_stripping);
- if (s->peer_has_vhdr) {
-- qemu_set_offload(qemu_get_queue(s->nic)->peer,
-- rxcso_supported,
-- s->lro_supported,
-- s->lro_supported,
-- 0,
-- 0,
-- 0,
-- 0);
-+ NetOffloads ol = { .csum = rxcso_supported,
-+ .tso4 = s->lro_supported,
-+ .tso6 = s->lro_supported };
-+
-+ qemu_set_offload(qemu_get_queue(s->nic)->peer, &ol);
- }
- }
-
-diff --git a/include/net/net.h b/include/net/net.h
-index 84ee18e0f9..48ba333d02 100644
---- a/include/net/net.h
-+++ b/include/net/net.h
-@@ -35,6 +35,16 @@ typedef struct NICConf {
- int32_t bootindex;
- } NICConf;
-
-+typedef struct NetOffloads {
-+ bool csum;
-+ bool tso4;
-+ bool tso6;
-+ bool ecn;
-+ bool ufo;
-+ bool uso4;
-+ bool uso6;
-+} NetOffloads;
-+
- #define DEFINE_NIC_PROPERTIES(_state, _conf) \
- DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr), \
- DEFINE_PROP_NETDEV("netdev", _state, _conf.peers)
-@@ -57,7 +67,7 @@ typedef bool (HasUfo)(NetClientState *);
- typedef bool (HasUso)(NetClientState *);
- typedef bool (HasVnetHdr)(NetClientState *);
- typedef bool (HasVnetHdrLen)(NetClientState *, int);
--typedef void (SetOffload)(NetClientState *, int, int, int, int, int, int, int);
-+typedef void (SetOffload)(NetClientState *, const NetOffloads *);
- typedef int (GetVnetHdrLen)(NetClientState *);
- typedef void (SetVnetHdrLen)(NetClientState *, int);
- typedef bool (GetVnetHashSupportedTypes)(NetClientState *, uint32_t *);
-@@ -189,8 +199,7 @@ bool qemu_has_ufo(NetClientState *nc);
- bool qemu_has_uso(NetClientState *nc);
- bool qemu_has_vnet_hdr(NetClientState *nc);
- bool qemu_has_vnet_hdr_len(NetClientState *nc, int len);
--void qemu_set_offload(NetClientState *nc, int csum, int tso4, int tso6,
-- int ecn, int ufo, int uso4, int uso6);
-+void qemu_set_offload(NetClientState *nc, const NetOffloads *ol);
- int qemu_get_vnet_hdr_len(NetClientState *nc);
- void qemu_set_vnet_hdr_len(NetClientState *nc, int len);
- bool qemu_get_vnet_hash_supported_types(NetClientState *nc, uint32_t *types);
-diff --git a/net/net.c b/net/net.c
-index da275db86e..63872b6855 100644
---- a/net/net.c
-+++ b/net/net.c
-@@ -540,14 +540,13 @@ bool qemu_has_vnet_hdr_len(NetClientState *nc, int len)
- return nc->info->has_vnet_hdr_len(nc, len);
- }
-
--void qemu_set_offload(NetClientState *nc, int csum, int tso4, int tso6,
-- int ecn, int ufo, int uso4, int uso6)
-+void qemu_set_offload(NetClientState *nc, const NetOffloads *ol)
- {
- if (!nc || !nc->info->set_offload) {
- return;
- }
-
-- nc->info->set_offload(nc, csum, tso4, tso6, ecn, ufo, uso4, uso6);
-+ nc->info->set_offload(nc, ol);
- }
-
- int qemu_get_vnet_hdr_len(NetClientState *nc)
-diff --git a/net/netmap.c b/net/netmap.c
-index 297510e190..6cd8f2bdc5 100644
---- a/net/netmap.c
-+++ b/net/netmap.c
-@@ -366,8 +366,7 @@ static void netmap_set_vnet_hdr_len(NetClientState *nc, int len)
- }
- }
-
--static void netmap_set_offload(NetClientState *nc, int csum, int tso4, int tso6,
-- int ecn, int ufo, int uso4, int uso6)
-+static void netmap_set_offload(NetClientState *nc, const NetOffloads *ol)
- {
- NetmapState *s = DO_UPCAST(NetmapState, nc, nc);
-
-diff --git a/net/tap-bsd.c b/net/tap-bsd.c
-index b4c84441ba..86b6edee94 100644
---- a/net/tap-bsd.c
-+++ b/net/tap-bsd.c
-@@ -231,8 +231,7 @@ int tap_fd_set_vnet_be(int fd, int is_be)
- return -EINVAL;
- }
-
--void tap_fd_set_offload(int fd, int csum, int tso4,
-- int tso6, int ecn, int ufo, int uso4, int uso6)
-+void tap_fd_set_offload(int fd, const NetOffloads *ol)
- {
- }
-
-diff --git a/net/tap-linux.c b/net/tap-linux.c
-index 22ec2f45d2..a1c58f74f5 100644
---- a/net/tap-linux.c
-+++ b/net/tap-linux.c
-@@ -239,8 +239,7 @@ int tap_fd_set_vnet_be(int fd, int is_be)
- abort();
- }
-
--void tap_fd_set_offload(int fd, int csum, int tso4,
-- int tso6, int ecn, int ufo, int uso4, int uso6)
-+void tap_fd_set_offload(int fd, const NetOffloads *ol)
- {
- unsigned int offload = 0;
-
-@@ -249,20 +248,24 @@ void tap_fd_set_offload(int fd, int csum, int tso4,
- return;
- }
-
-- if (csum) {
-+ if (ol->csum) {
- offload |= TUN_F_CSUM;
-- if (tso4)
-+ if (ol->tso4) {
- offload |= TUN_F_TSO4;
-- if (tso6)
-+ }
-+ if (ol->tso6) {
- offload |= TUN_F_TSO6;
-- if ((tso4 || tso6) && ecn)
-+ }
-+ if ((ol->tso4 || ol->tso6) && ol->ecn) {
- offload |= TUN_F_TSO_ECN;
-- if (ufo)
-+ }
-+ if (ol->ufo) {
- offload |= TUN_F_UFO;
-- if (uso4) {
-+ }
-+ if (ol->uso4) {
- offload |= TUN_F_USO4;
- }
-- if (uso6) {
-+ if (ol->uso6) {
- offload |= TUN_F_USO6;
- }
- }
-diff --git a/net/tap-solaris.c b/net/tap-solaris.c
-index 51b7830bef..833c066bee 100644
---- a/net/tap-solaris.c
-+++ b/net/tap-solaris.c
-@@ -27,6 +27,7 @@
- #include "tap_int.h"
- #include "qemu/ctype.h"
- #include "qemu/cutils.h"
-+#include "net/net.h"
-
- #include <sys/ethernet.h>
- #include <sys/sockio.h>
-@@ -235,8 +236,7 @@ int tap_fd_set_vnet_be(int fd, int is_be)
- return -EINVAL;
- }
-
--void tap_fd_set_offload(int fd, int csum, int tso4,
-- int tso6, int ecn, int ufo, int uso4, int uso6)
-+void tap_fd_set_offload(int fd, const NetOffloads *ol)
- {
- }
-
-diff --git a/net/tap-stub.c b/net/tap-stub.c
-index 38673434cb..67d14ad4d5 100644
---- a/net/tap-stub.c
-+++ b/net/tap-stub.c
-@@ -66,8 +66,7 @@ int tap_fd_set_vnet_be(int fd, int is_be)
- return -EINVAL;
- }
-
--void tap_fd_set_offload(int fd, int csum, int tso4,
-- int tso6, int ecn, int ufo, int uso4, int uso6)
-+void tap_fd_set_offload(int fd, const NetOffloads *ol)
- {
- }
-
-diff --git a/net/tap.c b/net/tap.c
-index f7df702f97..72046a43aa 100644
---- a/net/tap.c
-+++ b/net/tap.c
-@@ -285,15 +285,14 @@ static int tap_set_vnet_be(NetClientState *nc, bool is_be)
- return tap_fd_set_vnet_be(s->fd, is_be);
- }
-
--static void tap_set_offload(NetClientState *nc, int csum, int tso4,
-- int tso6, int ecn, int ufo, int uso4, int uso6)
-+static void tap_set_offload(NetClientState *nc, const NetOffloads *ol)
- {
- TAPState *s = DO_UPCAST(TAPState, nc, nc);
- if (s->fd < 0) {
- return;
- }
-
-- tap_fd_set_offload(s->fd, csum, tso4, tso6, ecn, ufo, uso4, uso6);
-+ tap_fd_set_offload(s->fd, ol);
- }
-
- static void tap_exit_notify(Notifier *notifier, void *data)
-@@ -391,6 +390,7 @@ static TAPState *net_tap_fd_init(NetClientState *peer,
- int fd,
- int vnet_hdr)
- {
-+ NetOffloads ol = {};
- NetClientState *nc;
- TAPState *s;
-
-@@ -404,7 +404,7 @@ static TAPState *net_tap_fd_init(NetClientState *peer,
- s->has_ufo = tap_probe_has_ufo(s->fd);
- s->has_uso = tap_probe_has_uso(s->fd);
- s->enabled = true;
-- tap_set_offload(&s->nc, 0, 0, 0, 0, 0, 0, 0);
-+ tap_set_offload(&s->nc, &ol);
- /*
- * Make sure host header length is set correctly in tap:
- * it might have been modified by another instance of qemu.
-diff --git a/net/tap_int.h b/net/tap_int.h
-index 8857ff299d..f8bbe1cb0c 100644
---- a/net/tap_int.h
-+++ b/net/tap_int.h
-@@ -27,6 +27,7 @@
- #define NET_TAP_INT_H
-
- #include "qapi/qapi-types-net.h"
-+#include "net/net.h"
-
- int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
- int vnet_hdr_required, int mq_required, Error **errp);
-@@ -37,8 +38,7 @@ void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp);
- int tap_probe_vnet_hdr(int fd, Error **errp);
- int tap_probe_has_ufo(int fd);
- int tap_probe_has_uso(int fd);
--void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo,
-- int uso4, int uso6);
-+void tap_fd_set_offload(int fd, const NetOffloads *ol);
- void tap_fd_set_vnet_hdr_len(int fd, int len);
- int tap_fd_set_vnet_le(int fd, int vnet_is_le);
- int tap_fd_set_vnet_be(int fd, int vnet_is_be);
---
-2.47.3
-
diff --git a/kvm-net-implement-UDP-tunnel-features-offloading.patch b/kvm-net-implement-UDP-tunnel-features-offloading.patch
deleted file mode 100644
index f7ecee1..0000000
--- a/kvm-net-implement-UDP-tunnel-features-offloading.patch
+++ /dev/null
@@ -1,209 +0,0 @@
-From 97f8e0bbaddf37dcf147f6405a8a96921469d60d Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:28 +0200
-Subject: [PATCH 19/19] net: implement UDP tunnel features offloading
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [14/14] 5ff3488d210020730a71b944519a9938f1628dcc (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-When any host or guest GSO over UDP tunnel offload is enabled the
-virtio net header includes the additional tunnel-related fields,
-update the size accordingly.
-
-Push the GSO over UDP tunnel offloads all the way down to the tap
-device extending the newly introduced NetFeatures struct, and
-eventually enable the associated features.
-
-As per virtio specification, to convert features bit to offload bit,
-map the extended features into the reserved range.
-
-Finally, make the vhost backend aware of the exact header layout, to
-copy it correctly. The tunnel-related field are present if either
-the guest or the host negotiated any UDP tunnel related feature:
-add them to the kernel supported features list, to allow qemu
-transfer to the backend the needed information.
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <093b4bc68368046bffbcab2202227632d6e4e83b.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit a5289563ad74a2a37e8d2101d82935454c71fef4)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- hw/net/virtio-net.c | 34 ++++++++++++++++++++++++++--------
- include/net/net.h | 2 ++
- net/net.c | 3 ++-
- net/tap-linux.c | 6 ++++++
- net/tap.c | 2 ++
- 5 files changed, 38 insertions(+), 9 deletions(-)
-
-diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
-index 0abb8c8a62..f021663f92 100644
---- a/hw/net/virtio-net.c
-+++ b/hw/net/virtio-net.c
-@@ -103,6 +103,12 @@
- #define VIRTIO_NET_F2O_SHIFT (VIRTIO_NET_OFFLOAD_MAP_MIN - \
- VIRTIO_NET_FEATURES_MAP_MIN + 64)
-
-+static bool virtio_has_tunnel_hdr(const uint64_t *features)
-+{
-+ return virtio_has_feature_ex(features, VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO) ||
-+ virtio_has_feature_ex(features, VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO);
-+}
-+
- static const VirtIOFeature feature_sizes[] = {
- {.flags = 1ULL << VIRTIO_NET_F_MAC,
- .end = endof(struct virtio_net_config, mac)},
-@@ -659,7 +665,8 @@ static bool peer_has_tunnel(VirtIONet *n)
- }
-
- static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs,
-- int version_1, int hash_report)
-+ int version_1, int hash_report,
-+ int tunnel)
- {
- int i;
- NetClientState *nc;
-@@ -667,9 +674,11 @@ static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs,
- n->mergeable_rx_bufs = mergeable_rx_bufs;
-
- if (version_1) {
-- n->guest_hdr_len = hash_report ?
-- sizeof(struct virtio_net_hdr_v1_hash) :
-- sizeof(struct virtio_net_hdr_mrg_rxbuf);
-+ n->guest_hdr_len = tunnel ?
-+ sizeof(struct virtio_net_hdr_v1_hash_tunnel) :
-+ (hash_report ?
-+ sizeof(struct virtio_net_hdr_v1_hash) :
-+ sizeof(struct virtio_net_hdr_mrg_rxbuf));
- n->rss_data.populate_hash = !!hash_report;
- } else {
- n->guest_hdr_len = n->mergeable_rx_bufs ?
-@@ -803,6 +812,10 @@ static void virtio_net_apply_guest_offloads(VirtIONet *n)
- .ufo = !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_UFO)),
- .uso4 = !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_USO4)),
- .uso6 = !!(n->curr_guest_offloads & (1ULL << VIRTIO_NET_F_GUEST_USO6)),
-+ .tnl = !!(n->curr_guest_offloads &
-+ (1ULL << VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_MAPPED)),
-+ .tnl_csum = !!(n->curr_guest_offloads &
-+ (1ULL << VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM_MAPPED)),
- };
-
- qemu_set_offload(qemu_get_queue(n->nic)->peer, &ol);
-@@ -824,7 +837,9 @@ virtio_net_guest_offloads_by_features(const uint64_t *features)
- (1ULL << VIRTIO_NET_F_GUEST_ECN) |
- (1ULL << VIRTIO_NET_F_GUEST_UFO) |
- (1ULL << VIRTIO_NET_F_GUEST_USO4) |
-- (1ULL << VIRTIO_NET_F_GUEST_USO6);
-+ (1ULL << VIRTIO_NET_F_GUEST_USO6) |
-+ (1ULL << VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_MAPPED) |
-+ (1ULL << VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM_MAPPED);
-
- return guest_offloads_mask & virtio_net_features_to_offload(features);
- }
-@@ -937,7 +952,8 @@ static void virtio_net_set_features(VirtIODevice *vdev,
- virtio_has_feature_ex(features,
- VIRTIO_F_VERSION_1),
- virtio_has_feature_ex(features,
-- VIRTIO_NET_F_HASH_REPORT));
-+ VIRTIO_NET_F_HASH_REPORT),
-+ virtio_has_tunnel_hdr(features));
-
- n->rsc4_enabled = virtio_has_feature_ex(features, VIRTIO_NET_F_RSC_EXT) &&
- virtio_has_feature_ex(features, VIRTIO_NET_F_GUEST_TSO4);
-@@ -3163,13 +3179,15 @@ static int virtio_net_post_load_device(void *opaque, int version_id)
- VirtIONet *n = opaque;
- VirtIODevice *vdev = VIRTIO_DEVICE(n);
- int i, link_down;
-+ bool has_tunnel_hdr = virtio_has_tunnel_hdr(vdev->guest_features_ex);
-
- trace_virtio_net_post_load_device();
- virtio_net_set_mrg_rx_bufs(n, n->mergeable_rx_bufs,
- virtio_vdev_has_feature(vdev,
- VIRTIO_F_VERSION_1),
- virtio_vdev_has_feature(vdev,
-- VIRTIO_NET_F_HASH_REPORT));
-+ VIRTIO_NET_F_HASH_REPORT),
-+ has_tunnel_hdr);
-
- /* MAC_TABLE_ENTRIES may be different from the saved image */
- if (n->mac_table.in_use > MAC_TABLE_ENTRIES) {
-@@ -3989,7 +4007,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
-
- n->vqs[0].tx_waiting = 0;
- n->tx_burst = n->net_conf.txburst;
-- virtio_net_set_mrg_rx_bufs(n, 0, 0, 0);
-+ virtio_net_set_mrg_rx_bufs(n, 0, 0, 0, 0);
- n->promisc = 1; /* for compatibility */
-
- n->mac_table.macs = g_malloc0(MAC_TABLE_ENTRIES * ETH_ALEN);
-diff --git a/include/net/net.h b/include/net/net.h
-index 9a9084690d..72b476ee1d 100644
---- a/include/net/net.h
-+++ b/include/net/net.h
-@@ -43,6 +43,8 @@ typedef struct NetOffloads {
- bool ufo;
- bool uso4;
- bool uso6;
-+ bool tnl;
-+ bool tnl_csum;
- } NetOffloads;
-
- #define DEFINE_NIC_PROPERTIES(_state, _conf) \
-diff --git a/net/net.c b/net/net.c
-index 9536184a0c..27e0d27807 100644
---- a/net/net.c
-+++ b/net/net.c
-@@ -575,7 +575,8 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len)
-
- assert(len == sizeof(struct virtio_net_hdr_mrg_rxbuf) ||
- len == sizeof(struct virtio_net_hdr) ||
-- len == sizeof(struct virtio_net_hdr_v1_hash));
-+ len == sizeof(struct virtio_net_hdr_v1_hash) ||
-+ len == sizeof(struct virtio_net_hdr_v1_hash_tunnel));
-
- nc->vnet_hdr_len = len;
- nc->info->set_vnet_hdr_len(nc, len);
-diff --git a/net/tap-linux.c b/net/tap-linux.c
-index e2628be798..8e275d2ea4 100644
---- a/net/tap-linux.c
-+++ b/net/tap-linux.c
-@@ -279,6 +279,12 @@ void tap_fd_set_offload(int fd, const NetOffloads *ol)
- if (ol->uso6) {
- offload |= TUN_F_USO6;
- }
-+ if (ol->tnl) {
-+ offload |= TUN_F_UDP_TUNNEL_GSO;
-+ }
-+ if (ol->tnl_csum) {
-+ offload |= TUN_F_UDP_TUNNEL_GSO_CSUM;
-+ }
- }
-
- if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) {
-diff --git a/net/tap.c b/net/tap.c
-index 9f65e3fb3d..dc2a2859ec 100644
---- a/net/tap.c
-+++ b/net/tap.c
-@@ -62,6 +62,8 @@ static const int kernel_feature_bits[] = {
- VIRTIO_F_NOTIFICATION_DATA,
- VIRTIO_NET_F_RSC_EXT,
- VIRTIO_NET_F_HASH_REPORT,
-+ VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO,
-+ VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO,
- VHOST_INVALID_FEATURE_BIT
- };
-
---
-2.47.3
-
diff --git a/kvm-net-implement-tunnel-probing.patch b/kvm-net-implement-tunnel-probing.patch
deleted file mode 100644
index 24305cb..0000000
--- a/kvm-net-implement-tunnel-probing.patch
+++ /dev/null
@@ -1,317 +0,0 @@
-From 0cad25c7acac95a4af0d46f4d0207de4ac973370 Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:27 +0200
-Subject: [PATCH 18/19] net: implement tunnel probing
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [13/14] 3cd000a61b90ffc176f950686fb9d36d93bbee3f (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-Tap devices support GSO over UDP tunnel offload. Probe for such
-feature in a similar manner to other offloads.
-
-GSO over UDP tunnel needs to be enabled in addition to a "plain"
-offload (TSO or USO).
-
-No need to check separately for the outer header checksum offload:
-the kernel is going to support both of them or none.
-
-The new features are disabled by default to avoid compat issues,
-and could be enabled, after that hw_compat_10_1 will be added,
-together with the related compat entries.
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <a987a8a7613cbf33bb2209c7c7f5889b512638a7.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit fffac046282c99801b62fa7fa1032cdc261bca6d)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- hw/net/virtio-net.c | 41 +++++++++++++++++++++++++++++++++++++++++
- include/net/net.h | 3 +++
- net/net.c | 9 +++++++++
- net/tap-bsd.c | 5 +++++
- net/tap-linux.c | 11 +++++++++++
- net/tap-linux.h | 9 +++++++++
- net/tap-solaris.c | 5 +++++
- net/tap-stub.c | 5 +++++
- net/tap.c | 11 +++++++++++
- net/tap_int.h | 1 +
- 10 files changed, 100 insertions(+)
-
-diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
-index 89cf008401..0abb8c8a62 100644
---- a/hw/net/virtio-net.c
-+++ b/hw/net/virtio-net.c
-@@ -649,6 +649,15 @@ static int peer_has_uso(VirtIONet *n)
- return qemu_has_uso(qemu_get_queue(n->nic)->peer);
- }
-
-+static bool peer_has_tunnel(VirtIONet *n)
-+{
-+ if (!peer_has_vnet_hdr(n)) {
-+ return false;
-+ }
-+
-+ return qemu_has_tunnel(qemu_get_queue(n->nic)->peer);
-+}
-+
- static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs,
- int version_1, int hash_report)
- {
-@@ -3073,6 +3082,13 @@ static void virtio_net_get_features(VirtIODevice *vdev, uint64_t *features,
- virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_USO4);
- virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_USO6);
-
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO);
-+ virtio_clear_feature_ex(features,
-+ VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM);
-+ virtio_clear_feature_ex(features,
-+ VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO_CSUM);
-+
- virtio_clear_feature_ex(features, VIRTIO_NET_F_HASH_REPORT);
- }
-
-@@ -3086,6 +3102,15 @@ static void virtio_net_get_features(VirtIODevice *vdev, uint64_t *features,
- virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_USO6);
- }
-
-+ if (!peer_has_tunnel(n)) {
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO);
-+ virtio_clear_feature_ex(features,
-+ VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM);
-+ virtio_clear_feature_ex(features,
-+ VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO_CSUM);
-+ }
-+
- if (!get_vhost_net(nc->peer)) {
- if (!use_own_hash) {
- virtio_clear_feature_ex(features, VIRTIO_NET_F_HASH_REPORT);
-@@ -4248,6 +4273,22 @@ static const Property virtio_net_properties[] = {
- rss_data.specified_hash_types,
- VIRTIO_NET_HASH_REPORT_UDPv6_EX - 1,
- ON_OFF_AUTO_AUTO),
-+ VIRTIO_DEFINE_PROP_FEATURE("host_tunnel", VirtIONet,
-+ host_features_ex,
-+ VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO,
-+ false),
-+ VIRTIO_DEFINE_PROP_FEATURE("host_tunnel_csum", VirtIONet,
-+ host_features_ex,
-+ VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO_CSUM,
-+ false),
-+ VIRTIO_DEFINE_PROP_FEATURE("guest_tunnel", VirtIONet,
-+ host_features_ex,
-+ VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO,
-+ false),
-+ VIRTIO_DEFINE_PROP_FEATURE("guest_tunnel_csum", VirtIONet,
-+ host_features_ex,
-+ VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM,
-+ false),
- };
-
- static void virtio_net_class_init(ObjectClass *klass, const void *data)
-diff --git a/include/net/net.h b/include/net/net.h
-index 48ba333d02..9a9084690d 100644
---- a/include/net/net.h
-+++ b/include/net/net.h
-@@ -65,6 +65,7 @@ typedef void (NetClientDestructor)(NetClientState *);
- typedef RxFilterInfo *(QueryRxFilter)(NetClientState *);
- typedef bool (HasUfo)(NetClientState *);
- typedef bool (HasUso)(NetClientState *);
-+typedef bool (HasTunnel)(NetClientState *);
- typedef bool (HasVnetHdr)(NetClientState *);
- typedef bool (HasVnetHdrLen)(NetClientState *, int);
- typedef void (SetOffload)(NetClientState *, const NetOffloads *);
-@@ -95,6 +96,7 @@ typedef struct NetClientInfo {
- NetPoll *poll;
- HasUfo *has_ufo;
- HasUso *has_uso;
-+ HasTunnel *has_tunnel;
- HasVnetHdr *has_vnet_hdr;
- HasVnetHdrLen *has_vnet_hdr_len;
- SetOffload *set_offload;
-@@ -197,6 +199,7 @@ void qemu_set_info_str(NetClientState *nc,
- void qemu_format_nic_info_str(NetClientState *nc, uint8_t macaddr[6]);
- bool qemu_has_ufo(NetClientState *nc);
- bool qemu_has_uso(NetClientState *nc);
-+bool qemu_has_tunnel(NetClientState *nc);
- bool qemu_has_vnet_hdr(NetClientState *nc);
- bool qemu_has_vnet_hdr_len(NetClientState *nc, int len);
- void qemu_set_offload(NetClientState *nc, const NetOffloads *ol);
-diff --git a/net/net.c b/net/net.c
-index 63872b6855..9536184a0c 100644
---- a/net/net.c
-+++ b/net/net.c
-@@ -522,6 +522,15 @@ bool qemu_has_uso(NetClientState *nc)
- return nc->info->has_uso(nc);
- }
-
-+bool qemu_has_tunnel(NetClientState *nc)
-+{
-+ if (!nc || !nc->info->has_tunnel) {
-+ return false;
-+ }
-+
-+ return nc->info->has_tunnel(nc);
-+}
-+
- bool qemu_has_vnet_hdr(NetClientState *nc)
- {
- if (!nc || !nc->info->has_vnet_hdr) {
-diff --git a/net/tap-bsd.c b/net/tap-bsd.c
-index 86b6edee94..751d4c819c 100644
---- a/net/tap-bsd.c
-+++ b/net/tap-bsd.c
-@@ -217,6 +217,11 @@ int tap_probe_has_uso(int fd)
- return 0;
- }
-
-+bool tap_probe_has_tunnel(int fd)
-+{
-+ return false;
-+}
-+
- void tap_fd_set_vnet_hdr_len(int fd, int len)
- {
- }
-diff --git a/net/tap-linux.c b/net/tap-linux.c
-index a1c58f74f5..e2628be798 100644
---- a/net/tap-linux.c
-+++ b/net/tap-linux.c
-@@ -196,6 +196,17 @@ int tap_probe_has_uso(int fd)
- return 1;
- }
-
-+bool tap_probe_has_tunnel(int fd)
-+{
-+ unsigned offload;
-+
-+ offload = TUN_F_CSUM | TUN_F_TSO4 | TUN_F_UDP_TUNNEL_GSO;
-+ if (ioctl(fd, TUNSETOFFLOAD, offload) < 0) {
-+ return false;
-+ }
-+ return true;
-+}
-+
- void tap_fd_set_vnet_hdr_len(int fd, int len)
- {
- if (ioctl(fd, TUNSETVNETHDRSZ, &len) == -1) {
-diff --git a/net/tap-linux.h b/net/tap-linux.h
-index 9a58cecb7f..8cd6b5874b 100644
---- a/net/tap-linux.h
-+++ b/net/tap-linux.h
-@@ -53,4 +53,13 @@
- #define TUN_F_USO4 0x20 /* I can handle USO for IPv4 packets */
- #define TUN_F_USO6 0x40 /* I can handle USO for IPv6 packets */
-
-+/* I can handle TSO/USO for UDP tunneled packets */
-+#define TUN_F_UDP_TUNNEL_GSO 0x080
-+
-+/*
-+ * I can handle TSO/USO for UDP tunneled packets requiring csum offload for
-+ * the outer header
-+ */
-+#define TUN_F_UDP_TUNNEL_GSO_CSUM 0x100
-+
- #endif /* QEMU_TAP_LINUX_H */
-diff --git a/net/tap-solaris.c b/net/tap-solaris.c
-index 833c066bee..ac1ae25761 100644
---- a/net/tap-solaris.c
-+++ b/net/tap-solaris.c
-@@ -222,6 +222,11 @@ int tap_probe_has_uso(int fd)
- return 0;
- }
-
-+bool tap_probe_has_tunnel(int fd)
-+{
-+ return false;
-+}
-+
- void tap_fd_set_vnet_hdr_len(int fd, int len)
- {
- }
-diff --git a/net/tap-stub.c b/net/tap-stub.c
-index 67d14ad4d5..f7a5e0c163 100644
---- a/net/tap-stub.c
-+++ b/net/tap-stub.c
-@@ -52,6 +52,11 @@ int tap_probe_has_uso(int fd)
- return 0;
- }
-
-+bool tap_probe_has_tunnel(int fd)
-+{
-+ return false;
-+}
-+
- void tap_fd_set_vnet_hdr_len(int fd, int len)
- {
- }
-diff --git a/net/tap.c b/net/tap.c
-index 72046a43aa..9f65e3fb3d 100644
---- a/net/tap.c
-+++ b/net/tap.c
-@@ -76,6 +76,7 @@ typedef struct TAPState {
- bool using_vnet_hdr;
- bool has_ufo;
- bool has_uso;
-+ bool has_tunnel;
- bool enabled;
- VHostNetState *vhost_net;
- unsigned host_vnet_hdr_len;
-@@ -246,6 +247,14 @@ static bool tap_has_uso(NetClientState *nc)
- return s->has_uso;
- }
-
-+static bool tap_has_tunnel(NetClientState *nc)
-+{
-+ TAPState *s = DO_UPCAST(TAPState, nc, nc);
-+
-+ assert(nc->info->type == NET_CLIENT_DRIVER_TAP);
-+ return s->has_tunnel;
-+}
-+
- static bool tap_has_vnet_hdr(NetClientState *nc)
- {
- TAPState *s = DO_UPCAST(TAPState, nc, nc);
-@@ -374,6 +383,7 @@ static NetClientInfo net_tap_info = {
- .cleanup = tap_cleanup,
- .has_ufo = tap_has_ufo,
- .has_uso = tap_has_uso,
-+ .has_tunnel = tap_has_tunnel,
- .has_vnet_hdr = tap_has_vnet_hdr,
- .has_vnet_hdr_len = tap_has_vnet_hdr_len,
- .set_offload = tap_set_offload,
-@@ -403,6 +413,7 @@ static TAPState *net_tap_fd_init(NetClientState *peer,
- s->using_vnet_hdr = false;
- s->has_ufo = tap_probe_has_ufo(s->fd);
- s->has_uso = tap_probe_has_uso(s->fd);
-+ s->has_tunnel = tap_probe_has_tunnel(s->fd);
- s->enabled = true;
- tap_set_offload(&s->nc, &ol);
- /*
-diff --git a/net/tap_int.h b/net/tap_int.h
-index f8bbe1cb0c..b76a05044b 100644
---- a/net/tap_int.h
-+++ b/net/tap_int.h
-@@ -38,6 +38,7 @@ void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp);
- int tap_probe_vnet_hdr(int fd, Error **errp);
- int tap_probe_has_ufo(int fd);
- int tap_probe_has_uso(int fd);
-+bool tap_probe_has_tunnel(int fd);
- void tap_fd_set_offload(int fd, const NetOffloads *ol);
- void tap_fd_set_vnet_hdr_len(int fd, int len);
- int tap_fd_set_vnet_le(int fd, int vnet_is_le);
---
-2.47.3
-
diff --git a/kvm-net-tap-linux.c-avoid-abort-when-setting-invalid-fd.patch b/kvm-net-tap-linux.c-avoid-abort-when-setting-invalid-fd.patch
deleted file mode 100644
index 8dc7c16..0000000
--- a/kvm-net-tap-linux.c-avoid-abort-when-setting-invalid-fd.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From a280e29d82926826575b509cceec10f81a9c2350 Mon Sep 17 00:00:00 2001
-From: "Houqi (Nick) Zuo" <hzuo@redhat.com>
-Date: Mon, 8 Dec 2025 12:35:18 +0800
-Subject: [PATCH 01/30] net/tap-linux.c: avoid abort when setting invalid fd
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 506: net/tap-linux.c: avoid abort when setting invalid fd
-RH-Jira: RHEL-113894
-RH-Acked-by: Eugenio Pérez <eperezma@redhat.com>
-RH-Acked-by: Koushik Dutta <None>
-RH-Commit: [1/1] 76405de0ad722774e385f8cc0a7567fa8cffcac8 (lvivier/qemu-kvm-centos)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-113894
-
-This patch removes abort() call in the tap_fd_set_vnet_hdr_len()
-function. If the fd is found to be in a bad state (e.g., EBADFD
- or ENODEV), the function will print an error message.
-
-When QEMU creates a tap device automatically and the tap device is
-manually removed from the host while the guest is running, the tap
-device file descriptor becomes invalid. Later, when the guest executes
-shutdown, the tap_fd_set_vnet_hdr_len() function may be called and
-abort QEMU with a core dump when attempting to use the invalid fd.
-The expected behavior for this negative test case is that QEMU should
-report an error but continue running rather than aborting.
-
-Testing:
-- Start QEMU with automatically created tap device
-- Manually remove the tap device on the host
-- Execute shutdown in the guest
-- Verify QEMU reports an error but does not abort
-
-Fixes: 0caed25cd171 ("virtio: Call set_features during reset")
-Signed-off-by: Houqi (Nick) Zuo <hzuo@redhat.com>
-Signed-off-by: Jason Wang <jasowang@redhat.com>
-(cherry picked from commit a1708203b583ec04fb9b793840dc282d3c89a20d)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- net/tap-linux.c | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/net/tap-linux.c b/net/tap-linux.c
-index 8e275d2ea4..7996e305c7 100644
---- a/net/tap-linux.c
-+++ b/net/tap-linux.c
-@@ -209,10 +209,11 @@ bool tap_probe_has_tunnel(int fd)
-
- void tap_fd_set_vnet_hdr_len(int fd, int len)
- {
-- if (ioctl(fd, TUNSETVNETHDRSZ, &len) == -1) {
-- fprintf(stderr, "TUNSETVNETHDRSZ ioctl() failed: %s. Exiting.\n",
-- strerror(errno));
-- abort();
-+ int ret;
-+
-+ ret = ioctl(fd, TUNSETVNETHDRSZ, &len);
-+ if (ret != 0) {
-+ error_report("TUNSETVNETHDRSZ ioctl() failed: %s.", strerror(errno));
- }
- }
-
---
-2.52.0
-
diff --git a/kvm-nvme-Kick-and-check-completions-in-BDS-context.patch b/kvm-nvme-Kick-and-check-completions-in-BDS-context.patch
deleted file mode 100644
index d78f395..0000000
--- a/kvm-nvme-Kick-and-check-completions-in-BDS-context.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From c9239fed6d3b7f14b847f10d53fd7c057e08cafd Mon Sep 17 00:00:00 2001
-From: Hanna Czenczek <hreitz@redhat.com>
-Date: Mon, 10 Nov 2025 16:48:42 +0100
-Subject: [PATCH 14/52] nvme: Kick and check completions in BDS context
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [7/45] 6f2f54a3568591087538e0cc2d423ca71f44d661 (kmwolf/centos-qemu-kvm)
-
-nvme_process_completion() must run in the main BDS context, so schedule
-a BH for requests that aren’t there.
-
-The context in which we kick does not matter, but let’s just keep kick
-and process_completion together for simplicity’s sake.
-
-(For what it’s worth, a quick fio bandwidth test indicates that on my
-test hardware, if anything, this may be a bit better than kicking
-immediately before scheduling a pure nvme_process_completion() BH. But
-I wouldn’t take more from those results than that it doesn’t really seem
-to matter either way.)
-
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-Message-ID: <20251110154854.151484-8-hreitz@redhat.com>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 7a501bbd51941fb1867d78e6b0d1dc69e396b9e2)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/nvme.c | 14 +++++++++++++-
- 1 file changed, 13 insertions(+), 1 deletion(-)
-
-diff --git a/block/nvme.c b/block/nvme.c
-index 8df53ee4ca..7ed5f570bc 100644
---- a/block/nvme.c
-+++ b/block/nvme.c
-@@ -481,7 +481,7 @@ static void nvme_trace_command(const NvmeCmd *cmd)
- }
- }
-
--static void nvme_deferred_fn(void *opaque)
-+static void nvme_kick_and_check_completions(void *opaque)
- {
- NVMeQueuePair *q = opaque;
-
-@@ -490,6 +490,18 @@ static void nvme_deferred_fn(void *opaque)
- nvme_process_completion(q);
- }
-
-+static void nvme_deferred_fn(void *opaque)
-+{
-+ NVMeQueuePair *q = opaque;
-+
-+ if (qemu_get_current_aio_context() == q->s->aio_context) {
-+ nvme_kick_and_check_completions(q);
-+ } else {
-+ aio_bh_schedule_oneshot(q->s->aio_context,
-+ nvme_kick_and_check_completions, q);
-+ }
-+}
-+
- static void nvme_submit_command(NVMeQueuePair *q, NVMeRequest *req,
- NvmeCmd *cmd, BlockCompletionFunc cb,
- void *opaque)
---
-2.52.0
-
diff --git a/kvm-nvme-Note-in-which-AioContext-some-functions-run.patch b/kvm-nvme-Note-in-which-AioContext-some-functions-run.patch
deleted file mode 100644
index 04467fe..0000000
--- a/kvm-nvme-Note-in-which-AioContext-some-functions-run.patch
+++ /dev/null
@@ -1,273 +0,0 @@
-From af936e3ce66c2b8ab98fe6a529cea73d86f78ee9 Mon Sep 17 00:00:00 2001
-From: Hanna Czenczek <hreitz@redhat.com>
-Date: Mon, 10 Nov 2025 16:48:44 +0100
-Subject: [PATCH 15/52] nvme: Note in which AioContext some functions run
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [8/45] 1ad4b84c0f2def1565fb3de24dcb6b3a17a18fec (kmwolf/centos-qemu-kvm)
-
-Sprinkle comments throughout block/nvme.c noting for some functions
-(where it may not be obvious) that they require a certain AioContext, or
-in which AioContext they do happen to run (for callbacks, BHs, event
-notifiers).
-
-Suggested-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-Message-ID: <20251110154854.151484-10-hreitz@redhat.com>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit ac3520f599fedee05945ce06bb0f71820a7b2ffc)
-(Mjt: pick this comments-only, no-code-changes commit to 10.1.x
- so the next change applies cleanly)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/nvme.c | 43 ++++++++++++++++++++++++++++++++++---------
- 1 file changed, 34 insertions(+), 9 deletions(-)
-
-diff --git a/block/nvme.c b/block/nvme.c
-index 7ed5f570bc..c3d3b99d1f 100644
---- a/block/nvme.c
-+++ b/block/nvme.c
-@@ -65,6 +65,7 @@ typedef struct {
- } NVMeQueue;
-
- typedef struct {
-+ /* Called from nvme_process_completion() in the BDS's main AioContext */
- BlockCompletionFunc *cb;
- void *opaque;
- int cid;
-@@ -84,6 +85,7 @@ typedef struct {
- uint8_t *prp_list_pages;
-
- /* Fields protected by @lock */
-+ /* Coroutines in this queue are woken in their own context */
- CoQueue free_req_queue;
- NVMeQueue sq, cq;
- int cq_phase;
-@@ -92,7 +94,7 @@ typedef struct {
- int need_kick;
- int inflight;
-
-- /* Thread-safe, no lock necessary */
-+ /* Thread-safe, no lock necessary; runs in the BDS's main context */
- QEMUBH *completion_bh;
- } NVMeQueuePair;
-
-@@ -206,11 +208,13 @@ static void nvme_free_queue_pair(NVMeQueuePair *q)
- g_free(q);
- }
-
-+/* Runs in the BDS's main AioContext */
- static void nvme_free_req_queue_cb(void *opaque)
- {
- NVMeQueuePair *q = opaque;
-
- qemu_mutex_lock(&q->lock);
-+ /* qemu_co_enter_next() wakes the coroutine in its own AioContext */
- while (q->free_req_head != -1 &&
- qemu_co_enter_next(&q->free_req_queue, &q->lock)) {
- /* Retry waiting requests */
-@@ -281,7 +285,7 @@ fail:
- return NULL;
- }
-
--/* With q->lock */
-+/* With q->lock, must be run in the BDS's main AioContext */
- static void nvme_kick(NVMeQueuePair *q)
- {
- BDRVNVMeState *s = q->s;
-@@ -308,7 +312,10 @@ static NVMeRequest *nvme_get_free_req_nofail_locked(NVMeQueuePair *q)
- return req;
- }
-
--/* Return a free request element if any, otherwise return NULL. */
-+/*
-+ * Return a free request element if any, otherwise return NULL.
-+ * May be run from any AioContext.
-+ */
- static NVMeRequest *nvme_get_free_req_nowait(NVMeQueuePair *q)
- {
- QEMU_LOCK_GUARD(&q->lock);
-@@ -321,6 +328,7 @@ static NVMeRequest *nvme_get_free_req_nowait(NVMeQueuePair *q)
- /*
- * Wait for a free request to become available if necessary, then
- * return it.
-+ * May be called in any AioContext.
- */
- static coroutine_fn NVMeRequest *nvme_get_free_req(NVMeQueuePair *q)
- {
-@@ -328,20 +336,21 @@ static coroutine_fn NVMeRequest *nvme_get_free_req(NVMeQueuePair *q)
-
- while (q->free_req_head == -1) {
- trace_nvme_free_req_queue_wait(q->s, q->index);
-+ /* nvme_free_req_queue_cb() wakes us in our own AioContext */
- qemu_co_queue_wait(&q->free_req_queue, &q->lock);
- }
-
- return nvme_get_free_req_nofail_locked(q);
- }
-
--/* With q->lock */
-+/* With q->lock, may be called in any AioContext */
- static void nvme_put_free_req_locked(NVMeQueuePair *q, NVMeRequest *req)
- {
- req->free_req_next = q->free_req_head;
- q->free_req_head = req - q->reqs;
- }
-
--/* With q->lock */
-+/* With q->lock, may be called in any AioContext */
- static void nvme_wake_free_req_locked(NVMeQueuePair *q)
- {
- if (!qemu_co_queue_empty(&q->free_req_queue)) {
-@@ -350,7 +359,7 @@ static void nvme_wake_free_req_locked(NVMeQueuePair *q)
- }
- }
-
--/* Insert a request in the freelist and wake waiters */
-+/* Insert a request in the freelist and wake waiters (from any AioContext) */
- static void nvme_put_free_req_and_wake(NVMeQueuePair *q, NVMeRequest *req)
- {
- qemu_mutex_lock(&q->lock);
-@@ -381,7 +390,7 @@ static inline int nvme_translate_error(const NvmeCqe *c)
- }
- }
-
--/* With q->lock */
-+/* With q->lock, must be run in the BDS's main AioContext */
- static bool nvme_process_completion(NVMeQueuePair *q)
- {
- BDRVNVMeState *s = q->s;
-@@ -451,6 +460,7 @@ static bool nvme_process_completion(NVMeQueuePair *q)
- return progress;
- }
-
-+/* As q->completion_bh, runs in the BDS's main AioContext */
- static void nvme_process_completion_bh(void *opaque)
- {
- NVMeQueuePair *q = opaque;
-@@ -481,6 +491,7 @@ static void nvme_trace_command(const NvmeCmd *cmd)
- }
- }
-
-+/* Must be run in the BDS's main AioContext */
- static void nvme_kick_and_check_completions(void *opaque)
- {
- NVMeQueuePair *q = opaque;
-@@ -490,6 +501,7 @@ static void nvme_kick_and_check_completions(void *opaque)
- nvme_process_completion(q);
- }
-
-+/* Runs in nvme_submit_command()'s AioContext */
- static void nvme_deferred_fn(void *opaque)
- {
- NVMeQueuePair *q = opaque;
-@@ -502,6 +514,7 @@ static void nvme_deferred_fn(void *opaque)
- }
- }
-
-+/* May be run in any AioContext */
- static void nvme_submit_command(NVMeQueuePair *q, NVMeRequest *req,
- NvmeCmd *cmd, BlockCompletionFunc cb,
- void *opaque)
-@@ -523,6 +536,7 @@ static void nvme_submit_command(NVMeQueuePair *q, NVMeRequest *req,
- defer_call(nvme_deferred_fn, q);
- }
-
-+/* Put into NVMeRequest.cb, so runs in the BDS's main AioContext */
- static void nvme_admin_cmd_sync_cb(void *opaque, int ret)
- {
- int *pret = opaque;
-@@ -530,6 +544,7 @@ static void nvme_admin_cmd_sync_cb(void *opaque, int ret)
- aio_wait_kick();
- }
-
-+/* Must be run in the BDS's or qemu's main AioContext */
- static int nvme_admin_cmd_sync(BlockDriverState *bs, NvmeCmd *cmd)
- {
- BDRVNVMeState *s = bs->opaque;
-@@ -638,6 +653,7 @@ out:
- return ret;
- }
-
-+/* Must be run in the BDS's main AioContext */
- static void nvme_poll_queue(NVMeQueuePair *q)
- {
- const size_t cqe_offset = q->cq.head * NVME_CQ_ENTRY_BYTES;
-@@ -660,6 +676,7 @@ static void nvme_poll_queue(NVMeQueuePair *q)
- qemu_mutex_unlock(&q->lock);
- }
-
-+/* Must be run in the BDS's main AioContext */
- static void nvme_poll_queues(BDRVNVMeState *s)
- {
- int i;
-@@ -669,6 +686,7 @@ static void nvme_poll_queues(BDRVNVMeState *s)
- }
- }
-
-+/* Run as an event notifier in the BDS's main AioContext */
- static void nvme_handle_event(EventNotifier *n)
- {
- BDRVNVMeState *s = container_of(n, BDRVNVMeState,
-@@ -722,6 +740,7 @@ out_error:
- return false;
- }
-
-+/* Run as an event notifier in the BDS's main AioContext */
- static bool nvme_poll_cb(void *opaque)
- {
- EventNotifier *e = opaque;
-@@ -745,6 +764,7 @@ static bool nvme_poll_cb(void *opaque)
- return false;
- }
-
-+/* Run as an event notifier in the BDS's main AioContext */
- static void nvme_poll_ready(EventNotifier *e)
- {
- BDRVNVMeState *s = container_of(e, BDRVNVMeState,
-@@ -1050,7 +1070,7 @@ static int nvme_probe_blocksizes(BlockDriverState *bs, BlockSizes *bsz)
- return 0;
- }
-
--/* Called with s->dma_map_lock */
-+/* Called with s->dma_map_lock, may be run in any AioContext */
- static coroutine_fn int nvme_cmd_unmap_qiov(BlockDriverState *bs,
- QEMUIOVector *qiov)
- {
-@@ -1061,13 +1081,17 @@ static coroutine_fn int nvme_cmd_unmap_qiov(BlockDriverState *bs,
- if (!s->dma_map_count && !qemu_co_queue_empty(&s->dma_flush_queue)) {
- r = qemu_vfio_dma_reset_temporary(s->vfio);
- if (!r) {
-+ /*
-+ * Queue access is protected by the dma_map_lock, and all
-+ * coroutines are woken in their own AioContext
-+ */
- qemu_co_queue_restart_all(&s->dma_flush_queue);
- }
- }
- return r;
- }
-
--/* Called with s->dma_map_lock */
-+/* Called with s->dma_map_lock, may be run in any AioContext */
- static coroutine_fn int nvme_cmd_map_qiov(BlockDriverState *bs, NvmeCmd *cmd,
- NVMeRequest *req, QEMUIOVector *qiov)
- {
-@@ -1186,6 +1210,7 @@ static void nvme_rw_cb_bh(void *opaque)
- qemu_coroutine_enter(data->co);
- }
-
-+/* Put into NVMeRequest.cb, so runs in the BDS's main AioContext */
- static void nvme_rw_cb(void *opaque, int ret)
- {
- NVMeCoData *data = opaque;
---
-2.52.0
-
diff --git a/kvm-oslib-qemu_clear_cloexec.patch b/kvm-oslib-qemu_clear_cloexec.patch
deleted file mode 100644
index 860b2e4..0000000
--- a/kvm-oslib-qemu_clear_cloexec.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From 7104509c323a8b5587389dc9236a38df43f4be75 Mon Sep 17 00:00:00 2001
-From: Steve Sistare <steven.sistare@oracle.com>
-Date: Wed, 1 Oct 2025 08:33:55 -0700
-Subject: [PATCH 090/116] oslib: qemu_clear_cloexec
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [74/100] 9b31f6ab1c36c5d6c351d2fa5aa5b5b5799e0951 (rovick1/qemu-kvm)
-
-Define qemu_clear_cloexec, analogous to qemu_set_cloexec.
-
-Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
-Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Reviewed-by: Fabiano Rosas <farosas@suse.de>
-Link: https://lore.kernel.org/r/1759332851-370353-4-git-send-email-steven.sistare@oracle.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
----
- include/qemu/osdep.h | 9 +++++++++
- util/oslib-posix.c | 9 +++++++++
- util/oslib-win32.c | 4 ++++
- 3 files changed, 22 insertions(+)
-
-diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
-index 96fe51bc39..30136ead7f 100644
---- a/include/qemu/osdep.h
-+++ b/include/qemu/osdep.h
-@@ -680,6 +680,15 @@ ssize_t qemu_write_full(int fd, const void *buf, size_t count)
-
- void qemu_set_cloexec(int fd);
-
-+/*
-+ * Clear FD_CLOEXEC for a descriptor.
-+ *
-+ * The caller must guarantee that no other fork+exec's occur before the
-+ * exec that is intended to inherit this descriptor, eg by suspending CPUs
-+ * and blocking monitor commands.
-+ */
-+void qemu_clear_cloexec(int fd);
-+
- /* Return a dynamically allocated directory path that is appropriate for storing
- * local state.
- *
-diff --git a/util/oslib-posix.c b/util/oslib-posix.c
-index 4ff577e5de..4c04658fc8 100644
---- a/util/oslib-posix.c
-+++ b/util/oslib-posix.c
-@@ -307,6 +307,15 @@ int qemu_socketpair(int domain, int type, int protocol, int sv[2])
- return ret;
- }
-
-+void qemu_clear_cloexec(int fd)
-+{
-+ int f;
-+ f = fcntl(fd, F_GETFD);
-+ assert(f != -1);
-+ f = fcntl(fd, F_SETFD, f & ~FD_CLOEXEC);
-+ assert(f != -1);
-+}
-+
- char *
- qemu_get_local_state_dir(void)
- {
-diff --git a/util/oslib-win32.c b/util/oslib-win32.c
-index b7351634ec..843a901fd3 100644
---- a/util/oslib-win32.c
-+++ b/util/oslib-win32.c
-@@ -222,6 +222,10 @@ void qemu_set_cloexec(int fd)
- {
- }
-
-+void qemu_clear_cloexec(int fd)
-+{
-+}
-+
- int qemu_get_thread_id(void)
- {
- return GetCurrentThreadId();
---
-2.52.0
-
diff --git a/kvm-pc-bios-s390-ccw-Always-reset-virtio-device-on-faile.patch b/kvm-pc-bios-s390-ccw-Always-reset-virtio-device-on-faile.patch
deleted file mode 100644
index 3bf6ac4..0000000
--- a/kvm-pc-bios-s390-ccw-Always-reset-virtio-device-on-faile.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From bad45ca2d89e152adfee22e2d6282d67262f1025 Mon Sep 17 00:00:00 2001
-From: Jared Rossi <jrossi@linux.ibm.com>
-Date: Sun, 8 Mar 2026 20:35:49 -0400
-Subject: [PATCH] pc-bios/s390-ccw: Always reset virtio device on failed boot
- attempt
-
-RH-Author: Cornelia Huck <cohuck@redhat.com>
-RH-MergeRequest: 516: pc-bios/s390-ccw: Always reset virtio device on failed boot attempt
-RH-Jira: RHEL-151317
-RH-Acked-by: acordeir <None>
-RH-Acked-by: Richard W.M. Jones <rjones@redhat.com>
-RH-Commit: [1/1] a803bf75e4205bca950eb00793e3911dbc62d60b (cohuck/qemu-kvm-cs)
-
-The virtio spec necessitates that live virtqueues must not be altered. Reset
-the failed device so that the queues are not live before we attempt to boot any
-fallback devices.
-
-Reviewed-by: Thomas Huth <thuth@redhat.com>
-Reviewed-by: Eric Farman <farman@linux.ibm.com>
-Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
-Message-ID: <20260309003601.242634-4-jrossi@linux.ibm.com>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
-(cherry picked from commit dd8c8f16c0244fd5393dc305501675ca1ae2990a)
-Signed-off-by: Cornelia Huck <cohuck@redhat.com>
----
- pc-bios/s390-ccw/main.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
-index 76bf743900..8e2c99bee1 100644
---- a/pc-bios/s390-ccw/main.c
-+++ b/pc-bios/s390-ccw/main.c
-@@ -277,7 +277,8 @@ static void ipl_boot_device(void)
- break;
- case CU_TYPE_VIRTIO:
- if (virtio_setup() == 0) {
-- zipl_load();
-+ zipl_load(); /* only return on error */
-+ virtio_reset(virtio_get_device());
- }
- break;
- default:
---
-2.52.0
-
diff --git a/kvm-pcie_sriov-Fix-broken-MMIO-accesses-from-SR-IOV-VFs.patch b/kvm-pcie_sriov-Fix-broken-MMIO-accesses-from-SR-IOV-VFs.patch
deleted file mode 100644
index 4e87061..0000000
--- a/kvm-pcie_sriov-Fix-broken-MMIO-accesses-from-SR-IOV-VFs.patch
+++ /dev/null
@@ -1,177 +0,0 @@
-From 36d73722360db85d210bacef0c8386e5af031447 Mon Sep 17 00:00:00 2001
-From: Damien Bergamini <damien.bergamini@eviden.com>
-Date: Mon, 1 Sep 2025 15:14:23 +0000
-Subject: [PATCH 1/2] pcie_sriov: Fix broken MMIO accesses from SR-IOV VFs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 431: pcie_sriov: Fix broken MMIO accesses from SR-IOV VFs
-RH-Jira: RHEL-120115
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Commit: [1/1] b6bb40d37376db589852cb07a915d6f0eae29f67 (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-120115
-
-Starting with commit cab1398a60eb, SR-IOV VFs are realized as soon as
-pcie_sriov_pf_init() is called. Because pcie_sriov_pf_init() must be
-called before pcie_sriov_pf_init_vf_bar(), the VF BARs types won't be
-known when the VF realize function calls pcie_sriov_vf_register_bar().
-
-This breaks the memory regions of the VFs (for instance with igbvf):
-
-$ lspci
-...
- Region 0: Memory at 281a00000 (64-bit, prefetchable) [virtual] [size=16K]
- Region 3: Memory at 281a20000 (64-bit, prefetchable) [virtual] [size=16K]
-
-$ info mtree
-...
-address-space: pci_bridge_pci_mem
- 0000000000000000-ffffffffffffffff (prio 0, i/o): pci_bridge_pci
- 0000000081a00000-0000000081a03fff (prio 1, i/o): igbvf-mmio
- 0000000081a20000-0000000081a23fff (prio 1, i/o): igbvf-msix
-
-and causes MMIO accesses to fail:
-
- Invalid write at addr 0x281A01520, size 4, region '(null)', reason: rejected
- Invalid read at addr 0x281A00C40, size 4, region '(null)', reason: rejected
-
-To fix this, VF BARs are now registered with pci_register_bar() which
-has a type parameter and pcie_sriov_vf_register_bar() is removed.
-
-Fixes: cab1398a60eb ("pcie_sriov: Reuse SR-IOV VF device instances")
-Signed-off-by: Damien Bergamini <damien.bergamini@eviden.com>
-Signed-off-by: Clement Mathieu--Drif <clement.mathieu--drif@eviden.com>
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <20250901151314.1038020-1-clement.mathieu--drif@eviden.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit 2e54e5fda779a7ba45578884276dca62462f7a06)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- docs/pcie_sriov.txt | 5 ++---
- hw/net/igbvf.c | 6 ++++--
- hw/nvme/ctrl.c | 8 ++------
- hw/pci/pci.c | 3 ---
- hw/pci/pcie_sriov.c | 11 -----------
- include/hw/pci/pcie_sriov.h | 4 ----
- 6 files changed, 8 insertions(+), 29 deletions(-)
-
-diff --git a/docs/pcie_sriov.txt b/docs/pcie_sriov.txt
-index ab2142807f..00d7bd93fd 100644
---- a/docs/pcie_sriov.txt
-+++ b/docs/pcie_sriov.txt
-@@ -72,8 +72,7 @@ setting up a BAR for a VF.
- 2) Similarly in the implementation of the virtual function, you need to
- make it a PCI Express device and add a similar set of capabilities
- except for the SR/IOV capability. Then you need to set up the VF BARs as
-- subregions of the PFs SR/IOV VF BARs by calling
-- pcie_sriov_vf_register_bar() instead of the normal pci_register_bar() call:
-+ subregions of the PFs SR/IOV VF BARs by calling pci_register_bar():
-
- pci_your_vf_dev_realize( ... )
- {
-@@ -83,7 +82,7 @@ setting up a BAR for a VF.
- pcie_ari_init(d, 0x100);
- ...
- memory_region_init(mr, ... )
-- pcie_sriov_vf_register_bar(d, bar_nr, mr);
-+ pci_register_bar(d, bar_nr, bar_type, mr);
- ...
- }
-
-diff --git a/hw/net/igbvf.c b/hw/net/igbvf.c
-index 31d72c4977..9b0db8f841 100644
---- a/hw/net/igbvf.c
-+++ b/hw/net/igbvf.c
-@@ -251,10 +251,12 @@ static void igbvf_pci_realize(PCIDevice *dev, Error **errp)
-
- memory_region_init_io(&s->mmio, OBJECT(dev), &mmio_ops, s, "igbvf-mmio",
- IGBVF_MMIO_SIZE);
-- pcie_sriov_vf_register_bar(dev, IGBVF_MMIO_BAR_IDX, &s->mmio);
-+ pci_register_bar(dev, IGBVF_MMIO_BAR_IDX, PCI_BASE_ADDRESS_MEM_TYPE_64 |
-+ PCI_BASE_ADDRESS_MEM_PREFETCH, &s->mmio);
-
- memory_region_init(&s->msix, OBJECT(dev), "igbvf-msix", IGBVF_MSIX_SIZE);
-- pcie_sriov_vf_register_bar(dev, IGBVF_MSIX_BAR_IDX, &s->msix);
-+ pci_register_bar(dev, IGBVF_MSIX_BAR_IDX, PCI_BASE_ADDRESS_MEM_TYPE_64 |
-+ PCI_BASE_ADDRESS_MEM_PREFETCH, &s->msix);
-
- ret = msix_init(dev, IGBVF_MSIX_VEC_NUM, &s->msix, IGBVF_MSIX_BAR_IDX, 0,
- &s->msix, IGBVF_MSIX_BAR_IDX, 0x2000, 0x70, errp);
-diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
-index f5ee6bf260..cd81f73997 100644
---- a/hw/nvme/ctrl.c
-+++ b/hw/nvme/ctrl.c
-@@ -8708,12 +8708,8 @@ static bool nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev, Error **errp)
- msix_table_offset);
- memory_region_add_subregion(&n->bar0, 0, &n->iomem);
-
-- if (pci_is_vf(pci_dev)) {
-- pcie_sriov_vf_register_bar(pci_dev, 0, &n->bar0);
-- } else {
-- pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY |
-- PCI_BASE_ADDRESS_MEM_TYPE_64, &n->bar0);
-- }
-+ pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY |
-+ PCI_BASE_ADDRESS_MEM_TYPE_64, &n->bar0);
-
- ret = msix_init(pci_dev, nr_vectors,
- &n->bar0, 0, msix_table_offset,
-diff --git a/hw/pci/pci.c b/hw/pci/pci.c
-index 0012cc12e7..d2ebb066e1 100644
---- a/hw/pci/pci.c
-+++ b/hw/pci/pci.c
-@@ -1490,9 +1490,6 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
- : pci_get_bus(pci_dev)->address_space_mem;
-
- if (pci_is_vf(pci_dev)) {
-- PCIDevice *pf = pci_dev->exp.sriov_vf.pf;
-- assert(!pf || type == pf->exp.sriov_pf.vf_bar_type[region_num]);
--
- r->addr = pci_bar_address(pci_dev, region_num, r->type, r->size);
- if (r->addr != PCI_BAR_UNMAPPED) {
- memory_region_add_subregion_overlap(r->address_space,
-diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
-index cf1b5b5c05..c4f88f0975 100644
---- a/hw/pci/pcie_sriov.c
-+++ b/hw/pci/pcie_sriov.c
-@@ -246,17 +246,6 @@ void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int region_num,
- dev->exp.sriov_pf.vf_bar_type[region_num] = type;
- }
-
--void pcie_sriov_vf_register_bar(PCIDevice *dev, int region_num,
-- MemoryRegion *memory)
--{
-- uint8_t type;
--
-- assert(dev->exp.sriov_vf.pf);
-- type = dev->exp.sriov_vf.pf->exp.sriov_pf.vf_bar_type[region_num];
--
-- return pci_register_bar(dev, region_num, type, memory);
--}
--
- static gint compare_vf_devfns(gconstpointer a, gconstpointer b)
- {
- return (*(PCIDevice **)a)->devfn - (*(PCIDevice **)b)->devfn;
-diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h
-index aeaa38cf34..b0ea6a62c7 100644
---- a/include/hw/pci/pcie_sriov.h
-+++ b/include/hw/pci/pcie_sriov.h
-@@ -37,10 +37,6 @@ void pcie_sriov_pf_exit(PCIDevice *dev);
- void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int region_num,
- uint8_t type, dma_addr_t size);
-
--/* Instantiate a bar for a VF */
--void pcie_sriov_vf_register_bar(PCIDevice *dev, int region_num,
-- MemoryRegion *memory);
--
- /**
- * pcie_sriov_pf_init_from_user_created_vfs() - Initialize PF with user-created
- * VFs, adding ARI to PF
---
-2.47.3
-
diff --git a/kvm-pcie_sriov-make-pcie_sriov_pf_exit-safe-on-non-SR-IO.patch b/kvm-pcie_sriov-make-pcie_sriov_pf_exit-safe-on-non-SR-IO.patch
deleted file mode 100644
index 8790d13..0000000
--- a/kvm-pcie_sriov-make-pcie_sriov_pf_exit-safe-on-non-SR-IO.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From db20fe92c8cc22e3317787d6c83056126e912f3a Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 24 Sep 2025 11:51:53 -0400
-Subject: [PATCH 2/4] pcie_sriov: make pcie_sriov_pf_exit() safe on non-SR-IOV
- devices
-
-RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
-RH-MergeRequest: 408: pcie_sriov: make pcie_sriov_pf_exit() safe on non-SR-IOV devices
-RH-Jira: RHEL-116443
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/1] a4fea6ad073c9fa5fdc7f20b3dfeab4e4acef73f (stefanha/centos-stream-qemu-kvm)
-
-Commit 3f9cfaa92c96 ("virtio-pci: Implement SR-IOV PF") added an
-unconditional call from virtio_pci_exit() to pcie_sriov_pf_exit().
-
-pcie_sriov_pf_exit() reads from the SR-IOV Capability in Configuration
-Space:
-
- uint8_t *cfg = dev->config + dev->exp.sriov_cap;
- ...
- unparent_vfs(dev, pci_get_word(cfg + PCI_SRIOV_TOTAL_VF));
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-This results in undefined behavior when dev->exp.sriov_cap is 0 because
-this is not an SR-IOV device. For example, unparent_vfs() segfaults when
-total_vfs happens to be non-zero.
-
-Fix this by returning early from pcie_sriov_pf_exit() when
-dev->exp.sriov_cap is 0 because this is not an SR-IOV device.
-
-Cc: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Cc: Michael S. Tsirkin <mst@redhat.com>
-Reported-by: Qing Wang <qinwang@redhat.com>
-Buglink: https://issues.redhat.com/browse/RHEL-116443
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Fixes: cab1398a60eb ("pcie_sriov: Reuse SR-IOV VF device instances")
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <20250924155153.579495-1-stefanha@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit bab681f752048c3bc22d561b1d314c7ec16419c9)
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/pci/pcie_sriov.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
-index 8a4bf0d6f7..cf1b5b5c05 100644
---- a/hw/pci/pcie_sriov.c
-+++ b/hw/pci/pcie_sriov.c
-@@ -195,7 +195,9 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset,
-
- void pcie_sriov_pf_exit(PCIDevice *dev)
- {
-- uint8_t *cfg = dev->config + dev->exp.sriov_cap;
-+ if (dev->exp.sriov_cap == 0) {
-+ return;
-+ }
-
- if (dev->exp.sriov_pf.vf_user_created) {
- uint16_t ven_id = pci_get_word(dev->config + PCI_VENDOR_ID);
-@@ -211,6 +213,8 @@ void pcie_sriov_pf_exit(PCIDevice *dev)
- pci_config_set_device_id(dev->exp.sriov_pf.vf[i]->config, vf_dev_id);
- }
- } else {
-+ uint8_t *cfg = dev->config + dev->exp.sriov_cap;
-+
- unparent_vfs(dev, pci_get_word(cfg + PCI_SRIOV_TOTAL_VF));
- }
- }
---
-2.47.3
-
diff --git a/kvm-python-backport-Remove-deprecated-get_event_loop-cal.patch b/kvm-python-backport-Remove-deprecated-get_event_loop-cal.patch
deleted file mode 100644
index 926a99d..0000000
--- a/kvm-python-backport-Remove-deprecated-get_event_loop-cal.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From d8bdd0cbf122d1f01acaec8c9846b9cdbf925d3c Mon Sep 17 00:00:00 2001
-From: John Snow <jsnow@redhat.com>
-Date: Tue, 13 Aug 2024 09:35:30 -0400
-Subject: [PATCH 25/52] python: backport 'Remove deprecated get_event_loop
- calls'
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [18/45] 7f8d672738b92fa5935342eded7559bc16bef7ab (kmwolf/centos-qemu-kvm)
-
-This method was deprecated in 3.12 because it ordinarily should not be
-used from coroutines; if there is not a currently running event loop,
-this automatically creates a new event loop - which is usually not what
-you want from code that would ever run in the bottom half.
-
-In our case, we do want this behavior in two places:
-
-(1) The synchronous shim, for convenience: this allows fully sync
-programs to use QEMUMonitorProtocol() without needing to set up an event
-loop beforehand. This is intentional to fully box in the async
-complexities into the legacy sync shim.
-
-(2) The qmp_tui shell; instead of relying on asyncio.run to create and
-run an asyncio program, we need to be able to pass the current asyncio
-loop to urwid setup functions. For convenience, again, we create one if
-one is not present to simplify the creation of the TUI appliance.
-
-The remaining user of get_event_loop() was in fact one of the erroneous
-users that should not have been using this function: if there's no
-running event loop inside of a coroutine, you're in big trouble :)
-
-Signed-off-by: John Snow <jsnow@redhat.com>
-cherry picked from commit python-qemu-qmp@aa1ff9907603a3033296027e1bd021133df86ef1
-Signed-off-by: John Snow <jsnow@redhat.com>
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 5d99044d09db0fa8c2b3294e301927118f9effc9)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- python/qemu/qmp/legacy.py | 9 ++++++++-
- python/qemu/qmp/qmp_tui.py | 7 ++++++-
- python/tests/protocol.py | 2 +-
- 3 files changed, 15 insertions(+), 3 deletions(-)
-
-diff --git a/python/qemu/qmp/legacy.py b/python/qemu/qmp/legacy.py
-index 22a2b5616e..ea9b8032c3 100644
---- a/python/qemu/qmp/legacy.py
-+++ b/python/qemu/qmp/legacy.py
-@@ -86,7 +86,14 @@ def __init__(self,
- "server argument should be False when passing a socket")
-
- self._qmp = QMPClient(nickname)
-- self._aloop = asyncio.get_event_loop()
-+
-+ try:
-+ self._aloop = asyncio.get_running_loop()
-+ except RuntimeError:
-+ # No running loop; since this is a sync shim likely to be
-+ # used in fully sync programs, create one if neccessary.
-+ self._aloop = asyncio.get_event_loop_policy().get_event_loop()
-+
- self._address = address
- self._timeout: Optional[float] = None
-
-diff --git a/python/qemu/qmp/qmp_tui.py b/python/qemu/qmp/qmp_tui.py
-index 562be008d5..651f611316 100644
---- a/python/qemu/qmp/qmp_tui.py
-+++ b/python/qemu/qmp/qmp_tui.py
-@@ -377,7 +377,12 @@ def run(self, debug: bool = False) -> None:
- screen = urwid.raw_display.Screen()
- screen.set_terminal_properties(256)
-
-- self.aloop = asyncio.get_event_loop()
-+ try:
-+ self.aloop = asyncio.get_running_loop()
-+ except RuntimeError:
-+ # No running asyncio event loop. Create one if necessary.
-+ self.aloop = asyncio.get_event_loop_policy().get_event_loop()
-+
- self.aloop.set_debug(debug)
-
- # Gracefully handle SIGTERM and SIGINT signals
-diff --git a/python/tests/protocol.py b/python/tests/protocol.py
-index c254c77b17..e565802516 100644
---- a/python/tests/protocol.py
-+++ b/python/tests/protocol.py
-@@ -227,7 +227,7 @@ def async_test(async_test_method):
- Decorator; adds SetUp and TearDown to async tests.
- """
- async def _wrapper(self, *args, **kwargs):
-- loop = asyncio.get_event_loop()
-+ loop = asyncio.get_running_loop()
- loop.set_debug(True)
-
- await self._asyncSetUp()
---
-2.52.0
-
diff --git a/kvm-python-backport-avoid-creating-additional-event-loop.patch b/kvm-python-backport-avoid-creating-additional-event-loop.patch
deleted file mode 100644
index a2b0a52..0000000
--- a/kvm-python-backport-avoid-creating-additional-event-loop.patch
+++ /dev/null
@@ -1,210 +0,0 @@
-From 3739feb5280370c3439030e1f1fe0ec0d0eb2ccb Mon Sep 17 00:00:00 2001
-From: John Snow <jsnow@redhat.com>
-Date: Wed, 3 Sep 2025 01:06:30 -0400
-Subject: [PATCH 26/52] python: backport 'avoid creating additional event loops
- per thread'
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [19/45] 1f870d1d45d5158c428bac46820d5aa7621f810f (kmwolf/centos-qemu-kvm)
-
-This commit is two backports squashed into one to avoid regressions.
-
-python: *really* remove get_event_loop
-
-A prior commit, aa1ff990, switched away from using get_event_loop *by
-default*, but this is not good enough to avoid deprecation warnings as
-`asyncio.get_event_loop_policy().get_event_loop()` is *also*
-deprecated. Replace this mechanism with explicit calls to
-asyncio.get_new_loop() and revise the cleanup mechanisms in __del__ to
-match.
-
-python: avoid creating additional event loops per thread
-
-"Too hasty by far!", commit 21ce2ee4 attempted to avoid deprecated
-behavior altogether by calling new_event_loop() directly if there was no
-loop currently running, but this has the unfortunate side effect of
-potentially creating multiple event loops per thread if tests
-instantiate multiple QMP connections in a single thread. This behavior
-is apparently not well-defined and causes problems in some, but not all,
-combinations of Python interpreter version and platform environment.
-
-Partially revert to Daniel Berrange's original patch, which calls
-get_event_loop and simply suppresses the deprecation warning in
-Python<=3.13. This time, however, additionally register new loops
-created with new_event_loop() so that future calls to get_event_loop()
-will return the loop already created.
-
-Reported-by: Richard W.M. Jones <rjones@redhat.com>
-Reported-by: Daniel P. Berrangé <berrange@redhat.com>
-Signed-off-by: John Snow <jsnow@redhat.com>
-cherry picked from commit python-qemu-qmp@21ce2ee4f2df87efe84a27b9c5112487f4670622
-cherry picked from commit python-qemu-qmp@c08fb82b38212956ccffc03fc6d015c3979f42fe
-Signed-off-by: John Snow <jsnow@redhat.com>
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 85f223e5b031eb8ab63fbca314a4fb296a3a2632)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- python/qemu/qmp/legacy.py | 46 +++++++++++++++++++++++---------------
- python/qemu/qmp/qmp_tui.py | 10 ++-------
- python/qemu/qmp/util.py | 27 ++++++++++++++++++++++
- 3 files changed, 57 insertions(+), 26 deletions(-)
-
-diff --git a/python/qemu/qmp/legacy.py b/python/qemu/qmp/legacy.py
-index ea9b8032c3..c732212c04 100644
---- a/python/qemu/qmp/legacy.py
-+++ b/python/qemu/qmp/legacy.py
-@@ -38,6 +38,7 @@
- from .error import QMPError
- from .protocol import Runstate, SocketAddrT
- from .qmp_client import QMPClient
-+from .util import get_or_create_event_loop
-
-
- #: QMPMessage is an entire QMP message of any kind.
-@@ -86,17 +87,13 @@ def __init__(self,
- "server argument should be False when passing a socket")
-
- self._qmp = QMPClient(nickname)
--
-- try:
-- self._aloop = asyncio.get_running_loop()
-- except RuntimeError:
-- # No running loop; since this is a sync shim likely to be
-- # used in fully sync programs, create one if neccessary.
-- self._aloop = asyncio.get_event_loop_policy().get_event_loop()
--
- self._address = address
- self._timeout: Optional[float] = None
-
-+ # This is a sync shim intended for use in fully synchronous
-+ # programs. Create and set an event loop if necessary.
-+ self._aloop = get_or_create_event_loop()
-+
- if server:
- assert not isinstance(self._address, socket.socket)
- self._sync(self._qmp.start_server(self._address))
-@@ -310,17 +307,30 @@ def send_fd_scm(self, fd: int) -> None:
- self._qmp.send_fd_scm(fd)
-
- def __del__(self) -> None:
-- if self._qmp.runstate == Runstate.IDLE:
-- return
-+ if self._qmp.runstate != Runstate.IDLE:
-+ self._qmp.logger.warning(
-+ "QEMUMonitorProtocol object garbage collected without a prior "
-+ "call to close()"
-+ )
-
- if not self._aloop.is_running():
-- self.close()
-- else:
-- # Garbage collection ran while the event loop was running.
-- # Nothing we can do about it now, but if we don't raise our
-- # own error, the user will be treated to a lot of traceback
-- # they might not understand.
-+ if self._qmp.runstate != Runstate.IDLE:
-+ # If the user neglected to close the QMP session and we
-+ # are not currently running in an asyncio context, we
-+ # have the opportunity to close the QMP session. If we
-+ # do not do this, the error messages presented over
-+ # dangling async resources may not make any sense to the
-+ # user.
-+ self.close()
-+
-+ if self._qmp.runstate != Runstate.IDLE:
-+ # If QMP is still not quiesced, it means that the garbage
-+ # collector ran from a context within the event loop and we
-+ # are simply too late to take any corrective action. Raise
-+ # our own error to give meaningful feedback to the user in
-+ # order to prevent pages of asyncio stacktrace jargon.
- raise QMPError(
-- "QEMUMonitorProtocol.close()"
-- " was not called before object was garbage collected"
-+ "QEMUMonitorProtocol.close() was not called before object was "
-+ "garbage collected, and could not be closed due to GC running "
-+ "in the event loop"
- )
-diff --git a/python/qemu/qmp/qmp_tui.py b/python/qemu/qmp/qmp_tui.py
-index 651f611316..89b0f5e081 100644
---- a/python/qemu/qmp/qmp_tui.py
-+++ b/python/qemu/qmp/qmp_tui.py
-@@ -40,7 +40,7 @@
- from .message import DeserializationError, Message, UnexpectedTypeError
- from .protocol import ConnectError, Runstate
- from .qmp_client import ExecInterruptedError, QMPClient
--from .util import pretty_traceback
-+from .util import get_or_create_event_loop, pretty_traceback
-
-
- # The name of the signal that is used to update the history list
-@@ -376,13 +376,7 @@ def run(self, debug: bool = False) -> None:
- """
- screen = urwid.raw_display.Screen()
- screen.set_terminal_properties(256)
--
-- try:
-- self.aloop = asyncio.get_running_loop()
-- except RuntimeError:
-- # No running asyncio event loop. Create one if necessary.
-- self.aloop = asyncio.get_event_loop_policy().get_event_loop()
--
-+ self.aloop = get_or_create_event_loop()
- self.aloop.set_debug(debug)
-
- # Gracefully handle SIGTERM and SIGINT signals
-diff --git a/python/qemu/qmp/util.py b/python/qemu/qmp/util.py
-index 0b3e781373..47ec39a8b5 100644
---- a/python/qemu/qmp/util.py
-+++ b/python/qemu/qmp/util.py
-@@ -10,6 +10,7 @@
- import sys
- import traceback
- from typing import TypeVar, cast
-+import warnings
-
-
- T = TypeVar('T')
-@@ -20,6 +21,32 @@
- # --------------------------
-
-
-+def get_or_create_event_loop() -> asyncio.AbstractEventLoop:
-+ """
-+ Return this thread's current event loop, or create a new one.
-+
-+ This function behaves similarly to asyncio.get_event_loop() in
-+ Python<=3.13, where if there is no event loop currently associated
-+ with the current context, it will create and register one. It should
-+ generally not be used in any asyncio-native applications.
-+ """
-+ try:
-+ with warnings.catch_warnings():
-+ # Python <= 3.13 will trigger deprecation warnings if no
-+ # event loop is set, but will create and set a new loop.
-+ warnings.simplefilter("ignore")
-+ loop = asyncio.get_event_loop()
-+ except RuntimeError:
-+ # Python 3.14+: No event loop set for this thread,
-+ # create and set one.
-+ loop = asyncio.new_event_loop()
-+ # Set this loop as the current thread's loop, to be returned
-+ # by calls to get_event_loop() in the future.
-+ asyncio.set_event_loop(loop)
-+
-+ return loop
-+
-+
- async def flush(writer: asyncio.StreamWriter) -> None:
- """
- Utility function to ensure a StreamWriter is *fully* drained.
---
-2.52.0
-
diff --git a/kvm-python-backport-drop-Python3.6-workarounds.patch b/kvm-python-backport-drop-Python3.6-workarounds.patch
deleted file mode 100644
index bba142e..0000000
--- a/kvm-python-backport-drop-Python3.6-workarounds.patch
+++ /dev/null
@@ -1,300 +0,0 @@
-From 5de86fbbb5f6c0353bd2668c0424da28bf786264 Mon Sep 17 00:00:00 2001
-From: John Snow <jsnow@redhat.com>
-Date: Tue, 6 Jun 2023 13:19:11 -0400
-Subject: [PATCH 24/52] python: backport 'drop Python3.6 workarounds'
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [17/45] 65ffd438927850c395611deb3821d01b71d3c2c1 (kmwolf/centos-qemu-kvm)
-
-Now that the minimum version is 3.7, drop some of the 3.6-specific hacks
-we've been carrying. A single remaining compatibility hack concerning
-3.6's lack of @asynccontextmanager is addressed in the following commit.
-
-Signed-off-by: John Snow <jsnow@redhat.com>
-cherry picked from commit python-qemu-qmp@3e8e34e594cfc6b707e6f67959166acde4b421b8
-Signed-off-by: John Snow <jsnow@redhat.com>
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit f9d2e0a3bd7ba2a693a892881f91cf53fa90cc71)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- python/qemu/qmp/protocol.py | 13 ++---
- python/qemu/qmp/qmp_tui.py | 8 +--
- python/qemu/qmp/util.py | 107 ++----------------------------------
- python/tests/protocol.py | 8 +--
- 4 files changed, 17 insertions(+), 119 deletions(-)
-
-diff --git a/python/qemu/qmp/protocol.py b/python/qemu/qmp/protocol.py
-index a4ffdfad51..4aff0ea423 100644
---- a/python/qemu/qmp/protocol.py
-+++ b/python/qemu/qmp/protocol.py
-@@ -36,13 +36,10 @@
- from .error import QMPError
- from .util import (
- bottom_half,
-- create_task,
- exception_summary,
- flush,
-- is_closing,
- pretty_traceback,
- upper_half,
-- wait_closed,
- )
-
-
-@@ -663,8 +660,8 @@ async def _establish_session(self) -> None:
- reader_coro = self._bh_loop_forever(self._bh_recv_message, 'Reader')
- writer_coro = self._bh_loop_forever(self._bh_send_message, 'Writer')
-
-- self._reader_task = create_task(reader_coro)
-- self._writer_task = create_task(writer_coro)
-+ self._reader_task = asyncio.create_task(reader_coro)
-+ self._writer_task = asyncio.create_task(writer_coro)
-
- self._bh_tasks = asyncio.gather(
- self._reader_task,
-@@ -689,7 +686,7 @@ def _schedule_disconnect(self) -> None:
- if not self._dc_task:
- self._set_state(Runstate.DISCONNECTING)
- self.logger.debug("Scheduling disconnect.")
-- self._dc_task = create_task(self._bh_disconnect())
-+ self._dc_task = asyncio.create_task(self._bh_disconnect())
-
- @upper_half
- async def _wait_disconnect(self) -> None:
-@@ -825,13 +822,13 @@ async def _bh_close_stream(self, error_pathway: bool = False) -> None:
- if not self._writer:
- return
-
-- if not is_closing(self._writer):
-+ if not self._writer.is_closing():
- self.logger.debug("Closing StreamWriter.")
- self._writer.close()
-
- self.logger.debug("Waiting for StreamWriter to close ...")
- try:
-- await wait_closed(self._writer)
-+ await self._writer.wait_closed()
- except Exception: # pylint: disable=broad-except
- # It's hard to tell if the Stream is already closed or
- # not. Even if one of the tasks has failed, it may have
-diff --git a/python/qemu/qmp/qmp_tui.py b/python/qemu/qmp/qmp_tui.py
-index 2d9ebbd20b..562be008d5 100644
---- a/python/qemu/qmp/qmp_tui.py
-+++ b/python/qemu/qmp/qmp_tui.py
-@@ -40,7 +40,7 @@
- from .message import DeserializationError, Message, UnexpectedTypeError
- from .protocol import ConnectError, Runstate
- from .qmp_client import ExecInterruptedError, QMPClient
--from .util import create_task, pretty_traceback
-+from .util import pretty_traceback
-
-
- # The name of the signal that is used to update the history list
-@@ -225,7 +225,7 @@ def cb_send_to_server(self, raw_msg: str) -> None:
- """
- try:
- msg = Message(bytes(raw_msg, encoding='utf-8'))
-- create_task(self._send_to_server(msg))
-+ asyncio.create_task(self._send_to_server(msg))
- except (DeserializationError, UnexpectedTypeError) as err:
- raw_msg = format_json(raw_msg)
- logging.info('Invalid message: %s', err.error_message)
-@@ -246,7 +246,7 @@ def kill_app(self) -> None:
- Initiates killing of app. A bridge between asynchronous and synchronous
- code.
- """
-- create_task(self._kill_app())
-+ asyncio.create_task(self._kill_app())
-
- async def _kill_app(self) -> None:
- """
-@@ -393,7 +393,7 @@ def run(self, debug: bool = False) -> None:
- handle_mouse=True,
- event_loop=event_loop)
-
-- create_task(self.manage_connection(), self.aloop)
-+ self.aloop.create_task(self.manage_connection())
- try:
- main_loop.run()
- except Exception as err:
-diff --git a/python/qemu/qmp/util.py b/python/qemu/qmp/util.py
-index ca6225e9cd..0b3e781373 100644
---- a/python/qemu/qmp/util.py
-+++ b/python/qemu/qmp/util.py
-@@ -1,25 +1,15 @@
- """
- Miscellaneous Utilities
-
--This module provides asyncio utilities and compatibility wrappers for
--Python 3.6 to provide some features that otherwise become available in
--Python 3.7+.
--
--Various logging and debugging utilities are also provided, such as
--`exception_summary()` and `pretty_traceback()`, used primarily for
--adding information into the logging stream.
-+This module provides asyncio and various logging and debugging
-+utilities, such as `exception_summary()` and `pretty_traceback()`, used
-+primarily for adding information into the logging stream.
- """
-
- import asyncio
- import sys
- import traceback
--from typing import (
-- Any,
-- Coroutine,
-- Optional,
-- TypeVar,
-- cast,
--)
-+from typing import TypeVar, cast
-
-
- T = TypeVar('T')
-@@ -79,95 +69,6 @@ def bottom_half(func: T) -> T:
- return func
-
-
--# -------------------------------
--# Section: Compatibility Wrappers
--# -------------------------------
--
--
--def create_task(coro: Coroutine[Any, Any, T],
-- loop: Optional[asyncio.AbstractEventLoop] = None
-- ) -> 'asyncio.Future[T]':
-- """
-- Python 3.6-compatible `asyncio.create_task` wrapper.
--
-- :param coro: The coroutine to execute in a task.
-- :param loop: Optionally, the loop to create the task in.
--
-- :return: An `asyncio.Future` object.
-- """
-- if sys.version_info >= (3, 7):
-- if loop is not None:
-- return loop.create_task(coro)
-- return asyncio.create_task(coro) # pylint: disable=no-member
--
-- # Python 3.6:
-- return asyncio.ensure_future(coro, loop=loop)
--
--
--def is_closing(writer: asyncio.StreamWriter) -> bool:
-- """
-- Python 3.6-compatible `asyncio.StreamWriter.is_closing` wrapper.
--
-- :param writer: The `asyncio.StreamWriter` object.
-- :return: `True` if the writer is closing, or closed.
-- """
-- if sys.version_info >= (3, 7):
-- return writer.is_closing()
--
-- # Python 3.6:
-- transport = writer.transport
-- assert isinstance(transport, asyncio.WriteTransport)
-- return transport.is_closing()
--
--
--async def wait_closed(writer: asyncio.StreamWriter) -> None:
-- """
-- Python 3.6-compatible `asyncio.StreamWriter.wait_closed` wrapper.
--
-- :param writer: The `asyncio.StreamWriter` to wait on.
-- """
-- if sys.version_info >= (3, 7):
-- await writer.wait_closed()
-- return
--
-- # Python 3.6
-- transport = writer.transport
-- assert isinstance(transport, asyncio.WriteTransport)
--
-- while not transport.is_closing():
-- await asyncio.sleep(0)
--
-- # This is an ugly workaround, but it's the best I can come up with.
-- sock = transport.get_extra_info('socket')
--
-- if sock is None:
-- # Our transport doesn't have a socket? ...
-- # Nothing we can reasonably do.
-- return
--
-- while sock.fileno() != -1:
-- await asyncio.sleep(0)
--
--
--def asyncio_run(coro: Coroutine[Any, Any, T], *, debug: bool = False) -> T:
-- """
-- Python 3.6-compatible `asyncio.run` wrapper.
--
-- :param coro: A coroutine to execute now.
-- :return: The return value from the coroutine.
-- """
-- if sys.version_info >= (3, 7):
-- return asyncio.run(coro, debug=debug)
--
-- # Python 3.6
-- loop = asyncio.get_event_loop()
-- loop.set_debug(debug)
-- ret = loop.run_until_complete(coro)
-- loop.close()
--
-- return ret
--
--
- # ----------------------------
- # Section: Logging & Debugging
- # ----------------------------
-diff --git a/python/tests/protocol.py b/python/tests/protocol.py
-index 56c4d441f9..c254c77b17 100644
---- a/python/tests/protocol.py
-+++ b/python/tests/protocol.py
-@@ -8,7 +8,6 @@
-
- from qemu.qmp import ConnectError, Runstate
- from qemu.qmp.protocol import AsyncProtocol, StateError
--from qemu.qmp.util import asyncio_run, create_task
-
-
- class NullProtocol(AsyncProtocol[None]):
-@@ -124,7 +123,7 @@ async def _runner():
- if allow_cancellation:
- return
- raise
-- return create_task(_runner())
-+ return asyncio.create_task(_runner())
-
-
- @contextmanager
-@@ -271,7 +270,7 @@ async def _watcher():
- msg=f"Expected state '{state.name}'",
- )
-
-- self.runstate_watcher = create_task(_watcher())
-+ self.runstate_watcher = asyncio.create_task(_watcher())
- # Kick the loop and force the task to block on the event.
- await asyncio.sleep(0)
-
-@@ -589,7 +588,8 @@ async def _asyncTearDown(self):
- async def testSmoke(self):
- with TemporaryDirectory(suffix='.qmp') as tmpdir:
- sock = os.path.join(tmpdir, type(self.proto).__name__ + ".sock")
-- server_task = create_task(self.server.start_server_and_accept(sock))
-+ server_task = asyncio.create_task(
-+ self.server.start_server_and_accept(sock))
-
- # give the server a chance to start listening [...]
- await asyncio.sleep(0)
---
-2.52.0
-
diff --git a/kvm-q35-increase-default-tseg-size.patch b/kvm-q35-increase-default-tseg-size.patch
deleted file mode 100644
index 9ac5d51..0000000
--- a/kvm-q35-increase-default-tseg-size.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From 50db9d559ad56dfa54de13adbb494edca24d9d43 Mon Sep 17 00:00:00 2001
-From: Gerd Hoffmann <kraxel@redhat.com>
-Date: Thu, 6 Nov 2025 11:56:40 +0100
-Subject: [PATCH 2/4] q35: increase default tseg size
-
-RH-Author: Gerd Hoffmann <kraxel@redhat.com>
-RH-MergeRequest: 447: q35: increase default tseg size
-RH-Jira: RHEL-126707
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/2] 8cbbb7b55e2e83bb6129b2da92179ff7b969c4ed (kraxel.rh/centos-src-qemu-kvm)
-
-With virtual machines becoming larger (more CPUs, more memory) the
-memory needed by the SMM code in OVMF to manage page tables and vcpu
-state grows too.
-
-Default SMM memory (aka TSEG) size is 16 MB, and this often is not
-enough. Bump it to 64 MB for new machine types.
-
-Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-Message-Id: <20251106105640.1642109-1-kraxel@redhat.com>
-(cherry picked from commit fa4136387928749d5a1b4fa3606ae0ce6dce75aa)
-
-[ RHEL: drop compat property update for upstream machine types ]
-[ RHEL: add compat property for rhel 10.0 machine type ]
-[ NOTE: the 10.0 compat properties are used for
- rhel-9.6 + older machine types too ]
-
-Resolves: RHEL-126707
----
- hw/i386/pc.c | 1 +
- hw/pci-host/q35.c | 2 +-
- 2 files changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/hw/i386/pc.c b/hw/i386/pc.c
-index 394a84eb8a..27900e071b 100644
---- a/hw/i386/pc.c
-+++ b/hw/i386/pc.c
-@@ -299,6 +299,7 @@ const size_t pc_rhel_compat_len = G_N_ELEMENTS(pc_rhel_compat);
-
- GlobalProperty pc_rhel_10_2_compat[] = {
- /* pc_rhel_10_2_compat from pc_compat_10_0 */
-+ { "mch", "extended-tseg-mbytes", "16" },
- { TYPE_X86_CPU, "x-consistent-cache", "false" },
- { TYPE_X86_CPU, "x-vendor-cpuid-only-v2", "false" },
- { TYPE_X86_CPU, "x-arch-cap-always-on", "true" },
-diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
-index 1951ae440c..a708758d36 100644
---- a/hw/pci-host/q35.c
-+++ b/hw/pci-host/q35.c
-@@ -663,7 +663,7 @@ static void mch_realize(PCIDevice *d, Error **errp)
-
- static const Property mch_props[] = {
- DEFINE_PROP_UINT16("extended-tseg-mbytes", MCHPCIState, ext_tseg_mbytes,
-- 16),
-+ 64),
- DEFINE_PROP_BOOL("smbase-smram", MCHPCIState, has_smram_at_smbase, true),
- };
-
---
-2.47.3
-
diff --git a/kvm-qapi-accel-Allow-to-query-mshv-capabilities.patch b/kvm-qapi-accel-Allow-to-query-mshv-capabilities.patch
deleted file mode 100644
index 5cac472..0000000
--- a/kvm-qapi-accel-Allow-to-query-mshv-capabilities.patch
+++ /dev/null
@@ -1,169 +0,0 @@
-From 4c29e56da6378dcd55336748d65a777ac85a7fc8 Mon Sep 17 00:00:00 2001
-From: Praveen K Paladugu <prapal@microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:44 +0200
-Subject: [PATCH 27/32] qapi/accel: Allow to query mshv capabilities
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [25/30] 50d73451b735ee139ca065c15a84e5f7e77e3904
-
-Allow to query mshv capabilities via query-mshv QMP and info mshv HMP commands.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Acked-by: Dr. David Alan Gilbert <dave@treblig.org>
-Link: https://lore.kernel.org/r/20250916164847.77883-25-magnuskulke@linux.microsoft.com
-[Fix "since" version. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit e7b08dfb902430b4f8226d23d7cf9b2762b6fc83)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- hmp-commands-info.hx | 13 +++++++++++++
- hw/core/machine-hmp-cmds.c | 15 +++++++++++++++
- hw/core/machine-qmp-cmds.c | 14 ++++++++++++++
- include/monitor/hmp.h | 1 +
- include/system/hw_accel.h | 1 +
- qapi/accelerator.json | 29 +++++++++++++++++++++++++++++
- 6 files changed, 73 insertions(+)
-
-diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
-index 6142f60e7b..eaaa880c1b 100644
---- a/hmp-commands-info.hx
-+++ b/hmp-commands-info.hx
-@@ -307,6 +307,19 @@ SRST
- Show KVM information.
- ERST
-
-+ {
-+ .name = "mshv",
-+ .args_type = "",
-+ .params = "",
-+ .help = "show MSHV information",
-+ .cmd = hmp_info_mshv,
-+ },
-+
-+SRST
-+ ``info mshv``
-+ Show MSHV information.
-+ERST
-+
- {
- .name = "numa",
- .args_type = "",
-diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
-index 3a612e2232..682ed9f49b 100644
---- a/hw/core/machine-hmp-cmds.c
-+++ b/hw/core/machine-hmp-cmds.c
-@@ -163,6 +163,21 @@ void hmp_info_kvm(Monitor *mon, const QDict *qdict)
- qapi_free_KvmInfo(info);
- }
-
-+void hmp_info_mshv(Monitor *mon, const QDict *qdict)
-+{
-+ MshvInfo *info;
-+
-+ info = qmp_query_mshv(NULL);
-+ monitor_printf(mon, "mshv support: ");
-+ if (info->present) {
-+ monitor_printf(mon, "%s\n", info->enabled ? "enabled" : "disabled");
-+ } else {
-+ monitor_printf(mon, "not compiled\n");
-+ }
-+
-+ qapi_free_MshvInfo(info);
-+}
-+
- void hmp_info_uuid(Monitor *mon, const QDict *qdict)
- {
- UuidInfo *info;
-diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
-index 6aca1a626e..e24bf0d97b 100644
---- a/hw/core/machine-qmp-cmds.c
-+++ b/hw/core/machine-qmp-cmds.c
-@@ -28,6 +28,20 @@
- #include "system/runstate.h"
- #include "system/system.h"
- #include "hw/s390x/storage-keys.h"
-+#include <sys/stat.h>
-+
-+/*
-+ * QMP query for MSHV
-+ */
-+MshvInfo *qmp_query_mshv(Error **errp)
-+{
-+ MshvInfo *info = g_malloc0(sizeof(*info));
-+
-+ info->enabled = mshv_enabled();
-+ info->present = accel_find("mshv");
-+
-+ return info;
-+}
-
- /*
- * fast means: we NEVER interrupt vCPU threads to retrieve
-diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
-index ae116d9804..31bd812e5f 100644
---- a/include/monitor/hmp.h
-+++ b/include/monitor/hmp.h
-@@ -24,6 +24,7 @@ strList *hmp_split_at_comma(const char *str);
- void hmp_info_name(Monitor *mon, const QDict *qdict);
- void hmp_info_version(Monitor *mon, const QDict *qdict);
- void hmp_info_kvm(Monitor *mon, const QDict *qdict);
-+void hmp_info_mshv(Monitor *mon, const QDict *qdict);
- void hmp_info_status(Monitor *mon, const QDict *qdict);
- void hmp_info_uuid(Monitor *mon, const QDict *qdict);
- void hmp_info_chardev(Monitor *mon, const QDict *qdict);
-diff --git a/include/system/hw_accel.h b/include/system/hw_accel.h
-index fa9228d5d2..55497edc29 100644
---- a/include/system/hw_accel.h
-+++ b/include/system/hw_accel.h
-@@ -14,6 +14,7 @@
- #include "hw/core/cpu.h"
- #include "system/kvm.h"
- #include "system/hvf.h"
-+#include "system/mshv.h"
- #include "system/whpx.h"
- #include "system/nvmm.h"
-
-diff --git a/qapi/accelerator.json b/qapi/accelerator.json
-index fb28c8d920..664e027246 100644
---- a/qapi/accelerator.json
-+++ b/qapi/accelerator.json
-@@ -54,3 +54,32 @@
- { 'command': 'x-accel-stats',
- 'returns': 'HumanReadableText',
- 'features': [ 'unstable' ] }
-+
-+##
-+# @MshvInfo:
-+#
-+# Information about support for MSHV acceleration
-+#
-+# @enabled: true if MSHV acceleration is active
-+#
-+# @present: true if MSHV acceleration is built into this executable
-+#
-+# Since: 10.2.0
-+##
-+{ 'struct': 'MshvInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
-+
-+##
-+# @query-mshv:
-+#
-+# Return information about MSHV acceleration
-+#
-+# Returns: @MshvInfo
-+#
-+# Since: 10.0.92
-+#
-+# .. qmp-example::
-+#
-+# -> { "execute": "query-mshv" }
-+# <- { "return": { "enabled": true, "present": true } }
-+##
-+{ 'command': 'query-mshv', 'returns': 'MshvInfo' }
---
-2.47.3
-
diff --git a/kvm-qapi-machine-s390x-add-QAPI-event-SCLP_CPI_INFO_AVAI.patch b/kvm-qapi-machine-s390x-add-QAPI-event-SCLP_CPI_INFO_AVAI.patch
deleted file mode 100644
index 796cb88..0000000
--- a/kvm-qapi-machine-s390x-add-QAPI-event-SCLP_CPI_INFO_AVAI.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From c616ee68c53e1ebc10f95e3401e505c034aeb361 Mon Sep 17 00:00:00 2001
-From: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
-Date: Thu, 16 Oct 2025 14:17:07 +0200
-Subject: [PATCH 01/10] qapi/machine-s390x: add QAPI event
- SCLP_CPI_INFO_AVAILABLE
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Thomas Huth <thuth@redhat.com>
-RH-MergeRequest: 412: Add -rhel9.8.0 and -rhel10.2.0 s390x machine types and enable the CPI feature
-RH-Jira: RHEL-104009 RHEL-105823 RHEL-73008
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/3] 24789cc7501d22168819bf459f7d880deba8b403 (thuth/qemu-kvm-cs)
-
-JIRA: https://issues.redhat.com/browse/RHEL-73008
-
-Add QAPI event SCLP_CPI_INFO_AVAILABLE to notify the availability
-of Control-Program Identification data in QOM.
-
-Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
-Suggested-by: Thomas Huth <thuth@redhat.com>
-Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
-Reviewed-by: Thomas Huth <thuth@redhat.com>
-Message-ID: <20251016121708.334133-1-shalini@linux.ibm.com>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
-(cherry picked from commit 0ce63280dc6fe9fce1d89922f2d17dcae77827e6)
----
- hw/s390x/sclpcpi.c | 4 ++++
- qapi/machine-s390x.json | 21 +++++++++++++++++++++
- 2 files changed, 25 insertions(+)
-
-diff --git a/hw/s390x/sclpcpi.c b/hw/s390x/sclpcpi.c
-index 7aa039d510..68fc1b809b 100644
---- a/hw/s390x/sclpcpi.c
-+++ b/hw/s390x/sclpcpi.c
-@@ -54,6 +54,7 @@
- #include "hw/s390x/event-facility.h"
- #include "hw/s390x/ebcdic.h"
- #include "qapi/qapi-visit-machine.h"
-+#include "qapi/qapi-events-machine-s390x.h"
- #include "migration/vmstate.h"
-
- typedef struct Data {
-@@ -106,6 +107,9 @@ static int write_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_hdr)
- e->timestamp = qemu_clock_get_ns(QEMU_CLOCK_HOST);
-
- cpim->ebh.flags = SCLP_EVENT_BUFFER_ACCEPTED;
-+
-+ qapi_event_send_sclp_cpi_info_available();
-+
- return SCLP_RC_NORMAL_COMPLETION;
- }
-
-diff --git a/qapi/machine-s390x.json b/qapi/machine-s390x.json
-index 966dbd61d2..8412668b67 100644
---- a/qapi/machine-s390x.json
-+++ b/qapi/machine-s390x.json
-@@ -119,3 +119,24 @@
- { 'command': 'query-s390x-cpu-polarization', 'returns': 'CpuPolarizationInfo',
- 'features': [ 'unstable' ]
- }
-+
-+##
-+# @SCLP_CPI_INFO_AVAILABLE:
-+#
-+# Emitted when the Control-Program Identification data is available
-+# in the QOM tree.
-+#
-+# Features:
-+#
-+# @unstable: This event is experimental.
-+#
-+# Since: 10.2
-+#
-+# .. qmp-example::
-+#
-+# <- { "event": "SCLP_CPI_INFO_AVAILABLE",
-+# "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
-+##
-+{ 'event': 'SCLP_CPI_INFO_AVAILABLE',
-+ 'features': [ 'unstable' ]
-+}
---
-2.47.3
-
diff --git a/kvm-qcow2-Fix-cache_clean_timer.patch b/kvm-qcow2-Fix-cache_clean_timer.patch
deleted file mode 100644
index 00befca..0000000
--- a/kvm-qcow2-Fix-cache_clean_timer.patch
+++ /dev/null
@@ -1,338 +0,0 @@
-From ebcb7dbc060ca295d2ec1daba67ba84fe2ede3bc Mon Sep 17 00:00:00 2001
-From: Hanna Czenczek <hreitz@redhat.com>
-Date: Mon, 10 Nov 2025 16:48:47 +0100
-Subject: [PATCH 05/19] qcow2: Fix cache_clean_timer
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Hanna Czenczek <hreitz@redhat.com>
-RH-MergeRequest: 454: Multithreading fixes for rbd, curl, qcow2
-RH-Jira: RHEL-79118
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [5/5] ff4bbc4f7c7cebeb8ba34a146854aca1f8aed86f (hreitz/qemu-kvm-c-9-s)
-
-The cache-cleaner runs as a timer CB in the BDS AioContext. With
-multiqueue, it can run concurrently to I/O requests, and because it does
-not take any lock, this can break concurrent cache accesses, corrupting
-the image. While the chances of this happening are low, it can be
-reproduced e.g. by modifying the code to schedule the timer CB every
-5 ms (instead of at most once per second) and modifying the last (inner)
-while loop of qcow2_cache_clean_unused() like so:
-
- while (i < c->size && can_clean_entry(c, i)) {
- for (int j = 0; j < 1000 && can_clean_entry(c, i); j++) {
- usleep(100);
- }
- c->entries[i].offset = 0;
- c->entries[i].lru_counter = 0;
- i++;
- to_clean++;
- }
-
-i.e. making it wait on purpose for the point in time where the cache is
-in use by something else.
-
-The solution chosen for this in this patch is not the best solution, I
-hope, but I admittedly can’t come up with anything strictly better.
-
-We can protect from concurrent cache accesses either by taking the
-existing s->lock, or we introduce a new (non-coroutine) mutex
-specifically for cache accesses. I would prefer to avoid the latter so
-as not to introduce additional (very slight) overhead.
-
-Using s->lock, which is a coroutine mutex, however means that we need to
-take it in a coroutine, so the timer must run in a coroutine. We can
-transform it from the current timer CB style into a coroutine that
-sleeps for the set interval. As a result, however, we can no longer
-just deschedule the timer to instantly guarantee it won’t run anymore,
-but have to await the coroutine’s exit.
-
-(Note even before this patch there were places that may not have been so
-guaranteed after all: Anything calling cache_clean_timer_del() from the
-QEMU main AioContext could have been running concurrently to an existing
-timer CB invocation.)
-
-Polling to await the timer to actually settle seems very complicated for
-something that’s rather a minor problem, but I can’t come up with any
-better solution that doesn’t again just overlook potential problems.
-
-(Not Cc-ing qemu-stable, as the issue is quite unlikely to be hit, and
-I’m not too fond of this solution.)
-
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-Message-ID: <20251110154854.151484-13-hreitz@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit f86dde9a1524f0d7fca0f4037f560e6131d31f7f)
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
----
- block/qcow2.c | 141 ++++++++++++++++++++++++++++++++++++++++----------
- block/qcow2.h | 5 +-
- 2 files changed, 117 insertions(+), 29 deletions(-)
-
-diff --git a/block/qcow2.c b/block/qcow2.c
-index 374ca53829..a6adfa9f84 100644
---- a/block/qcow2.c
-+++ b/block/qcow2.c
-@@ -835,41 +835,113 @@ static const char *overlap_bool_option_names[QCOW2_OL_MAX_BITNR] = {
- [QCOW2_OL_BITMAP_DIRECTORY_BITNR] = QCOW2_OPT_OVERLAP_BITMAP_DIRECTORY,
- };
-
--static void cache_clean_timer_cb(void *opaque)
-+static void coroutine_fn cache_clean_timer(void *opaque)
- {
-- BlockDriverState *bs = opaque;
-- BDRVQcow2State *s = bs->opaque;
-- qcow2_cache_clean_unused(s->l2_table_cache);
-- qcow2_cache_clean_unused(s->refcount_block_cache);
-- timer_mod(s->cache_clean_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
-- (int64_t) s->cache_clean_interval * 1000);
-+ BDRVQcow2State *s = opaque;
-+ uint64_t wait_ns;
-+
-+ WITH_QEMU_LOCK_GUARD(&s->lock) {
-+ wait_ns = s->cache_clean_interval * NANOSECONDS_PER_SECOND;
-+ }
-+
-+ while (wait_ns > 0) {
-+ qemu_co_sleep_ns_wakeable(&s->cache_clean_timer_wake,
-+ QEMU_CLOCK_VIRTUAL, wait_ns);
-+
-+ WITH_QEMU_LOCK_GUARD(&s->lock) {
-+ if (s->cache_clean_interval > 0) {
-+ qcow2_cache_clean_unused(s->l2_table_cache);
-+ qcow2_cache_clean_unused(s->refcount_block_cache);
-+ }
-+
-+ wait_ns = s->cache_clean_interval * NANOSECONDS_PER_SECOND;
-+ }
-+ }
-+
-+ WITH_QEMU_LOCK_GUARD(&s->lock) {
-+ s->cache_clean_timer_co = NULL;
-+ qemu_co_queue_restart_all(&s->cache_clean_timer_exit);
-+ }
- }
-
- static void cache_clean_timer_init(BlockDriverState *bs, AioContext *context)
- {
- BDRVQcow2State *s = bs->opaque;
- if (s->cache_clean_interval > 0) {
-- s->cache_clean_timer =
-- aio_timer_new_with_attrs(context, QEMU_CLOCK_VIRTUAL,
-- SCALE_MS, QEMU_TIMER_ATTR_EXTERNAL,
-- cache_clean_timer_cb, bs);
-- timer_mod(s->cache_clean_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
-- (int64_t) s->cache_clean_interval * 1000);
-+ assert(!s->cache_clean_timer_co);
-+ s->cache_clean_timer_co = qemu_coroutine_create(cache_clean_timer, s);
-+ aio_co_enter(context, s->cache_clean_timer_co);
- }
- }
-
--static void cache_clean_timer_del(BlockDriverState *bs)
-+/**
-+ * Delete the cache clean timer and await any yet running instance.
-+ * Called holding s->lock.
-+ */
-+static void coroutine_fn
-+cache_clean_timer_co_locked_del_and_wait(BlockDriverState *bs)
-+{
-+ BDRVQcow2State *s = bs->opaque;
-+
-+ if (s->cache_clean_timer_co) {
-+ s->cache_clean_interval = 0;
-+ qemu_co_sleep_wake(&s->cache_clean_timer_wake);
-+ qemu_co_queue_wait(&s->cache_clean_timer_exit, &s->lock);
-+ }
-+}
-+
-+/**
-+ * Same as cache_clean_timer_co_locked_del_and_wait(), but takes s->lock.
-+ */
-+static void coroutine_fn
-+cache_clean_timer_co_del_and_wait(BlockDriverState *bs)
- {
- BDRVQcow2State *s = bs->opaque;
-- if (s->cache_clean_timer) {
-- timer_free(s->cache_clean_timer);
-- s->cache_clean_timer = NULL;
-+
-+ WITH_QEMU_LOCK_GUARD(&s->lock) {
-+ cache_clean_timer_co_locked_del_and_wait(bs);
-+ }
-+}
-+
-+struct CacheCleanTimerDelAndWaitCoParams {
-+ BlockDriverState *bs;
-+ bool done;
-+};
-+
-+static void coroutine_fn cache_clean_timer_del_and_wait_co_entry(void *opaque)
-+{
-+ struct CacheCleanTimerDelAndWaitCoParams *p = opaque;
-+
-+ cache_clean_timer_co_del_and_wait(p->bs);
-+ p->done = true;
-+ aio_wait_kick();
-+}
-+
-+/**
-+ * Delete the cache clean timer and await any yet running instance.
-+ * Must be called from the main or BDS AioContext without s->lock held.
-+ */
-+static void coroutine_mixed_fn
-+cache_clean_timer_del_and_wait(BlockDriverState *bs)
-+{
-+ IO_OR_GS_CODE();
-+
-+ if (qemu_in_coroutine()) {
-+ cache_clean_timer_co_del_and_wait(bs);
-+ } else {
-+ struct CacheCleanTimerDelAndWaitCoParams p = { .bs = bs };
-+ Coroutine *co;
-+
-+ co = qemu_coroutine_create(cache_clean_timer_del_and_wait_co_entry, &p);
-+ qemu_coroutine_enter(co);
-+
-+ BDRV_POLL_WHILE(bs, !p.done);
- }
- }
-
- static void qcow2_detach_aio_context(BlockDriverState *bs)
- {
-- cache_clean_timer_del(bs);
-+ cache_clean_timer_del_and_wait(bs);
- }
-
- static void qcow2_attach_aio_context(BlockDriverState *bs,
-@@ -1214,12 +1286,24 @@ fail:
- return ret;
- }
-
-+/* s_locked specifies whether s->lock is held or not */
- static void qcow2_update_options_commit(BlockDriverState *bs,
-- Qcow2ReopenState *r)
-+ Qcow2ReopenState *r,
-+ bool s_locked)
- {
- BDRVQcow2State *s = bs->opaque;
- int i;
-
-+ /*
-+ * We need to stop the cache-clean-timer before destroying the metadata
-+ * table caches
-+ */
-+ if (s_locked) {
-+ cache_clean_timer_co_locked_del_and_wait(bs);
-+ } else {
-+ cache_clean_timer_del_and_wait(bs);
-+ }
-+
- if (s->l2_table_cache) {
- qcow2_cache_destroy(s->l2_table_cache);
- }
-@@ -1228,6 +1312,7 @@ static void qcow2_update_options_commit(BlockDriverState *bs,
- }
- s->l2_table_cache = r->l2_table_cache;
- s->refcount_block_cache = r->refcount_block_cache;
-+
- s->l2_slice_size = r->l2_slice_size;
-
- s->overlap_check = r->overlap_check;
-@@ -1239,11 +1324,8 @@ static void qcow2_update_options_commit(BlockDriverState *bs,
-
- s->discard_no_unref = r->discard_no_unref;
-
-- if (s->cache_clean_interval != r->cache_clean_interval) {
-- cache_clean_timer_del(bs);
-- s->cache_clean_interval = r->cache_clean_interval;
-- cache_clean_timer_init(bs, bdrv_get_aio_context(bs));
-- }
-+ s->cache_clean_interval = r->cache_clean_interval;
-+ cache_clean_timer_init(bs, bdrv_get_aio_context(bs));
-
- qapi_free_QCryptoBlockOpenOptions(s->crypto_opts);
- s->crypto_opts = r->crypto_opts;
-@@ -1261,6 +1343,7 @@ static void qcow2_update_options_abort(BlockDriverState *bs,
- qapi_free_QCryptoBlockOpenOptions(r->crypto_opts);
- }
-
-+/* Called with s->lock held */
- static int coroutine_fn GRAPH_RDLOCK
- qcow2_update_options(BlockDriverState *bs, QDict *options, int flags,
- Error **errp)
-@@ -1270,7 +1353,7 @@ qcow2_update_options(BlockDriverState *bs, QDict *options, int flags,
-
- ret = qcow2_update_options_prepare(bs, &r, options, flags, errp);
- if (ret >= 0) {
-- qcow2_update_options_commit(bs, &r);
-+ qcow2_update_options_commit(bs, &r, true);
- } else {
- qcow2_update_options_abort(bs, &r);
- }
-@@ -1914,7 +1997,7 @@ qcow2_do_open(BlockDriverState *bs, QDict *options, int flags,
- qemu_vfree(s->l1_table);
- /* else pre-write overlap checks in cache_destroy may crash */
- s->l1_table = NULL;
-- cache_clean_timer_del(bs);
-+ cache_clean_timer_co_locked_del_and_wait(bs);
- if (s->l2_table_cache) {
- qcow2_cache_destroy(s->l2_table_cache);
- }
-@@ -1969,6 +2052,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
-
- /* Initialise locks */
- qemu_co_mutex_init(&s->lock);
-+ qemu_co_queue_init(&s->cache_clean_timer_exit);
-
- assert(!qemu_in_coroutine());
- assert(qemu_get_current_aio_context() == qemu_get_aio_context());
-@@ -2054,7 +2138,7 @@ static void qcow2_reopen_commit(BDRVReopenState *state)
-
- GRAPH_RDLOCK_GUARD_MAINLOOP();
-
-- qcow2_update_options_commit(state->bs, state->opaque);
-+ qcow2_update_options_commit(state->bs, state->opaque, false);
- if (!s->data_file) {
- /*
- * If we don't have an external data file, s->data_file was cleared by
-@@ -2811,7 +2895,7 @@ qcow2_do_close(BlockDriverState *bs, bool close_data_file)
- qcow2_inactivate(bs);
- }
-
-- cache_clean_timer_del(bs);
-+ cache_clean_timer_del_and_wait(bs);
- qcow2_cache_destroy(s->l2_table_cache);
- qcow2_cache_destroy(s->refcount_block_cache);
-
-@@ -2881,6 +2965,7 @@ qcow2_co_invalidate_cache(BlockDriverState *bs, Error **errp)
- s->data_file = data_file;
- /* Re-initialize objects initialized in qcow2_open() */
- qemu_co_mutex_init(&s->lock);
-+ qemu_co_queue_init(&s->cache_clean_timer_exit);
-
- options = qdict_clone_shallow(bs->options);
-
-diff --git a/block/qcow2.h b/block/qcow2.h
-index a9e3481c6e..3e38bccd87 100644
---- a/block/qcow2.h
-+++ b/block/qcow2.h
-@@ -345,8 +345,11 @@ typedef struct BDRVQcow2State {
-
- Qcow2Cache *l2_table_cache;
- Qcow2Cache *refcount_block_cache;
-- QEMUTimer *cache_clean_timer;
-+ /* Non-NULL while the timer is running */
-+ Coroutine *cache_clean_timer_co;
- unsigned cache_clean_interval;
-+ QemuCoSleep cache_clean_timer_wake;
-+ CoQueue cache_clean_timer_exit;
-
- QLIST_HEAD(, QCowL2Meta) cluster_allocs;
-
---
-2.47.3
-
diff --git a/kvm-qcow2-Fix-corruption-on-discard-during-write-with-CO.patch b/kvm-qcow2-Fix-corruption-on-discard-during-write-with-CO.patch
deleted file mode 100644
index d62a04d..0000000
--- a/kvm-qcow2-Fix-corruption-on-discard-during-write-with-CO.patch
+++ /dev/null
@@ -1,162 +0,0 @@
-From 21a26a72ecde7527ece5fdef3ba23f10084fd43d Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Sat, 13 Jun 2026 23:03:37 +0300
-Subject: [PATCH 49/52] qcow2: Fix corruption on discard during write with COW
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [42/45] 5569e7b55c4b1c45632b64057b774a4523c23ac1 (kmwolf/centos-qemu-kvm)
-
-Most code in qcow2 that accesses (and potentially modifies) L2 tables
-does so while holding s->lock.
-
-There is one exception, which is allocating writes. They hold the lock
-initially while allocating clusters, but drop it for writing the guest
-payload before taking the lock again for updating the L2 tables. This
-allows concurrent requests that touch other parts of the image file to
-continue in parallel and is an important performance optimisation.
-
-However, this means that other requests that run while the lock is
-dropped for writing guest data must synchronise with the list of
-allocating requests in s->cluster_allocs and wait if they would overlap.
-For writes, this is done in handle_dependencies(), but discard and write
-zeros operations neglect to synchronise with s->cluster_allocs.
-
-This means that discard can free a cluster whose L2 entry will already
-be modified in qcow2_alloc_cluster_link_l2() by a previously started
-write. In the case of a pre-allocated zero cluster that is in the
-process of being overwritten, this means that discard can lead to a
-situation where the cluster is still mapped (because the write will
-restore the L2 entry just without the zero flag), but its refcount has
-been decreased, resulting in a corrupted image.
-
-Add the missing synchronisation to qcow2_cluster_discard() and
-qcow2_subcluster_zeroize() to fix the problem.
-
-Cc: qemu-stable@nongnu.org
-Reported-by: Denis V. Lunev <den@openvz.org>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260427170520.101242-4-kwolf@redhat.com>
-Reviewed-by: Denis V. Lunev <den@openvz.org>
-Tested-by: Denis V. Lunev <den@openvz.org>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit b8bfb1478d61512f851badd0d912c6661a2efee7)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-
-Message-ID: <20260613200411.1808021-54-mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/qcow2-cluster.c | 52 ++++++++++++++++++++++++++++++++++++++++---
- 1 file changed, 49 insertions(+), 3 deletions(-)
-
-diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
-index ce8c0076b3..c20011d34c 100644
---- a/block/qcow2-cluster.c
-+++ b/block/qcow2-cluster.c
-@@ -1392,6 +1392,9 @@ count_single_write_clusters(BlockDriverState *bs, int nb_clusters,
- * the same cluster. In this case we need to wait until the previous
- * request has completed and updated the L2 table accordingly.
- *
-+ * If allow_shortening == true, instead of waiting for a dependency, *cur_bytes
-+ * can be shortened so that the cluster allocations don't overlap.
-+ *
- * Returns:
- * 0 if there was no dependency. *cur_bytes indicates the number of
- * bytes from guest_offset that can be read before the next
-@@ -1403,7 +1406,9 @@ count_single_write_clusters(BlockDriverState *bs, int nb_clusters,
- */
- static int coroutine_fn handle_dependencies(BlockDriverState *bs,
- uint64_t guest_offset,
-- uint64_t *cur_bytes, QCowL2Meta **m)
-+ uint64_t *cur_bytes,
-+ bool allow_shortening,
-+ QCowL2Meta **m)
- {
- BDRVQcow2State *s = bs->opaque;
- QCowL2Meta *old_alloc;
-@@ -1434,7 +1439,7 @@ static int coroutine_fn handle_dependencies(BlockDriverState *bs,
-
- /* Conflict */
-
-- if (start < old_start) {
-+ if (start < old_start && allow_shortening) {
- /* Stop at the start of a running allocation */
- bytes = old_start - start;
- } else {
-@@ -1469,6 +1474,29 @@ static int coroutine_fn handle_dependencies(BlockDriverState *bs,
- return 0;
- }
-
-+static void coroutine_mixed_fn wait_for_dependencies(BlockDriverState *bs,
-+ uint64_t guest_offset,
-+ uint64_t bytes)
-+{
-+ BDRVQcow2State *s = bs->opaque;
-+ QCowL2Meta *m = NULL;
-+ int ret;
-+
-+ /*
-+ * Discard has some non-coroutine callers (creating internal snapshots and
-+ * make empty). They are calling from qemu-img or in a drained section, so
-+ * we know that no writes can be in progress.
-+ */
-+ if (!qemu_in_coroutine()) {
-+ assert(QLIST_EMPTY(&s->cluster_allocs));
-+ return;
-+ }
-+
-+ do {
-+ ret = handle_dependencies(bs, guest_offset, &bytes, false, &m);
-+ } while (ret == -EAGAIN);
-+}
-+
- /*
- * Checks how many already allocated clusters that don't require a new
- * allocation there are at the given guest_offset (up to *bytes).
-@@ -1840,7 +1868,7 @@ again:
- * the right synchronisation between the in-flight request and
- * the new one.
- */
-- ret = handle_dependencies(bs, start, &cur_bytes, m);
-+ ret = handle_dependencies(bs, start, &cur_bytes, true, m);
- if (ret == -EAGAIN) {
- /* Currently handle_dependencies() doesn't yield if we already had
- * an allocation. If it did, we would have to clean up the L2Meta
-@@ -2002,6 +2030,15 @@ int qcow2_cluster_discard(BlockDriverState *bs, uint64_t offset,
- int64_t cleared;
- int ret;
-
-+ /*
-+ * If we're touching a cluster for which allocating writes are in flight,
-+ * wait for them to complete to avoid conflicting metadata updates.
-+ *
-+ * We don't need to allocate a QCowL2Meta for the discard operation because
-+ * s->lock is held for the duration of the whole operation.
-+ */
-+ wait_for_dependencies(bs, offset, bytes);
-+
- /* Caller must pass aligned values, except at image end */
- assert(QEMU_IS_ALIGNED(offset, s->cluster_size));
- assert(QEMU_IS_ALIGNED(end_offset, s->cluster_size) ||
-@@ -2164,6 +2201,15 @@ int coroutine_fn qcow2_subcluster_zeroize(BlockDriverState *bs, uint64_t offset,
- int64_t cleared;
- int ret;
-
-+ /*
-+ * If we're touching a cluster for which allocating writes are in flight,
-+ * wait for them to complete to avoid conflicting metadata updates.
-+ *
-+ * We don't need to allocate a QCowL2Meta for the zeroize operation because
-+ * s->lock is held for the duration of the whole operation.
-+ */
-+ wait_for_dependencies(bs, offset, bytes);
-+
- /* If we have to stay in sync with an external data file, zero out
- * s->data_file first. */
- if (data_file_is_raw(bs)) {
---
-2.52.0
-
diff --git a/kvm-qcow2-Fix-data-loss-on-zero-write-with-detect-zeroes.patch b/kvm-qcow2-Fix-data-loss-on-zero-write-with-detect-zeroes.patch
deleted file mode 100644
index f94c11d..0000000
--- a/kvm-qcow2-Fix-data-loss-on-zero-write-with-detect-zeroes.patch
+++ /dev/null
@@ -1,205 +0,0 @@
-From aff7b26c2a2ad0c78e403a572a5cca52e1f2774e Mon Sep 17 00:00:00 2001
-From: Thomas Lamprecht <t.lamprecht@proxmox.com>
-Date: Sat, 13 Jun 2026 23:03:39 +0300
-Subject: [PATCH 51/52] qcow2: Fix data loss on zero write with
- detect-zeroes=unmap
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [44/45] 0d2cddb6cdde22f5842aeca19fcab691230f50c8 (kmwolf/centos-qemu-kvm)
-
-Commit b8bfb1478d ("qcow2: Fix corruption on discard during write with
-COW") added a wait_for_dependencies() at the start of
-qcow2_subcluster_zeroize(). That fixes the inconsistency it set out to
-fix, but turns the lock-protected pre-check in the caller,
-qcow2_co_pwrite_zeroes(), into a stale one: the wait yields s->lock,
-so an in-flight allocating write whose QCowL2Meta is already on
-s->cluster_allocs (but whose L2 entry is not yet linked) gets to link
-its entry during the yield. When the zeroize wakes, the cluster is now
-NORMAL, and with BDRV_REQ_MAY_UNMAP the free path in zero_in_l2_slice()
-unmaps the just-written cluster, silently dropping the data write's
-payload.
-
-This is reachable with detect-zeroes=unmap (the default for VirtIO
-disks with discard on in Proxmox VE), under which the block layer
-auto-promotes all-zero buffers to BDRV_REQ_ZERO_WRITE |
-BDRV_REQ_MAY_UNMAP. A memory-constrained Debian guest running 'apt
-full-upgrade' on such a disk reproduces it as random SIGSEGVs:
-swapped-out code pages come back as zero.
-
-Wait for in-flight dependencies before the lock-protected check in
-qcow2_co_pwrite_zeroes(). If a write linked its L2 entry during the
-wait, the type check now fails and the block layer falls back to a
-bounce-buffered zero write that only touches the requested subrange,
-preserving the racing write's data. Promote wait_for_dependencies() to
-qcow2_wait_for_dependencies() so qcow2.c can call it.
-
-Fixes: b8bfb1478d ("qcow2: Fix corruption on discard during write with COW")
-Fixes: d85e00dd03 ("qcow2: Fix corruption on discard during write with COW") in 10.2.x series
-Cc: qemu-stable@nongnu.org
-Tested-by: Fiona Ebner <f.ebner@proxmox.com>
-Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
-Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
-Message-ID: <20260522151318.238064-1-t.lamprecht@proxmox.com>
-[kwolf: Reverted unnecessary change to 'nr' assignment]
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 1d47eb68983577a4e06fe1c165d90e128b191b86)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-
-Message-ID: <20260613200411.1808021-56-mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/qcow2-cluster.c | 10 +++++-----
- block/qcow2.c | 8 +++++++-
- block/qcow2.h | 4 ++++
- tests/qemu-iotests/046 | 23 +++++++++++++++++++++++
- tests/qemu-iotests/046.out | 10 ++++++++++
- 5 files changed, 49 insertions(+), 6 deletions(-)
-
-diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
-index c20011d34c..23eeb9fc56 100644
---- a/block/qcow2-cluster.c
-+++ b/block/qcow2-cluster.c
-@@ -1474,9 +1474,9 @@ static int coroutine_fn handle_dependencies(BlockDriverState *bs,
- return 0;
- }
-
--static void coroutine_mixed_fn wait_for_dependencies(BlockDriverState *bs,
-- uint64_t guest_offset,
-- uint64_t bytes)
-+void coroutine_mixed_fn qcow2_wait_for_dependencies(BlockDriverState *bs,
-+ uint64_t guest_offset,
-+ uint64_t bytes)
- {
- BDRVQcow2State *s = bs->opaque;
- QCowL2Meta *m = NULL;
-@@ -2037,7 +2037,7 @@ int qcow2_cluster_discard(BlockDriverState *bs, uint64_t offset,
- * We don't need to allocate a QCowL2Meta for the discard operation because
- * s->lock is held for the duration of the whole operation.
- */
-- wait_for_dependencies(bs, offset, bytes);
-+ qcow2_wait_for_dependencies(bs, offset, bytes);
-
- /* Caller must pass aligned values, except at image end */
- assert(QEMU_IS_ALIGNED(offset, s->cluster_size));
-@@ -2208,7 +2208,7 @@ int coroutine_fn qcow2_subcluster_zeroize(BlockDriverState *bs, uint64_t offset,
- * We don't need to allocate a QCowL2Meta for the zeroize operation because
- * s->lock is held for the duration of the whole operation.
- */
-- wait_for_dependencies(bs, offset, bytes);
-+ qcow2_wait_for_dependencies(bs, offset, bytes);
-
- /* If we have to stay in sync with an external data file, zero out
- * s->data_file first. */
-diff --git a/block/qcow2.c b/block/qcow2.c
-index a6adfa9f84..0f9818528d 100644
---- a/block/qcow2.c
-+++ b/block/qcow2.c
-@@ -4183,10 +4183,16 @@ qcow2_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int64_t bytes,
- }
-
- qemu_co_mutex_lock(&s->lock);
-- /* We can have new write after previous check */
- offset -= head;
- bytes = s->subcluster_size;
- nr = s->subcluster_size;
-+ /*
-+ * Wait for in-flight allocating writes first: otherwise the type
-+ * check below could pass on UNALLOCATED while a yet-to-link_l2 write
-+ * completes during qcow2_subcluster_zeroize()'s own wait, letting the
-+ * resumed MAY_UNMAP discard the just-written data.
-+ */
-+ qcow2_wait_for_dependencies(bs, offset, bytes);
- ret = qcow2_get_host_offset(bs, offset, &nr, &off, &type);
- if (ret < 0 ||
- (type != QCOW2_SUBCLUSTER_UNALLOCATED_PLAIN &&
-diff --git a/block/qcow2.h b/block/qcow2.h
-index 3e38bccd87..26fe12ab2a 100644
---- a/block/qcow2.h
-+++ b/block/qcow2.h
-@@ -961,6 +961,10 @@ int coroutine_fn GRAPH_RDLOCK
- qcow2_subcluster_zeroize(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
- int flags);
-
-+void coroutine_mixed_fn
-+qcow2_wait_for_dependencies(BlockDriverState *bs, uint64_t guest_offset,
-+ uint64_t bytes);
-+
- int GRAPH_RDLOCK
- qcow2_expand_zero_clusters(BlockDriverState *bs,
- BlockDriverAmendStatusCB *status_cb,
-diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046
-index e03dd40147..0d84b5c1c7 100755
---- a/tests/qemu-iotests/046
-+++ b/tests/qemu-iotests/046
-@@ -226,6 +226,26 @@ aio_write -z 0x140000 0x10000
- resume A
- aio_flush
- EOF
-+
-+# Start an allocating write to a previously unallocated cluster and, before
-+# its L2 update is linked, issue a concurrent sub-cluster zero write with
-+# MAY_UNMAP that targets a disjoint range within the same cluster. The zero
-+# write's head/tail are zero (cluster is unallocated), so qcow2_co_pwrite_zeroes
-+# would expand it to the full subcluster. Without waiting for dependencies
-+# before the zero write's "unallocated" type check, that check passes,
-+# qcow2_subcluster_zeroize then yields in wait_for_dependencies, the allocating
-+# write links its L2 entry, and the resumed zeroize unmaps the cluster -
-+# silently discarding the just-written data. Waiting first makes the zero write
-+# fall back to a bounce-buffered real write, which only touches its own
-+# subrange.
-+cat <<EOF
-+break write_aio A
-+aio_write -P 180 0x200000 0x4000
-+wait_break A
-+aio_write -z -u 0x204000 0x4000
-+resume A
-+aio_flush
-+EOF
- }
-
- overlay_io | $QEMU_IO blkdebug::"$TEST_IMG" | _filter_qemu_io |\
-@@ -310,6 +330,9 @@ verify_io()
- echo read -P 0 0x120000 0x10000
- echo read -P 0 0x130000 0x10000
- echo read -P 0 0x140000 0x10000
-+
-+ echo read -P 180 0x200000 0x4000
-+ echo read -P 0 0x204000 0xc000
- }
-
- verify_io | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
-diff --git a/tests/qemu-iotests/046.out b/tests/qemu-iotests/046.out
-index 6341df335c..137cf527f1 100644
---- a/tests/qemu-iotests/046.out
-+++ b/tests/qemu-iotests/046.out
-@@ -169,6 +169,12 @@ wrote XXX/XXX bytes at offset XXX
- XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
- wrote XXX/XXX bytes at offset XXX
- XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+blkdebug: Suspended request 'A'
-+blkdebug: Resuming request 'A'
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+wrote XXX/XXX bytes at offset XXX
-+XXX KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-
- == Verify image content ==
- read 65536/65536 bytes at offset 0
-@@ -275,5 +281,9 @@ read 65536/65536 bytes at offset 1245184
- 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
- read 65536/65536 bytes at offset 1310720
- 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+read 16384/16384 bytes at offset 2097152
-+16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+read 49152/49152 bytes at offset 2113536
-+48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
- No errors were found on the image.
- *** done
---
-2.52.0
-
diff --git a/kvm-qcow2-Re-initialize-lock-in-invalidate_cache.patch b/kvm-qcow2-Re-initialize-lock-in-invalidate_cache.patch
deleted file mode 100644
index 738ae4a..0000000
--- a/kvm-qcow2-Re-initialize-lock-in-invalidate_cache.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From cfe4b6407a08b56490c3cadd4e01f810fb22070c Mon Sep 17 00:00:00 2001
-From: Hanna Czenczek <hreitz@redhat.com>
-Date: Mon, 10 Nov 2025 16:48:46 +0100
-Subject: [PATCH 04/19] qcow2: Re-initialize lock in invalidate_cache
-
-RH-Author: Hanna Czenczek <hreitz@redhat.com>
-RH-MergeRequest: 454: Multithreading fixes for rbd, curl, qcow2
-RH-Jira: RHEL-79118
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [4/5] 48ead2f35d8558fda48a2098240c0203f4c547b0 (hreitz/qemu-kvm-c-9-s)
-
-After clearing our state (memset()-ing it to 0), we should
-re-initialize objects that need it. Specifically, that applies to
-s->lock, which is originally initialized in qcow2_open().
-
-Given qemu_co_mutex_init() is just a memset() to 0, this is functionally
-a no-op, but still seems like the right thing to do.
-
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-Message-ID: <20251110154854.151484-12-hreitz@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 90db3a1721b30daf839901813616c0854f383cc5)
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
----
- block/qcow2.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/block/qcow2.c b/block/qcow2.c
-index 6df65aab93..374ca53829 100644
---- a/block/qcow2.c
-+++ b/block/qcow2.c
-@@ -2879,6 +2879,8 @@ qcow2_co_invalidate_cache(BlockDriverState *bs, Error **errp)
- data_file = s->data_file;
- memset(s, 0, sizeof(BDRVQcow2State));
- s->data_file = data_file;
-+ /* Re-initialize objects initialized in qcow2_open() */
-+ qemu_co_mutex_init(&s->lock);
-
- options = qdict_clone_shallow(bs->options);
-
---
-2.47.3
-
diff --git a/kvm-qdev-Add-a-SsidSizeMode-property-type.patch b/kvm-qdev-Add-a-SsidSizeMode-property-type.patch
deleted file mode 100644
index f2a11f1..0000000
--- a/kvm-qdev-Add-a-SsidSizeMode-property-type.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From 5f0546d421450aede89b929920c3963a83573e13 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Tue, 24 Mar 2026 14:02:29 +0000
-Subject: [PATCH 060/111] qdev: Add a SsidSizeMode property type
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [60/111] 907950d10709af8ef5016c7325cdc232b1a39996 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-160190
-
-Introduce a new enum type property allowing to set a Substream ID size
-for HW-accelerated smmuv3. Values are auto and 0..20. The auto value
-allows SSID size property to be derived from host IOMMU capabilities.
-A value of 0 disables SubstreamID, while non-zero values specify the
-SSID size in bits.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Acked-by: Markus Armbruster <armbru@redhat.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Message-id: 20260323182454.1416110-5-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 3a3dd64e63dc772f6067d8215b7add7474e6a3e5)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/core/qdev-properties-system.c | 14 ++++++++++++++
- include/hw/qdev-properties-system.h | 3 +++
- qapi/misc-arm.json | 16 ++++++++++++++++
- qapi/pragma.json | 1 +
- 4 files changed, 34 insertions(+)
-
-diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
-index 1f810b7ddf..67b3ce3a16 100644
---- a/hw/core/qdev-properties-system.c
-+++ b/hw/core/qdev-properties-system.c
-@@ -18,6 +18,7 @@
- #include "qapi/qapi-types-block.h"
- #include "qapi/qapi-types-machine.h"
- #include "qapi/qapi-types-migration.h"
-+#include "qapi/qapi-types-misc-arm.h"
- #include "qapi/qapi-visit-virtio.h"
- #include "qapi/qmp/qerror.h"
- #include "qemu/ctype.h"
-@@ -723,6 +724,19 @@ const PropertyInfo qdev_prop_zero_page_detection = {
- .set_default_value = qdev_propinfo_set_default_value_enum,
- };
-
-+/* --- SsidSizeMode --- */
-+
-+QEMU_BUILD_BUG_ON(sizeof(SsidSizeMode) != sizeof(int));
-+
-+const PropertyInfo qdev_prop_ssidsize_mode = {
-+ .type = "SsidSizeMode",
-+ .description = "ssidsize mode: auto, 0-20",
-+ .enum_table = &SsidSizeMode_lookup,
-+ .get = qdev_propinfo_get_enum,
-+ .set = qdev_propinfo_set_enum,
-+ .set_default_value = qdev_propinfo_set_default_value_enum,
-+};
-+
- /* --- Reserved Region --- */
-
- /*
-diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properties-system.h
-index 9601a11a09..7f9bcf59f2 100644
---- a/include/hw/qdev-properties-system.h
-+++ b/include/hw/qdev-properties-system.h
-@@ -13,6 +13,7 @@ extern const PropertyInfo qdev_prop_multifd_compression;
- extern const PropertyInfo qdev_prop_mig_mode;
- extern const PropertyInfo qdev_prop_granule_mode;
- extern const PropertyInfo qdev_prop_zero_page_detection;
-+extern const PropertyInfo qdev_prop_ssidsize_mode;
- extern const PropertyInfo qdev_prop_losttickpolicy;
- extern const PropertyInfo qdev_prop_blockdev_on_error;
- extern const PropertyInfo qdev_prop_bios_chs_trans;
-@@ -60,6 +61,8 @@ extern const PropertyInfo qdev_prop_virtio_gpu_output_list;
- #define DEFINE_PROP_ZERO_PAGE_DETECTION(_n, _s, _f, _d) \
- DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_zero_page_detection, \
- ZeroPageDetection)
-+#define DEFINE_PROP_SSIDSIZE_MODE(_n, _s, _f, _d) \
-+ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_ssidsize_mode, SsidSizeMode)
- #define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \
- DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \
- LostTickPolicy)
-diff --git a/qapi/misc-arm.json b/qapi/misc-arm.json
-index f921d740f1..416b4240e2 100644
---- a/qapi/misc-arm.json
-+++ b/qapi/misc-arm.json
-@@ -45,3 +45,19 @@
- # { "version": 3, "emulated": false, "kernel": true } ] }
- ##
- { 'command': 'query-gic-capabilities', 'returns': ['GICCapability'] }
-+
-+##
-+# @SsidSizeMode:
-+#
-+# SMMUv3 SubstreamID size configuration mode.
-+#
-+# @auto: derive from host IOMMU capabilities
-+#
-+# Values 0-20: SSIDSIZE value in bits. 0 disables SubstreamID.
-+#
-+# Since: 11.0
-+##
-+{ 'enum': 'SsidSizeMode',
-+ 'data': [ 'auto', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-+ '10', '11', '12', '13', '14', '15', '16', '17', '18',
-+ '19', '20' ] } # order matters, see ssidsize_mode_to_value()
-diff --git a/qapi/pragma.json b/qapi/pragma.json
-index 023a2ef7bc..5ad4487147 100644
---- a/qapi/pragma.json
-+++ b/qapi/pragma.json
-@@ -67,6 +67,7 @@
- 'S390CpuEntitlement',
- 'S390CpuPolarization',
- 'S390CpuState',
-+ 'SsidSizeMode',
- 'String',
- 'StringWrapper',
- 'SysEmuTarget',
---
-2.52.0
-
diff --git a/kvm-qdev-Add-an-OasMode-property-type.patch b/kvm-qdev-Add-an-OasMode-property-type.patch
deleted file mode 100644
index c489bc8..0000000
--- a/kvm-qdev-Add-an-OasMode-property-type.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-From e61bd5408af80f3150d8508954a837582a32f3aa Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Tue, 24 Mar 2026 14:02:29 +0000
-Subject: [PATCH 062/111] qdev: Add an OasMode property type
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [62/111] c760b42d4840853231ecc1e85f7e0f514a53686d (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-160190
-
-Introduce a new enum type property allowing to set an Output Address
-Size. Values are auto, 32, 36, 40, 42, 44, 48, 52, and 56, where a
-value of N specifies an N-bit OAS.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Acked-by: Markus Armbruster <armbru@redhat.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Message-id: 20260323182454.1416110-7-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit d3d2de3d227b63db5715fcaa89df388c929c7aba)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/core/qdev-properties-system.c | 13 +++++++++++++
- include/hw/qdev-properties-system.h | 3 +++
- qapi/misc-arm.json | 28 ++++++++++++++++++++++++++++
- 3 files changed, 44 insertions(+)
-
-diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
-index 67b3ce3a16..93b2c58ebe 100644
---- a/hw/core/qdev-properties-system.c
-+++ b/hw/core/qdev-properties-system.c
-@@ -737,6 +737,19 @@ const PropertyInfo qdev_prop_ssidsize_mode = {
- .set_default_value = qdev_propinfo_set_default_value_enum,
- };
-
-+/* --- OasMode --- */
-+
-+QEMU_BUILD_BUG_ON(sizeof(OasMode) != sizeof(int));
-+
-+const PropertyInfo qdev_prop_oas_mode = {
-+ .type = "OasMode",
-+ .description = "oas mode: auto, 32, 36, 40, 42, 44, 48, 52, 56",
-+ .enum_table = &OasMode_lookup,
-+ .get = qdev_propinfo_get_enum,
-+ .set = qdev_propinfo_set_enum,
-+ .set_default_value = qdev_propinfo_set_default_value_enum,
-+};
-+
- /* --- Reserved Region --- */
-
- /*
-diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properties-system.h
-index 7f9bcf59f2..153803c34a 100644
---- a/include/hw/qdev-properties-system.h
-+++ b/include/hw/qdev-properties-system.h
-@@ -14,6 +14,7 @@ extern const PropertyInfo qdev_prop_mig_mode;
- extern const PropertyInfo qdev_prop_granule_mode;
- extern const PropertyInfo qdev_prop_zero_page_detection;
- extern const PropertyInfo qdev_prop_ssidsize_mode;
-+extern const PropertyInfo qdev_prop_oas_mode;
- extern const PropertyInfo qdev_prop_losttickpolicy;
- extern const PropertyInfo qdev_prop_blockdev_on_error;
- extern const PropertyInfo qdev_prop_bios_chs_trans;
-@@ -63,6 +64,8 @@ extern const PropertyInfo qdev_prop_virtio_gpu_output_list;
- ZeroPageDetection)
- #define DEFINE_PROP_SSIDSIZE_MODE(_n, _s, _f, _d) \
- DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_ssidsize_mode, SsidSizeMode)
-+#define DEFINE_PROP_OAS_MODE(_n, _s, _f, _d) \
-+ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_oas_mode, OasMode)
- #define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \
- DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \
- LostTickPolicy)
-diff --git a/qapi/misc-arm.json b/qapi/misc-arm.json
-index 416b4240e2..4dc66d00e5 100644
---- a/qapi/misc-arm.json
-+++ b/qapi/misc-arm.json
-@@ -61,3 +61,31 @@
- 'data': [ 'auto', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
- '10', '11', '12', '13', '14', '15', '16', '17', '18',
- '19', '20' ] } # order matters, see ssidsize_mode_to_value()
-+
-+##
-+# @OasMode:
-+#
-+# SMMUv3 Output Address Size configuration mode.
-+#
-+# @auto: derive from host IOMMU capabilities
-+#
-+# @32: 32-bit output address size
-+#
-+# @36: 36-bit output address size
-+#
-+# @40: 40-bit output address size
-+#
-+# @42: 42-bit output address size
-+#
-+# @44: 44-bit output address size
-+#
-+# @48: 48-bit output address size
-+#
-+# @52: 52-bit output address size
-+#
-+# @56: 56-bit output address size
-+#
-+# Since: 11.0
-+##
-+{ 'enum': 'OasMode',
-+ 'data': [ 'auto', '32', '36', '40', '42', '44', '48', '52', '56' ] }
---
-2.52.0
-
diff --git a/kvm-qdev-Free-property-array-on-release.patch b/kvm-qdev-Free-property-array-on-release.patch
deleted file mode 100644
index 67c9bf9..0000000
--- a/kvm-qdev-Free-property-array-on-release.patch
+++ /dev/null
@@ -1,291 +0,0 @@
-From 97363c23acaa88f3a96e97fe7617496a3c48bc09 Mon Sep 17 00:00:00 2001
-From: Chandan Somani <csomani@redhat.com>
-Date: Thu, 8 Jan 2026 15:03:07 -0800
-Subject: [PATCH 2/2] qdev: Free property array on release
-
-RH-Author: Chandan Somani <None>
-RH-MergeRequest: 467: block: enable stats-intervals for storage devices
-RH-Jira: RHEL-114231
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
-RH-Commit: [2/2] f8b9e42543653e5a724175b73f25fa02593ff79d (csomani1/qemu-kvm)
-
-Before this patch, users of the property array would free the
-array themselves in their cleanup functions. This causes
-inconsistencies where some users leak the array and some free them.
-
-This patch makes it so that the property array's release function
-frees the property array (instead of just its elements). It fixes any
-leaks and requires less code.
-
-DEFINE_PROP_ARRAY leakers that are fixed in this patch:
-ebpf-rss_fds in hw/net/virtio-net.c
-rnmi_irqvec, rnmi_excpvec in hw/riscv/riscv_hart.c
-common.display_modes in hw/display/apple-gfx-mmio.m
-common.display_modes in hw/display/apple-gfx-pci.m
-
-Signed-off-by: Chandan Somani <csomani@redhat.com>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Link: https://lore.kernel.org/r/20260108230311.584141-2-csomani@redhat.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
----
- block/accounting.c | 1 -
- hw/core/qdev-properties.c | 21 ++++++++++-----------
- hw/input/stellaris_gamepad.c | 8 --------
- hw/intc/arm_gicv3_common.c | 8 --------
- hw/intc/rx_icu.c | 8 --------
- hw/misc/arm_sysctl.c | 2 --
- hw/misc/mps2-scc.c | 8 --------
- hw/net/rocker/rocker.c | 1 -
- hw/nvram/xlnx-efuse.c | 8 --------
- hw/nvram/xlnx-versal-efuse-ctrl.c | 1 -
- hw/virtio/virtio-iommu-pci.c | 8 --------
- 11 files changed, 10 insertions(+), 64 deletions(-)
-
-diff --git a/block/accounting.c b/block/accounting.c
-index 0933c61f3a..5cf51f029b 100644
---- a/block/accounting.c
-+++ b/block/accounting.c
-@@ -73,7 +73,6 @@ bool block_acct_setup(BlockAcctStats *stats, enum OnOffAuto account_invalid,
- }
- block_acct_add_interval(stats, stats_intervals[i]);
- }
-- g_free(stats_intervals);
- }
- return true;
- }
-diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
-index b7e8a89ba5..0449226e00 100644
---- a/hw/core/qdev-properties.c
-+++ b/hw/core/qdev-properties.c
-@@ -671,10 +671,8 @@ static Property array_elem_prop(Object *obj, const Property *parent_prop,
-
- /*
- * Object property release callback for array properties: We call the
-- * underlying element's property release hook for each element.
-- *
-- * Note that it is the responsibility of the individual device's deinit
-- * to free the array proper.
-+ * underlying element's property release hook for each element and free the
-+ * property array.
- */
- static void release_prop_array(Object *obj, const char *name, void *opaque)
- {
-@@ -684,15 +682,16 @@ static void release_prop_array(Object *obj, const char *name, void *opaque)
- char *elem = *arrayptr;
- int i;
-
-- if (!prop->arrayinfo->release) {
-- return;
-+ if (prop->arrayinfo->release) {
-+ for (i = 0; i < *alenptr; i++) {
-+ Property elem_prop = array_elem_prop(obj, prop, name, elem);
-+ prop->arrayinfo->release(obj, NULL, &elem_prop);
-+ elem += prop->arrayfieldsize;
-+ }
- }
-
-- for (i = 0; i < *alenptr; i++) {
-- Property elem_prop = array_elem_prop(obj, prop, name, elem);
-- prop->arrayinfo->release(obj, NULL, &elem_prop);
-- elem += prop->arrayfieldsize;
-- }
-+ g_clear_pointer(arrayptr, g_free);
-+ *alenptr = 0;
- }
-
- /*
-diff --git a/hw/input/stellaris_gamepad.c b/hw/input/stellaris_gamepad.c
-index fec1161c9c..207064dacb 100644
---- a/hw/input/stellaris_gamepad.c
-+++ b/hw/input/stellaris_gamepad.c
-@@ -63,13 +63,6 @@ static void stellaris_gamepad_realize(DeviceState *dev, Error **errp)
- qemu_input_handler_register(dev, &stellaris_gamepad_handler);
- }
-
--static void stellaris_gamepad_finalize(Object *obj)
--{
-- StellarisGamepad *s = STELLARIS_GAMEPAD(obj);
--
-- g_free(s->keycodes);
--}
--
- static void stellaris_gamepad_reset_enter(Object *obj, ResetType type)
- {
- StellarisGamepad *s = STELLARIS_GAMEPAD(obj);
-@@ -98,7 +91,6 @@ static const TypeInfo stellaris_gamepad_info[] = {
- .name = TYPE_STELLARIS_GAMEPAD,
- .parent = TYPE_SYS_BUS_DEVICE,
- .instance_size = sizeof(StellarisGamepad),
-- .instance_finalize = stellaris_gamepad_finalize,
- .class_init = stellaris_gamepad_class_init,
- },
- };
-diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c
-index e438d8c042..4fc84741a8 100644
---- a/hw/intc/arm_gicv3_common.c
-+++ b/hw/intc/arm_gicv3_common.c
-@@ -488,13 +488,6 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp)
- s->itslist = g_ptr_array_new();
- }
-
--static void arm_gicv3_finalize(Object *obj)
--{
-- GICv3State *s = ARM_GICV3_COMMON(obj);
--
-- g_free(s->redist_region_count);
--}
--
- static void arm_gicv3_common_reset_hold(Object *obj, ResetType type)
- {
- GICv3State *s = ARM_GICV3_COMMON(obj);
-@@ -643,7 +636,6 @@ static const TypeInfo arm_gicv3_common_type = {
- .instance_size = sizeof(GICv3State),
- .class_size = sizeof(ARMGICv3CommonClass),
- .class_init = arm_gicv3_common_class_init,
-- .instance_finalize = arm_gicv3_finalize,
- .abstract = true,
- .interfaces = (const InterfaceInfo[]) {
- { TYPE_ARM_LINUX_BOOT_IF },
-diff --git a/hw/intc/rx_icu.c b/hw/intc/rx_icu.c
-index f8615527b7..85da0624f6 100644
---- a/hw/intc/rx_icu.c
-+++ b/hw/intc/rx_icu.c
-@@ -334,13 +334,6 @@ static void rxicu_init(Object *obj)
- sysbus_init_irq(d, &icu->_swi);
- }
-
--static void rxicu_fini(Object *obj)
--{
-- RXICUState *icu = RX_ICU(obj);
-- g_free(icu->map);
-- g_free(icu->init_sense);
--}
--
- static const VMStateDescription vmstate_rxicu = {
- .name = "rx-icu",
- .version_id = 1,
-@@ -382,7 +375,6 @@ static const TypeInfo rxicu_info = {
- .parent = TYPE_SYS_BUS_DEVICE,
- .instance_size = sizeof(RXICUState),
- .instance_init = rxicu_init,
-- .instance_finalize = rxicu_fini,
- .class_init = rxicu_class_init,
- };
-
-diff --git a/hw/misc/arm_sysctl.c b/hw/misc/arm_sysctl.c
-index 0f4e37cd47..e715ff9475 100644
---- a/hw/misc/arm_sysctl.c
-+++ b/hw/misc/arm_sysctl.c
-@@ -618,9 +618,7 @@ static void arm_sysctl_finalize(Object *obj)
- {
- arm_sysctl_state *s = ARM_SYSCTL(obj);
-
-- g_free(s->db_voltage);
- g_free(s->db_clock);
-- g_free(s->db_clock_reset);
- }
-
- static const Property arm_sysctl_properties[] = {
-diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c
-index a9a5d4a535..acb0f5773b 100644
---- a/hw/misc/mps2-scc.c
-+++ b/hw/misc/mps2-scc.c
-@@ -405,13 +405,6 @@ static void mps2_scc_realize(DeviceState *dev, Error **errp)
- s->oscclk = g_new0(uint32_t, s->num_oscclk);
- }
-
--static void mps2_scc_finalize(Object *obj)
--{
-- MPS2SCC *s = MPS2_SCC(obj);
--
-- g_free(s->oscclk_reset);
--}
--
- static bool cfg7_needed(void *opaque)
- {
- MPS2SCC *s = opaque;
-@@ -489,7 +482,6 @@ static const TypeInfo mps2_scc_info = {
- .parent = TYPE_SYS_BUS_DEVICE,
- .instance_size = sizeof(MPS2SCC),
- .instance_init = mps2_scc_init,
-- .instance_finalize = mps2_scc_finalize,
- .class_init = mps2_scc_class_init,
- };
-
-diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
-index cc49701dd3..cbc7bd3ed9 100644
---- a/hw/net/rocker/rocker.c
-+++ b/hw/net/rocker/rocker.c
-@@ -1429,7 +1429,6 @@ static void pci_rocker_uninit(PCIDevice *dev)
- world_free(r->worlds[i]);
- }
- }
-- g_free(r->fp_ports_peers);
- }
-
- static void rocker_reset(DeviceState *dev)
-diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c
-index 4c23f8b931..1875fdb953 100644
---- a/hw/nvram/xlnx-efuse.c
-+++ b/hw/nvram/xlnx-efuse.c
-@@ -224,13 +224,6 @@ static void efuse_realize(DeviceState *dev, Error **errp)
- }
- }
-
--static void efuse_finalize(Object *obj)
--{
-- XlnxEFuse *s = XLNX_EFUSE(obj);
--
-- g_free(s->ro_bits);
--}
--
- static void efuse_prop_set_drive(Object *obj, Visitor *v, const char *name,
- void *opaque, Error **errp)
- {
-@@ -288,7 +281,6 @@ static const TypeInfo efuse_info = {
- .name = TYPE_XLNX_EFUSE,
- .parent = TYPE_DEVICE,
- .instance_size = sizeof(XlnxEFuse),
-- .instance_finalize = efuse_finalize,
- .class_init = efuse_class_init,
- };
-
-diff --git a/hw/nvram/xlnx-versal-efuse-ctrl.c b/hw/nvram/xlnx-versal-efuse-ctrl.c
-index 9096219800..ec86a7d6e5 100644
---- a/hw/nvram/xlnx-versal-efuse-ctrl.c
-+++ b/hw/nvram/xlnx-versal-efuse-ctrl.c
-@@ -729,7 +729,6 @@ static void efuse_ctrl_finalize(Object *obj)
- XlnxVersalEFuseCtrl *s = XLNX_VERSAL_EFUSE_CTRL(obj);
-
- register_finalize_block(s->reg_array);
-- g_free(s->extra_pg0_lock_spec);
- }
-
- static const VMStateDescription vmstate_efuse_ctrl = {
-diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c
-index 8123c6f83a..9396b3c07e 100644
---- a/hw/virtio/virtio-iommu-pci.c
-+++ b/hw/virtio/virtio-iommu-pci.c
-@@ -94,18 +94,10 @@ static void virtio_iommu_pci_instance_init(Object *obj)
- TYPE_VIRTIO_IOMMU);
- }
-
--static void virtio_iommu_pci_instance_finalize(Object *obj)
--{
-- VirtIOIOMMUPCI *dev = VIRTIO_IOMMU_PCI(obj);
--
-- g_free(dev->vdev.prop_resv_regions);
--}
--
- static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = {
- .generic_name = TYPE_VIRTIO_IOMMU_PCI,
- .instance_size = sizeof(VirtIOIOMMUPCI),
- .instance_init = virtio_iommu_pci_instance_init,
-- .instance_finalize = virtio_iommu_pci_instance_finalize,
- .class_init = virtio_iommu_pci_class_init,
- };
-
---
-2.47.3
-
diff --git a/kvm-qed-Don-t-try-to-flush-during-incoming-migration.patch b/kvm-qed-Don-t-try-to-flush-during-incoming-migration.patch
deleted file mode 100644
index 6954e4f..0000000
--- a/kvm-qed-Don-t-try-to-flush-during-incoming-migration.patch
+++ /dev/null
@@ -1,160 +0,0 @@
-From 4ed80433ccb6c0009a23dd71159af596badec426 Mon Sep 17 00:00:00 2001
-From: Fabiano Rosas <farosas@suse.de>
-Date: Sat, 13 Jun 2026 23:03:40 +0300
-Subject: [PATCH 18/52] qed: Don't try to flush during incoming migration
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [11/45] 2a884395bec8d06c70656664d87fe03e6e7ba902 (kmwolf/centos-qemu-kvm)
-
-It's not possible to access the image file while there is an incoming
-migration in progress, the QEMU process doesn't hold any locks to the
-storage at this point so nodes are inactive. Attempting to flush leads
-to an assert at bdrv_co_write_req_prepare():
-
- assert(!(bs->open_flags & BDRV_O_INACTIVE))
-
-The issue is reproducible by running iotest 181 on a host under cpu
-load. The migration must coincide with the header already containing
-the QED_F_NEED_CHECK flag.
-
-The sequence of events is as follows, with the respective call stacks
-referenced below:
-
-During block device init, bdrv_qed_attach_aio_context() starts the
-'need_check' timer. The timer will not fire during incoming migration
-as it uses QEMU_CLOCK_VIRTUAL (to avoid this very issue, as the code
-comment indicates). (0)
-
-However, there's still bdrv_qed_drain_begin() which uses the fact that
-the timer is live to decide whether to start the
-qed_need_check_timer_entry() directly. (1)
-
-The qed_need_check_timer_entry() eventually calls into
-qed_write_header() -> bdrv_co_pwrite() leading to the assert. (2)
-
-Skip creating the 'need_check' timer whenever the image is inactive.
-
-The stacks:
-
-(0) == issues timer_mod ==
- #6 in qed_start_need_check_timer at ../block/qed.c:340
- #7 in bdrv_qed_attach_aio_context at ../block/qed.c:373
- #8 in bdrv_qed_do_open at ../block/qed.c:556
- #9 in bdrv_qed_open_entry at ../block/qed.c:582
- #10 in coroutine_trampoline at ../util/coroutine-ucontext.c:175
- #0 in qemu_coroutine_switch<+120> at ../util/coroutine-ucontext.c:321
- #1 in qemu_aio_coroutine_enter<+356> at ../util/qemu-coroutine.c:293
- #2 in aio_co_enter<+179> at ../util/async.c:710
- #3 in aio_co_wake<+53> at ../util/async.c:695
- #4 in thread_pool_co_cb<+47> at ../util/thread-pool.c:283
- #5 in thread_pool_completion_bh<+241> at ../util/thread-pool.c:202
- #6 in aio_bh_call<+109> at ../util/async.c:173
- #7 in aio_bh_poll<+299> at ../util/async.c:220
- #8 in aio_poll<+690> at ../util/aio-posix.c:745
- #9 in bdrv_qed_open<+392> at ../block/qed.c:607
- #10 in bdrv_open_driver<+327> at ../block.c:1678
- #11 in bdrv_open_common<+1619> at ../block.c:2008
- #12 in bdrv_open_inherit<+2556> at ../block.c:4191
- #13 in bdrv_open<+118> at ../block.c:4286
- #14 in blk_new_open<+199> at ../block/block-backend.c:458
- #15 in blockdev_init<+2011> at ../blockdev.c:612
- #16 in drive_new<+3008> at ../blockdev.c:1008
- #17 in drive_init_func<+51> at ../system/vl.c:662
- #18 in qemu_opts_foreach<+227> at ../util/qemu-option.c:1148
- #19 in configure_blockdev<+350> at ../system/vl.c:721
- #20 in qemu_create_early_backends<+343> at ../system/vl.c:2076
- #21 in qemu_init<+12483> at ../system/vl.c:3778
- #22 in main<+46> at ../system/main.c:71
-
-(1) == sees timer_pending ==
- #6 in bdrv_qed_drain_begin at ../block/qed.c:391
- #7 in bdrv_do_drained_begin at ../block/io.c:366
- #8 in bdrv_do_drained_begin_quiesce at ../block/io.c:386
- #9 in bdrv_child_cb_drained_begin at ../block.c:1207
- #10 in bdrv_parent_drained_begin_single at ../block/io.c:133
- #11 in bdrv_parent_drained_begin at ../block/io.c:64
- #12 in bdrv_do_drained_begin at ../block/io.c:364
- #13 in bdrv_drained_begin at ../block/io.c:393
- #14 in blk_drain at ../block/block-backend.c:2101
- #15 in blk_unref at ../block/block-backend.c:544
- #16 in bdrv_open_inherit at ../block.c:4197
- #17 in bdrv_open at ../block.c:4286
- #18 in blk_new_open at ../block/block-backend.c:458
- #19 in blockdev_init at ../blockdev.c:612
- #20 in drive_new at ../blockdev.c:1008
- #21 in drive_init_func at ../system/vl.c:662
- #22 in qemu_opts_foreach at ../util/qemu-option.c:1148
- #23 in configure_blockdev at ../system/vl.c:721
- #24 in qemu_create_early_backends at ../system/vl.c:2076
- #25 in qemu_init at ../system/vl.c:3778
- #26 in main at ../system/main.c:71
-
-(2) == crashes ==
- #5 in __assert_fail (assertion="!(bs->open_flags & BDRV_O_INACTIVE)", file="../block/io.c", line=1977
- #6 in bdrv_co_write_req_prepare at ../block/io.c:1977
- #7 in bdrv_aligned_pwritev at ../block/io.c:2099
- #8 in bdrv_co_pwritev_part at ../block/io.c:2316
- #9 in bdrv_co_pwritev at ../block/io.c:2233
- #10 in bdrv_co_pwrite at ../include/block/block_int-io.h:77
- #11 in qed_write_header at ../block/qed.c:128
- #12 in qed_need_check_timer at ../block/qed.c:305
- #13 in qed_need_check_timer_entry at ../block/qed.c:319
-
-Note that this issue is not exactly the same as what's been reported
-in Gitlab, but given how easily this reproduces, I imagine it has to
-be happening in that setup as well.
-
-Link: https://gitlab.com/qemu-project/qemu/-/work_items/3515
-Signed-off-by: Fabiano Rosas <farosas@suse.de>
-Message-ID: <20260603193813.2327596-1-farosas@suse.de>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 7e573b660fefdebd21cb755d0d34bb5942fd3af3)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-
-Message-ID: <20260613200411.1808021-57-mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/qed.c | 16 +++++++++++-----
- 1 file changed, 11 insertions(+), 5 deletions(-)
-
-diff --git a/block/qed.c b/block/qed.c
-index 4a36fb3929..917b8d91b5 100644
---- a/block/qed.c
-+++ b/block/qed.c
-@@ -351,16 +351,22 @@ static void bdrv_qed_detach_aio_context(BlockDriverState *bs)
- {
- BDRVQEDState *s = bs->opaque;
-
-- qed_cancel_need_check_timer(s);
-- timer_free(s->need_check_timer);
-- s->need_check_timer = NULL;
-+ if (s->need_check_timer) {
-+ qed_cancel_need_check_timer(s);
-+ timer_free(s->need_check_timer);
-+ s->need_check_timer = NULL;
-+ }
- }
-
--static void bdrv_qed_attach_aio_context(BlockDriverState *bs,
-- AioContext *new_context)
-+static void GRAPH_RDLOCK bdrv_qed_attach_aio_context(BlockDriverState *bs,
-+ AioContext *new_context)
- {
- BDRVQEDState *s = bs->opaque;
-
-+ if (bdrv_is_inactive(bs)) {
-+ return;
-+ }
-+
- s->need_check_timer = aio_timer_new(new_context,
- QEMU_CLOCK_VIRTUAL, SCALE_NS,
- qed_need_check_timer_cb, s);
---
-2.52.0
-
diff --git a/kvm-qemu-img-Fix-amend-option-parse-error-handling.patch b/kvm-qemu-img-Fix-amend-option-parse-error-handling.patch
deleted file mode 100644
index de2c975..0000000
--- a/kvm-qemu-img-Fix-amend-option-parse-error-handling.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From a0454a8af25172f3f1f0f6eacc3e07d9c2b077fe Mon Sep 17 00:00:00 2001
-From: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Date: Thu, 23 Oct 2025 17:10:58 +0900
-Subject: [PATCH 22/52] qemu-img: Fix amend option parse error handling
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [15/45] 07da070d4ecdcb1ad22761fe68038b85dc0d0a42 (kmwolf/centos-qemu-kvm)
-
-qemu_opts_del(opts) dereferences opts->list, which is the old amend_opts
-pointer that can be dangling after executing
-qemu_opts_append(amend_opts, bs->drv->create_opts) and cause
-use-after-free.
-
-Fix the potential use-after-free by moving the qemu_opts_del() call
-before the qemu_opts_append() call.
-
-Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Message-ID: <20251023-iotests-v1-1-fab143ca4c2f@rsg.ci.i.u-tokyo.ac.jp>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit f00bcc833790c72c08bc5eed97845fdaa7542507)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- qemu-img.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/qemu-img.c b/qemu-img.c
-index a7791896c1..7a32d2d16c 100644
---- a/qemu-img.c
-+++ b/qemu-img.c
-@@ -4597,9 +4597,9 @@ static int img_amend(const img_cmd_t *ccmd, int argc, char **argv)
- amend_opts = qemu_opts_append(amend_opts, bs->drv->amend_opts);
- opts = qemu_opts_create(amend_opts, NULL, 0, &error_abort);
- if (!qemu_opts_do_parse(opts, options, NULL, &err)) {
-+ qemu_opts_del(opts);
- /* Try to parse options using the create options */
- amend_opts = qemu_opts_append(amend_opts, bs->drv->create_opts);
-- qemu_opts_del(opts);
- opts = qemu_opts_create(amend_opts, NULL, 0, &error_abort);
- if (qemu_opts_do_parse(opts, options, NULL, NULL)) {
- error_append_hint(&err,
---
-2.52.0
-
diff --git a/kvm-qemu-img-info-Add-cache-mode-option.patch b/kvm-qemu-img-info-Add-cache-mode-option.patch
deleted file mode 100644
index c685595..0000000
--- a/kvm-qemu-img-info-Add-cache-mode-option.patch
+++ /dev/null
@@ -1,153 +0,0 @@
-From 67461afaa7e25c6a41cb542ecc1a2b8696d5489d Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Fri, 24 Oct 2025 14:30:40 +0200
-Subject: [PATCH 5/6] qemu-img info: Add cache mode option
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 439: block: Expose block limits in monitor and qemu-img info
-RH-Jira: RHEL-110003
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [4/4] 1d7c278d70f37528be71b31fe121cc531a13dde5 (kmwolf/centos-qemu-kvm)
-
-When querying block limits, different cache modes (in particular
-O_DIRECT or not) can result in different limits. Add an option to
-'qemu-img info' that allows the user to specify a cache mode, so that
-they can get the block limits for the cache mode they intend to use with
-their VM.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20251024123041.51254-5-kwolf@redhat.com>
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 911992fd6ec7a84c7cc82831b4bcd8a2ca5ccc76)
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- docs/tools/qemu-img.rst | 2 +-
- qemu-img-cmds.hx | 4 ++--
- qemu-img.c | 25 +++++++++++++++++++++----
- 3 files changed, 24 insertions(+), 7 deletions(-)
-
-diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst
-index fdc9ea9cf2..558b0eb84d 100644
---- a/docs/tools/qemu-img.rst
-+++ b/docs/tools/qemu-img.rst
-@@ -503,7 +503,7 @@ Command description:
-
- The size syntax is similar to :manpage:`dd(1)`'s size syntax.
-
--.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [--limits] [-U] FILENAME
-+.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [--limits] [-t CACHE] [-U] FILENAME
-
- Give information about the disk image *FILENAME*. Use it in
- particular to know the size reserved on disk which can be different
-diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
-index 74b66f9d42..6bc8265cfb 100644
---- a/qemu-img-cmds.hx
-+++ b/qemu-img-cmds.hx
-@@ -66,9 +66,9 @@ SRST
- ERST
-
- DEF("info", img_info,
-- "info [--object objectdef] [--image-opts] [-f fmt] [--output=ofmt] [--backing-chain] [--limits] [-U] filename")
-+ "info [--object objectdef] [--image-opts] [-f fmt] [--output=ofmt] [--backing-chain] [--limits] [-t CACHE] [-U] filename")
- SRST
--.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [--limits] [-U] FILENAME
-+.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [--limits] [-t CACHE] [-U] FILENAME
- ERST
-
- DEF("map", img_map,
-diff --git a/qemu-img.c b/qemu-img.c
-index 5cdbeda969..a7791896c1 100644
---- a/qemu-img.c
-+++ b/qemu-img.c
-@@ -3003,6 +3003,7 @@ static gboolean str_equal_func(gconstpointer a, gconstpointer b)
- static BlockGraphInfoList *collect_image_info_list(bool image_opts,
- const char *filename,
- const char *fmt,
-+ const char *cache,
- bool chain, bool limits,
- bool force_share)
- {
-@@ -3010,6 +3011,15 @@ static BlockGraphInfoList *collect_image_info_list(bool image_opts,
- BlockGraphInfoList **tail = &head;
- GHashTable *filenames;
- Error *err = NULL;
-+ int cache_flags = 0;
-+ bool writethrough = false;
-+ int ret;
-+
-+ ret = bdrv_parse_cache_mode(cache, &cache_flags, &writethrough);
-+ if (ret < 0) {
-+ error_report("Invalid cache option: %s", cache);
-+ return NULL;
-+ }
-
- filenames = g_hash_table_new_full(g_str_hash, str_equal_func, NULL, NULL);
-
-@@ -3026,8 +3036,8 @@ static BlockGraphInfoList *collect_image_info_list(bool image_opts,
- g_hash_table_insert(filenames, (gpointer)filename, NULL);
-
- blk = img_open(image_opts, filename, fmt,
-- BDRV_O_NO_BACKING | BDRV_O_NO_IO, false, false,
-- force_share);
-+ BDRV_O_NO_BACKING | BDRV_O_NO_IO | cache_flags,
-+ writethrough, false, force_share);
- if (!blk) {
- goto err;
- }
-@@ -3087,6 +3097,7 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv)
- OutputFormat output_format = OFORMAT_HUMAN;
- bool chain = false;
- const char *filename, *fmt;
-+ const char *cache = BDRV_DEFAULT_CACHE;
- BlockGraphInfoList *list;
- bool image_opts = false;
- bool force_share = false;
-@@ -3099,13 +3110,14 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv)
- {"format", required_argument, 0, 'f'},
- {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS},
- {"backing-chain", no_argument, 0, OPTION_BACKING_CHAIN},
-+ {"cache", required_argument, 0, 't'},
- {"force-share", no_argument, 0, 'U'},
- {"limits", no_argument, 0, OPTION_LIMITS},
- {"output", required_argument, 0, OPTION_OUTPUT},
- {"object", required_argument, 0, OPTION_OBJECT},
- {0, 0, 0, 0}
- };
-- c = getopt_long(argc, argv, "hf:U", long_options, NULL);
-+ c = getopt_long(argc, argv, "hf:t:U", long_options, NULL);
- if (c == -1) {
- break;
- }
-@@ -3121,6 +3133,8 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv)
- " (incompatible with -f|--format)\n"
- " --backing-chain\n"
- " display information about the backing chain for copy-on-write overlays\n"
-+" -t, --cache CACHE\n"
-+" cache mode for FILE (default: " BDRV_DEFAULT_CACHE ")\n"
- " -U, --force-share\n"
- " open image in shared mode for concurrent access\n"
- " --limits\n"
-@@ -3143,6 +3157,9 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv)
- case OPTION_BACKING_CHAIN:
- chain = true;
- break;
-+ case 't':
-+ cache = optarg;
-+ break;
- case 'U':
- force_share = true;
- break;
-@@ -3164,7 +3181,7 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv)
- }
- filename = argv[optind++];
-
-- list = collect_image_info_list(image_opts, filename, fmt, chain,
-+ list = collect_image_info_list(image_opts, filename, fmt, cache, chain,
- limits, force_share);
- if (!list) {
- return 1;
---
-2.47.3
-
diff --git a/kvm-qemu-img-info-Optionally-show-block-limits.patch b/kvm-qemu-img-info-Optionally-show-block-limits.patch
deleted file mode 100644
index c528e64..0000000
--- a/kvm-qemu-img-info-Optionally-show-block-limits.patch
+++ /dev/null
@@ -1,240 +0,0 @@
-From 264e2c0bff1ae09ef89757eac655401dbdf10d90 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Fri, 24 Oct 2025 14:30:39 +0200
-Subject: [PATCH 4/6] qemu-img info: Optionally show block limits
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 439: block: Expose block limits in monitor and qemu-img info
-RH-Jira: RHEL-110003
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [3/4] 688d6d1617c4d5916b299f08fad0e928341c73f7 (kmwolf/centos-qemu-kvm)
-
-Add a new --limits option to 'qemu-img info' that displays the block
-limits for the image and all of its children, making the information
-more accessible for human users than in QMP. This option is not enabled
-by default because it can be a lot of output that isn't usually relevant
-if you're not specifically trying to diagnose some I/O problem.
-
-This makes the same information automatically also available in HMP
-'info block -v'.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
-Message-ID: <20251024123041.51254-4-kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 5b4b3bfdfc28d2398f34194d260d6eef9a9048b4)
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/qapi.c | 34 ++++++++++++++++++++++++++++++++--
- docs/tools/qemu-img.rst | 6 +++++-
- include/block/qapi.h | 2 +-
- qemu-img-cmds.hx | 4 ++--
- qemu-img.c | 15 ++++++++++++---
- 5 files changed, 52 insertions(+), 9 deletions(-)
-
-diff --git a/block/qapi.c b/block/qapi.c
-index 54521d0a68..9f5771e019 100644
---- a/block/qapi.c
-+++ b/block/qapi.c
-@@ -417,6 +417,7 @@ fail:
- */
- void bdrv_query_block_graph_info(BlockDriverState *bs,
- BlockGraphInfo **p_info,
-+ bool limits,
- Error **errp)
- {
- ERRP_GUARD();
-@@ -425,7 +426,7 @@ void bdrv_query_block_graph_info(BlockDriverState *bs,
- BdrvChild *c;
-
- info = g_new0(BlockGraphInfo, 1);
-- bdrv_do_query_node_info(bs, qapi_BlockGraphInfo_base(info), false, errp);
-+ bdrv_do_query_node_info(bs, qapi_BlockGraphInfo_base(info), limits, errp);
- if (*errp) {
- goto fail;
- }
-@@ -439,7 +440,7 @@ void bdrv_query_block_graph_info(BlockDriverState *bs,
- QAPI_LIST_APPEND(children_list_tail, c_info);
-
- c_info->name = g_strdup(c->name);
-- bdrv_query_block_graph_info(c->bs, &c_info->info, errp);
-+ bdrv_query_block_graph_info(c->bs, &c_info->info, limits, errp);
- if (*errp) {
- goto fail;
- }
-@@ -936,6 +937,29 @@ void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec,
- visit_free(v);
- }
-
-+/**
-+ * Dumps the given BlockLimitsInfo object in a human-readable form,
-+ * prepending an optional prefix if the dump is not empty.
-+ */
-+static void bdrv_image_info_limits_dump(BlockLimitsInfo *limits,
-+ const char *prefix,
-+ int indentation)
-+{
-+ QObject *obj;
-+ Visitor *v = qobject_output_visitor_new(&obj);
-+
-+ visit_type_BlockLimitsInfo(v, NULL, &limits, &error_abort);
-+ visit_complete(v, &obj);
-+ if (!qobject_is_empty_dump(obj)) {
-+ if (prefix) {
-+ qemu_printf("%*s%s", indentation * 4, "", prefix);
-+ }
-+ dump_qobject(indentation + 1, obj);
-+ }
-+ qobject_unref(obj);
-+ visit_free(v);
-+}
-+
- /**
- * Print the given @info object in human-readable form. Every field is indented
- * using the given @indentation (four spaces per indentation level).
-@@ -1011,6 +1035,12 @@ void bdrv_node_info_dump(BlockNodeInfo *info, int indentation, bool protocol)
- }
- }
-
-+ if (info->limits) {
-+ bdrv_image_info_limits_dump(info->limits,
-+ "Block limits:\n",
-+ indentation);
-+ }
-+
- if (info->has_snapshots) {
- SnapshotInfoList *elem;
-
-diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst
-index 5e7b85079d..fdc9ea9cf2 100644
---- a/docs/tools/qemu-img.rst
-+++ b/docs/tools/qemu-img.rst
-@@ -503,7 +503,7 @@ Command description:
-
- The size syntax is similar to :manpage:`dd(1)`'s size syntax.
-
--.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [-U] FILENAME
-+.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [--limits] [-U] FILENAME
-
- Give information about the disk image *FILENAME*. Use it in
- particular to know the size reserved on disk which can be different
-@@ -571,6 +571,10 @@ Command description:
- ``ImageInfoSpecific*`` QAPI object (e.g. ``ImageInfoSpecificQCow2``
- for qcow2 images).
-
-+ *Block limits*
-+ The block limits for I/O that QEMU detected for the image.
-+ This information is only shown if the ``--limits`` option was specified.
-+
- .. option:: map [--object OBJECTDEF] [--image-opts] [-f FMT] [--start-offset=OFFSET] [--max-length=LEN] [--output=OFMT] [-U] FILENAME
-
- Dump the metadata of image *FILENAME* and its backing file chain.
-diff --git a/include/block/qapi.h b/include/block/qapi.h
-index 54c48de26a..be554e53dc 100644
---- a/include/block/qapi.h
-+++ b/include/block/qapi.h
-@@ -42,7 +42,7 @@ bdrv_query_image_info(BlockDriverState *bs, ImageInfo **p_info, bool flat,
- bool skip_implicit_filters, Error **errp);
- void GRAPH_RDLOCK
- bdrv_query_block_graph_info(BlockDriverState *bs, BlockGraphInfo **p_info,
-- Error **errp);
-+ bool limits, Error **errp);
-
- void bdrv_snapshot_dump(QEMUSnapshotInfo *sn);
- void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec,
-diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
-index 2c5a8a28f9..74b66f9d42 100644
---- a/qemu-img-cmds.hx
-+++ b/qemu-img-cmds.hx
-@@ -66,9 +66,9 @@ SRST
- ERST
-
- DEF("info", img_info,
-- "info [--object objectdef] [--image-opts] [-f fmt] [--output=ofmt] [--backing-chain] [-U] filename")
-+ "info [--object objectdef] [--image-opts] [-f fmt] [--output=ofmt] [--backing-chain] [--limits] [-U] filename")
- SRST
--.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [-U] FILENAME
-+.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [--limits] [-U] FILENAME
- ERST
-
- DEF("map", img_map,
-diff --git a/qemu-img.c b/qemu-img.c
-index 7a162fdc08..5cdbeda969 100644
---- a/qemu-img.c
-+++ b/qemu-img.c
-@@ -86,6 +86,7 @@ enum {
- OPTION_BITMAPS = 275,
- OPTION_FORCE = 276,
- OPTION_SKIP_BROKEN = 277,
-+ OPTION_LIMITS = 278,
- };
-
- typedef enum OutputFormat {
-@@ -3002,7 +3003,8 @@ static gboolean str_equal_func(gconstpointer a, gconstpointer b)
- static BlockGraphInfoList *collect_image_info_list(bool image_opts,
- const char *filename,
- const char *fmt,
-- bool chain, bool force_share)
-+ bool chain, bool limits,
-+ bool force_share)
- {
- BlockGraphInfoList *head = NULL;
- BlockGraphInfoList **tail = &head;
-@@ -3039,7 +3041,7 @@ static BlockGraphInfoList *collect_image_info_list(bool image_opts,
- * the chain manually here.
- */
- bdrv_graph_rdlock_main_loop();
-- bdrv_query_block_graph_info(bs, &info, &err);
-+ bdrv_query_block_graph_info(bs, &info, limits, &err);
- bdrv_graph_rdunlock_main_loop();
-
- if (err) {
-@@ -3088,6 +3090,7 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv)
- BlockGraphInfoList *list;
- bool image_opts = false;
- bool force_share = false;
-+ bool limits = false;
-
- fmt = NULL;
- for(;;) {
-@@ -3097,6 +3100,7 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv)
- {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS},
- {"backing-chain", no_argument, 0, OPTION_BACKING_CHAIN},
- {"force-share", no_argument, 0, 'U'},
-+ {"limits", no_argument, 0, OPTION_LIMITS},
- {"output", required_argument, 0, OPTION_OUTPUT},
- {"object", required_argument, 0, OPTION_OBJECT},
- {0, 0, 0, 0}
-@@ -3119,6 +3123,8 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv)
- " display information about the backing chain for copy-on-write overlays\n"
- " -U, --force-share\n"
- " open image in shared mode for concurrent access\n"
-+" --limits\n"
-+" show detected block limits (may depend on options, e.g. cache mode)\n"
- " --output human|json\n"
- " specify output format (default: human)\n"
- " --object OBJDEF\n"
-@@ -3140,6 +3146,9 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv)
- case 'U':
- force_share = true;
- break;
-+ case OPTION_LIMITS:
-+ limits = true;
-+ break;
- case OPTION_OUTPUT:
- output_format = parse_output_format(argv[0], optarg);
- break;
-@@ -3156,7 +3165,7 @@ static int img_info(const img_cmd_t *ccmd, int argc, char **argv)
- filename = argv[optind++];
-
- list = collect_image_info_list(image_opts, filename, fmt, chain,
-- force_share);
-+ limits, force_share);
- if (!list) {
- return 1;
- }
---
-2.47.3
-
diff --git a/kvm-qemu-img-rebase-don-t-exceed-IO_BUF_SIZE-in-one-oper.patch b/kvm-qemu-img-rebase-don-t-exceed-IO_BUF_SIZE-in-one-oper.patch
deleted file mode 100644
index 44f3541..0000000
--- a/kvm-qemu-img-rebase-don-t-exceed-IO_BUF_SIZE-in-one-oper.patch
+++ /dev/null
@@ -1,161 +0,0 @@
-From 21f29bc69a9ce910c6869453a48665087fddfa29 Mon Sep 17 00:00:00 2001
-From: Alberto Garcia <berto@igalia.com>
-Date: Fri, 7 Nov 2025 10:18:30 +0100
-Subject: [PATCH 23/52] qemu-img rebase: don't exceed IO_BUF_SIZE in one
- operation
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [16/45] c0b0720c3a75eeb7a1519e1df29ffb9a59adc531 (kmwolf/centos-qemu-kvm)
-
-During a rebase operation data is copied from the backing chain into
-the target image using a loop, and each iteration looks for a
-contiguous region of allocated data of at most IO_BUF_SIZE (2 MB).
-
-Once that region is found, and in order to avoid partial writes, its
-boundaries are extended so they are aligned to the (sub)clusters of
-the target image (see commit 12df580b).
-
-This operation can however result in a region that exceeds the maximum
-allowed IO_BUF_SIZE, crashing qemu-img.
-
-This can be easily reproduced when the source image has a smaller
-cluster size than the target image:
-
-base <- int <- active
-
-$ qemu-img create -f qcow2 base.qcow2 4M
-$ qemu-img create -f qcow2 -F qcow2 -b base.qcow2 -o cluster_size=1M int.qcow2
-$ qemu-img create -f qcow2 -F qcow2 -b int.qcow2 -o cluster_size=2M active.qcow2
-$ qemu-io -c "write -P 0xff 1M 2M" int.qcow2
-$ qemu-img rebase -F qcow2 -b base.qcow2 active.qcow2
-qemu-img: qemu-img.c:4102: img_rebase: Assertion `written + pnum <= IO_BUF_SIZE' failed.
-Aborted
-
-Cc: qemu-stable <qemu-stable@nongnu.org>
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3174
-Fixes: 12df580b3b7f ("qemu-img: rebase: avoid unnecessary COW operations")
-Signed-off-by: Alberto Garcia <berto@igalia.com>
-Message-ID: <20251107091834.383781-1-berto@igalia.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 909852ba6b4a22fd2b6f9d8b88adb5fc47dfa781)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- qemu-img.c | 2 +-
- tests/qemu-iotests/024 | 46 ++++++++++++++++++++++++++++++++++++++
- tests/qemu-iotests/024.out | 26 +++++++++++++++++++++
- 3 files changed, 73 insertions(+), 1 deletion(-)
-
-diff --git a/qemu-img.c b/qemu-img.c
-index 7a32d2d16c..c42dd4e995 100644
---- a/qemu-img.c
-+++ b/qemu-img.c
-@@ -4081,7 +4081,7 @@ static int img_rebase(const img_cmd_t *ccmd, int argc, char **argv)
- n += offset - QEMU_ALIGN_DOWN(offset, write_align);
- offset = QEMU_ALIGN_DOWN(offset, write_align);
- n += QEMU_ALIGN_UP(offset + n, write_align) - (offset + n);
-- n = MIN(n, size - offset);
-+ n = MIN(n, MIN(size - offset, IO_BUF_SIZE));
- assert(!bdrv_is_allocated(unfiltered_bs, offset, n, &n_alloc) &&
- n_alloc == n);
-
-diff --git a/tests/qemu-iotests/024 b/tests/qemu-iotests/024
-index b29c76e161..021169b4a1 100755
---- a/tests/qemu-iotests/024
-+++ b/tests/qemu-iotests/024
-@@ -315,6 +315,52 @@ echo
-
- $QEMU_IMG map "$OVERLAY" | _filter_qemu_img_map
-
-+# Check that the region to copy to the overlay during a rebase
-+# operation does not exceed the I/O buffer size.
-+#
-+# backing_new <-- backing_old <-- overlay
-+#
-+# Backing (new): -- -- -- -- <-- Empty image, size 4MB
-+# Backing (old):|--|ff|ff|--| <-- 4 clusters, 1MB each
-+# Overlay: |-- --|-- --| <-- 2 clusters, 2MB each
-+#
-+# The data at [1MB, 3MB) must be copied from the old backing image to
-+# the overlay. However the rebase code will extend that region to the
-+# overlay's (sub)cluster boundaries to avoid CoW (see commit 12df580b).
-+# This test checks that IO_BUF_SIZE (2 MB) is taken into account.
-+
-+echo
-+echo "=== Test that the region to copy does not exceed 2MB (IO_BUF_SIZE) ==="
-+echo
-+
-+echo "Creating backing chain"
-+echo
-+
-+TEST_IMG=$BASE_NEW _make_test_img 4M
-+TEST_IMG=$BASE_OLD CLUSTER_SIZE=1M _make_test_img -b "$BASE_NEW" -F $IMGFMT
-+TEST_IMG=$OVERLAY CLUSTER_SIZE=2M _make_test_img -b "$BASE_OLD" -F $IMGFMT
-+
-+echo
-+echo "Writing data to region [1MB, 3MB)"
-+echo
-+
-+$QEMU_IO "$BASE_OLD" -c "write -P 0xff 1M 2M" | _filter_qemu_io
-+
-+echo
-+echo "Rebasing"
-+echo
-+
-+$QEMU_IMG rebase -b "$BASE_NEW" -F $IMGFMT "$OVERLAY"
-+
-+echo "Verifying the data"
-+echo
-+
-+$QEMU_IO "$OVERLAY" -c "read -P 0x00 0 1M" | _filter_qemu_io
-+$QEMU_IO "$OVERLAY" -c "read -P 0xff 1M 2M" | _filter_qemu_io
-+$QEMU_IO "$OVERLAY" -c "read -P 0x00 3M 1M" | _filter_qemu_io
-+
-+$QEMU_IMG map "$OVERLAY" | _filter_qemu_img_map
-+
- echo
-
- # success, all done
-diff --git a/tests/qemu-iotests/024.out b/tests/qemu-iotests/024.out
-index 3d1e31927a..1b7522ba71 100644
---- a/tests/qemu-iotests/024.out
-+++ b/tests/qemu-iotests/024.out
-@@ -243,4 +243,30 @@ Offset Length File
- 0 0x20000 TEST_DIR/subdir/t.IMGFMT
- 0x40000 0x20000 TEST_DIR/subdir/t.IMGFMT
-
-+=== Test that the region to copy does not exceed 2MB (IO_BUF_SIZE) ===
-+
-+Creating backing chain
-+
-+Formatting 'TEST_DIR/subdir/t.IMGFMT.base_new', fmt=IMGFMT size=4194304
-+Formatting 'TEST_DIR/subdir/t.IMGFMT.base_old', fmt=IMGFMT size=4194304 backing_file=TEST_DIR/subdir/t.IMGFMT.base_new backing_fmt=IMGFMT
-+Formatting 'TEST_DIR/subdir/t.IMGFMT', fmt=IMGFMT size=4194304 backing_file=TEST_DIR/subdir/t.IMGFMT.base_old backing_fmt=IMGFMT
-+
-+Writing data to region [1MB, 3MB)
-+
-+wrote 2097152/2097152 bytes at offset 1048576
-+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+
-+Rebasing
-+
-+Verifying the data
-+
-+read 1048576/1048576 bytes at offset 0
-+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+read 2097152/2097152 bytes at offset 1048576
-+2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+read 1048576/1048576 bytes at offset 3145728
-+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-+Offset Length File
-+0 0x400000 TEST_DIR/subdir/t.IMGFMT
-+
- *** done
---
-2.52.0
-
diff --git a/kvm-qemu-io-Add-aio_discard-command.patch b/kvm-qemu-io-Add-aio_discard-command.patch
deleted file mode 100644
index 14b744d..0000000
--- a/kvm-qemu-io-Add-aio_discard-command.patch
+++ /dev/null
@@ -1,167 +0,0 @@
-From f598b8e008e2b9179acaa138d75bac390a204508 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Sat, 13 Jun 2026 23:03:36 +0300
-Subject: [PATCH 48/52] qemu-io: Add 'aio_discard' command
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [41/45] f10ea407dd2cb93550396230790802dc8a728774 (kmwolf/centos-qemu-kvm)
-
-Testing interactions between multiple requests that include discard
-requests require that qemu-io can do the discard asynchronously, like it
-already does for reads and writes. To this effect, add an 'aio_discard'
-command.
-
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260427170520.101242-3-kwolf@redhat.com>
-Reviewed-by: Denis V. Lunev <den@openvz.org>
-Tested-by: Denis V. Lunev <den@openvz.org>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 7f8466e2ce620e3c6a6e2f32d616367174d4dbe9)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-
-Message-ID: <20260613200411.1808021-53-mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- qemu-io-cmds.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 115 insertions(+)
-
-diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
-index f6d077908f..de4c1966fe 100644
---- a/qemu-io-cmds.c
-+++ b/qemu-io-cmds.c
-@@ -2218,6 +2218,120 @@ static int discard_f(BlockBackend *blk, int argc, char **argv)
- return 0;
- }
-
-+static void aio_discard_help(void)
-+{
-+ printf(
-+"\n"
-+" asynchronously discards a range of bytes from the given offset\n"
-+"\n"
-+" Example:\n"
-+" 'aio_discard 512 1k' - discards 1 kilobyte from 512 bytes into the file\n"
-+"\n"
-+" Discards a segment of the currently open file.\n"
-+" -C, -- report statistics in a machine parsable format\n"
-+" -q, -- quiet mode, do not show I/O statistics\n"
-+" The discard is performed asynchronously and the aio_flush command must be\n"
-+" used to ensure all outstanding aio requests have been completed.\n"
-+" Note that due to its asynchronous nature, this command will be\n"
-+" considered successful once the request is submitted, independently\n"
-+" of potential I/O errors.\n"
-+"\n");
-+}
-+
-+static int aio_discard_f(BlockBackend *blk, int argc, char **argv);
-+
-+static const cmdinfo_t aio_discard_cmd = {
-+ .name = "aio_discard",
-+ .cfunc = aio_discard_f,
-+ .perm = BLK_PERM_WRITE,
-+ .argmin = 2,
-+ .argmax = -1,
-+ .args = "[-Cq] off len",
-+ .oneline = "asynchronously discards a number of bytes",
-+ .help = aio_discard_help,
-+};
-+
-+static void aio_discard_done(void *opaque, int ret)
-+{
-+ struct aio_ctx *ctx = opaque;
-+ struct timespec t2;
-+
-+ clock_gettime(CLOCK_MONOTONIC, &t2);
-+
-+ if (ret < 0) {
-+ printf("aio_discard failed: %s\n", strerror(-ret));
-+ block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct);
-+ goto out;
-+ }
-+
-+ block_acct_done(blk_get_stats(ctx->blk), &ctx->acct);
-+
-+ if (ctx->qflag) {
-+ goto out;
-+ }
-+
-+ /* Finally, report back -- -C gives a parsable format */
-+ t2 = tsub(t2, ctx->t1);
-+ print_report("discarded ", &t2, ctx->offset, ctx->qiov.size,
-+ ctx->qiov.size, 1, ctx->Cflag);
-+out:
-+ g_free(ctx);
-+}
-+
-+static int aio_discard_f(BlockBackend *blk, int argc, char **argv)
-+{
-+ int c, ret;
-+ int64_t count;
-+ struct aio_ctx *ctx = g_new0(struct aio_ctx, 1);
-+
-+ ctx->blk = blk;
-+
-+ while ((c = getopt(argc, argv, "Cq")) != -1) {
-+ switch (c) {
-+ case 'C':
-+ ctx->Cflag = true;
-+ break;
-+ case 'q':
-+ ctx->qflag = true;
-+ break;
-+ default:
-+ g_free(ctx);
-+ qemuio_command_usage(&aio_discard_cmd);
-+ return -EINVAL;
-+ }
-+ }
-+
-+ if (optind != argc - 2) {
-+ g_free(ctx);
-+ qemuio_command_usage(&aio_discard_cmd);
-+ return -EINVAL;
-+ }
-+
-+ ctx->offset = cvtnum(argv[optind]);
-+ if (ctx->offset < 0) {
-+ ret = ctx->offset;
-+ print_cvtnum_err(ret, argv[optind]);
-+ g_free(ctx);
-+ return ret;
-+ }
-+ optind++;
-+
-+ count = cvtnum(argv[optind]);
-+ if (count < 0) {
-+ print_cvtnum_err(count, argv[optind]);
-+ g_free(ctx);
-+ return count;
-+ }
-+
-+ clock_gettime(CLOCK_MONOTONIC, &ctx->t1);
-+ ctx->qiov.size = count;
-+ block_acct_start(blk_get_stats(blk), &ctx->acct, ctx->qiov.size,
-+ BLOCK_ACCT_UNMAP);
-+ blk_aio_pdiscard(blk, ctx->offset, count, aio_discard_done, ctx);
-+
-+ return 0;
-+}
-+
- static int alloc_f(BlockBackend *blk, int argc, char **argv)
- {
- BlockDriverState *bs = blk_bs(blk);
-@@ -2800,6 +2914,7 @@ static void __attribute((constructor)) init_qemuio_commands(void)
- qemuio_add_command(&length_cmd);
- qemuio_add_command(&info_cmd);
- qemuio_add_command(&discard_cmd);
-+ qemuio_add_command(&aio_discard_cmd);
- qemuio_add_command(&alloc_cmd);
- qemuio_add_command(&map_cmd);
- qemuio_add_command(&reopen_cmd);
---
-2.52.0
-
diff --git a/kvm-qemu-options.hx-Document-arm-smmuv3-device-s-accel-p.patch b/kvm-qemu-options.hx-Document-arm-smmuv3-device-s-accel-p.patch
deleted file mode 100644
index 470e28d..0000000
--- a/kvm-qemu-options.hx-Document-arm-smmuv3-device-s-accel-p.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From e622631ba406a9c7864ca7a3fc8104bb07fdecd9 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Tue, 24 Mar 2026 14:02:30 +0000
-Subject: [PATCH 064/111] qemu-options.hx: Document arm-smmuv3 device's accel
- properties
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [64/111] 310e3a909458ad308f4fbf2dc3296f7b0733c64d (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-160190
-
-Conflicts: contextual conflict in qemu-options.hx because we
-don't have -device amd-iommu documentation introduced by commit
-918973f1d476 ("amd_iommu: Document '-device amd-iommu' common options")
-
-Document arm-smmuv3 properties for setting HW-acceleration,
-Range Invalidation, and Address Translation Services support, as
-well as setting Output Address size and Substream ID size.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Message-id: 20260323182454.1416110-9-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit af35bc0c146ced44f6bfe98587495ae193adcec4)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- qemu-options.hx | 32 +++++++++++++++++++++++++++++++-
- 1 file changed, 31 insertions(+), 1 deletion(-)
-
-diff --git a/qemu-options.hx b/qemu-options.hx
-index 8eca7faa94..680a903db8 100644
---- a/qemu-options.hx
-+++ b/qemu-options.hx
-@@ -1231,13 +1231,43 @@ SRST
- ``aw-bits=val`` (val between 32 and 64, default depends on machine)
- This decides the address width of the IOVA address space.
-
--``-device arm-smmuv3,primary-bus=id``
-+``-device arm-smmuv3,primary-bus=id[,option=...]``
- This is only supported by ``-machine virt`` (ARM).
-
- ``primary-bus=id``
- Accepts either the default root complex (pcie.0) or a
- pxb-pcie based root complex.
-
-+ ``accel=on|off`` (default: off)
-+ Enables guest to leverage host SMMUv3 features for acceleration.
-+ Enabling accel configures the host SMMUv3 in nested mode to support
-+ vfio-pci passthrough.
-+
-+ The following options are available when accel=on.
-+ Note: 'auto' mode is not currently supported.
-+
-+ ``ril=on|off`` (default: on)
-+ Support for Range Invalidation, which allows the SMMUv3 driver to
-+ invalidate TLB entries for a range of IOVAs at once instead of issuing
-+ separate commands to invalidate each page. Must match with host SMMUv3
-+ Range Invalidation support.
-+
-+ ``ats=on|off`` (default: off)
-+ Support for Address Translation Services, which enables PCIe devices to
-+ cache address translations in their local TLB and reduce latency. Host
-+ SMMUv3 must support ATS in order to enable this feature for the vIOMMU.
-+
-+ ``oas=val`` (supported values are 44 and 48. default: 44)
-+ Sets the Output Address Size in bits. The value set here must be less
-+ than or equal to the host SMMUv3's supported OAS, so that the
-+ intermediate physical addresses (IPA) consumed by host SMMU for stage-2
-+ translation do not exceed the host's max supported IPA size.
-+
-+ ``ssidsize=val`` (val between 0 and 20. default: 0)
-+ Sets the Substream ID size in bits. When set to a non-zero value,
-+ PASID capability is advertised to the vIOMMU and accelerated use cases
-+ such as Shared Virtual Addressing (SVA) are supported.
-+
- ERST
-
- DEF("name", HAS_ARG, QEMU_OPTION_name,
---
-2.52.0
-
diff --git a/kvm-qemu-options.hx-Document-the-arm-smmuv3-device.patch b/kvm-qemu-options.hx-Document-the-arm-smmuv3-device.patch
deleted file mode 100644
index a6fee5b..0000000
--- a/kvm-qemu-options.hx-Document-the-arm-smmuv3-device.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From bf0ecadea242c05671bf057fc45d8c58862032d3 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 29 Aug 2025 09:25:30 +0100
-Subject: [PATCH 12/16] qemu-options.hx: Document the arm-smmuv3 device
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 423: hw/arm/virt: Add support for user creatable SMMUv3 device
-RH-Jira: RHEL-73800
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Donald Dutile <None>
-RH-Commit: [8/11] 775310b784fd7631a58e8bab1e8fcc36973fceca (eauger1/centos-qemu-kvm)
-
-Now that arm,virt can have user-creatable smmuv3 devices, document it.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Donald Dutile <ddutile@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Message-id: 20250829082543.7680-9-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 73d3d0187bc6b482d8b15116edce1475c7975b89)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- qemu-options.hx | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/qemu-options.hx b/qemu-options.hx
-index 3837456a61..5f146c1860 100644
---- a/qemu-options.hx
-+++ b/qemu-options.hx
-@@ -1231,6 +1231,13 @@ SRST
- ``aw-bits=val`` (val between 32 and 64, default depends on machine)
- This decides the address width of the IOVA address space.
-
-+``-device arm-smmuv3,primary-bus=id``
-+ This is only supported by ``-machine virt`` (ARM).
-+
-+ ``primary-bus=id``
-+ Accepts either the default root complex (pcie.0) or a
-+ pxb-pcie based root complex.
-+
- ERST
-
- DEF("name", HAS_ARG, QEMU_OPTION_name,
---
-2.47.3
-
diff --git a/kvm-qemu-options.hx-Support-auto-for-accel-SMMUv3-proper.patch b/kvm-qemu-options.hx-Support-auto-for-accel-SMMUv3-proper.patch
deleted file mode 100644
index 6712619..0000000
--- a/kvm-qemu-options.hx-Support-auto-for-accel-SMMUv3-proper.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-From b3e2305a115903a5f7a887ade486f04150f95988 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Mon, 8 Jun 2026 10:49:00 -0700
-Subject: [PATCH 074/111] qemu-options.hx: Support "auto" for accel SMMUv3
- properties
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [74/111] 0857e99a4635ba07b72c14c47e5a7882140d7400 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-163596
-
-Conflicts: contextual conflict in qemu-options.hx as we don't
-have -device amd-iommu documentation downstream
-
-Update documentation now that "auto" is supported for accelerated SMMUv3
-properties.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260608174900.2227340-10-nathanc@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 1b8c0edfee08c3d96cf80cab5d851c059fb7c167)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- qemu-options.hx | 25 +++++++++++++++++++------
- 1 file changed, 19 insertions(+), 6 deletions(-)
-
-diff --git a/qemu-options.hx b/qemu-options.hx
-index 680a903db8..3fe2171e70 100644
---- a/qemu-options.hx
-+++ b/qemu-options.hx
-@@ -1243,31 +1243,44 @@ SRST
- Enabling accel configures the host SMMUv3 in nested mode to support
- vfio-pci passthrough.
-
-- The following options are available when accel=on.
-- Note: 'auto' mode is not currently supported.
-+ The following options will be set to auto by default if not manually
-+ set. When accel=on and these properties are set to auto, the value is
-+ derived from the host SMMUv3 capabilities via IOMMU_GET_HW_INFO. With
-+ accel=on, this requires at least one cold-plugged vfio-pci device; if
-+ none is present at machine init, QEMU will abort.
-
-- ``ril=on|off`` (default: on)
-+ If accel=off, auto values resolve to the non-accel defaults given below.
-+
-+ ``ril=on|off|auto`` (default: auto)
- Support for Range Invalidation, which allows the SMMUv3 driver to
- invalidate TLB entries for a range of IOVAs at once instead of issuing
- separate commands to invalidate each page. Must match with host SMMUv3
- Range Invalidation support.
-
-- ``ats=on|off`` (default: off)
-+ - With accel=off, auto is resolved to 'on'.
-+
-+ ``ats=on|off|auto`` (default: auto)
- Support for Address Translation Services, which enables PCIe devices to
- cache address translations in their local TLB and reduce latency. Host
- SMMUv3 must support ATS in order to enable this feature for the vIOMMU.
-
-- ``oas=val`` (supported values are 44 and 48. default: 44)
-+ - With accel=off, auto is resolved to 'off'.
-+
-+ ``oas=val|auto`` (supported values are 44 and 48. default: auto)
- Sets the Output Address Size in bits. The value set here must be less
- than or equal to the host SMMUv3's supported OAS, so that the
- intermediate physical addresses (IPA) consumed by host SMMU for stage-2
- translation do not exceed the host's max supported IPA size.
-
-- ``ssidsize=val`` (val between 0 and 20. default: 0)
-+ - With accel=off, auto is resolved to 44.
-+
-+ ``ssidsize=val|auto`` (val between 0 and 20. default: auto)
- Sets the Substream ID size in bits. When set to a non-zero value,
- PASID capability is advertised to the vIOMMU and accelerated use cases
- such as Shared Virtual Addressing (SVA) are supported.
-
-+ - With accel=off, auto is resolved to 0.
-+
- ERST
-
- DEF("name", HAS_ARG, QEMU_OPTION_name,
---
-2.52.0
-
diff --git a/kvm-qmp-update-virtio-features-map-to-support-extended-f.patch b/kvm-qmp-update-virtio-features-map-to-support-extended-f.patch
deleted file mode 100644
index 279bf95..0000000
--- a/kvm-qmp-update-virtio-features-map-to-support-extended-f.patch
+++ /dev/null
@@ -1,329 +0,0 @@
-From af8775763edabeeb175f72d3db0b23a20fc177e0 Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:23 +0200
-Subject: [PATCH 14/19] qmp: update virtio features map to support extended
- features
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [9/14] c4ebb3187b6b7aa0c0e631363110a05f538c827b (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-Extend the VirtioDeviceFeatures struct with an additional u64
-to track unknown features in the 64-127 bit range and decode
-the full virtio features spaces for vhost and virtio devices.
-
-Also add entries for the soon-to-be-supported virtio net GSO over
-UDP features.
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Acked-by: Markus Armbruster <armbru@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <e51969f94d89045b333f1bc5ef5fca9e12fc371a.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit a76f5b795cab8ea0654e4813caa694470d7250a9)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- hw/virtio/virtio-hmp-cmds.c | 3 +-
- hw/virtio/virtio-qmp.c | 91 +++++++++++++++++++++++++------------
- hw/virtio/virtio-qmp.h | 3 +-
- qapi/virtio.json | 9 +++-
- 4 files changed, 74 insertions(+), 32 deletions(-)
-
-diff --git a/hw/virtio/virtio-hmp-cmds.c b/hw/virtio/virtio-hmp-cmds.c
-index 7d8677bcf0..1daae482d3 100644
---- a/hw/virtio/virtio-hmp-cmds.c
-+++ b/hw/virtio/virtio-hmp-cmds.c
-@@ -74,7 +74,8 @@ static void hmp_virtio_dump_features(Monitor *mon,
- }
-
- if (features->has_unknown_dev_features) {
-- monitor_printf(mon, " unknown-features(0x%016"PRIx64")\n",
-+ monitor_printf(mon, " unknown-features(0x%016"PRIx64"%016"PRIx64")\n",
-+ features->unknown_dev_features2,
- features->unknown_dev_features);
- }
- }
-diff --git a/hw/virtio/virtio-qmp.c b/hw/virtio/virtio-qmp.c
-index 3b6377cf0d..b338344c6c 100644
---- a/hw/virtio/virtio-qmp.c
-+++ b/hw/virtio/virtio-qmp.c
-@@ -325,6 +325,20 @@ static const qmp_virtio_feature_map_t virtio_net_feature_map[] = {
- FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \
- "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features "
- "negotiation supported"),
-+ FEATURE_ENTRY(VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO, \
-+ "VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO: Driver can receive GSO over "
-+ "UDP tunnel packets"),
-+ FEATURE_ENTRY(VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO_CSUM, \
-+ "VIRTIO_NET_F_GUEST_UDP_TUNNEL_GSO: Driver can receive GSO over "
-+ "UDP tunnel packets requiring checksum offload for the outer "
-+ "header"),
-+ FEATURE_ENTRY(VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO, \
-+ "VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO: Device can receive GSO over "
-+ "UDP tunnel packets"),
-+ FEATURE_ENTRY(VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO_CSUM, \
-+ "VIRTIO_NET_F_HOST_UDP_TUNNEL_GSO_CSUM: Device can receive GSO over "
-+ "UDP tunnel packets requiring checksum offload for the outer "
-+ "header"),
- { -1, "" }
- };
- #endif
-@@ -510,6 +524,24 @@ static const qmp_virtio_feature_map_t virtio_gpio_feature_map[] = {
- list; \
- })
-
-+#define CONVERT_FEATURES_EX(type, map, bitmap) \
-+ ({ \
-+ type *list = NULL; \
-+ type *node; \
-+ for (i = 0; map[i].virtio_bit != -1; i++) { \
-+ bit = map[i].virtio_bit; \
-+ if (!virtio_has_feature_ex(bitmap, bit)) { \
-+ continue; \
-+ } \
-+ node = g_new0(type, 1); \
-+ node->value = g_strdup(map[i].feature_desc); \
-+ node->next = list; \
-+ list = node; \
-+ virtio_clear_feature_ex(bitmap, bit); \
-+ } \
-+ list; \
-+ })
-+
- VirtioDeviceStatus *qmp_decode_status(uint8_t bitmap)
- {
- VirtioDeviceStatus *status;
-@@ -545,109 +577,112 @@ VhostDeviceProtocols *qmp_decode_protocols(uint64_t bitmap)
- return vhu_protocols;
- }
-
--VirtioDeviceFeatures *qmp_decode_features(uint16_t device_id, uint64_t bitmap)
-+VirtioDeviceFeatures *qmp_decode_features(uint16_t device_id,
-+ const uint64_t *bmap)
- {
-+ uint64_t bitmap[VIRTIO_FEATURES_NU64S];
- VirtioDeviceFeatures *features;
- uint64_t bit;
- int i;
-
-+ virtio_features_copy(bitmap, bmap);
- features = g_new0(VirtioDeviceFeatures, 1);
- features->has_dev_features = true;
-
- /* transport features */
-- features->transports = CONVERT_FEATURES(strList, virtio_transport_map, 0,
-- bitmap);
-+ features->transports = CONVERT_FEATURES_EX(strList, virtio_transport_map,
-+ bitmap);
-
- /* device features */
- switch (device_id) {
- #ifdef CONFIG_VIRTIO_SERIAL
- case VIRTIO_ID_CONSOLE:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_serial_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_serial_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VIRTIO_BLK
- case VIRTIO_ID_BLOCK:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_blk_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_blk_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VIRTIO_GPU
- case VIRTIO_ID_GPU:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_gpu_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_gpu_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VIRTIO_NET
- case VIRTIO_ID_NET:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_net_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_net_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VIRTIO_SCSI
- case VIRTIO_ID_SCSI:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_scsi_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_scsi_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VIRTIO_BALLOON
- case VIRTIO_ID_BALLOON:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_balloon_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_balloon_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VIRTIO_IOMMU
- case VIRTIO_ID_IOMMU:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_iommu_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_iommu_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VIRTIO_INPUT
- case VIRTIO_ID_INPUT:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_input_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_input_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VHOST_USER_FS
- case VIRTIO_ID_FS:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_fs_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_fs_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VHOST_VSOCK
- case VIRTIO_ID_VSOCK:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_vsock_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_vsock_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VIRTIO_CRYPTO
- case VIRTIO_ID_CRYPTO:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_crypto_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_crypto_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VIRTIO_MEM
- case VIRTIO_ID_MEM:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_mem_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_mem_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VIRTIO_I2C_ADAPTER
- case VIRTIO_ID_I2C_ADAPTER:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_i2c_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_i2c_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VIRTIO_RNG
- case VIRTIO_ID_RNG:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_rng_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_rng_feature_map, bitmap);
- break;
- #endif
- #ifdef CONFIG_VHOST_USER_GPIO
- case VIRTIO_ID_GPIO:
- features->dev_features =
-- CONVERT_FEATURES(strList, virtio_gpio_feature_map, 0, bitmap);
-+ CONVERT_FEATURES_EX(strList, virtio_gpio_feature_map, bitmap);
- break;
- #endif
- /* No features */
-@@ -680,10 +715,9 @@ VirtioDeviceFeatures *qmp_decode_features(uint16_t device_id, uint64_t bitmap)
- g_assert_not_reached();
- }
-
-- features->has_unknown_dev_features = bitmap != 0;
-- if (features->has_unknown_dev_features) {
-- features->unknown_dev_features = bitmap;
-- }
-+ features->has_unknown_dev_features = !virtio_features_empty(bitmap);
-+ features->unknown_dev_features = bitmap[0];
-+ features->unknown_dev_features2 = bitmap[1];
-
- return features;
- }
-@@ -743,11 +777,11 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
- status->device_id = vdev->device_id;
- status->vhost_started = vdev->vhost_started;
- status->guest_features = qmp_decode_features(vdev->device_id,
-- vdev->guest_features);
-+ vdev->guest_features_ex);
- status->host_features = qmp_decode_features(vdev->device_id,
-- vdev->host_features);
-+ vdev->host_features_ex);
- status->backend_features = qmp_decode_features(vdev->device_id,
-- vdev->backend_features);
-+ vdev->backend_features_ex);
-
- switch (vdev->device_endian) {
- case VIRTIO_DEVICE_ENDIAN_LITTLE:
-@@ -785,11 +819,12 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
- status->vhost_dev->nvqs = hdev->nvqs;
- status->vhost_dev->vq_index = hdev->vq_index;
- status->vhost_dev->features =
-- qmp_decode_features(vdev->device_id, hdev->features);
-+ qmp_decode_features(vdev->device_id, hdev->features_ex);
- status->vhost_dev->acked_features =
-- qmp_decode_features(vdev->device_id, hdev->acked_features);
-+ qmp_decode_features(vdev->device_id, hdev->acked_features_ex);
- status->vhost_dev->backend_features =
-- qmp_decode_features(vdev->device_id, hdev->backend_features);
-+ qmp_decode_features(vdev->device_id, hdev->backend_features_ex);
-+
- status->vhost_dev->protocol_features =
- qmp_decode_protocols(hdev->protocol_features);
- status->vhost_dev->max_queues = hdev->max_queues;
-diff --git a/hw/virtio/virtio-qmp.h b/hw/virtio/virtio-qmp.h
-index 245a446a56..e0a1e49035 100644
---- a/hw/virtio/virtio-qmp.h
-+++ b/hw/virtio/virtio-qmp.h
-@@ -18,6 +18,7 @@
- VirtIODevice *qmp_find_virtio_device(const char *path);
- VirtioDeviceStatus *qmp_decode_status(uint8_t bitmap);
- VhostDeviceProtocols *qmp_decode_protocols(uint64_t bitmap);
--VirtioDeviceFeatures *qmp_decode_features(uint16_t device_id, uint64_t bitmap);
-+VirtioDeviceFeatures *qmp_decode_features(uint16_t device_id,
-+ const uint64_t *bitmap);
-
- #endif
-diff --git a/qapi/virtio.json b/qapi/virtio.json
-index 9d652fe4a8..05295ab665 100644
---- a/qapi/virtio.json
-+++ b/qapi/virtio.json
-@@ -247,6 +247,7 @@
- # },
- # "host-features": {
- # "unknown-dev-features": 1073741824,
-+# "unknown-dev-features2": 0,
- # "dev-features": [],
- # "transports": [
- # "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
-@@ -490,14 +491,18 @@
- # unique features)
- #
- # @unknown-dev-features: Virtio device features bitmap that have not
--# been decoded
-+# been decoded (bits 0-63)
-+#
-+# @unknown-dev-features2: Virtio device features bitmap that have not
-+# been decoded (bits 64-127) (since 10.2)
- #
- # Since: 7.2
- ##
- { 'struct': 'VirtioDeviceFeatures',
- 'data': { 'transports': [ 'str' ],
- '*dev-features': [ 'str' ],
-- '*unknown-dev-features': 'uint64' } }
-+ '*unknown-dev-features': 'uint64',
-+ '*unknown-dev-features2': 'uint64' } }
-
- ##
- # @VirtQueueStatus:
---
-2.47.3
-
diff --git a/kvm-qtest-Do-not-run-bios-tables-test-on-aarch64.patch b/kvm-qtest-Do-not-run-bios-tables-test-on-aarch64.patch
deleted file mode 100644
index d048675..0000000
--- a/kvm-qtest-Do-not-run-bios-tables-test-on-aarch64.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 3b21c60b771087e7d566bf738e04e01a7a1bdf09 Mon Sep 17 00:00:00 2001
-From: Miroslav Rezanina <mrezanin@redhat.com>
-Date: Fri, 14 Nov 2025 06:46:07 +0100
-Subject: [PATCH 16/16] qtest: Do not run bios-tables-test on aarch64
-
-We do several disruptive downstream only changes that make
-bios-tables-test to fail. Disabling it for now.
-
-This is done to enable fixing RHEL-126573 and RHEL-67323.
-
-Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
----
- tests/qtest/meson.build | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
-index ef44ffaf78..13b52ea41a 100644
---- a/tests/qtest/meson.build
-+++ b/tests/qtest/meson.build
-@@ -252,7 +252,6 @@ qtests_arm = \
-
- # TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
- qtests_aarch64 = \
-- (cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \
- (config_all_accel.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? \
- ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \
- (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \
---
-2.47.3
-
diff --git a/kvm-qtest-bios-tables-test-Add-tests-for-legacy-smmuv3-a.patch b/kvm-qtest-bios-tables-test-Add-tests-for-legacy-smmuv3-a.patch
deleted file mode 100644
index 4ab008d..0000000
--- a/kvm-qtest-bios-tables-test-Add-tests-for-legacy-smmuv3-a.patch
+++ /dev/null
@@ -1,160 +0,0 @@
-From 51ec91309c99a5d81b53c2762d18c073f672e45a Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 29 Aug 2025 09:25:32 +0100
-Subject: [PATCH 14/16] qtest/bios-tables-test: Add tests for legacy smmuv3 and
- smmuv3 device
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 423: hw/arm/virt: Add support for user creatable SMMUv3 device
-RH-Jira: RHEL-73800
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Donald Dutile <None>
-RH-Commit: [10/11] 101ed34313636fdc11f7fbdedbe2f91671b84c4b (eauger1/centos-qemu-kvm)
-
-For the legacy SMMUv3 test, the setup includes three PCIe Root Complexes,
-one of which has bypass_iommu enabled. The generated IORT table contains
-a single SMMUv3 node, a Root Complex(RC) node and 1 ITS node.
-RC node features 4 ID mappings, of which 2 points to SMMU node and the
-remaining ones points to ITS.
-
- pcie.0 -> {SMMU0} -> {ITS}
-{RC} pcie.1 -> {SMMU0} -> {ITS}
- pcie.2 -> {ITS}
- [all other ids] -> {ITS}
-
-For the -device arm-smmuv3,... test, the configuration also includes three
-Root Complexes, with two connected to separate SMMUv3 devices.
-The resulting IORT table contains 1 RC node, 2 SMMU nodes and 1 ITS node.
-RC node features 4 ID mappings. 2 of them target the 2 SMMU nodes while
-the others targets the ITS.
-
- pcie.0 -> {SMMU0} -> {ITS}
-{RC} pcie.1 -> {SMMU1} -> {ITS}
- pcie.2 -> {ITS}
- [all other ids] -> {ITS}
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Donald Dutile <ddutile@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Message-id: 20250829082543.7680-11-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 3f8cd046c151c471d9a34181320f4a7d3f72b32a)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- tests/qtest/bios-tables-test.c | 86 ++++++++++++++++++++++++++++++++++
- 1 file changed, 86 insertions(+)
-
-diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
-index 386196edc8..a384aac1be 100644
---- a/tests/qtest/bios-tables-test.c
-+++ b/tests/qtest/bios-tables-test.c
-@@ -2343,6 +2343,86 @@ static void test_acpi_aarch64_virt_viot(void)
- free_test_data(&data);
- }
-
-+static void test_acpi_aarch64_virt_smmuv3_legacy(void)
-+{
-+ test_data data = {
-+ .machine = "virt",
-+ .arch = "aarch64",
-+ .tcg_only = true,
-+ .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
-+ .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
-+ .ram_start = 0x40000000ULL,
-+ .scan_len = 128ULL * MiB,
-+ };
-+
-+ /*
-+ * cdrom is plugged into scsi controller to avoid conflict
-+ * with pxb-pcie. See comments in test_acpi_aarch64_virt_tcg_pxb() for
-+ * details.
-+ *
-+ * The setup includes three PCIe root complexes, one of which has
-+ * bypass_iommu enabled. The generated IORT table contains a single
-+ * SMMUv3 node and a Root Complex node with three ID mappings. Two
-+ * of the ID mappings have output references pointing to the SMMUv3
-+ * node and the remaining one points to ITS.
-+ */
-+ data.variant = ".smmuv3-legacy";
-+ test_acpi_one(" -device pcie-root-port,chassis=1,id=pci.1"
-+ " -device virtio-scsi-pci,id=scsi0,bus=pci.1"
-+ " -drive file="
-+ "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2,"
-+ "if=none,media=cdrom,id=drive-scsi0-0-0-1,readonly=on"
-+ " -device scsi-cd,bus=scsi0.0,scsi-id=0,"
-+ "drive=drive-scsi0-0-0-1,id=scsi0-0-0-1,bootindex=1"
-+ " -cpu cortex-a57"
-+ " -M iommu=smmuv3"
-+ " -device pxb-pcie,id=pcie.1,bus=pcie.0,bus_nr=0x10"
-+ " -device pxb-pcie,id=pcie.2,bus=pcie.0,bus_nr=0x20,bypass_iommu=on",
-+ &data);
-+ free_test_data(&data);
-+}
-+
-+static void test_acpi_aarch64_virt_smmuv3_dev(void)
-+{
-+ test_data data = {
-+ .machine = "virt",
-+ .arch = "aarch64",
-+ .tcg_only = true,
-+ .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
-+ .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
-+ .ram_start = 0x40000000ULL,
-+ .scan_len = 128ULL * MiB,
-+ };
-+
-+ /*
-+ * cdrom is plugged into scsi controller to avoid conflict
-+ * with pxb-pcie. See comments in test_acpi_aarch64_virt_tcg_pxb()
-+ * for details.
-+ *
-+ * The setup includes three PCie root complexes, two of which are
-+ * connected to separate SMMUv3 devices. The resulting IORT table
-+ * contains two SMMUv3 nodes and a Root Complex node with ID mappings
-+ * of which two of the ID mappings have output references pointing
-+ * to two different SMMUv3 nodes and the remaining ones pointing to
-+ * ITS.
-+ */
-+ data.variant = ".smmuv3-dev";
-+ test_acpi_one(" -device pcie-root-port,chassis=1,id=pci.1"
-+ " -device virtio-scsi-pci,id=scsi0,bus=pci.1"
-+ " -drive file="
-+ "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2,"
-+ "if=none,media=cdrom,id=drive-scsi0-0-0-1,readonly=on"
-+ " -device scsi-cd,bus=scsi0.0,scsi-id=0,"
-+ "drive=drive-scsi0-0-0-1,id=scsi0-0-0-1,bootindex=1"
-+ " -cpu cortex-a57"
-+ " -device arm-smmuv3,primary-bus=pcie.0,id=smmuv3.0"
-+ " -device pxb-pcie,id=pcie.1,bus=pcie.0,bus_nr=0x10"
-+ " -device arm-smmuv3,primary-bus=pcie.1,id=smmuv3.1"
-+ " -device pxb-pcie,id=pcie.2,bus=pcie.0,bus_nr=0x20",
-+ &data);
-+ free_test_data(&data);
-+}
-+
- #ifndef _WIN32
- # define DEV_NULL "/dev/null"
- #else
-@@ -2776,6 +2856,12 @@ int main(int argc, char *argv[])
- if (qtest_has_device("virtio-iommu-pci")) {
- qtest_add_func("acpi/virt/viot", test_acpi_aarch64_virt_viot);
- }
-+ qtest_add_func("acpi/virt/smmuv3-legacy",
-+ test_acpi_aarch64_virt_smmuv3_legacy);
-+ if (qtest_has_device("arm-smmuv3")) {
-+ qtest_add_func("acpi/virt/smmuv3-dev",
-+ test_acpi_aarch64_virt_smmuv3_dev);
-+ }
- }
- #if 0 /* Disabled for Red Hat Enterprise Linux */
- } else if (strcmp(arch, "riscv64") == 0) {
---
-2.47.3
-
diff --git a/kvm-qtest-bios-tables-test-Update-tables-for-smmuv3-test.patch b/kvm-qtest-bios-tables-test-Update-tables-for-smmuv3-test.patch
deleted file mode 100644
index 9273081..0000000
--- a/kvm-qtest-bios-tables-test-Update-tables-for-smmuv3-test.patch
+++ /dev/null
@@ -1,282 +0,0 @@
-From d6f27731c3d469f4ba68807a4c1f8ee534cc9d57 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Fri, 29 Aug 2025 09:25:33 +0100
-Subject: [PATCH 15/16] qtest/bios-tables-test: Update tables for smmuv3 tests
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 423: hw/arm/virt: Add support for user creatable SMMUv3 device
-RH-Jira: RHEL-73800
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Donald Dutile <None>
-RH-Commit: [11/11] 88cb1daec4e92b759f12a96daacd46fc4656eacd (eauger1/centos-qemu-kvm)
-
-For the legacy smmuv3 test case, generated IORT has a single SMMUv3 node,
-a Root Complex(RC) node and 1 ITS node.
-RC node features 4 ID mappings, of which 2 points to SMMU node and the
-remaining ones points to ITS.
-
- pcie.0 -> {SMMU0} -> {ITS}
-{RC} pcie.1 -> {SMMU0} -> {ITS}
- pcie.2 -> {ITS}
- [all other ids] -> {ITS}
-
-...
-[030h 0048 1] Type : 00
-[031h 0049 2] Length : 0018
-[033h 0051 1] Revision : 01
-[034h 0052 4] Identifier : 00000000
-[038h 0056 4] Mapping Count : 00000000
-[03Ch 0060 4] Mapping Offset : 00000000
-
-[040h 0064 4] ItsCount : 00000001
-[044h 0068 4] Identifiers : 00000000
-
-[048h 0072 1] Type : 04
-[049h 0073 2] Length : 0058
-[04Bh 0075 1] Revision : 04
-[04Ch 0076 4] Identifier : 00000001
-[050h 0080 4] Mapping Count : 00000001
-[054h 0084 4] Mapping Offset : 00000044
-
-[058h 0088 8] Base Address : 0000000009050000
-[060h 0096 4] Flags (decoded below) : 00000001
- COHACC Override : 1
- HTTU Override : 0
- Proximity Domain Valid : 0
-[064h 0100 4] Reserved : 00000000
-[068h 0104 8] VATOS Address : 0000000000000000
-[070h 0112 4] Model : 00000000
-[074h 0116 4] Event GSIV : 0000006A
-[078h 0120 4] PRI GSIV : 0000006B
-[07Ch 0124 4] GERR GSIV : 0000006D
-[080h 0128 4] Sync GSIV : 0000006C
-[084h 0132 4] Proximity Domain : 00000000
-[088h 0136 4] Device ID Mapping Index : 00000000
-
-[08Ch 0140 4] Input base : 00000000
-[090h 0144 4] ID Count : 0000FFFF
-[094h 0148 4] Output Base : 00000000
-[098h 0152 4] Output Reference : 00000030
-[09Ch 0156 4] Flags (decoded below) : 00000000
- Single Mapping : 0
-
-[0A0h 0160 1] Type : 02
-[0A1h 0161 2] Length : 0074
-[0A3h 0163 1] Revision : 03
-[0A4h 0164 4] Identifier : 00000002
-[0A8h 0168 4] Mapping Count : 00000004
-[0ACh 0172 4] Mapping Offset : 00000024
-
-[0B0h 0176 8] Memory Properties : [IORT Memory Access Properties]
-[0B0h 0176 4] Cache Coherency : 00000001
-[0B4h 0180 1] Hints (decoded below) : 00
- Transient : 0
- Write Allocate : 0
- Read Allocate : 0
- Override : 0
-[0B5h 0181 2] Reserved : 0000
-[0B7h 0183 1] Memory Flags (decoded below) : 03
- Coherency : 1
- Device Attribute : 1
-[0B8h 0184 4] ATS Attribute : 00000000
-[0BCh 0188 4] PCI Segment Number : 00000000
-[0C0h 0192 1] Memory Size Limit : 40
-[0C1h 0193 2] PASID Capabilities : 0000
-[0C3h 0195 1] Reserved : 00
-
-[0C4h 0196 4] Input base : 00000000
-[0C8h 0200 4] ID Count : 000001FF
-[0CCh 0204 4] Output Base : 00000000
-[0D0h 0208 4] Output Reference : 00000048
-[0D4h 0212 4] Flags (decoded below) : 00000000
- Single Mapping : 0
-
-[0D8h 0216 4] Input base : 00001000
-[0DCh 0220 4] ID Count : 000000FF
-[0E0h 0224 4] Output Base : 00001000
-[0E4h 0228 4] Output Reference : 00000048
-[0E8h 0232 4] Flags (decoded below) : 00000000
- Single Mapping : 0
-
-[0ECh 0236 4] Input base : 00000200
-[0F0h 0240 4] ID Count : 00000DFF
-[0F4h 0244 4] Output Base : 00000200
-[0F8h 0248 4] Output Reference : 00000030
-[0FCh 0252 4] Flags (decoded below) : 00000000
- Single Mapping : 0
-
-[100h 0256 4] Input base : 00001100
-[104h 0260 4] ID Count : 0000EEFF
-[108h 0264 4] Output Base : 00001100
-[10Ch 0268 4] Output Reference : 00000030
-[110h 0272 4] Flags (decoded below) : 00000000
- Single Mapping : 0
-
-For the smmuv3-dev test case, IORT has 2 SMMUV3 nodes,
-1 RC node and 1 ITS node.
-RC node features 4 ID mappings. 2 of them target the 2
-SMMU nodes while the others targets the ITS.
-
- pcie.0 -> {SMMU0} -> {ITS}
-{RC} pcie.1 -> {SMMU1} -> {ITS}
- pcie.2 -> {ITS}
- [all other ids] -> {ITS}
-...
-[030h 0048 1] Type : 00
-[031h 0049 2] Length : 0018
-[033h 0051 1] Revision : 01
-[034h 0052 4] Identifier : 00000000
-[038h 0056 4] Mapping Count : 00000000
-[03Ch 0060 4] Mapping Offset : 00000000
-
-[040h 0064 4] ItsCount : 00000001
-[044h 0068 4] Identifiers : 00000000
-
-[048h 0072 1] Type : 04
-[049h 0073 2] Length : 0058
-[04Bh 0075 1] Revision : 04
-[04Ch 0076 4] Identifier : 00000001
-[050h 0080 4] Mapping Count : 00000001
-[054h 0084 4] Mapping Offset : 00000044
-
-[058h 0088 8] Base Address : 000000000C000000
-[060h 0096 4] Flags (decoded below) : 00000001
- COHACC Override : 1
- HTTU Override : 0
- Proximity Domain Valid : 0
-[064h 0100 4] Reserved : 00000000
-[068h 0104 8] VATOS Address : 0000000000000000
-[070h 0112 4] Model : 00000000
-[074h 0116 4] Event GSIV : 00000090
-[078h 0120 4] PRI GSIV : 00000091
-[07Ch 0124 4] GERR GSIV : 00000093
-[080h 0128 4] Sync GSIV : 00000092
-[084h 0132 4] Proximity Domain : 00000000
-[088h 0136 4] Device ID Mapping Index : 00000000
-
-[08Ch 0140 4] Input base : 00000000
-[090h 0144 4] ID Count : 0000FFFF
-[094h 0148 4] Output Base : 00000000
-[098h 0152 4] Output Reference : 00000030
-[09Ch 0156 4] Flags (decoded below) : 00000000
- Single Mapping : 0
-
-[0A0h 0160 1] Type : 04
-[0A1h 0161 2] Length : 0058
-[0A3h 0163 1] Revision : 04
-[0A4h 0164 4] Identifier : 00000002
-[0A8h 0168 4] Mapping Count : 00000001
-[0ACh 0172 4] Mapping Offset : 00000044
-
-[0B0h 0176 8] Base Address : 000000000C020000
-[0B8h 0184 4] Flags (decoded below) : 00000001
- COHACC Override : 1
- HTTU Override : 0
- Proximity Domain Valid : 0
-[0BCh 0188 4] Reserved : 00000000
-[0C0h 0192 8] VATOS Address : 0000000000000000
-[0C8h 0200 4] Model : 00000000
-[0CCh 0204 4] Event GSIV : 00000094
-[0D0h 0208 4] PRI GSIV : 00000095
-[0D4h 0212 4] GERR GSIV : 00000097
-[0D8h 0216 4] Sync GSIV : 00000096
-[0DCh 0220 4] Proximity Domain : 00000000
-[0E0h 0224 4] Device ID Mapping Index : 00000000
-
-[0E4h 0228 4] Input base : 00000000
-[0E8h 0232 4] ID Count : 0000FFFF
-[0ECh 0236 4] Output Base : 00000000
-[0F0h 0240 4] Output Reference : 00000030
-[0F4h 0244 4] Flags (decoded below) : 00000000
- Single Mapping : 0
-
-[0F8h 0248 1] Type : 02
-[0F9h 0249 2] Length : 0074
-[0FBh 0251 1] Revision : 03
-[0FCh 0252 4] Identifier : 00000003
-[100h 0256 4] Mapping Count : 00000004
-[104h 0260 4] Mapping Offset : 00000024
-
-[108h 0264 8] Memory Properties : [IORT Memory Access Properties]
-[108h 0264 4] Cache Coherency : 00000001
-[10Ch 0268 1] Hints (decoded below) : 00
- Transient : 0
- Write Allocate : 0
- Read Allocate : 0
- Override : 0
-[10Dh 0269 2] Reserved : 0000
-[10Fh 0271 1] Memory Flags (decoded below) : 03
- Coherency : 1
- Device Attribute : 1
-[110h 0272 4] ATS Attribute : 00000000
-[114h 0276 4] PCI Segment Number : 00000000
-[118h 0280 1] Memory Size Limit : 40
-[119h 0281 2] PASID Capabilities : 0000
-[11Bh 0283 1] Reserved : 00
-
-[11Ch 0284 4] Input base : 00000000
-[120h 0288 4] ID Count : 000001FF
-[124h 0292 4] Output Base : 00000000
-[128h 0296 4] Output Reference : 00000048
-[12Ch 0300 4] Flags (decoded below) : 00000000
- Single Mapping : 0
-
-[130h 0304 4] Input base : 00001000
-[134h 0308 4] ID Count : 000000FF
-[138h 0312 4] Output Base : 00001000
-[13Ch 0316 4] Output Reference : 000000A0
-[140h 0320 4] Flags (decoded below) : 00000000
- Single Mapping : 0
-
-[144h 0324 4] Input base : 00000200
-[148h 0328 4] ID Count : 00000DFF
-[14Ch 0332 4] Output Base : 00000200
-[150h 0336 4] Output Reference : 00000030
-[154h 0340 4] Flags (decoded below) : 00000000
- Single Mapping : 0
-
-[158h 0344 4] Input base : 00001100
-[15Ch 0348 4] ID Count : 0000EEFF
-[160h 0352 4] Output Base : 00001100
-[164h 0356 4] Output Reference : 00000030
-[168h 0360 4] Flags (decoded below) : 00000000
- Single Mapping : 0
-
-Note: DSDT changes are not described here as it is not impacted by the
-way the SMMUv3 is instantiated.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Donald Dutile <ddutile@redhat.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Message-id: 20250829082543.7680-12-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit d35146a6606cf6ebb4e24bb97dfc0330f074f6e3)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev | Bin 0 -> 10230 bytes
- tests/data/acpi/aarch64/virt/DSDT.smmuv3-legacy | Bin 0 -> 10230 bytes
- tests/data/acpi/aarch64/virt/IORT.smmuv3-dev | Bin 0 -> 364 bytes
- tests/data/acpi/aarch64/virt/IORT.smmuv3-legacy | Bin 0 -> 276 bytes
- tests/qtest/bios-tables-test-allowed-diff.h | 4 ----
- 5 files changed, 4 deletions(-)
-
-diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
-index 2e3e3ccdce..dfb8523c8b 100644
---- a/tests/qtest/bios-tables-test-allowed-diff.h
-+++ b/tests/qtest/bios-tables-test-allowed-diff.h
-@@ -1,5 +1 @@
- /* List of comma-separated changed AML files to ignore */
--"tests/data/acpi/aarch64/virt/DSDT.smmuv3-legacy",
--"tests/data/acpi/aarch64/virt/DSDT.smmuv3-dev",
--"tests/data/acpi/aarch64/virt/IORT.smmuv3-legacy",
--"tests/data/acpi/aarch64/virt/IORT.smmuv3-dev",
---
-2.47.3
-
diff --git a/kvm-ram-block-attributes-Unify-the-retrieval-of-the-bloc.patch b/kvm-ram-block-attributes-Unify-the-retrieval-of-the-bloc.patch
deleted file mode 100644
index 87c0288..0000000
--- a/kvm-ram-block-attributes-Unify-the-retrieval-of-the-bloc.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 0e0b1ba11faad72338036b9dfa97a3a8a8bc56dc Mon Sep 17 00:00:00 2001
-From: Paolo Bonzini <pbonzini@redhat.com>
-Date: Wed, 19 Nov 2025 12:51:32 +0100
-Subject: [PATCH 2/4] ram-block-attributes: Unify the retrieval of the block
- size
-
-RH-Author: Paolo Bonzini <pbonzini@redhat.com>
-RH-MergeRequest: 426: Fix hugetlb memory backends in confidential VMs
-RH-Jira: RHEL-126708
-RH-Acked-by: Bandan Das <bdas@redhat.com>
-RH-Acked-by: Eric Blake <eblake@redhat.com>
-RH-Acked-by: Peter Xu <peterx@redhat.com>
-RH-Commit: [2/2] 0d6f2045a97f04348c4d07ef331e42f47eaba160 (bonzini/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-126708
-
-There's an existing helper function designed to obtain the block size.
-Modify ram_block_attribute_create() to use this function for
-consistency.
-
-Tested-by: Farrah Chen <farrah.chen@intel.com>
-Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
-Link: https://lore.kernel.org/r/20251023095526.48365-3-chenyi.qiang@intel.com
-[peterx: fix double spaces, per david]
-Signed-off-by: Peter Xu <peterx@redhat.com>
-(cherry picked from commit b2ceb87b1a210d91a29d525590eb164d1121b8a1)
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
----
- system/ram-block-attributes.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
-index a7579de5b4..fb7c5c2746 100644
---- a/system/ram-block-attributes.c
-+++ b/system/ram-block-attributes.c
-@@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
-
- RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block)
- {
-- const int block_size = qemu_real_host_page_size();
-+ const int block_size = ram_block_attributes_get_block_size();
- RamBlockAttributes *attr;
- MemoryRegion *mr = ram_block->mr;
-
---
-2.47.3
-
diff --git a/kvm-ram-block-attributes-fix-interaction-with-hugetlb-me.patch b/kvm-ram-block-attributes-fix-interaction-with-hugetlb-me.patch
deleted file mode 100644
index 5e5f04d..0000000
--- a/kvm-ram-block-attributes-fix-interaction-with-hugetlb-me.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-From 6b03dd00ce169886ec7aa866c14daa99209a3137 Mon Sep 17 00:00:00 2001
-From: Paolo Bonzini <pbonzini@redhat.com>
-Date: Wed, 19 Nov 2025 12:51:32 +0100
-Subject: [PATCH 1/4] ram-block-attributes: fix interaction with hugetlb memory
- backends
-
-RH-Author: Paolo Bonzini <pbonzini@redhat.com>
-RH-MergeRequest: 426: Fix hugetlb memory backends in confidential VMs
-RH-Jira: RHEL-126708
-RH-Acked-by: Bandan Das <bdas@redhat.com>
-RH-Acked-by: Eric Blake <eblake@redhat.com>
-RH-Acked-by: Peter Xu <peterx@redhat.com>
-RH-Commit: [1/2] 050a6c78989db4ba3111fb903647270c7ab12e53 (bonzini/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-126708
-
-Currently, CoCo VMs can perform conversion at the base page granularity,
-which is the granularity that has to be tracked. In relevant setups, the
-target page size is assumed to be equal to the host page size, thus
-fixing the block size to the host page size.
-
-However, since private memory and shared memory have different backend
-at present, users can specify shared memory with a hugetlbfs backend
-while private memory with guest_memfd backend only supports 4K page
-size. In this scenario, ram_block->page_size is different from the host
-page size which will trigger an assertion when retrieving the block
-size.
-
-To address this, return the host page size directly to relax the
-restriction. This changes fixes a regression of using hugetlbfs backend
-for shared memory within CoCo VMs, with or without VFIO devices' presence.
-
-Acked-by: David Hildenbrand <david@redhat.com>
-Tested-by: Farrah Chen <farrah.chen@intel.com>
-Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
-Link: https://lore.kernel.org/r/20251023095526.48365-2-chenyi.qiang@intel.com
-[peterx: fix subject, per david]
-Cc: qemu-stable <qemu-stable@nongnu.org>
-Signed-off-by: Peter Xu <peterx@redhat.com>
-(cherry picked from commit 8922a758b29251d9009ec509e7f580b76509ab3d)
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
----
- system/ram-block-attributes.c | 18 ++++++++----------
- 1 file changed, 8 insertions(+), 10 deletions(-)
-
-diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
-index 68e8a02703..a7579de5b4 100644
---- a/system/ram-block-attributes.c
-+++ b/system/ram-block-attributes.c
-@@ -22,16 +22,14 @@ OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(RamBlockAttributes,
- { })
-
- static size_t
--ram_block_attributes_get_block_size(const RamBlockAttributes *attr)
-+ram_block_attributes_get_block_size(void)
- {
- /*
- * Because page conversion could be manipulated in the size of at least 4K
- * or 4K aligned, Use the host page size as the granularity to track the
- * memory attribute.
- */
-- g_assert(attr && attr->ram_block);
-- g_assert(attr->ram_block->page_size == qemu_real_host_page_size());
-- return attr->ram_block->page_size;
-+ return qemu_real_host_page_size();
- }
-
-
-@@ -40,7 +38,7 @@ ram_block_attributes_rdm_is_populated(const RamDiscardManager *rdm,
- const MemoryRegionSection *section)
- {
- const RamBlockAttributes *attr = RAM_BLOCK_ATTRIBUTES(rdm);
-- const size_t block_size = ram_block_attributes_get_block_size(attr);
-+ const size_t block_size = ram_block_attributes_get_block_size();
- const uint64_t first_bit = section->offset_within_region / block_size;
- const uint64_t last_bit =
- first_bit + int128_get64(section->size) / block_size - 1;
-@@ -81,7 +79,7 @@ ram_block_attributes_for_each_populated_section(const RamBlockAttributes *attr,
- {
- unsigned long first_bit, last_bit;
- uint64_t offset, size;
-- const size_t block_size = ram_block_attributes_get_block_size(attr);
-+ const size_t block_size = ram_block_attributes_get_block_size();
- int ret = 0;
-
- first_bit = section->offset_within_region / block_size;
-@@ -122,7 +120,7 @@ ram_block_attributes_for_each_discarded_section(const RamBlockAttributes *attr,
- {
- unsigned long first_bit, last_bit;
- uint64_t offset, size;
-- const size_t block_size = ram_block_attributes_get_block_size(attr);
-+ const size_t block_size = ram_block_attributes_get_block_size();
- int ret = 0;
-
- first_bit = section->offset_within_region / block_size;
-@@ -163,7 +161,7 @@ ram_block_attributes_rdm_get_min_granularity(const RamDiscardManager *rdm,
- const RamBlockAttributes *attr = RAM_BLOCK_ATTRIBUTES(rdm);
-
- g_assert(mr == attr->ram_block->mr);
-- return ram_block_attributes_get_block_size(attr);
-+ return ram_block_attributes_get_block_size();
- }
-
- static void
-@@ -265,7 +263,7 @@ ram_block_attributes_is_valid_range(RamBlockAttributes *attr, uint64_t offset,
- g_assert(mr);
-
- uint64_t region_size = memory_region_size(mr);
-- const size_t block_size = ram_block_attributes_get_block_size(attr);
-+ const size_t block_size = ram_block_attributes_get_block_size();
-
- if (!QEMU_IS_ALIGNED(offset, block_size) ||
- !QEMU_IS_ALIGNED(size, block_size)) {
-@@ -322,7 +320,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
- uint64_t offset, uint64_t size,
- bool to_discard)
- {
-- const size_t block_size = ram_block_attributes_get_block_size(attr);
-+ const size_t block_size = ram_block_attributes_get_block_size();
- const unsigned long first_bit = offset / block_size;
- const unsigned long nbits = size / block_size;
- const unsigned long last_bit = first_bit + nbits - 1;
---
-2.47.3
-
diff --git a/kvm-rbd-Run-co-BH-CB-in-the-coroutine-s-AioContext.patch b/kvm-rbd-Run-co-BH-CB-in-the-coroutine-s-AioContext.patch
deleted file mode 100644
index 789185b..0000000
--- a/kvm-rbd-Run-co-BH-CB-in-the-coroutine-s-AioContext.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-From 339f5506d877c9e32852aff3cbe165a0aa2964c5 Mon Sep 17 00:00:00 2001
-From: Hanna Czenczek <hreitz@redhat.com>
-Date: Mon, 10 Nov 2025 16:48:37 +0100
-Subject: [PATCH 01/19] =?UTF-8?q?rbd:=20Run=20co=20BH=20CB=20in=20the=20co?=
- =?UTF-8?q?routine=E2=80=99s=20AioContext?=
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Hanna Czenczek <hreitz@redhat.com>
-RH-MergeRequest: 454: Multithreading fixes for rbd, curl, qcow2
-RH-Jira: RHEL-79118
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/5] 6d858f7d65d6358bf7b8b58dc6e5a2ea9e8599fe (hreitz/qemu-kvm-c-9-s)
-
-qemu_rbd_completion_cb() schedules the request completion code
-(qemu_rbd_finish_bh()) to run in the BDS’s AioContext, assuming that
-this is the same thread in which qemu_rbd_start_co() runs.
-
-To explain, this is how both latter functions interact:
-
-In qemu_rbd_start_co():
-
- while (!task.complete)
- qemu_coroutine_yield();
-
-In qemu_rbd_finish_bh():
-
- task->complete = true;
- aio_co_wake(task->co); // task->co is qemu_rbd_start_co()
-
-For this interaction to work reliably, both must run in the same thread
-so that qemu_rbd_finish_bh() can only run once the coroutine yields.
-Otherwise, finish_bh() may run before start_co() checks task.complete,
-which will result in the latter seeing .complete as true immediately and
-skipping the yield altogether, even though finish_bh() still wakes it.
-
-With multiqueue, the BDS’s AioContext is not necessarily the thread
-start_co() runs in, and so finish_bh() may be scheduled to run in a
-different thread than start_co(). With the right timing, this will
-cause the problems described above; waking a non-yielding coroutine is
-not good, as can be reproduced by putting e.g. a usleep(100000) above
-the while loop in start_co() (and using multiqueue), giving finish_bh()
-a much better chance at exiting before start_co() can yield.
-
-So instead of scheduling finish_bh() in the BDS’s AioContext, schedule
-finish_bh() in task->co’s AioContext.
-
-In addition, we can get rid of task.complete altogether because we will
-get woken exactly once, when the task is indeed complete, no need to
-check.
-
-(We could go further and drop the BH, running aio_co_wake() directly in
-qemu_rbd_completion_cb() because we are allowed to do that even if the
-coroutine isn’t yet yielding and we’re in a different thread – but the
-doc comment on qemu_rbd_completion_cb() says to be careful, so I decided
-not to go so far here.)
-
-Buglink: https://issues.redhat.com/browse/RHEL-67115
-Reported-by: Junyao Zhao <junzhao@redhat.com>
-Cc: qemu-stable@nongnu.org
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-Message-ID: <20251110154854.151484-3-hreitz@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit 89d22536d1a1715083ef8118fe7e6e9239f900c1)
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
----
- block/rbd.c | 12 ++++--------
- 1 file changed, 4 insertions(+), 8 deletions(-)
-
-diff --git a/block/rbd.c b/block/rbd.c
-index 3611dc81cf..2a70b5a983 100644
---- a/block/rbd.c
-+++ b/block/rbd.c
-@@ -110,9 +110,7 @@ typedef struct BDRVRBDState {
- } BDRVRBDState;
-
- typedef struct RBDTask {
-- BlockDriverState *bs;
- Coroutine *co;
-- bool complete;
- int64_t ret;
- } RBDTask;
-
-@@ -1309,7 +1307,6 @@ static int qemu_rbd_resize(BlockDriverState *bs, uint64_t size)
- static void qemu_rbd_finish_bh(void *opaque)
- {
- RBDTask *task = opaque;
-- task->complete = true;
- aio_co_wake(task->co);
- }
-
-@@ -1326,7 +1323,7 @@ static void qemu_rbd_completion_cb(rbd_completion_t c, RBDTask *task)
- {
- task->ret = rbd_aio_get_return_value(c);
- rbd_aio_release(c);
-- aio_bh_schedule_oneshot(bdrv_get_aio_context(task->bs),
-+ aio_bh_schedule_oneshot(qemu_coroutine_get_aio_context(task->co),
- qemu_rbd_finish_bh, task);
- }
-
-@@ -1338,7 +1335,7 @@ static int coroutine_fn qemu_rbd_start_co(BlockDriverState *bs,
- RBDAIOCmd cmd)
- {
- BDRVRBDState *s = bs->opaque;
-- RBDTask task = { .bs = bs, .co = qemu_coroutine_self() };
-+ RBDTask task = { .co = qemu_coroutine_self() };
- rbd_completion_t c;
- int r;
-
-@@ -1401,9 +1398,8 @@ static int coroutine_fn qemu_rbd_start_co(BlockDriverState *bs,
- return r;
- }
-
-- while (!task.complete) {
-- qemu_coroutine_yield();
-- }
-+ /* Expect exactly a single wake from qemu_rbd_finish_bh() */
-+ qemu_coroutine_yield();
-
- if (task.ret < 0) {
- error_report("rbd request failed: cmd %d offset %" PRIu64 " bytes %"
---
-2.47.3
-
diff --git a/kvm-redhat-Add-new-rhel9.8.0-and-rhel10.2.0-machine-type.patch b/kvm-redhat-Add-new-rhel9.8.0-and-rhel10.2.0-machine-type.patch
deleted file mode 100644
index 5a719ff..0000000
--- a/kvm-redhat-Add-new-rhel9.8.0-and-rhel10.2.0-machine-type.patch
+++ /dev/null
@@ -1,99 +0,0 @@
-From 5c61c4d31ea23e30d79fb7d25d078d47701b2378 Mon Sep 17 00:00:00 2001
-From: Thomas Huth <thuth@redhat.com>
-Date: Thu, 18 Sep 2025 17:41:25 +0200
-Subject: [PATCH 03/10] redhat: Add new -rhel9.8.0 and -rhel10.2.0 machine
- types on s390x
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Thomas Huth <thuth@redhat.com>
-RH-MergeRequest: 412: Add -rhel9.8.0 and -rhel10.2.0 s390x machine types and enable the CPI feature
-RH-Jira: RHEL-104009 RHEL-105823 RHEL-73008
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [3/3] e9ad89069cb4b9badb1b5f57d78a043c64411b65 (thuth/qemu-kvm-cs)
-
-Upstream Status: RHEL only
-JIRA: https://issues.redhat.com/browse/RHEL-105823
-JIRA: https://issues.redhat.com/browse/RHEL-104009
-
-Add new -rhel9.8.0 and -rhel10.2.0 machine types that enable the
-CPI feature and have the "relaxed-translation" for PCI passthrough
-devices enabled by default.
-
-Signed-off-by: Thomas Huth <thuth@redhat.com>
----
- hw/s390x/s390-virtio-ccw.c | 34 +++++++++++++++++++++++++++++++---
- 1 file changed, 31 insertions(+), 3 deletions(-)
-
-diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
-index 9be423858d..4937a0c3b8 100644
---- a/hw/s390x/s390-virtio-ccw.c
-+++ b/hw/s390x/s390-virtio-ccw.c
-@@ -1172,8 +1172,18 @@ DEFINE_CCW_MACHINE(4, 2);
-
- #endif /* disabled for RHEL */
-
-+static void ccw_rhel_machine_10_2_0_instance_options(MachineState *machine)
-+{
-+}
-+
-+static void ccw_rhel_machine_10_2_0_class_options(MachineClass *mc)
-+{
-+}
-+DEFINE_CCW_MACHINE_AS_LATEST(10, 2, 0);
-+
- static void ccw_rhel_machine_10_0_0_instance_options(MachineState *machine)
- {
-+ ccw_rhel_machine_10_2_0_instance_options(machine);
- }
-
- static void ccw_rhel_machine_10_0_0_class_options(MachineClass *mc)
-@@ -1183,12 +1193,28 @@ static void ccw_rhel_machine_10_0_0_class_options(MachineClass *mc)
- { TYPE_S390_PCI_DEVICE, "relaxed-translation", "off", },
- };
-
-+ ccw_rhel_machine_10_2_0_class_options(mc);
-+
- compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
- compat_props_add(mc->compat_props, hw_compat_rhel_10_2, hw_compat_rhel_10_2_len);
- compat_props_add(mc->compat_props, hw_compat_rhel_10_1, hw_compat_rhel_10_1_len);
- s390mc->use_cpi = false;
- }
--DEFINE_CCW_MACHINE_AS_LATEST(10, 0, 0);
-+DEFINE_CCW_MACHINE(10, 0, 0);
-+
-+static void ccw_rhel_machine_9_8_0_instance_options(MachineState *machine)
-+{
-+ ccw_rhel_machine_10_2_0_instance_options(machine);
-+}
-+
-+static void ccw_rhel_machine_9_8_0_class_options(MachineClass *mc)
-+{
-+ ccw_rhel_machine_10_2_0_class_options(mc);
-+
-+ /* NB: remember to copy this line to the *latest* RHEL 9 machine */
-+ compat_props_add(mc->compat_props, hw_compat_rhel_9, hw_compat_rhel_9_len);
-+}
-+DEFINE_CCW_MACHINE(9, 8, 0);
-
- static void ccw_rhel_machine_9_6_0_instance_options(MachineState *machine)
- {
-@@ -1197,9 +1223,11 @@ static void ccw_rhel_machine_9_6_0_instance_options(MachineState *machine)
-
- static void ccw_rhel_machine_9_6_0_class_options(MachineClass *mc)
- {
-+ /*
-+ * NB: -rhel9.6 was on a par with -rhel10.0, so we derive from that
-+ * instead of deriving from the 9.8 machine type
-+ */
- ccw_rhel_machine_10_0_0_class_options(mc);
--
-- /* NB: remember to move this line to the *latest* RHEL 9 machine */
- compat_props_add(mc->compat_props, hw_compat_rhel_9, hw_compat_rhel_9_len);
- }
- DEFINE_CCW_MACHINE(9, 6, 0);
---
-2.47.3
-
diff --git a/kvm-redhat-allow-5-level-paging-for-TDX-VMs.patch b/kvm-redhat-allow-5-level-paging-for-TDX-VMs.patch
deleted file mode 100644
index 533cfcf..0000000
--- a/kvm-redhat-allow-5-level-paging-for-TDX-VMs.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 966c9312152322e6c2bb434861388a34754911c8 Mon Sep 17 00:00:00 2001
-From: Paolo Bonzini <pbonzini@redhat.com>
-Date: Fri, 18 Jul 2025 18:03:50 +0200
-Subject: [PATCH 4/4] redhat: allow 5-level paging for TDX VMs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Paolo Bonzini <pbonzini@redhat.com>
-RH-MergeRequest: 450: redhat: allow 5-level paging for TDX VMs
-RH-Jira: RHEL-111853
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Daniel P. Berrangé <berrange@redhat.com>
-RH-Commit: [1/1] d3ffac324cfbf79d99763b9d3d29797d883f4969 (bonzini/qemu-kvm-centos)
-
-Without this patch, when booting a TDX guest, qemu outputs,
-
-qemu-kvm: TDX requires guest CPU physical bits (48) to match host CPU physical bits (52)
-
-This is due to different machine types in RHEL vs. upstream, and therefore
-must be kept forever as a delta from upstream.
-
-Resolves: https://issues.redhat.com/browse/RHEL-111853
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
----
- target/i386/kvm/tdx.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
-index dbf0fa2c91..91fe19b7d4 100644
---- a/target/i386/kvm/tdx.c
-+++ b/target/i386/kvm/tdx.c
-@@ -754,6 +754,7 @@ static void tdx_cpu_instance_init(X86ConfidentialGuest *cg, CPUState *cpu)
- }
-
- object_property_set_bool(OBJECT(cpu), "pmu", false, &error_abort);
-+ object_property_set_int(OBJECT(cpu), "host-phys-bits-limit", 0, &error_abort);
-
- /* invtsc is fixed1 for TD guest */
- object_property_set_bool(OBJECT(cpu), "invtsc", true, &error_abort);
---
-2.47.3
-
diff --git a/kvm-rh-aarch64-rh-devices.mak-Add-CONFIG_TEGRA241_CMDQV.patch b/kvm-rh-aarch64-rh-devices.mak-Add-CONFIG_TEGRA241_CMDQV.patch
deleted file mode 100644
index a152704..0000000
--- a/kvm-rh-aarch64-rh-devices.mak-Add-CONFIG_TEGRA241_CMDQV.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 88c650be0128e88319d63ceed6d9f099a4a25f2e Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Thu, 7 May 2026 08:59:56 +0200
-Subject: [PATCH 111/111] rh: aarch64-rh-devices.mak: Add CONFIG_TEGRA241_CMDQV
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [111/111] 4c8d5826d2e77ed8437273d91928bd6166236807 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-UPSTREAM: RH Only
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- configs/devices/aarch64-softmmu/aarch64-rh-devices.mak | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak b/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak
-index 92d0b322d0..b0bfc18af3 100644
---- a/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak
-+++ b/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak
-@@ -4,6 +4,7 @@ CONFIG_ARM_GIC_KVM=y
- CONFIG_ARM_GICV3=y
- CONFIG_ARM_GIC=y
- CONFIG_ARM_SMMUV3=y
-+CONFIG_TEGRA241_CMDQV=y
- CONFIG_ARM_VIRT=y
- CONFIG_CXL=y
- CONFIG_CXL_MEM_DEVICE=y
---
-2.52.0
-
diff --git a/kvm-rh-configs-enable-CONFIG_TDX-for-x86_64.patch b/kvm-rh-configs-enable-CONFIG_TDX-for-x86_64.patch
deleted file mode 100644
index 68bc045..0000000
--- a/kvm-rh-configs-enable-CONFIG_TDX-for-x86_64.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 94e93fc7673af3236dc13cd8cfe90953c48bc813 Mon Sep 17 00:00:00 2001
-From: Paolo Bonzini <pbonzini@redhat.com>
-Date: Fri, 12 Dec 2025 12:30:30 +0100
-Subject: [PATCH 6/6] rh: configs: enable CONFIG_TDX for x86_64
-
-RH-Author: Paolo Bonzini <pbonzini@redhat.com>
-RH-MergeRequest: 445: rh: configs: enable CONFIG_TDX for x86_64
-RH-Jira: RHEL-111853
-RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
-RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-RH-Commit: [1/1] 282972aa9e4f94097c68b046f6bb09c4b03705fc (bonzini/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-111853
-
-TDX support is included in 10.1 but we still need to enable it,
-because RHEL is built --without-default-devices.
-
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
----
- configs/devices/x86_64-softmmu/x86_64-rh-devices.mak | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak
-index 1f244f766d..9063ae1b53 100644
---- a/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak
-+++ b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak
-@@ -74,6 +74,7 @@ CONFIG_SERIAL_PCI=y
- CONFIG_SEV=y
- CONFIG_SMBIOS=y
- CONFIG_SMBUS_EEPROM=y
-+CONFIG_TDX=y
- CONFIG_TEST_DEVICES=y
- CONFIG_USB=y
- CONFIG_USB_EHCI=y
---
-2.47.3
-
diff --git a/kvm-rh-enable-CONFIG_USB_STORAGE_BOT.patch b/kvm-rh-enable-CONFIG_USB_STORAGE_BOT.patch
deleted file mode 100644
index 8a0984d..0000000
--- a/kvm-rh-enable-CONFIG_USB_STORAGE_BOT.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From c70f4d1ef65ee432a5f2cedb94447d705f6d8686 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
-Date: Mon, 3 Nov 2025 14:35:38 +0400
-Subject: [PATCH 10/10] rh: enable CONFIG_USB_STORAGE_BOT
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
-RH-MergeRequest: 417: rh: enable CONFIG_USB_STORAGE_BOT
-RH-Jira: RHEL-101929
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/1] 612acd1d19c799c7441f63548648eb70b9e1dfd6 (marcandre.lureau-rh/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-101929
-
-Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
----
- configs/devices/aarch64-softmmu/aarch64-rh-devices.mak | 1 +
- configs/devices/riscv64-softmmu/riscv64-rh-devices.mak | 1 +
- configs/devices/x86_64-softmmu/x86_64-rh-devices.mak | 1 +
- 3 files changed, 3 insertions(+)
-
-diff --git a/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak b/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak
-index 855278f70e..92d0b322d0 100644
---- a/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak
-+++ b/configs/devices/aarch64-softmmu/aarch64-rh-devices.mak
-@@ -19,6 +19,7 @@ CONFIG_SEMIHOSTING=y
- CONFIG_USB=y
- CONFIG_USB_XHCI=y
- CONFIG_USB_XHCI_PCI=y
-+CONFIG_USB_STORAGE_BOT=y
- CONFIG_USB_STORAGE_CORE=y
- CONFIG_USB_STORAGE_CLASSIC=y
- CONFIG_USB_HUB=y
-diff --git a/configs/devices/riscv64-softmmu/riscv64-rh-devices.mak b/configs/devices/riscv64-softmmu/riscv64-rh-devices.mak
-index b5e55de916..5ac051f90b 100644
---- a/configs/devices/riscv64-softmmu/riscv64-rh-devices.mak
-+++ b/configs/devices/riscv64-softmmu/riscv64-rh-devices.mak
-@@ -15,6 +15,7 @@ CONFIG_SEMIHOSTING=y
- CONFIG_USB=y
- CONFIG_USB_XHCI=y
- CONFIG_USB_XHCI_PCI=y
-+CONFIG_USB_STORAGE_BOT=y
- CONFIG_USB_STORAGE_CORE=y
- CONFIG_USB_STORAGE_CLASSIC=y
- CONFIG_USB_HUB=y
-diff --git a/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak
-index 828cb8aa6f..1f244f766d 100644
---- a/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak
-+++ b/configs/devices/x86_64-softmmu/x86_64-rh-devices.mak
-@@ -79,6 +79,7 @@ CONFIG_USB=y
- CONFIG_USB_EHCI=y
- CONFIG_USB_EHCI_PCI=y
- CONFIG_USB_SMARTCARD=y
-+CONFIG_USB_STORAGE_BOT=y
- CONFIG_USB_STORAGE_CORE=y
- CONFIG_USB_STORAGE_CLASSIC=y
- CONFIG_USB_UHCI=y
---
-2.47.3
-
diff --git a/kvm-s390x-css-firm-up-handling-of-chained-TIC-CCWs.patch b/kvm-s390x-css-firm-up-handling-of-chained-TIC-CCWs.patch
deleted file mode 100644
index 876494a..0000000
--- a/kvm-s390x-css-firm-up-handling-of-chained-TIC-CCWs.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-From b02928d3eec7a63f029b3881788f7d8bd0780a17 Mon Sep 17 00:00:00 2001
-From: Christoph Schlameuss <cschlame@redhat.com>
-Date: Thu, 16 Jul 2026 10:34:43 +0200
-Subject: [PATCH 12/12] s390x/css: firm up handling of chained TIC CCWs
-
-RH-Author: Christoph Schlameuss <None>
-RH-MergeRequest: 510: s390x: interface harding fixes
-RH-Jira: RHEL-192791
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: acordeir <None>
-RH-Commit: [9/9] 19745abb6f8cc576ccf6d561c0c8f1341ffe7ed8 (cschlame/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-192791
-
-commit 33bece0fa121c0a85df4f0372145ca74b967e78e
-Author: Eric Farman <farman@linux.ibm.com>
-Date: Mon Jul 13 09:47:08 2026 +0200
-
- s390x/css: firm up handling of chained TIC CCWs
-
- The logic in css_interpret_ccw() correctly returns -EINVAL if a
- Transfer-In-Channel (TIC) CCW is command chained to another TIC CCW.
- The same routine also correctly returns -EINVAL if 256 CCWs do not
- perform a data transfer as part of the I/O operation [0].
-
- What is missing, however, is a combination of these two, where a loop
- can be generated that will continue processing CCWs but without
- providing an opportunity to catch a breath. Fix this by capping
- the number of TIC CCWs in a channel program at the same limit as
- the CCWs without data transfer.
-
- [0] See "Invalid Sequence" in z/Architecture Principles of Operation
- (SA22-7832-14), p16-27
-
- Cc: qemu-stable@nongnu.org
- Signed-off-by: Eric Farman <farman@linux.ibm.com>
- Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
- Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Message-ID: <20260713074708.884282-1-borntraeger@linux.ibm.com>
- Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-
-Signed-off-by: Christoph Schlameuss <cschlame@redhat.com>
----
- hw/s390x/css.c | 7 +++++++
- include/hw/s390x/css.h | 1 +
- 2 files changed, 8 insertions(+)
-
-diff --git a/hw/s390x/css.c b/hw/s390x/css.c
-index d89c223339..63947eff5a 100644
---- a/hw/s390x/css.c
-+++ b/hw/s390x/css.c
-@@ -1075,6 +1075,12 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr ccw_addr,
- ret = -EINVAL;
- break;
- }
-+ /* Limit the number of TICs in a given channel program */
-+ if (sch->ccw_tic_cnt == 255) {
-+ ret = -EINVAL;
-+ break;
-+ }
-+ sch->ccw_tic_cnt++;
- sch->channel_prog = ccw.cda;
- ret = -EAGAIN;
- break;
-@@ -1126,6 +1132,7 @@ static void sch_handle_start_func_virtual(SubchDev *sch)
- sch->ccw_fmt_1 = !!(orb->ctrl0 & ORB_CTRL0_MASK_FMT);
- schib->scsw.flags |= (sch->ccw_fmt_1) ? SCSW_FLAGS_MASK_FMT : 0;
- sch->ccw_no_data_cnt = 0;
-+ sch->ccw_tic_cnt = 0;
- suspend_allowed = !!(orb->ctrl0 & ORB_CTRL0_MASK_SPND);
- } else {
- /* Start Function resumed via rsch */
-diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h
-index 0b0400a9d4..17385140c3 100644
---- a/include/hw/s390x/css.h
-+++ b/include/hw/s390x/css.h
-@@ -132,6 +132,7 @@ struct SubchDev {
- bool ccw_fmt_1;
- bool thinint_active;
- uint8_t ccw_no_data_cnt;
-+ uint8_t ccw_tic_cnt;
- uint16_t migrated_schid; /* used for mismatch detection */
- CcwDataStream cds;
- /* transport-provided data: */
---
-2.52.0
-
diff --git a/kvm-s390x-css-limit-number-of-CHPIDs-in-description.patch b/kvm-s390x-css-limit-number-of-CHPIDs-in-description.patch
deleted file mode 100644
index d88c553..0000000
--- a/kvm-s390x-css-limit-number-of-CHPIDs-in-description.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-From 459bb0c6ebf1b985ba2dce97818f7d5b9e46020c Mon Sep 17 00:00:00 2001
-From: Christoph Schlameuss <cschlame@redhat.com>
-Date: Sat, 11 Jul 2026 14:58:01 +0200
-Subject: [PATCH 04/12] s390x/css: limit number of CHPIDs in description
-
-RH-Author: Christoph Schlameuss <None>
-RH-MergeRequest: 510: s390x: interface harding fixes
-RH-Jira: RHEL-192791
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: acordeir <None>
-RH-Commit: [1/9] 254d87004bf31f31ee0cc3e203aaa99e9cbd15e2 (cschlame/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-192791
-
-commit 22f2da06a8b291c975a7caf05dbd3b180c856741
-Author: Eric Farman <farman@linux.ibm.com>
-Date: Tue Jul 7 09:07:28 2026 +0200
-
- s390x/css: limit number of CHPIDs in description
-
- virtio-ccw uses a single virtual CHPID for all devices and
- device-types, but vfio-ccw (passthrough) shares real CHPID
- information with the guest. A sufficiently large passthrough
- configuration would exceed the defined response payload.
-
- Fix this by limiting the number of CHPID descriptions that
- are returned based on the given response format.
-
- Cc: qemu-stable@nongnu.org
- Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
- Signed-off-by: Eric Farman <farman@linux.ibm.com>
- Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Message-ID: <20260707070728.147203-6-borntraeger@linux.ibm.com>
- Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-
-Signed-off-by: Christoph Schlameuss <cschlame@redhat.com>
----
- hw/s390x/css.c | 17 +++++++++++++++++
- 1 file changed, 17 insertions(+)
-
-diff --git a/hw/s390x/css.c b/hw/s390x/css.c
-index 53444f6828..d89c223339 100644
---- a/hw/s390x/css.c
-+++ b/hw/s390x/css.c
-@@ -1871,6 +1871,7 @@ int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_chpid,
- int i, desc_size;
- uint32_t words[8];
- uint32_t chpid_type_word;
-+ uint32_t max_chpids, chpid_count = 0;
- CssImage *css;
-
- if (!m && !cssid) {
-@@ -1881,9 +1882,25 @@ int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_chpid,
- if (!css) {
- return 0;
- }
-+
-+ if (rfmt == 0) {
-+ max_chpids = 256;
-+ } else if (rfmt == 1) {
-+ max_chpids = 127;
-+ } else {
-+ /* Should be rejected by caller */
-+ return 0;
-+ }
-+
- desc_size = 0;
- for (i = f_chpid; i <= l_chpid; i++) {
- if (css->chpids[i].in_use) {
-+ /* Limit number of CHPIDs sent back */
-+ if (chpid_count == max_chpids) {
-+ break;
-+ }
-+
-+ chpid_count++;
- chpid_type_word = 0x80000000 | (css->chpids[i].type << 8) | i;
- if (rfmt == 0) {
- words[0] = cpu_to_be32(chpid_type_word);
---
-2.52.0
-
diff --git a/kvm-s390x-ioinst-Require-strict-length-and-format-for-SE.patch b/kvm-s390x-ioinst-Require-strict-length-and-format-for-SE.patch
deleted file mode 100644
index d8df1af..0000000
--- a/kvm-s390x-ioinst-Require-strict-length-and-format-for-SE.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From c1dcb5bd9b4f2ed7a057f475861a9ebb72f00f67 Mon Sep 17 00:00:00 2001
-From: Christoph Schlameuss <cschlame@redhat.com>
-Date: Sat, 11 Jul 2026 14:58:01 +0200
-Subject: [PATCH 05/12] s390x/ioinst: Require strict length and format for SEI
- CHSC handler
-
-RH-Author: Christoph Schlameuss <None>
-RH-MergeRequest: 510: s390x: interface harding fixes
-RH-Jira: RHEL-192791
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: acordeir <None>
-RH-Commit: [2/9] 6d8c4d614b902223a3e926641aac736cbcb596fc (cschlame/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-192791
-
-commit 386268daea86e53d90baf99df5c7b8e2727ea783
-Author: Matthew Rosato <mjrosato@linux.ibm.com>
-Date: Tue Jul 7 09:07:27 2026 +0200
-
- s390x/ioinst: Require strict length and format for SEI CHSC handler
-
- Ensure SEI commands that are received are of the appropriate length and
- format before handling.
-
- Cc: qemu-stable@nongnu.org
- Fixes: 8cba80c3a0 ("s390: Add PCI bus support")
- Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
- Reviewed-by: Eric Farman <farman@linux.ibm.com>
- Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
- Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Message-ID: <20260707070728.147203-5-borntraeger@linux.ibm.com>
- Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-
-Signed-off-by: Christoph Schlameuss <cschlame@redhat.com>
----
- target/s390x/ioinst.c | 20 ++++++++++++++++++++
- 1 file changed, 20 insertions(+)
-
-diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c
-index 2320dd4c12..94619f9215 100644
---- a/target/s390x/ioinst.c
-+++ b/target/s390x/ioinst.c
-@@ -609,13 +609,27 @@ static int chsc_sei_nt2_have_event(void)
-
- #define CHSC_SEI_NT0 (1ULL << 63)
- #define CHSC_SEI_NT2 (1ULL << 61)
-+#define CHSC_SEI_0_FMT 0x0f000000
- static void ioinst_handle_chsc_sei(ChscReq *req, ChscResp *res)
- {
- uint64_t selection_mask = ldq_be_p(&req->param1);
-+ uint32_t param0 = be32_to_cpu(req->param0);
- uint8_t *res_flags = (uint8_t *)res->data;
-+ uint16_t len = be16_to_cpu(req->len);
-+ uint16_t resp_code;
- int have_event = 0;
- int have_more = 0;
-
-+ if (len != 0x0010) {
-+ resp_code = 0x0003;
-+ goto out_err;
-+ }
-+
-+ if (param0 & CHSC_SEI_0_FMT) {
-+ resp_code = 0x0007;
-+ goto out_err;
-+ }
-+
- /* regarding architecture nt0 can not be masked */
- have_event = !chsc_sei_nt0_get_event(res);
- have_more = chsc_sei_nt0_have_event();
-@@ -642,6 +656,12 @@ static void ioinst_handle_chsc_sei(ChscReq *req, ChscResp *res)
- res->code = cpu_to_be16(0x0005);
- res->len = cpu_to_be16(CHSC_MIN_RESP_LEN);
- }
-+ return;
-+
-+ out_err:
-+ res->code = cpu_to_be16(resp_code);
-+ res->len = cpu_to_be16(CHSC_MIN_RESP_LEN);
-+ res->param = 0;
- }
-
- static void ioinst_handle_chsc_unimplemented(ChscResp *res)
---
-2.52.0
-
diff --git a/kvm-s390x-kvm-clamp-stsi-3.2.2-size.patch b/kvm-s390x-kvm-clamp-stsi-3.2.2-size.patch
deleted file mode 100644
index 3588157..0000000
--- a/kvm-s390x-kvm-clamp-stsi-3.2.2-size.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 11005598084892e065466adc25a0cf125c03d826 Mon Sep 17 00:00:00 2001
-From: Christoph Schlameuss <cschlame@redhat.com>
-Date: Sat, 11 Jul 2026 14:58:15 +0200
-Subject: [PATCH 09/12] s390x/kvm: clamp stsi 3.2.2 size
-
-RH-Author: Christoph Schlameuss <None>
-RH-MergeRequest: 510: s390x: interface harding fixes
-RH-Jira: RHEL-192791
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: acordeir <None>
-RH-Commit: [6/9] b2551d15e058714d1ca135308a6f9d5e537cd6fe (cschlame/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-192791
-
-commit a57e4612b61da20ddab196502c76b4dc05da1de8
-Author: Christian Borntraeger <borntraeger@linux.ibm.com>
-Date: Mon Jun 22 11:20:35 2026 +0200
-
- s390x/kvm: clamp stsi 3.2.2 size
-
- The stsi 3.2.2 page is being prepared by the kvm module and the size is
- clamped by the kernel. As the memory is mapped in the guest, another
- guest VCPU could race and overwrite the count and messing up the move
- operation. For any out of bound count, fall back to the kernel buffer.
-
- Cc: qemu-stable@nongnu.org
- Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Reviewed-by: Eric Farman <farman@linux.ibm.com>
- Message-ID: <20260622092035.400959-1-borntraeger@linux.ibm.com>
- Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-
-Signed-off-by: Christoph Schlameuss <cschlame@redhat.com>
----
- target/s390x/kvm/kvm.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
-index 491cc5f975..0cbd254655 100644
---- a/target/s390x/kvm/kvm.c
-+++ b/target/s390x/kvm/kvm.c
-@@ -1791,6 +1791,15 @@ static void insert_stsi_3_2_2(S390CPU *cpu, __u64 addr, uint8_t ar)
- } else if (s390_cpu_virt_mem_read(cpu, addr, ar, &sysib, sizeof(sysib))) {
- return;
- }
-+
-+ /*
-+ * The memory was filled by the kernel but mapped into the guest.
-+ * If something is fishy, do not touch the buffer.
-+ */
-+ if (sysib.count == 0 || sysib.count > ARRAY_SIZE(sysib.ext_names)) {
-+ return;
-+ }
-+
- /* Shift the stack of Extended Names to prepare for our own data */
- memmove(&sysib.ext_names[1], &sysib.ext_names[0],
- sizeof(sysib.ext_names[0]) * (sysib.count - 1));
---
-2.52.0
-
diff --git a/kvm-s390x-pci-Shrink-RPCIT-ranges-to-registered-window.patch b/kvm-s390x-pci-Shrink-RPCIT-ranges-to-registered-window.patch
deleted file mode 100644
index f4f5147..0000000
--- a/kvm-s390x-pci-Shrink-RPCIT-ranges-to-registered-window.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 170dc4d69a492c43d9ed6245abac91ce9ea2a6f1 Mon Sep 17 00:00:00 2001
-From: Christoph Schlameuss <cschlame@redhat.com>
-Date: Sat, 11 Jul 2026 14:58:01 +0200
-Subject: [PATCH 06/12] s390x/pci: Shrink RPCIT ranges to registered window
-
-RH-Author: Christoph Schlameuss <None>
-RH-MergeRequest: 510: s390x: interface harding fixes
-RH-Jira: RHEL-192791
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: acordeir <None>
-RH-Commit: [3/9] 50b2f5350069c1e213dac06f8b9c2c002df84525 (cschlame/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-192791
-
-commit b8c8ec1d752661e1904d089c77d8617c4b6bfb5a
-Author: Matthew Rosato <mjrosato@linux.ibm.com>
-Date: Tue Jul 7 09:07:26 2026 +0200
-
- s390x/pci: Shrink RPCIT ranges to registered window
-
- Today, if a RPCIT instruction is presented from the guest whose range
- exceeds the previously-registered IOAT, QEMU will process the range
- so long as 1) the specified range at least partially overlaps with
- what was previously registered and 2) the guest has valid IOAT entries
- in its table. If the entries are not present (invalid), then the
- RPCIT will unnecessarily spend time reporting the invalid
- region/segment entries.
-
- Optimize this path by exiting immediately if the requested range falls
- completely outside of the previously-registered range or if the
- requested range ends before it starts (which would only occur if the
- guest-specified address + length would overflow a u64). Otherwise,
- clamp the request to only the portion of the range that overlaps with
- what was previously registered, effectively ignoring the portion
- outside of the registered range.
-
- Cc: qemu-stable@nongnu.org
- Fixes: 5d1abf2344 ("s390x/pci: enforce zPCI state checking")
- Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
- Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
- Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Message-ID: <20260707070728.147203-4-borntraeger@linux.ibm.com>
- Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-
-Signed-off-by: Christoph Schlameuss <cschlame@redhat.com>
----
- hw/s390x/s390-pci-inst.c | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
-index a3bb5aa221..5a2aa1c12e 100644
---- a/hw/s390x/s390-pci-inst.c
-+++ b/hw/s390x/s390-pci-inst.c
-@@ -753,10 +753,16 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra)
- goto err;
- }
-
-- if (end < iommu->pba || start > iommu->pal) {
-+ if (end < start || end < iommu->pba || start > iommu->pal) {
- error = ERR_EVENT_OORANGE;
- goto err;
- }
-+ /*
-+ * If the specified range at least partially overlaps the registered
-+ * aperture, clamp the request to the aperture and ignore the rest.
-+ */
-+ sstart = MAX(start, iommu->pba);
-+ end = MIN(end, iommu->pal + 1);
-
- retry:
- start = sstart;
---
-2.52.0
-
diff --git a/kvm-s390x-pci-Tighten-region-detection-for-BAR-read-writ.patch b/kvm-s390x-pci-Tighten-region-detection-for-BAR-read-writ.patch
deleted file mode 100644
index 3078a30..0000000
--- a/kvm-s390x-pci-Tighten-region-detection-for-BAR-read-writ.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 624da84e824b854a9cbd64be087627d6991f8358 Mon Sep 17 00:00:00 2001
-From: Christoph Schlameuss <cschlame@redhat.com>
-Date: Sat, 11 Jul 2026 14:58:15 +0200
-Subject: [PATCH 07/12] s390x/pci: Tighten region detection for BAR read/write
-
-RH-Author: Christoph Schlameuss <None>
-RH-MergeRequest: 510: s390x: interface harding fixes
-RH-Jira: RHEL-192791
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: acordeir <None>
-RH-Commit: [4/9] 187be7e6318f69afd409a43a36ebc9ecfb295dec (cschlame/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-192791
-
-commit 2d709a70c75724e972126671b2e2c0fca0b6e239
-Author: Matthew Rosato <mjrosato@linux.ibm.com>
-Date: Tue Jul 7 09:07:25 2026 +0200
-
- s390x/pci: Tighten region detection for BAR read/write
-
- For PCISTG/PCISTB/PCILG instruction emulation, ensure that the offset
- and length provided by the guest does not overflow, and only return
- a memory region when the specified offset+length combination matches
- an existing subregion or the parent region.
-
- Cc: qemu-stable@nongnu.org
- Fixes: 4f6482bfe3 ("s390x/pci: search for subregion inside the BARs")
- Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
- Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
- Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Message-ID: <20260707070728.147203-3-borntraeger@linux.ibm.com>
- Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-
-Signed-off-by: Christoph Schlameuss <cschlame@redhat.com>
----
- hw/s390x/s390-pci-inst.c | 24 +++++++++++++++++++++++-
- 1 file changed, 23 insertions(+), 1 deletion(-)
-
-diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
-index 5a2aa1c12e..17d74d8542 100644
---- a/hw/s390x/s390-pci-inst.c
-+++ b/hw/s390x/s390-pci-inst.c
-@@ -392,13 +392,22 @@ static int zpci_endian_swap(uint64_t *ptr, uint8_t len)
- static MemoryRegion *s390_get_subregion(MemoryRegion *mr, uint64_t offset,
- uint8_t len)
- {
-+ uint64_t last = offset + len;
- MemoryRegion *subregion;
- uint64_t subregion_size;
-
-+ /*
-+ * Ensure the region is valid, the calculated address cannot wrap and that
-+ * it falls within this region.
-+ */
-+ if (!mr || offset > last || last > memory_region_size(mr)) {
-+ return NULL;
-+ }
-+
- QTAILQ_FOREACH(subregion, &mr->subregions, subregions_link) {
- subregion_size = int128_get64(subregion->size);
- if ((offset >= subregion->addr) &&
-- (offset + len) <= (subregion->addr + subregion_size)) {
-+ (last) <= (subregion->addr + subregion_size)) {
- mr = subregion;
- break;
- }
-@@ -413,6 +422,10 @@ static MemTxResult zpci_read_bar(S390PCIBusDevice *pbdev, uint8_t pcias,
-
- mr = pbdev->pdev->io_regions[pcias].memory;
- mr = s390_get_subregion(mr, offset, len);
-+ if (!mr) {
-+ return MEMTX_ERROR;
-+ }
-+
- offset -= mr->addr;
- return memory_region_dispatch_read(mr, offset, data,
- size_memop(len) | MO_BE,
-@@ -513,6 +526,10 @@ static MemTxResult zpci_write_bar(S390PCIBusDevice *pbdev, uint8_t pcias,
-
- mr = pbdev->pdev->io_regions[pcias].memory;
- mr = s390_get_subregion(mr, offset, len);
-+ if (!mr) {
-+ return MEMTX_ERROR;
-+ }
-+
- offset -= mr->addr;
- return memory_region_dispatch_write(mr, offset, data,
- size_memop(len) | MO_BE,
-@@ -906,6 +923,11 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr,
-
- mr = pbdev->pdev->io_regions[pcias].memory;
- mr = s390_get_subregion(mr, offset, len);
-+ if (!mr) {
-+ s390_program_interrupt(env, PGM_OPERAND, ra);
-+ return 0;
-+ }
-+
- offset -= mr->addr;
-
- for (i = 0; i < len; i += 8) {
---
-2.52.0
-
diff --git a/kvm-s390x-s390-pci-vfio.c-use-QOM-casts-where-appropriat.patch b/kvm-s390x-s390-pci-vfio.c-use-QOM-casts-where-appropriat.patch
deleted file mode 100644
index 54746ce..0000000
--- a/kvm-s390x-s390-pci-vfio.c-use-QOM-casts-where-appropriat.patch
+++ /dev/null
@@ -1,99 +0,0 @@
-From 28871cb5c6ef8c6f02786ebfef42f5080c8e7b9b Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:26:01 +0100
-Subject: [PATCH 066/116] s390x/s390-pci-vfio.c: use QOM casts where
- appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [50/100] ac7a09a8ded0883e74316ac4b8c8bd4af1e3f35a (rovick1/qemu-kvm)
-
-Use QOM casts to cast to VFIOPCIDevice instead of using container_of().
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
-Reviewed-by: Eric Farman <farman@linux.ibm.com>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-22-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit e2827210d6a9c56c1b14b00b414dfa9eb7843711)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/s390x/s390-pci-vfio.c | 14 +++++++-------
- 1 file changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c
-index c51bcea5fc..7760780aff 100644
---- a/hw/s390x/s390-pci-vfio.c
-+++ b/hw/s390x/s390-pci-vfio.c
-@@ -62,7 +62,7 @@ S390PCIDMACount *s390_pci_start_dma_count(S390pciState *s,
- {
- S390PCIDMACount *cnt;
- uint32_t avail;
-- VFIOPCIDevice *vpdev = container_of(pbdev->pdev, VFIOPCIDevice, pdev);
-+ VFIOPCIDevice *vpdev = VFIO_PCI_BASE(pbdev->pdev);
- int id;
-
- assert(vpdev);
-@@ -108,7 +108,7 @@ static void s390_pci_read_base(S390PCIBusDevice *pbdev,
- {
- struct vfio_info_cap_header *hdr;
- struct vfio_device_info_cap_zpci_base *cap;
-- VFIOPCIDevice *vpci = container_of(pbdev->pdev, VFIOPCIDevice, pdev);
-+ VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
- uint64_t vfio_size;
-
- hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_BASE);
-@@ -162,7 +162,7 @@ static bool get_host_fh(S390PCIBusDevice *pbdev, struct vfio_device_info *info,
- {
- struct vfio_info_cap_header *hdr;
- struct vfio_device_info_cap_zpci_base *cap;
-- VFIOPCIDevice *vpci = container_of(pbdev->pdev, VFIOPCIDevice, pdev);
-+ VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
-
- hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_BASE);
-
-@@ -185,7 +185,7 @@ static void s390_pci_read_group(S390PCIBusDevice *pbdev,
- struct vfio_device_info_cap_zpci_group *cap;
- S390pciState *s = s390_get_phb();
- ClpRspQueryPciGrp *resgrp;
-- VFIOPCIDevice *vpci = container_of(pbdev->pdev, VFIOPCIDevice, pdev);
-+ VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
- uint8_t start_gid = pbdev->zpci_fn.pfgid;
-
- hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_GROUP);
-@@ -264,7 +264,7 @@ static void s390_pci_read_util(S390PCIBusDevice *pbdev,
- {
- struct vfio_info_cap_header *hdr;
- struct vfio_device_info_cap_zpci_util *cap;
-- VFIOPCIDevice *vpci = container_of(pbdev->pdev, VFIOPCIDevice, pdev);
-+ VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
-
- hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_UTIL);
-
-@@ -291,7 +291,7 @@ static void s390_pci_read_pfip(S390PCIBusDevice *pbdev,
- {
- struct vfio_info_cap_header *hdr;
- struct vfio_device_info_cap_zpci_pfip *cap;
-- VFIOPCIDevice *vpci = container_of(pbdev->pdev, VFIOPCIDevice, pdev);
-+ VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
-
- hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_PFIP);
-
-@@ -314,7 +314,7 @@ static void s390_pci_read_pfip(S390PCIBusDevice *pbdev,
-
- static struct vfio_device_info *get_device_info(S390PCIBusDevice *pbdev)
- {
-- VFIOPCIDevice *vfio_pci = container_of(pbdev->pdev, VFIOPCIDevice, pdev);
-+ VFIOPCIDevice *vfio_pci = VFIO_PCI_BASE(pbdev->pdev);
-
- return vfio_get_device_info(vfio_pci->vbasedev.fd);
- }
---
-2.52.0
-
diff --git a/kvm-s390x-sclp-prevent-re-reading-the-sclp-header.patch b/kvm-s390x-sclp-prevent-re-reading-the-sclp-header.patch
deleted file mode 100644
index c6a790c..0000000
--- a/kvm-s390x-sclp-prevent-re-reading-the-sclp-header.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From e2c3b08190f32460c9046fd71da7ea96fdca4afe Mon Sep 17 00:00:00 2001
-From: Christoph Schlameuss <cschlame@redhat.com>
-Date: Thu, 16 Jul 2026 10:34:43 +0200
-Subject: [PATCH 10/12] s390x/sclp: prevent re-reading the sclp header
-
-RH-Author: Christoph Schlameuss <None>
-RH-MergeRequest: 510: s390x: interface harding fixes
-RH-Jira: RHEL-192791
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: acordeir <None>
-RH-Commit: [7/9] f84a26f6a6546cc221689dff2a415053462bf4ab (cschlame/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-192791
-
-commit 20701190e023216d0213a107a491402ce2cc501e
-Author: Christian Borntraeger <borntraeger@linux.ibm.com>
-Date: Thu Jul 9 16:29:05 2026 +0200
-
- s390x/sclp: prevent re-reading the sclp header
-
- We verify the sccb length and then allocate based on that length. The
- following access re-reads the sccb again. This can race against other
- vCPUs overwriting the length field.
-
- sclp_service_call_protected does not need a change as the ultravisor
- provides a consistent snapshot.
-
- Fixes: c1db53a5910f ("s390/sclp: read sccb from mem based on provided length")
- Cc: qemu-stable@nongnu.org
- Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
- Reviewed-by: Eric Farman <farman@linux.ibm.com>
- Reviewed-by: Collin Walling <walling@linux.ibm.com>
- Message-ID: <20260709142906.197474-2-borntraeger@linux.ibm.com>
- Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-
-Conflicts: target code is still using cpu_physical_memory_read() instead
- of upsteam having switched to address_space_read() and
- handling possible errors; sticking to old behavior for now
-
-Signed-off-by: Christoph Schlameuss <cschlame@redhat.com>
----
- hw/s390x/sclp.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
-index 16057356b1..27a354029c 100644
---- a/hw/s390x/sclp.c
-+++ b/hw/s390x/sclp.c
-@@ -328,10 +328,12 @@ int sclp_service_call(S390CPU *cpu, uint64_t sccb, uint32_t code)
- /*
- * we want to work on a private copy of the sccb, to prevent guests
- * from playing dirty tricks by modifying the memory content after
-- * the host has checked the values
-+ * the host has checked the values.
-+ * Reuse the previously fetched header
- */
- work_sccb = g_malloc0(be16_to_cpu(header.length));
- cpu_physical_memory_read(sccb, work_sccb, be16_to_cpu(header.length));
-+ work_sccb->h = header;
-
- if (!sclp_command_code_valid(code)) {
- work_sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);
---
-2.52.0
-
diff --git a/kvm-s390x-sclp-reject-invalid-write-event-data-headers.patch b/kvm-s390x-sclp-reject-invalid-write-event-data-headers.patch
deleted file mode 100644
index 3c3b02c..0000000
--- a/kvm-s390x-sclp-reject-invalid-write-event-data-headers.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 603081937866d300dc72d26a782168564478a8f4 Mon Sep 17 00:00:00 2001
-From: Christoph Schlameuss <cschlame@redhat.com>
-Date: Sat, 11 Jul 2026 14:58:15 +0200
-Subject: [PATCH 08/12] s390x/sclp: reject invalid write event data headers
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Christoph Schlameuss <None>
-RH-MergeRequest: 510: s390x: interface harding fixes
-RH-Jira: RHEL-192791
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: acordeir <None>
-RH-Commit: [5/9] b38f0d679531edbc7f9f1ebaa8b6b8e5bd385292 (cschlame/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-192791
-
-commit d88cd8f5570f4d6e08d62e098a8b7f53cdc75536
-Author: Christian Borntraeger <borntraeger@linux.ibm.com>
-Date: Tue Jul 7 09:07:24 2026 +0200
-
- s390x/sclp: reject invalid write event data headers
-
- If a guest submits an sccb with a tiny header length but a large number
- of event mask entries, the write_event_mask handler will
- 1. return the wrong RC (ok instead of error)
- 2. write to memory after the allocated sccb in qemu host memory.
-
- Add the necessary checks.
-
- Cc: qemu-stable@nongnu.org
- Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
- Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
- Reviewed-by: Eric Farman <farman@linux.ibm.com>
- Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
- Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Message-ID: <20260707070728.147203-2-borntraeger@linux.ibm.com>
- Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-
-Signed-off-by: Christoph Schlameuss <cschlame@redhat.com>
----
- hw/s390x/event-facility.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c
-index fee286ea63..184c469bd3 100644
---- a/hw/s390x/event-facility.c
-+++ b/hw/s390x/event-facility.c
-@@ -286,6 +286,7 @@ static void read_event_data(SCLPEventFacility *ef, SCCB *sccb)
- static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
- {
- WriteEventMask *we_mask = (WriteEventMask *) sccb;
-+ uint16_t sccb_length = be16_to_cpu(sccb->h.length);
- uint16_t mask_length = be16_to_cpu(we_mask->mask_length);
- sccb_mask_t tmp_mask;
-
-@@ -294,6 +295,11 @@ static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
- return;
- }
-
-+ if (sccb_length < sizeof(WriteEventMask) + 4 * mask_length) {
-+ sccb->h.response_code = cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LENGTH);
-+ return;
-+ }
-+
- /*
- * Note: We currently only support masks up to 8 byte length;
- * the remainder is filled up with zeroes. Older Linux
---
-2.52.0
-
diff --git a/kvm-s390x-sclpcpi-check-event-length-field-before-readin.patch b/kvm-s390x-sclpcpi-check-event-length-field-before-readin.patch
deleted file mode 100644
index 111da97..0000000
--- a/kvm-s390x-sclpcpi-check-event-length-field-before-readin.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From 7b4c4fc735e983f616c42a55022f6900687b4b05 Mon Sep 17 00:00:00 2001
-From: Christoph Schlameuss <cschlame@redhat.com>
-Date: Thu, 16 Jul 2026 10:34:43 +0200
-Subject: [PATCH 11/12] s390x/sclpcpi: check event length field before reading
- from buffer
-
-RH-Author: Christoph Schlameuss <None>
-RH-MergeRequest: 510: s390x: interface harding fixes
-RH-Jira: RHEL-192791
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Acked-by: acordeir <None>
-RH-Commit: [8/9] b28bf870b91442a2d450dd0a6afee4d5673cc694 (cschlame/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-192791
-
-commit 8a116a28535c34b001e68b52f85d6be3acb75350
-Author: Christian Borntraeger <borntraeger@linux.ibm.com>
-Date: Thu Jul 9 16:29:06 2026 +0200
-
- s390x/sclpcpi: check event length field before reading from buffer
-
- A guest might send a too short SCCB with SCLP_EVENT_CTRL_PGM_ID. QEMU
- would fill its data structures with garbage data. Check for the precise
- length of the CBI data structure and reject otherwise.
-
- Fixes: f345978f24be ("hw/s390x: add Control-Program Identification to QOM")
- Cc: qemu-stable@nongnu.org
- Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
- Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
- Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
- Reviewed-by: Eric Farman <farman@linux.ibm.com>
- Message-ID: <20260709142906.197474-3-borntraeger@linux.ibm.com>
- Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-
-Signed-off-by: Christoph Schlameuss <cschlame@redhat.com>
----
- hw/s390x/sclpcpi.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/hw/s390x/sclpcpi.c b/hw/s390x/sclpcpi.c
-index 68fc1b809b..ec4bdf2350 100644
---- a/hw/s390x/sclpcpi.c
-+++ b/hw/s390x/sclpcpi.c
-@@ -97,6 +97,11 @@ static int write_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_hdr)
- ebh);
- SCLPEventCPI *e = SCLP_EVENT_CPI(event);
-
-+ /* Caller checks sccb length, buffer header checking is our duty */
-+ if (be16_to_cpu(evt_buf_hdr->length) != sizeof(ControlProgramIdMsg)) {
-+ return SCLP_RC_INCONSISTENT_LENGTHS;
-+ }
-+
- ascii_put(e->system_type, (char *)cpim->data.system_type,
- sizeof(cpim->data.system_type));
- ascii_put(e->system_name, (char *)cpim->data.system_name,
---
-2.52.0
-
diff --git a/kvm-scsi-Don-t-consider-LOGICAL-UNIT-NOT-SUPPORTED-guest.patch b/kvm-scsi-Don-t-consider-LOGICAL-UNIT-NOT-SUPPORTED-guest.patch
deleted file mode 100644
index bf8ff48..0000000
--- a/kvm-scsi-Don-t-consider-LOGICAL-UNIT-NOT-SUPPORTED-guest.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From e77566291defe7b992bc17fa04907ec0d9b2b279 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Mon, 30 Mar 2026 14:16:35 +0200
-Subject: [PATCH 1/9] scsi: Don't consider LOGICAL UNIT NOT SUPPORTED guest
- recoverable
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 482: scsi: Don't consider LOGICAL UNIT NOT SUPPORTED guest recoverable
-RH-Jira: RHEL-158212
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
-RH-Commit: [1/1] 3ddb962c6255b588e33f8f6d80dd9d785498e342 (kmwolf/centos-qemu-kvm)
-
-When commit bdf9613b introduced scsi_sense_buf_is_guest_recoverable(),
-it included LOGICAL UNIT NOT SUPPORTED in the list of guest recoverable
-sense codes. It doesn't really explain how the codes to be in the list
-were selected.
-
-As the LUN doesn't come from the guest, but from the block backend
-(usually the SCSI device on the host that was opened with host_device,
-but it could also be the iscsi block driver), there is really no way the
-guest could influence this.
-
-It seems that on some storage arrays, LOGICAL UNIT NOT SUPPORTED can
-happen during failover operations. When combined with multipath, the
-request should be retried on another path instead of being reported to
-the guest, which would offline the filesystem in response.
-
-Simply returning false in scsi_sense_buf_is_guest_recoverable() will
-enable the retry logic in file-posix, and will also make sure that if
-the error persists, the configured error policy is respected so that the
-VM can be stopped.
-
-Buglink: https://redhat.atlassian.net/browse/RHEL-158212
-Fixes: bdf9613b7f87 ('scsi: explicitly list guest-recoverable sense codes')
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-ID: <20260330121635.49205-1-kwolf@redhat.com>
-Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit ccc613f96c66eb5401185ff6eeba18143892055d)
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- scsi/utils.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/scsi/utils.c b/scsi/utils.c
-index 545956f4f9..daee90ecf0 100644
---- a/scsi/utils.c
-+++ b/scsi/utils.c
-@@ -373,7 +373,6 @@ static bool scsi_sense_is_guest_recoverable(int key, int asc, int ascq)
- case 0x1a00: /* PARAMETER LIST LENGTH ERROR */
- case 0x2000: /* INVALID OPERATION CODE */
- case 0x2400: /* INVALID FIELD IN CDB */
-- case 0x2500: /* LOGICAL UNIT NOT SUPPORTED */
- case 0x2600: /* INVALID FIELD IN PARAMETER LIST */
-
- case 0x2104: /* UNALIGNED WRITE COMMAND */
---
-2.52.0
-
diff --git a/kvm-scsi-add-error-reporting-to-scsi_SG_IO.patch b/kvm-scsi-add-error-reporting-to-scsi_SG_IO.patch
deleted file mode 100644
index 3f4a9a4..0000000
--- a/kvm-scsi-add-error-reporting-to-scsi_SG_IO.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From d6784a187e586d6e8541ab8b1ab41541c768e614 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Thu, 29 Jan 2026 16:20:32 -0500
-Subject: [PATCH 3/7] scsi: add error reporting to scsi_SG_IO()
-
-RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
-RH-MergeRequest: 464: scsi: persistent reservation live migration
-RH-Jira: RHEL-132749
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
-RH-Commit: [2/5] 7858df3edd4f42eb1b9d3bf515b3470dd812327e (stefanha/centos-stream-qemu-kvm)
-
-Report the details of the SG_IO ioctl failure if an Error pointer is
-provided. This information aids troubleshooting and will be used by the
-SCSI Persistent Reservations migration code.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-Message-id: 20260129212035.219676-3-stefanha@redhat.com
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-(cherry picked from commit 6302598fe538206fd02494007ab5d218524dc7a7)
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/scsi/scsi-disk.c | 2 +-
- hw/scsi/scsi-generic.c | 33 ++++++++++++++++++++++++++++-----
- include/hw/scsi/scsi.h | 2 +-
- 3 files changed, 30 insertions(+), 7 deletions(-)
-
-diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
-index ca0214c404..c736988ef6 100644
---- a/hw/scsi/scsi-disk.c
-+++ b/hw/scsi/scsi-disk.c
-@@ -2749,7 +2749,7 @@ static int get_device_type(SCSIDiskState *s)
- cmd[4] = sizeof(buf);
-
- ret = scsi_SG_IO(s->qdev.conf.blk, SG_DXFER_FROM_DEV, cmd, sizeof(cmd),
-- buf, sizeof(buf), s->qdev.io_timeout);
-+ buf, sizeof(buf), s->qdev.io_timeout, NULL);
- if (ret < 0) {
- return -1;
- }
-diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
-index b27ad48f18..4f851186f6 100644
---- a/hw/scsi/scsi-generic.c
-+++ b/hw/scsi/scsi-generic.c
-@@ -526,10 +526,10 @@ static int read_naa_id(const uint8_t *p, uint64_t *p_wwn)
-
- int scsi_SG_IO(BlockBackend *blk, int direction, uint8_t *cmd,
- uint8_t cmd_size, uint8_t *buf, uint8_t buf_size,
-- uint32_t timeout)
-+ uint32_t timeout, Error **errp)
- {
- sg_io_hdr_t io_header;
-- uint8_t sensebuf[8];
-+ uint8_t sensebuf[8] = {};
- int ret;
-
- memset(&io_header, 0, sizeof(io_header));
-@@ -549,6 +549,29 @@ int scsi_SG_IO(BlockBackend *blk, int direction, uint8_t *cmd,
- io_header.driver_status || io_header.host_status) {
- trace_scsi_generic_ioctl_sgio_done(cmd[0], ret, io_header.status,
- io_header.host_status);
-+ if (ret < 0) {
-+ error_setg_errno(errp, -ret, "SG_IO ioctl failed");
-+ } else {
-+ g_autofree char *sensebuf_hex =
-+ g_strdup_printf("%02x%02x%02x%02x%02x%02x%02x%02x",
-+ sensebuf[0],
-+ sensebuf[1],
-+ sensebuf[2],
-+ sensebuf[3],
-+ sensebuf[4],
-+ sensebuf[5],
-+ sensebuf[6],
-+ sensebuf[7]);
-+
-+ error_setg(errp, "SG_IO SCSI command failed with status=0x%x "
-+ "driver_status=0x%x host_status=0x%x sensebuf=%s "
-+ "sb_len_wr=%u",
-+ io_header.status,
-+ io_header.driver_status,
-+ io_header.host_status,
-+ sensebuf_hex,
-+ io_header.sb_len_wr);
-+ }
- return -1;
- }
- return 0;
-@@ -575,7 +598,7 @@ static void scsi_generic_set_vpd_bl_emulation(SCSIDevice *s)
- cmd[4] = sizeof(buf);
-
- ret = scsi_SG_IO(s->conf.blk, SG_DXFER_FROM_DEV, cmd, sizeof(cmd),
-- buf, sizeof(buf), s->io_timeout);
-+ buf, sizeof(buf), s->io_timeout, NULL);
- if (ret < 0) {
- /*
- * Do not assume anything if we can't retrieve the
-@@ -611,7 +634,7 @@ static void scsi_generic_read_device_identification(SCSIDevice *s)
- cmd[4] = sizeof(buf);
-
- ret = scsi_SG_IO(s->conf.blk, SG_DXFER_FROM_DEV, cmd, sizeof(cmd),
-- buf, sizeof(buf), s->io_timeout);
-+ buf, sizeof(buf), s->io_timeout, NULL);
- if (ret < 0) {
- return;
- }
-@@ -663,7 +686,7 @@ static int get_stream_blocksize(BlockBackend *blk)
- cmd[4] = sizeof(buf);
-
- ret = scsi_SG_IO(blk, SG_DXFER_FROM_DEV, cmd, sizeof(cmd),
-- buf, sizeof(buf), 6);
-+ buf, sizeof(buf), 6, NULL);
- if (ret < 0) {
- return -1;
- }
-diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
-index a79c3aadfc..977b7e4d55 100644
---- a/include/hw/scsi/scsi.h
-+++ b/include/hw/scsi/scsi.h
-@@ -237,7 +237,7 @@ void scsi_device_unit_attention_reported(SCSIDevice *dev);
- void scsi_generic_read_device_inquiry(SCSIDevice *dev);
- int scsi_device_get_sense(SCSIDevice *dev, uint8_t *buf, int len, bool fixed);
- int scsi_SG_IO(BlockBackend *blk, int direction, uint8_t *cmd, uint8_t cmd_size,
-- uint8_t *buf, uint8_t buf_size, uint32_t timeout);
-+ uint8_t *buf, uint8_t buf_size, uint32_t timeout, Error **errp);
- SCSIDevice *scsi_device_find(SCSIBus *bus, int channel, int target, int lun);
- SCSIDevice *scsi_device_get(SCSIBus *bus, int channel, int target, int lun);
-
---
-2.47.3
-
diff --git a/kvm-scsi-adjust-error_prepend-formatting.patch b/kvm-scsi-adjust-error_prepend-formatting.patch
deleted file mode 100644
index dce5a6d..0000000
--- a/kvm-scsi-adjust-error_prepend-formatting.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 77d65b4a5dc0172a29dd810363d4f702242b929a Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 1 Apr 2026 13:19:25 -0400
-Subject: [PATCH 3/9] scsi: adjust error_prepend() formatting
-
-RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
-RH-MergeRequest: 492: scsi: PR live migration PREEMPT fixes
-RH-Jira: RHEL-155807
-RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/3] 8d4442c1d4ec94db0cbea00f3cd32e0f50ef13dc (stefanha/centos-stream-qemu-kvm)
-
-The error strings will be concatenated so add a separator to make the
-combined error message easy to read.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Link: https://lore.kernel.org/r/20260401171927.396672-2-stefanha@redhat.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 15c57ac351ccb4af625cd7dc582831f472c1a68f)
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/scsi/scsi-generic.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
-index b8b3f399f0..5825a47311 100644
---- a/hw/scsi/scsi-generic.c
-+++ b/hw/scsi/scsi-generic.c
-@@ -438,7 +438,7 @@ static bool scsi_generic_pr_register(SCSIDevice *s, uint64_t key, Error **errp)
- ret = scsi_SG_IO(s->conf.blk, SG_DXFER_TO_DEV, cmd, sizeof(cmd),
- buf, sizeof(buf), s->io_timeout, errp);
- if (ret < 0) {
-- error_prepend(errp, "PERSISTENT RESERVE OUT with REGISTER");
-+ error_prepend(errp, "PERSISTENT RESERVE OUT with REGISTER: ");
- return false;
- }
- return true;
-@@ -462,7 +462,7 @@ static bool scsi_generic_pr_preempt(SCSIDevice *s, uint64_t key,
- ret = scsi_SG_IO(s->conf.blk, SG_DXFER_TO_DEV, cmd, sizeof(cmd),
- buf, sizeof(buf), s->io_timeout, errp);
- if (ret < 0) {
-- error_prepend(errp, "PERSISTENT RESERVE OUT with PREEMPT");
-+ error_prepend(errp, "PERSISTENT RESERVE OUT with PREEMPT: ");
- return false;
- }
- return true;
---
-2.52.0
-
diff --git a/kvm-scsi-always-send-valid-PREEMPT-TYPE-field.patch b/kvm-scsi-always-send-valid-PREEMPT-TYPE-field.patch
deleted file mode 100644
index 85a6d9b..0000000
--- a/kvm-scsi-always-send-valid-PREEMPT-TYPE-field.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From 406d4eeb15d45107490b444482df8fcb9945da02 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 1 Apr 2026 13:19:26 -0400
-Subject: [PATCH 4/9] scsi: always send valid PREEMPT TYPE field
-
-RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
-RH-MergeRequest: 492: scsi: PR live migration PREEMPT fixes
-RH-Jira: RHEL-155807
-RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/3] 6fc4c51732256ea5e06eb05e7666cca216f8d45f (stefanha/centos-stream-qemu-kvm)
-
-The SPC-6 specification says that the PREEMPT service action ignores the
-TYPE field when there is no reservation. However, the LIO Linux iSCSI
-target rejects commands with a zero TYPE field. The field never ends up
-being used in this case, so replace it with a "valid" value to work
-around the issue.
-
-Reported-by: Qing Wang <qinwang@redhat.com>
-Buglink: https://redhat.atlassian.net/browse/RHEL-155807
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Link: https://lore.kernel.org/r/20260401171927.396672-3-stefanha@redhat.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 15a202656cd553911272f9666aa067c706fc3dfe)
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/scsi/scsi-generic.c | 10 ++++++++++
- include/scsi/constants.h | 10 ++++++++++
- 2 files changed, 20 insertions(+)
-
-diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
-index 5825a47311..8a57473623 100644
---- a/hw/scsi/scsi-generic.c
-+++ b/hw/scsi/scsi-generic.c
-@@ -452,6 +452,16 @@ static bool scsi_generic_pr_preempt(SCSIDevice *s, uint64_t key,
- uint64_t key_be = cpu_to_be64(key);
- int ret;
-
-+ /*
-+ * The LIO iSCSI target in Linux up to at least version 7.0 rejects PREEMPT
-+ * commands with a zero TYPE field although the SPC-6 specification says
-+ * the field should be ignored when there is no persistent reservation.
-+ * Work around this by choosing an arbitrary valid PR type value.
-+ */
-+ if (resv_type == 0) {
-+ resv_type = PR_TYPE_WRITE_EXCLUSIVE;
-+ }
-+
- cmd[0] = PERSISTENT_RESERVE_OUT;
- cmd[1] = PRO_PREEMPT;
- cmd[2] = resv_type & 0xf;
-diff --git a/include/scsi/constants.h b/include/scsi/constants.h
-index cb97bdb636..717e470a5d 100644
---- a/include/scsi/constants.h
-+++ b/include/scsi/constants.h
-@@ -340,4 +340,14 @@
- #define PRO_REGISTER_AND_MOVE 0x07
- #define PRO_REPLACE_LOST_RESERVATION 0x08
-
-+/*
-+ * Persistent reservation types
-+ */
-+#define PR_TYPE_WRITE_EXCLUSIVE 0x1
-+#define PR_TYPE_EXCLUSIVE_ACCESS 0x3
-+#define PR_TYPE_WRITE_EXCLUSIVE_REG_ONLY 0x5
-+#define PR_TYPE_EXCLUSIVE_ACCESS_REG_ONLY 0x6
-+#define PR_TYPE_WRITE_EXCLUSIVE_ALL_REGS 0x7
-+#define PR_TYPE_EXCLUSIVE_ACCESS_ALL_REGS 0x8
-+
- #endif
---
-2.52.0
-
diff --git a/kvm-scsi-change-buf_size-to-unsigned-int-in-scsi_SG_IO.patch b/kvm-scsi-change-buf_size-to-unsigned-int-in-scsi_SG_IO.patch
deleted file mode 100644
index fe3af9f..0000000
--- a/kvm-scsi-change-buf_size-to-unsigned-int-in-scsi_SG_IO.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 364a6ea9f63c7bfe25ced3cea0d10e3e5177677f Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 15 Apr 2026 19:29:05 -0400
-Subject: [PATCH 8/9] scsi: change buf_size to unsigned int in scsi_SG_IO()
-
-RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
-RH-MergeRequest: 498: scsi: handle reservation changes across migration
-RH-Jira: RHEL-153123
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [4/5] fe0a33daf96237ea2baf03afaccf9dd310e207c7 (stefanha/centos-stream-qemu-kvm)
-
-SG_IO supports an unsigned int dxfer_len value. Existing callers use
-less than 256 bytes, so scsi_SG_IO()'s uint8_t buf_size type was
-sufficient. The next patch will use a larger value, so update the type.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Link: https://lore.kernel.org/r/20260415232906.212349-2-stefanha@redhat.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit f4193228dd20d3d5b8eaaf65f46e2426181794f3)
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/scsi/scsi-generic.c | 2 +-
- include/hw/scsi/scsi.h | 3 ++-
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
-index 9c5927b543..c2f61b320f 100644
---- a/hw/scsi/scsi-generic.c
-+++ b/hw/scsi/scsi-generic.c
-@@ -793,7 +793,7 @@ static int read_naa_id(const uint8_t *p, uint64_t *p_wwn)
- }
-
- int scsi_SG_IO(BlockBackend *blk, int direction, uint8_t *cmd,
-- uint8_t cmd_size, uint8_t *buf, uint8_t buf_size,
-+ uint8_t cmd_size, uint8_t *buf, unsigned int buf_size,
- uint32_t timeout, Error **errp)
- {
- sg_io_hdr_t io_header;
-diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
-index f61c63c5ea..640a11522b 100644
---- a/include/hw/scsi/scsi.h
-+++ b/include/hw/scsi/scsi.h
-@@ -247,7 +247,8 @@ void scsi_device_unit_attention_reported(SCSIDevice *dev);
- void scsi_generic_read_device_inquiry(SCSIDevice *dev);
- int scsi_device_get_sense(SCSIDevice *dev, uint8_t *buf, int len, bool fixed);
- int scsi_SG_IO(BlockBackend *blk, int direction, uint8_t *cmd, uint8_t cmd_size,
-- uint8_t *buf, uint8_t buf_size, uint32_t timeout, Error **errp);
-+ uint8_t *buf, unsigned int buf_size, uint32_t timeout,
-+ Error **errp);
- SCSIDevice *scsi_device_find(SCSIBus *bus, int channel, int target, int lun);
- SCSIDevice *scsi_device_get(SCSIBus *bus, int channel, int target, int lun);
-
---
-2.52.0
-
diff --git a/kvm-scsi-generalize-scsi_SG_IO_FROM_DEV-to-scsi_SG_IO.patch b/kvm-scsi-generalize-scsi_SG_IO_FROM_DEV-to-scsi_SG_IO.patch
deleted file mode 100644
index 3224362..0000000
--- a/kvm-scsi-generalize-scsi_SG_IO_FROM_DEV-to-scsi_SG_IO.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-From af75da80d87f9b2490368edb3818bf0692c66882 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Thu, 29 Jan 2026 16:20:31 -0500
-Subject: [PATCH 2/7] scsi: generalize scsi_SG_IO_FROM_DEV() to scsi_SG_IO()
-
-RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
-RH-MergeRequest: 464: scsi: persistent reservation live migration
-RH-Jira: RHEL-132749
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
-RH-Commit: [1/5] 45295e0aa8da535c0fca388e6b8e3a0665a4cf7c (stefanha/centos-stream-qemu-kvm)
-
-Add a direction argument so that scsi_SG_IO() can be used for
-SG_DXFER_FROM_DEV and SG_DXFER_TO_DEV transfers.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-Message-id: 20260129212035.219676-2-stefanha@redhat.com
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-(cherry picked from commit 03396b9afcf93964bb4dbb9d0cd7387ba0f63aa3)
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/scsi/scsi-disk.c | 4 ++--
- hw/scsi/scsi-generic.c | 18 ++++++++++--------
- include/hw/scsi/scsi.h | 4 ++--
- 3 files changed, 14 insertions(+), 12 deletions(-)
-
-diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
-index b4782c6248..ca0214c404 100644
---- a/hw/scsi/scsi-disk.c
-+++ b/hw/scsi/scsi-disk.c
-@@ -2748,8 +2748,8 @@ static int get_device_type(SCSIDiskState *s)
- cmd[0] = INQUIRY;
- cmd[4] = sizeof(buf);
-
-- ret = scsi_SG_IO_FROM_DEV(s->qdev.conf.blk, cmd, sizeof(cmd),
-- buf, sizeof(buf), s->qdev.io_timeout);
-+ ret = scsi_SG_IO(s->qdev.conf.blk, SG_DXFER_FROM_DEV, cmd, sizeof(cmd),
-+ buf, sizeof(buf), s->qdev.io_timeout);
- if (ret < 0) {
- return -1;
- }
-diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
-index 9e380a2109..b27ad48f18 100644
---- a/hw/scsi/scsi-generic.c
-+++ b/hw/scsi/scsi-generic.c
-@@ -524,8 +524,9 @@ static int read_naa_id(const uint8_t *p, uint64_t *p_wwn)
- return -EINVAL;
- }
-
--int scsi_SG_IO_FROM_DEV(BlockBackend *blk, uint8_t *cmd, uint8_t cmd_size,
-- uint8_t *buf, uint8_t buf_size, uint32_t timeout)
-+int scsi_SG_IO(BlockBackend *blk, int direction, uint8_t *cmd,
-+ uint8_t cmd_size, uint8_t *buf, uint8_t buf_size,
-+ uint32_t timeout)
- {
- sg_io_hdr_t io_header;
- uint8_t sensebuf[8];
-@@ -533,7 +534,7 @@ int scsi_SG_IO_FROM_DEV(BlockBackend *blk, uint8_t *cmd, uint8_t cmd_size,
-
- memset(&io_header, 0, sizeof(io_header));
- io_header.interface_id = 'S';
-- io_header.dxfer_direction = SG_DXFER_FROM_DEV;
-+ io_header.dxfer_direction = direction;
- io_header.dxfer_len = buf_size;
- io_header.dxferp = buf;
- io_header.cmdp = cmd;
-@@ -573,8 +574,8 @@ static void scsi_generic_set_vpd_bl_emulation(SCSIDevice *s)
- cmd[2] = 0x00;
- cmd[4] = sizeof(buf);
-
-- ret = scsi_SG_IO_FROM_DEV(s->conf.blk, cmd, sizeof(cmd),
-- buf, sizeof(buf), s->io_timeout);
-+ ret = scsi_SG_IO(s->conf.blk, SG_DXFER_FROM_DEV, cmd, sizeof(cmd),
-+ buf, sizeof(buf), s->io_timeout);
- if (ret < 0) {
- /*
- * Do not assume anything if we can't retrieve the
-@@ -609,8 +610,8 @@ static void scsi_generic_read_device_identification(SCSIDevice *s)
- cmd[2] = 0x83;
- cmd[4] = sizeof(buf);
-
-- ret = scsi_SG_IO_FROM_DEV(s->conf.blk, cmd, sizeof(cmd),
-- buf, sizeof(buf), s->io_timeout);
-+ ret = scsi_SG_IO(s->conf.blk, SG_DXFER_FROM_DEV, cmd, sizeof(cmd),
-+ buf, sizeof(buf), s->io_timeout);
- if (ret < 0) {
- return;
- }
-@@ -661,7 +662,8 @@ static int get_stream_blocksize(BlockBackend *blk)
- cmd[0] = MODE_SENSE;
- cmd[4] = sizeof(buf);
-
-- ret = scsi_SG_IO_FROM_DEV(blk, cmd, sizeof(cmd), buf, sizeof(buf), 6);
-+ ret = scsi_SG_IO(blk, SG_DXFER_FROM_DEV, cmd, sizeof(cmd),
-+ buf, sizeof(buf), 6);
- if (ret < 0) {
- return -1;
- }
-diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
-index 90ee192b4d..a79c3aadfc 100644
---- a/include/hw/scsi/scsi.h
-+++ b/include/hw/scsi/scsi.h
-@@ -236,8 +236,8 @@ void scsi_device_report_change(SCSIDevice *dev, SCSISense sense);
- void scsi_device_unit_attention_reported(SCSIDevice *dev);
- void scsi_generic_read_device_inquiry(SCSIDevice *dev);
- int scsi_device_get_sense(SCSIDevice *dev, uint8_t *buf, int len, bool fixed);
--int scsi_SG_IO_FROM_DEV(BlockBackend *blk, uint8_t *cmd, uint8_t cmd_size,
-- uint8_t *buf, uint8_t buf_size, uint32_t timeout);
-+int scsi_SG_IO(BlockBackend *blk, int direction, uint8_t *cmd, uint8_t cmd_size,
-+ uint8_t *buf, uint8_t buf_size, uint32_t timeout);
- SCSIDevice *scsi_device_find(SCSIBus *bus, int channel, int target, int lun);
- SCSIDevice *scsi_device_get(SCSIBus *bus, int channel, int target, int lun);
-
---
-2.47.3
-
diff --git a/kvm-scsi-handle-reservation-changes-across-migration.patch b/kvm-scsi-handle-reservation-changes-across-migration.patch
deleted file mode 100644
index d205d3d..0000000
--- a/kvm-scsi-handle-reservation-changes-across-migration.patch
+++ /dev/null
@@ -1,246 +0,0 @@
-From 6724a87dab9516a52086427ab53453171bada849 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 15 Apr 2026 19:29:06 -0400
-Subject: [PATCH 9/9] scsi: handle reservation changes across migration
-
-RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
-RH-MergeRequest: 498: scsi: handle reservation changes across migration
-RH-Jira: RHEL-153123
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [5/5] 4ba82297c25e0992ec3f695f6bd3337aa44bb50b (stefanha/centos-stream-qemu-kvm)
-
-Other nodes in the cluster can preempt or clear SCSI Persistent
-Reservations at any time. When this happens across live migration, the
-reservation state transferred with the guest might be outdated.
-
-Attempt to handle such cases gracefully by checking the current
-reservation or registered keys to detect stale state before restoring.
-If the actual state of the disk has changed, do not modify it and accept
-that as the most up-to-date state.
-
-Do this using READ RESERVATION when the guest holds a reservation or
-READ KEYS when the guest has registered a key but does not hold a
-reservation.
-
-There is still a race condition between checking and restoring state,
-but it seems unavoidable and is no worse than before.
-
-Buglink: https://redhat.atlassian.net/browse/RHEL-153123
-Fixes: ab57b51f1375b6a6f098a74c6f79207a9630948d ("scsi: save/load SCSI reservation state")
-Reported-by: Qing Wang
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Link: https://lore.kernel.org/r/20260415232906.212349-3-stefanha@redhat.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 87c7b07fe4aa43dc7257b1e711faa835fac1cccb)
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/scsi/scsi-generic.c | 173 +++++++++++++++++++++++++++++++++++------
- 1 file changed, 149 insertions(+), 24 deletions(-)
-
-diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
-index c2f61b320f..452908ba95 100644
---- a/hw/scsi/scsi-generic.c
-+++ b/hw/scsi/scsi-generic.c
-@@ -478,13 +478,84 @@ static bool scsi_generic_pr_preempt(SCSIDevice *s, uint64_t key,
- return true;
- }
-
-+/*
-+ * Returns true if the given key is registered or false otherwise (including
-+ * errors).
-+ */
-+static bool scsi_generic_pr_key_registered(SCSIDevice *s, uint64_t key,
-+ Error **errp)
-+{
-+ const size_t key_list_offset = 8; /* in READ KEYS parameter data */
-+ uint64_t key_be = cpu_to_be64(key);
-+ uint8_t cmd[10] = {};
-+ size_t buf_len;
-+ g_autofree uint8_t *buf = NULL;
-+ uint32_t additional_length = 16 * 8; /* initial key list size */
-+
-+ /*
-+ * Loop to resize parameter data buffer when there are many keys. It would
-+ * be simpler to hardcode the maximum buffer size (it's only 64 KB), but
-+ * SG_IO can fail with EINVAL if the host kernel blkdev queue limits are
-+ * too low.
-+ */
-+ do {
-+ uint16_t allocation_length_be;
-+ int ret;
-+
-+ buf_len = key_list_offset + additional_length;
-+ buf = g_realloc(buf, buf_len);
-+ memset(buf, 0, buf_len);
-+
-+ cmd[0] = PERSISTENT_RESERVE_IN;
-+ cmd[1] = PRI_READ_KEYS;
-+ allocation_length_be = cpu_to_be16(buf_len);
-+ memcpy(&cmd[7], &allocation_length_be, sizeof(allocation_length_be));
-+
-+ ret = scsi_SG_IO(s->conf.blk, SG_DXFER_FROM_DEV, cmd, sizeof(cmd),
-+ buf, buf_len, s->io_timeout, errp);
-+ if (ret < 0) {
-+ error_prepend(errp, "PERSISTENT RESERVE IN with READ KEYS: ");
-+ return false;
-+ }
-+
-+ memcpy(&additional_length, &buf[4], sizeof(additional_length));
-+ be32_to_cpus(&additional_length);
-+
-+ /*
-+ * The parameter data's ADDITIONAL LENGTH must not overflow the CDB's
-+ * 16-bit ALLOCATION LENGTH field since the next loop iteration will
-+ * compute ALLOCATION LENGTH based on ADDITIONAL LENGTH.
-+ */
-+ if (additional_length > UINT16_MAX - key_list_offset) {
-+ error_setg(errp, "got invalid ADDITIONAL LENGTH %" PRIu32
-+ " from READ KEYS", additional_length);
-+ return false;
-+ }
-+
-+ for (size_t i = key_list_offset; i < buf_len; i += sizeof(key_be)) {
-+ if (i - key_list_offset >= additional_length) {
-+ break; /* end of parameter list */
-+ }
-+
-+ if (memcmp(&key_be, &buf[i], sizeof(key_be)) == 0) {
-+ return true; /* key found */
-+ }
-+ }
-+ } while (additional_length > buf_len - key_list_offset);
-+
-+ return false; /* key not found */
-+}
-+
- /* Register keys and preempt reservations after live migration */
- bool scsi_generic_pr_state_preempt(SCSIDevice *s, Error **errp)
- {
- SCSIPRState *pr_state = &s->pr_state;
-+ Error *local_err = NULL;
-+ bool check_stale_key = true;
- uint64_t key;
- uint8_t resv_type;
-
-+ /* Get the migrated PR state */
- WITH_QEMU_LOCK_GUARD(&pr_state->mutex) {
- key = pr_state->key;
- resv_type = pr_state->resv_type;
-@@ -492,36 +563,90 @@ bool scsi_generic_pr_state_preempt(SCSIDevice *s, Error **errp)
-
- trace_scsi_generic_pr_state_preempt(key, resv_type);
-
-- if (key) {
-- if (!scsi_generic_pr_register(s, key, errp)) {
-+ /* Handle stale PR state (e.g. another node preempted) */
-+ if (resv_type) {
-+ uint64_t dev_key;
-+ uint8_t dev_resv_type;
-+
-+ if (scsi_generic_read_reservation(s, &dev_key, &dev_resv_type,
-+ errp) < 0) {
- return false;
- }
-
-- /*
-- * Two cases:
-- *
-- * 1. There is no reservation (resv_type is 0) and the other I_T nexus
-- * will be unregistered. This is important so the source host does
-- * not leak registered keys across live migration.
-- *
-- * 2. There is a reservation (resv_type is not 0) and the other I_T
-- * nexus will be unregistered and its reservation is atomically
-- * taken over by us. This is the scenario where a reservation is
-- * migrated along with the guest.
-- */
-- if (!scsi_generic_pr_preempt(s, key, resv_type, errp)) {
-- return false;
-+ if (dev_resv_type != resv_type) {
-+ /* vmstate had a stale reservation type */
-+ g_autofree char *name = qdev_get_human_name(&s->qdev);
-+ warn_report("Expected SCSI reservation type 0x%x on device '%s', "
-+ "got 0x%x, using new type",
-+ resv_type, name, dev_resv_type);
-+ resv_type = dev_resv_type;
- }
-
-- /*
-- * Some SCSI targets, like the Linux LIO target, remove our
-- * registration when preempting without a reservation (resv_type is 0).
-- * Try to register again but ignore the error since a RESERVATION
-- * CONFLICT is expected if our registration remained in place.
-- */
-- if (resv_type == 0) {
-- scsi_generic_pr_register(s, key, NULL);
-+ if (dev_key == key) {
-+ /* The reservation exists, no need to check for a stale key */
-+ check_stale_key = false;
-+ } else {
-+ g_autofree char *name = qdev_get_human_name(&s->qdev);
-+ warn_report("Expected SCSI reservation with key 0x%" PRIx64
-+ " on device '%s', got 0x%" PRIx64 ", ignoring "
-+ "reservation",
-+ key, name, dev_key);
-+ resv_type = 0; /* vmstate had a stale reservation */
-+ }
-+ }
-+
-+ if (key != 0 && check_stale_key &&
-+ !scsi_generic_pr_key_registered(s, key, &local_err)) {
-+ if (local_err) {
-+ error_propagate(errp, local_err);
-+ return false;
- }
-+
-+ g_autofree char *name = qdev_get_human_name(&s->qdev);
-+ warn_report("SCSI reservation key 0x%" PRIx64 " on device '%s' not "
-+ "registered after migration, ignoring",
-+ key, name);
-+ key = 0; /* vmstate had a stale key */
-+ }
-+
-+ /* Stale PR state may have been updated */
-+ WITH_QEMU_LOCK_GUARD(&pr_state->mutex) {
-+ pr_state->key = key;
-+ pr_state->resv_type = resv_type;
-+ }
-+
-+ if (key == 0) {
-+ return true; /* no PR state, do nothing */
-+ }
-+
-+ if (!scsi_generic_pr_register(s, key, errp)) {
-+ return false;
-+ }
-+
-+ /*
-+ * Two cases:
-+ *
-+ * 1. There is no reservation (resv_type is 0) and the other I_T nexus
-+ * will be unregistered. This is important so the source host does
-+ * not leak registered keys across live migration.
-+ *
-+ * 2. There is a reservation (resv_type is not 0) and the other I_T
-+ * nexus will be unregistered and its reservation is atomically
-+ * taken over by us. This is the scenario where a reservation is
-+ * migrated along with the guest.
-+ */
-+ if (!scsi_generic_pr_preempt(s, key, resv_type, errp)) {
-+ return false;
-+ }
-+
-+ /*
-+ * Some SCSI targets, like the Linux LIO target, remove our
-+ * registration when preempting without a reservation (resv_type is 0).
-+ * Try to register again but ignore the error since a RESERVATION
-+ * CONFLICT is expected if our registration remained in place.
-+ */
-+ if (resv_type == 0) {
-+ scsi_generic_pr_register(s, key, NULL);
- }
- return true;
- }
---
-2.52.0
-
diff --git a/kvm-scsi-register-again-after-PREEMPT-without-reservatio.patch b/kvm-scsi-register-again-after-PREEMPT-without-reservatio.patch
deleted file mode 100644
index 6e6e88d..0000000
--- a/kvm-scsi-register-again-after-PREEMPT-without-reservatio.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 5ccd7244084cc6820a0a00df01c25484181b7fca Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Wed, 1 Apr 2026 13:19:27 -0400
-Subject: [PATCH 5/9] scsi: register again after PREEMPT without reservation
-
-RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
-RH-MergeRequest: 492: scsi: PR live migration PREEMPT fixes
-RH-Jira: RHEL-155807
-RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [3/3] 21242c1e293a3611c75a5cdbc99e55c6ab86cc20 (stefanha/centos-stream-qemu-kvm)
-
-The SCSI specification says PREEMPT without a reservation removes all
-registrations with the given key. Try to register again after PREEMPT
-since our key will have been removed.
-
-In practice some SCSI targets keep the calling I_T nexus' registration
-instead of removing it. Therefore we need to handle both the
-spec-compliant and the non-compliant behavior.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-Link: https://lore.kernel.org/r/20260401171927.396672-4-stefanha@redhat.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit b9a3b329d09dea5a4692de483419693ef0e23052)
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/scsi/scsi-generic.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
-index 8a57473623..9c5927b543 100644
---- a/hw/scsi/scsi-generic.c
-+++ b/hw/scsi/scsi-generic.c
-@@ -512,6 +512,16 @@ bool scsi_generic_pr_state_preempt(SCSIDevice *s, Error **errp)
- if (!scsi_generic_pr_preempt(s, key, resv_type, errp)) {
- return false;
- }
-+
-+ /*
-+ * Some SCSI targets, like the Linux LIO target, remove our
-+ * registration when preempting without a reservation (resv_type is 0).
-+ * Try to register again but ignore the error since a RESERVATION
-+ * CONFLICT is expected if our registration remained in place.
-+ */
-+ if (resv_type == 0) {
-+ scsi_generic_pr_register(s, key, NULL);
-+ }
- }
- return true;
- }
---
-2.52.0
-
diff --git a/kvm-scsi-save-load-SCSI-reservation-state.patch b/kvm-scsi-save-load-SCSI-reservation-state.patch
deleted file mode 100644
index 7660bff..0000000
--- a/kvm-scsi-save-load-SCSI-reservation-state.patch
+++ /dev/null
@@ -1,348 +0,0 @@
-From 91e9a0fbb3d6ee8726ea0ef17ff17404f823577a Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Thu, 29 Jan 2026 16:20:34 -0500
-Subject: [PATCH 5/7] scsi: save/load SCSI reservation state
-
-RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
-RH-MergeRequest: 464: scsi: persistent reservation live migration
-RH-Jira: RHEL-132749
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
-RH-Commit: [4/5] 2ebcfedf1a9e54433ed1ba3593d4fbcbadcd644b (stefanha/centos-stream-qemu-kvm)
-
-Add a vmstate subsection to SCSIDiskState so that scsi-block devices can
-transfer their reservation state during live migration. Upon loading the
-subsection, the destination QEMU invokes the PERSISTENT RESERVE OUT
-command's PREEMPT service action to atomically move the reservation from
-the source I_T nexus to the destination I_T nexus. This results in
-transparent live migration of SCSI reservations.
-
-This approach is incomplete since SCSI reservations are cooperative and
-other hosts could interfere. Neither the source QEMU nor the destination
-QEMU are aware of changes made by other hosts. The assumption is that
-reservation is not taken over by a third host without cooperation from
-the source host.
-
-I considered adding the vmstate subsection to SCSIDevice instead of
-SCSIDiskState, since reservations are part of the SCSI Primary Commands
-that other devices apart from disks could support. However, due to
-fragility of migrating reservations, we will probably limit support to
-scsi-block and maybe scsi-disk in the future. In the end, I think it
-makes sense to place this within scsi-disk.c.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-Message-id: 20260129212035.219676-5-stefanha@redhat.com
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-(cherry picked from commit ab57b51f1375b6a6f098a74c6f79207a9630948d)
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-
-Conflicts:
-- hw/core/machine.c
-
- Downstream does not have hw_compat_10_2. Make sure that machine types
- prior to RHEL 10.2 default to migrate-pr=off.
-
-- hw/scsi/scsi-disk.c
-
- Downstream is missing commit 40de712a89d8f ("migration: Add
- error-parameterized function variants in VMSD struct"), so add a
- .post_load() wrapper function that reports the Error and returns
- -EINVAL.
----
- hw/core/machine.c | 1 +
- hw/scsi/scsi-disk.c | 99 +++++++++++++++++++++++++++++++++++++++++-
- hw/scsi/scsi-generic.c | 83 +++++++++++++++++++++++++++++++++++
- hw/scsi/trace-events | 1 +
- include/hw/scsi/scsi.h | 1 +
- 5 files changed, 184 insertions(+), 1 deletion(-)
-
-diff --git a/hw/core/machine.c b/hw/core/machine.c
-index 2a1a42cebc..2b339f6a13 100644
---- a/hw/core/machine.c
-+++ b/hw/core/machine.c
-@@ -295,6 +295,7 @@ const char *rhel_old_machine_deprecation =
- "machine types for previous major releases are deprecated";
-
- GlobalProperty hw_compat_rhel_10_2[] = {
-+ { "scsi-block", "migrate-pr", "off" },
- /* hw_compat_rhel_10_2 from hw_compat_10_0 */
- { "scsi-hd", "dpofua", "off" },
- /* hw_compat_rhel_10_2 from hw_compat_10_0 */
-diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
-index c736988ef6..e7b821ad19 100644
---- a/hw/scsi/scsi-disk.c
-+++ b/hw/scsi/scsi-disk.c
-@@ -28,6 +28,7 @@
- #include "qemu/hw-version.h"
- #include "qemu/memalign.h"
- #include "hw/scsi/scsi.h"
-+#include "migration/misc.h"
- #include "migration/qemu-file-types.h"
- #include "migration/vmstate.h"
- #include "hw/scsi/emulation.h"
-@@ -122,6 +123,7 @@ struct SCSIDiskState {
- */
- uint16_t rotation_rate;
- bool migrate_emulated_scsi_request;
-+ NotifierWithReturn migration_notifier;
- };
-
- static void scsi_free_request(SCSIRequest *req)
-@@ -2737,6 +2739,29 @@ static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun,
- }
-
- #ifdef __linux__
-+/*
-+ * Preempt on the SCSI Persistent Reservation on the source when migration
-+ * fails because the destination may have already preempted and we need to get
-+ * the reservation back.
-+ */
-+static int scsi_block_migration_notifier(NotifierWithReturn *notifier,
-+ MigrationEvent *e, Error **errp)
-+{
-+ if (e->type == MIG_EVENT_PRECOPY_FAILED) {
-+ SCSIDiskState *s =
-+ container_of(notifier, SCSIDiskState, migration_notifier);
-+ SCSIDevice *d = &s->qdev;
-+ Error *local_err = NULL;
-+
-+ if (!scsi_generic_pr_state_preempt(d, &local_err)) {
-+ /* MIG_EVENT_PRECOPY_FAILED cannot fail, so just warn */
-+ error_prepend(&local_err, "scsi-block migration rollback: ");
-+ warn_report_err(local_err);
-+ }
-+ }
-+ return 0;
-+}
-+
- static int get_device_type(SCSIDiskState *s)
- {
- uint8_t cmd[16];
-@@ -2815,6 +2840,16 @@ static void scsi_block_realize(SCSIDevice *dev, Error **errp)
-
- scsi_realize(&s->qdev, errp);
- scsi_generic_read_device_inquiry(&s->qdev);
-+
-+ migration_add_notifier(&s->migration_notifier,
-+ scsi_block_migration_notifier);
-+}
-+
-+static void scsi_block_unrealize(SCSIDevice *dev)
-+{
-+ SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
-+
-+ migration_remove_notifier(&s->migration_notifier);
- }
-
- typedef struct SCSIBlockReq {
-@@ -3209,6 +3244,60 @@ static const Property scsi_hd_properties[] = {
- DEFINE_BLOCK_CHS_PROPERTIES(SCSIDiskState, qdev.conf),
- };
-
-+#ifdef __linux__
-+static bool scsi_disk_pr_state_post_load_errp(void *opaque, int version_id,
-+ Error **errp)
-+{
-+ SCSIDiskState *s = opaque;
-+ SCSIDevice *dev = &s->qdev;
-+
-+ return scsi_generic_pr_state_preempt(dev, errp);
-+}
-+
-+static int scsi_disk_pr_state_post_load(void *opaque, int version_id)
-+{
-+ SCSIDiskState *s = opaque;
-+ Error *errp = NULL;
-+
-+ if (scsi_disk_pr_state_post_load_errp(s, version_id, &errp)) {
-+ return 0;
-+ } else {
-+ error_report_err(errp);
-+ return -EINVAL;
-+ }
-+}
-+
-+static bool scsi_disk_pr_state_needed(void *opaque)
-+{
-+ SCSIDiskState *s = opaque;
-+ SCSIPRState *pr_state = &s->qdev.pr_state;
-+ bool ret;
-+
-+ if (!s->qdev.migrate_pr) {
-+ return false;
-+ }
-+
-+ /* A reservation requires a key, so checking this field is enough */
-+ WITH_QEMU_LOCK_GUARD(&pr_state->mutex) {
-+ ret = pr_state->key;
-+ }
-+ return ret;
-+}
-+
-+static const VMStateDescription vmstate_scsi_disk_pr_state = {
-+ .name = "scsi-disk/pr",
-+ .version_id = 1,
-+ .minimum_version_id = 1,
-+ .post_load = scsi_disk_pr_state_post_load,
-+ .needed = scsi_disk_pr_state_needed,
-+ .fields = (const VMStateField[]) {
-+ VMSTATE_UINT64(qdev.pr_state.key, SCSIDiskState),
-+ VMSTATE_UINT8(qdev.pr_state.resv_type, SCSIDiskState),
-+ VMSTATE_END_OF_LIST()
-+ }
-+};
-+#endif /* __linux__ */
-+
- static const VMStateDescription vmstate_scsi_disk_state = {
- .name = "scsi-disk",
- .version_id = 1,
-@@ -3221,7 +3310,13 @@ static const VMStateDescription vmstate_scsi_disk_state = {
- VMSTATE_BOOL(tray_open, SCSIDiskState),
- VMSTATE_BOOL(tray_locked, SCSIDiskState),
- VMSTATE_END_OF_LIST()
-- }
-+ },
-+ .subsections = (const VMStateDescription * const []) {
-+#ifdef __linux__
-+ &vmstate_scsi_disk_pr_state,
-+#endif
-+ NULL
-+ },
- };
-
- static void scsi_hd_class_initfn(ObjectClass *klass, const void *data)
-@@ -3301,6 +3396,7 @@ static const Property scsi_block_properties[] = {
- -1),
- DEFINE_PROP_UINT32("io_timeout", SCSIDiskState, qdev.io_timeout,
- DEFAULT_IO_TIMEOUT),
-+ DEFINE_PROP_BOOL("migrate-pr", SCSIDiskState, qdev.migrate_pr, true),
- };
-
- static void scsi_block_class_initfn(ObjectClass *klass, const void *data)
-@@ -3310,6 +3406,7 @@ static void scsi_block_class_initfn(ObjectClass *klass, const void *data)
- SCSIDiskClass *sdc = SCSI_DISK_BASE_CLASS(klass);
-
- sc->realize = scsi_block_realize;
-+ sc->unrealize = scsi_block_unrealize;
- sc->alloc_req = scsi_block_new_request;
- sc->parse_cdb = scsi_block_parse_cdb;
- sdc->dma_readv = scsi_block_dma_readv;
-diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
-index a6280eaa87..b8b3f399f0 100644
---- a/hw/scsi/scsi-generic.c
-+++ b/hw/scsi/scsi-generic.c
-@@ -423,6 +423,89 @@ static void scsi_handle_persistent_reserve_out_reply(
- }
- }
-
-+static bool scsi_generic_pr_register(SCSIDevice *s, uint64_t key, Error **errp)
-+{
-+ uint8_t cmd[10] = {};
-+ uint8_t buf[24] = {};
-+ uint64_t key_be = cpu_to_be64(key);
-+ int ret;
-+
-+ cmd[0] = PERSISTENT_RESERVE_OUT;
-+ cmd[1] = PRO_REGISTER;
-+ cmd[8] = sizeof(buf);
-+ memcpy(&buf[8], &key_be, sizeof(key_be));
-+
-+ ret = scsi_SG_IO(s->conf.blk, SG_DXFER_TO_DEV, cmd, sizeof(cmd),
-+ buf, sizeof(buf), s->io_timeout, errp);
-+ if (ret < 0) {
-+ error_prepend(errp, "PERSISTENT RESERVE OUT with REGISTER");
-+ return false;
-+ }
-+ return true;
-+}
-+
-+static bool scsi_generic_pr_preempt(SCSIDevice *s, uint64_t key,
-+ uint8_t resv_type, Error **errp)
-+{
-+ uint8_t cmd[10] = {};
-+ uint8_t buf[24] = {};
-+ uint64_t key_be = cpu_to_be64(key);
-+ int ret;
-+
-+ cmd[0] = PERSISTENT_RESERVE_OUT;
-+ cmd[1] = PRO_PREEMPT;
-+ cmd[2] = resv_type & 0xf;
-+ cmd[8] = sizeof(buf);
-+ memcpy(&buf[0], &key_be, sizeof(key_be));
-+ memcpy(&buf[8], &key_be, sizeof(key_be));
-+
-+ ret = scsi_SG_IO(s->conf.blk, SG_DXFER_TO_DEV, cmd, sizeof(cmd),
-+ buf, sizeof(buf), s->io_timeout, errp);
-+ if (ret < 0) {
-+ error_prepend(errp, "PERSISTENT RESERVE OUT with PREEMPT");
-+ return false;
-+ }
-+ return true;
-+}
-+
-+/* Register keys and preempt reservations after live migration */
-+bool scsi_generic_pr_state_preempt(SCSIDevice *s, Error **errp)
-+{
-+ SCSIPRState *pr_state = &s->pr_state;
-+ uint64_t key;
-+ uint8_t resv_type;
-+
-+ WITH_QEMU_LOCK_GUARD(&pr_state->mutex) {
-+ key = pr_state->key;
-+ resv_type = pr_state->resv_type;
-+ }
-+
-+ trace_scsi_generic_pr_state_preempt(key, resv_type);
-+
-+ if (key) {
-+ if (!scsi_generic_pr_register(s, key, errp)) {
-+ return false;
-+ }
-+
-+ /*
-+ * Two cases:
-+ *
-+ * 1. There is no reservation (resv_type is 0) and the other I_T nexus
-+ * will be unregistered. This is important so the source host does
-+ * not leak registered keys across live migration.
-+ *
-+ * 2. There is a reservation (resv_type is not 0) and the other I_T
-+ * nexus will be unregistered and its reservation is atomically
-+ * taken over by us. This is the scenario where a reservation is
-+ * migrated along with the guest.
-+ */
-+ if (!scsi_generic_pr_preempt(s, key, resv_type, errp)) {
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
- static void scsi_read_complete(void * opaque, int ret)
- {
- SCSIGenericReq *r = (SCSIGenericReq *)opaque;
-diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events
-index fdb87a237f..ab7a6f4cea 100644
---- a/hw/scsi/trace-events
-+++ b/hw/scsi/trace-events
-@@ -362,3 +362,4 @@ scsi_generic_aio_sgio_command(uint32_t tag, uint8_t cmd, uint32_t timeout) "gene
- scsi_generic_ioctl_sgio_command(uint8_t cmd, uint32_t timeout) "generic ioctl sgio: cmd=0x%x timeout=%u"
- scsi_generic_ioctl_sgio_done(uint8_t cmd, int ret, uint8_t status, uint8_t host_status) "generic ioctl sgio: cmd=0x%x ret=%d status=0x%x host_status=0x%x"
- scsi_generic_persistent_reserve_out_reply(uint8_t service_action, uint8_t resv_type, uint64_t old_key, uint64_t new_key) "persistent reserve out reply service_action=%u resv_type=%u old_key=0x%" PRIx64 " new_key=0x%" PRIx64
-+scsi_generic_pr_state_preempt(uint64_t key, uint8_t resv_type) "key=0x%" PRIx64 " resv_type=%u"
-diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
-index 7e120fdd6a..f61c63c5ea 100644
---- a/include/hw/scsi/scsi.h
-+++ b/include/hw/scsi/scsi.h
-@@ -253,6 +253,7 @@ SCSIDevice *scsi_device_get(SCSIBus *bus, int channel, int target, int lun);
-
- /* scsi-generic.c. */
- extern const SCSIReqOps scsi_generic_req_ops;
-+bool scsi_generic_pr_state_preempt(SCSIDevice *s, Error **errp);
-
- /* scsi-disk.c */
- #define SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR 0
---
-2.47.3
-
diff --git a/kvm-scsi-track-SCSI-reservation-state-for-live-migration.patch b/kvm-scsi-track-SCSI-reservation-state-for-live-migration.patch
deleted file mode 100644
index 82a3403..0000000
--- a/kvm-scsi-track-SCSI-reservation-state-for-live-migration.patch
+++ /dev/null
@@ -1,331 +0,0 @@
-From 220f405f15c997b636048aae3d4df44c4518e71d Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Thu, 29 Jan 2026 16:20:33 -0500
-Subject: [PATCH 4/7] scsi: track SCSI reservation state for live migration
-
-RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
-RH-MergeRequest: 464: scsi: persistent reservation live migration
-RH-Jira: RHEL-132749
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
-RH-Commit: [3/5] 563e4c4917709c65ca503898488131e3babf16e7 (stefanha/centos-stream-qemu-kvm)
-
-SCSI Persistent Reservations are stateful and external to the guest. In
-order to transparently move reservations to the destination host during
-live migration, it is necessary to track the state built up on the
-source host before migration. Only then can the destination host ensure
-an equivalent state is restored upon migration.
-
-Snoop on successful PERSISTENT RESERVE OUT commands and save the
-reservation key and reservation type. This will allow registered keys
-and reservations to be migrated.
-
-Also patch PERSISTENT RESERVE IN replies with the REPORT CAPABILITIES
-service action since features that involve the physical SCSI bus target
-ports must not be exposed to the guest (it sees a virtual SCSI bus).
-
-Usually this plays out as follows:
-1. The guest invokes the REGISTER service action to register a
- reservation key on its I_T nexus.
-2. The guest invokes the RESERVE service action to create a reservation
- using the previously-registered key.
-
-This commit implements the snooping and stores the reservation key and
-type (if any) for each LUN. The snooped PR state and the migrate_pr flag
-to enable PR migration will be used in later commits.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-Message-id: 20260129212035.219676-4-stefanha@redhat.com
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-(cherry picked from commit 70f0e0cedb2e0d7511cdebbce9b21a01bba55b74)
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/scsi/scsi-bus.c | 3 +
- hw/scsi/scsi-generic.c | 165 +++++++++++++++++++++++++++++++++++++++
- hw/scsi/trace-events | 1 +
- include/hw/scsi/scsi.h | 10 +++
- include/scsi/constants.h | 21 +++++
- 5 files changed, 200 insertions(+)
-
-diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
-index 9b12ee7f1c..878ccf62c9 100644
---- a/hw/scsi/scsi-bus.c
-+++ b/hw/scsi/scsi-bus.c
-@@ -393,6 +393,7 @@ static void scsi_qdev_realize(DeviceState *qdev, Error **errp)
- }
-
- qemu_mutex_init(&dev->requests_lock);
-+ qemu_mutex_init(&dev->pr_state.mutex);
- QTAILQ_INIT(&dev->requests);
- scsi_device_realize(dev, &local_err);
- if (local_err) {
-@@ -417,6 +418,8 @@ static void scsi_qdev_unrealize(DeviceState *qdev)
-
- scsi_device_unrealize(dev);
-
-+ qemu_mutex_destroy(&dev->pr_state.mutex);
-+
- blockdev_mark_auto_del(dev->conf.blk);
- }
-
-diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
-index 4f851186f6..a6280eaa87 100644
---- a/hw/scsi/scsi-generic.c
-+++ b/hw/scsi/scsi-generic.c
-@@ -264,6 +264,165 @@ static int scsi_generic_emulate_block_limits(SCSIGenericReq *r, SCSIDevice *s)
- return r->buflen;
- }
-
-+/*
-+ * Patch persistent reservation capabilities that are not emulated.
-+ */
-+static void scsi_handle_persistent_reserve_in_reply(SCSIGenericReq *r,
-+ SCSIDevice *s)
-+{
-+ uint8_t service_action = r->req.cmd.buf[1] & 0x1f;
-+
-+ if (!s->migrate_pr) {
-+ return; /* when migration is disabled there is no need for patching */
-+ }
-+
-+ if (service_action == PRI_REPORT_CAPABILITIES) {
-+ assert(r->buflen >= 3);
-+
-+ /*
-+ * Clear specify initiator ports capable (SIP_C) and all target ports
-+ * capable (ATC_C).
-+ *
-+ * SPEC_I_PT is not supported because the guest sees an emulated SCSI
-+ * bus and does not have the underlying transport IDs needed to use
-+ * SPEC_I_PT.
-+ *
-+ * ALL_TG_PT is not supported because we only track the state of this
-+ * emulated I_T nexus, not the underlying device's target ports.
-+ */
-+ r->buf[2] &= ~0xc;
-+ }
-+}
-+
-+static int scsi_generic_read_reservation(SCSIDevice *s, uint64_t *key,
-+ uint8_t *resv_type, Error **errp)
-+{
-+ uint8_t cmd[10] = {};
-+ uint8_t buf[24] = {};
-+ uint32_t additional_length;
-+ int ret;
-+
-+ *key = 0;
-+ *resv_type = 0;
-+
-+ cmd[0] = PERSISTENT_RESERVE_IN;
-+ cmd[1] = PRI_READ_RESERVATION;
-+ cmd[8] = sizeof(buf);
-+
-+ ret = scsi_SG_IO(s->conf.blk, SG_DXFER_FROM_DEV, cmd, sizeof(cmd),
-+ buf, sizeof(buf), s->io_timeout, errp);
-+ if (ret < 0) {
-+ return ret;
-+ }
-+
-+ memcpy(&additional_length, &buf[4], sizeof(additional_length));
-+ be32_to_cpus(&additional_length);
-+
-+ if (additional_length >= 0x10) {
-+ memcpy(key, &buf[8], sizeof(*key));
-+ be64_to_cpus(key);
-+
-+ *resv_type = buf[21] & 0xf;
-+ }
-+ return 0;
-+}
-+
-+/*
-+ * Snoop changes to registered keys and reservations so that this information
-+ * can be transferred during live migration.
-+ */
-+static void scsi_handle_persistent_reserve_out_reply(
-+ SCSIGenericReq *r,
-+ SCSIDevice *s)
-+{
-+ SCSIPRState *pr_state = &s->pr_state;
-+ uint8_t service_action = r->req.cmd.buf[1] & 0x1f;
-+ uint8_t resv_type = r->req.cmd.buf[2] & 0xf;
-+ uint64_t old_key;
-+ uint64_t new_key;
-+
-+ assert(r->buflen >= 16);
-+ memcpy(&old_key, &r->buf[0], sizeof(old_key));
-+ memcpy(&new_key, &r->buf[8], sizeof(new_key));
-+ be64_to_cpus(&old_key);
-+ be64_to_cpus(&new_key);
-+
-+ trace_scsi_generic_persistent_reserve_out_reply(service_action, resv_type,
-+ old_key, new_key);
-+
-+ switch (service_action) {
-+ case PRO_REGISTER: /* fallthrough */
-+ case PRO_REGISTER_AND_IGNORE_EXISTING_KEY:
-+ if (service_action == PRO_REGISTER && old_key == 0 && new_key == 0) {
-+ /* Do nothing */
-+ } else {
-+ WITH_QEMU_LOCK_GUARD(&pr_state->mutex) {
-+ pr_state->key = new_key;
-+ if (new_key == 0) {
-+ pr_state->resv_type = 0; /* release reservation */
-+ }
-+ }
-+ }
-+ break;
-+
-+ case PRO_RESERVE:
-+ WITH_QEMU_LOCK_GUARD(&pr_state->mutex) {
-+ pr_state->resv_type = resv_type;
-+ }
-+ break;
-+
-+ case PRO_RELEASE:
-+ WITH_QEMU_LOCK_GUARD(&pr_state->mutex) {
-+ pr_state->resv_type = 0;
-+ }
-+ break;
-+
-+ case PRO_CLEAR:
-+ WITH_QEMU_LOCK_GUARD(&pr_state->mutex) {
-+ pr_state->key = 0;
-+ pr_state->resv_type = 0;
-+ }
-+ break;
-+
-+ case PRO_REPLACE_LOST_RESERVATION:
-+ WITH_QEMU_LOCK_GUARD(&pr_state->mutex) {
-+ pr_state->key = new_key;
-+ pr_state->resv_type = resv_type;
-+ }
-+ break;
-+
-+ case PRO_PREEMPT: /* fallthrough */
-+ case PRO_PREEMPT_AND_ABORT: {
-+ uint64_t dev_key;
-+ uint8_t dev_resv_type;
-+ Error *local_err = NULL;
-+
-+ /* Not enough information to know actual state, ask the device */
-+ if (!scsi_generic_read_reservation(s, &dev_key, &dev_resv_type,
-+ &local_err)) {
-+ WITH_QEMU_LOCK_GUARD(&pr_state->mutex) {
-+ if (pr_state->key == dev_key) {
-+ pr_state->resv_type = dev_resv_type;
-+ } else {
-+ pr_state->resv_type = 0;
-+ }
-+ }
-+ }
-+ if (local_err) {
-+ warn_report_err(local_err);
-+ }
-+ break;
-+ }
-+
-+ /*
-+ * PRO_REGISTER_AND_MOVE cannot be implemented since it involves the
-+ * physical SCSI bus target ports.
-+ */
-+ default:
-+ break; /* do nothing */
-+ }
-+}
-+
- static void scsi_read_complete(void * opaque, int ret)
- {
- SCSIGenericReq *r = (SCSIGenericReq *)opaque;
-@@ -346,6 +505,9 @@ static void scsi_read_complete(void * opaque, int ret)
- if (r->req.cmd.buf[0] == INQUIRY) {
- len = scsi_handle_inquiry_reply(r, s, len);
- }
-+ if (r->req.cmd.buf[0] == PERSISTENT_RESERVE_IN) {
-+ scsi_handle_persistent_reserve_in_reply(r, s);
-+ }
-
- req_complete:
- scsi_req_data(&r->req, len);
-@@ -395,6 +557,9 @@ static void scsi_write_complete(void * opaque, int ret)
- s->blocksize = (r->buf[9] << 16) | (r->buf[10] << 8) | r->buf[11];
- trace_scsi_generic_write_complete_blocksize(s->blocksize);
- }
-+ if (r->req.cmd.buf[0] == PERSISTENT_RESERVE_OUT) {
-+ scsi_handle_persistent_reserve_out_reply(r, s);
-+ }
-
- scsi_command_complete_noio(r, ret);
- }
-diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events
-index 6c2788e202..fdb87a237f 100644
---- a/hw/scsi/trace-events
-+++ b/hw/scsi/trace-events
-@@ -361,3 +361,4 @@ scsi_generic_realize_blocksize(int blocksize) "block size %d"
- scsi_generic_aio_sgio_command(uint32_t tag, uint8_t cmd, uint32_t timeout) "generic aio sgio: tag=0x%x cmd=0x%x timeout=%u"
- scsi_generic_ioctl_sgio_command(uint8_t cmd, uint32_t timeout) "generic ioctl sgio: cmd=0x%x timeout=%u"
- scsi_generic_ioctl_sgio_done(uint8_t cmd, int ret, uint8_t status, uint8_t host_status) "generic ioctl sgio: cmd=0x%x ret=%d status=0x%x host_status=0x%x"
-+scsi_generic_persistent_reserve_out_reply(uint8_t service_action, uint8_t resv_type, uint64_t old_key, uint64_t new_key) "persistent reserve out reply service_action=%u resv_type=%u old_key=0x%" PRIx64 " new_key=0x%" PRIx64
-diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
-index 977b7e4d55..7e120fdd6a 100644
---- a/include/hw/scsi/scsi.h
-+++ b/include/hw/scsi/scsi.h
-@@ -54,6 +54,13 @@ struct SCSIRequest {
- QTAILQ_ENTRY(SCSIRequest) next;
- };
-
-+/* Per-SCSIDevice Persistent Reservation state */
-+typedef struct {
-+ QemuMutex mutex; /* protects all fields (e.g. from multiple IOThreads) */
-+ uint64_t key; /* 0 if no registered key */
-+ uint8_t resv_type; /* 0 if no reservation */
-+} SCSIPRState;
-+
- #define TYPE_SCSI_DEVICE "scsi-device"
- OBJECT_DECLARE_TYPE(SCSIDevice, SCSIDeviceClass, SCSI_DEVICE)
-
-@@ -94,6 +101,9 @@ struct SCSIDevice
- uint32_t io_timeout;
- bool needs_vpd_bl_emulation;
- bool hba_supports_iothread;
-+
-+ bool migrate_pr;
-+ SCSIPRState pr_state;
- };
-
- extern const VMStateDescription vmstate_scsi_device;
-diff --git a/include/scsi/constants.h b/include/scsi/constants.h
-index 9b98451912..cb97bdb636 100644
---- a/include/scsi/constants.h
-+++ b/include/scsi/constants.h
-@@ -319,4 +319,25 @@
- #define IDENT_DESCR_TGT_DESCR_SIZE 32
- #define XCOPY_BLK2BLK_SEG_DESC_SIZE 28
-
-+/*
-+ * PERSISTENT RESERVATION IN service action codes
-+ */
-+#define PRI_READ_KEYS 0x00
-+#define PRI_READ_RESERVATION 0x01
-+#define PRI_REPORT_CAPABILITIES 0x02
-+#define PRI_READ_FULL_STATUS 0x03
-+
-+/*
-+ * PERSISTENT RESERVATION OUT service action codes
-+ */
-+#define PRO_REGISTER 0x00
-+#define PRO_RESERVE 0x01
-+#define PRO_RELEASE 0x02
-+#define PRO_CLEAR 0x03
-+#define PRO_PREEMPT 0x04
-+#define PRO_PREEMPT_AND_ABORT 0x05
-+#define PRO_REGISTER_AND_IGNORE_EXISTING_KEY 0x06
-+#define PRO_REGISTER_AND_MOVE 0x07
-+#define PRO_REPLACE_LOST_RESERVATION 0x08
-+
- #endif
---
-2.47.3
-
diff --git a/kvm-system-iommufd-Remove-unused-viommu-pointer-from-IOM.patch b/kvm-system-iommufd-Remove-unused-viommu-pointer-from-IOM.patch
deleted file mode 100644
index 462088d..0000000
--- a/kvm-system-iommufd-Remove-unused-viommu-pointer-from-IOM.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From aaa21147aa0f3cc4be8c9f161c147400f2847888 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Tue, 9 Jun 2026 12:25:26 +0100
-Subject: [PATCH 083/111] system/iommufd: Remove unused viommu pointer from
- IOMMUFDVeventq
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [83/111] f26bf60ada82caf5d5e8cbdcb643ea9e5995dbcf (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-The viommu field is assigned but never used. Callers freeing the
-veventq already have access to the IOMMUFDViommu object through other
-references, so this field is redundant.
-
-Removing it also simplifies upcoming changes where veventq is
-allocated based on the viommu id before the IOMMUFDViommu object is
-created (e.g. vendor CMDQV-based veventq allocation).
-
-No functional change.
-
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Nicolin Chen <nicolinc@nvidia.com>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260609112552.378999-6-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 9e67a50ea91df52858849d0c36891e7a8931c05f)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/arm/smmuv3-accel.c | 1 -
- include/system/iommufd.h | 1 -
- 2 files changed, 2 deletions(-)
-
-diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
-index 4cef487679..70b2581c17 100644
---- a/hw/arm/smmuv3-accel.c
-+++ b/hw/arm/smmuv3-accel.c
-@@ -553,7 +553,6 @@ bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp)
- veventq = g_new0(IOMMUFDVeventq, 1);
- veventq->veventq_id = veventq_id;
- veventq->veventq_fd = veventq_fd;
-- veventq->viommu = accel->viommu;
- accel->veventq = veventq;
-
- /* Set up event handler for veventq fd */
-diff --git a/include/system/iommufd.h b/include/system/iommufd.h
-index 2abb7c9605..4591096c3e 100644
---- a/include/system/iommufd.h
-+++ b/include/system/iommufd.h
-@@ -58,7 +58,6 @@ typedef struct IOMMUFDVdev {
-
- /* Virtual event queue interface for a vIOMMU */
- typedef struct IOMMUFDVeventq {
-- IOMMUFDViommu *viommu;
- uint32_t veventq_id;
- uint32_t veventq_fd;
- uint32_t last_event_seq; /* Sequence number of last processed event */
---
-2.52.0
-
diff --git a/kvm-system-iommufd-Use-uint64_t-type-for-IOVA-mapping-si.patch b/kvm-system-iommufd-Use-uint64_t-type-for-IOVA-mapping-si.patch
deleted file mode 100644
index d1e42e6..0000000
--- a/kvm-system-iommufd-Use-uint64_t-type-for-IOVA-mapping-si.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From 3f329c9354514ec0363a55f232deef28459f5ec4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
-Date: Tue, 30 Sep 2025 14:35:25 +0200
-Subject: [PATCH 081/116] system/iommufd: Use uint64_t type for IOVA mapping
- size
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [65/100] c875244fb3df398bd2c47f3597f5ca7c1ae9a0a5 (rovick1/qemu-kvm)
-
-The 'ram_addr_t' type is described as:
-
- a QEMU internal address space that maps guest RAM physical
- addresses into an intermediate address space that can map
- to host virtual address spaces.
-
-This doesn't represent well an IOVA mapping size. Simply use
-the uint64_t type.
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250930123528.42878-2-philmd@linaro.org
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 70a7e33ddb7f2ca7caacf286222bd80fd330c454)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- backends/iommufd.c | 6 +++---
- include/system/iommufd.h | 6 +++---
- 2 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/backends/iommufd.c b/backends/iommufd.c
-index 2a33c7ab0b..fdfb7c9d67 100644
---- a/backends/iommufd.c
-+++ b/backends/iommufd.c
-@@ -197,7 +197,7 @@ void iommufd_backend_free_id(IOMMUFDBackend *be, uint32_t id)
- }
-
- int iommufd_backend_map_dma(IOMMUFDBackend *be, uint32_t ioas_id, hwaddr iova,
-- ram_addr_t size, void *vaddr, bool readonly)
-+ uint64_t size, void *vaddr, bool readonly)
- {
- int ret, fd = be->fd;
- struct iommu_ioas_map map = {
-@@ -230,7 +230,7 @@ int iommufd_backend_map_dma(IOMMUFDBackend *be, uint32_t ioas_id, hwaddr iova,
- }
-
- int iommufd_backend_map_file_dma(IOMMUFDBackend *be, uint32_t ioas_id,
-- hwaddr iova, ram_addr_t size,
-+ hwaddr iova, uint64_t size,
- int mfd, unsigned long start, bool readonly)
- {
- int ret, fd = be->fd;
-@@ -268,7 +268,7 @@ int iommufd_backend_map_file_dma(IOMMUFDBackend *be, uint32_t ioas_id,
- }
-
- int iommufd_backend_unmap_dma(IOMMUFDBackend *be, uint32_t ioas_id,
-- hwaddr iova, ram_addr_t size)
-+ hwaddr iova, uint64_t size)
- {
- int ret, fd = be->fd;
- struct iommu_ioas_unmap unmap = {
-diff --git a/include/system/iommufd.h b/include/system/iommufd.h
-index c9c72ffc45..a659f36a20 100644
---- a/include/system/iommufd.h
-+++ b/include/system/iommufd.h
-@@ -45,12 +45,12 @@ bool iommufd_backend_alloc_ioas(IOMMUFDBackend *be, uint32_t *ioas_id,
- Error **errp);
- void iommufd_backend_free_id(IOMMUFDBackend *be, uint32_t id);
- int iommufd_backend_map_file_dma(IOMMUFDBackend *be, uint32_t ioas_id,
-- hwaddr iova, ram_addr_t size, int fd,
-+ hwaddr iova, uint64_t size, int fd,
- unsigned long start, bool readonly);
- int iommufd_backend_map_dma(IOMMUFDBackend *be, uint32_t ioas_id, hwaddr iova,
-- ram_addr_t size, void *vaddr, bool readonly);
-+ uint64_t size, void *vaddr, bool readonly);
- int iommufd_backend_unmap_dma(IOMMUFDBackend *be, uint32_t ioas_id,
-- hwaddr iova, ram_addr_t size);
-+ hwaddr iova, uint64_t size);
- bool iommufd_backend_get_device_info(IOMMUFDBackend *be, uint32_t devid,
- uint32_t *type, void *data, uint32_t len,
- uint64_t *caps, Error **errp);
---
-2.52.0
-
diff --git a/kvm-system-memory-Factor-address_space_is_io-out.patch b/kvm-system-memory-Factor-address_space_is_io-out.patch
deleted file mode 100644
index 013de16..0000000
--- a/kvm-system-memory-Factor-address_space_is_io-out.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From 739a771cce232fe56b29291092dd7c10d1f2b364 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
-Date: Mon, 29 Sep 2025 14:36:19 +0200
-Subject: [PATCH 046/111] system/memory: Factor address_space_is_io() out
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [46/111] 1dcdda9cbb0db9215a654e8e7e6bab6bfb847014 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73796
-
-Factor address_space_is_io() out of cpu_physical_memory_is_io().
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Thomas Huth <thuth@redhat.com>
-Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-Message-Id: <20251002084203.63899-3-philmd@linaro.org>
-(cherry picked from commit 839976e9da4b577aca284847b7e965332f2ca687)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- include/system/memory.h | 9 +++++++++
- system/physmem.c | 21 ++++++++++++---------
- 2 files changed, 21 insertions(+), 9 deletions(-)
-
-diff --git a/include/system/memory.h b/include/system/memory.h
-index e2cd6ed126..4913206c8c 100644
---- a/include/system/memory.h
-+++ b/include/system/memory.h
-@@ -3017,6 +3017,15 @@ static inline MemoryRegion *address_space_translate(AddressSpace *as,
- bool address_space_access_valid(AddressSpace *as, hwaddr addr, hwaddr len,
- bool is_write, MemTxAttrs attrs);
-
-+/**
-+ * address_space_is_io: check whether an guest physical addresses
-+ * whithin an address space is I/O memory.
-+ *
-+ * @as: #AddressSpace to be accessed
-+ * @addr: address within that address space
-+ */
-+bool address_space_is_io(AddressSpace *as, hwaddr addr);
-+
- /* address_space_map: map a physical memory region into a host virtual address
- *
- * May map a subset of the requested range, given by and returned in @plen.
-diff --git a/system/physmem.c b/system/physmem.c
-index e5dd760e0b..2e34205ad7 100644
---- a/system/physmem.c
-+++ b/system/physmem.c
-@@ -3376,6 +3376,17 @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr,
- return flatview_access_valid(fv, addr, len, is_write, attrs);
- }
-
-+bool address_space_is_io(AddressSpace *as, hwaddr addr)
-+{
-+ MemoryRegion *mr;
-+
-+ RCU_READ_LOCK_GUARD();
-+ mr = address_space_translate(as, addr, &addr, NULL, false,
-+ MEMTXATTRS_UNSPECIFIED);
-+
-+ return !(memory_region_is_ram(mr) || memory_region_is_romd(mr));
-+}
-+
- static hwaddr
- flatview_extend_translation(FlatView *fv, hwaddr addr,
- hwaddr target_len,
-@@ -3772,15 +3783,7 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
-
- bool cpu_physical_memory_is_io(hwaddr phys_addr)
- {
-- MemoryRegion*mr;
-- hwaddr l = 1;
--
-- RCU_READ_LOCK_GUARD();
-- mr = address_space_translate(&address_space_memory,
-- phys_addr, &phys_addr, &l, false,
-- MEMTXATTRS_UNSPECIFIED);
--
-- return !(memory_region_is_ram(mr) || memory_region_is_romd(mr));
-+ return address_space_is_io(&address_space_memory, phys_addr);
- }
-
- int qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque)
---
-2.52.0
-
diff --git a/kvm-system-memory-Make-ram-device-region-directly-access.patch b/kvm-system-memory-Make-ram-device-region-directly-access.patch
deleted file mode 100644
index b02c950..0000000
--- a/kvm-system-memory-Make-ram-device-region-directly-access.patch
+++ /dev/null
@@ -1,150 +0,0 @@
-From a6d16269f9e1b8a9a397f4bfc30db35ee68e9412 Mon Sep 17 00:00:00 2001
-From: Gavin Shan <gshan@redhat.com>
-Date: Sat, 22 Aug 2026 11:26:51 +1000
-Subject: [PATCH 3/3] system/memory: Make ram device region directly accessible
-
-RH-Author: Gavin Shan <gshan@redhat.com>
-RH-MergeRequest: 517: memory: Make ram device region directly accessible
-RH-Jira: RHEL-246035
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [3/3] 853127b4ff1b8b834c958791d1d6f78dde4d0e0e (gwshan/qemu-centos10)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-246035
-
-This basically reverts 4a2e242bbb30 ("memory: Don't use memcpy for
-ram_device regions") to make ram device region directly accessible
-again. With this, the bounce buffer is bypassed in address_space_map()
-when a ram device region is involved, potentially avoid to overrun
-the (small) bounce buffer.
-
-Reported-by: Julia Graham <jugraham@redhat.com>
-Suggested-by: Michael S. Tsirkin <mst@redhat.com>
-Suggested-by: Peter Xu <peterx@redhat.com>
-Suggested-by: Richard Henderson <richard.henderson@linaro.org>
-Suggested-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Gavin Shan <gshan@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Link: https://lore.kernel.org/r/20260728031731.286666-4-gshan@redhat.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
-(cherry picked from commit ff77a515113f052cc5fc571b6a328142fdfcf220)
-Signed-off-by: Gavin Shan <gshan@redhat.com>
-Conflicts:
- system/memory.c
- Conflict due to missed upstream commits, but the existing
- memory_region_init_ram_ptr() is still well appliable in
- memory_region_init_ram_device_ptr().
- 5cb466d7ca56 ("memory: Add internal memory_region_set_ops helper function")
- 8fe668d0b492 ("memory: Shorten memory_region_init_ram_device_ptr and memory_region_init_rom_device")
- 7f116e951d80 ("memory: Factor out common ram ptr initialization")
----
- include/system/memory.h | 11 ++--------
- system/memory.c | 48 +----------------------------------------
- system/trace-events | 2 --
- 3 files changed, 3 insertions(+), 58 deletions(-)
-
-diff --git a/include/system/memory.h b/include/system/memory.h
-index 351cf1253c..161d1944e0 100644
---- a/include/system/memory.h
-+++ b/include/system/memory.h
-@@ -3161,15 +3161,8 @@ static inline bool memory_region_supports_direct_access(MemoryRegion *mr)
- if (memory_region_is_romd(mr)) {
- return true;
- }
-- if (!memory_region_is_ram(mr)) {
-- return false;
-- }
-- /*
-- * RAM DEVICE regions can be accessed directly using memcpy, but it might
-- * be MMIO and access using mempy can be wrong (e.g., using instructions not
-- * intended for MMIO access). So we treat this as IO.
-- */
-- return !memory_region_is_ram_device(mr);
-+
-+ return memory_region_is_ram(mr);
- }
-
- static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write,
-diff --git a/system/memory.c b/system/memory.c
-index bdd53369a9..70dc6d852f 100644
---- a/system/memory.c
-+++ b/system/memory.c
-@@ -1360,43 +1360,6 @@ const MemoryRegionOps unassigned_mem_ops = {
- .endianness = DEVICE_NATIVE_ENDIAN,
- };
-
--static uint64_t memory_region_ram_device_read(void *opaque,
-- hwaddr addr, unsigned size)
--{
-- MemoryRegion *mr = opaque;
-- uint64_t data = ldn_he_p(mr->ram_block->host + addr, size);
--
-- trace_memory_region_ram_device_read(get_cpu_index(), mr, addr, data, size);
--
-- return data;
--}
--
--static void memory_region_ram_device_write(void *opaque, hwaddr addr,
-- uint64_t data, unsigned size)
--{
-- MemoryRegion *mr = opaque;
--
-- trace_memory_region_ram_device_write(get_cpu_index(), mr, addr, data, size);
--
-- stn_he_p(mr->ram_block->host + addr, size, data);
--}
--
--static const MemoryRegionOps ram_device_mem_ops = {
-- .read = memory_region_ram_device_read,
-- .write = memory_region_ram_device_write,
-- .endianness = HOST_BIG_ENDIAN ? DEVICE_BIG_ENDIAN : DEVICE_LITTLE_ENDIAN,
-- .valid = {
-- .min_access_size = 1,
-- .max_access_size = 8,
-- .unaligned = true,
-- },
-- .impl = {
-- .min_access_size = 1,
-- .max_access_size = 8,
-- .unaligned = true,
-- },
--};
--
- bool memory_region_access_valid(MemoryRegion *mr,
- hwaddr addr,
- unsigned size,
-@@ -1707,17 +1670,8 @@ void memory_region_init_ram_device_ptr(MemoryRegion *mr,
- uint64_t size,
- void *ptr)
- {
-- memory_region_init(mr, owner, name, size);
-- mr->ram = true;
-- mr->terminates = true;
-+ memory_region_init_ram_ptr(mr, owner, name, size, ptr);
- mr->ram_device = true;
-- mr->ops = &ram_device_mem_ops;
-- mr->opaque = mr;
-- mr->destructor = memory_region_destructor_ram;
--
-- /* qemu_ram_alloc_from_ptr cannot fail with ptr != NULL. */
-- assert(ptr != NULL);
-- mr->ram_block = qemu_ram_alloc_from_ptr(size, ptr, mr, &error_abort);
- }
-
- void memory_region_init_alias(MemoryRegion *mr,
-diff --git a/system/trace-events b/system/trace-events
-index 82856e44f2..eb3e7681ab 100644
---- a/system/trace-events
-+++ b/system/trace-events
-@@ -20,8 +20,6 @@ memory_region_ops_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, u
- memory_region_ops_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size, const char *name) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u name '%s'"
- memory_region_subpage_read(int cpu_index, void *mr, uint64_t offset, uint64_t value, unsigned size) "cpu %d mr %p offset 0x%"PRIx64" value 0x%"PRIx64" size %u"
- memory_region_subpage_write(int cpu_index, void *mr, uint64_t offset, uint64_t value, unsigned size) "cpu %d mr %p offset 0x%"PRIx64" value 0x%"PRIx64" size %u"
--memory_region_ram_device_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u"
--memory_region_ram_device_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u"
- memory_region_sync_dirty(const char *mr, const char *listener, int global) "mr '%s' listener '%s' synced (global=%d)"
- flatview_new(void *view, void *root) "%p (root %p)"
- flatview_destroy(void *view, void *root) "%p (root %p)"
---
-2.52.0
-
diff --git a/kvm-system-memory-Use-memmove-for-directly-accessible-re.patch b/kvm-system-memory-Use-memmove-for-directly-accessible-re.patch
deleted file mode 100644
index a27328e..0000000
--- a/kvm-system-memory-Use-memmove-for-directly-accessible-re.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-From 7287740ea09f10266d5b3b9a5310927f30dae46e Mon Sep 17 00:00:00 2001
-From: Gavin Shan <gshan@redhat.com>
-Date: Sat, 22 Aug 2026 11:26:51 +1000
-Subject: [PATCH 1/3] system/memory: Use memmove() for directly accessible
- regions
-
-RH-Author: Gavin Shan <gshan@redhat.com>
-RH-MergeRequest: 517: memory: Make ram device region directly accessible
-RH-Jira: RHEL-246035
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [1/3] 4c7b4f5a6aa295707c18678d2c906bb3388a1969 (gwshan/qemu-centos10)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-246035
-
-Similar to what's done in commit 4a73aee88140 ("softmmu: Use memmove in
-flatview_write_continue"), there are more sites where the overlapping
-source and destination buffer are allowed for the directly accessible
-regions. Use memmove() in those sites, listed as below.
-
- hw/remote/vfio-user-obj.c::vfu_object_mr_rw
- include/system/memory.h::address_space_read
- system/physmem.c::flatview_read_continue_step
-
-Signed-off-by: Gavin Shan <gshan@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Reviewed-by: Peter Xu <peterx@redhat.com>
-Link: https://lore.kernel.org/r/20260728031731.286666-2-gshan@redhat.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
-(cherry picked from commit d2d7e63da8e9a6ac4bb23e3ecc1de468530c9437)
-Signed-off-by: Gavin Shan <gshan@redhat.com>
----
- hw/remote/vfio-user-obj.c | 4 ++--
- include/system/memory.h | 2 +-
- system/physmem.c | 2 +-
- 3 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c
-index ea6165ebdc..494fea565c 100644
---- a/hw/remote/vfio-user-obj.c
-+++ b/hw/remote/vfio-user-obj.c
-@@ -368,9 +368,9 @@ static int vfu_object_mr_rw(MemoryRegion *mr, uint8_t *buf, hwaddr offset,
- ram_ptr = memory_region_get_ram_ptr(mr);
-
- if (is_write) {
-- memcpy((ram_ptr + offset), buf, size);
-+ memmove((ram_ptr + offset), buf, size);
- } else {
-- memcpy(buf, (ram_ptr + offset), size);
-+ memmove(buf, (ram_ptr + offset), size);
- }
-
- return 0;
-diff --git a/include/system/memory.h b/include/system/memory.h
-index 8e60f03d44..b39ec9a5d3 100644
---- a/include/system/memory.h
-+++ b/include/system/memory.h
-@@ -3184,7 +3184,7 @@ MemTxResult address_space_read(AddressSpace *as, hwaddr addr,
- mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
- if (len == l && memory_access_is_direct(mr, false, attrs)) {
- ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
-- memcpy(buf, ptr, len);
-+ memmove(buf, ptr, len);
- } else {
- result = flatview_read_continue(fv, addr, attrs, buf, len,
- addr1, l, mr);
-diff --git a/system/physmem.c b/system/physmem.c
-index 4a1294f8a0..697e75dad7 100644
---- a/system/physmem.c
-+++ b/system/physmem.c
-@@ -3074,7 +3074,7 @@ static MemTxResult flatview_read_continue_step(MemTxAttrs attrs, uint8_t *buf,
- uint8_t *ram_ptr = qemu_ram_ptr_length(mr->ram_block, mr_addr, l,
- false, false);
-
-- memcpy(buf, ram_ptr, *l);
-+ memmove(buf, ram_ptr, *l);
-
- return MEMTX_OK;
- }
---
-2.52.0
-
diff --git a/kvm-system-memory-Use-qemu_ram_move-for-directly-accessi.patch b/kvm-system-memory-Use-qemu_ram_move-for-directly-accessi.patch
deleted file mode 100644
index 10ff848..0000000
--- a/kvm-system-memory-Use-qemu_ram_move-for-directly-accessi.patch
+++ /dev/null
@@ -1,270 +0,0 @@
-From 8f3cee2f6c741ba3bf93e097b3fb7207dbf08aaf Mon Sep 17 00:00:00 2001
-From: Gavin Shan <gshan@redhat.com>
-Date: Sat, 22 Aug 2026 11:26:51 +1000
-Subject: [PATCH 2/3] system/memory: Use qemu_ram_move() for directly
- accessible regions
-
-RH-Author: Gavin Shan <gshan@redhat.com>
-RH-MergeRequest: 517: memory: Make ram device region directly accessible
-RH-Jira: RHEL-246035
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [2/3] e4245fe1ea4ed269832f153ea4772f7848472ba0 (gwshan/qemu-centos10)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-246035
-
-All ram device regions were turned to be indirectly accessible by commit
-4a2e242bbb ("memory: Don't use memcpy for ram_device regions"). This leads
-to guest hang on attempt to build 'cuda-samples' as reported by Julia. The
-guest is started by the following command lines, with GH100 GPU card passed
-from the host.
-
- host$ lspci | grep GH100
- 0009:01:00.0 3D controller: NVIDIA Corporation GH100 [GH200 120GB / 480GB] (rev a1)
- host$ /home/sandbox/gavin/qemu.main/build/qemu-system-aarch64 \
- -machine virt,gic-version=host,ras=on,highmem-mmio-size=4T \
- -accel kvm -cpu host -smp cpus=48 -m size=8G \
- -drive file=/home/gavin/sandbox/images/disk.qcow2,if=none,id=d0 \
- -device virtio-blk-pci,id=vb0,bus=pcie.0,drive=d0,num-queues=4 \
- -device vfio-pci-nohotplug,host=0009:01:00.0,bus=pcie.1.0
- :
- guest$ cd cuda-samples/build
- guest$ make -j 20 clean
- guest$ make -j 20
- :
- [ 54%] Linking CUDA executable graphMemoryNodes
- [ 54%] Built target graphMemoryNodes
- <no more output afterwards, guest becomes frozen here>
-
- guest$ qemu-system-aarch64: virtio: bogus descriptor or out of resources
- [ 555.814025] virtio_blk virtio0: [vda] new size: 268435456 512-byte logical blocks (137 GB/128 GiB)
-
-When the GPU's driver (NVidia open driver) is loaded on guest bootup,
-the memory blocks residing in the PCI BAR#4 of the GH100 GPU card can
-be presented to the guest through memory hot-add. The page cache can
-then be allocated from the hot added memory blocks when cuda-samples
-is being built. Afterwards, the page cache is sent to QEMU's virtio-blk
-device as part of the DMA request, the bounce buffer has to be used to
-accomodate the request as the corresponding memory region (MemoryRegion)
-is an indirectly accessible ram device region in qemu. However, the max
-bounce bufer size is only 4096 bytes by default and that is exhausted
-quickly, leading to a reset on the virtio-blk device and frozen guest
-eventually.
-
- QEMU
- ====
- virtio_blk_handle_output
- virtio_blk_handle_vq
- virtio_blk_get_request
- virtqueue_pop
- virtqueue_split_pop
- virtqueue_map_desc
- address_space_map
- memory_access_is_direct # Return false
- memory_region_supports_direct_access
-
- (qemu) info mtree
- memory-region: pci_bridge_pci
- 0000000000000000-ffffffffffffffff (prio 0, container): pci_bridge_pci
- 0000042000000000-0000043fffffffff (prio 1, i/o): 0009:01:00.0 base BAR 4
- 0000042000000000-0000043fffffffff (prio 0, i/o): 0009:01:00.0 BAR 4
- 0000042000000000-000004379fffffff (prio 0, ramd): 0009:01:00.0 BAR 4 mmaps[0]
-
-This adds qemu_ram_move() where the aligned and small-sized accesses are
-handled by qatomics, and fall back to memmove() otherwise. The memove()
-for the directly accessible regions is replaced by qemu_ram_move() so that
-the issue covered by commit 4a2e242bbb (MMIO access instructions were
-optimized to SSE instructions) is fixed. This makes 'ram_device_mem_ops'
-redundant, paving the way to revert that commit to make the ram device
-region directly accessible again in the next patch.
-
-Besides, this also fixes the issue of the unexpected frozen reception on
-e1000 NIC in the scenario of DPDK due to the wrong Rx queue full indication
-caused by the following memcpy(), which is turned to 3 consective 'strb'
-instructions to the same location by glibc-2.24+ for aarch64. With this
-applied, the syntax of one-byte store is strictly ensured by a one-byte
-qatomic set.
-
- QEMU
- ====
- e1000_receive_iov
- pci_dma_write
- pci_dma_rw
- dma_memory_rw
- dma_memory_rw_relaxed
- address_space_rw
- address_space_write
- flatview_write
- flatview_write_continue
- flatview_write_continue_step
- memcpy # 3 consective 'strb' instructions
-
-Reported-by: Julia Graham <jugraham@redhat.com>
-Reported-by: Liu Gang <liugang24219@sangfor.com.cn>
-Reported-by: Ding Hui <dinghui@sangfor.com.cn>
-Suggested-by: Michael S. Tsirkin <mst@redhat.com>
-Suggested-by: Peter Xu <peterx@redhat.com>
-Suggested-by: Richard Henderson <richard.henderson@linaro.org>
-Suggested-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Gavin Shan <gshan@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Link: https://lore.kernel.org/r/20260728031731.286666-3-gshan@redhat.com
-[peterx: remove src==dst check, fix doc, enhance comments, per PeterM, add R-b]
-Signed-off-by: Peter Xu <peterx@redhat.com>
-(cherry picked from commit bec5e7c71cc9770a900dac6930d076fe7ee9e57b)
-Signed-off-by: Gavin Shan <gshan@redhat.com>
-Conflicts:
- include/system/memory.h
- Contextual conflict due to missed upstream commit 47b23339a5bb
- ("system/memory: Constify various AddressSpace arguments (access)")
----
- hw/remote/vfio-user-obj.c | 4 ++--
- include/system/memory.h | 35 +++++++++++++++++++++++++++-
- system/physmem.c | 48 +++++++++++++++++++++++++++++++++++++--
- 3 files changed, 82 insertions(+), 5 deletions(-)
-
-diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c
-index 494fea565c..c56ee70a0d 100644
---- a/hw/remote/vfio-user-obj.c
-+++ b/hw/remote/vfio-user-obj.c
-@@ -368,9 +368,9 @@ static int vfu_object_mr_rw(MemoryRegion *mr, uint8_t *buf, hwaddr offset,
- ram_ptr = memory_region_get_ram_ptr(mr);
-
- if (is_write) {
-- memmove((ram_ptr + offset), buf, size);
-+ qemu_ram_move((ram_ptr + offset), buf, size);
- } else {
-- memmove(buf, (ram_ptr + offset), size);
-+ qemu_ram_move(buf, (ram_ptr + offset), size);
- }
-
- return 0;
-diff --git a/include/system/memory.h b/include/system/memory.h
-index b39ec9a5d3..351cf1253c 100644
---- a/include/system/memory.h
-+++ b/include/system/memory.h
-@@ -3103,6 +3103,39 @@ void address_space_register_map_client(AddressSpace *as, QEMUBH *bh);
- void address_space_unregister_map_client(AddressSpace *as, QEMUBH *bh);
-
- /* Internal functions, part of the implementation of address_space_read. */
-+
-+/**
-+ * qemu_ram_move: move data from or to ramblock
-+ *
-+ * @dst: destination where the data is moved to
-+ * @src: source where the data is moved from
-+ * @n: length of data to be moved
-+ *
-+ * Move @n bytes from @src to @dst, the memory areas may overlap. This
-+ * provides the same semantics as memmove(), plus an additional stronger
-+ * guarantee: if @n is 1, 2 or 4 or 8 bytes, and @src and @dst are both
-+ * naturally aligned for that access size, then both the load and the store
-+ * will be done as a single atomic access (with the semantics of
-+ * qatomic_read() and qatomic_set()).
-+ *
-+ * This is the underlying function that we use to implement accesses by
-+ * a guest vCPU or a device DMA operation to a ram block. The atomic
-+ * guarantee is needed for two major cases: (A) When the ram block is
-+ * backed by a PCI BAR passed through from a host device (and so it might
-+ * be hardware registers that must be accessed exactly once at the right
-+ * width); (B) When an emulated device updates a data structure shared in
-+ * guest memory with guest software (e.g. a network device's set of tx and
-+ * rx descriptor blocks), if a write to memory is accidentally performed
-+ * multiple times then it can break the guest code when it busy polls the
-+ * guest memory.
-+ *
-+ * We don't attempt to perform the exact access when it would be unaligned
-+ * because this can't be done on all host architectures. Although this is
-+ * strictly speaking not doing what would happen on real hardware, we don't
-+ * think there are going to be situations where that matters in practice.
-+ */
-+void qemu_ram_move(void *dst, const void *src, size_t n);
-+
- MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
- MemTxAttrs attrs, void *buf, hwaddr len);
- MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
-@@ -3184,7 +3217,7 @@ MemTxResult address_space_read(AddressSpace *as, hwaddr addr,
- mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
- if (len == l && memory_access_is_direct(mr, false, attrs)) {
- ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
-- memmove(buf, ptr, len);
-+ qemu_ram_move(buf, ptr, len);
- } else {
- result = flatview_read_continue(fv, addr, attrs, buf, len,
- addr1, l, mr);
-diff --git a/system/physmem.c b/system/physmem.c
-index 697e75dad7..d88349616e 100644
---- a/system/physmem.c
-+++ b/system/physmem.c
-@@ -2869,6 +2869,50 @@ void memory_region_flush_rom_device(MemoryRegion *mr, hwaddr addr, hwaddr size)
- invalidate_and_set_dirty(mr, addr, size);
- }
-
-+void qemu_ram_move(void *dst, const void *src, size_t n)
-+{
-+ uintptr_t test, len;
-+
-+ if (n == 0) {
-+ return;
-+ }
-+
-+ /*
-+ * Calculate "the lowest set bit" over @src, @dst and @n, result put
-+ * into @len (which guarantees a power-of-two). With that and the
-+ * later check (len!=n), it makes sure that we will only do the atomic
-+ * ops when:
-+ *
-+ * (1) @n is a power-of-two
-+ * (2) @src and @dst addresses are both aligned to @n
-+ */
-+ test = (uintptr_t)src | (uintptr_t)dst | n;
-+ len = test & -test;
-+
-+ /* Overlapping buffers, unaligned or oversized access */
-+ if (n > 8 || len != n) {
-+ memmove(dst, src, n);
-+ return;
-+ }
-+
-+ switch (len) {
-+ case 1:
-+ qatomic_set((uint8_t *)dst, qatomic_read((uint8_t *)src));
-+ break;
-+ case 2:
-+ qatomic_set((uint16_t *)dst, qatomic_read((uint16_t *)src));
-+ break;
-+ case 4:
-+ qatomic_set((uint32_t *)dst, qatomic_read((uint32_t *)src));
-+ break;
-+ case 8:
-+ qatomic_set((uint64_t *)dst, qatomic_read((uint64_t *)src));
-+ break;
-+ default:
-+ g_assert_not_reached();
-+ }
-+}
-+
- int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr)
- {
- unsigned access_size_max = mr->ops->valid.max_access_size;
-@@ -2981,7 +3025,7 @@ static MemTxResult flatview_write_continue_step(MemTxAttrs attrs,
- uint8_t *ram_ptr = qemu_ram_ptr_length(mr->ram_block, mr_addr, l,
- false, true);
-
-- memmove(ram_ptr, buf, *l);
-+ qemu_ram_move(ram_ptr, buf, *l);
- invalidate_and_set_dirty(mr, mr_addr, *l);
-
- return MEMTX_OK;
-@@ -3074,7 +3118,7 @@ static MemTxResult flatview_read_continue_step(MemTxAttrs attrs, uint8_t *buf,
- uint8_t *ram_ptr = qemu_ram_ptr_length(mr->ram_block, mr_addr, l,
- false, false);
-
-- memmove(buf, ram_ptr, *l);
-+ qemu_ram_move(buf, ram_ptr, *l);
-
- return MEMTX_OK;
- }
---
-2.52.0
-
diff --git a/kvm-system-physmem-Remove-cpu_physical_memory_is_io.patch b/kvm-system-physmem-Remove-cpu_physical_memory_is_io.patch
deleted file mode 100644
index 71cdc69..0000000
--- a/kvm-system-physmem-Remove-cpu_physical_memory_is_io.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 5f3ad40eb9fabb58c7c6986ae42e814d54017db9 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
-Date: Mon, 29 Sep 2025 15:36:08 +0200
-Subject: [PATCH 049/111] system/physmem: Remove cpu_physical_memory_is_io()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [49/111] b20b8a1e8804c7105f541ad220967fd205d45322 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73796
-
-There are no more uses of the legacy cpu_physical_memory_is_io()
-method. Remove it.
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-Message-Id: <20251002084203.63899-6-philmd@linaro.org>
-(cherry picked from commit ec1eb357cb86eee74d63940154db1e1bfa86026a)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- include/exec/cpu-common.h | 2 --
- system/physmem.c | 5 -----
- 2 files changed, 7 deletions(-)
-
-diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
-index 9b658a3f48..7ac061bfcb 100644
---- a/include/exec/cpu-common.h
-+++ b/include/exec/cpu-common.h
-@@ -149,8 +149,6 @@ void *cpu_physical_memory_map(hwaddr addr,
- void cpu_physical_memory_unmap(void *buffer, hwaddr len,
- bool is_write, hwaddr access_len);
-
--bool cpu_physical_memory_is_io(hwaddr phys_addr);
--
- /* Coalesced MMIO regions are areas where write operations can be reordered.
- * This usually implies that write operations are side-effect free. This allows
- * batching which can make a major impact on performance when using
-diff --git a/system/physmem.c b/system/physmem.c
-index 2e34205ad7..4a1294f8a0 100644
---- a/system/physmem.c
-+++ b/system/physmem.c
-@@ -3781,11 +3781,6 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
- return 0;
- }
-
--bool cpu_physical_memory_is_io(hwaddr phys_addr)
--{
-- return address_space_is_io(&address_space_memory, phys_addr);
--}
--
- int qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque)
- {
- RAMBlock *block;
---
-2.52.0
-
diff --git a/kvm-target-arm-Convert-init_cpreg_list-to-g_hash_table_f.patch b/kvm-target-arm-Convert-init_cpreg_list-to-g_hash_table_f.patch
deleted file mode 100644
index 67f3de6..0000000
--- a/kvm-target-arm-Convert-init_cpreg_list-to-g_hash_table_f.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-From 886d2d31fbfb8263e73cd4e96d79cd1c059d6b8c Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Mon, 11 May 2026 12:06:39 -0400
-Subject: [PATCH 003/116] target/arm: Convert init_cpreg_list to
- g_hash_table_foreach
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [3/16] 704e757f243d944ee544496d50b7ead4a1e2e681 (eauger1/centos-qemu-kvm)
-
-Adjust count_cpreg and add_cpreg_to_list to be used with
-g_hash_table_foreach instead of g_list_foreach. In this way we have
-the ARMCPRegInfo pointer directly rather than having to look it up
-from the key.
-
-Delay the sorting of the cpreg_indexes until after add_cpreg_to_list.
-This allows us to sort the data that we actually care about,
-the kvm id, as computed within add_cpreg_to_list, instead of
-having to repeatedly compute the kvm id within cpreg_key_compare.
-
-Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit dee3c0c2cf9848cd849744474cdac108ce68a1ef)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/helper.c | 54 ++++++++++++++++++---------------------------
- 1 file changed, 21 insertions(+), 33 deletions(-)
-
-diff --git a/target/arm/helper.c b/target/arm/helper.c
-index d230f9e766..1cff4c5a68 100644
---- a/target/arm/helper.c
-+++ b/target/arm/helper.c
-@@ -209,11 +209,11 @@ bool write_list_to_cpustate(ARMCPU *cpu)
- return ok;
- }
-
--static void add_cpreg_to_list(gpointer key, gpointer opaque)
-+static void add_cpreg_to_list(gpointer key, gpointer value, gpointer opaque)
- {
- ARMCPU *cpu = opaque;
- uint32_t regidx = (uintptr_t)key;
-- const ARMCPRegInfo *ri = get_arm_cp_reginfo(cpu->cp_regs, regidx);
-+ const ARMCPRegInfo *ri = value;
-
- if (!(ri->type & (ARM_CP_NO_RAW | ARM_CP_ALIAS))) {
- cpu->cpreg_indexes[cpu->cpreg_array_len] = cpreg_to_kvm_id(regidx);
-@@ -222,61 +222,49 @@ static void add_cpreg_to_list(gpointer key, gpointer opaque)
- }
- }
-
--static void count_cpreg(gpointer key, gpointer opaque)
-+static void count_cpreg(gpointer key, gpointer value, gpointer opaque)
- {
- ARMCPU *cpu = opaque;
-- const ARMCPRegInfo *ri;
--
-- ri = g_hash_table_lookup(cpu->cp_regs, key);
-+ const ARMCPRegInfo *ri = value;
-
- if (!(ri->type & (ARM_CP_NO_RAW | ARM_CP_ALIAS))) {
- cpu->cpreg_array_len++;
- }
- }
-
--static gint cpreg_key_compare(gconstpointer a, gconstpointer b, gpointer d)
--{
-- uint64_t aidx = cpreg_to_kvm_id((uintptr_t)a);
-- uint64_t bidx = cpreg_to_kvm_id((uintptr_t)b);
--
-- if (aidx > bidx) {
-- return 1;
-- }
-- if (aidx < bidx) {
-- return -1;
-- }
-- return 0;
--}
--
- void init_cpreg_list(ARMCPU *cpu)
- {
- /*
- * Initialise the cpreg_tuples[] array based on the cp_regs hash.
- * Note that we require cpreg_tuples[] to be sorted by key ID.
- */
-- GList *keys;
- int arraylen;
-
-- keys = g_hash_table_get_keys(cpu->cp_regs);
-- keys = g_list_sort_with_data(keys, cpreg_key_compare, NULL);
--
- cpu->cpreg_array_len = 0;
--
-- g_list_foreach(keys, count_cpreg, cpu);
-+ g_hash_table_foreach(cpu->cp_regs, count_cpreg, cpu);
-
- arraylen = cpu->cpreg_array_len;
-- cpu->cpreg_indexes = g_new(uint64_t, arraylen);
-- cpu->cpreg_values = g_new(uint64_t, arraylen);
-- cpu->cpreg_vmstate_indexes = g_new(uint64_t, arraylen);
-- cpu->cpreg_vmstate_values = g_new(uint64_t, arraylen);
-- cpu->cpreg_vmstate_array_len = cpu->cpreg_array_len;
-+ if (arraylen) {
-+ cpu->cpreg_indexes = g_new(uint64_t, arraylen);
-+ cpu->cpreg_values = g_new(uint64_t, arraylen);
-+ cpu->cpreg_vmstate_indexes = g_new(uint64_t, arraylen);
-+ cpu->cpreg_vmstate_values = g_new(uint64_t, arraylen);
-+ } else {
-+ cpu->cpreg_indexes = NULL;
-+ cpu->cpreg_values = NULL;
-+ cpu->cpreg_vmstate_indexes = NULL;
-+ cpu->cpreg_vmstate_values = NULL;
-+ }
-+ cpu->cpreg_vmstate_array_len = arraylen;
- cpu->cpreg_array_len = 0;
-
-- g_list_foreach(keys, add_cpreg_to_list, cpu);
-+ g_hash_table_foreach(cpu->cp_regs, add_cpreg_to_list, cpu);
-
- assert(cpu->cpreg_array_len == arraylen);
-
-- g_list_free(keys);
-+ if (arraylen) {
-+ qsort(cpu->cpreg_indexes, arraylen, sizeof(uint64_t), compare_u64);
-+ }
- }
-
- bool arm_pan_enabled(CPUARMState *env)
---
-2.52.0
-
diff --git a/kvm-target-arm-Move-compare_u64-to-helper.c.patch b/kvm-target-arm-Move-compare_u64-to-helper.c.patch
deleted file mode 100644
index 9d7fb64..0000000
--- a/kvm-target-arm-Move-compare_u64-to-helper.c.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From 705cbaf080e8fba8bdf6a5031d4e437c9d7b9bfe Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Mon, 11 May 2026 12:06:24 -0400
-Subject: [PATCH 002/116] target/arm: Move compare_u64 to helper.c
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [2/16] 497fedf076c0f7945bbe584efc060d7238c50837 (eauger1/centos-qemu-kvm)
-
-We will use this function beyond kvm.c.
-
-Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
-Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 5a8af95cb31122d2fcd2e6d3427b8e8427cd8bdc)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/helper.c | 11 +++++++++++
- target/arm/internals.h | 3 +++
- target/arm/kvm.c | 11 -----------
- 3 files changed, 14 insertions(+), 11 deletions(-)
-
-diff --git a/target/arm/helper.c b/target/arm/helper.c
-index 0c1299ff84..d230f9e766 100644
---- a/target/arm/helper.c
-+++ b/target/arm/helper.c
-@@ -40,6 +40,17 @@
-
- static void switch_mode(CPUARMState *env, int mode);
-
-+int compare_u64(const void *a, const void *b)
-+{
-+ if (*(uint64_t *)a > *(uint64_t *)b) {
-+ return 1;
-+ }
-+ if (*(uint64_t *)a < *(uint64_t *)b) {
-+ return -1;
-+ }
-+ return 0;
-+}
-+
- uint64_t raw_read(CPUARMState *env, const ARMCPRegInfo *ri)
- {
- assert(ri->fieldoffset);
-diff --git a/target/arm/internals.h b/target/arm/internals.h
-index 1b3d0244fd..08e2acdb99 100644
---- a/target/arm/internals.h
-+++ b/target/arm/internals.h
-@@ -1981,4 +1981,7 @@ void vfp_clear_float_status_exc_flags(CPUARMState *env);
- void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask);
- bool arm_pan_enabled(CPUARMState *env);
-
-+/* Compare uint64_t for qsort and bsearch. */
-+int compare_u64(const void *a, const void *b);
-+
- #endif
-diff --git a/target/arm/kvm.c b/target/arm/kvm.c
-index c1ec6654ca..5a75ff5927 100644
---- a/target/arm/kvm.c
-+++ b/target/arm/kvm.c
-@@ -718,17 +718,6 @@ void kvm_arm_register_device(MemoryRegion *mr, uint64_t devid, uint64_t group,
- memory_region_ref(kd->mr);
- }
-
--static int compare_u64(const void *a, const void *b)
--{
-- if (*(uint64_t *)a > *(uint64_t *)b) {
-- return 1;
-- }
-- if (*(uint64_t *)a < *(uint64_t *)b) {
-- return -1;
-- }
-- return 0;
--}
--
- /*
- * cpreg_values are sorted in ascending order by KVM register ID
- * (see kvm_arm_init_cpreg_list). This allows us to cheaply find
---
-2.52.0
-
diff --git a/kvm-target-arm-cpu-Introduce-the-infrastructure-for-cpre.patch b/kvm-target-arm-cpu-Introduce-the-infrastructure-for-cpre.patch
deleted file mode 100644
index abe6bd7..0000000
--- a/kvm-target-arm-cpu-Introduce-the-infrastructure-for-cpre.patch
+++ /dev/null
@@ -1,244 +0,0 @@
-From 514f36e4f3411c5dc96c7f742f543d166eede410 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Mon, 20 Apr 2026 16:03:51 +0200
-Subject: [PATCH 010/116] target/arm/cpu: Introduce the infrastructure for
- cpreg migration tolerances
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [10/16] 71bbf8b6df2c02de6349343040f7edb827161f4c (eauger1/centos-qemu-kvm)
-
-Conflicts: contextual conflict in target/arm/internals.h as we don't
-have #define MECID_WIDTH 16 introduced by commit
-700f08d5829f ("target/arm: Implement FEAT_MEC registers")
-
-We introduce a datatype for a tolerance with respect to a given
-cpreg migration issue. The tolerance applies to a given cpreg kvm index,
-and can be of different types:
-a) mismatch in cpreg indexes
-- ToleranceNotOnBothEnds (cpreg index is allowed to be only present
- on one end)
-- ToleranceOnlySrcTestValue (cpreg index is allowed to be only
- present in source if its value @mask field matches @value)
-b) mismatch in cpreg values
-- ToleranceDiffInMask (value differences are allowed only within a mask)
-- ToleranceFieldLT (incoming field value must be less than a given value)
-- ToleranceFieldGT (incoming field value must be greater than a given value)
-
-A QLIST of such tolerances can be populated using a new helper:
-arm_register_cpreg_mig_tolerance() and arm_cpu_match_cpreg_mig_tolerance()
-allows to check whether a tolerance exists for a given kvm index and its
-criterion is matched.
-
-callers for those helpers will be introduced in subsequent patches.
-
-Only registration of migration tolerances related to cpreg index
-mismatch is currently allowed.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260420140552.104369-2-eric.auger@redhat.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit bb36be6fd799c4fdb2ac893cfab7f307c12527f2)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/cpu.c | 82 ++++++++++++++++++++++++++++++++++++++++++
- target/arm/cpu.h | 1 +
- target/arm/internals.h | 53 +++++++++++++++++++++++++++
- 3 files changed, 136 insertions(+)
-
-diff --git a/target/arm/cpu.c b/target/arm/cpu.c
-index e2b2337399..9f7938d8fa 100644
---- a/target/arm/cpu.c
-+++ b/target/arm/cpu.c
-@@ -172,6 +172,82 @@ void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook,
- QLIST_INSERT_HEAD(&cpu->el_change_hooks, entry, node);
- }
-
-+static ARMCPRegMigTolerance *find_mig_tolerance(ARMCPU *cpu, uint64_t kvmidx)
-+{
-+ ARMCPRegMigTolerance *t;
-+ QLIST_FOREACH(t, &cpu->cpreg_mig_tolerances, node) {
-+ if (t->kvmidx == kvmidx) {
-+ return t;
-+ }
-+ }
-+ return NULL;
-+}
-+
-+void arm_register_cpreg_mig_tolerance(ARMCPU *cpu, uint64_t kvmidx,
-+ uint64_t mask, uint64_t value,
-+ ARMCPRegMigToleranceType type)
-+{
-+ ARMCPRegMigTolerance *entry;
-+
-+ /* make sure the kvmidx has not tolerance already registered */
-+ assert(!find_mig_tolerance(cpu, kvmidx));
-+
-+ assert(type == ToleranceNotOnBothEnds ||
-+ type == ToleranceOnlySrcTestValue);
-+
-+ entry = g_new0(ARMCPRegMigTolerance, 1);
-+
-+ entry->kvmidx = kvmidx;
-+ entry->mask = mask;
-+ entry->value = value;
-+ entry->type = type;
-+
-+ QLIST_INSERT_HEAD(&cpu->cpreg_mig_tolerances, entry, node);
-+}
-+
-+bool arm_cpu_match_cpreg_mig_tolerance(ARMCPU *cpu, uint64_t kvmidx,
-+ uint64_t vmstate_value, uint64_t local_value,
-+ ARMCPRegMigToleranceType type)
-+{
-+ ARMCPRegMigTolerance *t = find_mig_tolerance(cpu, kvmidx);
-+ uint64_t diff, diff_outside_mask, field;
-+
-+ if (!t || t->type != type) {
-+ return false;
-+ }
-+
-+ if (type == ToleranceNotOnBothEnds) {
-+ return true;
-+ }
-+
-+ if (type == ToleranceOnlySrcTestValue &&
-+ ((vmstate_value & t->mask) == t->value)) {
-+ return true;
-+ }
-+
-+ /* Need to check the mask */
-+ diff = vmstate_value ^ local_value;
-+ diff_outside_mask = diff & ~t->mask;
-+
-+ if (diff_outside_mask) {
-+ /* there are differences outside of the mask */
-+ return false;
-+ }
-+ if (type == ToleranceDiffInMask) {
-+ /* differences only in the field, tolerance matched */
-+ return true;
-+ }
-+ /* need to compare field value against authorized ones */
-+ field = vmstate_value & t->mask;
-+ if (type == ToleranceFieldLT && (field < t->value)) {
-+ return true;
-+ }
-+ if (type == ToleranceFieldGT && (field > t->value)) {
-+ return true;
-+ }
-+ return false;
-+}
-+
- static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque)
- {
- /* Reset a single ARMCPRegInfo register */
-@@ -1455,6 +1531,7 @@ static void arm_cpu_initfn(Object *obj)
-
- QLIST_INIT(&cpu->pre_el_change_hooks);
- QLIST_INIT(&cpu->el_change_hooks);
-+ QLIST_INIT(&cpu->cpreg_mig_tolerances);
-
- #ifdef CONFIG_USER_ONLY
- # ifdef TARGET_AARCH64
-@@ -1895,6 +1972,7 @@ static void arm_cpu_finalizefn(Object *obj)
- {
- ARMCPU *cpu = ARM_CPU(obj);
- ARMELChangeHook *hook, *next;
-+ ARMCPRegMigTolerance *t, *n;
-
- g_hash_table_destroy(cpu->cp_regs);
-
-@@ -1906,6 +1984,10 @@ static void arm_cpu_finalizefn(Object *obj)
- QLIST_REMOVE(hook, node);
- g_free(hook);
- }
-+ QLIST_FOREACH_SAFE(t, &cpu->cpreg_mig_tolerances, node, n) {
-+ QLIST_REMOVE(t, node);
-+ g_free(t);
-+ }
- #ifndef CONFIG_USER_ONLY
- if (cpu->pmu_timer) {
- timer_free(cpu->pmu_timer);
-diff --git a/target/arm/cpu.h b/target/arm/cpu.h
-index dc0da8b0ae..e5dbc5a3f9 100644
---- a/target/arm/cpu.h
-+++ b/target/arm/cpu.h
-@@ -1126,6 +1126,7 @@ struct ArchCPU {
-
- QLIST_HEAD(, ARMELChangeHook) pre_el_change_hooks;
- QLIST_HEAD(, ARMELChangeHook) el_change_hooks;
-+ QLIST_HEAD(, ARMCPRegMigTolerance) cpreg_mig_tolerances;
-
- int32_t node_id; /* NUMA node this CPU belongs to */
-
-diff --git a/target/arm/internals.h b/target/arm/internals.h
-index 08e2acdb99..b8444aa8ab 100644
---- a/target/arm/internals.h
-+++ b/target/arm/internals.h
-@@ -1984,4 +1984,57 @@ bool arm_pan_enabled(CPUARMState *env);
- /* Compare uint64_t for qsort and bsearch. */
- int compare_u64(const void *a, const void *b);
-
-+typedef enum {
-+ ToleranceNotOnBothEnds,
-+ ToleranceOnlySrcTestValue,
-+ ToleranceDiffInMask,
-+ ToleranceFieldLT,
-+ ToleranceFieldGT,
-+} ARMCPRegMigToleranceType;
-+
-+typedef struct ARMCPRegMigTolerance {
-+ uint64_t kvmidx;
-+ uint64_t mask;
-+ uint64_t value;
-+ ARMCPRegMigToleranceType type;
-+ QLIST_ENTRY(ARMCPRegMigTolerance) node;
-+} ARMCPRegMigTolerance;
-+
-+/**
-+ * arm_register_cpreg_mig_tolerance:
-+ * Register a migration tolerance wrt one given cpreg identified by its
-+ * @kvmidx. Calling this function twice for the same @kvmidx is a
-+ * programming error and will cause an assertion failure.
-+ *
-+ * @cpu: vcpu to apply the migration tolerance on
-+ * @kvmidx: kvm index of the cpreg the tolerance applies to
-+ * @mask: bitmask where a difference is tolerated
-+ * (relevant with ToleranceDiffInMask)
-+ * @value: value the bitmask field is compared with
-+ * (relevant with ToleranceFieldLT and ToleranceFieldGT)
-+ * @type: type of the migration tolerance:
-+ * - ToleranceNotOnBothEnds (cpreg index is allowed to be only present
-+ * on one end)
-+ * - ToleranceOnlySrcTestValue (cpreg index is allowed to be only
-+ * present in source if its value @mask field matches @value)
-+ * - ToleranceDiffInMask (mismatch in cpreg values are only tolerated
-+ * if differences are within @mask)
-+ * - ToleranceFieldLT (mismatch in cpreg values are only tolerated
-+ * if incoming @bitmask field value is less than @value)
-+ * - ToleranceFieldGT (mismatch in cpreg values are only tolerated
-+ * if incoming @bitmask field value is greater than @value)
-+ */
-+void arm_register_cpreg_mig_tolerance(ARMCPU *cpu, uint64_t kvmidx,
-+ uint64_t mask, uint64_t value,
-+ ARMCPRegMigToleranceType type);
-+
-+/**
-+ * arm_cpu_match_cpreg_mig_tolerance:
-+ * Check whether a tolerance of type @type exists for a given @kvmidx
-+ * and the tolerance criterion is satisfied
-+ */
-+bool arm_cpu_match_cpreg_mig_tolerance(ARMCPU *cpu, uint64_t kvmidx,
-+ uint64_t vmstate_value, uint64_t local_value,
-+ ARMCPRegMigToleranceType type);
-+
- #endif
---
-2.52.0
-
diff --git a/kvm-target-arm-cpu64-Define-cpreg-migration-tolerance-fo.patch b/kvm-target-arm-cpu64-Define-cpreg-migration-tolerance-fo.patch
deleted file mode 100644
index fe69b27..0000000
--- a/kvm-target-arm-cpu64-Define-cpreg-migration-tolerance-fo.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From 6d01750d568320adda3e79e30f881bd02890890a Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Mon, 20 Apr 2026 16:03:55 +0200
-Subject: [PATCH 014/116] target/arm/cpu64: Define cpreg migration tolerance
- for KVM_REG_ARM_VENDOR_HYP_BMAP_2
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [14/16] 2289633dd2eadbde2e57a19da4259fa7c7c00013 (eauger1/centos-qemu-kvm)
-
-KVM_REG_ARM_VENDOR_HYP_BMAP_2 pseudo FW register is exposed
-from v6.15 onwards. Backward migration from a >= v6.15 to an older
-kernel would fail without cpreg migration tolerance definition
-for this register. If the register is present on source but not
-on destination, its value must be checked to make sure it matches
-the reset value, ie. 0, meaning no service is exposed to the guest,
-hence the choice of a ToleranceOnlySrcTestValue migration
-tolerance.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Message-id: 20260420140552.104369-6-eric.auger@redhat.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 6dd8be31f8fbbeba65a80b1e96c7331886c6f6d5)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/cpu64.c | 11 +++++++++++
- 1 file changed, 11 insertions(+)
-
-diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
-index 820d2542fa..98d9f34550 100644
---- a/target/arm/cpu64.c
-+++ b/target/arm/cpu64.c
-@@ -786,6 +786,17 @@ static void kvm_arm_set_cpreg_mig_tolerances(ARMCPU *cpu)
- 0, 0, ToleranceNotOnBothEnds);
- arm_register_cpreg_mig_tolerance(cpu, ARM64_SYS_REG(3, 0, 10, 2, 3),
- 0, 0, ToleranceNotOnBothEnds);
-+
-+ /*
-+ * KVM_REG_ARM_VENDOR_HYP_BMAP_2 pseudo FW register is exposed
-+ * from v6.15 onwards. Backward migration from a >= v6.15 to an older
-+ * kernel would fail without cpreg migration tolerance definition.
-+ * If the register is present on source but not on destination, make
-+ * sure it has its reset value, ie. 0, meaning no service is exposed
-+ * to the guest.
-+ */
-+ arm_register_cpreg_mig_tolerance(cpu, KVM_REG_ARM_FW_FEAT_BMAP_REG(3),
-+ UINT64_MAX, 0, ToleranceOnlySrcTestValue);
- }
- #endif
-
---
-2.52.0
-
diff --git a/kvm-target-arm-cpu64-Mitigate-migration-failures-due-to-.patch b/kvm-target-arm-cpu64-Mitigate-migration-failures-due-to-.patch
deleted file mode 100644
index 033bb78..0000000
--- a/kvm-target-arm-cpu64-Mitigate-migration-failures-due-to-.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From 18c38804ca688494c3969f125dff09013608e673 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Mon, 20 Apr 2026 16:03:54 +0200
-Subject: [PATCH 013/116] target/arm/cpu64: Mitigate migration failures due to
- spurious TCR_EL1, PIRE0_EL1 and PIR_EL1
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [13/16] 90857210d7a915351c637756650071ff44f8d378 (eauger1/centos-qemu-kvm)
-
-Conflicts: contextual conflict in target/arm/cpu64.c as cpu local
-variable is declared in the #if defined(CONFIG_KVM) and not at the top
-
-Before linux v6.13 those registers were erroneously unconditionally
-exposed and this was fixed by commits:
-- 0fcb4eea5345 ("KVM: arm64: Hide TCR2_EL1 from userspace when
- disabled for guests")
-- a68cddbe47ef ("KVM: arm64: Hide S1PIE registers from userspace
- when disabled for guests")
-in v6.13.
-
-This means if we migrate from an old kernel host to a >= 6.13 kernel
-host, migration currently fails.
-
-Declare cpreg migration tolerance for those registers.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Sebastian Ott <sebott@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Message-id: 20260420140552.104369-5-eric.auger@redhat.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 113ed8e53c08a46af2d3307ece846caf5a719f99)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/cpu64.c | 29 +++++++++++++++++++++++++++++
- 1 file changed, 29 insertions(+)
-
-diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
-index 051d5d653b..820d2542fa 100644
---- a/target/arm/cpu64.c
-+++ b/target/arm/cpu64.c
-@@ -762,10 +762,39 @@ static void aarch64_a53_initfn(Object *obj)
- }
- #endif
-
-+#if defined(CONFIG_KVM)
-+static void kvm_arm_set_cpreg_mig_tolerances(ARMCPU *cpu)
-+{
-+ /*
-+ * Registers that may be in the incoming stream and not exposed
-+ * on the destination
-+ */
-+
-+ /*
-+ * TCR_EL1 was erroneously unconditionnally exposed before linux v6.13.
-+ * See commit 0fcb4eea5345 ("KVM: arm64: Hide TCR2_EL1 from userspace
-+ * when disabled for guests")
-+ */
-+ arm_register_cpreg_mig_tolerance(cpu, ARM64_SYS_REG(3, 0, 2, 0, 3),
-+ 0, 0, ToleranceNotOnBothEnds);
-+ /*
-+ * PIRE0_EL1 and PIR_EL1 were erroneously unconditionnally exposed
-+ * before linux v6.13. See commit a68cddbe47ef ("KVM: arm64: Hide
-+ * S1PIE registers from userspace when disabled for guests")
-+ */
-+ arm_register_cpreg_mig_tolerance(cpu, ARM64_SYS_REG(3, 0, 10, 2, 2),
-+ 0, 0, ToleranceNotOnBothEnds);
-+ arm_register_cpreg_mig_tolerance(cpu, ARM64_SYS_REG(3, 0, 10, 2, 3),
-+ 0, 0, ToleranceNotOnBothEnds);
-+}
-+#endif
-+
- static void aarch64_host_initfn(Object *obj)
- {
- #if defined(CONFIG_KVM)
- ARMCPU *cpu = ARM_CPU(obj);
-+
-+ kvm_arm_set_cpreg_mig_tolerances(cpu);
- kvm_arm_set_cpu_features_from_host(cpu);
- if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
- aarch64_add_sve_properties(obj);
---
-2.52.0
-
diff --git a/kvm-target-arm-helper-Define-cpreg-migration-tolerance-f.patch b/kvm-target-arm-helper-Define-cpreg-migration-tolerance-f.patch
deleted file mode 100644
index b5a0d42..0000000
--- a/kvm-target-arm-helper-Define-cpreg-migration-tolerance-f.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 5c1ee6b3f760a68ec2545c157e72221e7452901c Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Mon, 20 Apr 2026 16:03:56 +0200
-Subject: [PATCH 015/116] target/arm/helper: Define cpreg migration tolerance
- for DGBDTR_EL0
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [15/16] 4c159a6da8530899c605c9aa81c99a06be2f0819 (eauger1/centos-qemu-kvm)
-
-We want to remove AArch32 DBGDTRTX which was erroneously exposed.
-This was attempted by 655659a74a36b ("target/arm: Correct encoding
-of Debug Communications Channel registers") but it was discovered
-that the removal of this debug register broke forward migration on
-TCG. Now we have the cpreg migration tolerance infrastructure, we
-can declare one for the DBGDTRTX. This allow to revert the reinstate
-patch.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Sebastian Ott <sebott@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Message-id: 20260420140552.104369-7-eric.auger@redhat.com
-[PMM: revised comment, included note about when we can drop
- the workaround]
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 234b3eaddd4ff08b8b62d563742e37f7bb6486bd)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/helper.c | 23 +++++++++++++++++++++++
- 1 file changed, 23 insertions(+)
-
-diff --git a/target/arm/helper.c b/target/arm/helper.c
-index 5e643ed6b2..0deb2bd760 100644
---- a/target/arm/helper.c
-+++ b/target/arm/helper.c
-@@ -6129,9 +6129,32 @@ void register_cp_regs_for_features(ARMCPU *cpu)
- .fgt = FGT_CLIDR_EL1,
- .resetvalue = GET_IDREG(isar, CLIDR)
- };
-+ uint64_t dbgtr_el0_kvmidx =
-+ cpreg_to_kvm_id(ENCODE_CP_REG(14, 0, 1, 0, 5, 3, 0));
-+
- define_one_arm_cp_reg(cpu, &clidr);
- define_arm_cp_regs(cpu, v7_cp_reginfo);
- define_debug_regs(cpu);
-+ /*
-+ * We used to incorrectly expose a non-existent AArch32 "DBGDTRTX"
-+ * register with this encoding. This has been fixed by commit
-+ * 655659a74a36 ("target/arm: Correct encoding of Debug
-+ * Communications Channel registers") by the introduction of correct
-+ * separate cpreg definitions for AA64 and AA32 versions. However,
-+ * the old cpreg definition couldn't be removed without breaking
-+ * migration, so commit 4f2b82f604 reinstated the bogus encoding
-+ * for migration data only.
-+ *
-+ * Now that we have migration tolerance infrastructure, we can use
-+ * this to allow forward migration from the buggy QEMU versions,
-+ * accepting and ignoring the bogus register if it is in the
-+ * source data. QEMU 11.0 was the last version that sent the
-+ * bogus encoding, so this workaround can be removed at the point
-+ * where we no longer care about migration from that version
-+ * (i.e. when we remove the "virt-11.0" machine type).
-+ */
-+ arm_register_cpreg_mig_tolerance(cpu, dbgtr_el0_kvmidx,
-+ 0, 0, ToleranceNotOnBothEnds);
- } else {
- define_arm_cp_regs(cpu, not_v7_cp_reginfo);
- }
---
-2.52.0
-
diff --git a/kvm-target-arm-kvm-Export-kvm_print_register_name.patch b/kvm-target-arm-kvm-Export-kvm_print_register_name.patch
deleted file mode 100644
index 3609a41..0000000
--- a/kvm-target-arm-kvm-Export-kvm_print_register_name.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From 9b51393c6b6e5759755d78f1cf1e97c174af3d1a Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Fri, 6 Mar 2026 09:01:12 +0000
-Subject: [PATCH 005/116] target/arm/kvm: Export kvm_print_register_name()
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [5/16] 66bc6985b3162adca02cac4efbbb86f5e973ed7f (eauger1/centos-qemu-kvm)
-
-Conflicts: contextual conflicts in target/arm/kvm-stub.c
-and target/arm/kvm_arm.h since we don't have arm_gic_cap_kvm_probe()
-downstream
-
-We want to use kvm_print_register_name() in machine.c so
-let's export the helper and implement a stub when kvm
-is not enabled.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Message-id: 20260304101625.1962633-4-eric.auger@redhat.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 5ae081fb493510f62280afc005aa36f702192539)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/kvm-stub.c | 5 +++++
- target/arm/kvm.c | 2 +-
- target/arm/kvm_arm.h | 9 +++++++++
- 3 files changed, 15 insertions(+), 1 deletion(-)
-
-diff --git a/target/arm/kvm-stub.c b/target/arm/kvm-stub.c
-index c93462c5b9..58b37e0dfe 100644
---- a/target/arm/kvm-stub.c
-+++ b/target/arm/kvm-stub.c
-@@ -124,3 +124,8 @@ bool kvm_arm_cpu_post_load(ARMCPU *cpu)
- {
- g_assert_not_reached();
- }
-+
-+char *kvm_print_register_name(uint64_t regidx)
-+{
-+ g_assert_not_reached();
-+}
-diff --git a/target/arm/kvm.c b/target/arm/kvm.c
-index 5dacb304bd..283d634ca1 100644
---- a/target/arm/kvm.c
-+++ b/target/arm/kvm.c
-@@ -911,7 +911,7 @@ static gchar *kvm_print_sve_register_name(uint64_t regidx)
- }
- }
-
--static gchar *kvm_print_register_name(uint64_t regidx)
-+char *kvm_print_register_name(uint64_t regidx)
- {
- switch ((regidx & KVM_REG_ARM_COPROC_MASK)) {
- case KVM_REG_ARM_CORE:
-diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
-index 6a9b6374a6..c4e7dc28ef 100644
---- a/target/arm/kvm_arm.h
-+++ b/target/arm/kvm_arm.h
-@@ -263,4 +263,13 @@ void kvm_arm_enable_mte(Object *cpuobj, Error **errp);
-
- void arm_cpu_kvm_set_irq(void *arm_cpu, int irq, int level);
-
-+/*
-+ * kvm_print_register_name:
-+ * @regidx: register KVM index
-+ *
-+ * Returns a human-readable string representing this register
-+ * The caller must free the string with g_free().
-+ */
-+char *kvm_print_register_name(uint64_t regidx);
-+
- #endif
---
-2.52.0
-
diff --git a/kvm-target-arm-kvm-Tweak-print_register_name-for-arm64-s.patch b/kvm-target-arm-kvm-Tweak-print_register_name-for-arm64-s.patch
deleted file mode 100644
index eeafbce..0000000
--- a/kvm-target-arm-kvm-Tweak-print_register_name-for-arm64-s.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From efcd88369bb1402aaf8b1084666ab6182717740f Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Fri, 6 Mar 2026 09:01:12 +0000
-Subject: [PATCH 006/116] target/arm/kvm: Tweak print_register_name() for arm64
- system register
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [6/16] e434272a6ecab513d6bc8c4811cd8e1463cdbfad (eauger1/centos-qemu-kvm)
-
-As opposed to other register types, arm64 system register decoding
-is not introduced by any 'register' mention which can lead to
-unfriendly user-facing traces. Let's add "system register"
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Message-id: 20260304101625.1962633-5-eric.auger@redhat.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 3e0a3a8e91efabef01dad8ea1cd1f13dcc46b14d)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/kvm.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/target/arm/kvm.c b/target/arm/kvm.c
-index 283d634ca1..ccf0fc501a 100644
---- a/target/arm/kvm.c
-+++ b/target/arm/kvm.c
-@@ -919,7 +919,7 @@ char *kvm_print_register_name(uint64_t regidx)
- case KVM_REG_ARM_DEMUX:
- return g_strdup_printf("demuxed reg %"PRIx64, regidx);
- case KVM_REG_ARM64_SYSREG:
-- return g_strdup_printf("op0:%d op1:%d crn:%d crm:%d op2:%d",
-+ return g_strdup_printf("system register op0:%d op1:%d crn:%d crm:%d op2:%d",
- CP_REG_ARM64_SYSREG_OP(regidx, OP0),
- CP_REG_ARM64_SYSREG_OP(regidx, OP1),
- CP_REG_ARM64_SYSREG_OP(regidx, CRN),
---
-2.52.0
-
diff --git a/kvm-target-arm-machine-Fix-detection-of-unknown-incoming.patch b/kvm-target-arm-machine-Fix-detection-of-unknown-incoming.patch
deleted file mode 100644
index 1906758..0000000
--- a/kvm-target-arm-machine-Fix-detection-of-unknown-incoming.patch
+++ /dev/null
@@ -1,126 +0,0 @@
-From 9667267d44ad88f8306c2dc3e0d23c1028cf5823 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Fri, 6 Mar 2026 09:01:12 +0000
-Subject: [PATCH 009/116] target/arm/machine: Fix detection of unknown incoming
- cpregs
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [9/16] 6450081257ce770c0825a69e794036bc181b5a6c (eauger1/centos-qemu-kvm)
-
-Currently the check of cpreg index matches fail to detect
-a situation where the length of both arrays is same but
-- destination has an extra register not found in the incoming stream (idx1)
-- source has an extra register not found in the destination (idx2)
- where idx1 < = idx2
-Normally this should fail but it does not.
-
-Fix the logic to scan all indexes.
-
-Fixes: 721fae12536 ("target-arm: Convert TCG to using (index,value) list for cp migration")
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Message-id: 20260304101625.1962633-8-eric.auger@redhat.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit dbfed8d80837ff7d36e763163f38549169ee64cc)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/machine.c | 61 +++++++++++++++++++++++++++++++++++---------
- 1 file changed, 49 insertions(+), 12 deletions(-)
-
-diff --git a/target/arm/machine.c b/target/arm/machine.c
-index 70157e000b..e0447083ee 100644
---- a/target/arm/machine.c
-+++ b/target/arm/machine.c
-@@ -967,6 +967,35 @@ static gchar *print_register_name(uint64_t kvm_regidx)
- }
- }
-
-+/*
-+ * Handle the situation where @kvmidx is on destination but not
-+ * in the incoming stream. This never fails the migration.
-+ */
-+static void handle_cpreg_missing_in_incoming_stream(ARMCPU *cpu, uint64_t kvmidx)
-+{
-+ g_autofree gchar *name = print_register_name(kvmidx);
-+
-+ warn_report("%s: %s "
-+ "expected by the destination but not in the incoming stream: "
-+ "skip it", __func__, name);
-+}
-+
-+/*
-+ * Handle the situation where @kvmidx is in the incoming stream
-+ * but not on destination. This currently fails the migration but
-+ * we plan to accomodate some exceptions, hence the boolean returned value.
-+ */
-+static bool handle_cpreg_only_in_incoming_stream(ARMCPU *cpu, uint64_t kvmidx)
-+{
-+ g_autofree gchar *name = print_register_name(kvmidx);
-+ bool fail = true;
-+
-+ error_report("%s: %s in the incoming stream but unknown on the "
-+ "destination: fail migration", __func__, name);
-+
-+ return fail;
-+}
-+
- static int cpu_post_load(void *opaque, int version_id)
- {
- ARMCPU *cpu = opaque;
-@@ -1006,21 +1035,12 @@ static int cpu_post_load(void *opaque, int version_id)
- for (i = 0, v = 0; i < cpu->cpreg_array_len
- && v < cpu->cpreg_vmstate_array_len;) {
- if (cpu->cpreg_vmstate_indexes[v] > cpu->cpreg_indexes[i]) {
-- g_autofree gchar *name = print_register_name(cpu->cpreg_indexes[i]);
--
-- warn_report("%s: %s "
-- "expected by the destination but not in the incoming stream: "
-- "skip it", __func__, name);
-- i++;
-+ handle_cpreg_missing_in_incoming_stream(cpu, cpu->cpreg_indexes[i++]);
- continue;
- }
- if (cpu->cpreg_vmstate_indexes[v] < cpu->cpreg_indexes[i]) {
-- g_autofree gchar *name = print_register_name(cpu->cpreg_vmstate_indexes[v]);
--
-- error_report("%s: %s in the incoming stream but unknown on the destination: "
-- "fail migration", __func__, name);
-- v++;
-- fail = true;
-+ fail = handle_cpreg_only_in_incoming_stream(cpu,
-+ cpu->cpreg_vmstate_indexes[v++]);
- continue;
- }
- /* matching register, copy the value over */
-@@ -1028,6 +1048,23 @@ static int cpu_post_load(void *opaque, int version_id)
- i++;
- v++;
- }
-+
-+ /*
-+ * if we have reached the end of the incoming array but there are
-+ * still regs in cpreg, continue parsing the regs which are missing
-+ * in the input stream
-+ */
-+ for ( ; i < cpu->cpreg_array_len; i++) {
-+ handle_cpreg_missing_in_incoming_stream(cpu, cpu->cpreg_indexes[i]);
-+ }
-+ /*
-+ * if we have reached the end of the cpreg array but there are
-+ * still regs in the input stream, continue parsing the vmstate array
-+ */
-+ for ( ; v < cpu->cpreg_vmstate_array_len; v++) {
-+ fail = handle_cpreg_only_in_incoming_stream(cpu,
-+ cpu->cpreg_vmstate_indexes[v]);
-+ }
- if (fail) {
- return -1;
- }
---
-2.52.0
-
diff --git a/kvm-target-arm-machine-Handle-ToleranceNotOnBothEnds-mig.patch b/kvm-target-arm-machine-Handle-ToleranceNotOnBothEnds-mig.patch
deleted file mode 100644
index 46bfc45..0000000
--- a/kvm-target-arm-machine-Handle-ToleranceNotOnBothEnds-mig.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From 9628d4afe762f07f9a1030795acf014fea744052 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Mon, 20 Apr 2026 16:03:52 +0200
-Subject: [PATCH 011/116] target/arm/machine: Handle ToleranceNotOnBothEnds
- migration tolerances
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [11/16] 26354a54c0d479bd06bdbb1e8d6ec47d7a4688e8 (eauger1/centos-qemu-kvm)
-
-If there is a mismatch between the cpreg indexes found on both ends,
-check whether a tolerance was registered for the given kvmidx. If any,
-silence warning/errors.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Message-id: 20260420140552.104369-3-eric.auger@redhat.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 5e65e7aa4a1b57b1dbfcecec629c9e3fb55e94b1)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/machine.c | 21 +++++++++++++++------
- target/arm/trace-events | 2 ++
- 2 files changed, 17 insertions(+), 6 deletions(-)
-
-diff --git a/target/arm/machine.c b/target/arm/machine.c
-index e0447083ee..0d749fc8fb 100644
---- a/target/arm/machine.c
-+++ b/target/arm/machine.c
-@@ -975,25 +975,34 @@ static void handle_cpreg_missing_in_incoming_stream(ARMCPU *cpu, uint64_t kvmidx
- {
- g_autofree gchar *name = print_register_name(kvmidx);
-
-+ if (arm_cpu_match_cpreg_mig_tolerance(cpu, kvmidx,
-+ 0, 0, ToleranceNotOnBothEnds)) {
-+ trace_tolerate_cpreg_missing_in_incoming_stream(name);
-+ return;
-+ }
- warn_report("%s: %s "
- "expected by the destination but not in the incoming stream: "
- "skip it", __func__, name);
- }
-
- /*
-- * Handle the situation where @kvmidx is in the incoming stream
-- * but not on destination. This currently fails the migration but
-- * we plan to accomodate some exceptions, hence the boolean returned value.
-+ * Handle the situation where @kvmidx is in the incoming
-+ * stream but not on destination. This fails the migration if
-+ * no cpreg mig tolerance is matched for this @kvmidx
-+ * Return true if the migration should eventually fail
- */
- static bool handle_cpreg_only_in_incoming_stream(ARMCPU *cpu, uint64_t kvmidx)
- {
- g_autofree gchar *name = print_register_name(kvmidx);
-- bool fail = true;
-
-+ if (arm_cpu_match_cpreg_mig_tolerance(cpu, kvmidx,
-+ 0, 0, ToleranceNotOnBothEnds)) {
-+ trace_tolerate_cpreg_only_in_incoming_stream(name);
-+ return false;
-+ }
- error_report("%s: %s in the incoming stream but unknown on the "
- "destination: fail migration", __func__, name);
--
-- return fail;
-+ return true;
- }
-
- static int cpu_post_load(void *opaque, int version_id)
-diff --git a/target/arm/trace-events b/target/arm/trace-events
-index 4e2502af9f..062a011881 100644
---- a/target/arm/trace-events
-+++ b/target/arm/trace-events
-@@ -16,3 +16,5 @@ kvm_arm_fixup_msi_route(uint64_t iova, uint64_t gpa) "MSI iova = 0x%"PRIx64" is
-
- # machine.c
- cpu_post_load(uint32_t cpreg_vmstate_array_len, uint32_t cpreg_array_len) "cpreg_vmstate_array_len=%d cpreg_array_len=%d"
-+tolerate_cpreg_missing_in_incoming_stream(char *name) "%s is missing in incoming stream but this is explicitly tolerated"
-+tolerate_cpreg_only_in_incoming_stream(char *name) "%s is in incoming stream but not on destination but this is explicitly tolerated"
---
-2.52.0
-
diff --git a/kvm-target-arm-machine-Handle-ToleranceOnlySrcTestValue-.patch b/kvm-target-arm-machine-Handle-ToleranceOnlySrcTestValue-.patch
deleted file mode 100644
index 734fb81..0000000
--- a/kvm-target-arm-machine-Handle-ToleranceOnlySrcTestValue-.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From ed217dda22c77ad780159755f48faf26a74531a6 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Mon, 20 Apr 2026 16:03:53 +0200
-Subject: [PATCH 012/116] target/arm/machine: Handle ToleranceOnlySrcTestValue
- migration tolerance
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [12/16] df44347fd53723ee81c4167e82bb85a15b94ac23 (eauger1/centos-qemu-kvm)
-
-Pass the value of the incoming register to
-handle_cpreg_only_in_incoming_stream and check whether there is
-a matching ToleranceOnlySrcTestValue tolerance.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Message-id: 20260420140552.104369-4-eric.auger@redhat.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit 9d2e717da4f4822ddb89c1ae78a0afd328a1f554)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/machine.c | 14 ++++++++++----
- 1 file changed, 10 insertions(+), 4 deletions(-)
-
-diff --git a/target/arm/machine.c b/target/arm/machine.c
-index 0d749fc8fb..b75097f371 100644
---- a/target/arm/machine.c
-+++ b/target/arm/machine.c
-@@ -991,12 +991,15 @@ static void handle_cpreg_missing_in_incoming_stream(ARMCPU *cpu, uint64_t kvmidx
- * no cpreg mig tolerance is matched for this @kvmidx
- * Return true if the migration should eventually fail
- */
--static bool handle_cpreg_only_in_incoming_stream(ARMCPU *cpu, uint64_t kvmidx)
-+static bool
-+handle_cpreg_only_in_incoming_stream(ARMCPU *cpu, uint64_t kvmidx, uint64_t value)
- {
- g_autofree gchar *name = print_register_name(kvmidx);
-
- if (arm_cpu_match_cpreg_mig_tolerance(cpu, kvmidx,
-- 0, 0, ToleranceNotOnBothEnds)) {
-+ 0, 0, ToleranceNotOnBothEnds) ||
-+ arm_cpu_match_cpreg_mig_tolerance(cpu, kvmidx,
-+ value, 0, ToleranceOnlySrcTestValue)) {
- trace_tolerate_cpreg_only_in_incoming_stream(name);
- return false;
- }
-@@ -1049,7 +1052,9 @@ static int cpu_post_load(void *opaque, int version_id)
- }
- if (cpu->cpreg_vmstate_indexes[v] < cpu->cpreg_indexes[i]) {
- fail = handle_cpreg_only_in_incoming_stream(cpu,
-- cpu->cpreg_vmstate_indexes[v++]);
-+ cpu->cpreg_vmstate_indexes[v],
-+ cpu->cpreg_vmstate_values[v]);
-+ v++;
- continue;
- }
- /* matching register, copy the value over */
-@@ -1072,7 +1077,8 @@ static int cpu_post_load(void *opaque, int version_id)
- */
- for ( ; v < cpu->cpreg_vmstate_array_len; v++) {
- fail = handle_cpreg_only_in_incoming_stream(cpu,
-- cpu->cpreg_vmstate_indexes[v]);
-+ cpu->cpreg_vmstate_indexes[v],
-+ cpu->cpreg_vmstate_values[v]);
- }
- if (fail) {
- return -1;
---
-2.52.0
-
diff --git a/kvm-target-arm-machine-Trace-all-register-mismatches.patch b/kvm-target-arm-machine-Trace-all-register-mismatches.patch
deleted file mode 100644
index 604e947..0000000
--- a/kvm-target-arm-machine-Trace-all-register-mismatches.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From 2ee6e5ea5ab6b435343f0585ba3dfa1cac313884 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Fri, 6 Mar 2026 09:01:12 +0000
-Subject: [PATCH 008/116] target/arm/machine: Trace all register mismatches
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [8/16] 270563b74465e4bf42901a2f0332a61621b22123 (eauger1/centos-qemu-kvm)
-
-At the moment, cpu_post_load() exits with error on the first
-catch of unexpected register in the incoming stream. Let the code
-go further and trace all the issues before exiting.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Message-id: 20260304101625.1962633-7-eric.auger@redhat.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit e25c63c3b368118dc109e49393554f85f1203d1e)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/machine.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/target/arm/machine.c b/target/arm/machine.c
-index 36c9d9946e..70157e000b 100644
---- a/target/arm/machine.c
-+++ b/target/arm/machine.c
-@@ -971,6 +971,7 @@ static int cpu_post_load(void *opaque, int version_id)
- {
- ARMCPU *cpu = opaque;
- CPUARMState *env = &cpu->env;
-+ bool fail = false;
- int i, v;
-
- trace_cpu_post_load(cpu->cpreg_vmstate_array_len,
-@@ -1003,13 +1004,14 @@ static int cpu_post_load(void *opaque, int version_id)
- */
-
- for (i = 0, v = 0; i < cpu->cpreg_array_len
-- && v < cpu->cpreg_vmstate_array_len; i++) {
-+ && v < cpu->cpreg_vmstate_array_len;) {
- if (cpu->cpreg_vmstate_indexes[v] > cpu->cpreg_indexes[i]) {
- g_autofree gchar *name = print_register_name(cpu->cpreg_indexes[i]);
-
- warn_report("%s: %s "
- "expected by the destination but not in the incoming stream: "
- "skip it", __func__, name);
-+ i++;
- continue;
- }
- if (cpu->cpreg_vmstate_indexes[v] < cpu->cpreg_indexes[i]) {
-@@ -1017,12 +1019,18 @@ static int cpu_post_load(void *opaque, int version_id)
-
- error_report("%s: %s in the incoming stream but unknown on the destination: "
- "fail migration", __func__, name);
-- return -1;
-+ v++;
-+ fail = true;
-+ continue;
- }
- /* matching register, copy the value over */
- cpu->cpreg_values[i] = cpu->cpreg_vmstate_values[v];
-+ i++;
- v++;
- }
-+ if (fail) {
-+ return -1;
-+ }
-
- if (kvm_enabled()) {
- if (!kvm_arm_cpu_post_load(cpu)) {
---
-2.52.0
-
diff --git a/kvm-target-arm-machine-Trace-cpreg-names-which-do-not-ma.patch b/kvm-target-arm-machine-Trace-cpreg-names-which-do-not-ma.patch
deleted file mode 100644
index 278ac52..0000000
--- a/kvm-target-arm-machine-Trace-cpreg-names-which-do-not-ma.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From 810318abdcf9574cd300350642a671cc1ba91556 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Fri, 6 Mar 2026 09:01:12 +0000
-Subject: [PATCH 007/116] target/arm/machine: Trace cpreg names which do not
- match on migration
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [7/16] 4fd2c91158511a672da05643c961fe55f964fe31 (eauger1/centos-qemu-kvm)
-
-Whenever there is a mismatch between cpreg indexes in the incoming
-stream and cpregs exposed by the destination output the name of
-the register. We use a print_register_name() wrapper helper. At the
-moment we are only able to do a nice decoding of the index for
-KVM regs.
-
-Without this patch, the error would be:
-qemu-system-aarch64: load of migration failed: Operation not permitted:
-error while loading state for instance 0x0 of device 'cpu': post load
-hook failed for: cpu, version_id: 22, minimum_version: 22, ret: -1
-which is not helpful for the end user to understand the actual
-issue.
-
-This patch adds the actual information about the probme:
-qemu-system-aarch64: cpu_post_load: system register
-op0:3 op1:0 crn:2 crm:0 op2:3 in the incoming stream but
-unknown on the destination, fail migration
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Message-id: 20260304101625.1962633-6-eric.auger@redhat.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit eac1e610f48923084cb07b3f1eaa05f5fedccd85)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/machine.c | 21 +++++++++++++++++++--
- 1 file changed, 19 insertions(+), 2 deletions(-)
-
-diff --git a/target/arm/machine.c b/target/arm/machine.c
-index 5caf2885c2..36c9d9946e 100644
---- a/target/arm/machine.c
-+++ b/target/arm/machine.c
-@@ -1,5 +1,6 @@
- #include "qemu/osdep.h"
- #include "cpu.h"
-+#include "cpregs.h"
- #include "trace.h"
- #include "qemu/error-report.h"
- #include "system/kvm.h"
-@@ -957,6 +958,15 @@ static int cpu_pre_load(void *opaque)
- return 0;
- }
-
-+static gchar *print_register_name(uint64_t kvm_regidx)
-+{
-+ if (kvm_enabled()) {
-+ return kvm_print_register_name(kvm_regidx);
-+ } else {
-+ return g_strdup_printf("system register 0x%x", kvm_to_cpreg_id(kvm_regidx));
-+ }
-+}
-+
- static int cpu_post_load(void *opaque, int version_id)
- {
- ARMCPU *cpu = opaque;
-@@ -995,11 +1005,18 @@ static int cpu_post_load(void *opaque, int version_id)
- for (i = 0, v = 0; i < cpu->cpreg_array_len
- && v < cpu->cpreg_vmstate_array_len; i++) {
- if (cpu->cpreg_vmstate_indexes[v] > cpu->cpreg_indexes[i]) {
-- /* register in our list but not incoming : skip it */
-+ g_autofree gchar *name = print_register_name(cpu->cpreg_indexes[i]);
-+
-+ warn_report("%s: %s "
-+ "expected by the destination but not in the incoming stream: "
-+ "skip it", __func__, name);
- continue;
- }
- if (cpu->cpreg_vmstate_indexes[v] < cpu->cpreg_indexes[i]) {
-- /* register in their list but not ours: fail migration */
-+ g_autofree gchar *name = print_register_name(cpu->cpreg_vmstate_indexes[v]);
-+
-+ error_report("%s: %s in the incoming stream but unknown on the destination: "
-+ "fail migration", __func__, name);
- return -1;
- }
- /* matching register, copy the value over */
---
-2.52.0
-
diff --git a/kvm-target-arm-machine-Use-VMSTATE_VARRAY_INT32_ALLOC-fo.patch b/kvm-target-arm-machine-Use-VMSTATE_VARRAY_INT32_ALLOC-fo.patch
deleted file mode 100644
index 5a66c3b..0000000
--- a/kvm-target-arm-machine-Use-VMSTATE_VARRAY_INT32_ALLOC-fo.patch
+++ /dev/null
@@ -1,194 +0,0 @@
-From 904bafbebc32c02ddc1906afd194f2c42c812759 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Fri, 6 Mar 2026 09:01:12 +0000
-Subject: [PATCH 004/116] target/arm/machine: Use VMSTATE_VARRAY_INT32_ALLOC
- for cpreg arrays
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [4/16] 833ad7f2be8a02eb811c8562d809e4cc2eedc2a6 (eauger1/centos-qemu-kvm)
-
-Conflicts:
-- contextual conflict in target/arm/trace-events as we don't have
- cpu.c, arm-powerctl.c, tcg/psci.c and hvf/hvf.c trace events
-- target/arm/whpx/whpx-all.c does not exist downstream
-
-This removes the need for explicitly allocating cpreg_vmstate arrays.
-On post save we simply point to cpreg arrays and set the length
-accordingly.
-
-Remove VMSTATE_VARRAY_INT32 for cpreg_vmstate_array_len as now
-the array is dynamically allocated.
-
-Also add a trace point on post_load to trace potential mismatch
-between the number of incoming cpregs versus current ones.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Message-id: 20260304101625.1962633-3-eric.auger@redhat.com
-Suggested-by: Peter Maydell <peter.maydell@linaro.org>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit ab2ddc7b662d34c242ddfcfbe35996417b047ce2)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/arm/helper.c | 5 -----
- target/arm/kvm.c | 5 -----
- target/arm/machine.c | 45 +++++++++++++++++++++++++++++------------
- target/arm/trace-events | 3 +++
- 4 files changed, 35 insertions(+), 23 deletions(-)
-
-diff --git a/target/arm/helper.c b/target/arm/helper.c
-index 1cff4c5a68..5e643ed6b2 100644
---- a/target/arm/helper.c
-+++ b/target/arm/helper.c
-@@ -247,15 +247,10 @@ void init_cpreg_list(ARMCPU *cpu)
- if (arraylen) {
- cpu->cpreg_indexes = g_new(uint64_t, arraylen);
- cpu->cpreg_values = g_new(uint64_t, arraylen);
-- cpu->cpreg_vmstate_indexes = g_new(uint64_t, arraylen);
-- cpu->cpreg_vmstate_values = g_new(uint64_t, arraylen);
- } else {
- cpu->cpreg_indexes = NULL;
- cpu->cpreg_values = NULL;
-- cpu->cpreg_vmstate_indexes = NULL;
-- cpu->cpreg_vmstate_values = NULL;
- }
-- cpu->cpreg_vmstate_array_len = arraylen;
- cpu->cpreg_array_len = 0;
-
- g_hash_table_foreach(cpu->cp_regs, add_cpreg_to_list, cpu);
-diff --git a/target/arm/kvm.c b/target/arm/kvm.c
-index 5a75ff5927..5dacb304bd 100644
---- a/target/arm/kvm.c
-+++ b/target/arm/kvm.c
-@@ -805,12 +805,7 @@ static int kvm_arm_init_cpreg_list(ARMCPU *cpu)
-
- cpu->cpreg_indexes = g_renew(uint64_t, cpu->cpreg_indexes, arraylen);
- cpu->cpreg_values = g_renew(uint64_t, cpu->cpreg_values, arraylen);
-- cpu->cpreg_vmstate_indexes = g_renew(uint64_t, cpu->cpreg_vmstate_indexes,
-- arraylen);
-- cpu->cpreg_vmstate_values = g_renew(uint64_t, cpu->cpreg_vmstate_values,
-- arraylen);
- cpu->cpreg_array_len = arraylen;
-- cpu->cpreg_vmstate_array_len = arraylen;
-
- for (i = 0, arraylen = 0; i < rlp->n; i++) {
- uint64_t regidx = rlp->reg[i];
-diff --git a/target/arm/machine.c b/target/arm/machine.c
-index 6986915bee..5caf2885c2 100644
---- a/target/arm/machine.c
-+++ b/target/arm/machine.c
-@@ -1,5 +1,6 @@
- #include "qemu/osdep.h"
- #include "cpu.h"
-+#include "trace.h"
- #include "qemu/error-report.h"
- #include "system/kvm.h"
- #include "system/tcg.h"
-@@ -894,11 +895,14 @@ static int cpu_pre_save(void *opaque)
- }
- }
-
-+ /*
-+ * On outbound migration, send the data in our cpreg_{values,indexes}
-+ * arrays. The migration code will not allocate anything, but just
-+ * reads the data pointed to by the VMSTATE_VARRAY_INT32_ALLOC() fields.
-+ */
-+ cpu->cpreg_vmstate_indexes = cpu->cpreg_indexes;
-+ cpu->cpreg_vmstate_values = cpu->cpreg_values;
- cpu->cpreg_vmstate_array_len = cpu->cpreg_array_len;
-- memcpy(cpu->cpreg_vmstate_indexes, cpu->cpreg_indexes,
-- cpu->cpreg_array_len * sizeof(uint64_t));
-- memcpy(cpu->cpreg_vmstate_values, cpu->cpreg_values,
-- cpu->cpreg_array_len * sizeof(uint64_t));
-
- return 0;
- }
-@@ -911,6 +915,9 @@ static int cpu_post_save(void *opaque)
- pmu_op_finish(&cpu->env);
- }
-
-+ cpu->cpreg_vmstate_indexes = NULL;
-+ cpu->cpreg_vmstate_values = NULL;
-+
- return 0;
- }
-
-@@ -944,6 +951,9 @@ static int cpu_pre_load(void *opaque)
- pmu_op_start(env);
- }
-
-+ g_assert(!cpu->cpreg_vmstate_indexes);
-+ g_assert(!cpu->cpreg_vmstate_values);
-+
- return 0;
- }
-
-@@ -953,6 +963,9 @@ static int cpu_post_load(void *opaque, int version_id)
- CPUARMState *env = &cpu->env;
- int i, v;
-
-+ trace_cpu_post_load(cpu->cpreg_vmstate_array_len,
-+ cpu->cpreg_array_len);
-+
- /*
- * Handle migration compatibility from old QEMU which didn't
- * send the irq-line-state subsection. A QEMU without it did not
-@@ -1004,6 +1017,11 @@ static int cpu_post_load(void *opaque, int version_id)
- }
- }
-
-+ g_free(cpu->cpreg_vmstate_indexes);
-+ g_free(cpu->cpreg_vmstate_values);
-+ cpu->cpreg_vmstate_indexes = NULL;
-+ cpu->cpreg_vmstate_values = NULL;
-+
- /*
- * Misaligned thumb pc is architecturally impossible. Fail the
- * incoming migration. For TCG it would trigger the assert in
-@@ -1071,16 +1089,17 @@ const VMStateDescription vmstate_arm_cpu = {
- VMSTATE_UINT32_ARRAY(env.fiq_regs, ARMCPU, 5),
- VMSTATE_UINT64_ARRAY(env.elr_el, ARMCPU, 4),
- VMSTATE_UINT64_ARRAY(env.sp_el, ARMCPU, 4),
-- /* The length-check must come before the arrays to avoid
-- * incoming data possibly overflowing the array.
-+ /*
-+ * The length must come before the arrays so we can
-+ * allocate the arrays before their data arrives
- */
-- VMSTATE_INT32_POSITIVE_LE(cpreg_vmstate_array_len, ARMCPU),
-- VMSTATE_VARRAY_INT32(cpreg_vmstate_indexes, ARMCPU,
-- cpreg_vmstate_array_len,
-- 0, vmstate_info_uint64, uint64_t),
-- VMSTATE_VARRAY_INT32(cpreg_vmstate_values, ARMCPU,
-- cpreg_vmstate_array_len,
-- 0, vmstate_info_uint64, uint64_t),
-+ VMSTATE_INT32(cpreg_vmstate_array_len, ARMCPU),
-+ VMSTATE_VARRAY_INT32_ALLOC(cpreg_vmstate_indexes, ARMCPU,
-+ cpreg_vmstate_array_len,
-+ 0, vmstate_info_uint64, uint64_t),
-+ VMSTATE_VARRAY_INT32_ALLOC(cpreg_vmstate_values, ARMCPU,
-+ cpreg_vmstate_array_len,
-+ 0, vmstate_info_uint64, uint64_t),
- VMSTATE_UINT64(env.exclusive_addr, ARMCPU),
- VMSTATE_UINT64(env.exclusive_val, ARMCPU),
- VMSTATE_UINT64(env.exclusive_high, ARMCPU),
-diff --git a/target/arm/trace-events b/target/arm/trace-events
-index 4438dce7be..4e2502af9f 100644
---- a/target/arm/trace-events
-+++ b/target/arm/trace-events
-@@ -13,3 +13,6 @@ arm_gt_update_irq(int timer, int irqstate) "gt_update_irq: timer %d irqstate %d"
-
- # kvm.c
- kvm_arm_fixup_msi_route(uint64_t iova, uint64_t gpa) "MSI iova = 0x%"PRIx64" is translated into 0x%"PRIx64
-+
-+# machine.c
-+cpu_post_load(uint32_t cpreg_vmstate_array_len, uint32_t cpreg_array_len) "cpreg_vmstate_array_len=%d cpreg_array_len=%d"
---
-2.52.0
-
diff --git a/kvm-target-i386-add-compatibility-property-for-arch_capa.patch b/kvm-target-i386-add-compatibility-property-for-arch_capa.patch
deleted file mode 100644
index 78aa945..0000000
--- a/kvm-target-i386-add-compatibility-property-for-arch_capa.patch
+++ /dev/null
@@ -1,135 +0,0 @@
-From ae1b11511be8c6ea7ac3b6dc46e106bb19829b0f Mon Sep 17 00:00:00 2001
-From: Paolo Bonzini <pbonzini@redhat.com>
-Date: Thu, 9 Oct 2025 16:49:59 +0200
-Subject: [PATCH 3/4] target/i386: add compatibility property for
- arch_capabilities
-
-RH-Author: Paolo Bonzini <pbonzini@redhat.com>
-RH-MergeRequest: 411: fix x86-64 migration regression in QEMU 10.1
-RH-Jira: RHEL-120253
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/2] 6bfa7c38398623ac7c3392c0ad17312e6f641f4d (bonzini/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-120253
-
-Prior to v10.1, if requested by user, arch-capabilities is always on
-despite the fact that CPUID advertises it to be off/unvailable.
-This causes a migration issue for VMs that are run on a machine
-without arch-capabilities and expect this feature to be present
-on the destination host with QEMU 10.1.
-
-Add a compatibility property to restore the legacy behavior for all
-machines with version prior to 10.1.
-
-To preserve the functionality (added by 10.1) of turning off
-ARCH_CAPABILITIES where Windows does not like it, use directly
-the guest CPU vendor: x86_cpu_get_supported_feature_word is not
-KVM-specific and therefore should not necessarily use the host
-CPUID.
-
-Co-authored-by: Hector Cao <hector.cao@canonical.com>
-Signed-off-by: Hector Cao <hector.cao@canonical.com>
-Fixes: d3a24134e37 ("target/i386: do not expose ARCH_CAPABILITIES on AMD CPU", 2025-07-17)
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit e9efa4a77168ac2816bf9471f878252ce6224710)
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
----
- hw/i386/pc.c | 2 ++
- target/i386/cpu.c | 17 +++++++++++++++++
- target/i386/cpu.h | 6 ++++++
- target/i386/kvm/kvm.c | 6 +-----
- 4 files changed, 26 insertions(+), 5 deletions(-)
-
-diff --git a/hw/i386/pc.c b/hw/i386/pc.c
-index 439abe8f46..625a89d097 100644
---- a/hw/i386/pc.c
-+++ b/hw/i386/pc.c
-@@ -84,6 +84,7 @@
- GlobalProperty pc_compat_10_0[] = {
- { TYPE_X86_CPU, "x-consistent-cache", "false" },
- { TYPE_X86_CPU, "x-vendor-cpuid-only-v2", "false" },
-+ { TYPE_X86_CPU, "x-arch-cap-always-on", "true" },
- };
- const size_t pc_compat_10_0_len = G_N_ELEMENTS(pc_compat_10_0);
-
-@@ -299,6 +300,7 @@ GlobalProperty pc_rhel_10_2_compat[] = {
- /* pc_rhel_10_2_compat from pc_compat_10_0 */
- { TYPE_X86_CPU, "x-consistent-cache", "false" },
- { TYPE_X86_CPU, "x-vendor-cpuid-only-v2", "false" },
-+ { TYPE_X86_CPU, "x-arch-cap-always-on", "true" },
- };
- const size_t pc_rhel_10_2_compat_len = G_N_ELEMENTS(pc_compat_10_0);
-
-diff --git a/target/i386/cpu.c b/target/i386/cpu.c
-index 9c756a05f2..de288dc5ac 100644
---- a/target/i386/cpu.c
-+++ b/target/i386/cpu.c
-@@ -7559,6 +7559,20 @@ uint64_t x86_cpu_get_supported_feature_word(X86CPU *cpu, FeatureWord w)
- #endif
- break;
-
-+ case FEAT_7_0_EDX:
-+ /*
-+ * Windows does not like ARCH_CAPABILITIES on AMD machines at all.
-+ * Do not show the fake ARCH_CAPABILITIES MSR that KVM sets up,
-+ * except if needed for migration.
-+ *
-+ * When arch_cap_always_on is removed, this tweak can move to
-+ * kvm_arch_get_supported_cpuid.
-+ */
-+ if (cpu && IS_AMD_CPU(&cpu->env) && !cpu->arch_cap_always_on) {
-+ unavail = CPUID_7_0_EDX_ARCH_CAPABILITIES;
-+ }
-+ break;
-+
- default:
- break;
- }
-@@ -10024,6 +10038,9 @@ static const Property x86_cpu_properties[] = {
- true),
- DEFINE_PROP_BOOL("x-l1-cache-per-thread", X86CPU, l1_cache_per_core, true),
- DEFINE_PROP_BOOL("x-force-cpuid-0x1f", X86CPU, force_cpuid_0x1f, false),
-+
-+ DEFINE_PROP_BOOL("x-arch-cap-always-on", X86CPU,
-+ arch_cap_always_on, false),
- };
-
- #ifndef CONFIG_USER_ONLY
-diff --git a/target/i386/cpu.h b/target/i386/cpu.h
-index f977fc49a7..b966bc997c 100644
---- a/target/i386/cpu.h
-+++ b/target/i386/cpu.h
-@@ -2314,6 +2314,12 @@ struct ArchCPU {
- /* Forcefully disable KVM PV features not exposed in guest CPUIDs */
- bool kvm_pv_enforce_cpuid;
-
-+ /*
-+ * Expose arch-capabilities unconditionally even on AMD models, for backwards
-+ * compatibility with QEMU <10.1.
-+ */
-+ bool arch_cap_always_on;
-+
- /* Number of physical address bits supported */
- uint32_t phys_bits;
-
-diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
-index 0eb39d22d6..baa2f80beb 100644
---- a/target/i386/kvm/kvm.c
-+++ b/target/i386/kvm/kvm.c
-@@ -503,12 +503,8 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
- * Linux v4.17-v4.20 incorrectly return ARCH_CAPABILITIES on SVM hosts.
- * We can detect the bug by checking if MSR_IA32_ARCH_CAPABILITIES is
- * returned by KVM_GET_MSR_INDEX_LIST.
-- *
-- * But also, because Windows does not like ARCH_CAPABILITIES on AMD
-- * mcahines at all, do not show the fake ARCH_CAPABILITIES MSR that
-- * KVM sets up.
- */
-- if (!has_msr_arch_capabs || !(edx & CPUID_7_0_EDX_ARCH_CAPABILITIES)) {
-+ if (!has_msr_arch_capabs) {
- ret &= ~CPUID_7_0_EDX_ARCH_CAPABILITIES;
- }
- } else if (function == 7 && index == 1 && reg == R_EAX) {
---
-2.47.3
-
diff --git a/kvm-target-i386-add-compatibility-property-for-pdcm-feat.patch b/kvm-target-i386-add-compatibility-property-for-pdcm-feat.patch
deleted file mode 100644
index dfd644c..0000000
--- a/kvm-target-i386-add-compatibility-property-for-pdcm-feat.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-From 0d2ec98960c89003d3040818b5c5493cd636b98d Mon Sep 17 00:00:00 2001
-From: Hector Cao <hector.cao@canonical.com>
-Date: Tue, 23 Sep 2025 12:16:41 +0200
-Subject: [PATCH 4/4] target/i386: add compatibility property for pdcm feature
-
-RH-Author: Paolo Bonzini <pbonzini@redhat.com>
-RH-MergeRequest: 411: fix x86-64 migration regression in QEMU 10.1
-RH-Jira: RHEL-120253
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/2] 9d76b45215d7ae2bc5ea2e61fe01780059d6d44c (bonzini/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-120253
-
-The pdcm feature is supposed to be disabled when PMU is not
-available. Up until v10.1, pdcm feature is enabled even when PMU
-is off. This behavior has been fixed but this change breaks the
-migration of VMs that are run with QEMU < 10.0 and expect the pdcm
-feature to be enabled on the destination host.
-
-This commit restores the legacy behavior for machines with version
-prior to 10.1 to allow the migration from older QEMU to QEMU 10.1.
-
-Signed-off-by: Hector Cao <hector.cao@canonical.com>
-Link: https://lore.kernel.org/r/20250910115733.21149-3-hector.cao@canonical.com
-Fixes: e68ec298090 ("i386/cpu: Move adjustment of CPUID_EXT_PDCM before feature_dependencies[] check", 2025-06-20)
-[Move property from migration object to CPU. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 6529f31e0dccadb532c80b36e3efe7aef83f9cad)
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
----
- hw/i386/pc.c | 2 ++
- target/i386/cpu.c | 15 ++++++++++++---
- target/i386/cpu.h | 6 ++++++
- 3 files changed, 20 insertions(+), 3 deletions(-)
-
-diff --git a/hw/i386/pc.c b/hw/i386/pc.c
-index 625a89d097..446d4a7c93 100644
---- a/hw/i386/pc.c
-+++ b/hw/i386/pc.c
-@@ -85,6 +85,7 @@ GlobalProperty pc_compat_10_0[] = {
- { TYPE_X86_CPU, "x-consistent-cache", "false" },
- { TYPE_X86_CPU, "x-vendor-cpuid-only-v2", "false" },
- { TYPE_X86_CPU, "x-arch-cap-always-on", "true" },
-+ { TYPE_X86_CPU, "x-pdcm-on-even-without-pmu", "true" },
- };
- const size_t pc_compat_10_0_len = G_N_ELEMENTS(pc_compat_10_0);
-
-@@ -301,6 +302,7 @@ GlobalProperty pc_rhel_10_2_compat[] = {
- { TYPE_X86_CPU, "x-consistent-cache", "false" },
- { TYPE_X86_CPU, "x-vendor-cpuid-only-v2", "false" },
- { TYPE_X86_CPU, "x-arch-cap-always-on", "true" },
-+ { TYPE_X86_CPU, "x-pdcm-on-even-without-pmu", "true" },
- };
- const size_t pc_rhel_10_2_compat_len = G_N_ELEMENTS(pc_compat_10_0);
-
-diff --git a/target/i386/cpu.c b/target/i386/cpu.c
-index de288dc5ac..dfcdfd3da6 100644
---- a/target/i386/cpu.c
-+++ b/target/i386/cpu.c
-@@ -7928,6 +7928,11 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
- /* Fixup overflow: max value for bits 23-16 is 255. */
- *ebx |= MIN(num, 255) << 16;
- }
-+ if (cpu->pdcm_on_even_without_pmu) {
-+ if (!cpu->enable_pmu) {
-+ *ecx &= ~CPUID_EXT_PDCM;
-+ }
-+ }
- break;
- case 2: { /* cache info: needed for Pentium Pro compatibility */
- const CPUCaches *caches;
-@@ -8978,9 +8983,11 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
- }
- }
-
-- /* PDCM is fixed1 bit for TDX */
-- if (!cpu->enable_pmu && !is_tdx_vm()) {
-- env->features[FEAT_1_ECX] &= ~CPUID_EXT_PDCM;
-+ if (!cpu->pdcm_on_even_without_pmu) {
-+ /* PDCM is fixed1 bit for TDX */
-+ if (!cpu->enable_pmu && !is_tdx_vm()) {
-+ env->features[FEAT_1_ECX] &= ~CPUID_EXT_PDCM;
-+ }
- }
-
- for (i = 0; i < ARRAY_SIZE(feature_dependencies); i++) {
-@@ -10041,6 +10048,8 @@ static const Property x86_cpu_properties[] = {
-
- DEFINE_PROP_BOOL("x-arch-cap-always-on", X86CPU,
- arch_cap_always_on, false),
-+ DEFINE_PROP_BOOL("x-pdcm-on-even-without-pmu", X86CPU,
-+ pdcm_on_even_without_pmu, false),
- };
-
- #ifndef CONFIG_USER_ONLY
-diff --git a/target/i386/cpu.h b/target/i386/cpu.h
-index b966bc997c..2187e61654 100644
---- a/target/i386/cpu.h
-+++ b/target/i386/cpu.h
-@@ -2320,6 +2320,12 @@ struct ArchCPU {
- */
- bool arch_cap_always_on;
-
-+ /*
-+ * Backwards compatibility with QEMU <10.1. The PDCM feature is now disabled when
-+ * PMU is not available, but prior to 10.1 it was enabled even if PMU is off.
-+ */
-+ bool pdcm_on_even_without_pmu;
-+
- /* Number of physical address bits supported */
- uint32_t phys_bits;
-
---
-2.47.3
-
diff --git a/kvm-target-i386-arch_memory_mapping-Use-address_space_me.patch b/kvm-target-i386-arch_memory_mapping-Use-address_space_me.patch
deleted file mode 100644
index c9c5422..0000000
--- a/kvm-target-i386-arch_memory_mapping-Use-address_space_me.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From 93d697c70717c2f9a544909774aaa978c0117d65 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
-Date: Mon, 29 Sep 2025 15:35:28 +0200
-Subject: [PATCH 047/111] target/i386/arch_memory_mapping: Use
- address_space_memory_is_io()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [47/111] 118cf50c385e9d53f0b925de1d4650d28ec36049 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73796
-
-Since all functions have an address space argument, it is
-trivial to replace cpu_physical_memory_is_io() by
-address_space_memory_is_io().
-
-Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-Message-Id: <20251002084203.63899-4-philmd@linaro.org>
-(cherry picked from commit 6ffaa9219616d12bc6c3e7cb26a77f7432ac0c70)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- target/i386/arch_memory_mapping.c | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/target/i386/arch_memory_mapping.c b/target/i386/arch_memory_mapping.c
-index a2398c2173..560f4689ab 100644
---- a/target/i386/arch_memory_mapping.c
-+++ b/target/i386/arch_memory_mapping.c
-@@ -35,7 +35,7 @@ static void walk_pte(MemoryMappingList *list, AddressSpace *as,
- }
-
- start_paddr = (pte & ~0xfff) & ~(0x1ULL << 63);
-- if (cpu_physical_memory_is_io(start_paddr)) {
-+ if (address_space_is_io(as, start_paddr)) {
- /* I/O region */
- continue;
- }
-@@ -65,7 +65,7 @@ static void walk_pte2(MemoryMappingList *list, AddressSpace *as,
- }
-
- start_paddr = pte & ~0xfff;
-- if (cpu_physical_memory_is_io(start_paddr)) {
-+ if (address_space_is_io(as, start_paddr)) {
- /* I/O region */
- continue;
- }
-@@ -100,7 +100,7 @@ static void walk_pde(MemoryMappingList *list, AddressSpace *as,
- if (pde & PG_PSE_MASK) {
- /* 2 MB page */
- start_paddr = (pde & ~0x1fffff) & ~(0x1ULL << 63);
-- if (cpu_physical_memory_is_io(start_paddr)) {
-+ if (address_space_is_io(as, start_paddr)) {
- /* I/O region */
- continue;
- }
-@@ -142,7 +142,7 @@ static void walk_pde2(MemoryMappingList *list, AddressSpace *as,
- */
- high_paddr = ((hwaddr)(pde & 0x1fe000) << 19);
- start_paddr = (pde & ~0x3fffff) | high_paddr;
-- if (cpu_physical_memory_is_io(start_paddr)) {
-+ if (address_space_is_io(as, start_paddr)) {
- /* I/O region */
- continue;
- }
-@@ -203,7 +203,7 @@ static void walk_pdpe(MemoryMappingList *list, AddressSpace *as,
- if (pdpe & PG_PSE_MASK) {
- /* 1 GB page */
- start_paddr = (pdpe & ~0x3fffffff) & ~(0x1ULL << 63);
-- if (cpu_physical_memory_is_io(start_paddr)) {
-+ if (address_space_is_io(as, start_paddr)) {
- /* I/O region */
- continue;
- }
---
-2.52.0
-
diff --git a/kvm-target-i386-emulate-Allow-instruction-decoding-from-.patch b/kvm-target-i386-emulate-Allow-instruction-decoding-from-.patch
deleted file mode 100644
index 068fd00..0000000
--- a/kvm-target-i386-emulate-Allow-instruction-decoding-from-.patch
+++ /dev/null
@@ -1,150 +0,0 @@
-From 35aea0fcc61b1796268f3eae3549721ecd0165fc Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:22 +0200
-Subject: [PATCH 04/32] target/i386/emulate: Allow instruction decoding from
- stream
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/30] 36aa0cc1832e8162cb7bba8001b2362245cdb80b
-
-Introduce a new helper function to decode x86 instructions from a
-raw instruction byte stream. MSHV delivers an instruction stream in a
-buffer of the vm_exit message. It can be used to speed up MMIO
-emulation, since instructions do not have to be fetched and translated.
-
-Added "fetch_instruction()" op to x86_emul_ops() to improve
-traceability.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-3-magnuskulke@linux.microsoft.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 1e25327b244a217078e3fa5df18322c70932f478)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- target/i386/emulate/x86_decode.c | 27 +++++++++++++++++++++++----
- target/i386/emulate/x86_decode.h | 9 +++++++++
- target/i386/emulate/x86_emu.c | 3 ++-
- target/i386/emulate/x86_emu.h | 2 ++
- 4 files changed, 36 insertions(+), 5 deletions(-)
-
-diff --git a/target/i386/emulate/x86_decode.c b/target/i386/emulate/x86_decode.c
-index 2eca39802e..97bd6f1a3b 100644
---- a/target/i386/emulate/x86_decode.c
-+++ b/target/i386/emulate/x86_decode.c
-@@ -71,10 +71,16 @@ static inline uint64_t decode_bytes(CPUX86State *env, struct x86_decode *decode,
- VM_PANIC_EX("%s invalid size %d\n", __func__, size);
- break;
- }
-- target_ulong va = linear_rip(env_cpu(env), env->eip) + decode->len;
-- emul_ops->read_mem(env_cpu(env), &val, va, size);
-+
-+ /* copy the bytes from the instruction stream, if available */
-+ if (decode->stream && decode->len + size <= decode->stream->len) {
-+ memcpy(&val, decode->stream->bytes + decode->len, size);
-+ } else {
-+ target_ulong va = linear_rip(env_cpu(env), env->eip) + decode->len;
-+ emul_ops->fetch_instruction(env_cpu(env), &val, va, size);
-+ }
- decode->len += size;
--
-+
- return val;
- }
-
-@@ -2076,9 +2082,10 @@ static void decode_opcodes(CPUX86State *env, struct x86_decode *decode)
- }
- }
-
--uint32_t decode_instruction(CPUX86State *env, struct x86_decode *decode)
-+static uint32_t decode_opcode(CPUX86State *env, struct x86_decode *decode)
- {
- memset(decode, 0, sizeof(*decode));
-+
- decode_prefix(env, decode);
- set_addressing_size(env, decode);
- set_operand_size(env, decode);
-@@ -2088,6 +2095,18 @@ uint32_t decode_instruction(CPUX86State *env, struct x86_decode *decode)
- return decode->len;
- }
-
-+uint32_t decode_instruction(CPUX86State *env, struct x86_decode *decode)
-+{
-+ return decode_opcode(env, decode);
-+}
-+
-+uint32_t decode_instruction_stream(CPUX86State *env, struct x86_decode *decode,
-+ struct x86_insn_stream *stream)
-+{
-+ decode->stream = stream;
-+ return decode_opcode(env, decode);
-+}
-+
- void init_decoder(void)
- {
- int i;
-diff --git a/target/i386/emulate/x86_decode.h b/target/i386/emulate/x86_decode.h
-index 927645af1a..1cadf3694f 100644
---- a/target/i386/emulate/x86_decode.h
-+++ b/target/i386/emulate/x86_decode.h
-@@ -272,6 +272,11 @@ typedef struct x86_decode_op {
- };
- } x86_decode_op;
-
-+typedef struct x86_insn_stream {
-+ const uint8_t *bytes;
-+ size_t len;
-+} x86_insn_stream;
-+
- typedef struct x86_decode {
- int len;
- uint8_t opcode[4];
-@@ -298,11 +303,15 @@ typedef struct x86_decode {
- struct x86_modrm modrm;
- struct x86_decode_op op[4];
- bool is_fpu;
-+
-+ x86_insn_stream *stream;
- } x86_decode;
-
- uint64_t sign(uint64_t val, int size);
-
- uint32_t decode_instruction(CPUX86State *env, struct x86_decode *decode);
-+uint32_t decode_instruction_stream(CPUX86State *env, struct x86_decode *decode,
-+ struct x86_insn_stream *stream);
-
- void *get_reg_ref(CPUX86State *env, int reg, int rex_present,
- int is_extended, int size);
-diff --git a/target/i386/emulate/x86_emu.c b/target/i386/emulate/x86_emu.c
-index db7a7f7437..4409f7bc13 100644
---- a/target/i386/emulate/x86_emu.c
-+++ b/target/i386/emulate/x86_emu.c
-@@ -1246,7 +1246,8 @@ static void init_cmd_handler(void)
- bool exec_instruction(CPUX86State *env, struct x86_decode *ins)
- {
- if (!_cmd_handler[ins->cmd].handler) {
-- printf("Unimplemented handler (" TARGET_FMT_lx ") for %d (%x %x) \n", env->eip,
-+ printf("Unimplemented handler (" TARGET_FMT_lx ") for %d (%x %x)\n",
-+ env->eip,
- ins->cmd, ins->opcode[0],
- ins->opcode_len > 1 ? ins->opcode[1] : 0);
- env->eip += ins->len;
-diff --git a/target/i386/emulate/x86_emu.h b/target/i386/emulate/x86_emu.h
-index a1a961284b..05686b162f 100644
---- a/target/i386/emulate/x86_emu.h
-+++ b/target/i386/emulate/x86_emu.h
-@@ -24,6 +24,8 @@
- #include "cpu.h"
-
- struct x86_emul_ops {
-+ void (*fetch_instruction)(CPUState *cpu, void *data, target_ulong addr,
-+ int bytes);
- void (*read_mem)(CPUState *cpu, void *data, target_ulong addr, int bytes);
- void (*write_mem)(CPUState *cpu, void *data, target_ulong addr, int bytes);
- void (*read_segment_descriptor)(CPUState *cpu, struct x86_segment_descriptor *desc,
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Add-CPU-create-and-remove-logic.patch b/kvm-target-i386-mshv-Add-CPU-create-and-remove-logic.patch
deleted file mode 100644
index a5f72f5..0000000
--- a/kvm-target-i386-mshv-Add-CPU-create-and-remove-logic.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-From 890cb9e42509e42471bc48dc6ddf0283a0b5e8f5 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:32 +0200
-Subject: [PATCH 15/32] target/i386/mshv: Add CPU create and remove logic
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [13/30] cdb6e3cec7a38a6328be8facbbdf19fd0fd9ec78
-
-Implement MSHV-specific hooks for vCPU creation and teardown in the
-i386 target.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-13-magnuskulke@linux.microsoft.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 4ed605c06e743b2ec0bfe35954d88b8c64dd3767)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- target/i386/mshv/mshv-cpu.c | 23 +++++++++++++++++------
- 1 file changed, 17 insertions(+), 6 deletions(-)
-
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 02d71ebc14..5069ab7a22 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -30,6 +30,8 @@
- #include "trace-accel_mshv.h"
- #include "trace.h"
-
-+#include <sys/ioctl.h>
-+
- int mshv_store_regs(CPUState *cpu)
- {
- error_report("unimplemented");
-@@ -62,20 +64,29 @@ int mshv_run_vcpu(int vm_fd, CPUState *cpu, hv_message *msg, MshvVmExit *exit)
-
- void mshv_remove_vcpu(int vm_fd, int cpu_fd)
- {
-- error_report("unimplemented");
-- abort();
-+ close(cpu_fd);
- }
-
-+
- int mshv_create_vcpu(int vm_fd, uint8_t vp_index, int *cpu_fd)
- {
-- error_report("unimplemented");
-- abort();
-+ int ret;
-+ struct mshv_create_vp vp_arg = {
-+ .vp_index = vp_index,
-+ };
-+ ret = ioctl(vm_fd, MSHV_CREATE_VP, &vp_arg);
-+ if (ret < 0) {
-+ error_report("failed to create mshv vcpu: %s", strerror(errno));
-+ return -1;
-+ }
-+
-+ *cpu_fd = ret;
-+
-+ return 0;
- }
-
- void mshv_init_mmio_emu(void)
- {
-- error_report("unimplemented");
-- abort();
- }
-
- void mshv_arch_init_vcpu(CPUState *cpu)
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Add-x86-decoder-emu-implementation.patch b/kvm-target-i386-mshv-Add-x86-decoder-emu-implementation.patch
deleted file mode 100644
index d64687d..0000000
--- a/kvm-target-i386-mshv-Add-x86-decoder-emu-implementation.patch
+++ /dev/null
@@ -1,431 +0,0 @@
-From 84edc1855313a6a06517794e1b2e65e75691725e Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:23 +0200
-Subject: [PATCH 05/32] target/i386/mshv: Add x86 decoder/emu implementation
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [3/30] 8fa2e2f50c18532d98ef3917f624bc3e65ad167d
-
-The MSHV accelerator requires a x86 decoder/emulator in userland to
-emulate MMIO instructions. This change contains the implementations for
-the generalized i386 instruction decoder/emulator.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-4-magnuskulke@linux.microsoft.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 0daf817c80b57e58168309420abf0a8a3d2a60f6)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- include/system/mshv.h | 25 +++
- target/i386/cpu.h | 2 +-
- target/i386/emulate/meson.build | 7 +-
- target/i386/meson.build | 2 +
- target/i386/mshv/meson.build | 7 +
- target/i386/mshv/x86.c | 297 ++++++++++++++++++++++++++++++++
- 6 files changed, 337 insertions(+), 3 deletions(-)
- create mode 100644 include/system/mshv.h
- create mode 100644 target/i386/mshv/meson.build
- create mode 100644 target/i386/mshv/x86.c
-
-diff --git a/include/system/mshv.h b/include/system/mshv.h
-new file mode 100644
-index 0000000000..342f1ef6a9
---- /dev/null
-+++ b/include/system/mshv.h
-@@ -0,0 +1,25 @@
-+/*
-+ * QEMU MSHV support
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * Authors: Ziqiao Zhou <ziqiaozhou@microsoft.com>
-+ * Magnus Kulke <magnuskulke@microsoft.com>
-+ * Jinank Jain <jinankjain@microsoft.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ *
-+ */
-+
-+#ifndef QEMU_MSHV_H
-+#define QEMU_MSHV_H
-+
-+#ifdef COMPILING_PER_TARGET
-+#ifdef CONFIG_MSHV
-+#define CONFIG_MSHV_IS_POSSIBLE
-+#endif
-+#else
-+#define CONFIG_MSHV_IS_POSSIBLE
-+#endif
-+
-+#endif
-diff --git a/target/i386/cpu.h b/target/i386/cpu.h
-index 2187e61654..4b7eae43e1 100644
---- a/target/i386/cpu.h
-+++ b/target/i386/cpu.h
-@@ -2126,7 +2126,7 @@ typedef struct CPUArchState {
- QEMUTimer *xen_periodic_timer;
- QemuMutex xen_timers_lock;
- #endif
--#if defined(CONFIG_HVF)
-+#if defined(CONFIG_HVF) || defined(CONFIG_MSHV)
- void *emu_mmio_buf;
- #endif
-
-diff --git a/target/i386/emulate/meson.build b/target/i386/emulate/meson.build
-index 4edd4f462f..b6dafb6a5b 100644
---- a/target/i386/emulate/meson.build
-+++ b/target/i386/emulate/meson.build
-@@ -1,5 +1,8 @@
--i386_system_ss.add(when: [hvf, 'CONFIG_HVF'], if_true: files(
-+emulator_files = files(
- 'x86_decode.c',
- 'x86_emu.c',
- 'x86_flags.c',
--))
-+)
-+
-+i386_system_ss.add(when: [hvf, 'CONFIG_HVF'], if_true: emulator_files)
-+i386_system_ss.add(when: 'CONFIG_MSHV', if_true: emulator_files)
-diff --git a/target/i386/meson.build b/target/i386/meson.build
-index 092af34e2d..89ba4912aa 100644
---- a/target/i386/meson.build
-+++ b/target/i386/meson.build
-@@ -13,6 +13,7 @@ i386_ss.add(when: 'CONFIG_KVM', if_true: files('host-cpu.c'))
- i386_ss.add(when: 'CONFIG_HVF', if_true: files('host-cpu.c'))
- i386_ss.add(when: 'CONFIG_WHPX', if_true: files('host-cpu.c'))
- i386_ss.add(when: 'CONFIG_NVMM', if_true: files('host-cpu.c'))
-+i386_ss.add(when: 'CONFIG_MSHV', if_true: files('host-cpu.c'))
-
- i386_system_ss = ss.source_set()
- i386_system_ss.add(files(
-@@ -34,6 +35,7 @@ subdir('nvmm')
- subdir('hvf')
- subdir('tcg')
- subdir('emulate')
-+subdir('mshv')
-
- target_arch += {'i386': i386_ss}
- target_system_arch += {'i386': i386_system_ss}
-diff --git a/target/i386/mshv/meson.build b/target/i386/mshv/meson.build
-new file mode 100644
-index 0000000000..8ddaa7c11d
---- /dev/null
-+++ b/target/i386/mshv/meson.build
-@@ -0,0 +1,7 @@
-+i386_mshv_ss = ss.source_set()
-+
-+i386_mshv_ss.add(files(
-+ 'x86.c',
-+))
-+
-+i386_system_ss.add_all(when: 'CONFIG_MSHV', if_true: i386_mshv_ss)
-diff --git a/target/i386/mshv/x86.c b/target/i386/mshv/x86.c
-new file mode 100644
-index 0000000000..d574b3bc52
---- /dev/null
-+++ b/target/i386/mshv/x86.c
-@@ -0,0 +1,297 @@
-+/*
-+ * QEMU MSHV support
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * Authors: Magnus Kulke <magnuskulke@microsoft.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#include "qemu/osdep.h"
-+
-+#include "cpu.h"
-+#include "emulate/x86_decode.h"
-+#include "emulate/x86_emu.h"
-+#include "qemu/typedefs.h"
-+#include "qemu/error-report.h"
-+#include "system/mshv.h"
-+
-+/* RW or Exec segment */
-+static const uint8_t RWRX_SEGMENT_TYPE = 0x2;
-+static const uint8_t CODE_SEGMENT_TYPE = 0x8;
-+static const uint8_t EXPAND_DOWN_SEGMENT_TYPE = 0x4;
-+
-+typedef enum CpuMode {
-+ REAL_MODE,
-+ PROTECTED_MODE,
-+ LONG_MODE,
-+} CpuMode;
-+
-+static CpuMode cpu_mode(CPUState *cpu)
-+{
-+ enum CpuMode m = REAL_MODE;
-+
-+ if (x86_is_protected(cpu)) {
-+ m = PROTECTED_MODE;
-+
-+ if (x86_is_long_mode(cpu)) {
-+ m = LONG_MODE;
-+ }
-+ }
-+
-+ return m;
-+}
-+
-+static bool segment_type_ro(const SegmentCache *seg)
-+{
-+ uint32_t type_ = (seg->flags >> DESC_TYPE_SHIFT) & 15;
-+ return (type_ & (~RWRX_SEGMENT_TYPE)) == 0;
-+}
-+
-+static bool segment_type_code(const SegmentCache *seg)
-+{
-+ uint32_t type_ = (seg->flags >> DESC_TYPE_SHIFT) & 15;
-+ return (type_ & CODE_SEGMENT_TYPE) != 0;
-+}
-+
-+static bool segment_expands_down(const SegmentCache *seg)
-+{
-+ uint32_t type_ = (seg->flags >> DESC_TYPE_SHIFT) & 15;
-+
-+ if (segment_type_code(seg)) {
-+ return false;
-+ }
-+
-+ return (type_ & EXPAND_DOWN_SEGMENT_TYPE) != 0;
-+}
-+
-+static uint32_t segment_limit(const SegmentCache *seg)
-+{
-+ uint32_t limit = seg->limit;
-+ uint32_t granularity = (seg->flags & DESC_G_MASK) != 0;
-+
-+ if (granularity != 0) {
-+ limit = (limit << 12) | 0xFFF;
-+ }
-+
-+ return limit;
-+}
-+
-+static uint8_t segment_db(const SegmentCache *seg)
-+{
-+ return (seg->flags >> DESC_B_SHIFT) & 1;
-+}
-+
-+static uint32_t segment_max_limit(const SegmentCache *seg)
-+{
-+ if (segment_db(seg) != 0) {
-+ return 0xFFFFFFFF;
-+ }
-+ return 0xFFFF;
-+}
-+
-+static int linearize(CPUState *cpu,
-+ target_ulong logical_addr, target_ulong *linear_addr,
-+ X86Seg seg_idx)
-+{
-+ enum CpuMode mode;
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+ SegmentCache *seg = &env->segs[seg_idx];
-+ target_ulong base = seg->base;
-+ target_ulong logical_addr_32b;
-+ uint32_t limit;
-+ /* TODO: the emulator will not pass us "write" indicator yet */
-+ bool write = false;
-+
-+ mode = cpu_mode(cpu);
-+
-+ switch (mode) {
-+ case LONG_MODE:
-+ if (__builtin_add_overflow(logical_addr, base, linear_addr)) {
-+ error_report("Address overflow");
-+ return -1;
-+ }
-+ break;
-+ case PROTECTED_MODE:
-+ case REAL_MODE:
-+ if (segment_type_ro(seg) && write) {
-+ error_report("Cannot write to read-only segment");
-+ return -1;
-+ }
-+
-+ logical_addr_32b = logical_addr & 0xFFFFFFFF;
-+ limit = segment_limit(seg);
-+
-+ if (segment_expands_down(seg)) {
-+ if (logical_addr_32b >= limit) {
-+ error_report("Address exceeds limit (expands down)");
-+ return -1;
-+ }
-+
-+ limit = segment_max_limit(seg);
-+ }
-+
-+ if (logical_addr_32b > limit) {
-+ error_report("Address exceeds limit %u", limit);
-+ return -1;
-+ }
-+ *linear_addr = logical_addr_32b + base;
-+ break;
-+ default:
-+ error_report("Unknown cpu mode: %d", mode);
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+bool x86_read_segment_descriptor(CPUState *cpu,
-+ struct x86_segment_descriptor *desc,
-+ x86_segment_selector sel)
-+{
-+ target_ulong base;
-+ uint32_t limit;
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+ target_ulong gva;
-+
-+ memset(desc, 0, sizeof(*desc));
-+
-+ /* valid gdt descriptors start from index 1 */
-+ if (!sel.index && GDT_SEL == sel.ti) {
-+ return false;
-+ }
-+
-+ if (GDT_SEL == sel.ti) {
-+ base = env->gdt.base;
-+ limit = env->gdt.limit;
-+ } else {
-+ base = env->ldt.base;
-+ limit = env->ldt.limit;
-+ }
-+
-+ if (sel.index * 8 >= limit) {
-+ return false;
-+ }
-+
-+ gva = base + sel.index * 8;
-+ emul_ops->read_mem(cpu, desc, gva, sizeof(*desc));
-+
-+ return true;
-+}
-+
-+bool x86_read_call_gate(CPUState *cpu, struct x86_call_gate *idt_desc,
-+ int gate)
-+{
-+ target_ulong base;
-+ uint32_t limit;
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+ target_ulong gva;
-+
-+ base = env->idt.base;
-+ limit = env->idt.limit;
-+
-+ memset(idt_desc, 0, sizeof(*idt_desc));
-+ if (gate * 8 >= limit) {
-+ perror("call gate exceeds idt limit");
-+ return false;
-+ }
-+
-+ gva = base + gate * 8;
-+ emul_ops->read_mem(cpu, idt_desc, gva, sizeof(*idt_desc));
-+
-+ return true;
-+}
-+
-+bool x86_is_protected(CPUState *cpu)
-+{
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+ uint64_t cr0 = env->cr[0];
-+
-+ return cr0 & CR0_PE_MASK;
-+}
-+
-+bool x86_is_real(CPUState *cpu)
-+{
-+ return !x86_is_protected(cpu);
-+}
-+
-+bool x86_is_v8086(CPUState *cpu)
-+{
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+ return x86_is_protected(cpu) && (env->eflags & VM_MASK);
-+}
-+
-+bool x86_is_long_mode(CPUState *cpu)
-+{
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+ uint64_t efer = env->efer;
-+ uint64_t lme_lma = (MSR_EFER_LME | MSR_EFER_LMA);
-+
-+ return ((efer & lme_lma) == lme_lma);
-+}
-+
-+bool x86_is_long64_mode(CPUState *cpu)
-+{
-+ error_report("unimplemented: is_long64_mode()");
-+ abort();
-+}
-+
-+bool x86_is_paging_mode(CPUState *cpu)
-+{
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+ uint64_t cr0 = env->cr[0];
-+
-+ return cr0 & CR0_PG_MASK;
-+}
-+
-+bool x86_is_pae_enabled(CPUState *cpu)
-+{
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+ uint64_t cr4 = env->cr[4];
-+
-+ return cr4 & CR4_PAE_MASK;
-+}
-+
-+target_ulong linear_addr(CPUState *cpu, target_ulong addr, X86Seg seg)
-+{
-+ int ret;
-+ target_ulong linear_addr;
-+
-+ ret = linearize(cpu, addr, &linear_addr, seg);
-+ if (ret < 0) {
-+ error_report("failed to linearize address");
-+ abort();
-+ }
-+
-+ return linear_addr;
-+}
-+
-+target_ulong linear_addr_size(CPUState *cpu, target_ulong addr, int size,
-+ X86Seg seg)
-+{
-+ switch (size) {
-+ case 2:
-+ addr = (uint16_t)addr;
-+ break;
-+ case 4:
-+ addr = (uint32_t)addr;
-+ break;
-+ default:
-+ break;
-+ }
-+ return linear_addr(cpu, addr, seg);
-+}
-+
-+target_ulong linear_rip(CPUState *cpu, target_ulong rip)
-+{
-+ return linear_addr(cpu, rip, R_CS);
-+}
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Implement-mshv_arch_put_registers.patch b/kvm-target-i386-mshv-Implement-mshv_arch_put_registers.patch
deleted file mode 100644
index b73fa87..0000000
--- a/kvm-target-i386-mshv-Implement-mshv_arch_put_registers.patch
+++ /dev/null
@@ -1,319 +0,0 @@
-From 78ed99e6783511368371defaebda4cc450a6e266 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:36 +0200
-Subject: [PATCH 19/32] target/i386/mshv: Implement mshv_arch_put_registers()
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [17/30] e2648880fed0b7eb9097768c3e4cfc914baa104a
-
-Write CPU register state to MSHV vCPUs. Various mapping functions to
-prepare the payload for the HV call have been implemented.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-17-magnuskulke@linux.microsoft.com
-[mshv.h/mshv_int.h split. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 25a1d871e0f19bbf8fee471af5fefec52465bb09)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- include/system/mshv_int.h | 15 +++
- target/i386/mshv/mshv-cpu.c | 237 ++++++++++++++++++++++++++++++++++++
- 2 files changed, 252 insertions(+)
-
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-index c6e6e8af30..0ea8d504fa 100644
---- a/include/system/mshv_int.h
-+++ b/include/system/mshv_int.h
-@@ -49,6 +49,20 @@ typedef struct MshvMsiControl {
- #define mshv_vcpufd(cpu) (cpu->accel->cpufd)
-
- /* cpu */
-+typedef struct MshvFPU {
-+ uint8_t fpr[8][16];
-+ uint16_t fcw;
-+ uint16_t fsw;
-+ uint8_t ftwx;
-+ uint8_t pad1;
-+ uint16_t last_opcode;
-+ uint64_t last_ip;
-+ uint64_t last_dp;
-+ uint8_t xmm[16][16];
-+ uint32_t mxcsr;
-+ uint32_t pad2;
-+} MshvFPU;
-+
- typedef enum MshvVmExit {
- MshvVmExitIgnore = 0,
- MshvVmExitShutdown = 1,
-@@ -58,6 +72,7 @@ typedef enum MshvVmExit {
- void mshv_init_mmio_emu(void);
- int mshv_create_vcpu(int vm_fd, uint8_t vp_index, int *cpu_fd);
- void mshv_remove_vcpu(int vm_fd, int cpu_fd);
-+int mshv_configure_vcpu(const CPUState *cpu, const MshvFPU *fpu, uint64_t xcr0);
- int mshv_get_standard_regs(CPUState *cpu);
- int mshv_get_special_regs(CPUState *cpu);
- int mshv_run_vcpu(int vm_fd, CPUState *cpu, hv_message *msg, MshvVmExit *exit);
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index bc75686f82..8b10c79e54 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -73,6 +73,35 @@ static enum hv_register_name SPECIAL_REGISTER_NAMES[17] = {
- HV_X64_REGISTER_APIC_BASE,
- };
-
-+static enum hv_register_name FPU_REGISTER_NAMES[26] = {
-+ HV_X64_REGISTER_XMM0,
-+ HV_X64_REGISTER_XMM1,
-+ HV_X64_REGISTER_XMM2,
-+ HV_X64_REGISTER_XMM3,
-+ HV_X64_REGISTER_XMM4,
-+ HV_X64_REGISTER_XMM5,
-+ HV_X64_REGISTER_XMM6,
-+ HV_X64_REGISTER_XMM7,
-+ HV_X64_REGISTER_XMM8,
-+ HV_X64_REGISTER_XMM9,
-+ HV_X64_REGISTER_XMM10,
-+ HV_X64_REGISTER_XMM11,
-+ HV_X64_REGISTER_XMM12,
-+ HV_X64_REGISTER_XMM13,
-+ HV_X64_REGISTER_XMM14,
-+ HV_X64_REGISTER_XMM15,
-+ HV_X64_REGISTER_FP_MMX0,
-+ HV_X64_REGISTER_FP_MMX1,
-+ HV_X64_REGISTER_FP_MMX2,
-+ HV_X64_REGISTER_FP_MMX3,
-+ HV_X64_REGISTER_FP_MMX4,
-+ HV_X64_REGISTER_FP_MMX5,
-+ HV_X64_REGISTER_FP_MMX6,
-+ HV_X64_REGISTER_FP_MMX7,
-+ HV_X64_REGISTER_FP_CONTROL_STATUS,
-+ HV_X64_REGISTER_XMM_CONTROL_STATUS,
-+};
-+
- int mshv_set_generic_regs(const CPUState *cpu, const hv_register_assoc *assocs,
- size_t n_regs)
- {
-@@ -372,8 +401,216 @@ int mshv_load_regs(CPUState *cpu)
- return 0;
- }
-
-+static inline void populate_hv_segment_reg(SegmentCache *seg,
-+ hv_x64_segment_register *hv_reg)
-+{
-+ uint32_t flags = seg->flags;
-+
-+ hv_reg->base = seg->base;
-+ hv_reg->limit = seg->limit;
-+ hv_reg->selector = seg->selector;
-+ hv_reg->segment_type = (flags >> DESC_TYPE_SHIFT) & 0xF;
-+ hv_reg->non_system_segment = (flags & DESC_S_MASK) != 0;
-+ hv_reg->descriptor_privilege_level = (flags >> DESC_DPL_SHIFT) & 0x3;
-+ hv_reg->present = (flags & DESC_P_MASK) != 0;
-+ hv_reg->reserved = 0;
-+ hv_reg->available = (flags & DESC_AVL_MASK) != 0;
-+ hv_reg->_long = (flags >> DESC_L_SHIFT) & 0x1;
-+ hv_reg->_default = (flags >> DESC_B_SHIFT) & 0x1;
-+ hv_reg->granularity = (flags & DESC_G_MASK) != 0;
-+}
-+
-+static inline void populate_hv_table_reg(const struct SegmentCache *seg,
-+ hv_x64_table_register *hv_reg)
-+{
-+ memset(hv_reg, 0, sizeof(*hv_reg));
-+
-+ hv_reg->base = seg->base;
-+ hv_reg->limit = seg->limit;
-+}
-+
-+static int set_special_regs(const CPUState *cpu)
-+{
-+ X86CPU *x86cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86cpu->env;
-+ struct hv_register_assoc assocs[ARRAY_SIZE(SPECIAL_REGISTER_NAMES)];
-+ size_t n_regs = ARRAY_SIZE(SPECIAL_REGISTER_NAMES);
-+ int ret;
-+
-+ /* set names */
-+ for (size_t i = 0; i < n_regs; i++) {
-+ assocs[i].name = SPECIAL_REGISTER_NAMES[i];
-+ }
-+ populate_hv_segment_reg(&env->segs[R_CS], &assocs[0].value.segment);
-+ populate_hv_segment_reg(&env->segs[R_DS], &assocs[1].value.segment);
-+ populate_hv_segment_reg(&env->segs[R_ES], &assocs[2].value.segment);
-+ populate_hv_segment_reg(&env->segs[R_FS], &assocs[3].value.segment);
-+ populate_hv_segment_reg(&env->segs[R_GS], &assocs[4].value.segment);
-+ populate_hv_segment_reg(&env->segs[R_SS], &assocs[5].value.segment);
-+ populate_hv_segment_reg(&env->tr, &assocs[6].value.segment);
-+ populate_hv_segment_reg(&env->ldt, &assocs[7].value.segment);
-+
-+ populate_hv_table_reg(&env->gdt, &assocs[8].value.table);
-+ populate_hv_table_reg(&env->idt, &assocs[9].value.table);
-+
-+ assocs[10].value.reg64 = env->cr[0];
-+ assocs[11].value.reg64 = env->cr[2];
-+ assocs[12].value.reg64 = env->cr[3];
-+ assocs[13].value.reg64 = env->cr[4];
-+ assocs[14].value.reg64 = cpu_get_apic_tpr(x86cpu->apic_state);
-+ assocs[15].value.reg64 = env->efer;
-+ assocs[16].value.reg64 = cpu_get_apic_base(x86cpu->apic_state);
-+
-+ ret = mshv_set_generic_regs(cpu, assocs, n_regs);
-+ if (ret < 0) {
-+ error_report("failed to set special registers");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int set_fpu(const CPUState *cpu, const struct MshvFPU *regs)
-+{
-+ struct hv_register_assoc assocs[ARRAY_SIZE(FPU_REGISTER_NAMES)];
-+ union hv_register_value *value;
-+ size_t fp_i;
-+ union hv_x64_fp_control_status_register *ctrl_status;
-+ union hv_x64_xmm_control_status_register *xmm_ctrl_status;
-+ int ret;
-+ size_t n_regs = ARRAY_SIZE(FPU_REGISTER_NAMES);
-+
-+ /* first 16 registers are xmm0-xmm15 */
-+ for (size_t i = 0; i < 16; i++) {
-+ assocs[i].name = FPU_REGISTER_NAMES[i];
-+ value = &assocs[i].value;
-+ memcpy(&value->reg128, ®s->xmm[i], 16);
-+ }
-+
-+ /* next 8 registers are fp_mmx0-fp_mmx7 */
-+ for (size_t i = 16; i < 24; i++) {
-+ assocs[i].name = FPU_REGISTER_NAMES[i];
-+ fp_i = (i - 16);
-+ value = &assocs[i].value;
-+ memcpy(&value->reg128, ®s->fpr[fp_i], 16);
-+ }
-+
-+ /* last two registers are fp_control_status and xmm_control_status */
-+ assocs[24].name = FPU_REGISTER_NAMES[24];
-+ value = &assocs[24].value;
-+ ctrl_status = &value->fp_control_status;
-+ ctrl_status->fp_control = regs->fcw;
-+ ctrl_status->fp_status = regs->fsw;
-+ ctrl_status->fp_tag = regs->ftwx;
-+ ctrl_status->reserved = 0;
-+ ctrl_status->last_fp_op = regs->last_opcode;
-+ ctrl_status->last_fp_rip = regs->last_ip;
-+
-+ assocs[25].name = FPU_REGISTER_NAMES[25];
-+ value = &assocs[25].value;
-+ xmm_ctrl_status = &value->xmm_control_status;
-+ xmm_ctrl_status->xmm_status_control = regs->mxcsr;
-+ xmm_ctrl_status->xmm_status_control_mask = 0;
-+ xmm_ctrl_status->last_fp_rdp = regs->last_dp;
-+
-+ ret = mshv_set_generic_regs(cpu, assocs, n_regs);
-+ if (ret < 0) {
-+ error_report("failed to set fpu registers");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int set_xc_reg(const CPUState *cpu, uint64_t xcr0)
-+{
-+ int ret;
-+ struct hv_register_assoc assoc = {
-+ .name = HV_X64_REGISTER_XFEM,
-+ .value.reg64 = xcr0,
-+ };
-+
-+ ret = mshv_set_generic_regs(cpu, &assoc, 1);
-+ if (ret < 0) {
-+ error_report("failed to set xcr0");
-+ return -errno;
-+ }
-+ return 0;
-+}
-+
-+static int set_cpu_state(const CPUState *cpu, const MshvFPU *fpu_regs,
-+ uint64_t xcr0)
-+{
-+ int ret;
-+
-+ ret = set_standard_regs(cpu);
-+ if (ret < 0) {
-+ return ret;
-+ }
-+ ret = set_special_regs(cpu);
-+ if (ret < 0) {
-+ return ret;
-+ }
-+ ret = set_fpu(cpu, fpu_regs);
-+ if (ret < 0) {
-+ return ret;
-+ }
-+ ret = set_xc_reg(cpu, xcr0);
-+ if (ret < 0) {
-+ return ret;
-+ }
-+ return 0;
-+}
-+
-+/*
-+ * TODO: populate topology info:
-+ *
-+ * X86CPU *x86cpu = X86_CPU(cpu);
-+ * CPUX86State *env = &x86cpu->env;
-+ * X86CPUTopoInfo *topo_info = &env->topo_info;
-+ */
-+int mshv_configure_vcpu(const CPUState *cpu, const struct MshvFPU *fpu,
-+ uint64_t xcr0)
-+{
-+ int ret;
-+
-+ ret = set_cpu_state(cpu, fpu, xcr0);
-+ if (ret < 0) {
-+ error_report("failed to set cpu state");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int put_regs(const CPUState *cpu)
-+{
-+ X86CPU *x86cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86cpu->env;
-+ MshvFPU fpu = {0};
-+ int ret;
-+
-+ memset(&fpu, 0, sizeof(fpu));
-+
-+ ret = mshv_configure_vcpu(cpu, &fpu, env->xcr0);
-+ if (ret < 0) {
-+ error_report("failed to configure vcpu");
-+ return ret;
-+ }
-+
-+ return 0;
-+}
-+
- int mshv_arch_put_registers(const CPUState *cpu)
- {
-+ int ret;
-+
-+ ret = put_regs(cpu);
-+ if (ret < 0) {
-+ error_report("Failed to put registers");
-+ return -1;
-+ }
-+
- error_report("unimplemented");
- abort();
- }
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Implement-mshv_get_special_regs.patch b/kvm-target-i386-mshv-Implement-mshv_get_special_regs.patch
deleted file mode 100644
index 9cede6e..0000000
--- a/kvm-target-i386-mshv-Implement-mshv_get_special_regs.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-From 30862bd55b3d5c95a051638ec49013e64596f46d Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:35 +0200
-Subject: [PATCH 18/32] target/i386/mshv: Implement mshv_get_special_regs()
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [16/30] 429625fae745bc6c3c9e9412741c875331a92180
-
-Retrieve special registers (e.g. segment, control, and descriptor
-table registers) from MSHV vCPUs.
-
-Various helper functions to map register state representations between
-Qemu and MSHV are introduced.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-16-magnuskulke@linux.microsoft.com
-[mshv.h/mshv_int.h split. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 0382c2c8544da66619d16988caaab8e3d9e881d4)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- include/system/mshv_int.h | 1 +
- target/i386/mshv/mshv-cpu.c | 104 ++++++++++++++++++++++++++++++++++++
- 2 files changed, 105 insertions(+)
-
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-index b0a79296ad..c6e6e8af30 100644
---- a/include/system/mshv_int.h
-+++ b/include/system/mshv_int.h
-@@ -59,6 +59,7 @@ void mshv_init_mmio_emu(void);
- int mshv_create_vcpu(int vm_fd, uint8_t vp_index, int *cpu_fd);
- void mshv_remove_vcpu(int vm_fd, int cpu_fd);
- int mshv_get_standard_regs(CPUState *cpu);
-+int mshv_get_special_regs(CPUState *cpu);
- int mshv_run_vcpu(int vm_fd, CPUState *cpu, hv_message *msg, MshvVmExit *exit);
- int mshv_load_regs(CPUState *cpu);
- int mshv_store_regs(CPUState *cpu);
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 4e3eee113b..bc75686f82 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -53,6 +53,26 @@ static enum hv_register_name STANDARD_REGISTER_NAMES[18] = {
- HV_X64_REGISTER_RFLAGS,
- };
-
-+static enum hv_register_name SPECIAL_REGISTER_NAMES[17] = {
-+ HV_X64_REGISTER_CS,
-+ HV_X64_REGISTER_DS,
-+ HV_X64_REGISTER_ES,
-+ HV_X64_REGISTER_FS,
-+ HV_X64_REGISTER_GS,
-+ HV_X64_REGISTER_SS,
-+ HV_X64_REGISTER_TR,
-+ HV_X64_REGISTER_LDTR,
-+ HV_X64_REGISTER_GDTR,
-+ HV_X64_REGISTER_IDTR,
-+ HV_X64_REGISTER_CR0,
-+ HV_X64_REGISTER_CR2,
-+ HV_X64_REGISTER_CR3,
-+ HV_X64_REGISTER_CR4,
-+ HV_X64_REGISTER_CR8,
-+ HV_X64_REGISTER_EFER,
-+ HV_X64_REGISTER_APIC_BASE,
-+};
-+
- int mshv_set_generic_regs(const CPUState *cpu, const hv_register_assoc *assocs,
- size_t n_regs)
- {
-@@ -255,6 +275,84 @@ int mshv_get_standard_regs(CPUState *cpu)
- return 0;
- }
-
-+static inline void populate_segment_reg(const hv_x64_segment_register *hv_seg,
-+ SegmentCache *seg)
-+{
-+ memset(seg, 0, sizeof(SegmentCache));
-+
-+ seg->base = hv_seg->base;
-+ seg->limit = hv_seg->limit;
-+ seg->selector = hv_seg->selector;
-+
-+ seg->flags = (hv_seg->segment_type << DESC_TYPE_SHIFT)
-+ | (hv_seg->present * DESC_P_MASK)
-+ | (hv_seg->descriptor_privilege_level << DESC_DPL_SHIFT)
-+ | (hv_seg->_default << DESC_B_SHIFT)
-+ | (hv_seg->non_system_segment * DESC_S_MASK)
-+ | (hv_seg->_long << DESC_L_SHIFT)
-+ | (hv_seg->granularity * DESC_G_MASK)
-+ | (hv_seg->available * DESC_AVL_MASK);
-+
-+}
-+
-+static inline void populate_table_reg(const hv_x64_table_register *hv_seg,
-+ SegmentCache *tbl)
-+{
-+ memset(tbl, 0, sizeof(SegmentCache));
-+
-+ tbl->base = hv_seg->base;
-+ tbl->limit = hv_seg->limit;
-+}
-+
-+static void populate_special_regs(const hv_register_assoc *assocs,
-+ X86CPU *x86cpu)
-+{
-+ CPUX86State *env = &x86cpu->env;
-+
-+ populate_segment_reg(&assocs[0].value.segment, &env->segs[R_CS]);
-+ populate_segment_reg(&assocs[1].value.segment, &env->segs[R_DS]);
-+ populate_segment_reg(&assocs[2].value.segment, &env->segs[R_ES]);
-+ populate_segment_reg(&assocs[3].value.segment, &env->segs[R_FS]);
-+ populate_segment_reg(&assocs[4].value.segment, &env->segs[R_GS]);
-+ populate_segment_reg(&assocs[5].value.segment, &env->segs[R_SS]);
-+
-+ populate_segment_reg(&assocs[6].value.segment, &env->tr);
-+ populate_segment_reg(&assocs[7].value.segment, &env->ldt);
-+
-+ populate_table_reg(&assocs[8].value.table, &env->gdt);
-+ populate_table_reg(&assocs[9].value.table, &env->idt);
-+
-+ env->cr[0] = assocs[10].value.reg64;
-+ env->cr[2] = assocs[11].value.reg64;
-+ env->cr[3] = assocs[12].value.reg64;
-+ env->cr[4] = assocs[13].value.reg64;
-+
-+ cpu_set_apic_tpr(x86cpu->apic_state, assocs[14].value.reg64);
-+ env->efer = assocs[15].value.reg64;
-+ cpu_set_apic_base(x86cpu->apic_state, assocs[16].value.reg64);
-+}
-+
-+
-+int mshv_get_special_regs(CPUState *cpu)
-+{
-+ struct hv_register_assoc assocs[ARRAY_SIZE(SPECIAL_REGISTER_NAMES)];
-+ int ret;
-+ X86CPU *x86cpu = X86_CPU(cpu);
-+ size_t n_regs = ARRAY_SIZE(SPECIAL_REGISTER_NAMES);
-+
-+ for (size_t i = 0; i < n_regs; i++) {
-+ assocs[i].name = SPECIAL_REGISTER_NAMES[i];
-+ }
-+ ret = get_generic_regs(cpu, assocs, n_regs);
-+ if (ret < 0) {
-+ error_report("failed to get special registers");
-+ return -errno;
-+ }
-+
-+ populate_special_regs(assocs, x86cpu);
-+ return 0;
-+}
-+
- int mshv_load_regs(CPUState *cpu)
- {
- int ret;
-@@ -265,6 +363,12 @@ int mshv_load_regs(CPUState *cpu)
- return -1;
- }
-
-+ ret = mshv_get_special_regs(cpu);
-+ if (ret < 0) {
-+ error_report("Failed to load special registers");
-+ return -1;
-+ }
-+
- return 0;
- }
-
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Implement-mshv_get_standard_regs.patch b/kvm-target-i386-mshv-Implement-mshv_get_standard_regs.patch
deleted file mode 100644
index e68b281..0000000
--- a/kvm-target-i386-mshv-Implement-mshv_get_standard_regs.patch
+++ /dev/null
@@ -1,182 +0,0 @@
-From 11393f9a7ff5fa2ec3182025fe5ba052d5fecee0 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:34 +0200
-Subject: [PATCH 17/32] target/i386/mshv: Implement mshv_get_standard_regs()
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [15/30] ccb135407183081206513dd2de2410a9c1768f15
-
-Fetch standard register state from MSHV vCPUs to support debugging,
-migration, and other introspection features in QEMU.
-
-Fetch standard register state from a MHSV vCPU's. A generic get_regs()
-function and a mapper to map the different register representations are
-introduced.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-15-magnuskulke@linux.microsoft.com
-[mshv.h/mshv_int.h split. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 66480a048a01fc833ba153410282609f26166141)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- include/system/mshv_int.h | 1 +
- target/i386/mshv/mshv-cpu.c | 116 +++++++++++++++++++++++++++++++++++-
- 2 files changed, 115 insertions(+), 2 deletions(-)
-
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-index 731841af92..b0a79296ad 100644
---- a/include/system/mshv_int.h
-+++ b/include/system/mshv_int.h
-@@ -58,6 +58,7 @@ typedef enum MshvVmExit {
- void mshv_init_mmio_emu(void);
- int mshv_create_vcpu(int vm_fd, uint8_t vp_index, int *cpu_fd);
- void mshv_remove_vcpu(int vm_fd, int cpu_fd);
-+int mshv_get_standard_regs(CPUState *cpu);
- int mshv_run_vcpu(int vm_fd, CPUState *cpu, hv_message *msg, MshvVmExit *exit);
- int mshv_load_regs(CPUState *cpu);
- int mshv_store_regs(CPUState *cpu);
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 9ead03ca2d..4e3eee113b 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -96,6 +96,66 @@ int mshv_set_generic_regs(const CPUState *cpu, const hv_register_assoc *assocs,
- return 0;
- }
-
-+static int get_generic_regs(CPUState *cpu, hv_register_assoc *assocs,
-+ size_t n_regs)
-+{
-+ int cpu_fd = mshv_vcpufd(cpu);
-+ int vp_index = cpu->cpu_index;
-+ hv_input_get_vp_registers *in;
-+ hv_register_value *values;
-+ size_t in_sz, names_sz, values_sz;
-+ int i, ret;
-+ struct mshv_root_hvcall args = {0};
-+
-+ /* find out the size of the struct w/ a flexible array at the tail */
-+ names_sz = n_regs * sizeof(hv_register_name);
-+ in_sz = sizeof(hv_input_get_vp_registers) + names_sz;
-+
-+ /* fill the input struct */
-+ in = g_malloc0(in_sz);
-+ in->vp_index = vp_index;
-+ for (i = 0; i < n_regs; i++) {
-+ in->names[i] = assocs[i].name;
-+ }
-+
-+ /* allocate value output buffer */
-+ values_sz = n_regs * sizeof(union hv_register_value);
-+ values = g_malloc0(values_sz);
-+
-+ /* create the hvcall envelope */
-+ args.code = HVCALL_GET_VP_REGISTERS;
-+ args.in_sz = in_sz;
-+ args.in_ptr = (uint64_t) in;
-+ args.out_sz = values_sz;
-+ args.out_ptr = (uint64_t) values;
-+ args.reps = (uint16_t) n_regs;
-+
-+ /* perform the call */
-+ ret = mshv_hvcall(cpu_fd, &args);
-+ g_free(in);
-+ if (ret < 0) {
-+ g_free(values);
-+ error_report("Failed to retrieve registers");
-+ return -1;
-+ }
-+
-+ /* assert we got all registers */
-+ if (args.reps != n_regs) {
-+ g_free(values);
-+ error_report("Failed to retrieve registers: expected %zu elements"
-+ ", got %u", n_regs, args.reps);
-+ return -1;
-+ }
-+
-+ /* copy values into assoc */
-+ for (i = 0; i < n_regs; i++) {
-+ assocs[i].value = values[i];
-+ }
-+ g_free(values);
-+
-+ return 0;
-+}
-+
- static int set_standard_regs(const CPUState *cpu)
- {
- X86CPU *x86cpu = X86_CPU(cpu);
-@@ -149,11 +209,63 @@ int mshv_store_regs(CPUState *cpu)
- return 0;
- }
-
-+static void populate_standard_regs(const hv_register_assoc *assocs,
-+ CPUX86State *env)
-+{
-+ env->regs[R_EAX] = assocs[0].value.reg64;
-+ env->regs[R_EBX] = assocs[1].value.reg64;
-+ env->regs[R_ECX] = assocs[2].value.reg64;
-+ env->regs[R_EDX] = assocs[3].value.reg64;
-+ env->regs[R_ESI] = assocs[4].value.reg64;
-+ env->regs[R_EDI] = assocs[5].value.reg64;
-+ env->regs[R_ESP] = assocs[6].value.reg64;
-+ env->regs[R_EBP] = assocs[7].value.reg64;
-+ env->regs[R_R8] = assocs[8].value.reg64;
-+ env->regs[R_R9] = assocs[9].value.reg64;
-+ env->regs[R_R10] = assocs[10].value.reg64;
-+ env->regs[R_R11] = assocs[11].value.reg64;
-+ env->regs[R_R12] = assocs[12].value.reg64;
-+ env->regs[R_R13] = assocs[13].value.reg64;
-+ env->regs[R_R14] = assocs[14].value.reg64;
-+ env->regs[R_R15] = assocs[15].value.reg64;
-+
-+ env->eip = assocs[16].value.reg64;
-+ env->eflags = assocs[17].value.reg64;
-+ rflags_to_lflags(env);
-+}
-+
-+int mshv_get_standard_regs(CPUState *cpu)
-+{
-+ struct hv_register_assoc assocs[ARRAY_SIZE(STANDARD_REGISTER_NAMES)];
-+ int ret;
-+ X86CPU *x86cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86cpu->env;
-+ size_t n_regs = ARRAY_SIZE(STANDARD_REGISTER_NAMES);
-+
-+ for (size_t i = 0; i < n_regs; i++) {
-+ assocs[i].name = STANDARD_REGISTER_NAMES[i];
-+ }
-+ ret = get_generic_regs(cpu, assocs, n_regs);
-+ if (ret < 0) {
-+ error_report("failed to get standard registers");
-+ return -1;
-+ }
-+
-+ populate_standard_regs(assocs, env);
-+ return 0;
-+}
-
- int mshv_load_regs(CPUState *cpu)
- {
-- error_report("unimplemented");
-- abort();
-+ int ret;
-+
-+ ret = mshv_get_standard_regs(cpu);
-+ if (ret < 0) {
-+ error_report("Failed to load standard registers");
-+ return -1;
-+ }
-+
-+ return 0;
- }
-
- int mshv_arch_put_registers(const CPUState *cpu)
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Implement-mshv_store_regs.patch b/kvm-target-i386-mshv-Implement-mshv_store_regs.patch
deleted file mode 100644
index aa3e8d0..0000000
--- a/kvm-target-i386-mshv-Implement-mshv_store_regs.patch
+++ /dev/null
@@ -1,188 +0,0 @@
-From 00d2e933423d093c34265d5e8056461308a738f3 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Thu, 2 Oct 2025 18:13:31 +0200
-Subject: [PATCH 16/32] target/i386/mshv: Implement mshv_store_regs()
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [14/30] 2f4fe2c0b042ec06d351929a7b090e554a459be1
-
-Add support for writing general-purpose registers to MSHV vCPUs
-during initialization or migration using the MSHV register interface. A
-generic set_register call is introduced to abstract the HV call over
-the various register types.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-14-magnuskulke@linux.microsoft.com
-[mshv.h/mshv_int.h split. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 2bd7a6aa4743ee85c77c0520e8b422b3bfeab386)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- include/system/mshv.h | 1 +
- include/system/mshv_int.h | 2 +
- target/i386/mshv/mshv-cpu.c | 116 +++++++++++++++++++++++++++++++++++-
- 3 files changed, 117 insertions(+), 2 deletions(-)
-
-diff --git a/include/system/mshv.h b/include/system/mshv.h
-index bbc42f4dc3..8b1fc20c80 100644
---- a/include/system/mshv.h
-+++ b/include/system/mshv.h
-@@ -18,6 +18,7 @@
- #include "qemu/accel.h"
- #include "hw/hyperv/hyperv-proto.h"
- #include "hw/hyperv/hvhdk.h"
-+#include "hw/hyperv/hvgdk_mini.h"
- #include "qapi/qapi-types-common.h"
- #include "system/memory.h"
- #include "accel/accel-ops.h"
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-index fb80f69772..731841af92 100644
---- a/include/system/mshv_int.h
-+++ b/include/system/mshv_int.h
-@@ -61,6 +61,8 @@ void mshv_remove_vcpu(int vm_fd, int cpu_fd);
- int mshv_run_vcpu(int vm_fd, CPUState *cpu, hv_message *msg, MshvVmExit *exit);
- int mshv_load_regs(CPUState *cpu);
- int mshv_store_regs(CPUState *cpu);
-+int mshv_set_generic_regs(const CPUState *cpu, const hv_register_assoc *assocs,
-+ size_t n_regs);
- int mshv_arch_put_registers(const CPUState *cpu);
- void mshv_arch_init_vcpu(CPUState *cpu);
- void mshv_arch_destroy_vcpu(CPUState *cpu);
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 5069ab7a22..9ead03ca2d 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -32,12 +32,124 @@
-
- #include <sys/ioctl.h>
-
-+static enum hv_register_name STANDARD_REGISTER_NAMES[18] = {
-+ HV_X64_REGISTER_RAX,
-+ HV_X64_REGISTER_RBX,
-+ HV_X64_REGISTER_RCX,
-+ HV_X64_REGISTER_RDX,
-+ HV_X64_REGISTER_RSI,
-+ HV_X64_REGISTER_RDI,
-+ HV_X64_REGISTER_RSP,
-+ HV_X64_REGISTER_RBP,
-+ HV_X64_REGISTER_R8,
-+ HV_X64_REGISTER_R9,
-+ HV_X64_REGISTER_R10,
-+ HV_X64_REGISTER_R11,
-+ HV_X64_REGISTER_R12,
-+ HV_X64_REGISTER_R13,
-+ HV_X64_REGISTER_R14,
-+ HV_X64_REGISTER_R15,
-+ HV_X64_REGISTER_RIP,
-+ HV_X64_REGISTER_RFLAGS,
-+};
-+
-+int mshv_set_generic_regs(const CPUState *cpu, const hv_register_assoc *assocs,
-+ size_t n_regs)
-+{
-+ int cpu_fd = mshv_vcpufd(cpu);
-+ int vp_index = cpu->cpu_index;
-+ size_t in_sz, assocs_sz;
-+ hv_input_set_vp_registers *in;
-+ struct mshv_root_hvcall args = {0};
-+ int ret;
-+
-+ /* find out the size of the struct w/ a flexible array at the tail */
-+ assocs_sz = n_regs * sizeof(hv_register_assoc);
-+ in_sz = sizeof(hv_input_set_vp_registers) + assocs_sz;
-+
-+ /* fill the input struct */
-+ in = g_malloc0(in_sz);
-+ in->vp_index = vp_index;
-+ memcpy(in->elements, assocs, assocs_sz);
-+
-+ /* create the hvcall envelope */
-+ args.code = HVCALL_SET_VP_REGISTERS;
-+ args.in_sz = in_sz;
-+ args.in_ptr = (uint64_t) in;
-+ args.reps = (uint16_t) n_regs;
-+
-+ /* perform the call */
-+ ret = mshv_hvcall(cpu_fd, &args);
-+ g_free(in);
-+ if (ret < 0) {
-+ error_report("Failed to set registers");
-+ return -1;
-+ }
-+
-+ /* assert we set all registers */
-+ if (args.reps != n_regs) {
-+ error_report("Failed to set registers: expected %zu elements"
-+ ", got %u", n_regs, args.reps);
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int set_standard_regs(const CPUState *cpu)
-+{
-+ X86CPU *x86cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86cpu->env;
-+ hv_register_assoc assocs[ARRAY_SIZE(STANDARD_REGISTER_NAMES)];
-+ int ret;
-+ size_t n_regs = ARRAY_SIZE(STANDARD_REGISTER_NAMES);
-+
-+ /* set names */
-+ for (size_t i = 0; i < ARRAY_SIZE(STANDARD_REGISTER_NAMES); i++) {
-+ assocs[i].name = STANDARD_REGISTER_NAMES[i];
-+ }
-+ assocs[0].value.reg64 = env->regs[R_EAX];
-+ assocs[1].value.reg64 = env->regs[R_EBX];
-+ assocs[2].value.reg64 = env->regs[R_ECX];
-+ assocs[3].value.reg64 = env->regs[R_EDX];
-+ assocs[4].value.reg64 = env->regs[R_ESI];
-+ assocs[5].value.reg64 = env->regs[R_EDI];
-+ assocs[6].value.reg64 = env->regs[R_ESP];
-+ assocs[7].value.reg64 = env->regs[R_EBP];
-+ assocs[8].value.reg64 = env->regs[R_R8];
-+ assocs[9].value.reg64 = env->regs[R_R9];
-+ assocs[10].value.reg64 = env->regs[R_R10];
-+ assocs[11].value.reg64 = env->regs[R_R11];
-+ assocs[12].value.reg64 = env->regs[R_R12];
-+ assocs[13].value.reg64 = env->regs[R_R13];
-+ assocs[14].value.reg64 = env->regs[R_R14];
-+ assocs[15].value.reg64 = env->regs[R_R15];
-+ assocs[16].value.reg64 = env->eip;
-+ lflags_to_rflags(env);
-+ assocs[17].value.reg64 = env->eflags;
-+
-+ ret = mshv_set_generic_regs(cpu, assocs, n_regs);
-+ if (ret < 0) {
-+ error_report("failed to set standard registers");
-+ return -errno;
-+ }
-+ return 0;
-+}
-+
- int mshv_store_regs(CPUState *cpu)
- {
-- error_report("unimplemented");
-- abort();
-+ int ret;
-+
-+ ret = set_standard_regs(cpu);
-+ if (ret < 0) {
-+ error_report("Failed to store standard registers");
-+ return -1;
-+ }
-+
-+ return 0;
- }
-
-+
- int mshv_load_regs(CPUState *cpu)
- {
- error_report("unimplemented");
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Implement-mshv_vcpu_run.patch b/kvm-target-i386-mshv-Implement-mshv_vcpu_run.patch
deleted file mode 100644
index b76928c..0000000
--- a/kvm-target-i386-mshv-Implement-mshv_vcpu_run.patch
+++ /dev/null
@@ -1,489 +0,0 @@
-From 334e33f443ce36355a29909ee41f49789ddae6d4 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:42 +0200
-Subject: [PATCH 25/32] target/i386/mshv: Implement mshv_vcpu_run()
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [23/30] f21e5df491be51f4256237f9497fbc73f44cc386
-
-Add the main vCPU execution loop for MSHV using the MSHV_RUN_VP ioctl.
-
-The execution loop handles guest entry and VM exits. There are handlers for
-memory r/w, PIO and MMIO to which the exit events are dispatched.
-
-In case of MMIO the i386 instruction decoder/emulator is invoked to
-perform the operation in user space.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-23-magnuskulke@linux.microsoft.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 6dec60528c419781f1f79cd9837d5f26415a3fd7)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- target/i386/mshv/mshv-cpu.c | 444 +++++++++++++++++++++++++++++++++++-
- 1 file changed, 442 insertions(+), 2 deletions(-)
-
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 33a3ce8b11..7edc032cea 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -1082,10 +1082,450 @@ void mshv_arch_amend_proc_features(
- features->access_guest_idle_reg = 1;
- }
-
-+static int set_memory_info(const struct hyperv_message *msg,
-+ struct hv_x64_memory_intercept_message *info)
-+{
-+ if (msg->header.message_type != HVMSG_GPA_INTERCEPT
-+ && msg->header.message_type != HVMSG_UNMAPPED_GPA
-+ && msg->header.message_type != HVMSG_UNACCEPTED_GPA) {
-+ error_report("invalid message type");
-+ return -1;
-+ }
-+ memcpy(info, msg->payload, sizeof(*info));
-+
-+ return 0;
-+}
-+
-+static int emulate_instruction(CPUState *cpu,
-+ const uint8_t *insn_bytes, size_t insn_len,
-+ uint64_t gva, uint64_t gpa)
-+{
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+ struct x86_decode decode = { 0 };
-+ int ret;
-+ x86_insn_stream stream = { .bytes = insn_bytes, .len = insn_len };
-+
-+ ret = mshv_load_regs(cpu);
-+ if (ret < 0) {
-+ error_report("failed to load registers");
-+ return -1;
-+ }
-+
-+ decode_instruction_stream(env, &decode, &stream);
-+ exec_instruction(env, &decode);
-+
-+ ret = mshv_store_regs(cpu);
-+ if (ret < 0) {
-+ error_report("failed to store registers");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int handle_mmio(CPUState *cpu, const struct hyperv_message *msg,
-+ MshvVmExit *exit_reason)
-+{
-+ struct hv_x64_memory_intercept_message info = { 0 };
-+ size_t insn_len;
-+ uint8_t access_type;
-+ uint8_t *instruction_bytes;
-+ int ret;
-+
-+ ret = set_memory_info(msg, &info);
-+ if (ret < 0) {
-+ error_report("failed to convert message to memory info");
-+ return -1;
-+ }
-+ insn_len = info.instruction_byte_count;
-+ access_type = info.header.intercept_access_type;
-+
-+ if (access_type == HV_X64_INTERCEPT_ACCESS_TYPE_EXECUTE) {
-+ error_report("invalid intercept access type: execute");
-+ return -1;
-+ }
-+
-+ if (insn_len > 16) {
-+ error_report("invalid mmio instruction length: %zu", insn_len);
-+ return -1;
-+ }
-+
-+ trace_mshv_handle_mmio(info.guest_virtual_address,
-+ info.guest_physical_address,
-+ info.instruction_byte_count, access_type);
-+
-+ instruction_bytes = info.instruction_bytes;
-+
-+ ret = emulate_instruction(cpu, instruction_bytes, insn_len,
-+ info.guest_virtual_address,
-+ info.guest_physical_address);
-+ if (ret < 0) {
-+ error_report("failed to emulate mmio");
-+ return -1;
-+ }
-+
-+ *exit_reason = MshvVmExitIgnore;
-+
-+ return 0;
-+}
-+
-+static int set_ioport_info(const struct hyperv_message *msg,
-+ hv_x64_io_port_intercept_message *info)
-+{
-+ if (msg->header.message_type != HVMSG_X64_IO_PORT_INTERCEPT) {
-+ error_report("Invalid message type");
-+ return -1;
-+ }
-+ memcpy(info, msg->payload, sizeof(*info));
-+
-+ return 0;
-+}
-+
-+static int set_x64_registers(const CPUState *cpu, const uint32_t *names,
-+ const uint64_t *values)
-+{
-+
-+ hv_register_assoc assocs[2];
-+ int ret;
-+
-+ for (size_t i = 0; i < ARRAY_SIZE(assocs); i++) {
-+ assocs[i].name = names[i];
-+ assocs[i].value.reg64 = values[i];
-+ }
-+
-+ ret = mshv_set_generic_regs(cpu, assocs, ARRAY_SIZE(assocs));
-+ if (ret < 0) {
-+ error_report("failed to set x64 registers");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static inline MemTxAttrs get_mem_attrs(bool is_secure_mode)
-+{
-+ MemTxAttrs memattr = {0};
-+ memattr.secure = is_secure_mode;
-+ return memattr;
-+}
-+
-+static void pio_read(uint64_t port, uint8_t *data, uintptr_t size,
-+ bool is_secure_mode)
-+{
-+ int ret = 0;
-+ MemTxAttrs memattr = get_mem_attrs(is_secure_mode);
-+ ret = address_space_rw(&address_space_io, port, memattr, (void *)data, size,
-+ false);
-+ if (ret != MEMTX_OK) {
-+ error_report("Failed to read from port %lx: %d", port, ret);
-+ abort();
-+ }
-+}
-+
-+static int pio_write(uint64_t port, const uint8_t *data, uintptr_t size,
-+ bool is_secure_mode)
-+{
-+ int ret = 0;
-+ MemTxAttrs memattr = get_mem_attrs(is_secure_mode);
-+ ret = address_space_rw(&address_space_io, port, memattr, (void *)data, size,
-+ true);
-+ return ret;
-+}
-+
-+static int handle_pio_non_str(const CPUState *cpu,
-+ hv_x64_io_port_intercept_message *info)
-+{
-+ size_t len = info->access_info.access_size;
-+ uint8_t access_type = info->header.intercept_access_type;
-+ int ret;
-+ uint32_t val, eax;
-+ const uint32_t eax_mask = 0xffffffffu >> (32 - len * 8);
-+ size_t insn_len;
-+ uint64_t rip, rax;
-+ uint32_t reg_names[2];
-+ uint64_t reg_values[2];
-+ uint16_t port = info->port_number;
-+
-+ if (access_type == HV_X64_INTERCEPT_ACCESS_TYPE_WRITE) {
-+ union {
-+ uint32_t u32;
-+ uint8_t bytes[4];
-+ } conv;
-+
-+ /* convert the first 4 bytes of rax to bytes */
-+ conv.u32 = (uint32_t)info->rax;
-+ /* secure mode is set to false */
-+ ret = pio_write(port, conv.bytes, len, false);
-+ if (ret < 0) {
-+ error_report("Failed to write to io port");
-+ return -1;
-+ }
-+ } else {
-+ uint8_t data[4] = { 0 };
-+ /* secure mode is set to false */
-+ pio_read(info->port_number, data, len, false);
-+
-+ /* Preserve high bits in EAX, but clear out high bits in RAX */
-+ val = *(uint32_t *)data;
-+ eax = (((uint32_t)info->rax) & ~eax_mask) | (val & eax_mask);
-+ info->rax = (uint64_t)eax;
-+ }
-+
-+ insn_len = info->header.instruction_length;
-+
-+ /* Advance RIP and update RAX */
-+ rip = info->header.rip + insn_len;
-+ rax = info->rax;
-+
-+ reg_names[0] = HV_X64_REGISTER_RIP;
-+ reg_values[0] = rip;
-+ reg_names[1] = HV_X64_REGISTER_RAX;
-+ reg_values[1] = rax;
-+
-+ ret = set_x64_registers(cpu, reg_names, reg_values);
-+ if (ret < 0) {
-+ error_report("Failed to set x64 registers");
-+ return -1;
-+ }
-+
-+ cpu->accel->dirty = false;
-+
-+ return 0;
-+}
-+
-+static int fetch_guest_state(CPUState *cpu)
-+{
-+ int ret;
-+
-+ ret = mshv_get_standard_regs(cpu);
-+ if (ret < 0) {
-+ error_report("Failed to get standard registers");
-+ return -1;
-+ }
-+
-+ ret = mshv_get_special_regs(cpu);
-+ if (ret < 0) {
-+ error_report("Failed to get special registers");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int read_memory(const CPUState *cpu, uint64_t initial_gva,
-+ uint64_t initial_gpa, uint64_t gva, uint8_t *data,
-+ size_t len)
-+{
-+ int ret;
-+ uint64_t gpa, flags;
-+
-+ if (gva == initial_gva) {
-+ gpa = initial_gpa;
-+ } else {
-+ flags = HV_TRANSLATE_GVA_VALIDATE_READ;
-+ ret = translate_gva(cpu, gva, &gpa, flags);
-+ if (ret < 0) {
-+ return -1;
-+ }
-+
-+ ret = mshv_guest_mem_read(gpa, data, len, false, false);
-+ if (ret < 0) {
-+ error_report("failed to read guest mem");
-+ return -1;
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+static int write_memory(const CPUState *cpu, uint64_t initial_gva,
-+ uint64_t initial_gpa, uint64_t gva, const uint8_t *data,
-+ size_t len)
-+{
-+ int ret;
-+ uint64_t gpa, flags;
-+
-+ if (gva == initial_gva) {
-+ gpa = initial_gpa;
-+ } else {
-+ flags = HV_TRANSLATE_GVA_VALIDATE_WRITE;
-+ ret = translate_gva(cpu, gva, &gpa, flags);
-+ if (ret < 0) {
-+ error_report("failed to translate gva to gpa");
-+ return -1;
-+ }
-+ }
-+ ret = mshv_guest_mem_write(gpa, data, len, false);
-+ if (ret != MEMTX_OK) {
-+ error_report("failed to write to mmio");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int handle_pio_str_write(CPUState *cpu,
-+ hv_x64_io_port_intercept_message *info,
-+ size_t repeat, uint16_t port,
-+ bool direction_flag)
-+{
-+ int ret;
-+ uint64_t src;
-+ uint8_t data[4] = { 0 };
-+ size_t len = info->access_info.access_size;
-+
-+ src = linear_addr(cpu, info->rsi, R_DS);
-+
-+ for (size_t i = 0; i < repeat; i++) {
-+ ret = read_memory(cpu, 0, 0, src, data, len);
-+ if (ret < 0) {
-+ error_report("Failed to read memory");
-+ return -1;
-+ }
-+ ret = pio_write(port, data, len, false);
-+ if (ret < 0) {
-+ error_report("Failed to write to io port");
-+ return -1;
-+ }
-+ src += direction_flag ? -len : len;
-+ info->rsi += direction_flag ? -len : len;
-+ }
-+
-+ return 0;
-+}
-+
-+static int handle_pio_str_read(CPUState *cpu,
-+ hv_x64_io_port_intercept_message *info,
-+ size_t repeat, uint16_t port,
-+ bool direction_flag)
-+{
-+ int ret;
-+ uint64_t dst;
-+ size_t len = info->access_info.access_size;
-+ uint8_t data[4] = { 0 };
-+
-+ dst = linear_addr(cpu, info->rdi, R_ES);
-+
-+ for (size_t i = 0; i < repeat; i++) {
-+ pio_read(port, data, len, false);
-+
-+ ret = write_memory(cpu, 0, 0, dst, data, len);
-+ if (ret < 0) {
-+ error_report("Failed to write memory");
-+ return -1;
-+ }
-+ dst += direction_flag ? -len : len;
-+ info->rdi += direction_flag ? -len : len;
-+ }
-+
-+ return 0;
-+}
-+
-+static int handle_pio_str(CPUState *cpu, hv_x64_io_port_intercept_message *info)
-+{
-+ uint8_t access_type = info->header.intercept_access_type;
-+ uint16_t port = info->port_number;
-+ bool repop = info->access_info.rep_prefix == 1;
-+ size_t repeat = repop ? info->rcx : 1;
-+ size_t insn_len = info->header.instruction_length;
-+ bool direction_flag;
-+ uint32_t reg_names[3];
-+ uint64_t reg_values[3];
-+ int ret;
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+
-+ ret = fetch_guest_state(cpu);
-+ if (ret < 0) {
-+ error_report("Failed to fetch guest state");
-+ return -1;
-+ }
-+
-+ direction_flag = (env->eflags & DESC_E_MASK) != 0;
-+
-+ if (access_type == HV_X64_INTERCEPT_ACCESS_TYPE_WRITE) {
-+ ret = handle_pio_str_write(cpu, info, repeat, port, direction_flag);
-+ if (ret < 0) {
-+ error_report("Failed to handle pio str write");
-+ return -1;
-+ }
-+ reg_names[0] = HV_X64_REGISTER_RSI;
-+ reg_values[0] = info->rsi;
-+ } else {
-+ ret = handle_pio_str_read(cpu, info, repeat, port, direction_flag);
-+ reg_names[0] = HV_X64_REGISTER_RDI;
-+ reg_values[0] = info->rdi;
-+ }
-+
-+ reg_names[1] = HV_X64_REGISTER_RIP;
-+ reg_values[1] = info->header.rip + insn_len;
-+ reg_names[2] = HV_X64_REGISTER_RAX;
-+ reg_values[2] = info->rax;
-+
-+ ret = set_x64_registers(cpu, reg_names, reg_values);
-+ if (ret < 0) {
-+ error_report("Failed to set x64 registers");
-+ return -1;
-+ }
-+
-+ cpu->accel->dirty = false;
-+
-+ return 0;
-+}
-+
-+static int handle_pio(CPUState *cpu, const struct hyperv_message *msg)
-+{
-+ struct hv_x64_io_port_intercept_message info = { 0 };
-+ int ret;
-+
-+ ret = set_ioport_info(msg, &info);
-+ if (ret < 0) {
-+ error_report("Failed to convert message to ioport info");
-+ return -1;
-+ }
-+
-+ if (info.access_info.string_op) {
-+ return handle_pio_str(cpu, &info);
-+ }
-+
-+ return handle_pio_non_str(cpu, &info);
-+}
-+
- int mshv_run_vcpu(int vm_fd, CPUState *cpu, hv_message *msg, MshvVmExit *exit)
- {
-- error_report("unimplemented");
-- abort();
-+ int ret;
-+ enum MshvVmExit exit_reason;
-+ int cpu_fd = mshv_vcpufd(cpu);
-+
-+ ret = ioctl(cpu_fd, MSHV_RUN_VP, msg);
-+ if (ret < 0) {
-+ return MshvVmExitShutdown;
-+ }
-+
-+ switch (msg->header.message_type) {
-+ case HVMSG_UNRECOVERABLE_EXCEPTION:
-+ return MshvVmExitShutdown;
-+ case HVMSG_UNMAPPED_GPA:
-+ case HVMSG_GPA_INTERCEPT:
-+ ret = handle_mmio(cpu, msg, &exit_reason);
-+ if (ret < 0) {
-+ error_report("failed to handle mmio");
-+ return -1;
-+ }
-+ return exit_reason;
-+ case HVMSG_X64_IO_PORT_INTERCEPT:
-+ ret = handle_pio(cpu, msg);
-+ if (ret < 0) {
-+ return MshvVmExitSpecial;
-+ }
-+ return MshvVmExitIgnore;
-+ default:
-+ break;
-+ }
-+
-+ *exit = MshvVmExitIgnore;
-+ return 0;
- }
-
- void mshv_remove_vcpu(int vm_fd, int cpu_fd)
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Integrate-x86-instruction-decoder-e.patch b/kvm-target-i386-mshv-Integrate-x86-instruction-decoder-e.patch
deleted file mode 100644
index 3dc0f45..0000000
--- a/kvm-target-i386-mshv-Integrate-x86-instruction-decoder-e.patch
+++ /dev/null
@@ -1,283 +0,0 @@
-From 3d2a5157c0ad300f954ba9b3fddadd4da5120eac Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:40 +0200
-Subject: [PATCH 23/32] target/i386/mshv: Integrate x86 instruction
- decoder/emulator
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [21/30] c9dba7c3e0a4c896fa581b97f121a293606e074f
-
-Connect the x86 instruction decoder and emulator to the MSHV backend
-to handle intercepted instructions. This enables software emulation
-of MMIO operations in MSHV guests. MSHV has a translate_gva hypercall
-that is used to accessing the physical guest memory.
-
-A guest might read from unmapped memory regions (e.g. OVMF will probe
-0xfed40000 for a vTPM). In those cases 0xFF bytes is returned instead of
-aborting the execution.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-21-magnuskulke@linux.microsoft.com
-[mshv.h/mshv_int.h split. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 9bc6a1d29605a13c541629a651e41787af65a963)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- accel/mshv/mem.c | 65 +++++++++++++++++
- include/system/mshv_int.h | 4 ++
- target/i386/mshv/mshv-cpu.c | 135 ++++++++++++++++++++++++++++++++++++
- 3 files changed, 204 insertions(+)
-
-diff --git a/accel/mshv/mem.c b/accel/mshv/mem.c
-index a0a40eb333..e55c38d4db 100644
---- a/accel/mshv/mem.c
-+++ b/accel/mshv/mem.c
-@@ -59,6 +59,71 @@ static int map_or_unmap(int vm_fd, const MshvMemoryRegion *mr, bool map)
- return set_guest_memory(vm_fd, ®ion);
- }
-
-+static int handle_unmapped_mmio_region_read(uint64_t gpa, uint64_t size,
-+ uint8_t *data)
-+{
-+ warn_report("read from unmapped mmio region gpa=0x%lx size=%lu", gpa, size);
-+
-+ if (size == 0 || size > 8) {
-+ error_report("invalid size %lu for reading from unmapped mmio region",
-+ size);
-+ return -1;
-+ }
-+
-+ memset(data, 0xFF, size);
-+
-+ return 0;
-+}
-+
-+int mshv_guest_mem_read(uint64_t gpa, uint8_t *data, uintptr_t size,
-+ bool is_secure_mode, bool instruction_fetch)
-+{
-+ int ret;
-+ MemTxAttrs memattr = { .secure = is_secure_mode };
-+
-+ if (instruction_fetch) {
-+ trace_mshv_insn_fetch(gpa, size);
-+ } else {
-+ trace_mshv_mem_read(gpa, size);
-+ }
-+
-+ ret = address_space_rw(&address_space_memory, gpa, memattr, (void *)data,
-+ size, false);
-+ if (ret == MEMTX_OK) {
-+ return 0;
-+ }
-+
-+ if (ret == MEMTX_DECODE_ERROR) {
-+ return handle_unmapped_mmio_region_read(gpa, size, data);
-+ }
-+
-+ error_report("failed to read guest memory at 0x%lx", gpa);
-+ return -1;
-+}
-+
-+int mshv_guest_mem_write(uint64_t gpa, const uint8_t *data, uintptr_t size,
-+ bool is_secure_mode)
-+{
-+ int ret;
-+ MemTxAttrs memattr = { .secure = is_secure_mode };
-+
-+ trace_mshv_mem_write(gpa, size);
-+ ret = address_space_rw(&address_space_memory, gpa, memattr, (void *)data,
-+ size, true);
-+ if (ret == MEMTX_OK) {
-+ return 0;
-+ }
-+
-+ if (ret == MEMTX_DECODE_ERROR) {
-+ warn_report("write to unmapped mmio region gpa=0x%lx size=%lu", gpa,
-+ size);
-+ return 0;
-+ }
-+
-+ error_report("Failed to write guest memory");
-+ return -1;
-+}
-+
- static int set_memory(const MshvMemoryRegion *mshv_mr, bool add)
- {
- int ret = 0;
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-index 6649438313..b29d39911d 100644
---- a/include/system/mshv_int.h
-+++ b/include/system/mshv_int.h
-@@ -101,6 +101,10 @@ typedef struct MshvMemoryRegion {
- bool readonly;
- } MshvMemoryRegion;
-
-+int mshv_guest_mem_read(uint64_t gpa, uint8_t *data, uintptr_t size,
-+ bool is_secure_mode, bool instruction_fetch);
-+int mshv_guest_mem_write(uint64_t gpa, const uint8_t *data, uintptr_t size,
-+ bool is_secure_mode);
- void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
- bool add);
-
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 1f43dfc58a..424ebdb122 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -104,6 +104,47 @@ static enum hv_register_name FPU_REGISTER_NAMES[26] = {
- HV_X64_REGISTER_XMM_CONTROL_STATUS,
- };
-
-+static int translate_gva(const CPUState *cpu, uint64_t gva, uint64_t *gpa,
-+ uint64_t flags)
-+{
-+ int ret;
-+ int cpu_fd = mshv_vcpufd(cpu);
-+ int vp_index = cpu->cpu_index;
-+
-+ hv_input_translate_virtual_address in = { 0 };
-+ hv_output_translate_virtual_address out = { 0 };
-+ struct mshv_root_hvcall args = {0};
-+ uint64_t gva_page = gva >> HV_HYP_PAGE_SHIFT;
-+
-+ in.vp_index = vp_index;
-+ in.control_flags = flags;
-+ in.gva_page = gva_page;
-+
-+ /* create the hvcall envelope */
-+ args.code = HVCALL_TRANSLATE_VIRTUAL_ADDRESS;
-+ args.in_sz = sizeof(in);
-+ args.in_ptr = (uint64_t) ∈
-+ args.out_sz = sizeof(out);
-+ args.out_ptr = (uint64_t) &out;
-+
-+ /* perform the call */
-+ ret = mshv_hvcall(cpu_fd, &args);
-+ if (ret < 0) {
-+ error_report("Failed to invoke gva->gpa translation");
-+ return -errno;
-+ }
-+
-+ if (out.translation_result.result_code != HV_TRANSLATE_GVA_SUCCESS) {
-+ error_report("Failed to translate gva (" TARGET_FMT_lx ") to gpa", gva);
-+ return -1;
-+ }
-+
-+ *gpa = ((out.gpa_page << HV_HYP_PAGE_SHIFT)
-+ | (gva & ~(uint64_t)HV_HYP_PAGE_MASK));
-+
-+ return 0;
-+}
-+
- int mshv_set_generic_regs(const CPUState *cpu, const hv_register_assoc *assocs,
- size_t n_regs)
- {
-@@ -1006,8 +1047,102 @@ int mshv_create_vcpu(int vm_fd, uint8_t vp_index, int *cpu_fd)
- return 0;
- }
-
-+static int guest_mem_read_with_gva(const CPUState *cpu, uint64_t gva,
-+ uint8_t *data, uintptr_t size,
-+ bool fetch_instruction)
-+{
-+ int ret;
-+ uint64_t gpa, flags;
-+
-+ flags = HV_TRANSLATE_GVA_VALIDATE_READ;
-+ ret = translate_gva(cpu, gva, &gpa, flags);
-+ if (ret < 0) {
-+ error_report("failed to translate gva to gpa");
-+ return -1;
-+ }
-+
-+ ret = mshv_guest_mem_read(gpa, data, size, false, fetch_instruction);
-+ if (ret < 0) {
-+ error_report("failed to read from guest memory");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int guest_mem_write_with_gva(const CPUState *cpu, uint64_t gva,
-+ const uint8_t *data, uintptr_t size)
-+{
-+ int ret;
-+ uint64_t gpa, flags;
-+
-+ flags = HV_TRANSLATE_GVA_VALIDATE_WRITE;
-+ ret = translate_gva(cpu, gva, &gpa, flags);
-+ if (ret < 0) {
-+ error_report("failed to translate gva to gpa");
-+ return -1;
-+ }
-+ ret = mshv_guest_mem_write(gpa, data, size, false);
-+ if (ret < 0) {
-+ error_report("failed to write to guest memory");
-+ return -1;
-+ }
-+ return 0;
-+}
-+
-+static void write_mem(CPUState *cpu, void *data, target_ulong addr, int bytes)
-+{
-+ if (guest_mem_write_with_gva(cpu, addr, data, bytes) < 0) {
-+ error_report("failed to write memory");
-+ abort();
-+ }
-+}
-+
-+static void fetch_instruction(CPUState *cpu, void *data,
-+ target_ulong addr, int bytes)
-+{
-+ if (guest_mem_read_with_gva(cpu, addr, data, bytes, true) < 0) {
-+ error_report("failed to fetch instruction");
-+ abort();
-+ }
-+}
-+
-+static void read_mem(CPUState *cpu, void *data, target_ulong addr, int bytes)
-+{
-+ if (guest_mem_read_with_gva(cpu, addr, data, bytes, false) < 0) {
-+ error_report("failed to read memory");
-+ abort();
-+ }
-+}
-+
-+static void read_segment_descriptor(CPUState *cpu,
-+ struct x86_segment_descriptor *desc,
-+ enum X86Seg seg_idx)
-+{
-+ bool ret;
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+ SegmentCache *seg = &env->segs[seg_idx];
-+ x86_segment_selector sel = { .sel = seg->selector & 0xFFFF };
-+
-+ ret = x86_read_segment_descriptor(cpu, desc, sel);
-+ if (ret == false) {
-+ error_report("failed to read segment descriptor");
-+ abort();
-+ }
-+}
-+
-+static const struct x86_emul_ops mshv_x86_emul_ops = {
-+ .fetch_instruction = fetch_instruction,
-+ .read_mem = read_mem,
-+ .write_mem = write_mem,
-+ .read_segment_descriptor = read_segment_descriptor,
-+};
-+
- void mshv_init_mmio_emu(void)
- {
-+ init_decoder();
-+ init_emu(&mshv_x86_emul_ops);
- }
-
- void mshv_arch_init_vcpu(CPUState *cpu)
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Register-CPUID-entries-with-MSHV.patch b/kvm-target-i386-mshv-Register-CPUID-entries-with-MSHV.patch
deleted file mode 100644
index 678f176..0000000
--- a/kvm-target-i386-mshv-Register-CPUID-entries-with-MSHV.patch
+++ /dev/null
@@ -1,252 +0,0 @@
-From d122c4cbb920e5d20ee70da4496b2b686319532f Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:38 +0200
-Subject: [PATCH 21/32] target/i386/mshv: Register CPUID entries with MSHV
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [19/30] 4a1e70942d21acee2c90095afd82e9f376b87b56
-
-Convert the guest CPU's CPUID model into MSHV's format and register it
-with the hypervisor. This ensures that the guest observes the correct
-CPU feature set during CPUID instructions.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-19-magnuskulke@linux.microsoft.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 4fa04dd16216e266564606b7da582e5fce07bced)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- target/i386/mshv/mshv-cpu.c | 206 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 206 insertions(+)
-
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 0fe3cbb48d..2b7a81274b 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -403,6 +403,206 @@ int mshv_load_regs(CPUState *cpu)
- return 0;
- }
-
-+static void add_cpuid_entry(GList *cpuid_entries,
-+ uint32_t function, uint32_t index,
-+ uint32_t eax, uint32_t ebx,
-+ uint32_t ecx, uint32_t edx)
-+{
-+ struct hv_cpuid_entry *entry;
-+
-+ entry = g_malloc0(sizeof(struct hv_cpuid_entry));
-+ entry->function = function;
-+ entry->index = index;
-+ entry->eax = eax;
-+ entry->ebx = ebx;
-+ entry->ecx = ecx;
-+ entry->edx = edx;
-+
-+ cpuid_entries = g_list_append(cpuid_entries, entry);
-+}
-+
-+static void collect_cpuid_entries(const CPUState *cpu, GList *cpuid_entries)
-+{
-+ X86CPU *x86_cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86_cpu->env;
-+ uint32_t eax, ebx, ecx, edx;
-+ uint32_t leaf, subleaf;
-+ size_t max_leaf = 0x1F;
-+ size_t max_subleaf = 0x20;
-+
-+ uint32_t leaves_with_subleaves[] = {0x4, 0x7, 0xD, 0xF, 0x10};
-+ int n_subleaf_leaves = ARRAY_SIZE(leaves_with_subleaves);
-+
-+ /* Regular leaves without subleaves */
-+ for (leaf = 0; leaf <= max_leaf; leaf++) {
-+ bool has_subleaves = false;
-+ for (int i = 0; i < n_subleaf_leaves; i++) {
-+ if (leaf == leaves_with_subleaves[i]) {
-+ has_subleaves = true;
-+ break;
-+ }
-+ }
-+
-+ if (!has_subleaves) {
-+ cpu_x86_cpuid(env, leaf, 0, &eax, &ebx, &ecx, &edx);
-+ if (eax == 0 && ebx == 0 && ecx == 0 && edx == 0) {
-+ /* all zeroes indicates no more leaves */
-+ continue;
-+ }
-+
-+ add_cpuid_entry(cpuid_entries, leaf, 0, eax, ebx, ecx, edx);
-+ continue;
-+ }
-+
-+ subleaf = 0;
-+ while (subleaf < max_subleaf) {
-+ cpu_x86_cpuid(env, leaf, subleaf, &eax, &ebx, &ecx, &edx);
-+
-+ if (eax == 0 && ebx == 0 && ecx == 0 && edx == 0) {
-+ /* all zeroes indicates no more leaves */
-+ break;
-+ }
-+ add_cpuid_entry(cpuid_entries, leaf, 0, eax, ebx, ecx, edx);
-+ subleaf++;
-+ }
-+ }
-+}
-+
-+static int register_intercept_result_cpuid_entry(const CPUState *cpu,
-+ uint8_t subleaf_specific,
-+ uint8_t always_override,
-+ struct hv_cpuid_entry *entry)
-+{
-+ int ret;
-+ int vp_index = cpu->cpu_index;
-+ int cpu_fd = mshv_vcpufd(cpu);
-+
-+ struct hv_register_x64_cpuid_result_parameters cpuid_params = {
-+ .input.eax = entry->function,
-+ .input.ecx = entry->index,
-+ .input.subleaf_specific = subleaf_specific,
-+ .input.always_override = always_override,
-+ .input.padding = 0,
-+ /*
-+ * With regard to masks - these are to specify bits to be overwritten
-+ * The current CpuidEntry structure wouldn't allow to carry the masks
-+ * in addition to the actual register values. For this reason, the
-+ * masks are set to the exact values of the corresponding register bits
-+ * to be registered for an overwrite. To view resulting values the
-+ * hypervisor would return, HvCallGetVpCpuidValues hypercall can be
-+ * used.
-+ */
-+ .result.eax = entry->eax,
-+ .result.eax_mask = entry->eax,
-+ .result.ebx = entry->ebx,
-+ .result.ebx_mask = entry->ebx,
-+ .result.ecx = entry->ecx,
-+ .result.ecx_mask = entry->ecx,
-+ .result.edx = entry->edx,
-+ .result.edx_mask = entry->edx,
-+ };
-+ union hv_register_intercept_result_parameters parameters = {
-+ .cpuid = cpuid_params,
-+ };
-+
-+ hv_input_register_intercept_result in = {0};
-+ in.vp_index = vp_index;
-+ in.intercept_type = HV_INTERCEPT_TYPE_X64_CPUID;
-+ in.parameters = parameters;
-+
-+ struct mshv_root_hvcall args = {0};
-+ args.code = HVCALL_REGISTER_INTERCEPT_RESULT;
-+ args.in_sz = sizeof(in);
-+ args.in_ptr = (uint64_t)∈
-+
-+ ret = mshv_hvcall(cpu_fd, &args);
-+ if (ret < 0) {
-+ error_report("failed to register intercept result for cpuid");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int register_intercept_result_cpuid(const CPUState *cpu,
-+ struct hv_cpuid *cpuid)
-+{
-+ int ret = 0, entry_ret;
-+ struct hv_cpuid_entry *entry;
-+ uint8_t subleaf_specific, always_override;
-+
-+ for (size_t i = 0; i < cpuid->nent; i++) {
-+ entry = &cpuid->entries[i];
-+
-+ /* set defaults */
-+ subleaf_specific = 0;
-+ always_override = 1;
-+
-+ /* Intel */
-+ /* 0xb - Extended Topology Enumeration Leaf */
-+ /* 0x1f - V2 Extended Topology Enumeration Leaf */
-+ /* AMD */
-+ /* 0x8000_001e - Processor Topology Information */
-+ /* 0x8000_0026 - Extended CPU Topology */
-+ if (entry->function == 0xb
-+ || entry->function == 0x1f
-+ || entry->function == 0x8000001e
-+ || entry->function == 0x80000026) {
-+ subleaf_specific = 1;
-+ always_override = 1;
-+ } else if (entry->function == 0x00000001
-+ || entry->function == 0x80000000
-+ || entry->function == 0x80000001
-+ || entry->function == 0x80000008) {
-+ subleaf_specific = 0;
-+ always_override = 1;
-+ }
-+
-+ entry_ret = register_intercept_result_cpuid_entry(cpu, subleaf_specific,
-+ always_override,
-+ entry);
-+ if ((entry_ret < 0) && (ret == 0)) {
-+ ret = entry_ret;
-+ }
-+ }
-+
-+ return ret;
-+}
-+
-+static int set_cpuid2(const CPUState *cpu)
-+{
-+ int ret;
-+ size_t n_entries, cpuid_size;
-+ struct hv_cpuid *cpuid;
-+ struct hv_cpuid_entry *entry;
-+ GList *entries = NULL;
-+
-+ collect_cpuid_entries(cpu, entries);
-+ n_entries = g_list_length(entries);
-+
-+ cpuid_size = sizeof(struct hv_cpuid)
-+ + n_entries * sizeof(struct hv_cpuid_entry);
-+
-+ cpuid = g_malloc0(cpuid_size);
-+ cpuid->nent = n_entries;
-+ cpuid->padding = 0;
-+
-+ for (size_t i = 0; i < n_entries; i++) {
-+ entry = g_list_nth_data(entries, i);
-+ cpuid->entries[i] = *entry;
-+ g_free(entry);
-+ }
-+ g_list_free(entries);
-+
-+ ret = register_intercept_result_cpuid(cpu, cpuid);
-+ g_free(cpuid);
-+ if (ret < 0) {
-+ return ret;
-+ }
-+
-+ return 0;
-+}
-+
- static inline void populate_hv_segment_reg(SegmentCache *seg,
- hv_x64_segment_register *hv_reg)
- {
-@@ -685,6 +885,12 @@ int mshv_configure_vcpu(const CPUState *cpu, const struct MshvFPU *fpu,
- int ret;
- int cpu_fd = mshv_vcpufd(cpu);
-
-+ ret = set_cpuid2(cpu);
-+ if (ret < 0) {
-+ error_report("failed to set cpuid");
-+ return -1;
-+ }
-+
- ret = set_cpu_state(cpu, fpu, xcr0);
- if (ret < 0) {
- error_report("failed to set cpu state");
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Register-MSRs-with-MSHV.patch b/kvm-target-i386-mshv-Register-MSRs-with-MSHV.patch
deleted file mode 100644
index abda761..0000000
--- a/kvm-target-i386-mshv-Register-MSRs-with-MSHV.patch
+++ /dev/null
@@ -1,528 +0,0 @@
-From 5bbfd219b62bdea50ee0d16396f7eed138f7771f Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Thu, 2 Oct 2025 18:19:22 +0200
-Subject: [PATCH 22/32] target/i386/mshv: Register MSRs with MSHV
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [20/30] 43ca27cba532fd1d562fa10ade6261df58af82fd
-
-Build and register the guest vCPU's model-specific registers using
-the MSHV interface.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-20-magnuskulke@linux.microsoft.com
-[mshv.h/mshv_int.h split. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit f38e2a63e541730e114f6ed09e5f8719e388c8db)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- accel/mshv/meson.build | 1 +
- accel/mshv/msr.c | 375 ++++++++++++++++++++++++++++++++++++
- include/system/mshv_int.h | 17 ++
- target/i386/cpu.h | 2 +
- target/i386/mshv/mshv-cpu.c | 33 ++++
- 5 files changed, 428 insertions(+)
- create mode 100644 accel/mshv/msr.c
-
-diff --git a/accel/mshv/meson.build b/accel/mshv/meson.build
-index f88fc8678c..d3a2b32581 100644
---- a/accel/mshv/meson.build
-+++ b/accel/mshv/meson.build
-@@ -2,6 +2,7 @@ mshv_ss = ss.source_set()
- mshv_ss.add(if_true: files(
- 'irq.c',
- 'mem.c',
-+ 'msr.c',
- 'mshv-all.c'
- ))
-
-diff --git a/accel/mshv/msr.c b/accel/mshv/msr.c
-new file mode 100644
-index 0000000000..e6e5baef50
---- /dev/null
-+++ b/accel/mshv/msr.c
-@@ -0,0 +1,375 @@
-+/*
-+ * QEMU MSHV support
-+ *
-+ * Copyright Microsoft, Corp. 2025
-+ *
-+ * Authors: Magnus Kulke <magnuskulke@microsoft.com>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#include "qemu/osdep.h"
-+#include "system/mshv.h"
-+#include "system/mshv_int.h"
-+#include "hw/hyperv/hvgdk_mini.h"
-+#include "linux/mshv.h"
-+#include "qemu/error-report.h"
-+
-+static uint32_t supported_msrs[64] = {
-+ IA32_MSR_TSC,
-+ IA32_MSR_EFER,
-+ IA32_MSR_KERNEL_GS_BASE,
-+ IA32_MSR_APIC_BASE,
-+ IA32_MSR_PAT,
-+ IA32_MSR_SYSENTER_CS,
-+ IA32_MSR_SYSENTER_ESP,
-+ IA32_MSR_SYSENTER_EIP,
-+ IA32_MSR_STAR,
-+ IA32_MSR_LSTAR,
-+ IA32_MSR_CSTAR,
-+ IA32_MSR_SFMASK,
-+ IA32_MSR_MTRR_DEF_TYPE,
-+ IA32_MSR_MTRR_PHYSBASE0,
-+ IA32_MSR_MTRR_PHYSMASK0,
-+ IA32_MSR_MTRR_PHYSBASE1,
-+ IA32_MSR_MTRR_PHYSMASK1,
-+ IA32_MSR_MTRR_PHYSBASE2,
-+ IA32_MSR_MTRR_PHYSMASK2,
-+ IA32_MSR_MTRR_PHYSBASE3,
-+ IA32_MSR_MTRR_PHYSMASK3,
-+ IA32_MSR_MTRR_PHYSBASE4,
-+ IA32_MSR_MTRR_PHYSMASK4,
-+ IA32_MSR_MTRR_PHYSBASE5,
-+ IA32_MSR_MTRR_PHYSMASK5,
-+ IA32_MSR_MTRR_PHYSBASE6,
-+ IA32_MSR_MTRR_PHYSMASK6,
-+ IA32_MSR_MTRR_PHYSBASE7,
-+ IA32_MSR_MTRR_PHYSMASK7,
-+ IA32_MSR_MTRR_FIX64K_00000,
-+ IA32_MSR_MTRR_FIX16K_80000,
-+ IA32_MSR_MTRR_FIX16K_A0000,
-+ IA32_MSR_MTRR_FIX4K_C0000,
-+ IA32_MSR_MTRR_FIX4K_C8000,
-+ IA32_MSR_MTRR_FIX4K_D0000,
-+ IA32_MSR_MTRR_FIX4K_D8000,
-+ IA32_MSR_MTRR_FIX4K_E0000,
-+ IA32_MSR_MTRR_FIX4K_E8000,
-+ IA32_MSR_MTRR_FIX4K_F0000,
-+ IA32_MSR_MTRR_FIX4K_F8000,
-+ IA32_MSR_TSC_AUX,
-+ IA32_MSR_DEBUG_CTL,
-+ HV_X64_MSR_GUEST_OS_ID,
-+ HV_X64_MSR_SINT0,
-+ HV_X64_MSR_SINT1,
-+ HV_X64_MSR_SINT2,
-+ HV_X64_MSR_SINT3,
-+ HV_X64_MSR_SINT4,
-+ HV_X64_MSR_SINT5,
-+ HV_X64_MSR_SINT6,
-+ HV_X64_MSR_SINT7,
-+ HV_X64_MSR_SINT8,
-+ HV_X64_MSR_SINT9,
-+ HV_X64_MSR_SINT10,
-+ HV_X64_MSR_SINT11,
-+ HV_X64_MSR_SINT12,
-+ HV_X64_MSR_SINT13,
-+ HV_X64_MSR_SINT14,
-+ HV_X64_MSR_SINT15,
-+ HV_X64_MSR_SCONTROL,
-+ HV_X64_MSR_SIEFP,
-+ HV_X64_MSR_SIMP,
-+ HV_X64_MSR_REFERENCE_TSC,
-+ HV_X64_MSR_EOM,
-+};
-+static const size_t msr_count = ARRAY_SIZE(supported_msrs);
-+
-+static int compare_msr_index(const void *a, const void *b)
-+{
-+ return *(uint32_t *)a - *(uint32_t *)b;
-+}
-+
-+__attribute__((constructor))
-+static void init_sorted_msr_map(void)
-+{
-+ qsort(supported_msrs, msr_count, sizeof(uint32_t), compare_msr_index);
-+}
-+
-+static int mshv_is_supported_msr(uint32_t msr)
-+{
-+ return bsearch(&msr, supported_msrs, msr_count, sizeof(uint32_t),
-+ compare_msr_index) != NULL;
-+}
-+
-+static int mshv_msr_to_hv_reg_name(uint32_t msr, uint32_t *hv_reg)
-+{
-+ switch (msr) {
-+ case IA32_MSR_TSC:
-+ *hv_reg = HV_X64_REGISTER_TSC;
-+ return 0;
-+ case IA32_MSR_EFER:
-+ *hv_reg = HV_X64_REGISTER_EFER;
-+ return 0;
-+ case IA32_MSR_KERNEL_GS_BASE:
-+ *hv_reg = HV_X64_REGISTER_KERNEL_GS_BASE;
-+ return 0;
-+ case IA32_MSR_APIC_BASE:
-+ *hv_reg = HV_X64_REGISTER_APIC_BASE;
-+ return 0;
-+ case IA32_MSR_PAT:
-+ *hv_reg = HV_X64_REGISTER_PAT;
-+ return 0;
-+ case IA32_MSR_SYSENTER_CS:
-+ *hv_reg = HV_X64_REGISTER_SYSENTER_CS;
-+ return 0;
-+ case IA32_MSR_SYSENTER_ESP:
-+ *hv_reg = HV_X64_REGISTER_SYSENTER_ESP;
-+ return 0;
-+ case IA32_MSR_SYSENTER_EIP:
-+ *hv_reg = HV_X64_REGISTER_SYSENTER_EIP;
-+ return 0;
-+ case IA32_MSR_STAR:
-+ *hv_reg = HV_X64_REGISTER_STAR;
-+ return 0;
-+ case IA32_MSR_LSTAR:
-+ *hv_reg = HV_X64_REGISTER_LSTAR;
-+ return 0;
-+ case IA32_MSR_CSTAR:
-+ *hv_reg = HV_X64_REGISTER_CSTAR;
-+ return 0;
-+ case IA32_MSR_SFMASK:
-+ *hv_reg = HV_X64_REGISTER_SFMASK;
-+ return 0;
-+ case IA32_MSR_MTRR_CAP:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_CAP;
-+ return 0;
-+ case IA32_MSR_MTRR_DEF_TYPE:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_DEF_TYPE;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSBASE0:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_BASE0;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSMASK0:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_MASK0;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSBASE1:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_BASE1;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSMASK1:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_MASK1;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSBASE2:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_BASE2;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSMASK2:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_MASK2;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSBASE3:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_BASE3;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSMASK3:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_MASK3;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSBASE4:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_BASE4;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSMASK4:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_MASK4;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSBASE5:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_BASE5;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSMASK5:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_MASK5;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSBASE6:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_BASE6;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSMASK6:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_MASK6;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSBASE7:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_BASE7;
-+ return 0;
-+ case IA32_MSR_MTRR_PHYSMASK7:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_PHYS_MASK7;
-+ return 0;
-+ case IA32_MSR_MTRR_FIX64K_00000:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_FIX64K00000;
-+ return 0;
-+ case IA32_MSR_MTRR_FIX16K_80000:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_FIX16K80000;
-+ return 0;
-+ case IA32_MSR_MTRR_FIX16K_A0000:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_FIX16KA0000;
-+ return 0;
-+ case IA32_MSR_MTRR_FIX4K_C0000:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_FIX4KC0000;
-+ return 0;
-+ case IA32_MSR_MTRR_FIX4K_C8000:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_FIX4KC8000;
-+ return 0;
-+ case IA32_MSR_MTRR_FIX4K_D0000:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_FIX4KD0000;
-+ return 0;
-+ case IA32_MSR_MTRR_FIX4K_D8000:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_FIX4KD8000;
-+ return 0;
-+ case IA32_MSR_MTRR_FIX4K_E0000:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_FIX4KE0000;
-+ return 0;
-+ case IA32_MSR_MTRR_FIX4K_E8000:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_FIX4KE8000;
-+ return 0;
-+ case IA32_MSR_MTRR_FIX4K_F0000:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_FIX4KF0000;
-+ return 0;
-+ case IA32_MSR_MTRR_FIX4K_F8000:
-+ *hv_reg = HV_X64_REGISTER_MSR_MTRR_FIX4KF8000;
-+ return 0;
-+ case IA32_MSR_TSC_AUX:
-+ *hv_reg = HV_X64_REGISTER_TSC_AUX;
-+ return 0;
-+ case IA32_MSR_BNDCFGS:
-+ *hv_reg = HV_X64_REGISTER_BNDCFGS;
-+ return 0;
-+ case IA32_MSR_DEBUG_CTL:
-+ *hv_reg = HV_X64_REGISTER_DEBUG_CTL;
-+ return 0;
-+ case IA32_MSR_TSC_ADJUST:
-+ *hv_reg = HV_X64_REGISTER_TSC_ADJUST;
-+ return 0;
-+ case IA32_MSR_SPEC_CTRL:
-+ *hv_reg = HV_X64_REGISTER_SPEC_CTRL;
-+ return 0;
-+ case HV_X64_MSR_GUEST_OS_ID:
-+ *hv_reg = HV_REGISTER_GUEST_OS_ID;
-+ return 0;
-+ case HV_X64_MSR_SINT0:
-+ *hv_reg = HV_REGISTER_SINT0;
-+ return 0;
-+ case HV_X64_MSR_SINT1:
-+ *hv_reg = HV_REGISTER_SINT1;
-+ return 0;
-+ case HV_X64_MSR_SINT2:
-+ *hv_reg = HV_REGISTER_SINT2;
-+ return 0;
-+ case HV_X64_MSR_SINT3:
-+ *hv_reg = HV_REGISTER_SINT3;
-+ return 0;
-+ case HV_X64_MSR_SINT4:
-+ *hv_reg = HV_REGISTER_SINT4;
-+ return 0;
-+ case HV_X64_MSR_SINT5:
-+ *hv_reg = HV_REGISTER_SINT5;
-+ return 0;
-+ case HV_X64_MSR_SINT6:
-+ *hv_reg = HV_REGISTER_SINT6;
-+ return 0;
-+ case HV_X64_MSR_SINT7:
-+ *hv_reg = HV_REGISTER_SINT7;
-+ return 0;
-+ case HV_X64_MSR_SINT8:
-+ *hv_reg = HV_REGISTER_SINT8;
-+ return 0;
-+ case HV_X64_MSR_SINT9:
-+ *hv_reg = HV_REGISTER_SINT9;
-+ return 0;
-+ case HV_X64_MSR_SINT10:
-+ *hv_reg = HV_REGISTER_SINT10;
-+ return 0;
-+ case HV_X64_MSR_SINT11:
-+ *hv_reg = HV_REGISTER_SINT11;
-+ return 0;
-+ case HV_X64_MSR_SINT12:
-+ *hv_reg = HV_REGISTER_SINT12;
-+ return 0;
-+ case HV_X64_MSR_SINT13:
-+ *hv_reg = HV_REGISTER_SINT13;
-+ return 0;
-+ case HV_X64_MSR_SINT14:
-+ *hv_reg = HV_REGISTER_SINT14;
-+ return 0;
-+ case HV_X64_MSR_SINT15:
-+ *hv_reg = HV_REGISTER_SINT15;
-+ return 0;
-+ case IA32_MSR_MISC_ENABLE:
-+ *hv_reg = HV_X64_REGISTER_MSR_IA32_MISC_ENABLE;
-+ return 0;
-+ case HV_X64_MSR_SCONTROL:
-+ *hv_reg = HV_REGISTER_SCONTROL;
-+ return 0;
-+ case HV_X64_MSR_SIEFP:
-+ *hv_reg = HV_REGISTER_SIEFP;
-+ return 0;
-+ case HV_X64_MSR_SIMP:
-+ *hv_reg = HV_REGISTER_SIMP;
-+ return 0;
-+ case HV_X64_MSR_REFERENCE_TSC:
-+ *hv_reg = HV_REGISTER_REFERENCE_TSC;
-+ return 0;
-+ case HV_X64_MSR_EOM:
-+ *hv_reg = HV_REGISTER_EOM;
-+ return 0;
-+ default:
-+ error_report("failed to map MSR %u to HV register name", msr);
-+ return -1;
-+ }
-+}
-+
-+static int set_msrs(const CPUState *cpu, GList *msrs)
-+{
-+ size_t n_msrs;
-+ GList *entries;
-+ MshvMsrEntry *entry;
-+ enum hv_register_name name;
-+ struct hv_register_assoc *assoc;
-+ int ret;
-+ size_t i = 0;
-+
-+ n_msrs = g_list_length(msrs);
-+ hv_register_assoc *assocs = g_new0(hv_register_assoc, n_msrs);
-+
-+ entries = msrs;
-+ for (const GList *elem = entries; elem != NULL; elem = elem->next) {
-+ entry = elem->data;
-+ ret = mshv_msr_to_hv_reg_name(entry->index, &name);
-+ if (ret < 0) {
-+ g_free(assocs);
-+ return ret;
-+ }
-+ assoc = &assocs[i];
-+ assoc->name = name;
-+ /* the union has been initialized to 0 */
-+ assoc->value.reg64 = entry->data;
-+ i++;
-+ }
-+ ret = mshv_set_generic_regs(cpu, assocs, n_msrs);
-+ g_free(assocs);
-+ if (ret < 0) {
-+ error_report("failed to set msrs");
-+ return -1;
-+ }
-+ return 0;
-+}
-+
-+
-+int mshv_configure_msr(const CPUState *cpu, const MshvMsrEntry *msrs,
-+ size_t n_msrs)
-+{
-+ GList *valid_msrs = NULL;
-+ uint32_t msr_index;
-+ int ret;
-+
-+ for (size_t i = 0; i < n_msrs; i++) {
-+ msr_index = msrs[i].index;
-+ /* check whether index of msrs is in SUPPORTED_MSRS */
-+ if (mshv_is_supported_msr(msr_index)) {
-+ valid_msrs = g_list_append(valid_msrs, (void *) &msrs[i]);
-+ }
-+ }
-+
-+ ret = set_msrs(cpu, valid_msrs);
-+ g_list_free(valid_msrs);
-+
-+ return ret;
-+}
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-index 0ea8d504fa..6649438313 100644
---- a/include/system/mshv_int.h
-+++ b/include/system/mshv_int.h
-@@ -14,6 +14,8 @@
- #ifndef QEMU_MSHV_INT_H
- #define QEMU_MSHV_INT_H
-
-+#define MSHV_MSR_ENTRIES_COUNT 64
-+
- typedef struct hyperv_message hv_message;
-
- struct AccelCPUState {
-@@ -102,6 +104,21 @@ typedef struct MshvMemoryRegion {
- void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
- bool add);
-
-+/* msr */
-+typedef struct MshvMsrEntry {
-+ uint32_t index;
-+ uint32_t reserved;
-+ uint64_t data;
-+} MshvMsrEntry;
-+
-+typedef struct MshvMsrEntries {
-+ MshvMsrEntry entries[MSHV_MSR_ENTRIES_COUNT];
-+ uint32_t nmsrs;
-+} MshvMsrEntries;
-+
-+int mshv_configure_msr(const CPUState *cpu, const MshvMsrEntry *msrs,
-+ size_t n_msrs);
-+
- /* interrupt */
- void mshv_init_msicontrol(void);
- int mshv_reserve_ioapic_msi_routes(int vm_fd);
-diff --git a/target/i386/cpu.h b/target/i386/cpu.h
-index 4b7eae43e1..8f780a3abe 100644
---- a/target/i386/cpu.h
-+++ b/target/i386/cpu.h
-@@ -435,9 +435,11 @@ typedef enum X86Seg {
- #define MSR_SMI_COUNT 0x34
- #define MSR_CORE_THREAD_COUNT 0x35
- #define MSR_MTRRcap 0xfe
-+#define MSR_MTRR_MEM_TYPE_WB 0x06
- #define MSR_MTRRcap_VCNT 8
- #define MSR_MTRRcap_FIXRANGE_SUPPORT (1 << 8)
- #define MSR_MTRRcap_WC_SUPPORTED (1 << 10)
-+#define MSR_MTRR_ENABLE (1 << 11)
-
- #define MSR_IA32_SYSENTER_CS 0x174
- #define MSR_IA32_SYSENTER_ESP 0x175
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 2b7a81274b..1f43dfc58a 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -872,6 +872,33 @@ static int set_lint(int cpu_fd)
- return set_lapic(cpu_fd, &lapic_state);
- }
-
-+static int setup_msrs(const CPUState *cpu)
-+{
-+ int ret;
-+ uint64_t default_type = MSR_MTRR_ENABLE | MSR_MTRR_MEM_TYPE_WB;
-+
-+ /* boot msr entries */
-+ MshvMsrEntry msrs[9] = {
-+ { .index = IA32_MSR_SYSENTER_CS, .data = 0x0, },
-+ { .index = IA32_MSR_SYSENTER_ESP, .data = 0x0, },
-+ { .index = IA32_MSR_SYSENTER_EIP, .data = 0x0, },
-+ { .index = IA32_MSR_STAR, .data = 0x0, },
-+ { .index = IA32_MSR_CSTAR, .data = 0x0, },
-+ { .index = IA32_MSR_LSTAR, .data = 0x0, },
-+ { .index = IA32_MSR_KERNEL_GS_BASE, .data = 0x0, },
-+ { .index = IA32_MSR_SFMASK, .data = 0x0, },
-+ { .index = IA32_MSR_MTRR_DEF_TYPE, .data = default_type, },
-+ };
-+
-+ ret = mshv_configure_msr(cpu, msrs, 9);
-+ if (ret < 0) {
-+ error_report("failed to setup msrs");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
- /*
- * TODO: populate topology info:
- *
-@@ -891,6 +918,12 @@ int mshv_configure_vcpu(const CPUState *cpu, const struct MshvFPU *fpu,
- return -1;
- }
-
-+ ret = setup_msrs(cpu);
-+ if (ret < 0) {
-+ error_report("failed to setup msrs");
-+ return -1;
-+ }
-+
- ret = set_cpu_state(cpu, fpu, xcr0);
- if (ret < 0) {
- error_report("failed to set cpu state");
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Set-local-interrupt-controller-stat.patch b/kvm-target-i386-mshv-Set-local-interrupt-controller-stat.patch
deleted file mode 100644
index 0a0ef11..0000000
--- a/kvm-target-i386-mshv-Set-local-interrupt-controller-stat.patch
+++ /dev/null
@@ -1,183 +0,0 @@
-From 140f8cbaa8665f281fe3e47c81cfd0c306f02d8b Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:37 +0200
-Subject: [PATCH 20/32] target/i386/mshv: Set local interrupt controller state
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [18/30] ded044d2fd9c55a149d7e71d952c10ed6ea29505
-
-To set the local interrupt controller state, perform hv calls retrieving
-partition state from the hypervisor.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-18-magnuskulke@linux.microsoft.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit ca20d46fa94887a6e42061646a71ee44cbc9adb0)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- target/i386/mshv/mshv-cpu.c | 117 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 117 insertions(+)
-
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 8b10c79e54..0fe3cbb48d 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -12,6 +12,7 @@
-
- #include "qemu/osdep.h"
- #include "qemu/error-report.h"
-+#include "qemu/memalign.h"
- #include "qemu/typedefs.h"
-
- #include "system/mshv.h"
-@@ -21,6 +22,7 @@
- #include "hw/hyperv/hvgdk.h"
- #include "hw/hyperv/hvgdk_mini.h"
- #include "hw/hyperv/hvhdk_mini.h"
-+#include "hw/i386/apic_internal.h"
-
- #include "cpu.h"
- #include "emulate/x86_decode.h"
-@@ -562,6 +564,114 @@ static int set_cpu_state(const CPUState *cpu, const MshvFPU *fpu_regs,
- return 0;
- }
-
-+static int get_vp_state(int cpu_fd, struct mshv_get_set_vp_state *state)
-+{
-+ int ret;
-+
-+ ret = ioctl(cpu_fd, MSHV_GET_VP_STATE, state);
-+ if (ret < 0) {
-+ error_report("failed to get partition state: %s", strerror(errno));
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int get_lapic(int cpu_fd,
-+ struct hv_local_interrupt_controller_state *state)
-+{
-+ int ret;
-+ size_t size = 4096;
-+ /* buffer aligned to 4k, as *state requires that */
-+ void *buffer = qemu_memalign(size, size);
-+ struct mshv_get_set_vp_state mshv_state = { 0 };
-+
-+ mshv_state.buf_ptr = (uint64_t) buffer;
-+ mshv_state.buf_sz = size;
-+ mshv_state.type = MSHV_VP_STATE_LAPIC;
-+
-+ ret = get_vp_state(cpu_fd, &mshv_state);
-+ if (ret == 0) {
-+ memcpy(state, buffer, sizeof(*state));
-+ }
-+ qemu_vfree(buffer);
-+ if (ret < 0) {
-+ error_report("failed to get lapic");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static uint32_t set_apic_delivery_mode(uint32_t reg, uint32_t mode)
-+{
-+ return ((reg) & ~0x700) | ((mode) << 8);
-+}
-+
-+static int set_vp_state(int cpu_fd, const struct mshv_get_set_vp_state *state)
-+{
-+ int ret;
-+
-+ ret = ioctl(cpu_fd, MSHV_SET_VP_STATE, state);
-+ if (ret < 0) {
-+ error_report("failed to set partition state: %s", strerror(errno));
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int set_lapic(int cpu_fd,
-+ const struct hv_local_interrupt_controller_state *state)
-+{
-+ int ret;
-+ size_t size = 4096;
-+ /* buffer aligned to 4k, as *state requires that */
-+ void *buffer = qemu_memalign(size, size);
-+ struct mshv_get_set_vp_state mshv_state = { 0 };
-+
-+ if (!state) {
-+ error_report("lapic state is NULL");
-+ return -1;
-+ }
-+ memcpy(buffer, state, sizeof(*state));
-+
-+ mshv_state.buf_ptr = (uint64_t) buffer;
-+ mshv_state.buf_sz = size;
-+ mshv_state.type = MSHV_VP_STATE_LAPIC;
-+
-+ ret = set_vp_state(cpu_fd, &mshv_state);
-+ qemu_vfree(buffer);
-+ if (ret < 0) {
-+ error_report("failed to set lapic: %s", strerror(errno));
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int set_lint(int cpu_fd)
-+{
-+ int ret;
-+ uint32_t *lvt_lint0, *lvt_lint1;
-+
-+ struct hv_local_interrupt_controller_state lapic_state = { 0 };
-+ ret = get_lapic(cpu_fd, &lapic_state);
-+ if (ret < 0) {
-+ return ret;
-+ }
-+
-+ lvt_lint0 = &lapic_state.apic_lvt_lint0;
-+ *lvt_lint0 = set_apic_delivery_mode(*lvt_lint0, APIC_DM_EXTINT);
-+
-+ lvt_lint1 = &lapic_state.apic_lvt_lint1;
-+ *lvt_lint1 = set_apic_delivery_mode(*lvt_lint1, APIC_DM_NMI);
-+
-+ /* TODO: should we skip setting lapic if the values are the same? */
-+
-+ return set_lapic(cpu_fd, &lapic_state);
-+}
-+
- /*
- * TODO: populate topology info:
- *
-@@ -573,6 +683,7 @@ int mshv_configure_vcpu(const CPUState *cpu, const struct MshvFPU *fpu,
- uint64_t xcr0)
- {
- int ret;
-+ int cpu_fd = mshv_vcpufd(cpu);
-
- ret = set_cpu_state(cpu, fpu, xcr0);
- if (ret < 0) {
-@@ -580,6 +691,12 @@ int mshv_configure_vcpu(const CPUState *cpu, const struct MshvFPU *fpu,
- return -1;
- }
-
-+ ret = set_lint(cpu_fd);
-+ if (ret < 0) {
-+ error_report("failed to set lpic int");
-+ return -1;
-+ }
-+
- return 0;
- }
-
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Use-preallocated-page-for-hvcall.patch b/kvm-target-i386-mshv-Use-preallocated-page-for-hvcall.patch
deleted file mode 100644
index 259c3b4..0000000
--- a/kvm-target-i386-mshv-Use-preallocated-page-for-hvcall.patch
+++ /dev/null
@@ -1,193 +0,0 @@
-From 553c58c0e1560ee83e90b1751ec79874a0a7addf Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Thu, 2 Oct 2025 09:50:12 +0200
-Subject: [PATCH 28/32] target/i386/mshv: Use preallocated page for hvcall
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [26/30] 338fa20beaaa44e30512d49026d2a9e9dd016b53
-
-There are hvcalls that are invoked during MMIO exits, the payload is of
-dynamic size. To avoid heap allocations we can use preallocated pages as
-in/out buffer for those calls. A page is reserved per vCPU and used for
-set/get register hv calls.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-26-magnuskulke@linux.microsoft.com
-[Use standard MAX_CONST macro; mshv.h/mshv_int.h split. - Paolo]
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit e4a20afce59937073298d716cc829bdc026542dc)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- accel/mshv/mshv-all.c | 2 +-
- include/system/mshv_int.h | 7 +++++++
- target/i386/mshv/mshv-cpu.c | 38 +++++++++++++++++++++++++------------
- 3 files changed, 34 insertions(+), 13 deletions(-)
-
-diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c
-index 5edfcbad9d..45174f7c4e 100644
---- a/accel/mshv/mshv-all.c
-+++ b/accel/mshv/mshv-all.c
-@@ -399,8 +399,8 @@ static int mshv_init_vcpu(CPUState *cpu)
- uint8_t vp_index = cpu->cpu_index;
- int ret;
-
-- mshv_arch_init_vcpu(cpu);
- cpu->accel = g_new0(AccelCPUState, 1);
-+ mshv_arch_init_vcpu(cpu);
-
- ret = mshv_create_vcpu(vm_fd, vp_index, &cpu->accel->cpufd);
- if (ret < 0) {
-diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h
-index 6350c69e9d..490563c1ab 100644
---- a/include/system/mshv_int.h
-+++ b/include/system/mshv_int.h
-@@ -20,9 +20,16 @@
-
- typedef struct hyperv_message hv_message;
-
-+typedef struct MshvHvCallArgs {
-+ void *base;
-+ void *input_page;
-+ void *output_page;
-+} MshvHvCallArgs;
-+
- struct AccelCPUState {
- int cpufd;
- bool dirty;
-+ MshvHvCallArgs hvcall_args;
- };
-
- typedef struct MshvMemoryListener {
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index de87142bff..1f7b9cb37e 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -34,6 +34,10 @@
-
- #include <sys/ioctl.h>
-
-+#define MAX_REGISTER_COUNT (MAX_CONST(ARRAY_SIZE(STANDARD_REGISTER_NAMES), \
-+ MAX_CONST(ARRAY_SIZE(SPECIAL_REGISTER_NAMES), \
-+ ARRAY_SIZE(FPU_REGISTER_NAMES))))
-+
- static enum hv_register_name STANDARD_REGISTER_NAMES[18] = {
- HV_X64_REGISTER_RAX,
- HV_X64_REGISTER_RBX,
-@@ -151,7 +155,7 @@ int mshv_set_generic_regs(const CPUState *cpu, const hv_register_assoc *assocs,
- int cpu_fd = mshv_vcpufd(cpu);
- int vp_index = cpu->cpu_index;
- size_t in_sz, assocs_sz;
-- hv_input_set_vp_registers *in;
-+ hv_input_set_vp_registers *in = cpu->accel->hvcall_args.input_page;
- struct mshv_root_hvcall args = {0};
- int ret;
-
-@@ -160,7 +164,7 @@ int mshv_set_generic_regs(const CPUState *cpu, const hv_register_assoc *assocs,
- in_sz = sizeof(hv_input_set_vp_registers) + assocs_sz;
-
- /* fill the input struct */
-- in = g_malloc0(in_sz);
-+ memset(in, 0, sizeof(hv_input_set_vp_registers));
- in->vp_index = vp_index;
- memcpy(in->elements, assocs, assocs_sz);
-
-@@ -172,7 +176,6 @@ int mshv_set_generic_regs(const CPUState *cpu, const hv_register_assoc *assocs,
-
- /* perform the call */
- ret = mshv_hvcall(cpu_fd, &args);
-- g_free(in);
- if (ret < 0) {
- error_report("Failed to set registers");
- return -1;
-@@ -193,8 +196,8 @@ static int get_generic_regs(CPUState *cpu, hv_register_assoc *assocs,
- {
- int cpu_fd = mshv_vcpufd(cpu);
- int vp_index = cpu->cpu_index;
-- hv_input_get_vp_registers *in;
-- hv_register_value *values;
-+ hv_input_get_vp_registers *in = cpu->accel->hvcall_args.input_page;
-+ hv_register_value *values = cpu->accel->hvcall_args.output_page;
- size_t in_sz, names_sz, values_sz;
- int i, ret;
- struct mshv_root_hvcall args = {0};
-@@ -204,15 +207,14 @@ static int get_generic_regs(CPUState *cpu, hv_register_assoc *assocs,
- in_sz = sizeof(hv_input_get_vp_registers) + names_sz;
-
- /* fill the input struct */
-- in = g_malloc0(in_sz);
-+ memset(in, 0, sizeof(hv_input_get_vp_registers));
- in->vp_index = vp_index;
- for (i = 0; i < n_regs; i++) {
- in->names[i] = assocs[i].name;
- }
-
-- /* allocate value output buffer */
-+ /* determine size of value output buffer */
- values_sz = n_regs * sizeof(union hv_register_value);
-- values = g_malloc0(values_sz);
-
- /* create the hvcall envelope */
- args.code = HVCALL_GET_VP_REGISTERS;
-@@ -224,16 +226,13 @@ static int get_generic_regs(CPUState *cpu, hv_register_assoc *assocs,
-
- /* perform the call */
- ret = mshv_hvcall(cpu_fd, &args);
-- g_free(in);
- if (ret < 0) {
-- g_free(values);
- error_report("Failed to retrieve registers");
- return -1;
- }
-
- /* assert we got all registers */
- if (args.reps != n_regs) {
-- g_free(values);
- error_report("Failed to retrieve registers: expected %zu elements"
- ", got %u", n_regs, args.reps);
- return -1;
-@@ -243,7 +242,6 @@ static int get_generic_regs(CPUState *cpu, hv_register_assoc *assocs,
- for (i = 0; i < n_regs; i++) {
- assocs[i].value = values[i];
- }
-- g_free(values);
-
- return 0;
- }
-@@ -1696,6 +1694,19 @@ void mshv_arch_init_vcpu(CPUState *cpu)
- {
- X86CPU *x86_cpu = X86_CPU(cpu);
- CPUX86State *env = &x86_cpu->env;
-+ AccelCPUState *state = cpu->accel;
-+ size_t page = HV_HYP_PAGE_SIZE;
-+ void *mem = qemu_memalign(page, 2 * page);
-+
-+ /* sanity check, to make sure we don't overflow the page */
-+ QEMU_BUILD_BUG_ON((MAX_REGISTER_COUNT
-+ * sizeof(hv_register_assoc)
-+ + sizeof(hv_input_get_vp_registers)
-+ > HV_HYP_PAGE_SIZE));
-+
-+ state->hvcall_args.base = mem;
-+ state->hvcall_args.input_page = mem;
-+ state->hvcall_args.output_page = (uint8_t *)mem + page;
-
- env->emu_mmio_buf = g_new(char, 4096);
- }
-@@ -1704,7 +1715,10 @@ void mshv_arch_destroy_vcpu(CPUState *cpu)
- {
- X86CPU *x86_cpu = X86_CPU(cpu);
- CPUX86State *env = &x86_cpu->env;
-+ AccelCPUState *state = cpu->accel;
-
-+ g_free(state->hvcall_args.base);
-+ state->hvcall_args = (MshvHvCallArgs){0};
- g_clear_pointer(&env->emu_mmio_buf, g_free);
- }
-
---
-2.47.3
-
diff --git a/kvm-target-i386-mshv-Write-MSRs-to-the-hypervisor.patch b/kvm-target-i386-mshv-Write-MSRs-to-the-hypervisor.patch
deleted file mode 100644
index 6ec7aa4..0000000
--- a/kvm-target-i386-mshv-Write-MSRs-to-the-hypervisor.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 07b03c6440308cb6294ee2d2e4518df052b2a363 Mon Sep 17 00:00:00 2001
-From: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Date: Tue, 16 Sep 2025 18:48:41 +0200
-Subject: [PATCH 24/32] target/i386/mshv: Write MSRs to the hypervisor
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [22/30] 8b9720dbc31e48c43e618a0650a21eb5a43b7954
-
-Push current model-specific register (MSR) values to MSHV's vCPUs as
-part of setting state to the hypervisor.
-
-Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20250916164847.77883-22-magnuskulke@linux.microsoft.com
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 64118f452cbd97cd9fa790b1c15b65b435f136d2)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
- target/i386/mshv/mshv-cpu.c | 68 +++++++++++++++++++++++++++++++++++--
- 1 file changed, 66 insertions(+), 2 deletions(-)
-
-diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
-index 424ebdb122..33a3ce8b11 100644
---- a/target/i386/mshv/mshv-cpu.c
-+++ b/target/i386/mshv/mshv-cpu.c
-@@ -998,6 +998,65 @@ static int put_regs(const CPUState *cpu)
- return 0;
- }
-
-+struct MsrPair {
-+ uint32_t index;
-+ uint64_t value;
-+};
-+
-+static int put_msrs(const CPUState *cpu)
-+{
-+ int ret = 0;
-+ X86CPU *x86cpu = X86_CPU(cpu);
-+ CPUX86State *env = &x86cpu->env;
-+ MshvMsrEntries *msrs = g_malloc0(sizeof(MshvMsrEntries));
-+
-+ struct MsrPair pairs[] = {
-+ { MSR_IA32_SYSENTER_CS, env->sysenter_cs },
-+ { MSR_IA32_SYSENTER_ESP, env->sysenter_esp },
-+ { MSR_IA32_SYSENTER_EIP, env->sysenter_eip },
-+ { MSR_EFER, env->efer },
-+ { MSR_PAT, env->pat },
-+ { MSR_STAR, env->star },
-+ { MSR_CSTAR, env->cstar },
-+ { MSR_LSTAR, env->lstar },
-+ { MSR_KERNELGSBASE, env->kernelgsbase },
-+ { MSR_FMASK, env->fmask },
-+ { MSR_MTRRdefType, env->mtrr_deftype },
-+ { MSR_VM_HSAVE_PA, env->vm_hsave },
-+ { MSR_SMI_COUNT, env->msr_smi_count },
-+ { MSR_IA32_PKRS, env->pkrs },
-+ { MSR_IA32_BNDCFGS, env->msr_bndcfgs },
-+ { MSR_IA32_XSS, env->xss },
-+ { MSR_IA32_UMWAIT_CONTROL, env->umwait },
-+ { MSR_IA32_TSX_CTRL, env->tsx_ctrl },
-+ { MSR_AMD64_TSC_RATIO, env->amd_tsc_scale_msr },
-+ { MSR_TSC_AUX, env->tsc_aux },
-+ { MSR_TSC_ADJUST, env->tsc_adjust },
-+ { MSR_IA32_SMBASE, env->smbase },
-+ { MSR_IA32_SPEC_CTRL, env->spec_ctrl },
-+ { MSR_VIRT_SSBD, env->virt_ssbd },
-+ };
-+
-+ if (ARRAY_SIZE(pairs) > MSHV_MSR_ENTRIES_COUNT) {
-+ error_report("MSR entries exceed maximum size");
-+ g_free(msrs);
-+ return -1;
-+ }
-+
-+ for (size_t i = 0; i < ARRAY_SIZE(pairs); i++) {
-+ MshvMsrEntry *entry = &msrs->entries[i];
-+ entry->index = pairs[i].index;
-+ entry->reserved = 0;
-+ entry->data = pairs[i].value;
-+ msrs->nmsrs++;
-+ }
-+
-+ ret = mshv_configure_msr(cpu, &msrs->entries[0], msrs->nmsrs);
-+ g_free(msrs);
-+ return ret;
-+}
-+
-+
- int mshv_arch_put_registers(const CPUState *cpu)
- {
- int ret;
-@@ -1008,8 +1067,13 @@ int mshv_arch_put_registers(const CPUState *cpu)
- return -1;
- }
-
-- error_report("unimplemented");
-- abort();
-+ ret = put_msrs(cpu);
-+ if (ret < 0) {
-+ error_report("Failed to put msrs");
-+ return -1;
-+ }
-+
-+ return 0;
- }
-
- void mshv_arch_amend_proc_features(
---
-2.47.3
-
diff --git a/kvm-tests-functional-add-tests-for-SCLP-event-CPI.patch b/kvm-tests-functional-add-tests-for-SCLP-event-CPI.patch
deleted file mode 100644
index 502a79a..0000000
--- a/kvm-tests-functional-add-tests-for-SCLP-event-CPI.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-From c8082b70cdd198a4a5236ca0543e2653663fb1d4 Mon Sep 17 00:00:00 2001
-From: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
-Date: Thu, 16 Oct 2025 14:17:08 +0200
-Subject: [PATCH 02/10] tests/functional: add tests for SCLP event CPI
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Thomas Huth <thuth@redhat.com>
-RH-MergeRequest: 412: Add -rhel9.8.0 and -rhel10.2.0 s390x machine types and enable the CPI feature
-RH-Jira: RHEL-104009 RHEL-105823 RHEL-73008
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/3] 7ff3e50bf038921d4514db88ef147ba92f960780 (thuth/qemu-kvm-cs)
-
-JIRA: https://issues.redhat.com/browse/RHEL-73008
-
-Add tests for SCLP event type Control-Program Identification.
-
-Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
-Suggested-by: Thomas Huth <thuth@redhat.com>
-Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
-Reviewed-by Thomas Huth <thuth@redhat.com>
-Message-ID: <20251016121708.334133-2-shalini@linux.ibm.com>
-Signed-off-by: Thomas Huth <thuth@redhat.com>
-(cherry picked from commit bc436b739c3c8683ef5e8c22391952dcaa95242e)
----
- tests/functional/test_s390x_ccw_virtio.py | 26 +++++++++++++++++++++++
- 1 file changed, 26 insertions(+)
-
-diff --git a/tests/functional/test_s390x_ccw_virtio.py b/tests/functional/test_s390x_ccw_virtio.py
-index 453711aa0f..0455337856 100755
---- a/tests/functional/test_s390x_ccw_virtio.py
-+++ b/tests/functional/test_s390x_ccw_virtio.py
-@@ -15,6 +15,7 @@
- import tempfile
-
- from qemu_test import QemuSystemTest, Asset
-+from qemu_test import exec_command
- from qemu_test import exec_command_and_wait_for_pattern
- from qemu_test import wait_for_console_pattern
-
-@@ -270,5 +271,30 @@ def test_s390x_fedora(self):
- 'while ! (dmesg -c | grep Start.virtcrypto_remove) ; do'
- ' sleep 1 ; done', 'Start virtcrypto_remove.')
-
-+ # Test SCLP event Control-Program Identification (CPI)
-+ cpi = '/sys/firmware/cpi/'
-+ sclpcpi = '/machine/sclp/s390-sclp-event-facility/sclpcpi'
-+ self.log.info("Test SCLP event CPI")
-+ exec_command(self, 'echo TESTVM > ' + cpi + 'system_name')
-+ exec_command(self, 'echo LINUX > ' + cpi + 'system_type')
-+ exec_command(self, 'echo TESTPLEX > ' + cpi + 'sysplex_name')
-+ exec_command(self, 'echo 0x001a000000060b00 > ' + cpi + 'system_level')
-+ exec_command_and_wait_for_pattern(self,
-+ 'echo 1 > ' + cpi + 'set', ':/#')
-+ try:
-+ event = self.vm.event_wait('SCLP_CPI_INFO_AVAILABLE')
-+ except TimeoutError:
-+ self.fail('Timed out waiting for the SCLP_CPI_INFO_AVAILABLE event')
-+ ts = self.vm.cmd('qom-get', path=sclpcpi, property='timestamp')
-+ self.assertNotEqual(ts, 0)
-+ name = self.vm.cmd('qom-get', path=sclpcpi, property='system_name')
-+ self.assertEqual(name.strip(), 'TESTVM')
-+ typ = self.vm.cmd('qom-get', path=sclpcpi, property='system_type')
-+ self.assertEqual(typ.strip(), 'LINUX')
-+ sysplex = self.vm.cmd('qom-get', path=sclpcpi, property='sysplex_name')
-+ self.assertEqual(sysplex.strip(), 'TESTPLEX')
-+ level = self.vm.cmd('qom-get', path=sclpcpi, property='system_level')
-+ self.assertEqual(level, 0x001a000000060b00)
-+
- if __name__ == '__main__':
- QemuSystemTest.main()
---
-2.47.3
-
diff --git a/kvm-tests-qemu-iotest-fix-iotest-024-with-qed-images.patch b/kvm-tests-qemu-iotest-fix-iotest-024-with-qed-images.patch
deleted file mode 100644
index 7abc314..0000000
--- a/kvm-tests-qemu-iotest-fix-iotest-024-with-qed-images.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 327ef6e8b3ea224047409dea90edba5c59f174ad Mon Sep 17 00:00:00 2001
-From: Alberto Garcia <berto@igalia.com>
-Date: Wed, 12 Nov 2025 18:09:57 +0100
-Subject: [PATCH 29/52] tests/qemu-iotest: fix iotest 024 with qed images
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [22/45] ec515379b04946e4730812abccc7d72ff6c7df26 (kmwolf/centos-qemu-kvm)
-
-Use 'qemu-io -c map' instead of 'qemu-img map' to get an output that
-works with both image types.
-
-Cc: qemu-stable <qemu-stable@nongnu.org>
-Fixes: 909852ba6b4a ("qemu-img rebase: don't exceed IO_BUF_SIZE in one operation")
-Fixes: 26b17e34bedb ("qemu-img rebase: don't exceed IO_BUF_SIZE in one operation") in 10.1.x
-Signed-off-by: Alberto Garcia <berto@igalia.com>
-Message-ID: <20251112170959.700840-1-berto@igalia.com>
-Reviewed-by: Eric Blake <eblake@redhat.com>
-Tested-by: Thomas Huth <thuth@redhat.com>
-Signed-off-by: Eric Blake <eblake@redhat.com>
-(cherry picked from commit 4c91719a6a78a1c24d8bb854f7594e767962d0d9)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- tests/qemu-iotests/024 | 2 +-
- tests/qemu-iotests/024.out | 3 +--
- 2 files changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/tests/qemu-iotests/024 b/tests/qemu-iotests/024
-index 021169b4a1..10be2bd845 100755
---- a/tests/qemu-iotests/024
-+++ b/tests/qemu-iotests/024
-@@ -359,7 +359,7 @@ $QEMU_IO "$OVERLAY" -c "read -P 0x00 0 1M" | _filter_qemu_io
- $QEMU_IO "$OVERLAY" -c "read -P 0xff 1M 2M" | _filter_qemu_io
- $QEMU_IO "$OVERLAY" -c "read -P 0x00 3M 1M" | _filter_qemu_io
-
--$QEMU_IMG map "$OVERLAY" | _filter_qemu_img_map
-+$QEMU_IO -c map "$OVERLAY" | _filter_qemu_io
-
- echo
-
-diff --git a/tests/qemu-iotests/024.out b/tests/qemu-iotests/024.out
-index 1b7522ba71..da8fedc08b 100644
---- a/tests/qemu-iotests/024.out
-+++ b/tests/qemu-iotests/024.out
-@@ -266,7 +266,6 @@ read 2097152/2097152 bytes at offset 1048576
- 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
- read 1048576/1048576 bytes at offset 3145728
- 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
--Offset Length File
--0 0x400000 TEST_DIR/subdir/t.IMGFMT
-+4 MiB (0x400000) bytes allocated at offset 0 bytes (0x0)
-
- *** done
---
-2.52.0
-
diff --git a/kvm-tests-qemu-iotests-Fix-check-for-existing-file-in-_r.patch b/kvm-tests-qemu-iotests-Fix-check-for-existing-file-in-_r.patch
deleted file mode 100644
index 1d961f6..0000000
--- a/kvm-tests-qemu-iotests-Fix-check-for-existing-file-in-_r.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 588224f69f23d255c577ddc6fabcdb4288c420b0 Mon Sep 17 00:00:00 2001
-From: Thomas Huth <thuth@redhat.com>
-Date: Mon, 8 Dec 2025 08:53:20 +0100
-Subject: [PATCH 30/52] tests/qemu-iotests: Fix check for existing file in
- _require_disk_usage()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [23/45] e757b9e7b5fb75c2093d1a7a85332188dd4daa38 (kmwolf/centos-qemu-kvm)
-
-Looks like the "$" has been forgotten here to get the contents of
-the FILENAME variable.
-
-Fixes: c49dda7254d ("iotests: Filter out ZFS in several tests")
-Signed-off-by: Thomas Huth <thuth@redhat.com>
-Message-ID: <20251208075320.35682-1-thuth@redhat.com>
-Reviewed-by: Laurent Vivier <laurent@vivier.eu>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit ab0065e36adf8becd9c1ffceec37ee809ce683af)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- tests/qemu-iotests/common.rc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
-index e977cb4eb6..d8fe476806 100644
---- a/tests/qemu-iotests/common.rc
-+++ b/tests/qemu-iotests/common.rc
-@@ -1008,7 +1008,7 @@ _require_disk_usage()
- else
- FILENAME="$TEST_IMG_FILE"
- fi
-- if [ -e "FILENAME" ]; then
-+ if [ -e "$FILENAME" ]; then
- echo "unwilling to overwrite existing file"
- exit 1
- fi
---
-2.52.0
-
diff --git a/kvm-tests-qtest-bios-tables-test-Prepare-for-IORT-reviso.patch b/kvm-tests-qtest-bios-tables-test-Prepare-for-IORT-reviso.patch
deleted file mode 100644
index a83cb95..0000000
--- a/kvm-tests-qtest-bios-tables-test-Prepare-for-IORT-reviso.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 245045065cd09440ed4909fdab7483a3e785b480 Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 032/111] tests/qtest/bios-tables-test: Prepare for IORT
- revison upgrade
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [32/111] a7efe2b4794db4049552c7b777d398d495c907b3 (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Subsequent patch will upgrade IORT revision to 5 to add support
-for IORT RMR nodes.
-
-Add the affected IORT blobs to allowed-diff list for bios-table
-tests.
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-25-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit b8e196a746eb279ba5b713de9b236259f944c82d)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- tests/qtest/bios-tables-test-allowed-diff.h | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
-index dfb8523c8b..3279638ad0 100644
---- a/tests/qtest/bios-tables-test-allowed-diff.h
-+++ b/tests/qtest/bios-tables-test-allowed-diff.h
-@@ -1 +1,5 @@
- /* List of comma-separated changed AML files to ignore */
-+"tests/data/acpi/aarch64/virt/IORT",
-+"tests/data/acpi/aarch64/virt/IORT.its_off",
-+"tests/data/acpi/aarch64/virt/IORT.smmuv3-legacy",
-+"tests/data/acpi/aarch64/virt/IORT.smmuv3-dev",
---
-2.52.0
-
diff --git a/kvm-tests-qtest-bios-tables-test-Update-IORT-blobs-after.patch b/kvm-tests-qtest-bios-tables-test-Update-IORT-blobs-after.patch
deleted file mode 100644
index c3449da..0000000
--- a/kvm-tests-qtest-bios-tables-test-Update-IORT-blobs-after.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From d7aecf7edeb7efbe4d7110f1251ab347e01c730e Mon Sep 17 00:00:00 2001
-From: Shameer Kolothum <skolothumtho@nvidia.com>
-Date: Thu, 29 Jan 2026 13:32:05 +0000
-Subject: [PATCH 034/111] tests/qtest/bios-tables-test: Update IORT blobs after
- revision upgrade
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [34/111] 7ece86f5a44f645061770b685d34b4909ff5561a (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73794
-
-Update the reference IORT blobs after revision upgrade for RMR node
-support. This affects the aarch64 'virt' IORT tests.
-
-IORT diff is the same for all the tests:
-
- /*
- * Intel ACPI Component Architecture
- * AML/ASL+ Disassembler version 20230628 (64-bit version)
- * Copyright (c) 2000 - 2023 Intel Corporation
- *
-- * Disassembly of tests/data/acpi/aarch64/virt/IORT, Mon Oct 20 14:42:41 2025
-+ * Disassembly of /tmp/aml-B4ZRE3, Mon Oct 20 14:42:41 2025
- *
- * ACPI Data Table [IORT]
- *
- * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue (in hex)
- */
-
- [000h 0000 004h] Signature : "IORT" [IO Remapping Table]
- [004h 0004 004h] Table Length : 00000080
--[008h 0008 001h] Revision : 03
--[009h 0009 001h] Checksum : B3
-+[008h 0008 001h] Revision : 05
-+[009h 0009 001h] Checksum : B1
- [00Ah 0010 006h] Oem ID : "BOCHS "
- [010h 0016 008h] Oem Table ID : "BXPC "
- [018h 0024 004h] Oem Revision : 00000001
- [01Ch 0028 004h] Asl Compiler ID : "BXPC"
- [020h 0032 004h] Asl Compiler Revision : 00000001
- ...
-
-Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Eric Auger <eric.auger@redhat.com>
-Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
-Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Message-id: 20260126104342.253965-27-skolothumtho@nvidia.com
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit f48bddafa251503a2aa4a6eb9dd612ec9c0781f7)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- tests/data/acpi/aarch64/virt/IORT | Bin 128 -> 128 bytes
- tests/data/acpi/aarch64/virt/IORT.its_off | Bin 172 -> 172 bytes
- tests/data/acpi/aarch64/virt/IORT.smmuv3-dev | Bin 364 -> 364 bytes
- tests/data/acpi/aarch64/virt/IORT.smmuv3-legacy | Bin 276 -> 276 bytes
- tests/qtest/bios-tables-test-allowed-diff.h | 4 ----
- 5 files changed, 4 deletions(-)
-
-diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
-index 3279638ad0..dfb8523c8b 100644
---- a/tests/qtest/bios-tables-test-allowed-diff.h
-+++ b/tests/qtest/bios-tables-test-allowed-diff.h
-@@ -1,5 +1 @@
- /* List of comma-separated changed AML files to ignore */
--"tests/data/acpi/aarch64/virt/IORT",
--"tests/data/acpi/aarch64/virt/IORT.its_off",
--"tests/data/acpi/aarch64/virt/IORT.smmuv3-legacy",
--"tests/data/acpi/aarch64/virt/IORT.smmuv3-dev",
---
-2.52.0
-
diff --git a/kvm-throttle-group-Fix-race-condition-in-throttle_group_.patch b/kvm-throttle-group-Fix-race-condition-in-throttle_group_.patch
deleted file mode 100644
index 87a359e..0000000
--- a/kvm-throttle-group-Fix-race-condition-in-throttle_group_.patch
+++ /dev/null
@@ -1,179 +0,0 @@
-From 8340b5280edd665c0b1bc6d11c28099252f92d8a Mon Sep 17 00:00:00 2001
-From: Alberto Garcia <berto@igalia.com>
-Date: Thu, 12 Mar 2026 13:12:00 +0100
-Subject: [PATCH 21/52] throttle-group: Fix race condition in
- throttle_group_restart_queue()
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [14/45] 695ff7204a816025291b74409abfdff6963075f4 (kmwolf/centos-qemu-kvm)
-
-When a timer is fired a pending I/O request is restarted and
-tg->any_timer_armed is reset so other requests can be scheduled.
-
-However we're resetting any_timer_armed first in timer_cb() before
-the request is actually restarted, and there's a window between both
-moments in which another thread can arm the same timer, hitting an
-assertion in throttle_group_restart_queue().
-
-This can be solved by deferring the reset of tg->any_timer_armed to
-the moment when the queue is actually restarted, which is protected by
-tg->lock, preventing other threads from arming the timer before that.
-
-In addition to that, throttle_group_restart_tgm() is also updated to
-hold tg->lock while the timer is being inspected. Here we consider
-three different scenarios:
-
-- If the tgm has a timer set, fire it immediately
-- If another tgm has a timer set, restart the queue anyway
-- If there is no timer set in this group then simulate a timer that
- fires immediately, by setting tg->any_timer_armed in order to
- prevent other threads from arming a timer in the meantime.
-
-Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3194
-Signed-off-by: Alberto Garcia <berto@igalia.com>
-Message-Id: <825598ef34ad384d936da19d634eda75598508f7.1773316842.git.berto@igalia.com>
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-(cherry picked from commit 9c8430f5d65144b85ad76433369288182a1c7baa)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- block/throttle-groups.c | 79 +++++++++++++++++++++++++++++++----------
- 1 file changed, 60 insertions(+), 19 deletions(-)
-
-diff --git a/block/throttle-groups.c b/block/throttle-groups.c
-index 5329ff1fdb..4b1b1944c2 100644
---- a/block/throttle-groups.c
-+++ b/block/throttle-groups.c
-@@ -391,6 +391,7 @@ void coroutine_fn throttle_group_co_io_limits_intercept(ThrottleGroupMember *tgm
- typedef struct {
- ThrottleGroupMember *tgm;
- ThrottleDirection direction;
-+ bool reset_timer_armed;
- } RestartData;
-
- static void coroutine_fn throttle_group_restart_queue_entry(void *opaque)
-@@ -403,6 +404,9 @@ static void coroutine_fn throttle_group_restart_queue_entry(void *opaque)
- bool empty_queue;
-
- qemu_mutex_lock(&tg->lock);
-+ if (data->reset_timer_armed) {
-+ tg->any_timer_armed[direction] = false;
-+ }
- empty_queue = !throttle_group_co_restart_queue(tgm, direction);
-
- /* If the request queue was empty then we have to take care of
-@@ -419,18 +423,23 @@ static void coroutine_fn throttle_group_restart_queue_entry(void *opaque)
- }
-
- static void throttle_group_restart_queue(ThrottleGroupMember *tgm,
-- ThrottleDirection direction)
-+ ThrottleDirection direction,
-+ bool reset_timer_armed)
- {
- Coroutine *co;
- RestartData *rd = g_new0(RestartData, 1);
-
- rd->tgm = tgm;
- rd->direction = direction;
-+ rd->reset_timer_armed = reset_timer_armed;
-
-- /* This function is called when a timer is fired or when
-- * throttle_group_restart_tgm() is called. Either way, there can
-+ /* If reset_timer_armed is set then this means that this function
-+ * was called when a timer was fired (either from timer_cb() or
-+ * from throttle_group_restart_tgm()). In this case there can
- * be no timer pending on this tgm at this point */
-- assert(!timer_pending(tgm->throttle_timers.timers[direction]));
-+ if (reset_timer_armed) {
-+ assert(!timer_pending(tgm->throttle_timers.timers[direction]));
-+ }
-
- qatomic_inc(&tgm->restart_pending);
-
-@@ -444,15 +453,50 @@ void throttle_group_restart_tgm(ThrottleGroupMember *tgm)
-
- if (tgm->throttle_state) {
- for (dir = THROTTLE_READ; dir < THROTTLE_MAX; dir++) {
-- QEMUTimer *t = tgm->throttle_timers.timers[dir];
-+ QEMUTimer *t;
-+ ThrottleState *ts = tgm->throttle_state;
-+ ThrottleGroup *tg = container_of(ts, ThrottleGroup, ts);
-+ bool reset_timer_armed;
-+
-+ /*
-+ * This function restarts the tgm's queue immediately.
-+ * This is used for example for callers to drain all requests.
-+ * There are three different scenarios depending on whether
-+ * a timer is armed for this tg and which tgm owns the timer.
-+ */
-+
-+ qemu_mutex_lock(&tg->lock);
-+
-+ t = tgm->throttle_timers.timers[dir];
- if (timer_pending(t)) {
-- /* If there's a pending timer on this tgm, fire it now */
-+ /*
-+ * Case 1: this tgm has a pending timer.
-+ * We can fire the timer immediately.
-+ */
- timer_del(t);
-- timer_cb(tgm, dir);
-+ reset_timer_armed = true;
-+ } else if (tg->any_timer_armed[dir]) {
-+ /*
-+ * Case 2: another tgm has a pending timer.
-+ * In this case we can still restart the queue but we
-+ * have to leave any_timer_armed untouched so the
-+ * other tgm's timer is not disrupted.
-+ */
-+ reset_timer_armed = false;
- } else {
-- /* Else run the next request from the queue manually */
-- throttle_group_restart_queue(tgm, dir);
-+ /*
-+ * Case 3: there is no timer set for this group.
-+ * Here we can simulate a timer that fires immediately,
-+ * so the queue is restarted but no other thread
-+ * can arm a timer in the meantime.
-+ */
-+ tg->any_timer_armed[dir] = true;
-+ reset_timer_armed = true;
- }
-+
-+ qemu_mutex_unlock(&tg->lock);
-+
-+ throttle_group_restart_queue(tgm, dir, reset_timer_armed);
- }
- }
- }
-@@ -499,16 +543,13 @@ void throttle_group_get_config(ThrottleGroupMember *tgm, ThrottleConfig *cfg)
- */
- static void timer_cb(ThrottleGroupMember *tgm, ThrottleDirection direction)
- {
-- ThrottleState *ts = tgm->throttle_state;
-- ThrottleGroup *tg = container_of(ts, ThrottleGroup, ts);
--
-- /* The timer has just been fired, so we can update the flag */
-- qemu_mutex_lock(&tg->lock);
-- tg->any_timer_armed[direction] = false;
-- qemu_mutex_unlock(&tg->lock);
--
-- /* Run the request that was waiting for this timer */
-- throttle_group_restart_queue(tgm, direction);
-+ /*
-+ * Run the request that was waiting for this timer.
-+ * tg->any_timer_armed needs to be cleared, but we'll do it later
-+ * when the queue is restarted in order to prevent another thread
-+ * from arming the timer before that.
-+ */
-+ throttle_group_restart_queue(tgm, direction, true);
- }
-
- static void read_timer_cb(void *opaque)
---
-2.52.0
-
diff --git a/kvm-treewide-handle-result-of-qio_channel_set_blocking.patch b/kvm-treewide-handle-result-of-qio_channel_set_blocking.patch
deleted file mode 100644
index b2b05d5..0000000
--- a/kvm-treewide-handle-result-of-qio_channel_set_blocking.patch
+++ /dev/null
@@ -1,401 +0,0 @@
-From 89171faf9a80ac41fa9a8625782503cb6570e06a Mon Sep 17 00:00:00 2001
-From: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-Date: Tue, 16 Sep 2025 16:13:53 +0300
-Subject: [PATCH 048/116] treewide: handle result of qio_channel_set_blocking()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [32/100] 0d816a7a5efb940a01f4bba3e2a3a91f12af3cd4 (rovick1/qemu-kvm)
-
-Currently, we just always pass NULL as errp argument. That doesn't
-look good.
-
-Some realizations of interface may actually report errors.
-Channel-socket realization actually either ignore or crash on
-errors, but we are going to straighten it out to always reporting
-an errp in further commits.
-
-So, convert all callers to either handle the error (where environment
-allows) or explicitly use &error_abort.
-
-Take also a chance to change the return value to more convenient
-bool (keeping also in mind, that underlying realizations may
-return -1 on failure, not -errno).
-
-Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-[DB: fix return type mismatch in TLS/websocket channel
- impls for qio_channel_set_blocking]
-Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-(cherry picked from commit 1ed8903916394fca2347c700da974ca3856274b2)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- block/nbd.c | 4 +++-
- chardev/char-socket.c | 20 ++++++++++++++++----
- hw/remote/proxy.c | 6 +++++-
- hw/remote/remote-obj.c | 6 +++++-
- hw/vfio-user/proxy.c | 11 ++++++++---
- include/io/channel.h | 6 +++---
- io/channel-tls.c | 2 +-
- io/channel-websock.c | 3 +--
- io/channel.c | 4 ++--
- nbd/server.c | 4 +++-
- scsi/qemu-pr-helper.c | 9 ++++++---
- tests/unit/io-channel-helpers.c | 5 +++--
- tests/unit/test-io-channel-tls.c | 4 ++--
- tools/i386/qemu-vmsr-helper.c | 6 ++++--
- ui/vnc.c | 2 +-
- util/vhost-user-server.c | 7 ++++++-
- 16 files changed, 69 insertions(+), 30 deletions(-)
-
-diff --git a/block/nbd.c b/block/nbd.c
-index d5a2b21c6d..5d231d5c4e 100644
---- a/block/nbd.c
-+++ b/block/nbd.c
-@@ -351,7 +351,9 @@ int coroutine_fn nbd_co_do_establish_connection(BlockDriverState *bs,
- return ret;
- }
-
-- qio_channel_set_blocking(s->ioc, false, NULL);
-+ if (!qio_channel_set_blocking(s->ioc, false, errp)) {
-+ return -EINVAL;
-+ }
- qio_channel_set_follow_coroutine_ctx(s->ioc, true);
-
- /* successfully connected */
-diff --git a/chardev/char-socket.c b/chardev/char-socket.c
-index 1e8313915b..f155269890 100644
---- a/chardev/char-socket.c
-+++ b/chardev/char-socket.c
-@@ -539,16 +539,24 @@ static int tcp_chr_sync_read(Chardev *chr, const uint8_t *buf, int len)
- SocketChardev *s = SOCKET_CHARDEV(chr);
- int size;
- int saved_errno;
-+ Error *local_err = NULL;
-
- if (s->state != TCP_CHARDEV_STATE_CONNECTED) {
- return 0;
- }
-
-- qio_channel_set_blocking(s->ioc, true, NULL);
-+ if (!qio_channel_set_blocking(s->ioc, true, &local_err)) {
-+ error_report_err(local_err);
-+ return -1;
-+ }
- size = tcp_chr_recv(chr, (void *) buf, len);
- saved_errno = errno;
- if (s->state != TCP_CHARDEV_STATE_DISCONNECTED) {
-- qio_channel_set_blocking(s->ioc, false, NULL);
-+ if (!qio_channel_set_blocking(s->ioc, false, &local_err)) {
-+ error_report_err(local_err);
-+ /* failed to recover non-blocking state */
-+ tcp_chr_disconnect(chr);
-+ }
- }
- if (size == 0) {
- /* connection closed */
-@@ -893,18 +901,22 @@ static void tcp_chr_set_client_ioc_name(Chardev *chr,
- static int tcp_chr_new_client(Chardev *chr, QIOChannelSocket *sioc)
- {
- SocketChardev *s = SOCKET_CHARDEV(chr);
-+ Error *local_err = NULL;
-
- if (s->state != TCP_CHARDEV_STATE_CONNECTING) {
- return -1;
- }
-
-+ if (!qio_channel_set_blocking(QIO_CHANNEL(sioc), false, &local_err)) {
-+ error_report_err(local_err);
-+ return -1;
-+ }
-+
- s->ioc = QIO_CHANNEL(sioc);
- object_ref(OBJECT(sioc));
- s->sioc = sioc;
- object_ref(OBJECT(sioc));
-
-- qio_channel_set_blocking(s->ioc, false, NULL);
--
- if (s->do_nodelay) {
- qio_channel_set_delay(s->ioc, false);
- }
-diff --git a/hw/remote/proxy.c b/hw/remote/proxy.c
-index b0165aa2a1..18e0f7a064 100644
---- a/hw/remote/proxy.c
-+++ b/hw/remote/proxy.c
-@@ -112,8 +112,12 @@ static void pci_proxy_dev_realize(PCIDevice *device, Error **errp)
- return;
- }
-
-+ if (!qio_channel_set_blocking(dev->ioc, true, errp)) {
-+ object_unref(dev->ioc);
-+ return;
-+ }
-+
- qemu_mutex_init(&dev->io_mutex);
-- qio_channel_set_blocking(dev->ioc, true, NULL);
-
- pci_conf[PCI_LATENCY_TIMER] = 0xff;
- pci_conf[PCI_INTERRUPT_PIN] = 0x01;
-diff --git a/hw/remote/remote-obj.c b/hw/remote/remote-obj.c
-index 85882902d7..3402068ab9 100644
---- a/hw/remote/remote-obj.c
-+++ b/hw/remote/remote-obj.c
-@@ -107,7 +107,11 @@ static void remote_object_machine_done(Notifier *notifier, void *data)
- error_report_err(err);
- return;
- }
-- qio_channel_set_blocking(ioc, false, NULL);
-+ if (!qio_channel_set_blocking(ioc, false, &err)) {
-+ error_report_err(err);
-+ object_unref(OBJECT(ioc));
-+ return;
-+ }
-
- o->dev = dev;
-
-diff --git a/hw/vfio-user/proxy.c b/hw/vfio-user/proxy.c
-index 2c03d49f97..bbd7ec243d 100644
---- a/hw/vfio-user/proxy.c
-+++ b/hw/vfio-user/proxy.c
-@@ -886,10 +886,11 @@ VFIOUserProxy *vfio_user_connect_dev(SocketAddress *addr, Error **errp)
- sioc = qio_channel_socket_new();
- ioc = QIO_CHANNEL(sioc);
- if (qio_channel_socket_connect_sync(sioc, addr, errp) < 0) {
-- object_unref(OBJECT(ioc));
-- return NULL;
-+ goto fail;
-+ }
-+ if (!qio_channel_set_blocking(ioc, false, errp)) {
-+ goto fail;
- }
-- qio_channel_set_blocking(ioc, false, NULL);
-
- proxy = g_malloc0(sizeof(VFIOUserProxy));
- proxy->sockname = g_strdup_printf("unix:%s", sockname);
-@@ -923,6 +924,10 @@ VFIOUserProxy *vfio_user_connect_dev(SocketAddress *addr, Error **errp)
- QLIST_INSERT_HEAD(&vfio_user_sockets, proxy, next);
-
- return proxy;
-+
-+fail:
-+ object_unref(OBJECT(ioc));
-+ return NULL;
- }
-
- void vfio_user_set_handler(VFIODevice *vbasedev,
-diff --git a/include/io/channel.h b/include/io/channel.h
-index 234e5db70d..6770d2ce35 100644
---- a/include/io/channel.h
-+++ b/include/io/channel.h
-@@ -513,9 +513,9 @@ int coroutine_mixed_fn qio_channel_write_all(QIOChannel *ioc,
- * return QIO_CHANNEL_ERR_BLOCK if they would otherwise
- * block on I/O
- */
--int qio_channel_set_blocking(QIOChannel *ioc,
-- bool enabled,
-- Error **errp);
-+bool qio_channel_set_blocking(QIOChannel *ioc,
-+ bool enabled,
-+ Error **errp);
-
- /**
- * qio_channel_set_follow_coroutine_ctx:
-diff --git a/io/channel-tls.c b/io/channel-tls.c
-index a8248a9216..7135896f79 100644
---- a/io/channel-tls.c
-+++ b/io/channel-tls.c
-@@ -425,7 +425,7 @@ static int qio_channel_tls_set_blocking(QIOChannel *ioc,
- {
- QIOChannelTLS *tioc = QIO_CHANNEL_TLS(ioc);
-
-- return qio_channel_set_blocking(tioc->master, enabled, errp);
-+ return qio_channel_set_blocking(tioc->master, enabled, errp) ? 0 : -1;
- }
-
- static void qio_channel_tls_set_delay(QIOChannel *ioc,
-diff --git a/io/channel-websock.c b/io/channel-websock.c
-index ec5e09f9ab..cb4dafdebb 100644
---- a/io/channel-websock.c
-+++ b/io/channel-websock.c
-@@ -1191,8 +1191,7 @@ static int qio_channel_websock_set_blocking(QIOChannel *ioc,
- {
- QIOChannelWebsock *wioc = QIO_CHANNEL_WEBSOCK(ioc);
-
-- qio_channel_set_blocking(wioc->master, enabled, errp);
-- return 0;
-+ return qio_channel_set_blocking(wioc->master, enabled, errp) ? 0 : -1;
- }
-
- static void qio_channel_websock_set_delay(QIOChannel *ioc,
-diff --git a/io/channel.c b/io/channel.c
-index ebd9322765..852e684938 100644
---- a/io/channel.c
-+++ b/io/channel.c
-@@ -359,12 +359,12 @@ int coroutine_mixed_fn qio_channel_write_all(QIOChannel *ioc,
- }
-
-
--int qio_channel_set_blocking(QIOChannel *ioc,
-+bool qio_channel_set_blocking(QIOChannel *ioc,
- bool enabled,
- Error **errp)
- {
- QIOChannelClass *klass = QIO_CHANNEL_GET_CLASS(ioc);
-- return klass->io_set_blocking(ioc, enabled, errp);
-+ return klass->io_set_blocking(ioc, enabled, errp) == 0;
- }
-
-
-diff --git a/nbd/server.c b/nbd/server.c
-index d242be9811..acec0487a8 100644
---- a/nbd/server.c
-+++ b/nbd/server.c
-@@ -1411,7 +1411,9 @@ static coroutine_fn int nbd_negotiate(NBDClient *client, Error **errp)
- ....options sent, ending in NBD_OPT_EXPORT_NAME or NBD_OPT_GO....
- */
-
-- qio_channel_set_blocking(client->ioc, false, NULL);
-+ if (!qio_channel_set_blocking(client->ioc, false, errp)) {
-+ return -EINVAL;
-+ }
- qio_channel_set_follow_coroutine_ctx(client->ioc, true);
-
- trace_nbd_negotiate_begin();
-diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c
-index b69dd982d6..074b4db472 100644
---- a/scsi/qemu-pr-helper.c
-+++ b/scsi/qemu-pr-helper.c
-@@ -733,8 +733,11 @@ static void coroutine_fn prh_co_entry(void *opaque)
- uint32_t flags;
- int r;
-
-- qio_channel_set_blocking(QIO_CHANNEL(client->ioc),
-- false, NULL);
-+ if (!qio_channel_set_blocking(QIO_CHANNEL(client->ioc),
-+ false, &local_err)) {
-+ goto out;
-+ }
-+
- qio_channel_set_follow_coroutine_ctx(QIO_CHANNEL(client->ioc), true);
-
- /* A very simple negotiation for future extensibility. No features
-@@ -786,6 +789,7 @@ static void coroutine_fn prh_co_entry(void *opaque)
- }
- }
-
-+out:
- if (local_err) {
- if (verbose == 0) {
- error_free(local_err);
-@@ -794,7 +798,6 @@ static void coroutine_fn prh_co_entry(void *opaque)
- }
- }
-
--out:
- object_unref(OBJECT(client->ioc));
- g_free(client);
- }
-diff --git a/tests/unit/io-channel-helpers.c b/tests/unit/io-channel-helpers.c
-index c0799c21c2..22b42d14cd 100644
---- a/tests/unit/io-channel-helpers.c
-+++ b/tests/unit/io-channel-helpers.c
-@@ -20,6 +20,7 @@
-
- #include "qemu/osdep.h"
- #include "io-channel-helpers.h"
-+#include "qapi/error.h"
- #include "qemu/iov.h"
-
- struct QIOChannelTest {
-@@ -109,8 +110,8 @@ void qio_channel_test_run_threads(QIOChannelTest *test,
- test->src = src;
- test->dst = dst;
-
-- qio_channel_set_blocking(test->dst, blocking, NULL);
-- qio_channel_set_blocking(test->src, blocking, NULL);
-+ qio_channel_set_blocking(test->dst, blocking, &error_abort);
-+ qio_channel_set_blocking(test->src, blocking, &error_abort);
-
- reader = g_thread_new("reader",
- test_io_thread_reader,
-diff --git a/tests/unit/test-io-channel-tls.c b/tests/unit/test-io-channel-tls.c
-index e036ac5df4..6f282ad45d 100644
---- a/tests/unit/test-io-channel-tls.c
-+++ b/tests/unit/test-io-channel-tls.c
-@@ -184,8 +184,8 @@ static void test_io_channel_tls(const void *opaque)
- * thread, so we need these non-blocking to avoid deadlock
- * of ourselves
- */
-- qio_channel_set_blocking(QIO_CHANNEL(clientChanSock), false, NULL);
-- qio_channel_set_blocking(QIO_CHANNEL(serverChanSock), false, NULL);
-+ qio_channel_set_blocking(QIO_CHANNEL(clientChanSock), false, &error_abort);
-+ qio_channel_set_blocking(QIO_CHANNEL(serverChanSock), false, &error_abort);
-
- /* Now the real part of the test, setup the sessions */
- clientChanTLS = qio_channel_tls_new_client(
-diff --git a/tools/i386/qemu-vmsr-helper.c b/tools/i386/qemu-vmsr-helper.c
-index 5f19a48cbd..6c0f4fe870 100644
---- a/tools/i386/qemu-vmsr-helper.c
-+++ b/tools/i386/qemu-vmsr-helper.c
-@@ -213,8 +213,10 @@ static void coroutine_fn vh_co_entry(void *opaque)
- uint64_t vmsr;
- int r;
-
-- qio_channel_set_blocking(QIO_CHANNEL(client->ioc),
-- false, NULL);
-+ if (!qio_channel_set_blocking(QIO_CHANNEL(client->ioc),
-+ false, &local_err)) {
-+ goto out;
-+ }
-
- qio_channel_set_follow_coroutine_ctx(QIO_CHANNEL(client->ioc), true);
-
-diff --git a/ui/vnc.c b/ui/vnc.c
-index 68ca4a68e7..8ca77b2971 100644
---- a/ui/vnc.c
-+++ b/ui/vnc.c
-@@ -3337,7 +3337,7 @@ static void vnc_connect(VncDisplay *vd, QIOChannelSocket *sioc,
-
- VNC_DEBUG("New client on socket %p\n", vs->sioc);
- update_displaychangelistener(&vd->dcl, VNC_REFRESH_INTERVAL_BASE);
-- qio_channel_set_blocking(vs->ioc, false, NULL);
-+ qio_channel_set_blocking(vs->ioc, false, &error_abort);
- if (vs->ioc_tag) {
- g_source_remove(vs->ioc_tag);
- }
-diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c
-index b19229074a..d805a92394 100644
---- a/util/vhost-user-server.c
-+++ b/util/vhost-user-server.c
-@@ -336,6 +336,7 @@ static void vu_accept(QIONetListener *listener, QIOChannelSocket *sioc,
- gpointer opaque)
- {
- VuServer *server = opaque;
-+ Error *local_err = NULL;
-
- if (server->sioc) {
- warn_report("Only one vhost-user client is allowed to "
-@@ -368,7 +369,11 @@ static void vu_accept(QIONetListener *listener, QIOChannelSocket *sioc,
- object_ref(OBJECT(server->ioc));
-
- /* TODO vu_message_write() spins if non-blocking! */
-- qio_channel_set_blocking(server->ioc, false, NULL);
-+ if (!qio_channel_set_blocking(server->ioc, false, &local_err)) {
-+ error_report_err(local_err);
-+ vu_deinit(&server->vu_dev);
-+ return;
-+ }
-
- qio_channel_set_follow_coroutine_ctx(server->ioc, true);
-
---
-2.52.0
-
diff --git a/kvm-treewide-rename-qemu_wait_io_event-qemu_wait_io_even.patch b/kvm-treewide-rename-qemu_wait_io_event-qemu_wait_io_even.patch
deleted file mode 100644
index c894679..0000000
--- a/kvm-treewide-rename-qemu_wait_io_event-qemu_wait_io_even.patch
+++ /dev/null
@@ -1,219 +0,0 @@
-From 8aa1e85d4a67cbe79da787ddfbe5d65395cd5daf Mon Sep 17 00:00:00 2001
-From: Paolo Bonzini <pbonzini@redhat.com>
-Date: Tue, 2 Sep 2025 07:17:09 +0200
-Subject: [PATCH 12/32] treewide: rename
- qemu_wait_io_event/qemu_wait_io_event_common
-
-RH-Author: Igor Mammedov <imammedo@redhat.com>
-RH-MergeRequest: 437: el10: x86: enablement for Azure L1VH OCP readiness
-RH-Jira: RHEL-134212
-RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [10/30] 501e99aab6fb49429b23c688cffbecdf283c89dd
-
-Do so before extending it to the user-mode emulators, where there is no
-such thing as an "I/O thread".
-
-Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 871de7078fcaf597605576b97b32fab14722ea43)
-Signed-off-by: Igor Mammedov <imammedo@redhat.com>
-
- Conflicts: (due to missing cpu exit/interrupt_request refactoring)
- cpu-common.c
- include/hw/core/cpu.h
----
- accel/dummy-cpus.c | 2 +-
- accel/hvf/hvf-accel-ops.c | 2 +-
- accel/kvm/kvm-accel-ops.c | 2 +-
- accel/tcg/tcg-accel-ops-mttcg.c | 2 +-
- accel/tcg/tcg-accel-ops-rr.c | 4 ++--
- cpu-common.c | 1 +
- include/hw/core/cpu.h | 9 +++++++++
- include/system/cpus.h | 4 ++--
- system/cpus.c | 6 +++---
- target/i386/nvmm/nvmm-accel-ops.c | 2 +-
- target/i386/whpx/whpx-accel-ops.c | 2 +-
- 11 files changed, 23 insertions(+), 13 deletions(-)
-
-diff --git a/accel/dummy-cpus.c b/accel/dummy-cpus.c
-index 03cfc0fa01..225a47c31f 100644
---- a/accel/dummy-cpus.c
-+++ b/accel/dummy-cpus.c
-@@ -57,7 +57,7 @@ static void *dummy_cpu_thread_fn(void *arg)
- qemu_sem_wait(&cpu->sem);
- #endif
- bql_lock();
-- qemu_wait_io_event(cpu);
-+ qemu_process_cpu_events(cpu);
- } while (!cpu->unplug);
-
- bql_unlock();
-diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
-index d488d6afba..7a27bdadb4 100644
---- a/accel/hvf/hvf-accel-ops.c
-+++ b/accel/hvf/hvf-accel-ops.c
-@@ -198,7 +198,7 @@ static void *hvf_cpu_thread_fn(void *arg)
- cpu_handle_guest_debug(cpu);
- }
- }
-- qemu_wait_io_event(cpu);
-+ qemu_process_cpu_events(cpu);
- } while (!cpu->unplug || cpu_can_run(cpu));
-
- hvf_vcpu_destroy(cpu);
-diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
-index b709187c7d..65a7f76a69 100644
---- a/accel/kvm/kvm-accel-ops.c
-+++ b/accel/kvm/kvm-accel-ops.c
-@@ -53,7 +53,7 @@ static void *kvm_vcpu_thread_fn(void *arg)
- cpu_handle_guest_debug(cpu);
- }
- }
-- qemu_wait_io_event(cpu);
-+ qemu_process_cpu_events(cpu);
- } while (!cpu->unplug || cpu_can_run(cpu));
-
- kvm_destroy_vcpu(cpu);
-diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c
-index 337b993d3d..a3255000df 100644
---- a/accel/tcg/tcg-accel-ops-mttcg.c
-+++ b/accel/tcg/tcg-accel-ops-mttcg.c
-@@ -113,7 +113,7 @@ static void *mttcg_cpu_thread_fn(void *arg)
- }
- }
-
-- qemu_wait_io_event(cpu);
-+ qemu_process_cpu_events(cpu);
- } while (!cpu->unplug || cpu_can_run(cpu));
-
- tcg_cpu_destroy(cpu);
-diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c
-index 6eec5c9eee..60ad1a39f0 100644
---- a/accel/tcg/tcg-accel-ops-rr.c
-+++ b/accel/tcg/tcg-accel-ops-rr.c
-@@ -117,7 +117,7 @@ static void rr_wait_io_event(void)
- rr_start_kick_timer();
-
- CPU_FOREACH(cpu) {
-- qemu_wait_io_event_common(cpu);
-+ qemu_process_cpu_events_common(cpu);
- }
- }
-
-@@ -203,7 +203,7 @@ static void *rr_cpu_thread_fn(void *arg)
- /* process any pending work */
- CPU_FOREACH(cpu) {
- current_cpu = cpu;
-- qemu_wait_io_event_common(cpu);
-+ qemu_process_cpu_events_common(cpu);
- }
- }
-
-diff --git a/cpu-common.c b/cpu-common.c
-index ef5757d23b..8e4cbac290 100644
---- a/cpu-common.c
-+++ b/cpu-common.c
-@@ -137,6 +137,7 @@ static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi)
- wi->done = false;
- qemu_mutex_unlock(&cpu->work_mutex);
-
-+ /* conflict fixup due missing exit and interrupt refactoring */
- qemu_cpu_kick(cpu);
- }
-
-diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
-index 5eaf41a566..fadd6c5ac0 100644
---- a/include/hw/core/cpu.h
-+++ b/include/hw/core/cpu.h
-@@ -422,6 +422,15 @@ struct qemu_work_item;
- * valid under cpu_list_lock.
- * @created: Indicates whether the CPU thread has been successfully created.
- * @halt_cond: condition variable sleeping threads can wait on.
-+ * @exit_request: Another thread requests the CPU to call qemu_process_cpu_events().
-+ * Should be read only by CPU thread with load-acquire, to synchronize with
-+ * other threads' store-release operation.
-+ *
-+ * In some cases, accelerator-specific code will write exit_request from
-+ * within the same thread, to "bump" the effect of qemu_cpu_kick() to
-+ * the one provided by cpu_exit(), especially when processing interrupt
-+ * flags. In this case, the write and read happen in the same thread
-+ * and the write therefore can use qemu_atomic_set().
- * @interrupt_request: Indicates a pending interrupt request.
- * @halted: Nonzero if the CPU is in suspended state.
- * @stop: Indicates a pending stop request.
-diff --git a/include/system/cpus.h b/include/system/cpus.h
-index 69be6a77a7..4aebec4870 100644
---- a/include/system/cpus.h
-+++ b/include/system/cpus.h
-@@ -17,8 +17,8 @@ bool cpu_work_list_empty(CPUState *cpu);
- bool cpu_thread_is_idle(CPUState *cpu);
- bool all_cpu_threads_idle(void);
- bool cpu_can_run(CPUState *cpu);
--void qemu_wait_io_event_common(CPUState *cpu);
--void qemu_wait_io_event(CPUState *cpu);
-+void qemu_process_cpu_events_common(CPUState *cpu);
-+void qemu_process_cpu_events(CPUState *cpu);
- void cpu_thread_signal_created(CPUState *cpu);
- void cpu_thread_signal_destroyed(CPUState *cpu);
- void cpu_handle_guest_debug(CPUState *cpu);
-diff --git a/system/cpus.c b/system/cpus.c
-index 256723558d..efffbd8df6 100644
---- a/system/cpus.c
-+++ b/system/cpus.c
-@@ -444,7 +444,7 @@ static void qemu_cpu_stop(CPUState *cpu, bool exit)
- qemu_cond_broadcast(&qemu_pause_cond);
- }
-
--void qemu_wait_io_event_common(CPUState *cpu)
-+void qemu_process_cpu_events_common(CPUState *cpu)
- {
- qatomic_set_mb(&cpu->thread_kicked, false);
- if (cpu->stop) {
-@@ -453,7 +453,7 @@ void qemu_wait_io_event_common(CPUState *cpu)
- process_queued_cpu_work(cpu);
- }
-
--void qemu_wait_io_event(CPUState *cpu)
-+void qemu_process_cpu_events(CPUState *cpu)
- {
- bool slept = false;
-
-@@ -468,7 +468,7 @@ void qemu_wait_io_event(CPUState *cpu)
- qemu_plugin_vcpu_resume_cb(cpu);
- }
-
-- qemu_wait_io_event_common(cpu);
-+ qemu_process_cpu_events_common(cpu);
- }
-
- void cpus_kick_thread(CPUState *cpu)
-diff --git a/target/i386/nvmm/nvmm-accel-ops.c b/target/i386/nvmm/nvmm-accel-ops.c
-index 3799260bbd..c7b1d0f1d3 100644
---- a/target/i386/nvmm/nvmm-accel-ops.c
-+++ b/target/i386/nvmm/nvmm-accel-ops.c
-@@ -51,7 +51,7 @@ static void *qemu_nvmm_cpu_thread_fn(void *arg)
- while (cpu_thread_is_idle(cpu)) {
- qemu_cond_wait_bql(cpu->halt_cond);
- }
-- qemu_wait_io_event_common(cpu);
-+ qemu_process_cpu_events_common(cpu);
- } while (!cpu->unplug || cpu_can_run(cpu));
-
- nvmm_destroy_vcpu(cpu);
-diff --git a/target/i386/whpx/whpx-accel-ops.c b/target/i386/whpx/whpx-accel-ops.c
-index da58805b1a..2ca4ee0263 100644
---- a/target/i386/whpx/whpx-accel-ops.c
-+++ b/target/i386/whpx/whpx-accel-ops.c
-@@ -51,7 +51,7 @@ static void *whpx_cpu_thread_fn(void *arg)
- while (cpu_thread_is_idle(cpu)) {
- qemu_cond_wait_bql(cpu->halt_cond);
- }
-- qemu_wait_io_event_common(cpu);
-+ qemu_process_cpu_events_common(cpu);
- } while (!cpu->unplug || cpu_can_run(cpu));
-
- whpx_destroy_vcpu(cpu);
---
-2.47.3
-
diff --git a/kvm-vfio-Add-Error-parameter-to-vfio_region_setup.patch b/kvm-vfio-Add-Error-parameter-to-vfio_region_setup.patch
deleted file mode 100644
index 4331a6c..0000000
--- a/kvm-vfio-Add-Error-parameter-to-vfio_region_setup.patch
+++ /dev/null
@@ -1,147 +0,0 @@
-From e4a9b1a603140f3e07aafed06d545125e856b608 Mon Sep 17 00:00:00 2001
-From: Ankit Agrawal <ankita@nvidia.com>
-Date: Tue, 17 Feb 2026 15:30:09 +0000
-Subject: [PATCH 2/4] vfio: Add Error ** parameter to vfio_region_setup()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Cédric Le Goater <clg@redhat.com>
-RH-MergeRequest: 500: NVIDIA:Grace:Backport hw/vfio: Enable hugepfnmap for non-power-of-2 device memory regions - GB200
-RH-Jira: RHEL-150900
-RH-Acked-by: Rodolfo Vick <None>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/3] ae95924770d3a7828fc3d67df36fc6d09baf2e97 (clegoate/qemu-kvm-centos)
-
-Add an Error **errp parameter to vfio_region_setup() and
-vfio_setup_region_sparse_mmaps to allow proper error handling
-instead of just returning error codes.
-
-The function sets errors via error_setg() when failure occur.
-
-Suggested-by: Cedric Le Goater <clg@redhat.com>
-Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20260217153010.408739-3-ankita@nvidia.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit c42010197eb905fe826550bb5f7c236d5534ddb4)
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
----
- hw/vfio/display.c | 6 +++---
- hw/vfio/pci.c | 3 +--
- hw/vfio/region.c | 20 +++++++++++---------
- hw/vfio/vfio-region.h | 2 +-
- 4 files changed, 16 insertions(+), 15 deletions(-)
-
-diff --git a/hw/vfio/display.c b/hw/vfio/display.c
-index faacd9019a..5a42a6f7a2 100644
---- a/hw/vfio/display.c
-+++ b/hw/vfio/display.c
-@@ -446,13 +446,13 @@ static void vfio_display_region_update(void *opaque)
-
- if (!dpy->region.buffer.size) {
- /* mmap region */
-+ Error *error = NULL;
- ret = vfio_region_setup(OBJECT(vdev), &vdev->vbasedev,
- &dpy->region.buffer,
- plane.region_index,
-- "display");
-+ "display", &error);
- if (ret != 0) {
-- error_report("%s: vfio_region_setup(%d): %s",
-- __func__, plane.region_index, strerror(-ret));
-+ error_report_err(error);
- goto err;
- }
- ret = vfio_region_mmap(&dpy->region.buffer);
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 378b475b2c..1ba66699dc 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -2993,11 +2993,10 @@ bool vfio_pci_populate_device(VFIOPCIDevice *vdev, Error **errp)
- char *name = g_strdup_printf("%s BAR %d", vbasedev->name, i);
-
- ret = vfio_region_setup(OBJECT(vdev), vbasedev,
-- &vdev->bars[i].region, i, name);
-+ &vdev->bars[i].region, i, name, errp);
- g_free(name);
-
- if (ret) {
-- error_setg_errno(errp, -ret, "failed to get region %d info", i);
- return false;
- }
-
-diff --git a/hw/vfio/region.c b/hw/vfio/region.c
-index a61e47a79c..055033a79e 100644
---- a/hw/vfio/region.c
-+++ b/hw/vfio/region.c
-@@ -163,7 +163,8 @@ static int vfio_mmap_compare_offset(const void *a, const void *b)
- }
-
- static int vfio_setup_region_sparse_mmaps(VFIORegion *region,
-- struct vfio_region_info *info)
-+ struct vfio_region_info *info,
-+ Error **errp)
- {
- struct vfio_info_cap_header *hdr;
- struct vfio_region_info_cap_sparse_mmap *sparse;
-@@ -210,12 +211,12 @@ static int vfio_setup_region_sparse_mmaps(VFIORegion *region,
- off_t prev_end = region->mmaps[i - 1].offset +
- region->mmaps[i - 1].size;
- if (prev_end > region->mmaps[i].offset) {
-- error_report("%s: overlapping sparse mmap regions detected "
-- "in region %d: [0x%"PRIx64"-0x%"PRIx64"] overlaps "
-- "with [0x%"PRIx64"-0x%"PRIx64"]",
-- __func__, region->nr, region->mmaps[i - 1].offset,
-- prev_end - 1, region->mmaps[i].offset,
-- region->mmaps[i].offset + region->mmaps[i].size - 1);
-+ error_setg(errp, "%s: overlapping sparse mmap regions detected "
-+ "in region %d: [0x%"PRIx64"-0x%"PRIx64"] overlaps "
-+ "with [0x%"PRIx64"-0x%"PRIx64"]",
-+ __func__, region->nr, region->mmaps[i - 1].offset,
-+ prev_end - 1, region->mmaps[i].offset,
-+ region->mmaps[i].offset + region->mmaps[i].size - 1);
- g_free(region->mmaps);
- region->mmaps = NULL;
- region->nr_mmaps = 0;
-@@ -228,13 +229,14 @@ static int vfio_setup_region_sparse_mmaps(VFIORegion *region,
- }
-
- int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region,
-- int index, const char *name)
-+ int index, const char *name, Error **errp)
- {
- struct vfio_region_info *info = NULL;
- int ret;
-
- ret = vfio_device_get_region_info(vbasedev, index, &info);
- if (ret) {
-+ error_setg_errno(errp, -ret, "failed to get region %d info", index);
- return ret;
- }
-
-@@ -253,7 +255,7 @@ int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region,
- if (!vbasedev->no_mmap &&
- region->flags & VFIO_REGION_INFO_FLAG_MMAP) {
-
-- ret = vfio_setup_region_sparse_mmaps(region, info);
-+ ret = vfio_setup_region_sparse_mmaps(region, info, errp);
-
- if (ret == -ENODEV) {
- region->nr_mmaps = 1;
-diff --git a/hw/vfio/vfio-region.h b/hw/vfio/vfio-region.h
-index ede6e0c8f9..9b21d4ee5b 100644
---- a/hw/vfio/vfio-region.h
-+++ b/hw/vfio/vfio-region.h
-@@ -38,7 +38,7 @@ void vfio_region_write(void *opaque, hwaddr addr,
- uint64_t vfio_region_read(void *opaque,
- hwaddr addr, unsigned size);
- int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region,
-- int index, const char *name);
-+ int index, const char *name, Error **errp);
- int vfio_region_mmap(VFIORegion *region);
- void vfio_region_mmaps_set_enabled(VFIORegion *region, bool enabled);
- void vfio_region_unmap(VFIORegion *region);
---
-2.52.0
-
diff --git a/kvm-vfio-Clean-up-includes.patch b/kvm-vfio-Clean-up-includes.patch
deleted file mode 100644
index 161f61a..0000000
--- a/kvm-vfio-Clean-up-includes.patch
+++ /dev/null
@@ -1,155 +0,0 @@
-From eafa7ec2363234dec4a325405c3f05b7f3e30c72 Mon Sep 17 00:00:00 2001
-From: Peter Maydell <peter.maydell@linaro.org>
-Date: Tue, 4 Nov 2025 16:09:42 +0000
-Subject: [PATCH 105/116] vfio: Clean up includes
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [89/100] 66f086acae0b63d2e4a589529bb52d2a33ba7fe3 (rovick1/qemu-kvm)
-
-This commit was created with scripts/clean-includes:
- ./scripts/clean-includes --git vfio hw/vfio hw/vfio-user
-
-All .c should include qemu/osdep.h first. The script performs three
-related cleanups:
-
-* Ensure .c files include qemu/osdep.h first.
-* Including it in a .h is redundant, since the .c already includes
- it. Drop such inclusions.
-* Likewise, including headers qemu/osdep.h includes is redundant.
- Drop these, too.
-
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Message-id: 20251104160943.751997-9-peter.maydell@linaro.org
-(cherry picked from commit b1f4f4695c96bb8e20a00e82d1868b5b018002bc)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/container.c | 2 +-
- hw/vfio-user/container.h | 1 -
- hw/vfio-user/device.h | 1 -
- hw/vfio-user/pci.c | 2 +-
- hw/vfio/ap.c | 1 -
- hw/vfio/container.c | 2 +-
- hw/vfio/cpr-legacy.c | 2 +-
- hw/vfio/pci-quirks.h | 1 -
- 8 files changed, 4 insertions(+), 8 deletions(-)
-
-diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c
-index e45192fef6..dab7a23224 100644
---- a/hw/vfio-user/container.c
-+++ b/hw/vfio-user/container.c
-@@ -6,9 +6,9 @@
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-+#include "qemu/osdep.h"
- #include <sys/ioctl.h>
- #include <linux/vfio.h>
--#include "qemu/osdep.h"
-
- #include "hw/vfio-user/container.h"
- #include "hw/vfio-user/device.h"
-diff --git a/hw/vfio-user/container.h b/hw/vfio-user/container.h
-index a2b42e3169..c952e09063 100644
---- a/hw/vfio-user/container.h
-+++ b/hw/vfio-user/container.h
-@@ -7,7 +7,6 @@
- #ifndef HW_VFIO_USER_CONTAINER_H
- #define HW_VFIO_USER_CONTAINER_H
-
--#include "qemu/osdep.h"
-
- #include "hw/vfio/vfio-container.h"
- #include "hw/vfio-user/proxy.h"
-diff --git a/hw/vfio-user/device.h b/hw/vfio-user/device.h
-index d183a3950e..49c05848f1 100644
---- a/hw/vfio-user/device.h
-+++ b/hw/vfio-user/device.h
-@@ -9,7 +9,6 @@
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
--#include "qemu/osdep.h"
- #include "linux/vfio.h"
-
- #include "hw/vfio-user/proxy.h"
-diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
-index b53ed3b456..353d07e781 100644
---- a/hw/vfio-user/pci.c
-+++ b/hw/vfio-user/pci.c
-@@ -6,8 +6,8 @@
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
--#include <sys/ioctl.h>
- #include "qemu/osdep.h"
-+#include <sys/ioctl.h>
- #include "qapi-visit-sockets.h"
- #include "qemu/error-report.h"
-
-diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
-index 7719f24579..3368ac8915 100644
---- a/hw/vfio/ap.c
-+++ b/hw/vfio/ap.c
-@@ -10,7 +10,6 @@
- * directory.
- */
-
--#include <stdbool.h>
- #include "qemu/osdep.h"
- #include CONFIG_DEVICES /* CONFIG_IOMMUFD */
- #include <linux/vfio.h>
-diff --git a/hw/vfio/container.c b/hw/vfio/container.c
-index 41de343924..cc0367ecc4 100644
---- a/hw/vfio/container.c
-+++ b/hw/vfio/container.c
-@@ -10,10 +10,10 @@
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-+#include "qemu/osdep.h"
- #include <sys/ioctl.h>
- #include <linux/vfio.h>
-
--#include "qemu/osdep.h"
- #include "system/tcg.h"
- #include "system/ram_addr.h"
- #include "qapi/error.h"
-diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
-index 7184c93991..273b597880 100644
---- a/hw/vfio/cpr-legacy.c
-+++ b/hw/vfio/cpr-legacy.c
-@@ -4,9 +4,9 @@
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-+#include "qemu/osdep.h"
- #include <sys/ioctl.h>
- #include <linux/vfio.h>
--#include "qemu/osdep.h"
- #include "hw/vfio/vfio-container-legacy.h"
- #include "hw/vfio/vfio-device.h"
- #include "hw/vfio/vfio-listener.h"
-diff --git a/hw/vfio/pci-quirks.h b/hw/vfio/pci-quirks.h
-index d1532e379b..a6282e063a 100644
---- a/hw/vfio/pci-quirks.h
-+++ b/hw/vfio/pci-quirks.h
-@@ -12,7 +12,6 @@
- #ifndef HW_VFIO_VFIO_PCI_QUIRKS_H
- #define HW_VFIO_VFIO_PCI_QUIRKS_H
-
--#include "qemu/osdep.h"
- #include "exec/memop.h"
-
- /*
---
-2.52.0
-
diff --git a/kvm-vfio-Disable-VFIO-migration-with-MultiFD-support.patch b/kvm-vfio-Disable-VFIO-migration-with-MultiFD-support.patch
deleted file mode 100644
index 5219676..0000000
--- a/kvm-vfio-Disable-VFIO-migration-with-MultiFD-support.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 66bd3c1e7702962060d23fdc3084f0ace26b94e6 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
-Date: Thu, 6 Nov 2025 16:39:53 +0100
-Subject: [PATCH 03/16] vfio: Disable VFIO migration with MultiFD support
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Cédric Le Goater <clg@redhat.com>
-RH-MergeRequest: 421: vfio: Disable VFIO migration with MultiFD support
-RH-Jira: RHEL-126573
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Thomas Huth <thuth@redhat.com>
-RH-Commit: [1/1] b3ec6731c96e5650c66ece6e3b8728a7b94353f2 (clegoate/qemu-kvm-centos)
-
-QEMU 10.0 extends VFIO migration with MultiFD support, which can be
-controlled through the 'vfio-pci' device property
-'x-migration-multifd-transfer'. By default, this property is set to
-'auto', meaning its activation depends on the availability of other
-related features. However, it should be set to 'off' in RHEL until
-more testing has been completed.
-
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
----
- hw/vfio/pci.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 9486521a90..83ecffb535 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -3686,10 +3686,11 @@ static const Property vfio_pci_dev_properties[] = {
- igd_legacy_mode, ON_OFF_AUTO_AUTO),
- DEFINE_PROP_ON_OFF_AUTO("enable-migration", VFIOPCIDevice,
- vbasedev.enable_migration, ON_OFF_AUTO_AUTO),
-+ /* RHEL only. Disable VFIO migration with MultiFD support */
- DEFINE_PROP("x-migration-multifd-transfer", VFIOPCIDevice,
- vbasedev.migration_multifd_transfer,
- vfio_pci_migration_multifd_transfer_prop, OnOffAuto,
-- .set_default = true, .defval.i = ON_OFF_AUTO_AUTO),
-+ .set_default = true, .defval.i = ON_OFF_AUTO_OFF),
- DEFINE_PROP_ON_OFF_AUTO("x-migration-load-config-after-iter", VFIOPCIDevice,
- vbasedev.migration_load_config_after_iter,
- ON_OFF_AUTO_AUTO),
---
-2.47.3
-
diff --git a/kvm-vfio-Do-not-unparent-in-instance_finalize.patch b/kvm-vfio-Do-not-unparent-in-instance_finalize.patch
deleted file mode 100644
index d401778..0000000
--- a/kvm-vfio-Do-not-unparent-in-instance_finalize.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From 0d033fb85e813db89680dea1383427ac46e38fe9 Mon Sep 17 00:00:00 2001
-From: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Date: Wed, 24 Sep 2025 13:37:25 +0900
-Subject: [PATCH 050/116] vfio: Do not unparent in instance_finalize()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [34/100] 7c40971f01b26c9c77dfd2ada8856fec16529ebf (rovick1/qemu-kvm)
-
-Children are automatically unparented so manually unparenting is
-unnecessary.
-
-Worse, automatic unparenting happens before the instance_finalize()
-callback of the parent gets called, so object_unparent() calls in
-the callback will refer to objects that are already unparented, which
-is semantically incorrect.
-
-Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-Link: https://lore.kernel.org/r/20250924-use-v4-6-07c6c598f53d@rsg.ci.i.u-tokyo.ac.jp
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 9b80f8a8e758b427501e6bcbcb114ae45ff68387)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci-quirks.c | 9 +--------
- hw/vfio/region.c | 3 ---
- 2 files changed, 1 insertion(+), 11 deletions(-)
-
-diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
-index c97606dbf1..b5da6afbf5 100644
---- a/hw/vfio/pci-quirks.c
-+++ b/hw/vfio/pci-quirks.c
-@@ -1159,15 +1159,12 @@ void vfio_vga_quirk_exit(VFIOPCIDevice *vdev)
-
- void vfio_vga_quirk_finalize(VFIOPCIDevice *vdev)
- {
-- int i, j;
-+ int i;
-
- for (i = 0; i < ARRAY_SIZE(vdev->vga->region); i++) {
- while (!QLIST_EMPTY(&vdev->vga->region[i].quirks)) {
- VFIOQuirk *quirk = QLIST_FIRST(&vdev->vga->region[i].quirks);
- QLIST_REMOVE(quirk, next);
-- for (j = 0; j < quirk->nr_mem; j++) {
-- object_unparent(OBJECT(&quirk->mem[j]));
-- }
- g_free(quirk->mem);
- g_free(quirk->data);
- g_free(quirk);
-@@ -1207,14 +1204,10 @@ void vfio_bar_quirk_exit(VFIOPCIDevice *vdev, int nr)
- void vfio_bar_quirk_finalize(VFIOPCIDevice *vdev, int nr)
- {
- VFIOBAR *bar = &vdev->bars[nr];
-- int i;
-
- while (!QLIST_EMPTY(&bar->quirks)) {
- VFIOQuirk *quirk = QLIST_FIRST(&bar->quirks);
- QLIST_REMOVE(quirk, next);
-- for (i = 0; i < quirk->nr_mem; i++) {
-- object_unparent(OBJECT(&quirk->mem[i]));
-- }
- g_free(quirk->mem);
- g_free(quirk->data);
- g_free(quirk);
-diff --git a/hw/vfio/region.c b/hw/vfio/region.c
-index d04c57db63..b165ab0b93 100644
---- a/hw/vfio/region.c
-+++ b/hw/vfio/region.c
-@@ -365,12 +365,9 @@ void vfio_region_finalize(VFIORegion *region)
- for (i = 0; i < region->nr_mmaps; i++) {
- if (region->mmaps[i].mmap) {
- munmap(region->mmaps[i].mmap, region->mmaps[i].size);
-- object_unparent(OBJECT(®ion->mmaps[i].mem));
- }
- }
-
-- object_unparent(OBJECT(region->mem));
--
- g_free(region->mem);
- g_free(region->mmaps);
-
---
-2.52.0
-
diff --git a/kvm-vfio-Introduce-helper-vfio_pci_from_vfio_device.patch b/kvm-vfio-Introduce-helper-vfio_pci_from_vfio_device.patch
deleted file mode 100644
index 082b6d7..0000000
--- a/kvm-vfio-Introduce-helper-vfio_pci_from_vfio_device.patch
+++ /dev/null
@@ -1,153 +0,0 @@
-From 7bb99b469a3438c358c0027703e4b01935e7dfab Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Fri, 22 Aug 2025 02:40:42 -0400
-Subject: [PATCH 028/116] vfio: Introduce helper vfio_pci_from_vfio_device()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [12/100] 16eb1e58aa0767917fd2a31368388495f721b2b9 (rovick1/qemu-kvm)
-
-Introduce helper vfio_pci_from_vfio_device() to transform from VFIODevice
-to VFIOPCIDevice, also to hide low level VFIO_DEVICE_TYPE_PCI type check.
-
-Suggested-by: Cédric Le Goater <clg@redhat.com>
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250822064101.123526-5-zhenzhong.duan@intel.com
-[ clg: Added documentation ]
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit bb1a6f1f43374a1850c314c4d0e945667d013d07)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/container.c | 4 ++--
- hw/vfio/device.c | 2 +-
- hw/vfio/iommufd.c | 4 ++--
- hw/vfio/listener.c | 4 ++--
- hw/vfio/pci.c | 9 +++++++++
- hw/vfio/pci.h | 12 ++++++++++++
- 6 files changed, 28 insertions(+), 7 deletions(-)
-
-diff --git a/hw/vfio/container.c b/hw/vfio/container.c
-index b912b9396b..c1554c1fd1 100644
---- a/hw/vfio/container.c
-+++ b/hw/vfio/container.c
-@@ -1101,7 +1101,7 @@ static int vfio_legacy_pci_hot_reset(VFIODevice *vbasedev, bool single)
- /* Prep dependent devices for reset and clear our marker. */
- QLIST_FOREACH(vbasedev_iter, &group->device_list, next) {
- if (!vbasedev_iter->dev->realized ||
-- vbasedev_iter->type != VFIO_DEVICE_TYPE_PCI) {
-+ !vfio_pci_from_vfio_device(vbasedev_iter)) {
- continue;
- }
- tmp = container_of(vbasedev_iter, VFIOPCIDevice, vbasedev);
-@@ -1186,7 +1186,7 @@ out:
-
- QLIST_FOREACH(vbasedev_iter, &group->device_list, next) {
- if (!vbasedev_iter->dev->realized ||
-- vbasedev_iter->type != VFIO_DEVICE_TYPE_PCI) {
-+ !vfio_pci_from_vfio_device(vbasedev_iter)) {
- continue;
- }
- tmp = container_of(vbasedev_iter, VFIOPCIDevice, vbasedev);
-diff --git a/hw/vfio/device.c b/hw/vfio/device.c
-index 7ebf41c95e..412678a1f6 100644
---- a/hw/vfio/device.c
-+++ b/hw/vfio/device.c
-@@ -129,7 +129,7 @@ static inline const char *action_to_str(int action)
-
- static const char *index_to_str(VFIODevice *vbasedev, int index)
- {
-- if (vbasedev->type != VFIO_DEVICE_TYPE_PCI) {
-+ if (!vfio_pci_from_vfio_device(vbasedev)) {
- return NULL;
- }
-
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index dbcd861b27..65b94aaa00 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -738,8 +738,8 @@ iommufd_cdev_dep_get_realized_vpdev(struct vfio_pci_dependent_device *dep_dev,
- }
-
- vbasedev_tmp = iommufd_cdev_pci_find_by_devid(dep_dev->devid);
-- if (!vbasedev_tmp || !vbasedev_tmp->dev->realized ||
-- vbasedev_tmp->type != VFIO_DEVICE_TYPE_PCI) {
-+ if (!vfio_pci_from_vfio_device(vbasedev_tmp) ||
-+ !vbasedev_tmp->dev->realized) {
- return NULL;
- }
-
-diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
-index c244be5e21..e093833165 100644
---- a/hw/vfio/listener.c
-+++ b/hw/vfio/listener.c
-@@ -453,7 +453,7 @@ static void vfio_device_error_append(VFIODevice *vbasedev, Error **errp)
- * MMIO region mapping failures are not fatal but in this case PCI
- * peer-to-peer transactions are broken.
- */
-- if (vbasedev && vbasedev->type == VFIO_DEVICE_TYPE_PCI) {
-+ if (vfio_pci_from_vfio_device(vbasedev)) {
- error_append_hint(errp, "%s: PCI peer-to-peer transactions "
- "on BARs are not supported.\n", vbasedev->name);
- }
-@@ -759,7 +759,7 @@ static bool vfio_section_is_vfio_pci(MemoryRegionSection *section,
- owner = memory_region_owner(section->mr);
-
- QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) {
-- if (vbasedev->type != VFIO_DEVICE_TYPE_PCI) {
-+ if (!vfio_pci_from_vfio_device(vbasedev)) {
- continue;
- }
- pcidev = container_of(vbasedev, VFIOPCIDevice, vbasedev);
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 7c057ee2f9..58ab1116d8 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -2836,6 +2836,15 @@ static int vfio_pci_load_config(VFIODevice *vbasedev, QEMUFile *f)
- return ret;
- }
-
-+/* Transform from VFIODevice to VFIOPCIDevice. Return NULL if fails. */
-+VFIOPCIDevice *vfio_pci_from_vfio_device(VFIODevice *vbasedev)
-+{
-+ if (vbasedev && vbasedev->type == VFIO_DEVICE_TYPE_PCI) {
-+ return container_of(vbasedev, VFIOPCIDevice, vbasedev);
-+ }
-+ return NULL;
-+}
-+
- void vfio_sub_page_bar_update_mappings(VFIOPCIDevice *vdev)
- {
- PCIDevice *pdev = &vdev->pdev;
-diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
-index 056f5e12cf..e3ab3fe1f7 100644
---- a/hw/vfio/pci.h
-+++ b/hw/vfio/pci.h
-@@ -227,6 +227,18 @@ void vfio_pci_write_config(PCIDevice *pdev,
- uint64_t vfio_vga_read(void *opaque, hwaddr addr, unsigned size);
- void vfio_vga_write(void *opaque, hwaddr addr, uint64_t data, unsigned size);
-
-+/**
-+ * vfio_pci_from_vfio_device: Transform from VFIODevice to
-+ * VFIOPCIDevice
-+ *
-+ * This function checks if the given @vbasedev is a VFIO PCI device.
-+ * If it is, it returns the containing VFIOPCIDevice.
-+ *
-+ * @vbasedev: The VFIODevice to transform
-+ *
-+ * Return: The VFIOPCIDevice on success, NULL on failure.
-+ */
-+VFIOPCIDevice *vfio_pci_from_vfio_device(VFIODevice *vbasedev);
- void vfio_sub_page_bar_update_mappings(VFIOPCIDevice *vdev);
- bool vfio_opt_rom_in_denylist(VFIOPCIDevice *vdev);
- bool vfio_config_quirk_setup(VFIOPCIDevice *vdev, Error **errp);
---
-2.52.0
-
diff --git a/kvm-vfio-Move-vfio-region.h-under-hw-vfio.patch b/kvm-vfio-Move-vfio-region.h-under-hw-vfio.patch
deleted file mode 100644
index 1b76b5e..0000000
--- a/kvm-vfio-Move-vfio-region.h-under-hw-vfio.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 9a4b3f0996a325625a05d0cea8f1f8077b2b94bf Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
-Date: Mon, 1 Sep 2025 08:46:31 +0200
-Subject: [PATCH 024/116] vfio: Move vfio-region.h under hw/vfio/
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [8/100] f7d96a2b1d562aa26f3e13acdcc757b4f8c2e66e (rovick1/qemu-kvm)
-
-Since the removal of vfio-platform, header file vfio-region.h no
-longer needs to be a public VFIO interface. Move it under hw/vfio.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250901064631.530723-9-clg@redhat.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit e7a47f717718441b546090fe3fa91e2705ca125b)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- {include/hw => hw}/vfio/vfio-region.h | 0
- 1 file changed, 0 insertions(+), 0 deletions(-)
- rename {include/hw => hw}/vfio/vfio-region.h (100%)
-
-diff --git a/include/hw/vfio/vfio-region.h b/hw/vfio/vfio-region.h
-similarity index 100%
-rename from include/hw/vfio/vfio-region.h
-rename to hw/vfio/vfio-region.h
---
-2.52.0
-
diff --git a/kvm-vfio-Remove-vfio-amd-xgbe-device.patch b/kvm-vfio-Remove-vfio-amd-xgbe-device.patch
deleted file mode 100644
index c1d9f13..0000000
--- a/kvm-vfio-Remove-vfio-amd-xgbe-device.patch
+++ /dev/null
@@ -1,623 +0,0 @@
-From 6b84e6bbd52027202cf01b0ed15cc71fb524f530 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
-Date: Mon, 1 Sep 2025 08:46:28 +0200
-Subject: [PATCH 020/116] vfio: Remove 'vfio-amd-xgbe' device
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [4/100] d0b2ea5bf9e57ff19692d57c19f301d47d653240 (rovick1/qemu-kvm)
-
-Conflicts:
- hw/arm/virt.c: due to the downstream-only handling of RAMFB
- hw/core/sysbus-fdt.c: downstream 60e7ac0c41c2 ("vfio: rename
-field to "num_initial_regions") touches sysbus-fdt.c. Anyway that code
-is removed
-
-The VFIO_AMD_XGBE device type has been deprecated in the QEMU 10.0
-timeframe. The AMD "Seattle" device is not supported anymore. Remove it.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250901064631.530723-6-clg@redhat.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit aeb1a50d4a7f464a8ff0a66e0beec2a5e1ef6342)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- docs/about/deprecated.rst | 6 -
- docs/about/removed-features.rst | 9 +
- docs/devel/kconfig.rst | 1 -
- hw/arm/Kconfig | 1 -
- hw/arm/virt.c | 2 -
- hw/core/sysbus-fdt.c | 315 --------------------------------
- hw/vfio/Kconfig | 5 -
- hw/vfio/amd-xgbe.c | 61 -------
- hw/vfio/meson.build | 1 -
- include/hw/vfio/vfio-amd-xgbe.h | 46 -----
- 10 files changed, 9 insertions(+), 438 deletions(-)
- delete mode 100644 hw/vfio/amd-xgbe.c
- delete mode 100644 include/hw/vfio/vfio-amd-xgbe.h
-
-diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
-index d50645a071..631871ffc8 100644
---- a/docs/about/deprecated.rst
-+++ b/docs/about/deprecated.rst
-@@ -526,12 +526,6 @@ The vfio-calxeda-xgmac device allows to assign a host Calxeda Highbank
- string) to a guest. Calxeda HW has been ewasted now and there is no point
- keeping that device.
-
--``-device vfio-amd-xgbe`` (since 10.0)
--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--The vfio-amd-xgbe device allows to assign a host AMD 10GbE controller
--to a guest ("amd,xgbe-seattle-v1a" compatibility string). AMD "Seattle"
--is not supported anymore and there is no point keeping that device.
--
- ``-device vfio-platform`` (since 10.0)
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- The vfio-platform device allows to assign a host platform device
-diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
-index d7c2113fc3..759c067412 100644
---- a/docs/about/removed-features.rst
-+++ b/docs/about/removed-features.rst
-@@ -1262,6 +1262,15 @@ The corresponding upstream server project is no longer maintained.
- Users are recommended to switch to an alternative distributed block
- device driver such as RBD.
-
-+VFIO devices
-+------------
-+
-+``-device vfio-amd-xgbe`` (since 10.2)
-+''''''''''''''''''''''''''''''''''''''
-+The vfio-amd-xgbe device allows to assign a host AMD 10GbE controller
-+to a guest ("amd,xgbe-seattle-v1a" compatibility string). AMD "Seattle"
-+is not supported anymore and there is no point keeping that device.
-+
- Tools
- -----
-
-diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst
-index 493b76c4fb..9fdf501529 100644
---- a/docs/devel/kconfig.rst
-+++ b/docs/devel/kconfig.rst
-@@ -59,7 +59,6 @@ stanza like the following::
- config ARM_VIRT
- bool
- imply PCI_DEVICES
-- imply VFIO_AMD_XGBE
- imply VFIO_XGMAC
- select A15MPCORE
- select ACPI
-diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
-index 2aa4b5d778..64b2ec87b5 100644
---- a/hw/arm/Kconfig
-+++ b/hw/arm/Kconfig
-@@ -5,7 +5,6 @@ config ARM_VIRT
- depends on TCG || KVM || HVF
- imply PCI_DEVICES
- imply TEST_DEVICES
-- imply VFIO_AMD_XGBE
- imply VFIO_PLATFORM
- imply VFIO_XGMAC
- imply TPM_TIS_SYSBUS
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index 752dc08720..c0292a3899 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -39,7 +39,6 @@
- #include "hw/arm/virt.h"
- #include "hw/block/flash.h"
- #include "hw/vfio/vfio-calxeda-xgmac.h"
--#include "hw/vfio/vfio-amd-xgbe.h"
- #include "hw/display/ramfb.h"
- #include "net/net.h"
- #include "system/device_tree.h"
-@@ -3324,7 +3323,6 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
- mc->max_cpus = 384;
- #if 0 /* Disabled for Red Hat Enterprise Linux */
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_CALXEDA_XGMAC);
-- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_AMD_XGBE);
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM);
- #endif
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
-diff --git a/hw/core/sysbus-fdt.c b/hw/core/sysbus-fdt.c
-index 673e083d31..0caffe4845 100644
---- a/hw/core/sysbus-fdt.c
-+++ b/hw/core/sysbus-fdt.c
-@@ -35,7 +35,6 @@
- #include "hw/platform-bus.h"
- #include "hw/vfio/vfio-platform.h"
- #include "hw/vfio/vfio-calxeda-xgmac.h"
--#include "hw/vfio/vfio-amd-xgbe.h"
- #include "hw/vfio/vfio-region.h"
- #include "hw/display/ramfb.h"
- #include "hw/uefi/var-service-api.h"
-@@ -69,142 +68,6 @@ typedef struct HostProperty {
-
- #ifdef CONFIG_LINUX
-
--/**
-- * copy_properties_from_host
-- *
-- * copies properties listed in an array from host device tree to
-- * guest device tree. If a non optional property is not found, the
-- * function asserts. An optional property is ignored if not found
-- * in the host device tree.
-- * @props: array of HostProperty to copy
-- * @nb_props: number of properties in the array
-- * @host_dt: host device tree blob
-- * @guest_dt: guest device tree blob
-- * @node_path: host dt node path where the property is supposed to be
-- found
-- * @nodename: guest node name the properties should be added to
-- */
--static void copy_properties_from_host(HostProperty *props, int nb_props,
-- void *host_fdt, void *guest_fdt,
-- char *node_path, char *nodename)
--{
-- int i, prop_len;
-- const void *r;
-- Error *err = NULL;
--
-- for (i = 0; i < nb_props; i++) {
-- r = qemu_fdt_getprop(host_fdt, node_path,
-- props[i].name,
-- &prop_len,
-- &err);
-- if (r) {
-- qemu_fdt_setprop(guest_fdt, nodename,
-- props[i].name, r, prop_len);
-- } else {
-- if (props[i].optional && prop_len == -FDT_ERR_NOTFOUND) {
-- /* optional property does not exist */
-- error_free(err);
-- } else {
-- error_report_err(err);
-- }
-- if (!props[i].optional) {
-- /* mandatory property not found: bail out */
-- exit(1);
-- }
-- err = NULL;
-- }
-- }
--}
--
--/* clock properties whose values are copied/pasted from host */
--static HostProperty clock_copied_properties[] = {
-- {"compatible", false},
-- {"#clock-cells", false},
-- {"clock-frequency", true},
-- {"clock-output-names", true},
--};
--
--/**
-- * fdt_build_clock_node
-- *
-- * Build a guest clock node, used as a dependency from a passthrough'ed
-- * device. Most information are retrieved from the host clock node.
-- * Also check the host clock is a fixed one.
-- *
-- * @host_fdt: host device tree blob from which info are retrieved
-- * @guest_fdt: guest device tree blob where the clock node is added
-- * @host_phandle: phandle of the clock in host device tree
-- * @guest_phandle: phandle to assign to the guest node
-- */
--static void fdt_build_clock_node(void *host_fdt, void *guest_fdt,
-- uint32_t host_phandle,
-- uint32_t guest_phandle)
--{
-- char *node_path = NULL;
-- char *nodename;
-- const void *r;
-- int ret, node_offset, prop_len, path_len = 16;
--
-- node_offset = fdt_node_offset_by_phandle(host_fdt, host_phandle);
-- if (node_offset <= 0) {
-- error_report("not able to locate clock handle %d in host device tree",
-- host_phandle);
-- exit(1);
-- }
-- node_path = g_malloc(path_len);
-- while ((ret = fdt_get_path(host_fdt, node_offset, node_path, path_len))
-- == -FDT_ERR_NOSPACE) {
-- path_len += 16;
-- node_path = g_realloc(node_path, path_len);
-- }
-- if (ret < 0) {
-- error_report("not able to retrieve node path for clock handle %d",
-- host_phandle);
-- exit(1);
-- }
--
-- r = qemu_fdt_getprop(host_fdt, node_path, "compatible", &prop_len,
-- &error_fatal);
-- if (strcmp(r, "fixed-clock")) {
-- error_report("clock handle %d is not a fixed clock", host_phandle);
-- exit(1);
-- }
--
-- nodename = strrchr(node_path, '/');
-- qemu_fdt_add_subnode(guest_fdt, nodename);
--
-- copy_properties_from_host(clock_copied_properties,
-- ARRAY_SIZE(clock_copied_properties),
-- host_fdt, guest_fdt,
-- node_path, nodename);
--
-- qemu_fdt_setprop_cell(guest_fdt, nodename, "phandle", guest_phandle);
--
-- g_free(node_path);
--}
--
--/**
-- * sysfs_to_dt_name: convert the name found in sysfs into the node name
-- * for instance e0900000.xgmac is converted into xgmac@e0900000
-- * @sysfs_name: directory name in sysfs
-- *
-- * returns the device tree name upon success or NULL in case the sysfs name
-- * does not match the expected format
-- */
--static char *sysfs_to_dt_name(const char *sysfs_name)
--{
-- gchar **substrings = g_strsplit(sysfs_name, ".", 2);
-- char *dt_name = NULL;
--
-- if (!substrings || !substrings[0] || !substrings[1]) {
-- goto out;
-- }
-- dt_name = g_strdup_printf("%s@%s", substrings[1], substrings[0]);
--out:
-- g_strfreev(substrings);
-- return dt_name;
--}
--
- /* Device Specific Code */
-
- /**
-@@ -263,182 +126,6 @@ static int add_calxeda_midway_xgmac_fdt_node(SysBusDevice *sbdev, void *opaque)
- return 0;
- }
-
--/* AMD xgbe properties whose values are copied/pasted from host */
--static HostProperty amd_xgbe_copied_properties[] = {
-- {"compatible", false},
-- {"dma-coherent", true},
-- {"amd,per-channel-interrupt", true},
-- {"phy-mode", false},
-- {"mac-address", true},
-- {"amd,speed-set", false},
-- {"amd,serdes-blwc", true},
-- {"amd,serdes-cdr-rate", true},
-- {"amd,serdes-pq-skew", true},
-- {"amd,serdes-tx-amp", true},
-- {"amd,serdes-dfe-tap-config", true},
-- {"amd,serdes-dfe-tap-enable", true},
-- {"clock-names", false},
--};
--
--/**
-- * add_amd_xgbe_fdt_node
-- *
-- * Generates the combined xgbe/phy node following kernel >=4.2
-- * binding documentation:
-- * Documentation/devicetree/bindings/net/amd-xgbe.txt:
-- * Also 2 clock nodes are created (dma and ptp)
-- *
-- * Asserts in case of error
-- */
--static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque)
--{
-- PlatformBusFDTData *data = opaque;
-- PlatformBusDevice *pbus = data->pbus;
-- VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(sbdev);
-- VFIODevice *vbasedev = &vdev->vbasedev;
-- VFIOINTp *intp;
-- const char *parent_node = data->pbus_node_name;
-- char **node_path, *nodename, *dt_name;
-- void *guest_fdt = data->fdt, *host_fdt;
-- const void *r;
-- int i, prop_len;
-- uint32_t *irq_attr, *reg_attr;
-- const uint32_t *host_clock_phandles;
-- uint64_t mmio_base, irq_number;
-- uint32_t guest_clock_phandles[2];
--
-- host_fdt = load_device_tree_from_sysfs();
--
-- dt_name = sysfs_to_dt_name(vbasedev->name);
-- if (!dt_name) {
-- error_report("%s incorrect sysfs device name %s",
-- __func__, vbasedev->name);
-- exit(1);
-- }
-- node_path = qemu_fdt_node_path(host_fdt, dt_name, vdev->compat,
-- &error_fatal);
-- if (!node_path || !node_path[0]) {
-- error_report("%s unable to retrieve node path for %s/%s",
-- __func__, dt_name, vdev->compat);
-- exit(1);
-- }
--
-- if (node_path[1]) {
-- error_report("%s more than one node matching %s/%s!",
-- __func__, dt_name, vdev->compat);
-- exit(1);
-- }
--
-- g_free(dt_name);
--
-- if (vbasedev->num_initial_regions != 5) {
-- error_report("%s Does the host dt node combine XGBE/PHY?", __func__);
-- exit(1);
-- }
--
-- /* generate nodes for DMA_CLK and PTP_CLK */
-- r = qemu_fdt_getprop(host_fdt, node_path[0], "clocks",
-- &prop_len, &error_fatal);
-- if (prop_len != 8) {
-- error_report("%s clocks property should contain 2 handles", __func__);
-- exit(1);
-- }
-- host_clock_phandles = r;
-- guest_clock_phandles[0] = qemu_fdt_alloc_phandle(guest_fdt);
-- guest_clock_phandles[1] = qemu_fdt_alloc_phandle(guest_fdt);
--
-- /**
-- * clock handles fetched from host dt are in be32 layout whereas
-- * rest of the code uses cpu layout. Also guest clock handles are
-- * in cpu layout.
-- */
-- fdt_build_clock_node(host_fdt, guest_fdt,
-- be32_to_cpu(host_clock_phandles[0]),
-- guest_clock_phandles[0]);
--
-- fdt_build_clock_node(host_fdt, guest_fdt,
-- be32_to_cpu(host_clock_phandles[1]),
-- guest_clock_phandles[1]);
--
-- /* combined XGBE/PHY node */
-- mmio_base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
-- nodename = g_strdup_printf("%s/%s@%" PRIx64, parent_node,
-- vbasedev->name, mmio_base);
-- qemu_fdt_add_subnode(guest_fdt, nodename);
--
-- copy_properties_from_host(amd_xgbe_copied_properties,
-- ARRAY_SIZE(amd_xgbe_copied_properties),
-- host_fdt, guest_fdt,
-- node_path[0], nodename);
--
-- qemu_fdt_setprop_cells(guest_fdt, nodename, "clocks",
-- guest_clock_phandles[0],
-- guest_clock_phandles[1]);
--
-- reg_attr = g_new(uint32_t, vbasedev->num_initial_regions * 2);
-- for (i = 0; i < vbasedev->num_initial_regions; i++) {
-- mmio_base = platform_bus_get_mmio_addr(pbus, sbdev, i);
-- reg_attr[2 * i] = cpu_to_be32(mmio_base);
-- reg_attr[2 * i + 1] = cpu_to_be32(
-- memory_region_size(vdev->regions[i]->mem));
-- }
-- qemu_fdt_setprop(guest_fdt, nodename, "reg", reg_attr,
-- vbasedev->num_initial_regions * 2 * sizeof(uint32_t));
--
-- irq_attr = g_new(uint32_t, vbasedev->num_irqs * 3);
-- for (i = 0; i < vbasedev->num_irqs; i++) {
-- irq_number = platform_bus_get_irqn(pbus, sbdev , i)
-- + data->irq_start;
-- irq_attr[3 * i] = cpu_to_be32(GIC_FDT_IRQ_TYPE_SPI);
-- irq_attr[3 * i + 1] = cpu_to_be32(irq_number);
-- /*
-- * General device interrupt and PCS auto-negotiation interrupts are
-- * level-sensitive while the 4 per-channel interrupts are edge
-- * sensitive
-- */
-- QLIST_FOREACH(intp, &vdev->intp_list, next) {
-- if (intp->pin == i) {
-- break;
-- }
-- }
-- if (intp->flags & VFIO_IRQ_INFO_AUTOMASKED) {
-- irq_attr[3 * i + 2] = cpu_to_be32(GIC_FDT_IRQ_FLAGS_LEVEL_HI);
-- } else {
-- irq_attr[3 * i + 2] = cpu_to_be32(GIC_FDT_IRQ_FLAGS_EDGE_LO_HI);
-- }
-- }
-- qemu_fdt_setprop(guest_fdt, nodename, "interrupts",
-- irq_attr, vbasedev->num_irqs * 3 * sizeof(uint32_t));
--
-- g_free(host_fdt);
-- g_strfreev(node_path);
-- g_free(irq_attr);
-- g_free(reg_attr);
-- g_free(nodename);
-- return 0;
--}
--
--/* DT compatible matching */
--static bool vfio_platform_match(SysBusDevice *sbdev,
-- const BindingEntry *entry)
--{
-- VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(sbdev);
-- const char *compat;
-- unsigned int n;
--
-- for (n = vdev->num_compat, compat = vdev->compat; n > 0;
-- n--, compat += strlen(compat) + 1) {
-- if (!strcmp(entry->compat, compat)) {
-- return true;
-- }
-- }
--
-- return false;
--}
--
--#define VFIO_PLATFORM_BINDING(compat, add_fn) \
-- {TYPE_VFIO_PLATFORM, (compat), (add_fn), vfio_platform_match}
--
- #endif /* CONFIG_LINUX */
-
- #ifdef CONFIG_TPM
-@@ -513,8 +200,6 @@ static bool type_match(SysBusDevice *sbdev, const BindingEntry *entry)
- static const BindingEntry bindings[] = {
- #ifdef CONFIG_LINUX
- TYPE_BINDING(TYPE_VFIO_CALXEDA_XGMAC, add_calxeda_midway_xgmac_fdt_node),
-- TYPE_BINDING(TYPE_VFIO_AMD_XGBE, add_amd_xgbe_fdt_node),
-- VFIO_PLATFORM_BINDING("amd,xgbe-seattle-v1a", add_amd_xgbe_fdt_node),
- #endif
- #ifdef CONFIG_TPM
- TYPE_BINDING(TYPE_TPM_TIS_SYSBUS, add_tpm_tis_fdt_node),
-diff --git a/hw/vfio/Kconfig b/hw/vfio/Kconfig
-index 91d9023b79..bc984f1986 100644
---- a/hw/vfio/Kconfig
-+++ b/hw/vfio/Kconfig
-@@ -28,11 +28,6 @@ config VFIO_XGMAC
- default y
- depends on VFIO_PLATFORM
-
--config VFIO_AMD_XGBE
-- bool
-- default y
-- depends on VFIO_PLATFORM
--
- config VFIO_AP
- bool
- default y
-diff --git a/hw/vfio/amd-xgbe.c b/hw/vfio/amd-xgbe.c
-deleted file mode 100644
-index 58f590e385..0000000000
---- a/hw/vfio/amd-xgbe.c
-+++ /dev/null
-@@ -1,61 +0,0 @@
--/*
-- * AMD XGBE VFIO device
-- *
-- * Copyright Linaro Limited, 2015
-- *
-- * Authors:
-- * Eric Auger <eric.auger@linaro.org>
-- *
-- * This work is licensed under the terms of the GNU GPL, version 2. See
-- * the COPYING file in the top-level directory.
-- *
-- */
--
--#include "qemu/osdep.h"
--#include "hw/vfio/vfio-amd-xgbe.h"
--#include "migration/vmstate.h"
--#include "qemu/module.h"
--#include "qemu/error-report.h"
--
--static void amd_xgbe_realize(DeviceState *dev, Error **errp)
--{
-- VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
-- VFIOAmdXgbeDeviceClass *k = VFIO_AMD_XGBE_DEVICE_GET_CLASS(dev);
--
-- warn_report("-device vfio-amd-xgbe is deprecated");
-- vdev->compat = g_strdup("amd,xgbe-seattle-v1a");
-- vdev->num_compat = 1;
--
-- k->parent_realize(dev, errp);
--}
--
--static const VMStateDescription vfio_platform_amd_xgbe_vmstate = {
-- .name = "vfio-amd-xgbe",
-- .unmigratable = 1,
--};
--
--static void vfio_amd_xgbe_class_init(ObjectClass *klass, const void *data)
--{
-- DeviceClass *dc = DEVICE_CLASS(klass);
-- VFIOAmdXgbeDeviceClass *vcxc =
-- VFIO_AMD_XGBE_DEVICE_CLASS(klass);
-- device_class_set_parent_realize(dc, amd_xgbe_realize,
-- &vcxc->parent_realize);
-- dc->desc = "VFIO AMD XGBE";
-- dc->vmsd = &vfio_platform_amd_xgbe_vmstate;
--}
--
--static const TypeInfo vfio_amd_xgbe_dev_info = {
-- .name = TYPE_VFIO_AMD_XGBE,
-- .parent = TYPE_VFIO_PLATFORM,
-- .instance_size = sizeof(VFIOAmdXgbeDevice),
-- .class_init = vfio_amd_xgbe_class_init,
-- .class_size = sizeof(VFIOAmdXgbeDeviceClass),
--};
--
--static void register_amd_xgbe_dev_type(void)
--{
-- type_register_static(&vfio_amd_xgbe_dev_info);
--}
--
--type_init(register_amd_xgbe_dev_type)
-diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
-index bfaf6be805..0edcaf5155 100644
---- a/hw/vfio/meson.build
-+++ b/hw/vfio/meson.build
-@@ -20,7 +20,6 @@ vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
- specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)
-
- system_ss.add(when: 'CONFIG_VFIO_XGMAC', if_true: files('calxeda-xgmac.c'))
--system_ss.add(when: 'CONFIG_VFIO_AMD_XGBE', if_true: files('amd-xgbe.c'))
- system_ss.add(when: 'CONFIG_VFIO', if_true: files(
- 'cpr.c',
- 'cpr-legacy.c',
-diff --git a/include/hw/vfio/vfio-amd-xgbe.h b/include/hw/vfio/vfio-amd-xgbe.h
-deleted file mode 100644
-index a894546c02..0000000000
---- a/include/hw/vfio/vfio-amd-xgbe.h
-+++ /dev/null
-@@ -1,46 +0,0 @@
--/*
-- * VFIO AMD XGBE device
-- *
-- * Copyright Linaro Limited, 2015
-- *
-- * Authors:
-- * Eric Auger <eric.auger@linaro.org>
-- *
-- * This work is licensed under the terms of the GNU GPL, version 2. See
-- * the COPYING file in the top-level directory.
-- *
-- */
--
--#ifndef HW_VFIO_VFIO_AMD_XGBE_H
--#define HW_VFIO_VFIO_AMD_XGBE_H
--
--#include "hw/vfio/vfio-platform.h"
--#include "qom/object.h"
--
--#define TYPE_VFIO_AMD_XGBE "vfio-amd-xgbe"
--
--/**
-- * This device exposes:
-- * - 5 MMIO regions: MAC, PCS, SerDes Rx/Tx regs,
-- SerDes Integration Registers 1/2 & 2/2
-- * - 2 level sensitive IRQs and optional DMA channel IRQs
-- */
--struct VFIOAmdXgbeDevice {
-- VFIOPlatformDevice vdev;
--};
--
--typedef struct VFIOAmdXgbeDevice VFIOAmdXgbeDevice;
--
--struct VFIOAmdXgbeDeviceClass {
-- /*< private >*/
-- VFIOPlatformDeviceClass parent_class;
-- /*< public >*/
-- DeviceRealize parent_realize;
--};
--
--typedef struct VFIOAmdXgbeDeviceClass VFIOAmdXgbeDeviceClass;
--
--DECLARE_OBJ_CHECKERS(VFIOAmdXgbeDevice, VFIOAmdXgbeDeviceClass,
-- VFIO_AMD_XGBE_DEVICE, TYPE_VFIO_AMD_XGBE)
--
--#endif
---
-2.52.0
-
diff --git a/kvm-vfio-Remove-vfio-calxeda-xgmac-device.patch b/kvm-vfio-Remove-vfio-calxeda-xgmac-device.patch
deleted file mode 100644
index b841ecb..0000000
--- a/kvm-vfio-Remove-vfio-calxeda-xgmac-device.patch
+++ /dev/null
@@ -1,366 +0,0 @@
-From c752372d16d3b2d95921c75263f7e119f6bf7c09 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
-Date: Mon, 1 Sep 2025 08:46:29 +0200
-Subject: [PATCH 021/116] vfio: Remove 'vfio-calxeda-xgmac' device
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [5/100] 22237c22b8adb8293ae79327fabe6359bedc010d (rovick1/qemu-kvm)
-
-Conflicts:
- hw/arm/virt.c: due to the downstream-only code in #if 0
- hw/core/sysbus-fdt.c: downstream 60e7ac0c41c2 ("vfio: rename
- field to "num_initial_regions") touches sysbus-fdt.c. Anyway that code
- is removed
-
-The VFIO_XGMAC device type has been deprecated in the QEMU 10.0
-timeframe. Remove it.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250901064631.530723-7-clg@redhat.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 8ebc416ac17a71aec267df1ca5cb5301cc6c4906)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- docs/about/deprecated.rst | 7 ---
- docs/about/removed-features.rst | 7 +++
- docs/devel/kconfig.rst | 1 -
- hw/arm/Kconfig | 1 -
- hw/arm/virt.c | 3 +-
- hw/core/sysbus-fdt.c | 68 ----------------------------
- hw/vfio/Kconfig | 5 --
- hw/vfio/calxeda-xgmac.c | 61 -------------------------
- hw/vfio/meson.build | 1 -
- include/hw/vfio/vfio-calxeda-xgmac.h | 43 ------------------
- 10 files changed, 8 insertions(+), 189 deletions(-)
- delete mode 100644 hw/vfio/calxeda-xgmac.c
- delete mode 100644 include/hw/vfio/vfio-calxeda-xgmac.h
-
-diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
-index 631871ffc8..0df97eb2b7 100644
---- a/docs/about/deprecated.rst
-+++ b/docs/about/deprecated.rst
-@@ -519,13 +519,6 @@ which is not enough for all types of use cases, use ``reconnect-ms`` instead.
- VFIO device options
- '''''''''''''''''''
-
--``-device vfio-calxeda-xgmac`` (since 10.0)
--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--The vfio-calxeda-xgmac device allows to assign a host Calxeda Highbank
--10Gb XGMAC Ethernet controller device ("calxeda,hb-xgmac" compatibility
--string) to a guest. Calxeda HW has been ewasted now and there is no point
--keeping that device.
--
- ``-device vfio-platform`` (since 10.0)
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- The vfio-platform device allows to assign a host platform device
-diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
-index 759c067412..47e632b4ac 100644
---- a/docs/about/removed-features.rst
-+++ b/docs/about/removed-features.rst
-@@ -1265,6 +1265,13 @@ device driver such as RBD.
- VFIO devices
- ------------
-
-+``-device vfio-calxeda-xgmac`` (since 10.2)
-+'''''''''''''''''''''''''''''''''''''''''''
-+The vfio-calxeda-xgmac device allows to assign a host Calxeda Highbank
-+10Gb XGMAC Ethernet controller device ("calxeda,hb-xgmac" compatibility
-+string) to a guest. Calxeda HW has been ewasted now and there is no point
-+keeping that device.
-+
- ``-device vfio-amd-xgbe`` (since 10.2)
- ''''''''''''''''''''''''''''''''''''''
- The vfio-amd-xgbe device allows to assign a host AMD 10GbE controller
-diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst
-index 9fdf501529..1d4a114a02 100644
---- a/docs/devel/kconfig.rst
-+++ b/docs/devel/kconfig.rst
-@@ -59,7 +59,6 @@ stanza like the following::
- config ARM_VIRT
- bool
- imply PCI_DEVICES
-- imply VFIO_XGMAC
- select A15MPCORE
- select ACPI
- select ARM_SMMUV3
-diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
-index 64b2ec87b5..3fca48349a 100644
---- a/hw/arm/Kconfig
-+++ b/hw/arm/Kconfig
-@@ -6,7 +6,6 @@ config ARM_VIRT
- imply PCI_DEVICES
- imply TEST_DEVICES
- imply VFIO_PLATFORM
-- imply VFIO_XGMAC
- imply TPM_TIS_SYSBUS
- imply TPM_TIS_I2C
- imply NVDIMM
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index c0292a3899..2a399e468c 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -38,7 +38,7 @@
- #include "hw/arm/primecell.h"
- #include "hw/arm/virt.h"
- #include "hw/block/flash.h"
--#include "hw/vfio/vfio-calxeda-xgmac.h"
-+#include "hw/vfio/vfio-platform.h"
- #include "hw/display/ramfb.h"
- #include "net/net.h"
- #include "system/device_tree.h"
-@@ -3322,7 +3322,6 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
- /* Maximum supported VCPU count for all virt-rhel* machines */
- mc->max_cpus = 384;
- #if 0 /* Disabled for Red Hat Enterprise Linux */
-- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_CALXEDA_XGMAC);
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM);
- #endif
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
-diff --git a/hw/core/sysbus-fdt.c b/hw/core/sysbus-fdt.c
-index 0caffe4845..59f1d17de1 100644
---- a/hw/core/sysbus-fdt.c
-+++ b/hw/core/sysbus-fdt.c
-@@ -33,9 +33,6 @@
- #include "system/tpm.h"
- #include "hw/arm/smmuv3.h"
- #include "hw/platform-bus.h"
--#include "hw/vfio/vfio-platform.h"
--#include "hw/vfio/vfio-calxeda-xgmac.h"
--#include "hw/vfio/vfio-region.h"
- #include "hw/display/ramfb.h"
- #include "hw/uefi/var-service-api.h"
- #include "hw/arm/fdt.h"
-@@ -66,68 +63,6 @@ typedef struct HostProperty {
- bool optional;
- } HostProperty;
-
--#ifdef CONFIG_LINUX
--
--/* Device Specific Code */
--
--/**
-- * add_calxeda_midway_xgmac_fdt_node
-- *
-- * Generates a simple node with following properties:
-- * compatible string, regs, interrupts, dma-coherent
-- */
--static int add_calxeda_midway_xgmac_fdt_node(SysBusDevice *sbdev, void *opaque)
--{
-- PlatformBusFDTData *data = opaque;
-- PlatformBusDevice *pbus = data->pbus;
-- void *fdt = data->fdt;
-- const char *parent_node = data->pbus_node_name;
-- int compat_str_len, i;
-- char *nodename;
-- uint32_t *irq_attr, *reg_attr;
-- uint64_t mmio_base, irq_number;
-- VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(sbdev);
-- VFIODevice *vbasedev = &vdev->vbasedev;
--
-- mmio_base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
-- nodename = g_strdup_printf("%s/%s@%" PRIx64, parent_node,
-- vbasedev->name, mmio_base);
-- qemu_fdt_add_subnode(fdt, nodename);
--
-- compat_str_len = strlen(vdev->compat) + 1;
-- qemu_fdt_setprop(fdt, nodename, "compatible",
-- vdev->compat, compat_str_len);
--
-- qemu_fdt_setprop(fdt, nodename, "dma-coherent", "", 0);
--
-- reg_attr = g_new(uint32_t, vbasedev->num_initial_regions * 2);
-- for (i = 0; i < vbasedev->num_initial_regions; i++) {
-- mmio_base = platform_bus_get_mmio_addr(pbus, sbdev, i);
-- reg_attr[2 * i] = cpu_to_be32(mmio_base);
-- reg_attr[2 * i + 1] = cpu_to_be32(
-- memory_region_size(vdev->regions[i]->mem));
-- }
-- qemu_fdt_setprop(fdt, nodename, "reg", reg_attr,
-- vbasedev->num_initial_regions * 2 * sizeof(uint32_t));
--
-- irq_attr = g_new(uint32_t, vbasedev->num_irqs * 3);
-- for (i = 0; i < vbasedev->num_irqs; i++) {
-- irq_number = platform_bus_get_irqn(pbus, sbdev , i)
-- + data->irq_start;
-- irq_attr[3 * i] = cpu_to_be32(GIC_FDT_IRQ_TYPE_SPI);
-- irq_attr[3 * i + 1] = cpu_to_be32(irq_number);
-- irq_attr[3 * i + 2] = cpu_to_be32(GIC_FDT_IRQ_FLAGS_LEVEL_HI);
-- }
-- qemu_fdt_setprop(fdt, nodename, "interrupts",
-- irq_attr, vbasedev->num_irqs * 3 * sizeof(uint32_t));
-- g_free(irq_attr);
-- g_free(reg_attr);
-- g_free(nodename);
-- return 0;
--}
--
--#endif /* CONFIG_LINUX */
--
- #ifdef CONFIG_TPM
- /*
- * add_tpm_tis_fdt_node: Create a DT node for TPM TIS
-@@ -198,9 +133,6 @@ static bool type_match(SysBusDevice *sbdev, const BindingEntry *entry)
-
- /* list of supported dynamic sysbus bindings */
- static const BindingEntry bindings[] = {
--#ifdef CONFIG_LINUX
-- TYPE_BINDING(TYPE_VFIO_CALXEDA_XGMAC, add_calxeda_midway_xgmac_fdt_node),
--#endif
- #ifdef CONFIG_TPM
- TYPE_BINDING(TYPE_TPM_TIS_SYSBUS, add_tpm_tis_fdt_node),
- #endif
-diff --git a/hw/vfio/Kconfig b/hw/vfio/Kconfig
-index bc984f1986..9a1dbe2926 100644
---- a/hw/vfio/Kconfig
-+++ b/hw/vfio/Kconfig
-@@ -23,11 +23,6 @@ config VFIO_PLATFORM
- select VFIO
- depends on LINUX && PLATFORM_BUS
-
--config VFIO_XGMAC
-- bool
-- default y
-- depends on VFIO_PLATFORM
--
- config VFIO_AP
- bool
- default y
-diff --git a/hw/vfio/calxeda-xgmac.c b/hw/vfio/calxeda-xgmac.c
-deleted file mode 100644
-index 03f2ff5763..0000000000
---- a/hw/vfio/calxeda-xgmac.c
-+++ /dev/null
-@@ -1,61 +0,0 @@
--/*
-- * calxeda xgmac VFIO device
-- *
-- * Copyright Linaro Limited, 2014
-- *
-- * Authors:
-- * Eric Auger <eric.auger@linaro.org>
-- *
-- * This work is licensed under the terms of the GNU GPL, version 2. See
-- * the COPYING file in the top-level directory.
-- *
-- */
--
--#include "qemu/osdep.h"
--#include "hw/vfio/vfio-calxeda-xgmac.h"
--#include "migration/vmstate.h"
--#include "qemu/module.h"
--#include "qemu/error-report.h"
--
--static void calxeda_xgmac_realize(DeviceState *dev, Error **errp)
--{
-- VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
-- VFIOCalxedaXgmacDeviceClass *k = VFIO_CALXEDA_XGMAC_DEVICE_GET_CLASS(dev);
--
-- warn_report("-device vfio-calxeda-xgmac is deprecated");
-- vdev->compat = g_strdup("calxeda,hb-xgmac");
-- vdev->num_compat = 1;
--
-- k->parent_realize(dev, errp);
--}
--
--static const VMStateDescription vfio_platform_calxeda_xgmac_vmstate = {
-- .name = "vfio-calxeda-xgmac",
-- .unmigratable = 1,
--};
--
--static void vfio_calxeda_xgmac_class_init(ObjectClass *klass, const void *data)
--{
-- DeviceClass *dc = DEVICE_CLASS(klass);
-- VFIOCalxedaXgmacDeviceClass *vcxc =
-- VFIO_CALXEDA_XGMAC_DEVICE_CLASS(klass);
-- device_class_set_parent_realize(dc, calxeda_xgmac_realize,
-- &vcxc->parent_realize);
-- dc->desc = "VFIO Calxeda XGMAC";
-- dc->vmsd = &vfio_platform_calxeda_xgmac_vmstate;
--}
--
--static const TypeInfo vfio_calxeda_xgmac_dev_info = {
-- .name = TYPE_VFIO_CALXEDA_XGMAC,
-- .parent = TYPE_VFIO_PLATFORM,
-- .instance_size = sizeof(VFIOCalxedaXgmacDevice),
-- .class_init = vfio_calxeda_xgmac_class_init,
-- .class_size = sizeof(VFIOCalxedaXgmacDeviceClass),
--};
--
--static void register_calxeda_xgmac_dev_type(void)
--{
-- type_register_static(&vfio_calxeda_xgmac_dev_info);
--}
--
--type_init(register_calxeda_xgmac_dev_type)
-diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
-index 0edcaf5155..06473a0789 100644
---- a/hw/vfio/meson.build
-+++ b/hw/vfio/meson.build
-@@ -19,7 +19,6 @@ vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
-
- specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)
-
--system_ss.add(when: 'CONFIG_VFIO_XGMAC', if_true: files('calxeda-xgmac.c'))
- system_ss.add(when: 'CONFIG_VFIO', if_true: files(
- 'cpr.c',
- 'cpr-legacy.c',
-diff --git a/include/hw/vfio/vfio-calxeda-xgmac.h b/include/hw/vfio/vfio-calxeda-xgmac.h
-deleted file mode 100644
-index 8482f151dd..0000000000
---- a/include/hw/vfio/vfio-calxeda-xgmac.h
-+++ /dev/null
-@@ -1,43 +0,0 @@
--/*
-- * VFIO calxeda xgmac device
-- *
-- * Copyright Linaro Limited, 2014
-- *
-- * Authors:
-- * Eric Auger <eric.auger@linaro.org>
-- *
-- * This work is licensed under the terms of the GNU GPL, version 2. See
-- * the COPYING file in the top-level directory.
-- *
-- */
--
--#ifndef HW_VFIO_VFIO_CALXEDA_XGMAC_H
--#define HW_VFIO_VFIO_CALXEDA_XGMAC_H
--
--#include "hw/vfio/vfio-platform.h"
--#include "qom/object.h"
--
--#define TYPE_VFIO_CALXEDA_XGMAC "vfio-calxeda-xgmac"
--
--/**
-- * This device exposes:
-- * - a single MMIO region corresponding to its register space
-- * - 3 IRQS (main and 2 power related IRQs)
-- */
--struct VFIOCalxedaXgmacDevice {
-- VFIOPlatformDevice vdev;
--};
--typedef struct VFIOCalxedaXgmacDevice VFIOCalxedaXgmacDevice;
--
--struct VFIOCalxedaXgmacDeviceClass {
-- /*< private >*/
-- VFIOPlatformDeviceClass parent_class;
-- /*< public >*/
-- DeviceRealize parent_realize;
--};
--typedef struct VFIOCalxedaXgmacDeviceClass VFIOCalxedaXgmacDeviceClass;
--
--DECLARE_OBJ_CHECKERS(VFIOCalxedaXgmacDevice, VFIOCalxedaXgmacDeviceClass,
-- VFIO_CALXEDA_XGMAC_DEVICE, TYPE_VFIO_CALXEDA_XGMAC)
--
--#endif
---
-2.52.0
-
diff --git a/kvm-vfio-Remove-vfio-platform.patch b/kvm-vfio-Remove-vfio-platform.patch
deleted file mode 100644
index 1bffc6f..0000000
--- a/kvm-vfio-Remove-vfio-platform.patch
+++ /dev/null
@@ -1,999 +0,0 @@
-From e5a4eb3213d2368f93b3cdd5c4363c6e5900fa4e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
-Date: Mon, 1 Sep 2025 08:46:30 +0200
-Subject: [PATCH 023/116] vfio: Remove 'vfio-platform'
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [7/100] 8e09d3b9c245e811a0be39cfba01ef1f9a185826 (rovick1/qemu-kvm)
-
-Conflicts:
- hw/arm/virt.c: contextual diff due to downstream-only sections
- hw/vfio/platform.c: contextual diff due to downstream
- 60e7ac0c41c2 ("vfio: rename field to "num_initial_regions"")
- anyway the file is removed
-
-The VFIO_PLATFORM device type has been deprecated in the QEMU 10.0
-timeframe. All dependent devices have been removed. Now remove the
-core vfio platform framework.
-
-Rename VFIO_DEVICE_TYPE_PLATFORM enum to VFIO_DEVICE_TYPE_UNUSED to
-maintain the same index for the CCW and AP VFIO device types.
-
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250901064631.530723-8-clg@redhat.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 762c85543948bf1f7838d663995648635d3f4b92)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- docs/about/deprecated.rst | 12 -
- docs/about/removed-features.rst | 9 +
- hw/arm/Kconfig | 1 -
- hw/arm/virt.c | 4 -
- hw/vfio/Kconfig | 6 -
- hw/vfio/meson.build | 1 -
- hw/vfio/platform.c | 716 --------------------------------
- hw/vfio/trace-events | 11 -
- include/hw/vfio/vfio-device.h | 2 +-
- include/hw/vfio/vfio-platform.h | 78 ----
- 10 files changed, 10 insertions(+), 830 deletions(-)
- delete mode 100644 hw/vfio/platform.c
- delete mode 100644 include/hw/vfio/vfio-platform.h
-
-diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
-index 0df97eb2b7..fc422acc3e 100644
---- a/docs/about/deprecated.rst
-+++ b/docs/about/deprecated.rst
-@@ -516,18 +516,6 @@ Stream ``reconnect`` (since 9.2)
- The ``reconnect`` option only allows specifying second granularity timeouts,
- which is not enough for all types of use cases, use ``reconnect-ms`` instead.
-
--VFIO device options
--'''''''''''''''''''
--
--``-device vfio-platform`` (since 10.0)
--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--The vfio-platform device allows to assign a host platform device
--to a guest in a generic manner. Integrating a new device into
--the vfio-platform infrastructure requires some adaptation at
--both kernel and qemu level. No such attempt has been done for years
--and the conclusion is that vfio-platform has not got any traction.
--PCIe passthrough shall be the mainline solution.
--
- CPU device properties
- '''''''''''''''''''''
-
-diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
-index 47e632b4ac..177128812d 100644
---- a/docs/about/removed-features.rst
-+++ b/docs/about/removed-features.rst
-@@ -1278,6 +1278,15 @@ The vfio-amd-xgbe device allows to assign a host AMD 10GbE controller
- to a guest ("amd,xgbe-seattle-v1a" compatibility string). AMD "Seattle"
- is not supported anymore and there is no point keeping that device.
-
-+``-device vfio-platform`` (since 10.2)
-+''''''''''''''''''''''''''''''''''''''
-+The vfio-platform device allows to assign a host platform device
-+to a guest in a generic manner. Integrating a new device into
-+the vfio-platform infrastructure requires some adaptation at
-+both kernel and qemu level. No such attempt has been done for years
-+and the conclusion is that vfio-platform has not got any traction.
-+PCIe passthrough shall be the mainline solution.
-+
- Tools
- -----
-
-diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
-index 3fca48349a..3baa6c6c74 100644
---- a/hw/arm/Kconfig
-+++ b/hw/arm/Kconfig
-@@ -5,7 +5,6 @@ config ARM_VIRT
- depends on TCG || KVM || HVF
- imply PCI_DEVICES
- imply TEST_DEVICES
-- imply VFIO_PLATFORM
- imply TPM_TIS_SYSBUS
- imply TPM_TIS_I2C
- imply NVDIMM
-diff --git a/hw/arm/virt.c b/hw/arm/virt.c
-index 990d2c73c7..5bb6ba7de7 100644
---- a/hw/arm/virt.c
-+++ b/hw/arm/virt.c
-@@ -38,7 +38,6 @@
- #include "hw/arm/primecell.h"
- #include "hw/arm/virt.h"
- #include "hw/block/flash.h"
--#include "hw/vfio/vfio-platform.h"
- #include "hw/display/ramfb.h"
- #include "net/net.h"
- #include "system/device_tree.h"
-@@ -3322,9 +3321,6 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
- mc->init = machvirt_init;
- /* Maximum supported VCPU count for all virt-rhel* machines */
- mc->max_cpus = 384;
--#if 0 /* Disabled for Red Hat Enterprise Linux */
-- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM);
--#endif
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_UEFI_VARS_SYSBUS);
- machine_class_allow_dynamic_sysbus_dev(mc, TYPE_ARM_SMMUV3);
-diff --git a/hw/vfio/Kconfig b/hw/vfio/Kconfig
-index 9a1dbe2926..27de24e4db 100644
---- a/hw/vfio/Kconfig
-+++ b/hw/vfio/Kconfig
-@@ -17,12 +17,6 @@ config VFIO_CCW
- select VFIO
- depends on LINUX && S390_CCW_VIRTIO
-
--config VFIO_PLATFORM
-- bool
-- default y
-- select VFIO
-- depends on LINUX && PLATFORM_BUS
--
- config VFIO_AP
- bool
- default y
-diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
-index 06473a0789..d3ed3cb7ac 100644
---- a/hw/vfio/meson.build
-+++ b/hw/vfio/meson.build
-@@ -13,7 +13,6 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
- 'pci.c',
- ))
- vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
--vfio_ss.add(when: 'CONFIG_VFIO_PLATFORM', if_true: files('platform.c'))
- vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
- vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
-
-diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
-deleted file mode 100644
-index c9349ba7b7..0000000000
---- a/hw/vfio/platform.c
-+++ /dev/null
-@@ -1,716 +0,0 @@
--/*
-- * vfio based device assignment support - platform devices
-- *
-- * Copyright Linaro Limited, 2014
-- *
-- * Authors:
-- * Kim Phillips <kim.phillips@linaro.org>
-- * Eric Auger <eric.auger@linaro.org>
-- *
-- * This work is licensed under the terms of the GNU GPL, version 2. See
-- * the COPYING file in the top-level directory.
-- *
-- * Based on vfio based PCI device assignment support:
-- * Copyright Red Hat, Inc. 2012
-- */
--
--#include "qemu/osdep.h"
--#include CONFIG_DEVICES /* CONFIG_IOMMUFD */
--#include "qapi/error.h"
--#include <sys/ioctl.h>
--#include <linux/vfio.h>
--
--#include "hw/vfio/vfio-platform.h"
--#include "system/iommufd.h"
--#include "migration/vmstate.h"
--#include "qemu/error-report.h"
--#include "qemu/lockable.h"
--#include "qemu/main-loop.h"
--#include "qemu/module.h"
--#include "qemu/range.h"
--#include "system/memory.h"
--#include "system/address-spaces.h"
--#include "qemu/queue.h"
--#include "hw/sysbus.h"
--#include "trace.h"
--#include "hw/irq.h"
--#include "hw/platform-bus.h"
--#include "hw/qdev-properties.h"
--#include "system/kvm.h"
--#include "hw/vfio/vfio-region.h"
--
--/*
-- * Functions used whatever the injection method
-- */
--
--static inline bool vfio_irq_is_automasked(VFIOINTp *intp)
--{
-- return intp->flags & VFIO_IRQ_INFO_AUTOMASKED;
--}
--
--/**
-- * vfio_init_intp - allocate, initialize the IRQ struct pointer
-- * and add it into the list of IRQs
-- * @vbasedev: the VFIO device handle
-- * @info: irq info struct retrieved from VFIO driver
-- * @errp: error object
-- */
--static VFIOINTp *vfio_init_intp(VFIODevice *vbasedev,
-- struct vfio_irq_info info, Error **errp)
--{
-- int ret;
-- VFIOPlatformDevice *vdev =
-- container_of(vbasedev, VFIOPlatformDevice, vbasedev);
-- SysBusDevice *sbdev = SYS_BUS_DEVICE(vdev);
-- VFIOINTp *intp;
--
-- intp = g_malloc0(sizeof(*intp));
-- intp->vdev = vdev;
-- intp->pin = info.index;
-- intp->flags = info.flags;
-- intp->state = VFIO_IRQ_INACTIVE;
-- intp->kvm_accel = false;
--
-- sysbus_init_irq(sbdev, &intp->qemuirq);
--
-- /* Get an eventfd for trigger */
-- intp->interrupt = g_new0(EventNotifier, 1);
-- ret = event_notifier_init(intp->interrupt, 0);
-- if (ret) {
-- g_free(intp->interrupt);
-- g_free(intp);
-- error_setg_errno(errp, -ret,
-- "failed to initialize trigger eventfd notifier");
-- return NULL;
-- }
-- if (vfio_irq_is_automasked(intp)) {
-- /* Get an eventfd for resample/unmask */
-- intp->unmask = g_new0(EventNotifier, 1);
-- ret = event_notifier_init(intp->unmask, 0);
-- if (ret) {
-- g_free(intp->interrupt);
-- g_free(intp->unmask);
-- g_free(intp);
-- error_setg_errno(errp, -ret,
-- "failed to initialize resample eventfd notifier");
-- return NULL;
-- }
-- }
--
-- QLIST_INSERT_HEAD(&vdev->intp_list, intp, next);
-- return intp;
--}
--
--/**
-- * vfio_set_trigger_eventfd - set VFIO eventfd handling
-- *
-- * @intp: IRQ struct handle
-- * @handler: handler to be called on eventfd signaling
-- *
-- * Setup VFIO signaling and attach an optional user-side handler
-- * to the eventfd
-- */
--static int vfio_set_trigger_eventfd(VFIOINTp *intp,
-- eventfd_user_side_handler_t handler)
--{
-- VFIODevice *vbasedev = &intp->vdev->vbasedev;
-- int32_t fd = event_notifier_get_fd(intp->interrupt);
-- Error *err = NULL;
--
-- qemu_set_fd_handler(fd, (IOHandler *)handler, NULL, intp);
--
-- if (!vfio_device_irq_set_signaling(vbasedev, intp->pin, 0,
-- VFIO_IRQ_SET_ACTION_TRIGGER, fd, &err)) {
-- error_reportf_err(err, VFIO_MSG_PREFIX, vbasedev->name);
-- qemu_set_fd_handler(fd, NULL, NULL, NULL);
-- return -EINVAL;
-- }
--
-- return 0;
--}
--
--/*
-- * Functions only used when eventfds are handled on user-side
-- * ie. without irqfd
-- */
--
--/**
-- * vfio_mmap_set_enabled - enable/disable the fast path mode
-- * @vdev: the VFIO platform device
-- * @enabled: the target mmap state
-- *
-- * enabled = true ~ fast path = MMIO region is mmaped (no KVM TRAP);
-- * enabled = false ~ slow path = MMIO region is trapped and region callbacks
-- * are called; slow path enables to trap the device IRQ status register reset
--*/
--
--static void vfio_mmap_set_enabled(VFIOPlatformDevice *vdev, bool enabled)
--{
-- int i;
--
-- for (i = 0; i < vdev->vbasedev.num_initial_regions; i++) {
-- vfio_region_mmaps_set_enabled(vdev->regions[i], enabled);
-- }
--}
--
--/**
-- * vfio_intp_mmap_enable - timer function, restores the fast path
-- * if there is no more active IRQ
-- * @opaque: actually points to the VFIO platform device
-- *
-- * Called on mmap timer timeout, this function checks whether the
-- * IRQ is still active and if not, restores the fast path.
-- * by construction a single eventfd is handled at a time.
-- * if the IRQ is still active, the timer is re-programmed.
-- */
--static void vfio_intp_mmap_enable(void *opaque)
--{
-- VFIOINTp *tmp;
-- VFIOPlatformDevice *vdev = (VFIOPlatformDevice *)opaque;
--
-- QEMU_LOCK_GUARD(&vdev->intp_mutex);
-- QLIST_FOREACH(tmp, &vdev->intp_list, next) {
-- if (tmp->state == VFIO_IRQ_ACTIVE) {
-- trace_vfio_platform_intp_mmap_enable(tmp->pin);
-- /* re-program the timer to check active status later */
-- timer_mod(vdev->mmap_timer,
-- qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
-- vdev->mmap_timeout);
-- return;
-- }
-- }
-- vfio_mmap_set_enabled(vdev, true);
--}
--
--/**
-- * vfio_intp_inject_pending_lockheld - Injects a pending IRQ
-- * @opaque: opaque pointer, in practice the VFIOINTp handle
-- *
-- * The function is called on a previous IRQ completion, from
-- * vfio_platform_eoi, while the intp_mutex is locked.
-- * Also in such situation, the slow path already is set and
-- * the mmap timer was already programmed.
-- */
--static void vfio_intp_inject_pending_lockheld(VFIOINTp *intp)
--{
-- trace_vfio_platform_intp_inject_pending_lockheld(intp->pin,
-- event_notifier_get_fd(intp->interrupt));
--
-- intp->state = VFIO_IRQ_ACTIVE;
--
-- /* trigger the virtual IRQ */
-- qemu_set_irq(intp->qemuirq, 1);
--}
--
--/**
-- * vfio_intp_interrupt - The user-side eventfd handler
-- * @opaque: opaque pointer which in practice is the VFIOINTp handle
-- *
-- * the function is entered in event handler context:
-- * the vIRQ is injected into the guest if there is no other active
-- * or pending IRQ.
-- */
--static void vfio_intp_interrupt(VFIOINTp *intp)
--{
-- int ret;
-- VFIOINTp *tmp;
-- VFIOPlatformDevice *vdev = intp->vdev;
-- bool delay_handling = false;
--
-- QEMU_LOCK_GUARD(&vdev->intp_mutex);
-- if (intp->state == VFIO_IRQ_INACTIVE) {
-- QLIST_FOREACH(tmp, &vdev->intp_list, next) {
-- if (tmp->state == VFIO_IRQ_ACTIVE ||
-- tmp->state == VFIO_IRQ_PENDING) {
-- delay_handling = true;
-- break;
-- }
-- }
-- }
-- if (delay_handling) {
-- /*
-- * the new IRQ gets a pending status and is pushed in
-- * the pending queue
-- */
-- intp->state = VFIO_IRQ_PENDING;
-- trace_vfio_intp_interrupt_set_pending(intp->pin);
-- QSIMPLEQ_INSERT_TAIL(&vdev->pending_intp_queue,
-- intp, pqnext);
-- event_notifier_test_and_clear(intp->interrupt);
-- return;
-- }
--
-- trace_vfio_platform_intp_interrupt(intp->pin,
-- event_notifier_get_fd(intp->interrupt));
--
-- ret = event_notifier_test_and_clear(intp->interrupt);
-- if (!ret) {
-- error_report("Error when clearing fd=%d (ret = %d)",
-- event_notifier_get_fd(intp->interrupt), ret);
-- }
--
-- intp->state = VFIO_IRQ_ACTIVE;
--
-- /* sets slow path */
-- vfio_mmap_set_enabled(vdev, false);
--
-- /* trigger the virtual IRQ */
-- qemu_set_irq(intp->qemuirq, 1);
--
-- /*
-- * Schedule the mmap timer which will restore fastpath when no IRQ
-- * is active anymore
-- */
-- if (vdev->mmap_timeout) {
-- timer_mod(vdev->mmap_timer,
-- qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
-- vdev->mmap_timeout);
-- }
--}
--
--/**
-- * vfio_platform_eoi - IRQ completion routine
-- * @vbasedev: the VFIO device handle
-- *
-- * De-asserts the active virtual IRQ and unmasks the physical IRQ
-- * (effective for level sensitive IRQ auto-masked by the VFIO driver).
-- * Then it handles next pending IRQ if any.
-- * eoi function is called on the first access to any MMIO region
-- * after an IRQ was triggered, trapped since slow path was set.
-- * It is assumed this access corresponds to the IRQ status
-- * register reset. With such a mechanism, a single IRQ can be
-- * handled at a time since there is no way to know which IRQ
-- * was completed by the guest (we would need additional details
-- * about the IRQ status register mask).
-- */
--static void vfio_platform_eoi(VFIODevice *vbasedev)
--{
-- VFIOINTp *intp;
-- VFIOPlatformDevice *vdev =
-- container_of(vbasedev, VFIOPlatformDevice, vbasedev);
--
-- QEMU_LOCK_GUARD(&vdev->intp_mutex);
-- QLIST_FOREACH(intp, &vdev->intp_list, next) {
-- if (intp->state == VFIO_IRQ_ACTIVE) {
-- trace_vfio_platform_eoi(intp->pin,
-- event_notifier_get_fd(intp->interrupt));
-- intp->state = VFIO_IRQ_INACTIVE;
--
-- /* deassert the virtual IRQ */
-- qemu_set_irq(intp->qemuirq, 0);
--
-- if (vfio_irq_is_automasked(intp)) {
-- /* unmasks the physical level-sensitive IRQ */
-- vfio_device_irq_unmask(vbasedev, intp->pin);
-- }
--
-- /* a single IRQ can be active at a time */
-- break;
-- }
-- }
-- /* in case there are pending IRQs, handle the first one */
-- if (!QSIMPLEQ_EMPTY(&vdev->pending_intp_queue)) {
-- intp = QSIMPLEQ_FIRST(&vdev->pending_intp_queue);
-- vfio_intp_inject_pending_lockheld(intp);
-- QSIMPLEQ_REMOVE_HEAD(&vdev->pending_intp_queue, pqnext);
-- }
--}
--
--/**
-- * vfio_start_eventfd_injection - starts the virtual IRQ injection using
-- * user-side handled eventfds
-- * @sbdev: the sysbus device handle
-- * @irq: the qemu irq handle
-- */
--
--static void vfio_start_eventfd_injection(SysBusDevice *sbdev, qemu_irq irq)
--{
-- VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(sbdev);
-- VFIOINTp *intp;
--
-- QLIST_FOREACH(intp, &vdev->intp_list, next) {
-- if (intp->qemuirq == irq) {
-- break;
-- }
-- }
-- assert(intp);
--
-- if (vfio_set_trigger_eventfd(intp, vfio_intp_interrupt)) {
-- abort();
-- }
--}
--
--/*
-- * Functions used for irqfd
-- */
--
--/**
-- * vfio_set_resample_eventfd - sets the resamplefd for an IRQ
-- * @intp: the IRQ struct handle
-- * programs the VFIO driver to unmask this IRQ when the
-- * intp->unmask eventfd is triggered
-- */
--static int vfio_set_resample_eventfd(VFIOINTp *intp)
--{
-- int32_t fd = event_notifier_get_fd(intp->unmask);
-- VFIODevice *vbasedev = &intp->vdev->vbasedev;
-- Error *err = NULL;
--
-- qemu_set_fd_handler(fd, NULL, NULL, NULL);
-- if (!vfio_device_irq_set_signaling(vbasedev, intp->pin, 0,
-- VFIO_IRQ_SET_ACTION_UNMASK, fd, &err)) {
-- error_reportf_err(err, VFIO_MSG_PREFIX, vbasedev->name);
-- return -EINVAL;
-- }
-- return 0;
--}
--
--/**
-- * vfio_start_irqfd_injection - starts the virtual IRQ injection using
-- * irqfd
-- *
-- * @sbdev: the sysbus device handle
-- * @irq: the qemu irq handle
-- *
-- * In case the irqfd setup fails, we fallback to userspace handled eventfd
-- */
--static void vfio_start_irqfd_injection(SysBusDevice *sbdev, qemu_irq irq)
--{
-- VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(sbdev);
-- VFIOINTp *intp;
--
-- if (!kvm_irqfds_enabled() || !kvm_resamplefds_enabled() ||
-- !vdev->irqfd_allowed) {
-- goto fail_irqfd;
-- }
--
-- QLIST_FOREACH(intp, &vdev->intp_list, next) {
-- if (intp->qemuirq == irq) {
-- break;
-- }
-- }
-- assert(intp);
--
-- if (kvm_irqchip_add_irqfd_notifier(kvm_state, intp->interrupt,
-- intp->unmask, irq) < 0) {
-- goto fail_irqfd;
-- }
--
-- if (vfio_set_trigger_eventfd(intp, NULL) < 0) {
-- goto fail_vfio;
-- }
-- if (vfio_irq_is_automasked(intp)) {
-- if (vfio_set_resample_eventfd(intp) < 0) {
-- goto fail_vfio;
-- }
-- trace_vfio_platform_start_level_irqfd_injection(intp->pin,
-- event_notifier_get_fd(intp->interrupt),
-- event_notifier_get_fd(intp->unmask));
-- } else {
-- trace_vfio_platform_start_edge_irqfd_injection(intp->pin,
-- event_notifier_get_fd(intp->interrupt));
-- }
--
-- intp->kvm_accel = true;
--
-- return;
--fail_vfio:
-- kvm_irqchip_remove_irqfd_notifier(kvm_state, intp->interrupt, irq);
-- abort();
--fail_irqfd:
-- vfio_start_eventfd_injection(sbdev, irq);
--}
--
--/* VFIO skeleton */
--
--static void vfio_platform_compute_needs_reset(VFIODevice *vbasedev)
--{
-- vbasedev->needs_reset = true;
--}
--
--/* not implemented yet */
--static int vfio_platform_hot_reset_multi(VFIODevice *vbasedev)
--{
-- return -1;
--}
--
--/**
-- * vfio_populate_device - Allocate and populate MMIO region
-- * and IRQ structs according to driver returned information
-- * @vbasedev: the VFIO device handle
-- * @errp: error object
-- *
-- */
--static bool vfio_populate_device(VFIODevice *vbasedev, Error **errp)
--{
-- VFIOINTp *intp, *tmp;
-- int i, ret = -1;
-- VFIOPlatformDevice *vdev =
-- container_of(vbasedev, VFIOPlatformDevice, vbasedev);
--
-- if (!(vbasedev->flags & VFIO_DEVICE_FLAGS_PLATFORM)) {
-- error_setg(errp, "this isn't a platform device");
-- return false;
-- }
--
-- vdev->regions = g_new0(VFIORegion *, vbasedev->num_initial_regions);
--
-- for (i = 0; i < vbasedev->num_initial_regions; i++) {
-- char *name = g_strdup_printf("VFIO %s region %d\n", vbasedev->name, i);
--
-- vdev->regions[i] = g_new0(VFIORegion, 1);
-- ret = vfio_region_setup(OBJECT(vdev), vbasedev,
-- vdev->regions[i], i, name);
-- g_free(name);
-- if (ret) {
-- error_setg_errno(errp, -ret, "failed to get region %d info", i);
-- goto reg_error;
-- }
-- }
--
-- vdev->mmap_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL,
-- vfio_intp_mmap_enable, vdev);
--
-- QSIMPLEQ_INIT(&vdev->pending_intp_queue);
--
-- for (i = 0; i < vbasedev->num_irqs; i++) {
-- struct vfio_irq_info irq;
--
-- ret = vfio_device_get_irq_info(vbasedev, i, &irq);
--
-- if (ret) {
-- error_setg_errno(errp, -ret, "failed to get device irq info");
-- goto irq_err;
-- } else {
-- trace_vfio_platform_populate_interrupts(irq.index,
-- irq.count,
-- irq.flags);
-- intp = vfio_init_intp(vbasedev, irq, errp);
-- if (!intp) {
-- goto irq_err;
-- }
-- }
-- }
-- return true;
--irq_err:
-- timer_del(vdev->mmap_timer);
-- QLIST_FOREACH_SAFE(intp, &vdev->intp_list, next, tmp) {
-- QLIST_REMOVE(intp, next);
-- g_free(intp);
-- }
--reg_error:
-- for (i = 0; i < vbasedev->num_initial_regions; i++) {
-- if (vdev->regions[i]) {
-- vfio_region_finalize(vdev->regions[i]);
-- }
-- g_free(vdev->regions[i]);
-- }
-- g_free(vdev->regions);
-- return false;
--}
--
--/* specialized functions for VFIO Platform devices */
--static VFIODeviceOps vfio_platform_ops = {
-- .vfio_compute_needs_reset = vfio_platform_compute_needs_reset,
-- .vfio_hot_reset_multi = vfio_platform_hot_reset_multi,
-- .vfio_eoi = vfio_platform_eoi,
--};
--
--/**
-- * vfio_base_device_init - perform preliminary VFIO setup
-- * @vbasedev: the VFIO device handle
-- * @errp: error object
-- *
-- * Implement the VFIO command sequence that allows to discover
-- * assigned device resources: group extraction, device
-- * fd retrieval, resource query.
-- * Precondition: the device name must be initialized
-- */
--static bool vfio_base_device_init(VFIODevice *vbasedev, Error **errp)
--{
-- /* @fd takes precedence over @sysfsdev which takes precedence over @host */
-- if (vbasedev->fd < 0 && vbasedev->sysfsdev) {
-- vfio_device_free_name(vbasedev);
-- vbasedev->name = g_path_get_basename(vbasedev->sysfsdev);
-- } else if (vbasedev->fd < 0) {
-- if (!vbasedev->name || strchr(vbasedev->name, '/')) {
-- error_setg(errp, "wrong host device name");
-- return false;
-- }
--
-- vbasedev->sysfsdev = g_strdup_printf("/sys/bus/platform/devices/%s",
-- vbasedev->name);
-- }
--
-- if (!vfio_device_get_name(vbasedev, errp)) {
-- return false;
-- }
--
-- if (!vfio_device_attach(vbasedev->name, vbasedev,
-- &address_space_memory, errp)) {
-- return false;
-- }
--
-- if (vfio_populate_device(vbasedev, errp)) {
-- return true;
-- }
--
-- vfio_device_detach(vbasedev);
-- return false;
--}
--
--/**
-- * vfio_platform_realize - the device realize function
-- * @dev: device state pointer
-- * @errp: error
-- *
-- * initialize the device, its memory regions and IRQ structures
-- * IRQ are started separately
-- */
--static void vfio_platform_realize(DeviceState *dev, Error **errp)
--{
-- ERRP_GUARD();
-- VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
-- SysBusDevice *sbdev = SYS_BUS_DEVICE(dev);
-- VFIODevice *vbasedev = &vdev->vbasedev;
-- int i;
--
-- warn_report("-device vfio-platform is deprecated");
-- qemu_mutex_init(&vdev->intp_mutex);
--
-- trace_vfio_platform_realize(vbasedev->sysfsdev ?
-- vbasedev->sysfsdev : vbasedev->name,
-- vdev->compat);
--
-- if (!vfio_base_device_init(vbasedev, errp)) {
-- goto init_err;
-- }
--
-- if (!vdev->compat) {
-- GError *gerr = NULL;
-- gchar *contents;
-- gsize length;
-- char *path;
--
-- path = g_strdup_printf("%s/of_node/compatible", vbasedev->sysfsdev);
-- if (!g_file_get_contents(path, &contents, &length, &gerr)) {
-- error_setg(errp, "%s", gerr->message);
-- g_error_free(gerr);
-- g_free(path);
-- return;
-- }
-- g_free(path);
-- vdev->compat = contents;
-- for (vdev->num_compat = 0; length; vdev->num_compat++) {
-- size_t skip = strlen(contents) + 1;
-- contents += skip;
-- length -= skip;
-- }
-- }
--
-- for (i = 0; i < vbasedev->num_initial_regions; i++) {
-- if (vfio_region_mmap(vdev->regions[i])) {
-- warn_report("%s mmap unsupported, performance may be slow",
-- memory_region_name(vdev->regions[i]->mem));
-- }
-- sysbus_init_mmio(sbdev, vdev->regions[i]->mem);
-- }
-- return;
--
--init_err:
-- if (vdev->vbasedev.name) {
-- error_prepend(errp, VFIO_MSG_PREFIX, vdev->vbasedev.name);
-- } else {
-- error_prepend(errp, "vfio error: ");
-- }
--}
--
--static const VMStateDescription vfio_platform_vmstate = {
-- .name = "vfio-platform",
-- .unmigratable = 1,
--};
--
--static const Property vfio_platform_dev_properties[] = {
-- DEFINE_PROP_STRING("host", VFIOPlatformDevice, vbasedev.name),
-- DEFINE_PROP_STRING("sysfsdev", VFIOPlatformDevice, vbasedev.sysfsdev),
-- DEFINE_PROP_BOOL("x-no-mmap", VFIOPlatformDevice, vbasedev.no_mmap, false),
-- DEFINE_PROP_UINT32("mmap-timeout-ms", VFIOPlatformDevice,
-- mmap_timeout, 1100),
-- DEFINE_PROP_BOOL("x-irqfd", VFIOPlatformDevice, irqfd_allowed, true),
--#ifdef CONFIG_IOMMUFD
-- DEFINE_PROP_LINK("iommufd", VFIOPlatformDevice, vbasedev.iommufd,
-- TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
--#endif
--};
--
--static void vfio_platform_instance_init(Object *obj)
--{
-- VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(obj);
-- VFIODevice *vbasedev = &vdev->vbasedev;
--
-- vfio_device_init(vbasedev, VFIO_DEVICE_TYPE_PLATFORM, &vfio_platform_ops,
-- DEVICE(vdev), false);
--}
--
--#ifdef CONFIG_IOMMUFD
--static void vfio_platform_set_fd(Object *obj, const char *str, Error **errp)
--{
-- vfio_device_set_fd(&VFIO_PLATFORM_DEVICE(obj)->vbasedev, str, errp);
--}
--#endif
--
--static void vfio_platform_class_init(ObjectClass *klass, const void *data)
--{
-- DeviceClass *dc = DEVICE_CLASS(klass);
-- SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
--
-- dc->realize = vfio_platform_realize;
-- device_class_set_props(dc, vfio_platform_dev_properties);
--#ifdef CONFIG_IOMMUFD
-- object_class_property_add_str(klass, "fd", NULL, vfio_platform_set_fd);
--#endif
-- dc->vmsd = &vfio_platform_vmstate;
-- dc->desc = "VFIO-based platform device assignment";
-- sbc->connect_irq_notifier = vfio_start_irqfd_injection;
-- set_bit(DEVICE_CATEGORY_MISC, dc->categories);
--
-- object_class_property_set_description(klass, /* 2.4 */
-- "host",
-- "Host device name of assigned device");
-- object_class_property_set_description(klass, /* 2.4 and 2.5 */
-- "x-no-mmap",
-- "Disable MMAP for device. Allows to trace MMIO "
-- "accesses (DEBUG)");
-- object_class_property_set_description(klass, /* 2.4 */
-- "mmap-timeout-ms",
-- "When EOI is not provided by KVM/QEMU, wait time "
-- "(milliseconds) to re-enable device direct access "
-- "after level interrupt (DEBUG)");
-- object_class_property_set_description(klass, /* 2.4 */
-- "x-irqfd",
-- "Allow disabling irqfd support (DEBUG)");
-- object_class_property_set_description(klass, /* 2.6 */
-- "sysfsdev",
-- "Host sysfs path of assigned device");
--#ifdef CONFIG_IOMMUFD
-- object_class_property_set_description(klass, /* 9.0 */
-- "iommufd",
-- "Set host IOMMUFD backend device");
--#endif
--}
--
--static const TypeInfo vfio_platform_dev_info = {
-- .name = TYPE_VFIO_PLATFORM,
-- .parent = TYPE_DYNAMIC_SYS_BUS_DEVICE,
-- .instance_size = sizeof(VFIOPlatformDevice),
-- .instance_init = vfio_platform_instance_init,
-- .class_init = vfio_platform_class_init,
-- .class_size = sizeof(VFIOPlatformDeviceClass),
--};
--
--static void register_vfio_platform_dev_type(void)
--{
-- type_register_static(&vfio_platform_dev_info);
--}
--
--type_init(register_vfio_platform_dev_type)
-diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
-index fc6ed230d0..e3d571f8c8 100644
---- a/hw/vfio/trace-events
-+++ b/hw/vfio/trace-events
-@@ -127,17 +127,6 @@ vfio_region_unmap(const char *name, unsigned long offset, unsigned long end) "Re
- vfio_region_sparse_mmap_header(const char *name, int index, int nr_areas) "Device %s region %d: %d sparse mmap entries"
- vfio_region_sparse_mmap_entry(int i, unsigned long start, unsigned long end) "sparse entry %d [0x%lx - 0x%lx]"
-
--# platform.c
--vfio_platform_realize(char *name, char *compat) "vfio device %s, compat = %s"
--vfio_platform_eoi(int pin, int fd) "EOI IRQ pin %d (fd=%d)"
--vfio_platform_intp_mmap_enable(int pin) "IRQ #%d still active, stay in slow path"
--vfio_platform_intp_interrupt(int pin, int fd) "Inject IRQ #%d (fd = %d)"
--vfio_platform_intp_inject_pending_lockheld(int pin, int fd) "Inject pending IRQ #%d (fd = %d)"
--vfio_platform_populate_interrupts(int pin, int count, int flags) "- IRQ index %d: count %d, flags=0x%x"
--vfio_intp_interrupt_set_pending(int index) "irq %d is set PENDING"
--vfio_platform_start_level_irqfd_injection(int index, int fd, int resamplefd) "IRQ index=%d, fd = %d, resamplefd = %d"
--vfio_platform_start_edge_irqfd_injection(int index, int fd) "IRQ index=%d, fd = %d"
--
- # spapr.c
- vfio_prereg_listener_region_add_skip(uint64_t start, uint64_t end) "0x%"PRIx64" - 0x%"PRIx64
- vfio_prereg_listener_region_del_skip(uint64_t start, uint64_t end) "0x%"PRIx64" - 0x%"PRIx64
-diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h
-index df81d319b2..2bc16a1a2e 100644
---- a/include/hw/vfio/vfio-device.h
-+++ b/include/hw/vfio/vfio-device.h
-@@ -36,7 +36,7 @@
-
- enum {
- VFIO_DEVICE_TYPE_PCI = 0,
-- VFIO_DEVICE_TYPE_PLATFORM = 1,
-+ VFIO_DEVICE_TYPE_UNUSED = 1,
- VFIO_DEVICE_TYPE_CCW = 2,
- VFIO_DEVICE_TYPE_AP = 3,
- };
-diff --git a/include/hw/vfio/vfio-platform.h b/include/hw/vfio/vfio-platform.h
-deleted file mode 100644
-index 256d8500b7..0000000000
---- a/include/hw/vfio/vfio-platform.h
-+++ /dev/null
-@@ -1,78 +0,0 @@
--/*
-- * vfio based device assignment support - platform devices
-- *
-- * Copyright Linaro Limited, 2014
-- *
-- * Authors:
-- * Kim Phillips <kim.phillips@linaro.org>
-- *
-- * This work is licensed under the terms of the GNU GPL, version 2. See
-- * the COPYING file in the top-level directory.
-- *
-- * Based on vfio based PCI device assignment support:
-- * Copyright Red Hat, Inc. 2012
-- */
--
--#ifndef HW_VFIO_VFIO_PLATFORM_H
--#define HW_VFIO_VFIO_PLATFORM_H
--
--#include "hw/sysbus.h"
--#include "hw/vfio/vfio-device.h"
--#include "qemu/event_notifier.h"
--#include "qemu/queue.h"
--#include "qom/object.h"
--
--#define TYPE_VFIO_PLATFORM "vfio-platform"
--
--enum {
-- VFIO_IRQ_INACTIVE = 0,
-- VFIO_IRQ_PENDING = 1,
-- VFIO_IRQ_ACTIVE = 2,
-- /* VFIO_IRQ_ACTIVE_AND_PENDING cannot happen with VFIO */
--};
--
--typedef struct VFIOINTp {
-- QLIST_ENTRY(VFIOINTp) next; /* entry for IRQ list */
-- QSIMPLEQ_ENTRY(VFIOINTp) pqnext; /* entry for pending IRQ queue */
-- EventNotifier *interrupt; /* eventfd triggered on interrupt */
-- EventNotifier *unmask; /* eventfd for unmask on QEMU bypass */
-- qemu_irq qemuirq;
-- struct VFIOPlatformDevice *vdev; /* back pointer to device */
-- int state; /* inactive, pending, active */
-- uint8_t pin; /* index */
-- uint32_t flags; /* IRQ info flags */
-- bool kvm_accel; /* set when QEMU bypass through KVM enabled */
--} VFIOINTp;
--
--/* function type for user side eventfd handler */
--typedef void (*eventfd_user_side_handler_t)(VFIOINTp *intp);
--
--typedef struct VFIORegion VFIORegion;
--
--struct VFIOPlatformDevice {
-- SysBusDevice sbdev;
-- VFIODevice vbasedev; /* not a QOM object */
-- VFIORegion **regions;
-- QLIST_HEAD(, VFIOINTp) intp_list; /* list of IRQs */
-- /* queue of pending IRQs */
-- QSIMPLEQ_HEAD(, VFIOINTp) pending_intp_queue;
-- char *compat; /* DT compatible values, separated by NUL */
-- unsigned int num_compat; /* number of compatible values */
-- uint32_t mmap_timeout; /* delay to re-enable mmaps after interrupt */
-- QEMUTimer *mmap_timer; /* allows fast-path resume after IRQ hit */
-- QemuMutex intp_mutex; /* protect the intp_list IRQ state */
-- bool irqfd_allowed; /* debug option to force irqfd on/off */
--};
--typedef struct VFIOPlatformDevice VFIOPlatformDevice;
--
--struct VFIOPlatformDeviceClass {
-- /*< private >*/
-- SysBusDeviceClass parent_class;
-- /*< public >*/
--};
--typedef struct VFIOPlatformDeviceClass VFIOPlatformDeviceClass;
--
--DECLARE_OBJ_CHECKERS(VFIOPlatformDevice, VFIOPlatformDeviceClass,
-- VFIO_PLATFORM_DEVICE, TYPE_VFIO_PLATFORM)
--
--#endif /* HW_VFIO_VFIO_PLATFORM_H */
---
-2.52.0
-
diff --git a/kvm-vfio-Remove-workaround-for-kernel-DMA-unmap-overflow.patch b/kvm-vfio-Remove-workaround-for-kernel-DMA-unmap-overflow.patch
deleted file mode 100644
index 282cf13..0000000
--- a/kvm-vfio-Remove-workaround-for-kernel-DMA-unmap-overflow.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From bf050d499dff24314563fb35faaa4f445a923fb8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
-Date: Fri, 26 Sep 2025 10:54:23 +0200
-Subject: [PATCH 080/116] vfio: Remove workaround for kernel DMA unmap overflow
- bug
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [64/100] c9310e612ea2b3e10620f507e64649fb1f46cdaf (rovick1/qemu-kvm)
-
-A kernel bug was introduced in Linux v4.15 via commit 71a7d3d78e3c
-("vfio/type1: Check for address space wrap-around on unmap"), which
-added a test for address space wrap-around in the vfio DMA unmap path.
-Unfortunately, due to an integer overflow, the kernel would
-incorrectly detect an unmap of the last page in the 64-bit address
-space as a wrap-around, causing the unmap to fail with -EINVAL.
-
-A QEMU workaround was introduced in commit 567d7d3e6be5 ("vfio/common:
-Work around kernel overflow bug in DMA unmap") to retry the unmap,
-excluding the final page of the range.
-
-The kernel bug was then fixed in Linux v5.0 via commit 58fec830fc19
-("vfio/type1: Fix dma_unmap wrap-around check"). Since the oldest
-supported LTS kernel is now v5.4, kernels affected by this bug are
-considered deprecated, and the workaround is no longer necessary.
-
-This change reverts 567d7d3e6be5, removing the workaround.
-
-Link: https://bugzilla.redhat.com/show_bug.cgi?id=1662291
-Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
-Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Link: https://lore.kernel.org/qemu-devel/20250926085423.375547-1-clg@redhat.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 1d9a832b58be63e53ef0d2342c271a34ecb349db)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/container-legacy.c | 20 +-------------------
- hw/vfio/trace-events | 1 -
- 2 files changed, 1 insertion(+), 20 deletions(-)
-
-diff --git a/hw/vfio/container-legacy.c b/hw/vfio/container-legacy.c
-index 0101a72f53..2d19d97e2d 100644
---- a/hw/vfio/container-legacy.c
-+++ b/hw/vfio/container-legacy.c
-@@ -161,25 +161,7 @@ static int vfio_legacy_dma_unmap_one(const VFIOContainer *bcontainer,
- need_dirty_sync = true;
- }
-
-- while (ioctl(container->fd, VFIO_IOMMU_UNMAP_DMA, &unmap)) {
-- /*
-- * The type1 backend has an off-by-one bug in the kernel (71a7d3d78e3c
-- * v4.15) where an overflow in its wrap-around check prevents us from
-- * unmapping the last page of the address space. Test for the error
-- * condition and re-try the unmap excluding the last page. The
-- * expectation is that we've never mapped the last page anyway and this
-- * unmap request comes via vIOMMU support which also makes it unlikely
-- * that this page is used. This bug was introduced well after type1 v2
-- * support was introduced, so we shouldn't need to test for v1. A fix
-- * is queued for kernel v5.0 so this workaround can be removed once
-- * affected kernels are sufficiently deprecated.
-- */
-- if (errno == EINVAL && unmap.size && !(unmap.iova + unmap.size) &&
-- container->iommu_type == VFIO_TYPE1v2_IOMMU) {
-- trace_vfio_legacy_dma_unmap_overflow_workaround();
-- unmap.size -= 1ULL << ctz64(bcontainer->pgsizes);
-- continue;
-- }
-+ if (ioctl(container->fd, VFIO_IOMMU_UNMAP_DMA, &unmap)) {
- return -errno;
- }
-
-diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
-index e3d571f8c8..7496e1b64b 100644
---- a/hw/vfio/trace-events
-+++ b/hw/vfio/trace-events
-@@ -112,7 +112,6 @@ vfio_container_disconnect(int fd) "close container->fd=%d"
- vfio_group_put(int fd) "close group->fd=%d"
- vfio_device_get(const char * name, unsigned int flags, unsigned int num_regions, unsigned int num_irqs) "Device %s flags: %u, regions: %u, irqs: %u"
- vfio_device_put(int fd) "close vdev->fd=%d"
--vfio_legacy_dma_unmap_overflow_workaround(void) ""
-
- # region.c
- vfio_region_write(const char *name, int index, uint64_t addr, uint64_t data, unsigned size) " (%s:region%d+0x%"PRIx64", 0x%"PRIx64 ", %d)"
---
-2.52.0
-
diff --git a/kvm-vfio-Report-an-error-when-the-dma_max_mappings-limit.patch b/kvm-vfio-Report-an-error-when-the-dma_max_mappings-limit.patch
deleted file mode 100644
index 737830d..0000000
--- a/kvm-vfio-Report-an-error-when-the-dma_max_mappings-limit.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From 5aa93e83bde673ad1140870300a365a9f23a2006 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
-Date: Thu, 14 Aug 2025 17:34:19 +0200
-Subject: [PATCH 026/116] vfio: Report an error when the 'dma_max_mappings'
- limit is reached
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [10/100] 980ecbe9d119e3de2914fb7c19274bc527fa11d5 (rovick1/qemu-kvm)
-
-The VFIO IOMMU Type1 kernel driver enforces a default IOMMU mapping
-limit of 65535, which is configurable via the 'dma_max_mappings'
-module parameter. When this limit is reached, QEMU issues a warning
-and fails the mapping operation, but allows the VM to continue
-running, potentially causing issues later. This scenario occurs with
-SEV-SNP guests, which must update all IOMMU mappings during
-initialization.
-
-To address this, update vfio_ram_discard_register_listener() to accept
-an 'Error **' parameter and propagate the error to the caller. This
-change will halt the VM immediately, at init time, with the same error
-message.
-
-Additionally, the same behavior will be enforced at runtime. While
-this might be considered too brutal, the rarity of this case and the
-planned removal of the dma_max_mappings module parameter make it a
-reasonable approach.
-
-Cc: Alex Williamson <alex.williamson@redhat.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250814153419.1643897-1-clg@redhat.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit ceb59c1cc61dee57c8806571e7c723e555914547)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/listener.c | 13 +++++++++----
- 1 file changed, 9 insertions(+), 4 deletions(-)
-
-diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
-index 5ebafaa07e..c244be5e21 100644
---- a/hw/vfio/listener.c
-+++ b/hw/vfio/listener.c
-@@ -250,8 +250,9 @@ static int vfio_ram_discard_notify_populate(RamDiscardListener *rdl,
- return 0;
- }
-
--static void vfio_ram_discard_register_listener(VFIOContainerBase *bcontainer,
-- MemoryRegionSection *section)
-+static bool vfio_ram_discard_register_listener(VFIOContainerBase *bcontainer,
-+ MemoryRegionSection *section,
-+ Error **errp)
- {
- RamDiscardManager *rdm = memory_region_get_ram_discard_manager(section->mr);
- int target_page_size = qemu_target_page_size();
-@@ -316,13 +317,15 @@ static void vfio_ram_discard_register_listener(VFIOContainerBase *bcontainer,
-
- if (vrdl_mappings + max_memslots - vrdl_count >
- bcontainer->dma_max_mappings) {
-- warn_report("%s: possibly running out of DMA mappings. E.g., try"
-+ error_setg(errp, "%s: possibly running out of DMA mappings. E.g., try"
- " increasing the 'block-size' of virtio-mem devies."
- " Maximum possible DMA mappings: %d, Maximum possible"
- " memslots: %d", __func__, bcontainer->dma_max_mappings,
- max_memslots);
-+ return false;
- }
- }
-+ return true;
- }
-
- static void vfio_ram_discard_unregister_listener(VFIOContainerBase *bcontainer,
-@@ -571,7 +574,9 @@ void vfio_container_region_add(VFIOContainerBase *bcontainer,
- */
- if (memory_region_has_ram_discard_manager(section->mr)) {
- if (!cpr_remap) {
-- vfio_ram_discard_register_listener(bcontainer, section);
-+ if (!vfio_ram_discard_register_listener(bcontainer, section, &err)) {
-+ goto fail;
-+ }
- } else if (!vfio_cpr_ram_discard_register_listener(bcontainer,
- section)) {
- error_setg(&err,
---
-2.52.0
-
diff --git a/kvm-vfio-container-Remap-only-populated-parts-in-a-secti.patch b/kvm-vfio-container-Remap-only-populated-parts-in-a-secti.patch
deleted file mode 100644
index 1a3f66b..0000000
--- a/kvm-vfio-container-Remap-only-populated-parts-in-a-secti.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From 71afe9279971bf2738ca60316d66a6eac271b190 Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Sun, 28 Sep 2025 04:54:27 -0400
-Subject: [PATCH 098/116] vfio/container: Remap only populated parts in a
- section
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [82/100] a6a483d335d66c5d550a5e4eb12569915def6a11 (rovick1/qemu-kvm)
-
-If there are multiple containers and unmap-all fails for some of them, we
-need to remap vaddr for the other containers for which unmap-all succeeded.
-When ram discard is enabled, we should only remap populated parts in a
-section instead of the whole section.
-
-Fixes: eba1f657cbb1 ("vfio/container: recover from unmap-all-vaddr failure")
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
-Reviewed-by: David Hildenbrand <david@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250928085432.40107-2-zhenzhong.duan@intel.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 5a78db7f8099274550bdacdc1fc24943567ac615)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/cpr-legacy.c | 20 +++++++++++++++-----
- hw/vfio/listener.c | 4 ++--
- include/hw/vfio/vfio-cpr.h | 2 +-
- 3 files changed, 18 insertions(+), 8 deletions(-)
-
-diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
-index 80af7469d0..b4581e8f85 100644
---- a/hw/vfio/cpr-legacy.c
-+++ b/hw/vfio/cpr-legacy.c
-@@ -228,22 +228,32 @@ void vfio_cpr_giommu_remap(VFIOContainer *bcontainer,
- memory_region_iommu_replay(giommu->iommu_mr, &giommu->n);
- }
-
-+static int vfio_cpr_rdm_remap(MemoryRegionSection *section, void *opaque)
-+{
-+ RamDiscardListener *rdl = opaque;
-+
-+ return rdl->notify_populate(rdl, section);
-+}
-+
- /*
- * In old QEMU, VFIO_DMA_UNMAP_FLAG_VADDR may fail on some mapping after
- * succeeding for others, so the latter have lost their vaddr. Call this
-- * to restore vaddr for a section with a RamDiscardManager.
-+ * to restore vaddr for populated parts in a section with a RamDiscardManager.
- *
-- * The ram discard listener already exists. Call its populate function
-+ * The ram discard listener already exists. Call its replay_populated function
- * directly, which calls vfio_legacy_cpr_dma_map.
- */
--bool vfio_cpr_ram_discard_register_listener(VFIOContainer *bcontainer,
-- MemoryRegionSection *section)
-+bool vfio_cpr_ram_discard_replay_populated(VFIOContainer *bcontainer,
-+ MemoryRegionSection *section)
- {
-+ RamDiscardManager *rdm = memory_region_get_ram_discard_manager(section->mr);
- VFIORamDiscardListener *vrdl =
- vfio_find_ram_discard_listener(bcontainer, section);
-
- g_assert(vrdl);
-- return vrdl->listener.notify_populate(&vrdl->listener, section) == 0;
-+ return ram_discard_manager_replay_populated(rdm, section,
-+ vfio_cpr_rdm_remap,
-+ &vrdl->listener) == 0;
- }
-
- int vfio_cpr_group_get_device_fd(int d, const char *name)
-diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
-index b5cefc9395..df42bc58e7 100644
---- a/hw/vfio/listener.c
-+++ b/hw/vfio/listener.c
-@@ -578,8 +578,8 @@ void vfio_container_region_add(VFIOContainer *bcontainer,
- if (!vfio_ram_discard_register_listener(bcontainer, section, &err)) {
- goto fail;
- }
-- } else if (!vfio_cpr_ram_discard_register_listener(bcontainer,
-- section)) {
-+ } else if (!vfio_cpr_ram_discard_replay_populated(bcontainer,
-+ section)) {
- error_setg(&err,
- "vfio_cpr_ram_discard_register_listener for %s failed",
- memory_region_name(section->mr));
-diff --git a/include/hw/vfio/vfio-cpr.h b/include/hw/vfio/vfio-cpr.h
-index 81f4e24e22..4606da500a 100644
---- a/include/hw/vfio/vfio-cpr.h
-+++ b/include/hw/vfio/vfio-cpr.h
-@@ -68,7 +68,7 @@ bool vfio_cpr_container_match(struct VFIOLegacyContainer *container,
- void vfio_cpr_giommu_remap(struct VFIOContainer *bcontainer,
- MemoryRegionSection *section);
-
--bool vfio_cpr_ram_discard_register_listener(
-+bool vfio_cpr_ram_discard_replay_populated(
- struct VFIOContainer *bcontainer, MemoryRegionSection *section);
-
- void vfio_cpr_save_vector_fd(struct VFIOPCIDevice *vdev, const char *name,
---
-2.52.0
-
diff --git a/kvm-vfio-container-Restrict-dma_map_file-to-shared-RAM-o.patch b/kvm-vfio-container-Restrict-dma_map_file-to-shared-RAM-o.patch
deleted file mode 100644
index e4426e5..0000000
--- a/kvm-vfio-container-Restrict-dma_map_file-to-shared-RAM-o.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-From 773e27e2cfefb0958df726b726a6de91bda8771d Mon Sep 17 00:00:00 2001
-From: Chenyi Qiang <chenyi.qiang@intel.com>
-Date: Wed, 27 May 2026 18:11:08 +0800
-Subject: [PATCH 7/9] vfio/container: Restrict dma_map_file() to shared RAM or
- RAM devices
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 497: vfio/container: Restrict dma_map_file() to shared RAM or RAM devices
-RH-Jira: RHEL-180750
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Commit: [1/1] 423a647a11151907ab26eb341e73298a2880908e (rovick1/qemu-kvm)
-
-vfio_container_dma_map() uses dma_map_file() whenever a RAMBlock has an
-fd and the VFIO IOMMU backend supports file-based DMA mapping. That is
-not correct for private file-backed guest RAM.
-
-dma_map_file() resolves PFNs from the backing file, but private guest
-RAM mappings (MAP_PRIVATE) can run on different PFNs than the file
-because they are subject to copy-on-write (COW) anomalies. As a result,
-using dma_map_file() on a privately mapped RAMBlock can program DMA
-against pages that do not back QEMU's actual guest memory.
-
-Fix this by using dma_map_file() only for shared mapped RAMBlocks
-MAP_SHARED) or RAM device regions.
-
-Fixes: fb32965b6dd8 ("vfio/iommufd: use IOMMU_IOAS_MAP_FILE")
-Reported-by: Farrah Chen <farrah.chen@intel.com>
-Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220776
-Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Suggested-by: Cédric Le Goater <clg@redhat.com>
-Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
-Link: https://lore.kernel.org/qemu-devel/20260527101109.71781-1-chenyi.qiang@intel.com
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
----
- hw/vfio/container.c | 34 +++++++++++++++++++++++++++++++---
- 1 file changed, 31 insertions(+), 3 deletions(-)
-
-diff --git a/hw/vfio/container.c b/hw/vfio/container.c
-index 1b8569d36a..f534797a98 100644
---- a/hw/vfio/container.c
-+++ b/hw/vfio/container.c
-@@ -73,15 +73,43 @@ void vfio_address_space_insert(VFIOAddressSpace *space,
- bcontainer->space = space;
- }
-
-+static bool vfio_container_can_dma_map_file(VFIOContainer *bcontainer,
-+ MemoryRegion *mr, int *fd)
-+{
-+ VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
-+ RAMBlock *rb = mr->ram_block;
-+
-+ if (!vioc->dma_map_file || !rb) {
-+ return false;
-+ }
-+
-+ *fd = qemu_ram_get_fd(rb);
-+ if (*fd < 0) {
-+ return false;
-+ }
-+
-+ /*
-+ * We can use IOMMU DMA mapping (IOMMU_IOAS_MAP_FILE) for :
-+ *
-+ * 1) Guest RAM blocks explicitly configured as shared (MAP_SHARED)
-+ * 2) RAM device sub-regions (MMIO BARs)
-+ *
-+ * Private RAM mappings (MAP_PRIVATE) are strictly excluded. Because
-+ * they are subject to copy-on-write (COW) anomalies, their underlying
-+ * PFNs can permanently diverge from the backing file
-+ */
-+ return qemu_ram_is_shared(rb) || memory_region_is_ram_device(mr);
-+}
-+
- int vfio_container_dma_map(VFIOContainer *bcontainer,
- hwaddr iova, uint64_t size,
- void *vaddr, bool readonly, MemoryRegion *mr)
- {
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
-- RAMBlock *rb = mr->ram_block;
-- int mfd = rb ? qemu_ram_get_fd(rb) : -1;
-+ int mfd;
-
-- if (mfd >= 0 && vioc->dma_map_file) {
-+ if (vfio_container_can_dma_map_file(bcontainer, mr, &mfd)) {
-+ RAMBlock *rb = mr->ram_block;
- unsigned long start = vaddr - qemu_ram_get_host_addr(rb);
- unsigned long offset = qemu_ram_get_fd_offset(rb);
-
---
-2.52.0
-
diff --git a/kvm-vfio-container-Support-unmap-all-in-one-ioctl.patch b/kvm-vfio-container-Support-unmap-all-in-one-ioctl.patch
deleted file mode 100644
index f37dc07..0000000
--- a/kvm-vfio-container-Support-unmap-all-in-one-ioctl.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-From 8099d6501f399b1c55f23dd482389304349c9664 Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Thu, 9 Oct 2025 00:01:32 -0400
-Subject: [PATCH 102/116] vfio/container: Support unmap all in one ioctl()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [86/100] 0c5f202cb07001ea023816c1c4bbf09e460b83b0 (rovick1/qemu-kvm)
-
-VFIO type1 kernel uAPI supports unmapping whole address space in one call
-since commit c19650995374 ("vfio/type1: implement unmap all"). Use the
-unmap_all variant whenever it's supported in kernel.
-
-Opportunistically pass VFIOLegacyContainer pointer in low level function
-vfio_legacy_dma_unmap_one().
-
-Co-developed-by: John Levon <levon@movementarian.org>
-Signed-off-by: John Levon <levon@movementarian.org>
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20251009040134.334251-2-zhenzhong.duan@intel.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 962bcf0911e7f3601da0f07ba7da9824cb6a5ba5)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/container-legacy.c | 38 ++++++++++++++-----------
- include/hw/vfio/vfio-container-legacy.h | 1 +
- 2 files changed, 23 insertions(+), 16 deletions(-)
-
-diff --git a/hw/vfio/container-legacy.c b/hw/vfio/container-legacy.c
-index fad0226f7d..e639760381 100644
---- a/hw/vfio/container-legacy.c
-+++ b/hw/vfio/container-legacy.c
-@@ -135,14 +135,14 @@ unmap_exit:
- return ret;
- }
-
--static int vfio_legacy_dma_unmap_one(const VFIOContainer *bcontainer,
-+static int vfio_legacy_dma_unmap_one(const VFIOLegacyContainer *container,
- hwaddr iova, uint64_t size,
-- IOMMUTLBEntry *iotlb)
-+ uint32_t flags, IOMMUTLBEntry *iotlb)
- {
-- const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+ const VFIOContainer *bcontainer = VFIO_IOMMU(container);
- struct vfio_iommu_type1_dma_unmap unmap = {
- .argsz = sizeof(unmap),
-- .flags = 0,
-+ .flags = flags,
- .iova = iova,
- .size = size,
- };
-@@ -184,25 +184,28 @@ static int vfio_legacy_dma_unmap(const VFIOContainer *bcontainer,
- hwaddr iova, uint64_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all)
- {
-+ const VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-+ uint32_t flags = 0;
- int ret;
-
- if (unmap_all) {
-- /* The unmap ioctl doesn't accept a full 64-bit span. */
-- Int128 llsize = int128_rshift(int128_2_64(), 1);
--
-- ret = vfio_legacy_dma_unmap_one(bcontainer, 0, int128_get64(llsize),
-- iotlb);
-+ if (container->unmap_all_supported) {
-+ flags = VFIO_DMA_UNMAP_FLAG_ALL;
-+ } else {
-+ /* The unmap ioctl doesn't accept a full 64-bit span. */
-+ Int128 llsize = int128_rshift(int128_2_64(), 1);
-+ size = int128_get64(llsize);
-+
-+ ret = vfio_legacy_dma_unmap_one(container, 0, size, flags, iotlb);
-+ if (ret) {
-+ return ret;
-+ }
-
-- if (ret == 0) {
-- ret = vfio_legacy_dma_unmap_one(bcontainer, int128_get64(llsize),
-- int128_get64(llsize), iotlb);
-+ iova = size;
- }
--
-- } else {
-- ret = vfio_legacy_dma_unmap_one(bcontainer, iova, size, iotlb);
- }
-
-- return ret;
-+ return vfio_legacy_dma_unmap_one(container, iova, size, flags, iotlb);
- }
-
- static int vfio_legacy_dma_map(const VFIOContainer *bcontainer, hwaddr iova,
-@@ -533,6 +536,9 @@ static bool vfio_legacy_setup(VFIOContainer *bcontainer, Error **errp)
-
- vfio_get_info_iova_range(info, bcontainer);
-
-+ ret = ioctl(container->fd, VFIO_CHECK_EXTENSION, VFIO_UNMAP_ALL);
-+ container->unmap_all_supported = !!ret;
-+
- vfio_get_iommu_info_migration(container, info);
- return true;
- }
-diff --git a/include/hw/vfio/vfio-container-legacy.h b/include/hw/vfio/vfio-container-legacy.h
-index 74a72df018..ffd594e80d 100644
---- a/include/hw/vfio/vfio-container-legacy.h
-+++ b/include/hw/vfio/vfio-container-legacy.h
-@@ -30,6 +30,7 @@ struct VFIOLegacyContainer {
-
- int fd; /* /dev/vfio/vfio, empowered by the attached groups */
- unsigned iommu_type;
-+ bool unmap_all_supported;
- QLIST_HEAD(, VFIOGroup) group_list;
- VFIOContainerCPR cpr;
- };
---
-2.52.0
-
diff --git a/kvm-vfio-container-set-error-on-cpr-failure.patch b/kvm-vfio-container-set-error-on-cpr-failure.patch
deleted file mode 100644
index 0624ba4..0000000
--- a/kvm-vfio-container-set-error-on-cpr-failure.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From c39b56b7304e8518c5a374fb9b55b292ddc17530 Mon Sep 17 00:00:00 2001
-From: Steve Sistare <steven.sistare@oracle.com>
-Date: Wed, 13 Aug 2025 07:17:47 -0700
-Subject: [PATCH 025/116] vfio/container: set error on cpr failure
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [9/100] 9822cac629f3132a25b3618094196c72cfd0f28a (rovick1/qemu-kvm)
-
-Set an error message if vfio_cpr_ram_discard_register_listener fails so
-the fail label gets a valid error object.
-
-Reported-by: Cédric Le Goater <clg@redhat.com>
-Fixes: eba1f657cbb1 ("vfio/container: recover from unmap-all-vaddr failure")
-Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
-Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Link: https://lore.kernel.org/qemu-devel/1755094667-281419-1-git-send-email-steven.sistare@oracle.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 36cd81dc139f899127d868ba9baaf3079c336efc)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/listener.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
-index f498e23a93..5ebafaa07e 100644
---- a/hw/vfio/listener.c
-+++ b/hw/vfio/listener.c
-@@ -574,6 +574,9 @@ void vfio_container_region_add(VFIOContainerBase *bcontainer,
- vfio_ram_discard_register_listener(bcontainer, section);
- } else if (!vfio_cpr_ram_discard_register_listener(bcontainer,
- section)) {
-+ error_setg(&err,
-+ "vfio_cpr_ram_discard_register_listener for %s failed",
-+ memory_region_name(section->mr));
- goto fail;
- }
- return;
---
-2.52.0
-
diff --git a/kvm-vfio-container.c-use-QOM-casts-where-appropriate.patch b/kvm-vfio-container.c-use-QOM-casts-where-appropriate.patch
deleted file mode 100644
index bff7a12..0000000
--- a/kvm-vfio-container.c-use-QOM-casts-where-appropriate.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-From 0b7454223958c35ebd9c0d10c3293efc0e828de4 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:49 +0100
-Subject: [PATCH 036/116] vfio/container.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [20/100] da87b1375fe631dadbdad3febea57c88ab31bc47 (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOUserContainer and VFIOContainerBase instead
-of accessing bcontainer directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: John Levon <john.levon@nutanix.com>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-10-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 06229592fa7e6173b979158e9759f0d40a183861)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/container.c | 26 +++++++++++---------------
- 1 file changed, 11 insertions(+), 15 deletions(-)
-
-diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c
-index d589dd90f5..3cdbd44c1a 100644
---- a/hw/vfio-user/container.c
-+++ b/hw/vfio-user/container.c
-@@ -24,16 +24,14 @@
- */
- static void vfio_user_listener_begin(VFIOContainerBase *bcontainer)
- {
-- VFIOUserContainer *container = container_of(bcontainer, VFIOUserContainer,
-- bcontainer);
-+ VFIOUserContainer *container = VFIO_IOMMU_USER(bcontainer);
-
- container->proxy->async_ops = true;
- }
-
- static void vfio_user_listener_commit(VFIOContainerBase *bcontainer)
- {
-- VFIOUserContainer *container = container_of(bcontainer, VFIOUserContainer,
-- bcontainer);
-+ VFIOUserContainer *container = VFIO_IOMMU_USER(bcontainer);
-
- /* wait here for any async requests sent during the transaction */
- container->proxy->async_ops = false;
-@@ -44,8 +42,8 @@ static int vfio_user_dma_unmap(const VFIOContainerBase *bcontainer,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all)
- {
-- VFIOUserContainer *container = container_of(bcontainer, VFIOUserContainer,
-- bcontainer);
-+ VFIOUserContainer *container = VFIO_IOMMU_USER(bcontainer);
-+
- Error *local_err = NULL;
- int ret = 0;
-
-@@ -86,8 +84,8 @@ static int vfio_user_dma_map(const VFIOContainerBase *bcontainer, hwaddr iova,
- ram_addr_t size, void *vaddr, bool readonly,
- MemoryRegion *mrp)
- {
-- VFIOUserContainer *container = container_of(bcontainer, VFIOUserContainer,
-- bcontainer);
-+ VFIOUserContainer *container = VFIO_IOMMU_USER(bcontainer);
-+
- int fd = memory_region_get_fd(mrp);
- Error *local_err = NULL;
- int ret = 0;
-@@ -173,8 +171,7 @@ static int vfio_user_query_dirty_bitmap(const VFIOContainerBase *bcontainer,
-
- static bool vfio_user_setup(VFIOContainerBase *bcontainer, Error **errp)
- {
-- VFIOUserContainer *container = container_of(bcontainer, VFIOUserContainer,
-- bcontainer);
-+ VFIOUserContainer *container = VFIO_IOMMU_USER(bcontainer);
-
- assert(container->proxy->dma_pgsizes != 0);
- bcontainer->pgsizes = container->proxy->dma_pgsizes;
-@@ -218,7 +215,7 @@ vfio_user_container_connect(AddressSpace *as, VFIODevice *vbasedev,
- goto put_space_exit;
- }
-
-- bcontainer = &container->bcontainer;
-+ bcontainer = VFIO_IOMMU(container);
-
- ret = ram_block_uncoordinated_discard_disable(true);
- if (ret) {
-@@ -263,7 +260,7 @@ put_space_exit:
-
- static void vfio_user_container_disconnect(VFIOUserContainer *container)
- {
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
- VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
- VFIOAddressSpace *space = bcontainer->space;
-
-@@ -291,7 +288,7 @@ static bool vfio_user_device_get(VFIOUserContainer *container,
-
- vbasedev->fd = -1;
-
-- vfio_device_prepare(vbasedev, &container->bcontainer, &info);
-+ vfio_device_prepare(vbasedev, VFIO_IOMMU(container), &info);
-
- return true;
- }
-@@ -315,8 +312,7 @@ static bool vfio_user_device_attach(const char *name, VFIODevice *vbasedev,
-
- static void vfio_user_device_detach(VFIODevice *vbasedev)
- {
-- VFIOUserContainer *container = container_of(vbasedev->bcontainer,
-- VFIOUserContainer, bcontainer);
-+ VFIOUserContainer *container = VFIO_IOMMU_USER(vbasedev->bcontainer);
-
- vfio_device_unprepare(vbasedev);
-
---
-2.52.0
-
diff --git a/kvm-vfio-cpr-exec-mode.patch b/kvm-vfio-cpr-exec-mode.patch
deleted file mode 100644
index db9661e..0000000
--- a/kvm-vfio-cpr-exec-mode.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From fa80def8f8d7ce4a1d60bcd16937dbf3a2e1c9d3 Mon Sep 17 00:00:00 2001
-From: Steve Sistare <steven.sistare@oracle.com>
-Date: Mon, 30 Sep 2024 09:31:52 -0700
-Subject: [PATCH 095/116] vfio: cpr-exec mode
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [79/100] bee9f7a3984192ca2bd2111f21fb94e9d2b97e59 (rovick1/qemu-kvm)
-
-All blockers and notifiers for cpr-transfer mode also apply to cpr-exec.
-
-Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
-Acked-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/r/30750362-d4a1-4392-8dd6-016624d01be1@oracle.com
-Signed-off-by: Peter Xu <peterx@redhat.com>
----
- hw/vfio/container-legacy.c | 3 ++-
- hw/vfio/cpr-iommufd.c | 3 ++-
- hw/vfio/cpr-legacy.c | 9 +++++----
- hw/vfio/cpr.c | 13 +++++++------
- 4 files changed, 16 insertions(+), 12 deletions(-)
-
-diff --git a/hw/vfio/container-legacy.c b/hw/vfio/container-legacy.c
-index 1394dd6fe8..fad0226f7d 100644
---- a/hw/vfio/container-legacy.c
-+++ b/hw/vfio/container-legacy.c
-@@ -986,7 +986,8 @@ static bool vfio_legacy_attach_device(const char *name, VFIODevice *vbasedev,
- error_setg(&vbasedev->cpr.mdev_blocker,
- "CPR does not support vfio mdev %s", vbasedev->name);
- if (migrate_add_blocker_modes(&vbasedev->cpr.mdev_blocker, errp,
-- MIG_MODE_CPR_TRANSFER, -1) < 0) {
-+ MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC,
-+ -1) < 0) {
- goto hiod_unref_exit;
- }
- }
-diff --git a/hw/vfio/cpr-iommufd.c b/hw/vfio/cpr-iommufd.c
-index 1d70c87996..8a4d65de5e 100644
---- a/hw/vfio/cpr-iommufd.c
-+++ b/hw/vfio/cpr-iommufd.c
-@@ -159,7 +159,8 @@ bool vfio_iommufd_cpr_register_iommufd(IOMMUFDBackend *be, Error **errp)
-
- if (!vfio_cpr_supported(be, cpr_blocker)) {
- return migrate_add_blocker_modes(cpr_blocker, errp,
-- MIG_MODE_CPR_TRANSFER, -1) == 0;
-+ MIG_MODE_CPR_TRANSFER,
-+ MIG_MODE_CPR_EXEC, -1) == 0;
- }
-
- vmstate_register(NULL, -1, &iommufd_cpr_vmstate, be);
-diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
-index 3a1d126556..80af7469d0 100644
---- a/hw/vfio/cpr-legacy.c
-+++ b/hw/vfio/cpr-legacy.c
-@@ -179,16 +179,17 @@ bool vfio_legacy_cpr_register_container(VFIOLegacyContainer *container,
-
- if (!vfio_cpr_supported(container, cpr_blocker)) {
- return migrate_add_blocker_modes(cpr_blocker, errp,
-- MIG_MODE_CPR_TRANSFER, -1) == 0;
-+ MIG_MODE_CPR_TRANSFER,
-+ MIG_MODE_CPR_EXEC, -1) == 0;
- }
-
- vfio_cpr_add_kvm_notifier();
-
- vmstate_register(NULL, -1, &vfio_container_vmstate, container);
-
-- migration_add_notifier_mode(&container->cpr.transfer_notifier,
-- vfio_cpr_fail_notifier,
-- MIG_MODE_CPR_TRANSFER);
-+ migration_add_notifier_modes(&container->cpr.transfer_notifier,
-+ vfio_cpr_fail_notifier,
-+ MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC, -1);
- return true;
- }
-
-diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c
-index 2c71fc1e8e..db462aabcb 100644
---- a/hw/vfio/cpr.c
-+++ b/hw/vfio/cpr.c
-@@ -195,9 +195,10 @@ static int vfio_cpr_kvm_close_notifier(NotifierWithReturn *notifier,
- void vfio_cpr_add_kvm_notifier(void)
- {
- if (!kvm_close_notifier.notify) {
-- migration_add_notifier_mode(&kvm_close_notifier,
-- vfio_cpr_kvm_close_notifier,
-- MIG_MODE_CPR_TRANSFER);
-+ migration_add_notifier_modes(&kvm_close_notifier,
-+ vfio_cpr_kvm_close_notifier,
-+ MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC,
-+ -1);
- }
- }
-
-@@ -282,9 +283,9 @@ static int vfio_cpr_pci_notifier(NotifierWithReturn *notifier,
-
- void vfio_cpr_pci_register_device(VFIOPCIDevice *vdev)
- {
-- migration_add_notifier_mode(&vdev->cpr.transfer_notifier,
-- vfio_cpr_pci_notifier,
-- MIG_MODE_CPR_TRANSFER);
-+ migration_add_notifier_modes(&vdev->cpr.transfer_notifier,
-+ vfio_cpr_pci_notifier,
-+ MIG_MODE_CPR_TRANSFER, MIG_MODE_CPR_EXEC, -1);
- }
-
- void vfio_cpr_pci_unregister_device(VFIOPCIDevice *vdev)
---
-2.52.0
-
diff --git a/kvm-vfio-cpr-iommufd.c-use-QOM-casts-where-appropriate.patch b/kvm-vfio-cpr-iommufd.c-use-QOM-casts-where-appropriate.patch
deleted file mode 100644
index 2d2ca67..0000000
--- a/kvm-vfio-cpr-iommufd.c-use-QOM-casts-where-appropriate.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 67a729c7cf2b097aa492c0a049a526411a40c0a1 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:16 +0100
-Subject: [PATCH 058/116] vfio/cpr-iommufd.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [42/100] 1746dde982eb2cfd00107f598efe53dcf6eb7c94 (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOIOMMUFDContainer and VFIOContainer instead
-of accessing bcontainer directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-9-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 91bdb2f32902c83490cbafe524c82005a64e1f68)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/cpr-iommufd.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio/cpr-iommufd.c b/hw/vfio/cpr-iommufd.c
-index 6aaf6f77a2..1d70c87996 100644
---- a/hw/vfio/cpr-iommufd.c
-+++ b/hw/vfio/cpr-iommufd.c
-@@ -176,7 +176,7 @@ void vfio_iommufd_cpr_unregister_iommufd(IOMMUFDBackend *be)
- bool vfio_iommufd_cpr_register_container(VFIOIOMMUFDContainer *container,
- Error **errp)
- {
-- VFIOContainer *bcontainer = &container->bcontainer;
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
-
- migration_add_notifier_mode(&bcontainer->cpr_reboot_notifier,
- vfio_cpr_reboot_notifier,
-@@ -189,7 +189,7 @@ bool vfio_iommufd_cpr_register_container(VFIOIOMMUFDContainer *container,
-
- void vfio_iommufd_cpr_unregister_container(VFIOIOMMUFDContainer *container)
- {
-- VFIOContainer *bcontainer = &container->bcontainer;
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
-
- migration_remove_notifier(&bcontainer->cpr_reboot_notifier);
- }
---
-2.52.0
-
diff --git a/kvm-vfio-cpr-legacy-drop-an-erroneous-assert.patch b/kvm-vfio-cpr-legacy-drop-an-erroneous-assert.patch
deleted file mode 100644
index c6f2d30..0000000
--- a/kvm-vfio-cpr-legacy-drop-an-erroneous-assert.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From b466b2c82dcaec4df06d4d2992191bb4d01e5327 Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Sun, 28 Sep 2025 04:54:28 -0400
-Subject: [PATCH 099/116] vfio/cpr-legacy: drop an erroneous assert
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [83/100] 665ecb595eb462e58612b0a03ede41eaf33d259c (rovick1/qemu-kvm)
-
-vfio_legacy_cpr_dma_map() is not only used in post_load on destination
-but also error recovery path on source side. Assert it for destination
-is wrong.
-
-Fixes: 7e9f21411302 ("vfio/container: restore DMA vaddr")
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
-Link: https://lore.kernel.org/qemu-devel/20250928085432.40107-3-zhenzhong.duan@intel.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 94230948960e56cb47e835266c7cd8df46da03a4)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/cpr-legacy.c | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
-index b4581e8f85..7184c93991 100644
---- a/hw/vfio/cpr-legacy.c
-+++ b/hw/vfio/cpr-legacy.c
-@@ -52,8 +52,6 @@ static int vfio_legacy_cpr_dma_map(const VFIOContainer *bcontainer,
- .size = size,
- };
-
-- g_assert(cpr_is_incoming());
--
- if (ioctl(container->fd, VFIO_IOMMU_MAP_DMA, &map)) {
- return -errno;
- }
---
-2.52.0
-
diff --git a/kvm-vfio-cpr.c-use-QOM-casts-where-appropriate.patch b/kvm-vfio-cpr.c-use-QOM-casts-where-appropriate.patch
deleted file mode 100644
index e827352..0000000
--- a/kvm-vfio-cpr.c-use-QOM-casts-where-appropriate.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 1748fcfa8e350d1e28c01ccd31c403d79858bf93 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:58 +0100
-Subject: [PATCH 044/116] vfio/cpr.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [28/100] b5ac8c4ae6f9c35ddb091a1037e687668df40984 (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOPCIDevice and PCIDevice instead of
-accessing pdev directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-19-mark.caveayland@nutanix.com
-[ clg: Updated vfio_cpr_set_msi_virq() ]
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 54a3eb315023f59db0426d85604f4527bf7b1aaa)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/cpr.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c
-index a831243e02..f911988add 100644
---- a/hw/vfio/cpr.c
-+++ b/hw/vfio/cpr.c
-@@ -56,7 +56,7 @@ static void vfio_cpr_claim_vectors(VFIOPCIDevice *vdev, int nr_vectors,
- {
- int i, fd;
- bool pending = false;
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-
- vdev->nr_vectors = nr_vectors;
- vdev->msi_vectors = g_new0(VFIOMSIVector, nr_vectors);
-@@ -99,7 +99,7 @@ static void vfio_cpr_claim_vectors(VFIOPCIDevice *vdev, int nr_vectors,
- static int vfio_cpr_pci_pre_load(void *opaque)
- {
- VFIOPCIDevice *vdev = opaque;
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int size = MIN(pci_config_size(pdev), vdev->config_size);
- int i;
-
-@@ -113,7 +113,7 @@ static int vfio_cpr_pci_pre_load(void *opaque)
- static int vfio_cpr_pci_post_load(void *opaque, int version_id)
- {
- VFIOPCIDevice *vdev = opaque;
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int nr_vectors;
-
- vfio_sub_page_bar_update_mappings(vdev);
-@@ -214,7 +214,7 @@ static int set_irqfd_notifier_gsi(KVMState *s, EventNotifier *n,
- static int vfio_cpr_set_msi_virq(VFIOPCIDevice *vdev, Error **errp, bool enable)
- {
- const char *op = (enable ? "enable" : "disable");
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int i, nr_vectors, ret = 0;
-
- if (msix_enabled(pdev)) {
---
-2.52.0
-
diff --git a/kvm-vfio-igd-Enable-quirks-when-IGD-is-not-the-primary-d.patch b/kvm-vfio-igd-Enable-quirks-when-IGD-is-not-the-primary-d.patch
deleted file mode 100644
index 74ceddf..0000000
--- a/kvm-vfio-igd-Enable-quirks-when-IGD-is-not-the-primary-d.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From 012e86bf90f92c1e2dc25f43806dadaea2ef36e2 Mon Sep 17 00:00:00 2001
-From: Tomita Moeko <tomitamoeko@gmail.com>
-Date: Thu, 14 Aug 2025 00:05:10 +0800
-Subject: [PATCH 019/116] vfio/igd: Enable quirks when IGD is not the primary
- display
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [3/100] fe9e2f561c2782a0713a06e219d738ca98d62729 (rovick1/qemu-kvm)
-
-Since linux 6.15, commit 41112160ca87 ("vfio/pci: match IGD devices in
-display controller class"), IGD related regions are also exposed when
-IGD is not primary display (device class is Display controller).
-
-Allow IGD quirks to be enabled in this configuration so that guests can
-have display output on IGD when it is not the primary display.
-
-Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
-Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250813160510.23553-1-tomitamoeko@gmail.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 432ca3dfa3d57a7bf1e427576fcfca4ab0079a50)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/igd.c | 7 ++++---
- hw/vfio/pci.h | 5 +++++
- 2 files changed, 9 insertions(+), 3 deletions(-)
-
-diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
-index ee0767b0b8..f116c40ccd 100644
---- a/hw/vfio/igd.c
-+++ b/hw/vfio/igd.c
-@@ -460,7 +460,7 @@ void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
- int gen;
-
- if (!vfio_pci_is(vdev, PCI_VENDOR_ID_INTEL, PCI_ANY_ID) ||
-- !vfio_is_vga(vdev) || nr != 0) {
-+ !vfio_is_base_display(vdev) || nr != 0) {
- return;
- }
-
-@@ -518,7 +518,7 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
- Error *err = NULL;
-
- if (!vfio_pci_is(vdev, PCI_VENDOR_ID_INTEL, PCI_ANY_ID) ||
-- !vfio_is_vga(vdev)) {
-+ !vfio_is_base_display(vdev)) {
- return true;
- }
-
-@@ -534,12 +534,13 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
- /*
- * For backward compatibility, enable legacy mode when
- * - Device geneation is 6 to 9 (including both)
-- * - IGD claims VGA cycles on host
-+ * - IGD exposes itself as VGA controller and claims VGA cycles on host
- * - Machine type is i440fx (pc_piix)
- * - IGD device is at guest BDF 00:02.0
- * - Not manually disabled by x-igd-legacy-mode=off
- */
- if ((vdev->igd_legacy_mode != ON_OFF_AUTO_OFF) &&
-+ vfio_is_vga(vdev) &&
- (gen >= 6 && gen <= 9) &&
- !(gmch & IGD_GMCH_VGA_DISABLE) &&
- !strcmp(MACHINE_GET_CLASS(qdev_get_machine())->family, "pc_piix") &&
-diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
-index 81555d8774..056f5e12cf 100644
---- a/hw/vfio/pci.h
-+++ b/hw/vfio/pci.h
-@@ -204,6 +204,11 @@ static inline bool vfio_is_vga(VFIOPCIDevice *vdev)
- return (vdev->class_code >> 8) == PCI_CLASS_DISPLAY_VGA;
- }
-
-+static inline bool vfio_is_base_display(VFIOPCIDevice *vdev)
-+{
-+ return (vdev->class_code >> 16) == PCI_BASE_CLASS_DISPLAY;
-+}
-+
- /* MSI/MSI-X/INTx */
- void vfio_pci_vector_init(VFIOPCIDevice *vdev, int nr);
- void vfio_pci_add_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector,
---
-2.52.0
-
diff --git a/kvm-vfio-igd.c-use-QOM-casts-where-appropriate.patch b/kvm-vfio-igd.c-use-QOM-casts-where-appropriate.patch
deleted file mode 100644
index 6a3d554..0000000
--- a/kvm-vfio-igd.c-use-QOM-casts-where-appropriate.patch
+++ /dev/null
@@ -1,174 +0,0 @@
-From b3f25aaf0931d1fdf746e22887af9d0305f0e04b Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:59 +0100
-Subject: [PATCH 045/116] vfio/igd.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [29/100] f6dc005b45e6581e8c2bbfa4db39e5d00e7bd98c (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOPCIDevice and PCIDevice instead of
-accessing pdev directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Tomita Moeko <tomitamoeko@gmail.com>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-20-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 8d3776dd6d8740fb7c91c7c1c25b60fc7edfd19c)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/igd.c | 38 +++++++++++++++++++++-----------------
- 1 file changed, 21 insertions(+), 17 deletions(-)
-
-diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
-index f116c40ccd..4bfa2e0fcd 100644
---- a/hw/vfio/igd.c
-+++ b/hw/vfio/igd.c
-@@ -200,7 +200,7 @@ static bool vfio_pci_igd_opregion_detect(VFIOPCIDevice *vdev,
- }
-
- /* Hotplugging is not supported for opregion access */
-- if (vdev->pdev.qdev.hotplugged) {
-+ if (DEVICE(vdev)->hotplugged) {
- warn_report("IGD device detected, but OpRegion is not supported "
- "on hotplugged device.");
- return false;
-@@ -260,11 +260,12 @@ static int vfio_pci_igd_copy(VFIOPCIDevice *vdev, PCIDevice *pdev,
- static int vfio_pci_igd_host_init(VFIOPCIDevice *vdev,
- struct vfio_region_info *info)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- PCIBus *bus;
- PCIDevice *host_bridge;
- int ret;
-
-- bus = pci_device_root_bus(&vdev->pdev);
-+ bus = pci_device_root_bus(pdev);
- host_bridge = pci_find_device(bus, 0, PCI_DEVFN(0, 0));
-
- if (!host_bridge) {
-@@ -327,13 +328,14 @@ type_init(vfio_pci_igd_register_types)
- static int vfio_pci_igd_lpc_init(VFIOPCIDevice *vdev,
- struct vfio_region_info *info)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- PCIDevice *lpc_bridge;
- int ret;
-
-- lpc_bridge = pci_find_device(pci_device_root_bus(&vdev->pdev),
-+ lpc_bridge = pci_find_device(pci_device_root_bus(pdev),
- 0, PCI_DEVFN(0x1f, 0));
- if (!lpc_bridge) {
-- lpc_bridge = pci_create_simple(pci_device_root_bus(&vdev->pdev),
-+ lpc_bridge = pci_create_simple(pci_device_root_bus(pdev),
- PCI_DEVFN(0x1f, 0), "vfio-pci-igd-lpc-bridge");
- }
-
-@@ -350,13 +352,14 @@ static bool vfio_pci_igd_setup_lpc_bridge(VFIOPCIDevice *vdev, Error **errp)
- {
- struct vfio_region_info *host = NULL;
- struct vfio_region_info *lpc = NULL;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- PCIDevice *lpc_bridge;
- int ret;
-
- /*
- * Copying IDs or creating new devices are not supported on hotplug
- */
-- if (vdev->pdev.qdev.hotplugged) {
-+ if (DEVICE(vdev)->hotplugged) {
- error_setg(errp, "IGD LPC is not supported on hotplugged device");
- return false;
- }
-@@ -366,7 +369,7 @@ static bool vfio_pci_igd_setup_lpc_bridge(VFIOPCIDevice *vdev, Error **errp)
- * can stuff host values into, so if there's already one there and it's not
- * one we can hack on, this quirk is no-go. Sorry Q35.
- */
-- lpc_bridge = pci_find_device(pci_device_root_bus(&vdev->pdev),
-+ lpc_bridge = pci_find_device(pci_device_root_bus(pdev),
- 0, PCI_DEVFN(0x1f, 0));
- if (lpc_bridge && !object_dynamic_cast(OBJECT(lpc_bridge),
- "vfio-pci-igd-lpc-bridge")) {
-@@ -510,6 +513,7 @@ void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
- static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
- {
- struct vfio_region_info *opregion = NULL;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int ret, gen;
- uint64_t gms_size = 0;
- uint64_t *bdsm_size;
-@@ -529,7 +533,7 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
- info_report("OpRegion detected on Intel display %x.", vdev->device_id);
-
- gen = igd_gen(vdev);
-- gmch = vfio_pci_read_config(&vdev->pdev, IGD_GMCH, 4);
-+ gmch = vfio_pci_read_config(pdev, IGD_GMCH, 4);
-
- /*
- * For backward compatibility, enable legacy mode when
-@@ -544,7 +548,7 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
- (gen >= 6 && gen <= 9) &&
- !(gmch & IGD_GMCH_VGA_DISABLE) &&
- !strcmp(MACHINE_GET_CLASS(qdev_get_machine())->family, "pc_piix") &&
-- (&vdev->pdev == pci_find_device(pci_device_root_bus(&vdev->pdev),
-+ (pdev == pci_find_device(pci_device_root_bus(pdev),
- 0, PCI_DEVFN(0x2, 0)))) {
- /*
- * IGD legacy mode requires:
-@@ -566,7 +570,7 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
- */
- ret = vfio_device_get_region_info(&vdev->vbasedev,
- VFIO_PCI_ROM_REGION_INDEX, &rom);
-- if ((ret || !rom->size) && !vdev->pdev.romfile) {
-+ if ((ret || !rom->size) && !pdev->romfile) {
- error_setg(&err, "Device has no ROM");
- goto error;
- }
-@@ -611,8 +615,8 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
- * ASLS (OpRegion address) is read-only, emulated
- * It contains HPA, guest firmware need to reprogram it with GPA.
- */
-- pci_set_long(vdev->pdev.config + IGD_ASLS, 0);
-- pci_set_long(vdev->pdev.wmask + IGD_ASLS, ~0);
-+ pci_set_long(pdev->config + IGD_ASLS, 0);
-+ pci_set_long(pdev->wmask + IGD_ASLS, ~0);
- pci_set_long(vdev->emulated_config_bits + IGD_ASLS, ~0);
-
- /*
-@@ -626,8 +630,8 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
- }
-
- /* GMCH is read-only, emulated */
-- pci_set_long(vdev->pdev.config + IGD_GMCH, gmch);
-- pci_set_long(vdev->pdev.wmask + IGD_GMCH, 0);
-+ pci_set_long(pdev->config + IGD_GMCH, gmch);
-+ pci_set_long(pdev->wmask + IGD_GMCH, 0);
- pci_set_long(vdev->emulated_config_bits + IGD_GMCH, ~0);
- }
-
-@@ -636,12 +640,12 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
-
- /* BDSM is read-write, emulated. BIOS needs to be able to write it */
- if (gen < 11) {
-- pci_set_long(vdev->pdev.config + IGD_BDSM, 0);
-- pci_set_long(vdev->pdev.wmask + IGD_BDSM, ~0);
-+ pci_set_long(pdev->config + IGD_BDSM, 0);
-+ pci_set_long(pdev->wmask + IGD_BDSM, ~0);
- pci_set_long(vdev->emulated_config_bits + IGD_BDSM, ~0);
- } else {
-- pci_set_quad(vdev->pdev.config + IGD_BDSM_GEN11, 0);
-- pci_set_quad(vdev->pdev.wmask + IGD_BDSM_GEN11, ~0);
-+ pci_set_quad(pdev->config + IGD_BDSM_GEN11, 0);
-+ pci_set_quad(pdev->wmask + IGD_BDSM_GEN11, ~0);
- pci_set_quad(vdev->emulated_config_bits + IGD_BDSM_GEN11, ~0);
- }
- }
---
-2.52.0
-
diff --git a/kvm-vfio-iommufd-Force-creating-nesting-parent-HWPT.patch b/kvm-vfio-iommufd-Force-creating-nesting-parent-HWPT.patch
deleted file mode 100644
index d883213..0000000
--- a/kvm-vfio-iommufd-Force-creating-nesting-parent-HWPT.patch
+++ /dev/null
@@ -1,121 +0,0 @@
-From e860d57ea2f5ed6480d1717226e99626a5f4ba4e Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Tue, 6 Jan 2026 01:12:50 -0500
-Subject: [PATCH 076/111] vfio/iommufd: Force creating nesting parent HWPT
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 505: SMMU Rebase for accelerated SMMU and CMDQV support
-RH-Jira: RHEL-142465 RHEL-160190 RHEL-163596 RHEL-73794 RHEL-73796 RHEL-73798
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [76/111] 49096907847a865983e879a968586122dccb292e (eauger1/centos-qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-73798
-
-Conflicts: contextual conflict in hw/vfio/device.c and
-include/hw/vfio/vfio-device.h due to out of order backport og
-de36da106dcf hw/vfio: Add helper to retrieve device feature
-also change hw/core/hw-error.h into former hw/hw.h since we
-also miss 048a23851cd4 include: move hw/hw.h to hw/core/, rename
-
-Call pci_device_get_viommu_flags() to get if vIOMMU supports
-VIOMMU_FLAG_WANT_NESTING_PARENT.
-
-If yes, create a nesting parent HWPT and add it to the container's hwpt_list,
-letting this parent HWPT cover the entire second stage mappings (GPA=>HPA).
-
-This allows a VFIO passthrough device to directly attach to this default HWPT
-and then to use the system address space and its listener.
-
-Introduce a vfio_device_get_viommu_flags_want_nesting() helper to facilitate
-this implementation.
-
-It is safe to do so because a vIOMMU will be able to fail in set_iommu_device()
-call, if something else related to the VFIO device or vIOMMU isn't compatible.
-
-Suggested-by: Nicolin Chen <nicolinc@nvidia.com>
-Suggested-by: Yi Liu <yi.l.liu@intel.com>
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Yi Liu <yi.l.liu@intel.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20260106061304.314546-9-zhenzhong.duan@intel.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit c3459c6bfaad6a3d0bef4d3ebc6753bb3e66c1ef)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/device.c | 13 +++++++++++++
- hw/vfio/iommufd.c | 9 +++++++++
- include/hw/vfio/vfio-device.h | 1 +
- 3 files changed, 23 insertions(+)
-
-diff --git a/hw/vfio/device.c b/hw/vfio/device.c
-index 330f2598ff..c01eb72ee7 100644
---- a/hw/vfio/device.c
-+++ b/hw/vfio/device.c
-@@ -24,6 +24,8 @@
- #include "hw/vfio/vfio-device.h"
- #include "hw/vfio/pci.h"
- #include "hw/hw.h"
-+#include "hw/core/iommu.h"
-+#include "hw/hw.h"
- #include "trace.h"
- #include "qapi/error.h"
- #include "qemu/error-report.h"
-@@ -524,6 +526,17 @@ int vfio_device_get_feature(VFIODevice *vbasedev,
- return vbasedev->io_ops->device_feature(vbasedev, feature);
- }
-
-+bool vfio_device_get_viommu_flags_want_nesting(VFIODevice *vbasedev)
-+{
-+ VFIOPCIDevice *vdev = vfio_pci_from_vfio_device(vbasedev);
-+
-+ if (vdev) {
-+ return !!(pci_device_get_viommu_flags(PCI_DEVICE(vdev)) &
-+ VIOMMU_FLAG_WANT_NESTING_PARENT);
-+ }
-+ return false;
-+}
-+
- /*
- * Traditional ioctl() based io
- */
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index 67acdfa183..59dc17b166 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -363,6 +363,15 @@ static bool iommufd_cdev_autodomains_get(VFIODevice *vbasedev,
- flags = IOMMU_HWPT_ALLOC_DIRTY_TRACKING;
- }
-
-+ /*
-+ * If vIOMMU requests VFIO's cooperation to create nesting parent HWPT,
-+ * force to create it so that it could be reused by vIOMMU to create
-+ * nested HWPT.
-+ */
-+ if (vfio_device_get_viommu_flags_want_nesting(vbasedev)) {
-+ flags |= IOMMU_HWPT_ALLOC_NEST_PARENT;
-+ }
-+
- if (cpr_is_incoming()) {
- hwpt_id = vbasedev->cpr.hwpt_id;
- goto skip_alloc;
-diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h
-index fc28f580ba..27e2976593 100644
---- a/include/hw/vfio/vfio-device.h
-+++ b/include/hw/vfio/vfio-device.h
-@@ -260,6 +260,7 @@ void vfio_device_unprepare(VFIODevice *vbasedev);
-
- int vfio_device_get_feature(VFIODevice *vbasedev,
- struct vfio_device_feature *feature);
-+bool vfio_device_get_viommu_flags_want_nesting(VFIODevice *vbasedev);
-
- int vfio_device_get_region_info(VFIODevice *vbasedev, int index,
- struct vfio_region_info **info);
---
-2.52.0
-
diff --git a/kvm-vfio-iommufd-Restore-vbasedev-s-reference-to-hwpt-af.patch b/kvm-vfio-iommufd-Restore-vbasedev-s-reference-to-hwpt-af.patch
deleted file mode 100644
index e22ee35..0000000
--- a/kvm-vfio-iommufd-Restore-vbasedev-s-reference-to-hwpt-af.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 2e59058caf20c55428f60d01958cdcb3e24e214c Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Sun, 28 Sep 2025 04:54:30 -0400
-Subject: [PATCH 101/116] vfio/iommufd: Restore vbasedev's reference to hwpt
- after CPR transfer
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [85/100] bee86cff29b04fee93669e35482a362d70198d82 (rovick1/qemu-kvm)
-
-After CPR transfer, if there are more than one VFIO devices, device is
-not added to hwpt->device_list and its reference to hwpt isn't restored
-on destination. We still need to call iommufd_cdev_attach_container() to
-restore it after a matching container is found, or else SIGSEV triggers.
-
-Fixes: 4296ee07455e ("vfio/iommufd: reconstruct device")
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
-Link: https://lore.kernel.org/qemu-devel/20250928085432.40107-5-zhenzhong.duan@intel.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 8bf49fff0dfbb065ad65daa48d2e1a63ad2fd552)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/iommufd.c | 5 ++---
- 1 file changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index 3b0288f416..ce10371818 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -560,10 +560,9 @@ static bool iommufd_cdev_attach(const char *name, VFIODevice *vbasedev,
- continue;
- }
-
-- if (!cpr_is_incoming()) {
-+ if (!cpr_is_incoming() ||
-+ (vbasedev->cpr.ioas_id == container->ioas_id)) {
- res = iommufd_cdev_attach_container(vbasedev, container, &err);
-- } else if (vbasedev->cpr.ioas_id == container->ioas_id) {
-- res = true;
- } else {
- continue;
- }
---
-2.52.0
-
diff --git a/kvm-vfio-iommufd-Set-cpr.ioas_id-on-source-side-for-CPR-.patch b/kvm-vfio-iommufd-Set-cpr.ioas_id-on-source-side-for-CPR-.patch
deleted file mode 100644
index 58f39d3..0000000
--- a/kvm-vfio-iommufd-Set-cpr.ioas_id-on-source-side-for-CPR-.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 663f00467aa4f1a081005dc0460b3d170aaa9693 Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Sun, 28 Sep 2025 04:54:29 -0400
-Subject: [PATCH 100/116] vfio/iommufd: Set cpr.ioas_id on source side for CPR
- transfer
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [84/100] c3e02d9b858065fe04b730f23b4f95363148371f (rovick1/qemu-kvm)
-
-On source side, if there are more than one VFIO devices and they
-attach to same container, only the first device sets cpr.ioas_id,
-the others are bypassed. We should set it for each device, or
-else only first device works.
-
-Fixes: 4296ee07455e ("vfio/iommufd: reconstruct device")
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
-Link: https://lore.kernel.org/qemu-devel/20250928085432.40107-4-zhenzhong.duan@intel.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit d59db04aed750ba4fc56f79cae99814334ec8285)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/iommufd.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index 10fc065d20..3b0288f416 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -602,7 +602,6 @@ skip_ioas_alloc:
- container->be = vbasedev->iommufd;
- container->ioas_id = ioas_id;
- QLIST_INIT(&container->hwpt_list);
-- vbasedev->cpr.ioas_id = ioas_id;
-
- bcontainer = VFIO_IOMMU(container);
- vfio_address_space_insert(space, bcontainer);
-@@ -636,6 +635,8 @@ skip_ioas_alloc:
- bcontainer->initialized = true;
-
- found_container:
-+ vbasedev->cpr.ioas_id = container->ioas_id;
-+
- ret = ioctl(devfd, VFIO_DEVICE_GET_INFO, &dev_info);
- if (ret) {
- error_setg_errno(errp, errno, "error getting device info");
---
-2.52.0
-
diff --git a/kvm-vfio-iommufd-Support-unmap-all-in-one-ioctl.patch b/kvm-vfio-iommufd-Support-unmap-all-in-one-ioctl.patch
deleted file mode 100644
index 4d107d2..0000000
--- a/kvm-vfio-iommufd-Support-unmap-all-in-one-ioctl.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From cf9a245a831df3b807926c544b593675363a956f Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Thu, 9 Oct 2025 00:01:33 -0400
-Subject: [PATCH 103/116] vfio/iommufd: Support unmap all in one ioctl()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [87/100] aa45e281f3de07944c441b6096b73c54f3e45b97 (rovick1/qemu-kvm)
-
-IOMMUFD kernel uAPI supports unmapping whole address space in one call with
-[iova, size] set to [0, UINT64_MAX], this can simplify iommufd_cdev_unmap()
-a bit. See iommufd_ioas_unmap() in kernel for details.
-
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20251009040134.334251-3-zhenzhong.duan@intel.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit b30823e5619ed5658d33e43abe1308195edb3e8b)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/iommufd.c | 15 +--------------
- 1 file changed, 1 insertion(+), 14 deletions(-)
-
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index ce10371818..bb5775aa71 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -62,21 +62,8 @@ static int iommufd_cdev_unmap(const VFIOContainer *bcontainer,
- {
- const VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
-
-- /* unmap in halves */
- if (unmap_all) {
-- Int128 llsize = int128_rshift(int128_2_64(), 1);
-- int ret;
--
-- ret = iommufd_backend_unmap_dma(container->be, container->ioas_id,
-- 0, int128_get64(llsize));
--
-- if (ret == 0) {
-- ret = iommufd_backend_unmap_dma(container->be, container->ioas_id,
-- int128_get64(llsize),
-- int128_get64(llsize));
-- }
--
-- return ret;
-+ size = UINT64_MAX;
- }
-
- /* TODO: Handle dma_unmap_bitmap with iotlb args (migration) */
---
-2.52.0
-
diff --git a/kvm-vfio-iommufd.c-use-QOM-casts-where-appropriate.patch b/kvm-vfio-iommufd.c-use-QOM-casts-where-appropriate.patch
deleted file mode 100644
index f64afa6..0000000
--- a/kvm-vfio-iommufd.c-use-QOM-casts-where-appropriate.patch
+++ /dev/null
@@ -1,154 +0,0 @@
-From e98b1125a4bfaf936715b633c886ff90c19fdf8e Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:15 +0100
-Subject: [PATCH 057/116] vfio/iommufd.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [41/100] 3c8cf0152b35812f417df304657aa7b7bb3492fd (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOIOMMUFDContainer and VFIOContainer instead
-of accessing bcontainer directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-8-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit cc5b394291f428a04ff7a622573c02560b183797)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/iommufd.c | 34 ++++++++++++++--------------------
- 1 file changed, 14 insertions(+), 20 deletions(-)
-
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index 2ebd87ec8f..76f0806ec0 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -38,8 +38,7 @@ static int iommufd_cdev_map(const VFIOContainer *bcontainer, hwaddr iova,
- ram_addr_t size, void *vaddr, bool readonly,
- MemoryRegion *mr)
- {
-- const VFIOIOMMUFDContainer *container =
-- container_of(bcontainer, VFIOIOMMUFDContainer, bcontainer);
-+ const VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
-
- return iommufd_backend_map_dma(container->be,
- container->ioas_id,
-@@ -50,8 +49,7 @@ static int iommufd_cdev_map_file(const VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- int fd, unsigned long start, bool readonly)
- {
-- const VFIOIOMMUFDContainer *container =
-- container_of(bcontainer, VFIOIOMMUFDContainer, bcontainer);
-+ const VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
-
- return iommufd_backend_map_file_dma(container->be,
- container->ioas_id,
-@@ -62,8 +60,7 @@ static int iommufd_cdev_unmap(const VFIOContainer *bcontainer,
- hwaddr iova, ram_addr_t size,
- IOMMUTLBEntry *iotlb, bool unmap_all)
- {
-- const VFIOIOMMUFDContainer *container =
-- container_of(bcontainer, VFIOIOMMUFDContainer, bcontainer);
-+ const VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
-
- /* unmap in halves */
- if (unmap_all) {
-@@ -162,8 +159,7 @@ static bool iommufd_hwpt_dirty_tracking(VFIOIOASHwpt *hwpt)
- static int iommufd_set_dirty_page_tracking(const VFIOContainer *bcontainer,
- bool start, Error **errp)
- {
-- const VFIOIOMMUFDContainer *container =
-- container_of(bcontainer, VFIOIOMMUFDContainer, bcontainer);
-+ const VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
- VFIOIOASHwpt *hwpt;
-
- QLIST_FOREACH(hwpt, &container->hwpt_list, next) {
-@@ -194,9 +190,7 @@ static int iommufd_query_dirty_bitmap(const VFIOContainer *bcontainer,
- VFIOBitmap *vbmap, hwaddr iova,
- hwaddr size, Error **errp)
- {
-- VFIOIOMMUFDContainer *container = container_of(bcontainer,
-- VFIOIOMMUFDContainer,
-- bcontainer);
-+ VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
- unsigned long page_size = qemu_real_host_page_size();
- VFIOIOASHwpt *hwpt;
-
-@@ -324,6 +318,7 @@ static bool iommufd_cdev_autodomains_get(VFIODevice *vbasedev,
- {
- ERRP_GUARD();
- IOMMUFDBackend *iommufd = vbasedev->iommufd;
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
- uint32_t type, flags = 0;
- uint64_t hw_caps;
- VFIOIOASHwpt *hwpt;
-@@ -408,9 +403,9 @@ skip_alloc:
- vbasedev->iommu_dirty_tracking = iommufd_hwpt_dirty_tracking(hwpt);
- QLIST_INSERT_HEAD(&hwpt->device_list, vbasedev, hwpt_next);
- QLIST_INSERT_HEAD(&container->hwpt_list, hwpt, next);
-- container->bcontainer.dirty_pages_supported |=
-+ bcontainer->dirty_pages_supported |=
- vbasedev->iommu_dirty_tracking;
-- if (container->bcontainer.dirty_pages_supported &&
-+ if (bcontainer->dirty_pages_supported &&
- !vbasedev->iommu_dirty_tracking) {
- warn_report("IOMMU instance for device %s doesn't support dirty tracking",
- vbasedev->name);
-@@ -464,7 +459,7 @@ static void iommufd_cdev_detach_container(VFIODevice *vbasedev,
-
- static void iommufd_cdev_container_destroy(VFIOIOMMUFDContainer *container)
- {
-- VFIOContainer *bcontainer = &container->bcontainer;
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
-
- if (!QLIST_EMPTY(&bcontainer->device_list)) {
- return;
-@@ -486,7 +481,7 @@ static int iommufd_cdev_ram_block_discard_disable(bool state)
- static bool iommufd_cdev_get_info_iova_range(VFIOIOMMUFDContainer *container,
- uint32_t ioas_id, Error **errp)
- {
-- VFIOContainer *bcontainer = &container->bcontainer;
-+ VFIOContainer *bcontainer = VFIO_IOMMU(container);
- g_autofree struct iommu_ioas_iova_ranges *info = NULL;
- struct iommu_iova_range *iova_ranges;
- int sz, fd = container->be->fd;
-@@ -559,7 +554,7 @@ static bool iommufd_cdev_attach(const char *name, VFIODevice *vbasedev,
-
- /* try to attach to an existing container in this space */
- QLIST_FOREACH(bcontainer, &space->containers, next) {
-- container = container_of(bcontainer, VFIOIOMMUFDContainer, bcontainer);
-+ container = VFIO_IOMMU_IOMMUFD(bcontainer);
- if (VFIO_IOMMU_GET_CLASS(bcontainer) != iommufd_vioc ||
- vbasedev->iommufd != container->be) {
- continue;
-@@ -609,7 +604,7 @@ skip_ioas_alloc:
- QLIST_INIT(&container->hwpt_list);
- vbasedev->cpr.ioas_id = ioas_id;
-
-- bcontainer = &container->bcontainer;
-+ bcontainer = VFIO_IOMMU(container);
- vfio_address_space_insert(space, bcontainer);
-
- if (!iommufd_cdev_attach_container(vbasedev, container, errp)) {
-@@ -690,9 +685,8 @@ static void iommufd_cdev_detach(VFIODevice *vbasedev)
- {
- VFIOContainer *bcontainer = vbasedev->bcontainer;
- VFIOAddressSpace *space = bcontainer->space;
-- VFIOIOMMUFDContainer *container = container_of(bcontainer,
-- VFIOIOMMUFDContainer,
-- bcontainer);
-+ VFIOIOMMUFDContainer *container = VFIO_IOMMU_IOMMUFD(bcontainer);
-+
- vfio_device_unprepare(vbasedev);
-
- if (!vbasedev->ram_block_discard_allowed) {
---
-2.52.0
-
diff --git a/kvm-vfio-listener-Add-an-assertion-for-unmap_all.patch b/kvm-vfio-listener-Add-an-assertion-for-unmap_all.patch
deleted file mode 100644
index 8148675..0000000
--- a/kvm-vfio-listener-Add-an-assertion-for-unmap_all.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From d02f661a6864f285860c96012cb91483aedc6ddd Mon Sep 17 00:00:00 2001
-From: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Date: Thu, 9 Oct 2025 00:01:34 -0400
-Subject: [PATCH 104/116] vfio/listener: Add an assertion for unmap_all
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [88/100] 4ad8a0942a3c5bca0dfb7419bf0d6286a76b4216 (rovick1/qemu-kvm)
-
-Currently the maximum of iommu address space is 64bit. So when a maximum
-iommu memory section is deleted, it's in scope [0, 2^64). Add a
-assertion for that.
-
-Suggested-by: Cédric Le Goater <clg@redhat.com>
-Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20251009040134.334251-4-zhenzhong.duan@intel.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 271fec6f18492630df2e1b4599ba2de6eb1d0668)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/listener.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
-index df42bc58e7..27174bf87c 100644
---- a/hw/vfio/listener.c
-+++ b/hw/vfio/listener.c
-@@ -716,6 +716,7 @@ static void vfio_listener_region_del(MemoryListener *listener,
- bool unmap_all = false;
-
- if (int128_eq(llsize, int128_2_64())) {
-+ assert(!iova);
- unmap_all = true;
- llsize = int128_zero();
- }
---
-2.52.0
-
diff --git a/kvm-vfio-only-check-region-info-cache-for-initial-region.patch b/kvm-vfio-only-check-region-info-cache-for-initial-region.patch
deleted file mode 100644
index 02b4fc2..0000000
--- a/kvm-vfio-only-check-region-info-cache-for-initial-region.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From 9659c700e0afab65e7993459764b2e802178873b Mon Sep 17 00:00:00 2001
-From: John Levon <john.levon@nutanix.com>
-Date: Tue, 14 Oct 2025 17:12:27 +0200
-Subject: [PATCH 05/10] vfio: only check region info cache for initial regions
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Cédric Le Goater <clg@redhat.com>
-RH-MergeRequest: 414: Fixes for vfio region cache
-RH-Jira: RHEL-118810
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/2] 30b628642ee153e7da612e43aead3c6cd2de9769 (clegoate/qemu-kvm-centos)
-
-It is semantically valid for a VFIO device to increase the number of
-regions after initialization. In this case, we'd attempt to check for
-cached region info past the size of the ->reginfo array. Check for the
-region index and skip the cache in these cases.
-
-This also works around some VGPU use cases which appear to be a bug,
-where VFIO_DEVICE_QUERY_GFX_PLANE returns a region index beyond the
-reported ->num_regions.
-
-Fixes: 95cdb024 ("vfio: add region info cache")
-Signed-off-by: John Levon <john.levon@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Alex Williamson <alex@shazbot.org>
-Link: https://lore.kernel.org/qemu-devel/20251014151227.2298892-3-john.levon@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit ecbe424a63c9f860a901d6a4a75724b046abd796)
----
- hw/vfio/device.c | 27 +++++++++++++++++++--------
- 1 file changed, 19 insertions(+), 8 deletions(-)
-
-diff --git a/hw/vfio/device.c b/hw/vfio/device.c
-index 0b459c0f7c..7ebf41c95e 100644
---- a/hw/vfio/device.c
-+++ b/hw/vfio/device.c
-@@ -205,10 +205,19 @@ int vfio_device_get_region_info(VFIODevice *vbasedev, int index,
- int fd = -1;
- int ret;
-
-- /* check cache */
-- if (vbasedev->reginfo[index] != NULL) {
-- *info = vbasedev->reginfo[index];
-- return 0;
-+ /*
-+ * We only set up the region info cache for the initial number of regions.
-+ *
-+ * Since a VFIO device may later increase the number of regions then use
-+ * such regions with an index past ->num_initial_regions, don't attempt to
-+ * use the info cache in those cases.
-+ */
-+ if (index < vbasedev->num_initial_regions) {
-+ /* check cache */
-+ if (vbasedev->reginfo[index] != NULL) {
-+ *info = vbasedev->reginfo[index];
-+ return 0;
-+ }
- }
-
- *info = g_malloc0(argsz);
-@@ -236,10 +245,12 @@ retry:
- goto retry;
- }
-
-- /* fill cache */
-- vbasedev->reginfo[index] = *info;
-- if (vbasedev->region_fds != NULL) {
-- vbasedev->region_fds[index] = fd;
-+ if (index < vbasedev->num_initial_regions) {
-+ /* fill cache */
-+ vbasedev->reginfo[index] = *info;
-+ if (vbasedev->region_fds != NULL) {
-+ vbasedev->region_fds[index] = fd;
-+ }
- }
-
- return 0;
---
-2.47.3
-
diff --git a/kvm-vfio-pci-Add-ats-property.patch b/kvm-vfio-pci-Add-ats-property.patch
deleted file mode 100644
index 2c8f9af..0000000
--- a/kvm-vfio-pci-Add-ats-property.patch
+++ /dev/null
@@ -1,211 +0,0 @@
-From 81498d839f0f05e914e0c77a2264072b262069a5 Mon Sep 17 00:00:00 2001
-From: Nathan Chen <nathanc@nvidia.com>
-Date: Tue, 23 Jun 2026 13:49:42 -0700
-Subject: [PATCH 30/30] vfio/pci: Add ats property
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 508: ATS support backport
-RH-Jira: RHEL-184675
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [2/2] 18a34a15b8c4b5eed56cc3f255d64169a75d0668 (rovick1/qemu-kvm)
-
-JIRA: https://redhat.atlassian.net/browse/RHEL-184675
-
-Add an "ats" OnOffAuto property to vfio-pci. When the device has an ATS
-extended capability in config space but we should not expose it (ats=off,
-or ats=auto and kernel reports IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED), mask
-the capability so the guest does not see it.
-
-If ATS is explicitly requested but not supported by the kernel, fail
-device realize.
-
-This aligns with the kernel's per-device effective ATS reporting and allows
-vfio-pci to mask ATS when the host kernel reports ATS as unsupported.
-
-Emit a warning when ats=on is requested but the physical device does not
-advertise ATS, since ATS cannot be exposed to the guest in this case.
-
-Emit a warning when ats=auto, ats cap is present on the physical device,
-but kernel reports ATS as unsupported.
-
-Suggested-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Signed-off-by: Nathan Chen <nathanc@nvidia.com>
-Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20260623204943.989903-3-nathanc@nvidia.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit bc034e8a959c07471d1214b3525bb68fccce1031)
----
- hw/vfio/pci.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++---
- hw/vfio/pci.h | 1 +
- 2 files changed, 85 insertions(+), 4 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 6e0714a630..0160ebcfe5 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -2553,10 +2553,53 @@ static bool vfio_pci_synthesize_pasid_cap(VFIOPCIDevice *vdev, Error **errp)
- return true;
- }
-
--static void vfio_add_ext_cap(VFIOPCIDevice *vdev)
-+/*
-+ * Determine whether ATS capability should be advertised for @vdev, based on
-+ * whether it was enabled on the command line and whether it is supported
-+ * according to the kernel.
-+ *
-+ * Store whether ATS capability should be advertised in @ats_needed.
-+ *
-+ * Returns false only when ats=on is explicitly requested but the kernel
-+ * reports it is not supported. Returns true in all other cases.
-+ */
-+static bool vfio_pci_ats_requested_and_supported(VFIOPCIDevice *vdev,
-+ bool *ats_needed, Error **errp)
-+{
-+ HostIOMMUDevice *hiod = vdev->vbasedev.hiod;
-+ HostIOMMUDeviceClass *hiodc;
-+ bool ats_supported;
-+ *ats_needed = false;
-+
-+ if (vdev->ats == ON_OFF_AUTO_OFF) {
-+ return true;
-+ }
-+
-+ *ats_needed = true;
-+ if (!hiod) {
-+ return true;
-+ }
-+ hiodc = HOST_IOMMU_DEVICE_GET_CLASS(hiod);
-+ if (!hiodc || !hiodc->support_ats) {
-+ return true;
-+ }
-+
-+ ats_supported = hiodc->support_ats(hiod);
-+ if (vdev->ats == ON_OFF_AUTO_ON && !ats_supported) {
-+ error_setg(errp, "vfio-pci: ATS requested but not supported by kernel");
-+ *ats_needed = false;
-+ return false;
-+ }
-+
-+ *ats_needed = ats_supported;
-+ return true;
-+}
-+
-+static void vfio_add_ext_cap(VFIOPCIDevice *vdev, bool ats_needed)
- {
- PCIDevice *pdev = PCI_DEVICE(vdev);
- bool pasid_cap_added = false;
-+ bool ats_cap_present = false;
- Error *err = NULL;
- uint32_t header;
- uint16_t cap_id, next, size;
-@@ -2642,7 +2685,19 @@ static void vfio_add_ext_cap(VFIOPCIDevice *vdev)
- */
- case PCI_EXT_CAP_ID_PASID:
- pasid_cap_added = true;
-- /* fallthrough */
-+ pcie_add_capability(pdev, cap_id, cap_ver, next, size);
-+ break;
-+ case PCI_EXT_CAP_ID_ATS:
-+ ats_cap_present = true;
-+ /*
-+ * If ATS is requested and supported according to the kernel, add
-+ * the ATS capability. If not supported according to the kernel or
-+ * disabled on the qemu command line, omit the ATS cap.
-+ */
-+ if (ats_needed) {
-+ pcie_add_capability(pdev, cap_id, cap_ver, next, size);
-+ }
-+ break;
- default:
- pcie_add_capability(pdev, cap_id, cap_ver, next, size);
- }
-@@ -2653,6 +2708,16 @@ static void vfio_add_ext_cap(VFIOPCIDevice *vdev)
- error_report_err(err);
- }
-
-+ if (vdev->ats == ON_OFF_AUTO_ON && !ats_cap_present) {
-+ warn_report("vfio-pci: ats=on requested, but host device has no "
-+ "ATS extended capability");
-+ }
-+
-+ if (vdev->ats == ON_OFF_AUTO_AUTO && ats_cap_present && !ats_needed) {
-+ warn_report("vfio-pci: host kernel reports ATS unsupported; "
-+ "ATS capability will be masked");
-+ }
-+
- /* Cleanup chain head ID if necessary */
- if (pci_get_word(pdev->config + PCI_CONFIG_SPACE_SIZE) == 0xFFFF) {
- pci_set_word(pdev->config + PCI_CONFIG_SPACE_SIZE, 0);
-@@ -2664,6 +2729,7 @@ static void vfio_add_ext_cap(VFIOPCIDevice *vdev)
- bool vfio_pci_add_capabilities(VFIOPCIDevice *vdev, Error **errp)
- {
- PCIDevice *pdev = PCI_DEVICE(vdev);
-+ bool ats_needed = false;
-
- if (!(pdev->config[PCI_STATUS] & PCI_STATUS_CAP_LIST) ||
- !pdev->config[PCI_CAPABILITY_LIST]) {
-@@ -2674,7 +2740,11 @@ bool vfio_pci_add_capabilities(VFIOPCIDevice *vdev, Error **errp)
- return false;
- }
-
-- vfio_add_ext_cap(vdev);
-+ if (!vfio_pci_ats_requested_and_supported(vdev, &ats_needed, errp)) {
-+ return false;
-+ }
-+
-+ vfio_add_ext_cap(vdev, ats_needed);
- return true;
- }
-
-@@ -3845,6 +3915,7 @@ static const Property vfio_pci_properties[] = {
- DEFINE_PROP_BOOL("skip-vsc-check", VFIOPCIDevice, skip_vsc_check, true),
- DEFINE_PROP_UINT16("x-vpasid-cap-offset", VFIOPCIDevice,
- vpasid_cap_offset, 0),
-+ DEFINE_PROP_ON_OFF_AUTO("ats", VFIOPCIDevice, ats, ON_OFF_AUTO_AUTO),
- };
-
- #ifdef CONFIG_IOMMUFD
-@@ -4002,13 +4073,22 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data)
- "destination when doing live "
- "migration of device state via "
- "multifd channels");
-- object_class_property_set_description(klass, /* 11.0 */
-+ object_class_property_set_description(klass, /* 11.0 */
- "x-vpasid-cap-offset",
- "PCIe extended configuration space offset at which to place a "
- "synthetic PASID extended capability when PASID is enabled via "
- "a vIOMMU. A value of 0 (default) places the capability at the "
- "end of the extended configuration space. The offset must be "
- "4-byte aligned and within the PCIe extended configuration space");
-+ object_class_property_set_description(klass, /* 11.1 */
-+ "ats",
-+ "Control guest visibility of the ATS PCIe extended capability. "
-+ "Valid values are on, off, and auto (default). "
-+ "'off' always masks ATS. "
-+ "'on' requires ATS support for the device and fails realize if the "
-+ "host kernel reports ATS as unavailable for this device. "
-+ "'auto' masks ATS only when the host kernel reports "
-+ "ATS as unavailable");
- }
-
- static const TypeInfo vfio_pci_info = {
-diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
-index c1c59e4092..b651d4a3fe 100644
---- a/hw/vfio/pci.h
-+++ b/hw/vfio/pci.h
-@@ -189,6 +189,7 @@ struct VFIOPCIDevice {
- bool clear_parent_atomics_on_exit;
- bool skip_vsc_check;
- uint16_t vpasid_cap_offset;
-+ OnOffAuto ats;
- VFIODisplay *dpy;
- Notifier irqchip_change_notifier;
- VFIOPCICPR cpr;
---
-2.52.0
-
diff --git a/kvm-vfio-pci-Do-not-unparent-in-instance_finalize.patch b/kvm-vfio-pci-Do-not-unparent-in-instance_finalize.patch
deleted file mode 100644
index 9cd9ee3..0000000
--- a/kvm-vfio-pci-Do-not-unparent-in-instance_finalize.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From ae6cdc32fc4262e3b0aed7d41ec26238888c4b63 Mon Sep 17 00:00:00 2001
-From: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Date: Wed, 24 Sep 2025 13:37:21 +0900
-Subject: [PATCH 049/116] vfio/pci: Do not unparent in instance_finalize()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [33/100] a481bd02b386af864a7f3005b05198bb76812a8f (rovick1/qemu-kvm)
-
-Children are automatically unparented so manually unparenting is
-unnecessary.
-
-Worse, automatic unparenting happens before the insntance_finalize()
-callback of the parent gets called, so object_unparent() calls in
-the callback will refer to objects that are already unparented, which
-is semantically incorrect.
-
-Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-Link: https://lore.kernel.org/r/20250924-use-v4-2-07c6c598f53d@rsg.ci.i.u-tokyo.ac.jp
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit e3ed862cabce6d8a12300b941243cb44e9cd40d1)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 4 ----
- 1 file changed, 4 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index d9cdd90ea5..38ea58020d 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -2028,7 +2028,6 @@ static void vfio_bars_finalize(VFIOPCIDevice *vdev)
- vfio_region_finalize(&bar->region);
- if (bar->mr) {
- assert(bar->size);
-- object_unparent(OBJECT(bar->mr));
- g_free(bar->mr);
- bar->mr = NULL;
- }
-@@ -2036,9 +2035,6 @@ static void vfio_bars_finalize(VFIOPCIDevice *vdev)
-
- if (vdev->vga) {
- vfio_vga_quirk_finalize(vdev);
-- for (i = 0; i < ARRAY_SIZE(vdev->vga->region); i++) {
-- object_unparent(OBJECT(&vdev->vga->region[i].mem));
-- }
- g_free(vdev->vga);
- }
- }
---
-2.52.0
-
diff --git a/kvm-vfio-pci-quirks.c-use-QOM-casts-where-appropriate.patch b/kvm-vfio-pci-quirks.c-use-QOM-casts-where-appropriate.patch
deleted file mode 100644
index dc12ca2..0000000
--- a/kvm-vfio-pci-quirks.c-use-QOM-casts-where-appropriate.patch
+++ /dev/null
@@ -1,237 +0,0 @@
-From 32a31d04b92fbb5b66bf5b9b15dc74cec5785dbc Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:57 +0100
-Subject: [PATCH 043/116] vfio/pci-quirks.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [27/100] c2d0e48ad7378c49be7d0d298cae6cc11298831b (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOPCIDevice and PCIDevice instead of
-accessing pdev directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-18-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 31bfd70ef02045692d04bf53461399d3b81c0ea3)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci-quirks.c | 48 ++++++++++++++++++++++++++------------------
- 1 file changed, 29 insertions(+), 19 deletions(-)
-
-diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
-index 3f002252ac..c97606dbf1 100644
---- a/hw/vfio/pci-quirks.c
-+++ b/hw/vfio/pci-quirks.c
-@@ -113,6 +113,7 @@ static uint64_t vfio_generic_window_quirk_data_read(void *opaque,
- {
- VFIOConfigWindowQuirk *window = opaque;
- VFIOPCIDevice *vdev = window->vdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- uint64_t data;
-
- /* Always read data reg, discard if window enabled */
-@@ -120,7 +121,7 @@ static uint64_t vfio_generic_window_quirk_data_read(void *opaque,
- addr + window->data_offset, size);
-
- if (window->window_enabled) {
-- data = vfio_pci_read_config(&vdev->pdev, window->address_val, size);
-+ data = vfio_pci_read_config(pdev, window->address_val, size);
- trace_vfio_quirk_generic_window_data_read(vdev->vbasedev.name,
- memory_region_name(window->data_mem), data);
- }
-@@ -133,9 +134,10 @@ static void vfio_generic_window_quirk_data_write(void *opaque, hwaddr addr,
- {
- VFIOConfigWindowQuirk *window = opaque;
- VFIOPCIDevice *vdev = window->vdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-
- if (window->window_enabled) {
-- vfio_pci_write_config(&vdev->pdev, window->address_val, data, size);
-+ vfio_pci_write_config(pdev, window->address_val, data, size);
- trace_vfio_quirk_generic_window_data_write(vdev->vbasedev.name,
- memory_region_name(window->data_mem), data);
- return;
-@@ -156,6 +158,7 @@ static uint64_t vfio_generic_quirk_mirror_read(void *opaque,
- {
- VFIOConfigMirrorQuirk *mirror = opaque;
- VFIOPCIDevice *vdev = mirror->vdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- uint64_t data;
-
- /* Read and discard in case the hardware cares */
-@@ -163,7 +166,7 @@ static uint64_t vfio_generic_quirk_mirror_read(void *opaque,
- addr + mirror->offset, size);
-
- addr += mirror->config_offset;
-- data = vfio_pci_read_config(&vdev->pdev, addr, size);
-+ data = vfio_pci_read_config(pdev, addr, size);
- trace_vfio_quirk_generic_mirror_read(vdev->vbasedev.name,
- memory_region_name(mirror->mem),
- addr, data);
-@@ -175,9 +178,10 @@ static void vfio_generic_quirk_mirror_write(void *opaque, hwaddr addr,
- {
- VFIOConfigMirrorQuirk *mirror = opaque;
- VFIOPCIDevice *vdev = mirror->vdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-
- addr += mirror->config_offset;
-- vfio_pci_write_config(&vdev->pdev, addr, data, size);
-+ vfio_pci_write_config(pdev, addr, data, size);
- trace_vfio_quirk_generic_mirror_write(vdev->vbasedev.name,
- memory_region_name(mirror->mem),
- addr, data);
-@@ -211,7 +215,8 @@ static uint64_t vfio_ati_3c3_quirk_read(void *opaque,
- hwaddr addr, unsigned size)
- {
- VFIOPCIDevice *vdev = opaque;
-- uint64_t data = vfio_pci_read_config(&vdev->pdev,
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+ uint64_t data = vfio_pci_read_config(pdev,
- PCI_BASE_ADDRESS_4 + 1, size);
-
- trace_vfio_quirk_ati_3c3_read(vdev->vbasedev.name, data);
-@@ -563,6 +568,7 @@ static uint64_t vfio_nvidia_3d0_quirk_read(void *opaque,
- {
- VFIONvidia3d0Quirk *quirk = opaque;
- VFIOPCIDevice *vdev = quirk->vdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- VFIONvidia3d0State old_state = quirk->state;
- uint64_t data = vfio_vga_read(&vdev->vga->region[QEMU_PCI_VGA_IO_HI],
- addr + 0x10, size);
-@@ -573,7 +579,7 @@ static uint64_t vfio_nvidia_3d0_quirk_read(void *opaque,
- (quirk->offset & ~(PCI_CONFIG_SPACE_SIZE - 1)) == 0x1800) {
- uint8_t offset = quirk->offset & (PCI_CONFIG_SPACE_SIZE - 1);
-
-- data = vfio_pci_read_config(&vdev->pdev, offset, size);
-+ data = vfio_pci_read_config(pdev, offset, size);
- trace_vfio_quirk_nvidia_3d0_read(vdev->vbasedev.name,
- offset, size, data);
- }
-@@ -586,6 +592,7 @@ static void vfio_nvidia_3d0_quirk_write(void *opaque, hwaddr addr,
- {
- VFIONvidia3d0Quirk *quirk = opaque;
- VFIOPCIDevice *vdev = quirk->vdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- VFIONvidia3d0State old_state = quirk->state;
-
- quirk->state = NONE;
-@@ -599,7 +606,7 @@ static void vfio_nvidia_3d0_quirk_write(void *opaque, hwaddr addr,
- if ((quirk->offset & ~(PCI_CONFIG_SPACE_SIZE - 1)) == 0x1800) {
- uint8_t offset = quirk->offset & (PCI_CONFIG_SPACE_SIZE - 1);
-
-- vfio_pci_write_config(&vdev->pdev, offset, data, size);
-+ vfio_pci_write_config(pdev, offset, data, size);
- trace_vfio_quirk_nvidia_3d0_write(vdev->vbasedev.name,
- offset, data, size);
- return;
-@@ -815,7 +822,7 @@ static void vfio_nvidia_quirk_mirror_write(void *opaque, hwaddr addr,
- {
- VFIOConfigMirrorQuirk *mirror = opaque;
- VFIOPCIDevice *vdev = mirror->vdev;
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- LastDataSet *last = (LastDataSet *)&mirror->data;
-
- vfio_generic_quirk_mirror_write(opaque, addr, data, size);
-@@ -1005,6 +1012,7 @@ static void vfio_rtl8168_quirk_address_write(void *opaque, hwaddr addr,
- {
- VFIOrtl8168Quirk *rtl = opaque;
- VFIOPCIDevice *vdev = rtl->vdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-
- rtl->enabled = false;
-
-@@ -1013,7 +1021,7 @@ static void vfio_rtl8168_quirk_address_write(void *opaque, hwaddr addr,
- rtl->addr = (uint32_t)data;
-
- if (data & 0x80000000U) { /* Do write */
-- if (vdev->pdev.cap_present & QEMU_PCI_CAP_MSIX) {
-+ if (pdev->cap_present & QEMU_PCI_CAP_MSIX) {
- hwaddr offset = data & 0xfff;
- uint64_t val = rtl->data;
-
-@@ -1021,7 +1029,7 @@ static void vfio_rtl8168_quirk_address_write(void *opaque, hwaddr addr,
- (uint16_t)offset, val);
-
- /* Write to the proper guest MSI-X table instead */
-- memory_region_dispatch_write(&vdev->pdev.msix_table_mmio,
-+ memory_region_dispatch_write(&pdev->msix_table_mmio,
- offset, val,
- size_memop(size) | MO_LE,
- MEMTXATTRS_UNSPECIFIED);
-@@ -1049,11 +1057,12 @@ static uint64_t vfio_rtl8168_quirk_data_read(void *opaque,
- {
- VFIOrtl8168Quirk *rtl = opaque;
- VFIOPCIDevice *vdev = rtl->vdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- uint64_t data = vfio_region_read(&vdev->bars[2].region, addr + 0x70, size);
-
-- if (rtl->enabled && (vdev->pdev.cap_present & QEMU_PCI_CAP_MSIX)) {
-+ if (rtl->enabled && (pdev->cap_present & QEMU_PCI_CAP_MSIX)) {
- hwaddr offset = rtl->addr & 0xfff;
-- memory_region_dispatch_read(&vdev->pdev.msix_table_mmio, offset,
-+ memory_region_dispatch_read(&pdev->msix_table_mmio, offset,
- &data, size_memop(size) | MO_LE,
- MEMTXATTRS_UNSPECIFIED);
- trace_vfio_quirk_rtl8168_msix_read(vdev->vbasedev.name, offset, data);
-@@ -1297,7 +1306,7 @@ static void vfio_radeon_set_gfx_only_reset(VFIOPCIDevice *vdev)
-
- static int vfio_radeon_reset(VFIOPCIDevice *vdev)
- {
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int i, ret = 0;
- uint32_t data;
-
-@@ -1454,7 +1463,7 @@ static bool is_valid_std_cap_offset(uint8_t pos)
- static bool vfio_add_nv_gpudirect_cap(VFIOPCIDevice *vdev, Error **errp)
- {
- ERRP_GUARD();
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int ret, pos;
- bool c8_conflict = false, d4_conflict = false;
- uint8_t tmp;
-@@ -1547,6 +1556,7 @@ static bool vfio_add_nv_gpudirect_cap(VFIOPCIDevice *vdev, Error **errp)
- static bool vfio_add_vmd_shadow_cap(VFIOPCIDevice *vdev, Error **errp)
- {
- ERRP_GUARD();
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- uint8_t membar_phys[16];
- int ret, pos = 0xE8;
-
-@@ -1565,7 +1575,7 @@ static bool vfio_add_vmd_shadow_cap(VFIOPCIDevice *vdev, Error **errp)
- return false;
- }
-
-- ret = pci_add_capability(&vdev->pdev, PCI_CAP_ID_VNDR, pos,
-+ ret = pci_add_capability(pdev, PCI_CAP_ID_VNDR, pos,
- VMD_SHADOW_CAP_LEN, errp);
- if (ret < 0) {
- error_prepend(errp, "Failed to add VMD MEMBAR Shadow cap: ");
-@@ -1574,10 +1584,10 @@ static bool vfio_add_vmd_shadow_cap(VFIOPCIDevice *vdev, Error **errp)
-
- memset(vdev->emulated_config_bits + pos, 0xFF, VMD_SHADOW_CAP_LEN);
- pos += PCI_CAP_FLAGS;
-- pci_set_byte(vdev->pdev.config + pos++, VMD_SHADOW_CAP_LEN);
-- pci_set_byte(vdev->pdev.config + pos++, VMD_SHADOW_CAP_VER);
-- pci_set_long(vdev->pdev.config + pos, 0x53484457); /* SHDW */
-- memcpy(vdev->pdev.config + pos + 4, membar_phys, 16);
-+ pci_set_byte(pdev->config + pos++, VMD_SHADOW_CAP_LEN);
-+ pci_set_byte(pdev->config + pos++, VMD_SHADOW_CAP_VER);
-+ pci_set_long(pdev->config + pos, 0x53484457); /* SHDW */
-+ memcpy(pdev->config + pos + 4, membar_phys, 16);
-
- return true;
- }
---
-2.52.0
-
diff --git a/kvm-vfio-pci.c-rename-vfio_instance_finalize-to-vfio_pci.patch b/kvm-vfio-pci.c-rename-vfio_instance_finalize-to-vfio_pci.patch
deleted file mode 100644
index a5339d3..0000000
--- a/kvm-vfio-pci.c-rename-vfio_instance_finalize-to-vfio_pci.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 76b658cd5329cd8aa367b7fc2b0ba6cd2a518eb4 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:21 +0100
-Subject: [PATCH 063/116] vfio/pci.c: rename vfio_instance_finalize() to
- vfio_pci_finalize()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [47/100] 1d6a68586209f0528d266bfa4a258fe1d10d07f5 (rovick1/qemu-kvm)
-
-This is the more typical naming convention for QOM finalize() functions, in
-particular it changes the prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-14-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit e6fd80873a24883dc204d09f11c16e30c8cd1c37)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 4002af0c54..d30f60c21a 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -3568,7 +3568,7 @@ error:
- error_prepend(errp, VFIO_MSG_PREFIX, vbasedev->name);
- }
-
--static void vfio_instance_finalize(Object *obj)
-+static void vfio_pci_finalize(Object *obj)
- {
- VFIOPCIDevice *vdev = VFIO_PCI_BASE(obj);
-
-@@ -3939,7 +3939,7 @@ static const TypeInfo vfio_pci_dev_info = {
- .parent = TYPE_VFIO_PCI_BASE,
- .class_init = vfio_pci_dev_class_init,
- .instance_init = vfio_pci_init,
-- .instance_finalize = vfio_instance_finalize,
-+ .instance_finalize = vfio_pci_finalize,
- };
-
- static const Property vfio_pci_dev_nohotplug_properties[] = {
---
-2.52.0
-
diff --git a/kvm-vfio-pci.c-rename-vfio_instance_init-to-vfio_pci_ini.patch b/kvm-vfio-pci.c-rename-vfio_instance_init-to-vfio_pci_ini.patch
deleted file mode 100644
index edcab10..0000000
--- a/kvm-vfio-pci.c-rename-vfio_instance_init-to-vfio_pci_ini.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 2a903ed34fe1fc93a0e36b7c6dec27267257d1e4 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:20 +0100
-Subject: [PATCH 062/116] vfio/pci.c: rename vfio_instance_init() to
- vfio_pci_init()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [46/100] 56772d0a87348b63c29291d72abf90e32f3a1201 (rovick1/qemu-kvm)
-
-This is the more typical naming convention for QOM init() functions, in
-particular it changes the prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-13-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit d5db50dd819142748e10e488a2288052ec0235fd)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 38ea58020d..4002af0c54 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -3643,7 +3643,7 @@ post_reset:
- vfio_pci_post_reset(vdev);
- }
-
--static void vfio_instance_init(Object *obj)
-+static void vfio_pci_init(Object *obj)
- {
- PCIDevice *pci_dev = PCI_DEVICE(obj);
- VFIOPCIDevice *vdev = VFIO_PCI_BASE(obj);
-@@ -3938,7 +3938,7 @@ static const TypeInfo vfio_pci_dev_info = {
- .name = TYPE_VFIO_PCI,
- .parent = TYPE_VFIO_PCI_BASE,
- .class_init = vfio_pci_dev_class_init,
-- .instance_init = vfio_instance_init,
-+ .instance_init = vfio_pci_init,
- .instance_finalize = vfio_instance_finalize,
- };
-
---
-2.52.0
-
diff --git a/kvm-vfio-pci.c-rename-vfio_pci_base_dev_class_init-to-vf.patch b/kvm-vfio-pci.c-rename-vfio_pci_base_dev_class_init-to-vf.patch
deleted file mode 100644
index bd4484a..0000000
--- a/kvm-vfio-pci.c-rename-vfio_pci_base_dev_class_init-to-vf.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 7bc2dc6aeea3fc68757d816eba5b99f4735792c0 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:25 +0100
-Subject: [PATCH 068/116] vfio/pci.c: rename vfio_pci_base_dev_class_init() to
- vfio_pci_device_class_init()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [52/100] df1c185ff24360560eadae0ca7f414de6c073d34 (rovick1/qemu-kvm)
-
-This changes the function prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-18-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 153273f2796a664b08120799f326c6319f640011)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 937283bcc6..5380cf0c53 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -3674,7 +3674,7 @@ static void vfio_pci_init(Object *obj)
- pci_dev->cap_present |= QEMU_PCI_SKIP_RESET_ON_CPR;
- }
-
--static void vfio_pci_base_dev_class_init(ObjectClass *klass, const void *data)
-+static void vfio_pci_device_class_init(ObjectClass *klass, const void *data)
- {
- DeviceClass *dc = DEVICE_CLASS(klass);
- PCIDeviceClass *pdc = PCI_DEVICE_CLASS(klass);
-@@ -3691,7 +3691,7 @@ static const TypeInfo vfio_pci_base_dev_info = {
- .parent = TYPE_PCI_DEVICE,
- .instance_size = sizeof(VFIOPCIDevice),
- .abstract = true,
-- .class_init = vfio_pci_base_dev_class_init,
-+ .class_init = vfio_pci_device_class_init,
- .interfaces = (const InterfaceInfo[]) {
- { INTERFACE_PCIE_DEVICE },
- { INTERFACE_CONVENTIONAL_PCI_DEVICE },
---
-2.52.0
-
diff --git a/kvm-vfio-pci.c-rename-vfio_pci_base_dev_info-to-vfio_pci.patch b/kvm-vfio-pci.c-rename-vfio_pci_base_dev_info-to-vfio_pci.patch
deleted file mode 100644
index 2225a33..0000000
--- a/kvm-vfio-pci.c-rename-vfio_pci_base_dev_info-to-vfio_pci.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 40a277966e442e55e2ebfb21764709d35ba27519 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:26 +0100
-Subject: [PATCH 069/116] vfio/pci.c: rename vfio_pci_base_dev_info to
- vfio_pci_device_info
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [53/100] 229bbd7ea6501e1defd957bd9cc9c2ad59ab7cb0 (rovick1/qemu-kvm)
-
-This changes the prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-19-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 596b158ffd727465fbeb9fff9a22b7ea7a341bc3)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 5380cf0c53..9e96f7d306 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -3686,7 +3686,7 @@ static void vfio_pci_device_class_init(ObjectClass *klass, const void *data)
- pdc->config_write = vfio_pci_write_config;
- }
-
--static const TypeInfo vfio_pci_base_dev_info = {
-+static const TypeInfo vfio_pci_device_info = {
- .name = TYPE_VFIO_PCI_DEVICE,
- .parent = TYPE_PCI_DEVICE,
- .instance_size = sizeof(VFIOPCIDevice),
-@@ -3991,7 +3991,7 @@ static void register_vfio_pci_dev_type(void)
- vfio_pci_migration_multifd_transfer_prop = qdev_prop_on_off_auto;
- vfio_pci_migration_multifd_transfer_prop.realized_set_allowed = true;
-
-- type_register_static(&vfio_pci_base_dev_info);
-+ type_register_static(&vfio_pci_device_info);
- type_register_static(&vfio_pci_info);
- type_register_static(&vfio_pci_nohotplug_dev_info);
- }
---
-2.52.0
-
diff --git a/kvm-vfio-pci.c-rename-vfio_pci_dev_class_init-to-vfio_pc.patch b/kvm-vfio-pci.c-rename-vfio_pci_dev_class_init-to-vfio_pc.patch
deleted file mode 100644
index 238a072..0000000
--- a/kvm-vfio-pci.c-rename-vfio_pci_dev_class_init-to-vfio_pc.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From c0751ea51b4b91ae48f86e5a33715b7c458e0a68 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:22 +0100
-Subject: [PATCH 064/116] vfio/pci.c: rename vfio_pci_dev_class_init() to
- vfio_pci_class_init()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [48/100] dc121b3bf306f7f933a2858eb264bfb89b07bf36 (rovick1/qemu-kvm)
-
-This changes the function prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-15-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 784fa15f02fc0adbf8897f5c3012652174cc7274)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index d30f60c21a..96a0d8b290 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -3785,7 +3785,7 @@ static void vfio_pci_set_fd(Object *obj, const char *str, Error **errp)
- }
- #endif
-
--static void vfio_pci_dev_class_init(ObjectClass *klass, const void *data)
-+static void vfio_pci_class_init(ObjectClass *klass, const void *data)
- {
- DeviceClass *dc = DEVICE_CLASS(klass);
- PCIDeviceClass *pdc = PCI_DEVICE_CLASS(klass);
-@@ -3937,7 +3937,7 @@ static void vfio_pci_dev_class_init(ObjectClass *klass, const void *data)
- static const TypeInfo vfio_pci_dev_info = {
- .name = TYPE_VFIO_PCI,
- .parent = TYPE_VFIO_PCI_BASE,
-- .class_init = vfio_pci_dev_class_init,
-+ .class_init = vfio_pci_class_init,
- .instance_init = vfio_pci_init,
- .instance_finalize = vfio_pci_finalize,
- };
---
-2.52.0
-
diff --git a/kvm-vfio-pci.c-rename-vfio_pci_dev_info-to-vfio_pci_info.patch b/kvm-vfio-pci.c-rename-vfio_pci_dev_info-to-vfio_pci_info.patch
deleted file mode 100644
index 98c63b4..0000000
--- a/kvm-vfio-pci.c-rename-vfio_pci_dev_info-to-vfio_pci_info.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 89a252c44c9acc995d34d1c77c7f652bc4994a06 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:23 +0100
-Subject: [PATCH 065/116] vfio/pci.c: rename vfio_pci_dev_info to vfio_pci_info
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [49/100] e7837d38dc5250bfd3130e2088729b4e9850d307 (rovick1/qemu-kvm)
-
-This changes the prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-16-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 25c8376b37948d7608b1a13f43e985fc801295e5)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 96a0d8b290..fd8d8f7e32 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -3934,7 +3934,7 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data)
- "multifd channels");
- }
-
--static const TypeInfo vfio_pci_dev_info = {
-+static const TypeInfo vfio_pci_info = {
- .name = TYPE_VFIO_PCI,
- .parent = TYPE_VFIO_PCI_BASE,
- .class_init = vfio_pci_class_init,
-@@ -3992,7 +3992,7 @@ static void register_vfio_pci_dev_type(void)
- vfio_pci_migration_multifd_transfer_prop.realized_set_allowed = true;
-
- type_register_static(&vfio_pci_base_dev_info);
-- type_register_static(&vfio_pci_dev_info);
-+ type_register_static(&vfio_pci_info);
- type_register_static(&vfio_pci_nohotplug_dev_info);
- }
-
---
-2.52.0
-
diff --git a/kvm-vfio-pci.c-rename-vfio_pci_dev_nohotplug_properties-.patch b/kvm-vfio-pci.c-rename-vfio_pci_dev_nohotplug_properties-.patch
deleted file mode 100644
index c23164b..0000000
--- a/kvm-vfio-pci.c-rename-vfio_pci_dev_nohotplug_properties-.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 45ff92e2f3f4684ca5c910e0e94f3f883f40988e Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:28 +0100
-Subject: [PATCH 071/116] vfio/pci.c: rename
- vfio_pci_dev_nohotplug_properties[] to vfio_pci_nohotplug_properties[]
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [55/100] f5a45ca34a156360ccd20eea400b80fd27f1d9f1 (rovick1/qemu-kvm)
-
-This changes the prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-21-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 05530ba2462f37fd55d72bdab31a7a5c29ab7519)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index ae84907aca..339324987c 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -3942,7 +3942,7 @@ static const TypeInfo vfio_pci_info = {
- .instance_finalize = vfio_pci_finalize,
- };
-
--static const Property vfio_pci_dev_nohotplug_properties[] = {
-+static const Property vfio_pci_nohotplug_properties[] = {
- DEFINE_PROP_BOOL("ramfb", VFIOPCIDevice, enable_ramfb, false),
- DEFINE_PROP_BOOL("use-legacy-x86-rom", VFIOPCIDevice,
- use_legacy_x86_rom, false),
-@@ -3955,7 +3955,7 @@ static void vfio_pci_nohotplug_dev_class_init(ObjectClass *klass,
- {
- DeviceClass *dc = DEVICE_CLASS(klass);
-
-- device_class_set_props(dc, vfio_pci_dev_nohotplug_properties);
-+ device_class_set_props(dc, vfio_pci_nohotplug_properties);
- dc->hotpluggable = false;
-
- object_class_property_set_description(klass, /* 3.1 */
---
-2.52.0
-
diff --git a/kvm-vfio-pci.c-rename-vfio_pci_dev_properties-to-vfio_pc.patch b/kvm-vfio-pci.c-rename-vfio_pci_dev_properties-to-vfio_pc.patch
deleted file mode 100644
index c0ae814..0000000
--- a/kvm-vfio-pci.c-rename-vfio_pci_dev_properties-to-vfio_pc.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 0ceb3f374c9b6f18aacb2bbb79a69cc7559bd3d2 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:27 +0100
-Subject: [PATCH 070/116] vfio/pci.c: rename vfio_pci_dev_properties[] to
- vfio_pci_properties[]
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [54/100] f8c9842e23be50ca7077ea3645676d96cf865c60 (rovick1/qemu-kvm)
-
-This changes the prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-20-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 7c53e1f43ee365ee5061dd30d60c21a55eefbfce)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 9e96f7d306..ae84907aca 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -3701,7 +3701,7 @@ static const TypeInfo vfio_pci_device_info = {
-
- static PropertyInfo vfio_pci_migration_multifd_transfer_prop;
-
--static const Property vfio_pci_dev_properties[] = {
-+static const Property vfio_pci_properties[] = {
- DEFINE_PROP_PCI_HOST_DEVADDR("host", VFIOPCIDevice, host),
- DEFINE_PROP_UUID_NODEFAULT("vf-token", VFIOPCIDevice, vf_token),
- DEFINE_PROP_STRING("sysfsdev", VFIOPCIDevice, vbasedev.sysfsdev),
-@@ -3791,7 +3791,7 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data)
- PCIDeviceClass *pdc = PCI_DEVICE_CLASS(klass);
-
- device_class_set_legacy_reset(dc, vfio_pci_reset);
-- device_class_set_props(dc, vfio_pci_dev_properties);
-+ device_class_set_props(dc, vfio_pci_properties);
- #ifdef CONFIG_IOMMUFD
- object_class_property_add_str(klass, "fd", NULL, vfio_pci_set_fd);
- #endif
---
-2.52.0
-
diff --git a/kvm-vfio-pci.c-rename-vfio_pci_nohotplug_dev_class_init-.patch b/kvm-vfio-pci.c-rename-vfio_pci_nohotplug_dev_class_init-.patch
deleted file mode 100644
index 48dad8a..0000000
--- a/kvm-vfio-pci.c-rename-vfio_pci_nohotplug_dev_class_init-.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 7a71a92eb375cc03dfa5f7a6822465d917f38aeb Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:29 +0100
-Subject: [PATCH 072/116] vfio/pci.c: rename
- vfio_pci_nohotplug_dev_class_init() to vfio_pci_nohotplug_class_init()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [56/100] 3da726c4974320a800d8c27b80480f15ab45e734 (rovick1/qemu-kvm)
-
-This changes the function prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-22-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit cc44b39c274b35f1510725f60dd95af59d0bd3fb)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 339324987c..2b453fffcd 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -3950,7 +3950,7 @@ static const Property vfio_pci_nohotplug_properties[] = {
- ON_OFF_AUTO_AUTO),
- };
-
--static void vfio_pci_nohotplug_dev_class_init(ObjectClass *klass,
-+static void vfio_pci_nohotplug_class_init(ObjectClass *klass,
- const void *data)
- {
- DeviceClass *dc = DEVICE_CLASS(klass);
-@@ -3975,7 +3975,7 @@ static const TypeInfo vfio_pci_nohotplug_dev_info = {
- .name = TYPE_VFIO_PCI_NOHOTPLUG,
- .parent = TYPE_VFIO_PCI,
- .instance_size = sizeof(VFIOPCIDevice),
-- .class_init = vfio_pci_nohotplug_dev_class_init,
-+ .class_init = vfio_pci_nohotplug_class_init,
- };
-
- static void register_vfio_pci_dev_type(void)
---
-2.52.0
-
diff --git a/kvm-vfio-pci.c-rename-vfio_pci_nohotplug_dev_info-to-vfi.patch b/kvm-vfio-pci.c-rename-vfio_pci_nohotplug_dev_info-to-vfi.patch
deleted file mode 100644
index bd6beb8..0000000
--- a/kvm-vfio-pci.c-rename-vfio_pci_nohotplug_dev_info-to-vfi.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 5a616f38e879907a109b239e24ec670cbb89e3bb Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:30 +0100
-Subject: [PATCH 073/116] vfio/pci.c: rename vfio_pci_nohotplug_dev_info to
- vfio_pci_nohotplug_info
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [57/100] a86275cbf9578d7c1b888495f60c5b292338a801 (rovick1/qemu-kvm)
-
-This changes the prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-23-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 5bdf0db823869a210434b5048d20dce5e686b7aa)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 2b453fffcd..c34ed85d5e 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -3971,7 +3971,7 @@ static void vfio_pci_nohotplug_class_init(ObjectClass *klass,
- "Controls loading of a legacy VGA BIOS ROM");
- }
-
--static const TypeInfo vfio_pci_nohotplug_dev_info = {
-+static const TypeInfo vfio_pci_nohotplug_info = {
- .name = TYPE_VFIO_PCI_NOHOTPLUG,
- .parent = TYPE_VFIO_PCI,
- .instance_size = sizeof(VFIOPCIDevice),
-@@ -3993,7 +3993,7 @@ static void register_vfio_pci_dev_type(void)
-
- type_register_static(&vfio_pci_device_info);
- type_register_static(&vfio_pci_info);
-- type_register_static(&vfio_pci_nohotplug_dev_info);
-+ type_register_static(&vfio_pci_nohotplug_info);
- }
-
- type_init(register_vfio_pci_dev_type)
---
-2.52.0
-
diff --git a/kvm-vfio-pci.c-use-QOM-casts-where-appropriate.patch b/kvm-vfio-pci.c-use-QOM-casts-where-appropriate.patch
deleted file mode 100644
index d8a9093..0000000
--- a/kvm-vfio-pci.c-use-QOM-casts-where-appropriate.patch
+++ /dev/null
@@ -1,826 +0,0 @@
-From 3bdae047cf5f3c0a0223d05ab17a81f0c70207aa Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:56 +0100
-Subject: [PATCH 042/116] vfio/pci.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [26/100] b8431428007b0f056600d0ab79970fb302acf6a7 (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOPCIDevice and PCIDevice instead of
-accessing pdev directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-17-mark.caveayland@nutanix.com
-[ clg: Updated vfio_sub_page_bar_update_mappings() ]
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 77f143cc418121fb30ad9e26dd90334dcf5851fc)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.c | 204 ++++++++++++++++++++++++++++++--------------------
- 1 file changed, 121 insertions(+), 83 deletions(-)
-
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 58ab1116d8..8525a8640e 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -120,6 +120,7 @@ static void vfio_intx_mmap_enable(void *opaque)
- static void vfio_intx_interrupt(void *opaque)
- {
- VFIOPCIDevice *vdev = opaque;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-
- if (!event_notifier_test_and_clear(&vdev->intx.interrupt)) {
- return;
-@@ -128,7 +129,7 @@ static void vfio_intx_interrupt(void *opaque)
- trace_vfio_intx_interrupt(vdev->vbasedev.name, 'A' + vdev->intx.pin);
-
- vdev->intx.pending = true;
-- pci_irq_assert(&vdev->pdev);
-+ pci_irq_assert(pdev);
- vfio_mmap_set_enabled(vdev, false);
- if (vdev->intx.mmap_timeout) {
- timer_mod(vdev->intx.mmap_timer,
-@@ -139,6 +140,7 @@ static void vfio_intx_interrupt(void *opaque)
- void vfio_pci_intx_eoi(VFIODevice *vbasedev)
- {
- VFIOPCIDevice *vdev = container_of(vbasedev, VFIOPCIDevice, vbasedev);
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-
- if (!vdev->intx.pending) {
- return;
-@@ -147,13 +149,14 @@ void vfio_pci_intx_eoi(VFIODevice *vbasedev)
- trace_vfio_pci_intx_eoi(vbasedev->name);
-
- vdev->intx.pending = false;
-- pci_irq_deassert(&vdev->pdev);
-+ pci_irq_deassert(pdev);
- vfio_device_irq_unmask(vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
- }
-
- static bool vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp)
- {
- #ifdef CONFIG_KVM
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int irq_fd = event_notifier_get_fd(&vdev->intx.interrupt);
-
- if (vdev->no_kvm_intx || !kvm_irqfds_enabled() ||
-@@ -166,7 +169,7 @@ static bool vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp)
- qemu_set_fd_handler(irq_fd, NULL, NULL, vdev);
- vfio_device_irq_mask(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
- vdev->intx.pending = false;
-- pci_irq_deassert(&vdev->pdev);
-+ pci_irq_deassert(pdev);
-
- /* Get an eventfd for resample/unmask */
- if (!vfio_notifier_init(vdev, &vdev->intx.unmask, "intx-unmask", 0, errp)) {
-@@ -244,6 +247,8 @@ static bool vfio_cpr_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp)
- static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev)
- {
- #ifdef CONFIG_KVM
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+
- if (!vdev->intx.kvm_accel) {
- return;
- }
-@@ -254,7 +259,7 @@ static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev)
- */
- vfio_device_irq_mask(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
- vdev->intx.pending = false;
-- pci_irq_deassert(&vdev->pdev);
-+ pci_irq_deassert(pdev);
-
- /* Tell KVM to stop listening for an INTx irqfd */
- if (kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, &vdev->intx.interrupt,
-@@ -310,7 +315,7 @@ static void vfio_intx_routing_notifier(PCIDevice *pdev)
- return;
- }
-
-- route = pci_device_route_intx_to_irq(&vdev->pdev, vdev->intx.pin);
-+ route = pci_device_route_intx_to_irq(pdev, vdev->intx.pin);
-
- if (pci_intx_route_changed(&vdev->intx.route, &route)) {
- vfio_intx_update(vdev, &route);
-@@ -327,7 +332,8 @@ static void vfio_irqchip_change(Notifier *notify, void *data)
-
- static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
- {
-- uint8_t pin = vfio_pci_read_config(&vdev->pdev, PCI_INTERRUPT_PIN, 1);
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+ uint8_t pin = vfio_pci_read_config(pdev, PCI_INTERRUPT_PIN, 1);
- Error *err = NULL;
- int32_t fd;
-
-@@ -345,7 +351,7 @@ static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
- }
-
- vdev->intx.pin = pin - 1; /* Pin A (1) -> irq[0] */
-- pci_config_set_interrupt_pin(vdev->pdev.config, pin);
-+ pci_config_set_interrupt_pin(pdev->config, pin);
-
- #ifdef CONFIG_KVM
- /*
-@@ -353,7 +359,7 @@ static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
- * where we won't actually use the result anyway.
- */
- if (kvm_irqfds_enabled() && kvm_resamplefds_enabled()) {
-- vdev->intx.route = pci_device_route_intx_to_irq(&vdev->pdev,
-+ vdev->intx.route = pci_device_route_intx_to_irq(pdev,
- vdev->intx.pin);
- }
- #endif
-@@ -393,13 +399,14 @@ skip_signaling:
-
- static void vfio_intx_disable(VFIOPCIDevice *vdev)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int fd;
-
- timer_del(vdev->intx.mmap_timer);
- vfio_intx_disable_kvm(vdev);
- vfio_device_irq_disable(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
- vdev->intx.pending = false;
-- pci_irq_deassert(&vdev->pdev);
-+ pci_irq_deassert(pdev);
- vfio_mmap_set_enabled(vdev, true);
-
- fd = event_notifier_get_fd(&vdev->intx.interrupt);
-@@ -431,6 +438,7 @@ static void vfio_msi_interrupt(void *opaque)
- {
- VFIOMSIVector *vector = opaque;
- VFIOPCIDevice *vdev = vector->vdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- MSIMessage (*get_msg)(PCIDevice *dev, unsigned vector);
- void (*notify)(PCIDevice *dev, unsigned vector);
- MSIMessage msg;
-@@ -445,9 +453,9 @@ static void vfio_msi_interrupt(void *opaque)
- notify = msix_notify;
-
- /* A masked vector firing needs to use the PBA, enable it */
-- if (msix_is_masked(&vdev->pdev, nr)) {
-+ if (msix_is_masked(pdev, nr)) {
- set_bit(nr, vdev->msix->pending);
-- memory_region_set_enabled(&vdev->pdev.msix_pba_mmio, true);
-+ memory_region_set_enabled(&pdev->msix_pba_mmio, true);
- trace_vfio_msix_pba_enable(vdev->vbasedev.name);
- }
- } else if (vdev->interrupt == VFIO_INT_MSI) {
-@@ -457,9 +465,9 @@ static void vfio_msi_interrupt(void *opaque)
- abort();
- }
-
-- msg = get_msg(&vdev->pdev, nr);
-+ msg = get_msg(pdev, nr);
- trace_vfio_msi_interrupt(vdev->vbasedev.name, nr, msg.address, msg.data);
-- notify(&vdev->pdev, nr);
-+ notify(pdev, nr);
- }
-
- void vfio_pci_msi_set_handler(VFIOPCIDevice *vdev, int nr, bool enable)
-@@ -498,6 +506,7 @@ static int vfio_enable_msix_no_vec(VFIOPCIDevice *vdev)
-
- static int vfio_enable_vectors(VFIOPCIDevice *vdev, bool msix)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- struct vfio_irq_set *irq_set;
- int ret = 0, i, argsz;
- int32_t *fds;
-@@ -540,7 +549,7 @@ static int vfio_enable_vectors(VFIOPCIDevice *vdev, bool msix)
- */
- if (vdev->msi_vectors[i].use) {
- if (vdev->msi_vectors[i].virq < 0 ||
-- (msix && msix_is_masked(&vdev->pdev, i))) {
-+ (msix && msix_is_masked(pdev, i))) {
- fd = event_notifier_get_fd(&vdev->msi_vectors[i].interrupt);
- } else {
- fd = event_notifier_get_fd(&vdev->msi_vectors[i].kvm_interrupt);
-@@ -560,12 +569,14 @@ static int vfio_enable_vectors(VFIOPCIDevice *vdev, bool msix)
- void vfio_pci_add_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector,
- int vector_n, bool msix)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+
- if ((msix && vdev->no_kvm_msix) || (!msix && vdev->no_kvm_msi)) {
- return;
- }
-
- vector->virq = kvm_irqchip_add_msi_route(&vfio_route_change,
-- vector_n, &vdev->pdev);
-+ vector_n, pdev);
- }
-
- static void vfio_connect_kvm_msi_virq(VFIOMSIVector *vector, int nr)
-@@ -634,7 +645,7 @@ static void set_irq_signalling(VFIODevice *vbasedev, VFIOMSIVector *vector,
- void vfio_pci_vector_init(VFIOPCIDevice *vdev, int nr)
- {
- VFIOMSIVector *vector = &vdev->msi_vectors[nr];
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- Error *local_err = NULL;
-
- vector->vdev = vdev;
-@@ -723,7 +734,7 @@ static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
- clear_bit(nr, vdev->msix->pending);
- if (find_first_bit(vdev->msix->pending,
- vdev->nr_vectors) == vdev->nr_vectors) {
-- memory_region_set_enabled(&vdev->pdev.msix_pba_mmio, false);
-+ memory_region_set_enabled(&pdev->msix_pba_mmio, false);
- trace_vfio_msix_pba_disable(vdev->vbasedev.name);
- }
-
-@@ -774,7 +785,9 @@ static void vfio_msix_vector_release(PCIDevice *pdev, unsigned int nr)
-
- void vfio_pci_msix_set_notifiers(VFIOPCIDevice *vdev)
- {
-- msix_set_vector_notifiers(&vdev->pdev, vfio_msix_vector_use,
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+
-+ msix_set_vector_notifiers(pdev, vfio_msix_vector_use,
- vfio_msix_vector_release, NULL);
- }
-
-@@ -801,6 +814,7 @@ void vfio_pci_commit_kvm_msi_virq_batch(VFIOPCIDevice *vdev)
-
- static void vfio_msix_enable(VFIOPCIDevice *vdev)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int ret;
-
- vfio_disable_interrupts(vdev);
-@@ -817,7 +831,7 @@ static void vfio_msix_enable(VFIOPCIDevice *vdev)
- */
- vfio_pci_prepare_kvm_msi_virq_batch(vdev);
-
-- if (msix_set_vector_notifiers(&vdev->pdev, vfio_msix_vector_use,
-+ if (msix_set_vector_notifiers(pdev, vfio_msix_vector_use,
- vfio_msix_vector_release, NULL)) {
- error_report("vfio: msix_set_vector_notifiers failed");
- }
-@@ -855,11 +869,12 @@ static void vfio_msix_enable(VFIOPCIDevice *vdev)
-
- static void vfio_msi_enable(VFIOPCIDevice *vdev)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int ret, i;
-
- vfio_disable_interrupts(vdev);
-
-- vdev->nr_vectors = msi_nr_vectors_allocated(&vdev->pdev);
-+ vdev->nr_vectors = msi_nr_vectors_allocated(pdev);
- retry:
- /*
- * Setting vector notifiers needs to enable route for each vector.
-@@ -952,10 +967,11 @@ static void vfio_msi_disable_common(VFIOPCIDevice *vdev)
-
- static void vfio_msix_disable(VFIOPCIDevice *vdev)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- Error *err = NULL;
- int i;
-
-- msix_unset_vector_notifiers(&vdev->pdev);
-+ msix_unset_vector_notifiers(pdev);
-
- /*
- * MSI-X will only release vectors if MSI-X is still enabled on the
-@@ -963,8 +979,8 @@ static void vfio_msix_disable(VFIOPCIDevice *vdev)
- */
- for (i = 0; i < vdev->nr_vectors; i++) {
- if (vdev->msi_vectors[i].use) {
-- vfio_msix_vector_release(&vdev->pdev, i);
-- msix_vector_unuse(&vdev->pdev, i);
-+ vfio_msix_vector_release(pdev, i);
-+ msix_vector_unuse(pdev, i);
- }
- }
-
-@@ -1001,6 +1017,7 @@ static void vfio_msi_disable(VFIOPCIDevice *vdev)
-
- static void vfio_update_msi(VFIOPCIDevice *vdev)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int i;
-
- for (i = 0; i < vdev->nr_vectors; i++) {
-@@ -1011,8 +1028,8 @@ static void vfio_update_msi(VFIOPCIDevice *vdev)
- continue;
- }
-
-- msg = msi_get_message(&vdev->pdev, i);
-- vfio_update_kvm_msi_virq(vector, msg, &vdev->pdev);
-+ msg = msi_get_message(pdev, i);
-+ vfio_update_kvm_msi_virq(vector, msg, pdev);
- }
- }
-
-@@ -1174,13 +1191,14 @@ static const MemoryRegionOps vfio_rom_ops = {
-
- static void vfio_pci_size_rom(VFIOPCIDevice *vdev)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- VFIODevice *vbasedev = &vdev->vbasedev;
- uint32_t orig, size = cpu_to_le32((uint32_t)PCI_ROM_ADDRESS_MASK);
- char *name;
-
-- if (vdev->pdev.romfile || !vdev->pdev.rom_bar) {
-+ if (pdev->romfile || !pdev->rom_bar) {
- /* Since pci handles romfile, just print a message and return */
-- if (vfio_opt_rom_in_denylist(vdev) && vdev->pdev.romfile) {
-+ if (vfio_opt_rom_in_denylist(vdev) && pdev->romfile) {
- warn_report("Device at %s is known to cause system instability"
- " issues during option rom execution",
- vdev->vbasedev.name);
-@@ -1209,7 +1227,7 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev)
- }
-
- if (vfio_opt_rom_in_denylist(vdev)) {
-- if (vdev->pdev.rom_bar > 0) {
-+ if (pdev->rom_bar > 0) {
- warn_report("Device at %s is known to cause system instability"
- " issues during option rom execution",
- vdev->vbasedev.name);
-@@ -1228,12 +1246,12 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev)
-
- name = g_strdup_printf("vfio[%s].rom", vdev->vbasedev.name);
-
-- memory_region_init_io(&vdev->pdev.rom, OBJECT(vdev),
-+ memory_region_init_io(&pdev->rom, OBJECT(vdev),
- &vfio_rom_ops, vdev, name, size);
- g_free(name);
-
-- pci_register_bar(&vdev->pdev, PCI_ROM_SLOT,
-- PCI_BASE_ADDRESS_SPACE_MEMORY, &vdev->pdev.rom);
-+ pci_register_bar(pdev, PCI_ROM_SLOT,
-+ PCI_BASE_ADDRESS_SPACE_MEMORY, &pdev->rom);
-
- vdev->rom_read_failed = false;
- }
-@@ -1506,6 +1524,7 @@ static void vfio_disable_interrupts(VFIOPCIDevice *vdev)
-
- static bool vfio_msi_setup(VFIOPCIDevice *vdev, int pos, Error **errp)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- uint16_t ctrl;
- bool msi_64bit, msi_maskbit;
- int ret, entries;
-@@ -1526,7 +1545,7 @@ static bool vfio_msi_setup(VFIOPCIDevice *vdev, int pos, Error **errp)
-
- trace_vfio_msi_setup(vdev->vbasedev.name, pos);
-
-- ret = msi_init(&vdev->pdev, pos, entries, msi_64bit, msi_maskbit, &err);
-+ ret = msi_init(pdev, pos, entries, msi_64bit, msi_maskbit, &err);
- if (ret < 0) {
- if (ret == -ENOTSUP) {
- return true;
-@@ -1719,6 +1738,7 @@ static bool vfio_pci_relocate_msix(VFIOPCIDevice *vdev, Error **errp)
- */
- static bool vfio_msix_early_setup(VFIOPCIDevice *vdev, Error **errp)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- uint8_t pos;
- uint16_t ctrl;
- uint32_t table, pba;
-@@ -1726,7 +1746,7 @@ static bool vfio_msix_early_setup(VFIOPCIDevice *vdev, Error **errp)
- VFIOMSIXInfo *msix;
- int ret;
-
-- pos = pci_find_capability(&vdev->pdev, PCI_CAP_ID_MSIX);
-+ pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
- if (!pos) {
- return true;
- }
-@@ -1818,12 +1838,13 @@ static bool vfio_msix_early_setup(VFIOPCIDevice *vdev, Error **errp)
-
- static bool vfio_msix_setup(VFIOPCIDevice *vdev, int pos, Error **errp)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int ret;
- Error *err = NULL;
-
- vdev->msix->pending = g_new0(unsigned long,
- BITS_TO_LONGS(vdev->msix->entries));
-- ret = msix_init(&vdev->pdev, vdev->msix->entries,
-+ ret = msix_init(pdev, vdev->msix->entries,
- vdev->bars[vdev->msix->table_bar].mr,
- vdev->msix->table_bar, vdev->msix->table_offset,
- vdev->bars[vdev->msix->pba_bar].mr,
-@@ -1855,7 +1876,7 @@ static bool vfio_msix_setup(VFIOPCIDevice *vdev, int pos, Error **errp)
- * vector-use notifier is called, which occurs on unmask, we test whether
- * PBA emulation is needed and again disable if not.
- */
-- memory_region_set_enabled(&vdev->pdev.msix_pba_mmio, false);
-+ memory_region_set_enabled(&pdev->msix_pba_mmio, false);
-
- /*
- * The emulated machine may provide a paravirt interface for MSIX setup
-@@ -1867,7 +1888,7 @@ static bool vfio_msix_setup(VFIOPCIDevice *vdev, int pos, Error **errp)
- */
- if (object_property_get_bool(OBJECT(qdev_get_machine()),
- "vfio-no-msix-emulation", NULL)) {
-- memory_region_set_enabled(&vdev->pdev.msix_table_mmio, false);
-+ memory_region_set_enabled(&pdev->msix_table_mmio, false);
- }
-
- return true;
-@@ -1875,10 +1896,12 @@ static bool vfio_msix_setup(VFIOPCIDevice *vdev, int pos, Error **errp)
-
- void vfio_pci_teardown_msi(VFIOPCIDevice *vdev)
- {
-- msi_uninit(&vdev->pdev);
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+
-+ msi_uninit(pdev);
-
- if (vdev->msix) {
-- msix_uninit(&vdev->pdev,
-+ msix_uninit(pdev,
- vdev->bars[vdev->msix->table_bar].mr,
- vdev->bars[vdev->msix->pba_bar].mr);
- g_free(vdev->msix->pending);
-@@ -1939,6 +1962,7 @@ static void vfio_bars_prepare(VFIOPCIDevice *vdev)
-
- static void vfio_bar_register(VFIOPCIDevice *vdev, int nr)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- VFIOBAR *bar = &vdev->bars[nr];
- char *name;
-
-@@ -1960,7 +1984,7 @@ static void vfio_bar_register(VFIOPCIDevice *vdev, int nr)
- }
- }
-
-- pci_register_bar(&vdev->pdev, nr, bar->type, bar->mr);
-+ pci_register_bar(pdev, nr, bar->type, bar->mr);
- }
-
- static void vfio_bars_register(VFIOPCIDevice *vdev)
-@@ -1974,6 +1998,7 @@ static void vfio_bars_register(VFIOPCIDevice *vdev)
-
- void vfio_pci_bars_exit(VFIOPCIDevice *vdev)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int i;
-
- for (i = 0; i < PCI_ROM_SLOT; i++) {
-@@ -1987,7 +2012,7 @@ void vfio_pci_bars_exit(VFIOPCIDevice *vdev)
- }
-
- if (vdev->vga) {
-- pci_unregister_vga(&vdev->pdev);
-+ pci_unregister_vga(pdev);
- vfio_vga_quirk_exit(vdev);
- }
- }
-@@ -2059,8 +2084,10 @@ static void vfio_set_word_bits(uint8_t *buf, uint16_t val, uint16_t mask)
- static void vfio_add_emulated_word(VFIOPCIDevice *vdev, int pos,
- uint16_t val, uint16_t mask)
- {
-- vfio_set_word_bits(vdev->pdev.config + pos, val, mask);
-- vfio_set_word_bits(vdev->pdev.wmask + pos, ~mask, mask);
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+
-+ vfio_set_word_bits(pdev->config + pos, val, mask);
-+ vfio_set_word_bits(pdev->wmask + pos, ~mask, mask);
- vfio_set_word_bits(vdev->emulated_config_bits + pos, mask, mask);
- }
-
-@@ -2072,8 +2099,10 @@ static void vfio_set_long_bits(uint8_t *buf, uint32_t val, uint32_t mask)
- static void vfio_add_emulated_long(VFIOPCIDevice *vdev, int pos,
- uint32_t val, uint32_t mask)
- {
-- vfio_set_long_bits(vdev->pdev.config + pos, val, mask);
-- vfio_set_long_bits(vdev->pdev.wmask + pos, ~mask, mask);
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+
-+ vfio_set_long_bits(pdev->config + pos, val, mask);
-+ vfio_set_long_bits(pdev->wmask + pos, ~mask, mask);
- vfio_set_long_bits(vdev->emulated_config_bits + pos, mask, mask);
- }
-
-@@ -2081,7 +2110,8 @@ static void vfio_pci_enable_rp_atomics(VFIOPCIDevice *vdev)
- {
- struct vfio_device_info_cap_pci_atomic_comp *cap;
- g_autofree struct vfio_device_info *info = NULL;
-- PCIBus *bus = pci_get_bus(&vdev->pdev);
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+ PCIBus *bus = pci_get_bus(pdev);
- PCIDevice *parent = bus->parent_dev;
- struct vfio_info_cap_header *hdr;
- uint32_t mask = 0;
-@@ -2097,8 +2127,8 @@ static void vfio_pci_enable_rp_atomics(VFIOPCIDevice *vdev)
- if (pci_bus_is_root(bus) || !parent || !parent->exp.exp_cap ||
- pcie_cap_get_type(parent) != PCI_EXP_TYPE_ROOT_PORT ||
- pcie_cap_get_version(parent) != PCI_EXP_FLAGS_VER2 ||
-- vdev->pdev.devfn ||
-- vdev->pdev.cap_present & QEMU_PCI_CAP_MULTIFUNCTION) {
-+ pdev->devfn ||
-+ pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) {
- return;
- }
-
-@@ -2142,8 +2172,10 @@ static void vfio_pci_enable_rp_atomics(VFIOPCIDevice *vdev)
-
- static void vfio_pci_disable_rp_atomics(VFIOPCIDevice *vdev)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+
- if (vdev->clear_parent_atomics_on_exit) {
-- PCIDevice *parent = pci_get_bus(&vdev->pdev)->parent_dev;
-+ PCIDevice *parent = pci_get_bus(pdev)->parent_dev;
- uint8_t *pos = parent->config + parent->exp.exp_cap + PCI_EXP_DEVCAP2;
-
- pci_long_test_and_clear_mask(pos, PCI_EXP_DEVCAP2_ATOMIC_COMP32 |
-@@ -2155,10 +2187,11 @@ static void vfio_pci_disable_rp_atomics(VFIOPCIDevice *vdev)
- static bool vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size,
- Error **errp)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- uint16_t flags;
- uint8_t type;
-
-- flags = pci_get_word(vdev->pdev.config + pos + PCI_CAP_FLAGS);
-+ flags = pci_get_word(pdev->config + pos + PCI_CAP_FLAGS);
- type = (flags & PCI_EXP_FLAGS_TYPE) >> 4;
-
- if (type != PCI_EXP_TYPE_ENDPOINT &&
-@@ -2170,8 +2203,8 @@ static bool vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size,
- return false;
- }
-
-- if (!pci_bus_is_express(pci_get_bus(&vdev->pdev))) {
-- PCIBus *bus = pci_get_bus(&vdev->pdev);
-+ if (!pci_bus_is_express(pci_get_bus(pdev))) {
-+ PCIBus *bus = pci_get_bus(pdev);
- PCIDevice *bridge;
-
- /*
-@@ -2203,7 +2236,7 @@ static bool vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size,
- return true;
- }
-
-- } else if (pci_bus_is_root(pci_get_bus(&vdev->pdev))) {
-+ } else if (pci_bus_is_root(pci_get_bus(pdev))) {
- /*
- * On a Root Complex bus Endpoints become Root Complex Integrated
- * Endpoints, which changes the type and clears the LNK & LNK2 fields.
-@@ -2271,20 +2304,20 @@ static bool vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size,
- 1, PCI_EXP_FLAGS_VERS);
- }
-
-- pos = pci_add_capability(&vdev->pdev, PCI_CAP_ID_EXP, pos, size,
-- errp);
-+ pos = pci_add_capability(pdev, PCI_CAP_ID_EXP, pos, size, errp);
- if (pos < 0) {
- return false;
- }
-
-- vdev->pdev.exp.exp_cap = pos;
-+ pdev->exp.exp_cap = pos;
-
- return true;
- }
-
- static void vfio_check_pcie_flr(VFIOPCIDevice *vdev, uint8_t pos)
- {
-- uint32_t cap = pci_get_long(vdev->pdev.config + pos + PCI_EXP_DEVCAP);
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+ uint32_t cap = pci_get_long(pdev->config + pos + PCI_EXP_DEVCAP);
-
- if (cap & PCI_EXP_DEVCAP_FLR) {
- trace_vfio_check_pcie_flr(vdev->vbasedev.name);
-@@ -2294,7 +2327,8 @@ static void vfio_check_pcie_flr(VFIOPCIDevice *vdev, uint8_t pos)
-
- static void vfio_check_pm_reset(VFIOPCIDevice *vdev, uint8_t pos)
- {
-- uint16_t csr = pci_get_word(vdev->pdev.config + pos + PCI_PM_CTRL);
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+ uint16_t csr = pci_get_word(pdev->config + pos + PCI_PM_CTRL);
-
- if (!(csr & PCI_PM_CTRL_NO_SOFT_RESET)) {
- trace_vfio_check_pm_reset(vdev->vbasedev.name);
-@@ -2304,7 +2338,8 @@ static void vfio_check_pm_reset(VFIOPCIDevice *vdev, uint8_t pos)
-
- static void vfio_check_af_flr(VFIOPCIDevice *vdev, uint8_t pos)
- {
-- uint8_t cap = pci_get_byte(vdev->pdev.config + pos + PCI_AF_CAP);
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-+ uint8_t cap = pci_get_byte(pdev->config + pos + PCI_AF_CAP);
-
- if ((cap & PCI_AF_CAP_TP) && (cap & PCI_AF_CAP_FLR)) {
- trace_vfio_check_af_flr(vdev->vbasedev.name);
-@@ -2315,7 +2350,7 @@ static void vfio_check_af_flr(VFIOPCIDevice *vdev, uint8_t pos)
- static bool vfio_add_vendor_specific_cap(VFIOPCIDevice *vdev, int pos,
- uint8_t size, Error **errp)
- {
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-
- pos = pci_add_capability(pdev, PCI_CAP_ID_VNDR, pos, size, errp);
- if (pos < 0) {
-@@ -2337,7 +2372,7 @@ static bool vfio_add_vendor_specific_cap(VFIOPCIDevice *vdev, int pos,
- static bool vfio_add_std_cap(VFIOPCIDevice *vdev, uint8_t pos, Error **errp)
- {
- ERRP_GUARD();
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- uint8_t cap_id, next, size;
- bool ret;
-
-@@ -2423,17 +2458,18 @@ static bool vfio_add_std_cap(VFIOPCIDevice *vdev, uint8_t pos, Error **errp)
-
- static int vfio_setup_rebar_ecap(VFIOPCIDevice *vdev, uint16_t pos)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- uint32_t ctrl;
- int i, nbar;
-
-- ctrl = pci_get_long(vdev->pdev.config + pos + PCI_REBAR_CTRL);
-+ ctrl = pci_get_long(pdev->config + pos + PCI_REBAR_CTRL);
- nbar = (ctrl & PCI_REBAR_CTRL_NBAR_MASK) >> PCI_REBAR_CTRL_NBAR_SHIFT;
-
- for (i = 0; i < nbar; i++) {
- uint32_t cap;
- int size;
-
-- ctrl = pci_get_long(vdev->pdev.config + pos + PCI_REBAR_CTRL + (i * 8));
-+ ctrl = pci_get_long(pdev->config + pos + PCI_REBAR_CTRL + (i * 8));
- size = (ctrl & PCI_REBAR_CTRL_BAR_SIZE) >> PCI_REBAR_CTRL_BAR_SHIFT;
-
- /* The cap register reports sizes 1MB to 128TB, with 4 reserved bits */
-@@ -2471,7 +2507,7 @@ static int vfio_setup_rebar_ecap(VFIOPCIDevice *vdev, uint16_t pos)
-
- static void vfio_add_ext_cap(VFIOPCIDevice *vdev)
- {
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- uint32_t header;
- uint16_t cap_id, next, size;
- uint8_t cap_ver;
-@@ -2565,7 +2601,7 @@ static void vfio_add_ext_cap(VFIOPCIDevice *vdev)
-
- bool vfio_pci_add_capabilities(VFIOPCIDevice *vdev, Error **errp)
- {
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-
- if (!(pdev->config[PCI_STATUS] & PCI_STATUS_CAP_LIST) ||
- !pdev->config[PCI_CAPABILITY_LIST]) {
-@@ -2582,7 +2618,7 @@ bool vfio_pci_add_capabilities(VFIOPCIDevice *vdev, Error **errp)
-
- void vfio_pci_pre_reset(VFIOPCIDevice *vdev)
- {
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- uint16_t cmd;
-
- vfio_disable_interrupts(vdev);
-@@ -2799,7 +2835,7 @@ static int vfio_pci_save_config(VFIODevice *vbasedev, QEMUFile *f, Error **errp)
- static int vfio_pci_load_config(VFIODevice *vbasedev, QEMUFile *f)
- {
- VFIOPCIDevice *vdev = container_of(vbasedev, VFIOPCIDevice, vbasedev);
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- pcibus_t old_addr[PCI_NUM_REGIONS - 1];
- int bar, ret;
-
-@@ -2847,7 +2883,7 @@ VFIOPCIDevice *vfio_pci_from_vfio_device(VFIODevice *vbasedev)
-
- void vfio_sub_page_bar_update_mappings(VFIOPCIDevice *vdev)
- {
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- int page_size = qemu_real_host_page_size();
- int bar;
-
-@@ -2931,6 +2967,7 @@ bool vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp)
-
- bool vfio_pci_populate_device(VFIOPCIDevice *vdev, Error **errp)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- VFIODevice *vbasedev = &vdev->vbasedev;
- struct vfio_region_info *reg_info = NULL;
- struct vfio_irq_info irq_info;
-@@ -2982,7 +3019,7 @@ bool vfio_pci_populate_device(VFIOPCIDevice *vdev, Error **errp)
-
- vdev->config_size = reg_info->size;
- if (vdev->config_size == PCI_CONFIG_SPACE_SIZE) {
-- vdev->pdev.cap_present &= ~QEMU_PCI_CAP_EXPRESS;
-+ pdev->cap_present &= ~QEMU_PCI_CAP_EXPRESS;
- }
- vdev->config_offset = reg_info->offset;
-
-@@ -3186,25 +3223,26 @@ static void vfio_unregister_req_notifier(VFIOPCIDevice *vdev)
-
- void vfio_pci_config_register_vga(VFIOPCIDevice *vdev)
- {
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- assert(vdev->vga != NULL);
-
-- pci_register_vga(&vdev->pdev, &vdev->vga->region[QEMU_PCI_VGA_MEM].mem,
-+ pci_register_vga(pdev, &vdev->vga->region[QEMU_PCI_VGA_MEM].mem,
- &vdev->vga->region[QEMU_PCI_VGA_IO_LO].mem,
- &vdev->vga->region[QEMU_PCI_VGA_IO_HI].mem);
- }
-
- bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Error **errp)
- {
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- VFIODevice *vbasedev = &vdev->vbasedev;
- uint32_t config_space_size;
- int ret;
-
-- config_space_size = MIN(pci_config_size(&vdev->pdev), vdev->config_size);
-+ config_space_size = MIN(pci_config_size(pdev), vdev->config_size);
-
- /* Get a copy of config space */
- ret = vfio_pci_config_space_read(vdev, 0, config_space_size,
-- vdev->pdev.config);
-+ pdev->config);
- if (ret < (int)config_space_size) {
- ret = ret < 0 ? -ret : EFAULT;
- error_setg_errno(errp, ret, "failed to read device config space");
-@@ -3289,10 +3327,10 @@ bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Error **errp)
- PCI_HEADER_TYPE_MULTI_FUNCTION;
-
- /* Restore or clear multifunction, this is always controlled by QEMU */
-- if (vdev->pdev.cap_present & QEMU_PCI_CAP_MULTIFUNCTION) {
-- vdev->pdev.config[PCI_HEADER_TYPE] |= PCI_HEADER_TYPE_MULTI_FUNCTION;
-+ if (pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) {
-+ pdev->config[PCI_HEADER_TYPE] |= PCI_HEADER_TYPE_MULTI_FUNCTION;
- } else {
-- vdev->pdev.config[PCI_HEADER_TYPE] &= ~PCI_HEADER_TYPE_MULTI_FUNCTION;
-+ pdev->config[PCI_HEADER_TYPE] &= ~PCI_HEADER_TYPE_MULTI_FUNCTION;
- }
-
- /*
-@@ -3300,8 +3338,8 @@ bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Error **errp)
- * BAR, such as might be the case with the option ROM, we can get
- * confusing, unwritable, residual addresses from the host here.
- */
-- memset(&vdev->pdev.config[PCI_BASE_ADDRESS_0], 0, 24);
-- memset(&vdev->pdev.config[PCI_ROM_ADDRESS], 0, 4);
-+ memset(&pdev->config[PCI_BASE_ADDRESS_0], 0, 24);
-+ memset(&pdev->config[PCI_ROM_ADDRESS], 0, 4);
-
- vfio_pci_size_rom(vdev);
-
-@@ -3322,7 +3360,7 @@ bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Error **errp)
-
- bool vfio_pci_interrupt_setup(VFIOPCIDevice *vdev, Error **errp)
- {
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
-
- /* QEMU emulates all of MSI & MSIX */
- if (pdev->cap_present & QEMU_PCI_CAP_MSIX) {
-@@ -3335,10 +3373,10 @@ bool vfio_pci_interrupt_setup(VFIOPCIDevice *vdev, Error **errp)
- vdev->msi_cap_size);
- }
-
-- if (vfio_pci_read_config(&vdev->pdev, PCI_INTERRUPT_PIN, 1)) {
-+ if (vfio_pci_read_config(pdev, PCI_INTERRUPT_PIN, 1)) {
- vdev->intx.mmap_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL,
- vfio_intx_mmap_enable, vdev);
-- pci_device_set_intx_routing_notifier(&vdev->pdev,
-+ pci_device_set_intx_routing_notifier(pdev,
- vfio_intx_routing_notifier);
- vdev->irqchip_change_notifier.notify = vfio_irqchip_change;
- kvm_irqchip_add_change_notifier(&vdev->irqchip_change_notifier);
-@@ -3350,7 +3388,7 @@ bool vfio_pci_interrupt_setup(VFIOPCIDevice *vdev, Error **errp)
- */
- if (!cpr_is_incoming() && !vfio_intx_enable(vdev, errp)) {
- timer_free(vdev->intx.mmap_timer);
-- pci_device_set_intx_routing_notifier(&vdev->pdev, NULL);
-+ pci_device_set_intx_routing_notifier(pdev, NULL);
- kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier);
- return false;
- }
-@@ -3516,7 +3554,7 @@ out_deregister:
- if (vdev->interrupt == VFIO_INT_INTx) {
- vfio_intx_disable(vdev);
- }
-- pci_device_set_intx_routing_notifier(&vdev->pdev, NULL);
-+ pci_device_set_intx_routing_notifier(pdev, NULL);
- if (vdev->irqchip_change_notifier.notify) {
- kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier);
- }
-@@ -3548,7 +3586,7 @@ static void vfio_exitfn(PCIDevice *pdev)
-
- vfio_unregister_req_notifier(vdev);
- vfio_unregister_err_notifier(vdev);
-- pci_device_set_intx_routing_notifier(&vdev->pdev, NULL);
-+ pci_device_set_intx_routing_notifier(pdev, NULL);
- if (vdev->irqchip_change_notifier.notify) {
- kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier);
- }
---
-2.52.0
-
diff --git a/kvm-vfio-pci.h-rename-VFIOPCIDevice-pdev-field-to-parent.patch b/kvm-vfio-pci.h-rename-VFIOPCIDevice-pdev-field-to-parent.patch
deleted file mode 100644
index 53a37af..0000000
--- a/kvm-vfio-pci.h-rename-VFIOPCIDevice-pdev-field-to-parent.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From 140c54e956b284cbb96874e7f003f71d0e727984 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:26:02 +0100
-Subject: [PATCH 047/116] vfio/pci.h: rename VFIOPCIDevice pdev field to
- parent_obj
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [31/100] d8dc488ce4e8c2cdec8db0f0e90715513194b2b2 (rovick1/qemu-kvm)
-
-Now that nothing accesses the pdev field directly, rename pdev to
-parent_obj as per our current coding guidelines.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-23-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit bb986792a968ee51cda72cd4cc05822198495375)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/cpr.c | 4 ++--
- hw/vfio/pci.c | 4 ++--
- hw/vfio/pci.h | 2 +-
- 3 files changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c
-index f911988add..2c71fc1e8e 100644
---- a/hw/vfio/cpr.c
-+++ b/hw/vfio/cpr.c
-@@ -173,8 +173,8 @@ const VMStateDescription vfio_cpr_pci_vmstate = {
- .post_load = vfio_cpr_pci_post_load,
- .needed = cpr_incoming_needed,
- .fields = (VMStateField[]) {
-- VMSTATE_PCI_DEVICE(pdev, VFIOPCIDevice),
-- VMSTATE_MSIX_TEST(pdev, VFIOPCIDevice, pci_msix_present),
-+ VMSTATE_PCI_DEVICE(parent_obj, VFIOPCIDevice),
-+ VMSTATE_MSIX_TEST(parent_obj, VFIOPCIDevice, pci_msix_present),
- VMSTATE_VFIO_INTX(intx, VFIOPCIDevice),
- VMSTATE_END_OF_LIST()
- }
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 8525a8640e..d9cdd90ea5 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -2814,8 +2814,8 @@ static const VMStateDescription vmstate_vfio_pci_config = {
- .version_id = 1,
- .minimum_version_id = 1,
- .fields = (const VMStateField[]) {
-- VMSTATE_PCI_DEVICE(pdev, VFIOPCIDevice),
-- VMSTATE_MSIX_TEST(pdev, VFIOPCIDevice, vfio_msix_present),
-+ VMSTATE_PCI_DEVICE(parent_obj, VFIOPCIDevice),
-+ VMSTATE_MSIX_TEST(parent_obj, VFIOPCIDevice, vfio_msix_present),
- VMSTATE_END_OF_LIST()
- },
- .subsections = (const VMStateDescription * const []) {
-diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
-index 08bab970cb..dd419f9147 100644
---- a/hw/vfio/pci.h
-+++ b/hw/vfio/pci.h
-@@ -123,7 +123,7 @@ typedef struct VFIOMSIXInfo {
- OBJECT_DECLARE_SIMPLE_TYPE(VFIOPCIDevice, VFIO_PCI_BASE)
-
- struct VFIOPCIDevice {
-- PCIDevice pdev;
-+ PCIDevice parent_obj;
-
- VFIODevice vbasedev;
- VFIOINTx intx;
---
-2.52.0
-
diff --git a/kvm-vfio-pci.h-update-VFIOPCIDevice-declaration.patch b/kvm-vfio-pci.h-update-VFIOPCIDevice-declaration.patch
deleted file mode 100644
index 56eeb7b..0000000
--- a/kvm-vfio-pci.h-update-VFIOPCIDevice-declaration.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 49c47201b804596abd07a01540873cf8818d0049 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:54 +0100
-Subject: [PATCH 041/116] vfio/pci.h: update VFIOPCIDevice declaration
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [25/100] d8ed3b3ddb415b5d777bbd928ba2014c4f1ad8d6 (rovick1/qemu-kvm)
-
-Update the VFIOPCIDevice declaration so that it is closer to our coding
-guidelines: add a blank line after the parent object.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-15-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 750e424fd04311aaeeb85536744c4cd3e460404d)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/pci.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
-index e3ab3fe1f7..08bab970cb 100644
---- a/hw/vfio/pci.h
-+++ b/hw/vfio/pci.h
-@@ -124,6 +124,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(VFIOPCIDevice, VFIO_PCI_BASE)
-
- struct VFIOPCIDevice {
- PCIDevice pdev;
-+
- VFIODevice vbasedev;
- VFIOINTx intx;
- unsigned int config_size;
---
-2.52.0
-
diff --git a/kvm-vfio-region-Clarify-dma-buf-failure-messages.patch b/kvm-vfio-region-Clarify-dma-buf-failure-messages.patch
deleted file mode 100644
index 55ad8f6..0000000
--- a/kvm-vfio-region-Clarify-dma-buf-failure-messages.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From c5a8a9187f8395f35218cb6e301ee777f4a0da7b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
-Date: Wed, 15 Jul 2026 10:00:00 +0200
-Subject: [PATCH] vfio/region: Clarify dma-buf failure messages
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 514: vfio/region: Clarify dma-buf failure messages
-RH-Jira: RHEL-224652
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [1/1] 290b4b792bd444608b01bab64514a0e0725e9f89 (rovick1/qemu-kvm)
-
-The dma-buf failure messages in vfio_region_create_dma_buf() say "PCI
-BAR IOMMU mappings may fail", which suggests the BAR is broken. In
-practice, only P2P DMA is affected -- normal passthrough uses the mmap
-fallback.
-
-Reword both messages to mention P2P DMA explicitly and clarify that
-the mmap fallback is in use. Use warn_report_err_once() at the call
-site so per-BAR repetition on mdev devices is suppressed.
-
-Fixes: dcf1b77e834d ("hw/vfio/region: Create dmabuf for PCI BAR per region")
-Cc: Nicolin Chen <nicolinc@nvidia.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 4b2e6505d59b7b16c6e15a2494942d00648e8510)
----
- hw/vfio/region.c | 11 +++++------
- 1 file changed, 5 insertions(+), 6 deletions(-)
-
-diff --git a/hw/vfio/region.c b/hw/vfio/region.c
-index 1e9915fdd3..9258ab6847 100644
---- a/hw/vfio/region.c
-+++ b/hw/vfio/region.c
-@@ -316,13 +316,12 @@ static bool vfio_region_create_dma_buf(VFIORegion *region, Error **errp)
- ret = vfio_device_get_feature(vbasedev, feature);
- if (ret < 0) {
- if (ret == -ENOTTY) {
-- warn_report_once("VFIO dma-buf not supported in kernel: "
-- "PCI BAR IOMMU mappings may fail");
-+ warn_report_once("VFIO dma-buf not supported in kernel, "
-+ "using mmap fallback, P2P DMA will not work");
- return true;
- }
-- /* P2P DMA or exposing device memory use cases are not supported. */
-- error_setg_errno(errp, -ret, "%s: failed to create dma-buf: "
-- "PCI BAR IOMMU mappings may fail",
-+ error_setg_errno(errp, -ret, "%s: dma-buf unavailable, "
-+ "using mmap fallback, P2P DMA will not work",
- memory_region_name(region->mem));
- return false;
- }
-@@ -443,7 +442,7 @@ int vfio_region_mmap(VFIORegion *region)
- }
-
- if (!vfio_region_create_dma_buf(region, &local_err)) {
-- error_report_err(local_err);
-+ warn_report_err_once(local_err);
- }
-
- return 0;
---
-2.52.0
-
diff --git a/kvm-vfio-rename-field-to-num_initial_regions.patch b/kvm-vfio-rename-field-to-num_initial_regions.patch
deleted file mode 100644
index 84b624d..0000000
--- a/kvm-vfio-rename-field-to-num_initial_regions.patch
+++ /dev/null
@@ -1,253 +0,0 @@
-From de33fcdabae841dba89fae781d6391164b22740f Mon Sep 17 00:00:00 2001
-From: John Levon <john.levon@nutanix.com>
-Date: Tue, 14 Oct 2025 17:12:26 +0200
-Subject: [PATCH 04/10] vfio: rename field to "num_initial_regions"
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Cédric Le Goater <clg@redhat.com>
-RH-MergeRequest: 414: Fixes for vfio region cache
-RH-Jira: RHEL-118810
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/2] 62524d77e79b6a57c4e61762cd61449280e4f2cd (clegoate/qemu-kvm-centos)
-
-We set VFIODevice::num_regions at initialization time, and do not
-otherwise refresh it. As it is valid in theory for a VFIO device to
-later increase the number of supported regions, rename the field to
-"num_initial_regions" to better reflect its semantics.
-
-Signed-off-by: John Levon <john.levon@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Alex Williamson <alex@shazbot.org>
-Link: https://lore.kernel.org/qemu-devel/20251014151227.2298892-2-john.levon@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit aaca725884b57c9245528a0afb3f32e078543faf)
-
-Conflicts: Modified hw/core/sysbus-fdt.c and hw/vfio/platform.c
----
- hw/core/sysbus-fdt.c | 14 +++++++-------
- hw/vfio-user/device.c | 2 +-
- hw/vfio/ccw.c | 4 ++--
- hw/vfio/device.c | 12 ++++++------
- hw/vfio/iommufd.c | 3 ++-
- hw/vfio/pci.c | 4 ++--
- hw/vfio/platform.c | 10 +++++-----
- include/hw/vfio/vfio-device.h | 2 +-
- 8 files changed, 26 insertions(+), 25 deletions(-)
-
-diff --git a/hw/core/sysbus-fdt.c b/hw/core/sysbus-fdt.c
-index c339a27875..1e1966813f 100644
---- a/hw/core/sysbus-fdt.c
-+++ b/hw/core/sysbus-fdt.c
-@@ -236,15 +236,15 @@ static int add_calxeda_midway_xgmac_fdt_node(SysBusDevice *sbdev, void *opaque)
-
- qemu_fdt_setprop(fdt, nodename, "dma-coherent", "", 0);
-
-- reg_attr = g_new(uint32_t, vbasedev->num_regions * 2);
-- for (i = 0; i < vbasedev->num_regions; i++) {
-+ reg_attr = g_new(uint32_t, vbasedev->num_initial_regions * 2);
-+ for (i = 0; i < vbasedev->num_initial_regions; i++) {
- mmio_base = platform_bus_get_mmio_addr(pbus, sbdev, i);
- reg_attr[2 * i] = cpu_to_be32(mmio_base);
- reg_attr[2 * i + 1] = cpu_to_be32(
- memory_region_size(vdev->regions[i]->mem));
- }
- qemu_fdt_setprop(fdt, nodename, "reg", reg_attr,
-- vbasedev->num_regions * 2 * sizeof(uint32_t));
-+ vbasedev->num_initial_regions * 2 * sizeof(uint32_t));
-
- irq_attr = g_new(uint32_t, vbasedev->num_irqs * 3);
- for (i = 0; i < vbasedev->num_irqs; i++) {
-@@ -330,7 +330,7 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque)
-
- g_free(dt_name);
-
-- if (vbasedev->num_regions != 5) {
-+ if (vbasedev->num_initial_regions != 5) {
- error_report("%s Does the host dt node combine XGBE/PHY?", __func__);
- exit(1);
- }
-@@ -374,15 +374,15 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque)
- guest_clock_phandles[0],
- guest_clock_phandles[1]);
-
-- reg_attr = g_new(uint32_t, vbasedev->num_regions * 2);
-- for (i = 0; i < vbasedev->num_regions; i++) {
-+ reg_attr = g_new(uint32_t, vbasedev->num_initial_regions * 2);
-+ for (i = 0; i < vbasedev->num_initial_regions; i++) {
- mmio_base = platform_bus_get_mmio_addr(pbus, sbdev, i);
- reg_attr[2 * i] = cpu_to_be32(mmio_base);
- reg_attr[2 * i + 1] = cpu_to_be32(
- memory_region_size(vdev->regions[i]->mem));
- }
- qemu_fdt_setprop(guest_fdt, nodename, "reg", reg_attr,
-- vbasedev->num_regions * 2 * sizeof(uint32_t));
-+ vbasedev->num_initial_regions * 2 * sizeof(uint32_t));
-
- irq_attr = g_new(uint32_t, vbasedev->num_irqs * 3);
- for (i = 0; i < vbasedev->num_irqs; i++) {
-diff --git a/hw/vfio-user/device.c b/hw/vfio-user/device.c
-index 0609a7dc25..64ef35b320 100644
---- a/hw/vfio-user/device.c
-+++ b/hw/vfio-user/device.c
-@@ -134,7 +134,7 @@ static int vfio_user_device_io_get_region_info(VFIODevice *vbasedev,
- VFIOUserFDs fds = { 0, 1, fd};
- int ret;
-
-- if (info->index > vbasedev->num_regions) {
-+ if (info->index > vbasedev->num_initial_regions) {
- return -EINVAL;
- }
-
-diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
-index 9560b8d851..4d9588e7aa 100644
---- a/hw/vfio/ccw.c
-+++ b/hw/vfio/ccw.c
-@@ -484,9 +484,9 @@ static bool vfio_ccw_get_region(VFIOCCWDevice *vcdev, Error **errp)
- * We always expect at least the I/O region to be present. We also
- * may have a variable number of regions governed by capabilities.
- */
-- if (vdev->num_regions < VFIO_CCW_CONFIG_REGION_INDEX + 1) {
-+ if (vdev->num_initial_regions < VFIO_CCW_CONFIG_REGION_INDEX + 1) {
- error_setg(errp, "vfio: too few regions (%u), expected at least %u",
-- vdev->num_regions, VFIO_CCW_CONFIG_REGION_INDEX + 1);
-+ vdev->num_initial_regions, VFIO_CCW_CONFIG_REGION_INDEX + 1);
- return false;
- }
-
-diff --git a/hw/vfio/device.c b/hw/vfio/device.c
-index 52a1996dc4..0b459c0f7c 100644
---- a/hw/vfio/device.c
-+++ b/hw/vfio/device.c
-@@ -257,7 +257,7 @@ int vfio_device_get_region_info_type(VFIODevice *vbasedev, uint32_t type,
- {
- int i;
-
-- for (i = 0; i < vbasedev->num_regions; i++) {
-+ for (i = 0; i < vbasedev->num_initial_regions; i++) {
- struct vfio_info_cap_header *hdr;
- struct vfio_region_info_cap_type *cap_type;
-
-@@ -466,7 +466,7 @@ void vfio_device_prepare(VFIODevice *vbasedev, VFIOContainerBase *bcontainer,
- int i;
-
- vbasedev->num_irqs = info->num_irqs;
-- vbasedev->num_regions = info->num_regions;
-+ vbasedev->num_initial_regions = info->num_regions;
- vbasedev->flags = info->flags;
- vbasedev->reset_works = !!(info->flags & VFIO_DEVICE_FLAGS_RESET);
-
-@@ -476,10 +476,10 @@ void vfio_device_prepare(VFIODevice *vbasedev, VFIOContainerBase *bcontainer,
- QLIST_INSERT_HEAD(&vfio_device_list, vbasedev, global_next);
-
- vbasedev->reginfo = g_new0(struct vfio_region_info *,
-- vbasedev->num_regions);
-+ vbasedev->num_initial_regions);
- if (vbasedev->use_region_fds) {
-- vbasedev->region_fds = g_new0(int, vbasedev->num_regions);
-- for (i = 0; i < vbasedev->num_regions; i++) {
-+ vbasedev->region_fds = g_new0(int, vbasedev->num_initial_regions);
-+ for (i = 0; i < vbasedev->num_initial_regions; i++) {
- vbasedev->region_fds[i] = -1;
- }
- }
-@@ -489,7 +489,7 @@ void vfio_device_unprepare(VFIODevice *vbasedev)
- {
- int i;
-
-- for (i = 0; i < vbasedev->num_regions; i++) {
-+ for (i = 0; i < vbasedev->num_initial_regions; i++) {
- g_free(vbasedev->reginfo[i]);
- if (vbasedev->region_fds != NULL && vbasedev->region_fds[i] != -1) {
- close(vbasedev->region_fds[i]);
-diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
-index 48c590b6a9..dbcd861b27 100644
---- a/hw/vfio/iommufd.c
-+++ b/hw/vfio/iommufd.c
-@@ -668,7 +668,8 @@ found_container:
- vfio_iommufd_cpr_register_device(vbasedev);
-
- trace_iommufd_cdev_device_info(vbasedev->name, devfd, vbasedev->num_irqs,
-- vbasedev->num_regions, vbasedev->flags);
-+ vbasedev->num_initial_regions,
-+ vbasedev->flags);
- return true;
-
- err_listener_register:
-diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
-index 48da233cb2..9486521a90 100644
---- a/hw/vfio/pci.c
-+++ b/hw/vfio/pci.c
-@@ -2933,9 +2933,9 @@ bool vfio_pci_populate_device(VFIOPCIDevice *vdev, Error **errp)
- return false;
- }
-
-- if (vbasedev->num_regions < VFIO_PCI_CONFIG_REGION_INDEX + 1) {
-+ if (vbasedev->num_initial_regions < VFIO_PCI_CONFIG_REGION_INDEX + 1) {
- error_setg(errp, "unexpected number of io regions %u",
-- vbasedev->num_regions);
-+ vbasedev->num_initial_regions);
- return false;
- }
-
-diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
-index 5c1795a26f..c9349ba7b7 100644
---- a/hw/vfio/platform.c
-+++ b/hw/vfio/platform.c
-@@ -148,7 +148,7 @@ static void vfio_mmap_set_enabled(VFIOPlatformDevice *vdev, bool enabled)
- {
- int i;
-
-- for (i = 0; i < vdev->vbasedev.num_regions; i++) {
-+ for (i = 0; i < vdev->vbasedev.num_initial_regions; i++) {
- vfio_region_mmaps_set_enabled(vdev->regions[i], enabled);
- }
- }
-@@ -453,9 +453,9 @@ static bool vfio_populate_device(VFIODevice *vbasedev, Error **errp)
- return false;
- }
-
-- vdev->regions = g_new0(VFIORegion *, vbasedev->num_regions);
-+ vdev->regions = g_new0(VFIORegion *, vbasedev->num_initial_regions);
-
-- for (i = 0; i < vbasedev->num_regions; i++) {
-+ for (i = 0; i < vbasedev->num_initial_regions; i++) {
- char *name = g_strdup_printf("VFIO %s region %d\n", vbasedev->name, i);
-
- vdev->regions[i] = g_new0(VFIORegion, 1);
-@@ -499,7 +499,7 @@ irq_err:
- g_free(intp);
- }
- reg_error:
-- for (i = 0; i < vbasedev->num_regions; i++) {
-+ for (i = 0; i < vbasedev->num_initial_regions; i++) {
- if (vdev->regions[i]) {
- vfio_region_finalize(vdev->regions[i]);
- }
-@@ -608,7 +608,7 @@ static void vfio_platform_realize(DeviceState *dev, Error **errp)
- }
- }
-
-- for (i = 0; i < vbasedev->num_regions; i++) {
-+ for (i = 0; i < vbasedev->num_initial_regions; i++) {
- if (vfio_region_mmap(vdev->regions[i])) {
- warn_report("%s mmap unsupported, performance may be slow",
- memory_region_name(vdev->regions[i]->mem));
-diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h
-index 9290774299..df81d319b2 100644
---- a/include/hw/vfio/vfio-device.h
-+++ b/include/hw/vfio/vfio-device.h
-@@ -74,7 +74,7 @@ typedef struct VFIODevice {
- VFIODeviceOps *ops;
- VFIODeviceIOOps *io_ops;
- unsigned int num_irqs;
-- unsigned int num_regions;
-+ unsigned int num_initial_regions;
- unsigned int flags;
- VFIOMigration *migration;
- Error *migration_blocker;
---
-2.47.3
-
diff --git a/kvm-vfio-scsi-ui-Error-check-qio_channel_socket_connect_.patch b/kvm-vfio-scsi-ui-Error-check-qio_channel_socket_connect_.patch
deleted file mode 100644
index 4a69178..0000000
--- a/kvm-vfio-scsi-ui-Error-check-qio_channel_socket_connect_.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-From 481a0c91e004873fd5d28bc82bbe11ebba2901f9 Mon Sep 17 00:00:00 2001
-From: Markus Armbruster <armbru@redhat.com>
-Date: Wed, 23 Jul 2025 15:32:57 +0200
-Subject: [PATCH 018/116] vfio scsi ui: Error-check
- qio_channel_socket_connect_sync() the same way
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [2/100] f61dd6e10ef6ff7b143fd59a1550b62237ba0ac6 (rovick1/qemu-kvm)
-
-qio_channel_socket_connect_sync() returns 0 on success, and -1 on
-failure, with errp set. Some callers check the return value, and some
-check whether errp was set.
-
-For consistency, always check the return value, and always check it's
-negative.
-
-Signed-off-by: Markus Armbruster <armbru@redhat.com>
-Message-ID: <20250723133257.1497640-3-armbru@redhat.com>
-Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
-(cherry picked from commit ec14a3de622ae30a8afa78b6f564bc743b753ee1)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/proxy.c | 2 +-
- scsi/pr-manager-helper.c | 9 ++-------
- ui/input-barrier.c | 5 +----
- 3 files changed, 4 insertions(+), 12 deletions(-)
-
-diff --git a/hw/vfio-user/proxy.c b/hw/vfio-user/proxy.c
-index 2275d3fe39..2c03d49f97 100644
---- a/hw/vfio-user/proxy.c
-+++ b/hw/vfio-user/proxy.c
-@@ -885,7 +885,7 @@ VFIOUserProxy *vfio_user_connect_dev(SocketAddress *addr, Error **errp)
-
- sioc = qio_channel_socket_new();
- ioc = QIO_CHANNEL(sioc);
-- if (qio_channel_socket_connect_sync(sioc, addr, errp)) {
-+ if (qio_channel_socket_connect_sync(sioc, addr, errp) < 0) {
- object_unref(OBJECT(ioc));
- return NULL;
- }
-diff --git a/scsi/pr-manager-helper.c b/scsi/pr-manager-helper.c
-index 6b86f01b01..aea751fb04 100644
---- a/scsi/pr-manager-helper.c
-+++ b/scsi/pr-manager-helper.c
-@@ -105,20 +105,15 @@ static int pr_manager_helper_initialize(PRManagerHelper *pr_mgr,
- .u.q_unix.path = path
- };
- QIOChannelSocket *sioc = qio_channel_socket_new();
-- Error *local_err = NULL;
--
- uint32_t flags;
- int r;
-
- assert(!pr_mgr->ioc);
- qio_channel_set_name(QIO_CHANNEL(sioc), "pr-manager-helper");
-- qio_channel_socket_connect_sync(sioc,
-- &saddr,
-- &local_err);
-+ r = qio_channel_socket_connect_sync(sioc, &saddr, errp);
- g_free(path);
-- if (local_err) {
-+ if (r < 0) {
- object_unref(OBJECT(sioc));
-- error_propagate(errp, local_err);
- return -ENOTCONN;
- }
-
-diff --git a/ui/input-barrier.c b/ui/input-barrier.c
-index 9793258aac..0a2198ca50 100644
---- a/ui/input-barrier.c
-+++ b/ui/input-barrier.c
-@@ -490,7 +490,6 @@ static gboolean input_barrier_event(QIOChannel *ioc G_GNUC_UNUSED,
- static void input_barrier_complete(UserCreatable *uc, Error **errp)
- {
- InputBarrier *ib = INPUT_BARRIER(uc);
-- Error *local_err = NULL;
-
- if (!ib->name) {
- error_setg(errp, QERR_MISSING_PARAMETER, "name");
-@@ -506,9 +505,7 @@ static void input_barrier_complete(UserCreatable *uc, Error **errp)
- ib->sioc = qio_channel_socket_new();
- qio_channel_set_name(QIO_CHANNEL(ib->sioc), "barrier-client");
-
-- qio_channel_socket_connect_sync(ib->sioc, &ib->saddr, &local_err);
-- if (local_err) {
-- error_propagate(errp, local_err);
-+ if (qio_channel_socket_connect_sync(ib->sioc, &ib->saddr, errp) < 0) {
- return;
- }
-
---
-2.52.0
-
diff --git a/kvm-vfio-spapr.c-rename-VFIOContainer-bcontainer-field-t.patch b/kvm-vfio-spapr.c-rename-VFIOContainer-bcontainer-field-t.patch
deleted file mode 100644
index 33b3996..0000000
--- a/kvm-vfio-spapr.c-rename-VFIOContainer-bcontainer-field-t.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 6cf408cdf62e1d862f610bb8ad928ad221d6e98d Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:19 +0100
-Subject: [PATCH 061/116] vfio/spapr.c: rename VFIOContainer bcontainer field
- to parent_obj
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [45/100] 38ba4a34a229a04036883dbe4020000d645e65c4 (rovick1/qemu-kvm)
-
-Now that nothing accesses the bcontainer field directly, rename bcontainer to
-parent_obj as per our current coding guidelines.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-12-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 1bd06d0385eb72bb54aa14af34e8361ec3ae8cee)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/spapr.c | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c
-index c883ba6da9..8d9d68da4e 100644
---- a/hw/vfio/spapr.c
-+++ b/hw/vfio/spapr.c
-@@ -30,12 +30,13 @@ typedef struct VFIOHostDMAWindow {
- QLIST_ENTRY(VFIOHostDMAWindow) hostwin_next;
- } VFIOHostDMAWindow;
-
--typedef struct VFIOSpaprContainer {
-- VFIOLegacyContainer container;
-+struct VFIOSpaprContainer {
-+ VFIOLegacyContainer parent_obj;
-+
- MemoryListener prereg_listener;
- QLIST_HEAD(, VFIOHostDMAWindow) hostwin_list;
- unsigned int levels;
--} VFIOSpaprContainer;
-+};
-
- OBJECT_DECLARE_SIMPLE_TYPE(VFIOSpaprContainer, VFIO_IOMMU_SPAPR);
-
---
-2.52.0
-
diff --git a/kvm-vfio-spapr.c-use-QOM-casts-where-appropriate.patch b/kvm-vfio-spapr.c-use-QOM-casts-where-appropriate.patch
deleted file mode 100644
index 2eefba2..0000000
--- a/kvm-vfio-spapr.c-use-QOM-casts-where-appropriate.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-From a67df724e2c459dd67e0d1e7594da331019a809a Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:46 +0100
-Subject: [PATCH 033/116] vfio/spapr.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [17/100] 08eb7c65e80d66e9f35c87ef4f460bed25d2a056 (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOContainer and VFIOContainerBase instead
-of accessing bcontainer directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-7-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 1ea79b4b9a1477dca3ff53358fc9ebdd73d55938)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/spapr.c | 16 ++++++----------
- 1 file changed, 6 insertions(+), 10 deletions(-)
-
-diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c
-index 564b70ef97..c41e4588d6 100644
---- a/hw/vfio/spapr.c
-+++ b/hw/vfio/spapr.c
-@@ -62,7 +62,7 @@ static void vfio_prereg_listener_region_add(MemoryListener *listener,
- VFIOSpaprContainer *scontainer = container_of(listener, VFIOSpaprContainer,
- prereg_listener);
- VFIOContainer *container = &scontainer->container;
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
- const hwaddr gpa = section->offset_within_address_space;
- hwaddr end;
- int ret;
-@@ -244,7 +244,7 @@ static bool vfio_spapr_create_window(VFIOContainer *container,
- hwaddr *pgsize, Error **errp)
- {
- int ret = 0;
-- VFIOContainerBase *bcontainer = &container->bcontainer;
-+ VFIOContainerBase *bcontainer = VFIO_IOMMU(container);
- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
- container);
- IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
-@@ -352,8 +352,7 @@ vfio_spapr_container_add_section_window(VFIOContainerBase *bcontainer,
- MemoryRegionSection *section,
- Error **errp)
- {
-- VFIOContainer *container = container_of(bcontainer, VFIOContainer,
-- bcontainer);
-+ VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
- container);
- VFIOHostDMAWindow *hostwin;
-@@ -443,8 +442,7 @@ static void
- vfio_spapr_container_del_section_window(VFIOContainerBase *bcontainer,
- MemoryRegionSection *section)
- {
-- VFIOContainer *container = container_of(bcontainer, VFIOContainer,
-- bcontainer);
-+ VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
- container);
-
-@@ -465,8 +463,7 @@ vfio_spapr_container_del_section_window(VFIOContainerBase *bcontainer,
-
- static void vfio_spapr_container_release(VFIOContainerBase *bcontainer)
- {
-- VFIOContainer *container = container_of(bcontainer, VFIOContainer,
-- bcontainer);
-+ VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
- container);
- VFIOHostDMAWindow *hostwin, *next;
-@@ -484,8 +481,7 @@ static void vfio_spapr_container_release(VFIOContainerBase *bcontainer)
- static bool vfio_spapr_container_setup(VFIOContainerBase *bcontainer,
- Error **errp)
- {
-- VFIOContainer *container = container_of(bcontainer, VFIOContainer,
-- bcontainer);
-+ VFIOContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
- container);
- struct vfio_iommu_spapr_tce_info info;
---
-2.52.0
-
diff --git a/kvm-vfio-spapr.c-use-QOM-casts-where-appropriate2.patch b/kvm-vfio-spapr.c-use-QOM-casts-where-appropriate2.patch
deleted file mode 100644
index 2b58481..0000000
--- a/kvm-vfio-spapr.c-use-QOM-casts-where-appropriate2.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From 24472cbc79057934597e994d0a96b04b31b7a7f2 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:18 +0100
-Subject: [PATCH 060/116] vfio/spapr.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [44/100] 86a61536de3668baab89ee1f4d89f3c23973f5e9 (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOSpaprContainer and VFIOLegacyContainer
-instead of accessing bcontainer directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-11-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 6c671235636cfb5e825040b4621ff06c77925731)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/spapr.c | 19 +++++++------------
- 1 file changed, 7 insertions(+), 12 deletions(-)
-
-diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c
-index acaa9c1419..c883ba6da9 100644
---- a/hw/vfio/spapr.c
-+++ b/hw/vfio/spapr.c
-@@ -61,7 +61,7 @@ static void vfio_prereg_listener_region_add(MemoryListener *listener,
- {
- VFIOSpaprContainer *scontainer = container_of(listener, VFIOSpaprContainer,
- prereg_listener);
-- VFIOLegacyContainer *container = &scontainer->container;
-+ VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(scontainer);
- VFIOContainer *bcontainer = VFIO_IOMMU(container);
- const hwaddr gpa = section->offset_within_address_space;
- hwaddr end;
-@@ -121,7 +121,7 @@ static void vfio_prereg_listener_region_del(MemoryListener *listener,
- {
- VFIOSpaprContainer *scontainer = container_of(listener, VFIOSpaprContainer,
- prereg_listener);
-- VFIOLegacyContainer *container = &scontainer->container;
-+ VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(scontainer);
- const hwaddr gpa = section->offset_within_address_space;
- hwaddr end;
- int ret;
-@@ -245,8 +245,7 @@ static bool vfio_spapr_create_window(VFIOLegacyContainer *container,
- {
- int ret = 0;
- VFIOContainer *bcontainer = VFIO_IOMMU(container);
-- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
-- container);
-+ VFIOSpaprContainer *scontainer = VFIO_IOMMU_SPAPR(bcontainer);
- IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
- uint64_t pagesize = memory_region_iommu_get_min_page_size(iommu_mr), pgmask;
- unsigned entries, bits_total, bits_per_level, max_levels, ddw_levels;
-@@ -353,8 +352,7 @@ vfio_spapr_container_add_section_window(VFIOContainer *bcontainer,
- Error **errp)
- {
- VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
-- container);
-+ VFIOSpaprContainer *scontainer = VFIO_IOMMU_SPAPR(container);
- VFIOHostDMAWindow *hostwin;
- hwaddr pgsize = 0;
- int ret;
-@@ -443,8 +441,7 @@ vfio_spapr_container_del_section_window(VFIOContainer *bcontainer,
- MemoryRegionSection *section)
- {
- VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
-- container);
-+ VFIOSpaprContainer *scontainer = VFIO_IOMMU_SPAPR(container);
-
- if (container->iommu_type != VFIO_SPAPR_TCE_v2_IOMMU) {
- return;
-@@ -464,8 +461,7 @@ vfio_spapr_container_del_section_window(VFIOContainer *bcontainer,
- static void vfio_spapr_container_release(VFIOContainer *bcontainer)
- {
- VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
-- container);
-+ VFIOSpaprContainer *scontainer = VFIO_IOMMU_SPAPR(container);
- VFIOHostDMAWindow *hostwin, *next;
-
- if (container->iommu_type == VFIO_SPAPR_TCE_v2_IOMMU) {
-@@ -482,8 +478,7 @@ static bool vfio_spapr_container_setup(VFIOContainer *bcontainer,
- Error **errp)
- {
- VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);
-- VFIOSpaprContainer *scontainer = container_of(container, VFIOSpaprContainer,
-- container);
-+ VFIOSpaprContainer *scontainer = VFIO_IOMMU_SPAPR(container);
- struct vfio_iommu_spapr_tce_info info;
- bool v2 = container->iommu_type == VFIO_SPAPR_TCE_v2_IOMMU;
- int ret, fd = container->fd;
---
-2.52.0
-
diff --git a/kvm-vfio-user-clarify-partial-message-handling.patch b/kvm-vfio-user-clarify-partial-message-handling.patch
deleted file mode 100644
index 1c4a7bb..0000000
--- a/kvm-vfio-user-clarify-partial-message-handling.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 937cc3882a0c76eb65608f9c79f7f023e3a8bd26 Mon Sep 17 00:00:00 2001
-From: John Levon <john.levon@nutanix.com>
-Date: Wed, 3 Dec 2025 15:33:12 +0530
-Subject: [PATCH 108/116] vfio-user: clarify partial message handling
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [92/100] 7f20179aa72ae9188fc47b2f2230d58104b7b127 (rovick1/qemu-kvm)
-
-Improve a comment for this.
-
-Signed-off-by: John Levon <john.levon@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Link: https://lore.kernel.org/qemu-devel/20251203100316.3604456-3-john.levon@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 356c7b175258f29429fb91a7641f775080ab6b49)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/proxy.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/hw/vfio-user/proxy.c b/hw/vfio-user/proxy.c
-index 75845d7c89..82c76c6665 100644
---- a/hw/vfio-user/proxy.c
-+++ b/hw/vfio-user/proxy.c
-@@ -362,7 +362,10 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
- while (msgleft > 0) {
- ret = qio_channel_read(proxy->ioc, data, msgleft, errp);
-
-- /* prepare to complete read on next iternation */
-+ /*
-+ * We'll complete this read on the next go around; keep track of the
-+ * partial message until then.
-+ */
- if (ret == QIO_CHANNEL_ERR_BLOCK) {
- proxy->part_recv = msg;
- proxy->recv_left = msgleft;
---
-2.52.0
-
diff --git a/kvm-vfio-user-container.h-rename-VFIOUserContainer-bcont.patch b/kvm-vfio-user-container.h-rename-VFIOUserContainer-bcont.patch
deleted file mode 100644
index 493267c..0000000
--- a/kvm-vfio-user-container.h-rename-VFIOUserContainer-bcont.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 96f7b013ab842f7cc919480cb4b11f13c617c7ad Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:50 +0100
-Subject: [PATCH 037/116] vfio-user/container.h: rename VFIOUserContainer
- bcontainer field to parent_obj
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [21/100] fe360b607b35d661f9d5045df8654b02f087f022 (rovick1/qemu-kvm)
-
-Now that nothing accesses the bcontainer field directly, rename bcontainer to
-parent_obj as per our current coding guidelines.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: John Levon <john.levon@nutanix.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-11-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 81b53891ca52288540e6e4f34bb924284feebc58)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/container.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/vfio-user/container.h b/hw/vfio-user/container.h
-index d5d2275af7..96aa6785d9 100644
---- a/hw/vfio-user/container.h
-+++ b/hw/vfio-user/container.h
-@@ -14,7 +14,7 @@
-
- /* MMU container sub-class for vfio-user. */
- struct VFIOUserContainer {
-- VFIOContainerBase bcontainer;
-+ VFIOContainerBase parent_obj;
-
- VFIOUserProxy *proxy;
- };
---
-2.52.0
-
diff --git a/kvm-vfio-user-container.h-update-VFIOUserContainer-decla.patch b/kvm-vfio-user-container.h-update-VFIOUserContainer-decla.patch
deleted file mode 100644
index 8e64a2b..0000000
--- a/kvm-vfio-user-container.h-update-VFIOUserContainer-decla.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 01b0fa2ad3eb81243bb2032be91f3933ad47991d Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:48 +0100
-Subject: [PATCH 035/116] vfio-user/container.h: update VFIOUserContainer
- declaration
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [19/100] cd1782d0e5a391a92cced59496565bc077b84ea1 (rovick1/qemu-kvm)
-
-Update the VFIOUserContainer declaration so that it is closer to our coding
-guidelines: remove the explicit typedef (this is already handled by the
-OBJECT_DECLARE_TYPE() macro) and add a blank line after the parent object.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: John Levon <john.levon@nutanix.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-9-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 52a1cc3dc00f09779aeb9aa9c6fcdc0284a40d4c)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/container.h | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio-user/container.h b/hw/vfio-user/container.h
-index 2bb1fa1343..d5d2275af7 100644
---- a/hw/vfio-user/container.h
-+++ b/hw/vfio-user/container.h
-@@ -13,10 +13,11 @@
- #include "hw/vfio-user/proxy.h"
-
- /* MMU container sub-class for vfio-user. */
--typedef struct VFIOUserContainer {
-+struct VFIOUserContainer {
- VFIOContainerBase bcontainer;
-+
- VFIOUserProxy *proxy;
--} VFIOUserContainer;
-+};
-
- OBJECT_DECLARE_SIMPLE_TYPE(VFIOUserContainer, VFIO_IOMMU_USER);
-
---
-2.52.0
-
diff --git a/kvm-vfio-user-pci.c-rename-VFIOUserPCIDevice-device-fiel.patch b/kvm-vfio-user-pci.c-rename-VFIOUserPCIDevice-device-fiel.patch
deleted file mode 100644
index 65bc117..0000000
--- a/kvm-vfio-user-pci.c-rename-VFIOUserPCIDevice-device-fiel.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From b8105a116255cf1237c709b4c16dc9d4b98fa39b Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:53 +0100
-Subject: [PATCH 040/116] vfio-user/pci.c: rename VFIOUserPCIDevice device
- field to parent_obj
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [24/100] a44be813509b770809e2e897c238d18496ae4c3d (rovick1/qemu-kvm)
-
-Now that nothing accesses the device field directly, rename device to
-parent_obj as per our current coding guidelines.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: John Levon <john.levon@nutanix.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-14-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 5fc421b8cd4813fa8ca9131905f12c4eedf55051)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/pci.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
-index 7b6a6514f6..c3947a8f2e 100644
---- a/hw/vfio-user/pci.c
-+++ b/hw/vfio-user/pci.c
-@@ -20,7 +20,7 @@
- OBJECT_DECLARE_SIMPLE_TYPE(VFIOUserPCIDevice, VFIO_USER_PCI)
-
- struct VFIOUserPCIDevice {
-- VFIOPCIDevice device;
-+ VFIOPCIDevice parent_obj;
-
- SocketAddress *socket;
- bool send_queued; /* all sends are queued */
---
-2.52.0
-
diff --git a/kvm-vfio-user-pci.c-rename-vfio_user_instance_finalize-t.patch b/kvm-vfio-user-pci.c-rename-vfio_user_instance_finalize-t.patch
deleted file mode 100644
index 0077fb2..0000000
--- a/kvm-vfio-user-pci.c-rename-vfio_user_instance_finalize-t.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 82c288346ae45ef2efed23c0278fc317b7bc7b8f Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:34 +0100
-Subject: [PATCH 077/116] vfio-user/pci.c: rename vfio_user_instance_finalize()
- to vfio_user_pci_finalize()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [61/100] 546ea3a8974ba1052bf2e0966c9711b855eed000 (rovick1/qemu-kvm)
-
-This is the more typical naming convention for QOM finalize() functions, in
-particular it changes the prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-27-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit d5447437aef2d326728e0ad1590a5fa50c0b33a3)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
-index 52561900fd..d4f5c7b9d7 100644
---- a/hw/vfio-user/pci.c
-+++ b/hw/vfio-user/pci.c
-@@ -370,7 +370,7 @@ static void vfio_user_pci_init(Object *obj)
- pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
- }
-
--static void vfio_user_instance_finalize(Object *obj)
-+static void vfio_user_pci_finalize(Object *obj)
- {
- VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(obj);
- VFIODevice *vbasedev = &vdev->vbasedev;
-@@ -469,7 +469,7 @@ static const TypeInfo vfio_user_pci_dev_info = {
- .instance_size = sizeof(VFIOUserPCIDevice),
- .class_init = vfio_user_pci_class_init,
- .instance_init = vfio_user_pci_init,
-- .instance_finalize = vfio_user_instance_finalize,
-+ .instance_finalize = vfio_user_pci_finalize,
- };
-
- static void register_vfio_user_dev_type(void)
---
-2.52.0
-
diff --git a/kvm-vfio-user-pci.c-rename-vfio_user_instance_init-to-vf.patch b/kvm-vfio-user-pci.c-rename-vfio_user_instance_init-to-vf.patch
deleted file mode 100644
index 4f479ca..0000000
--- a/kvm-vfio-user-pci.c-rename-vfio_user_instance_init-to-vf.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 1719925d5205bc16e5b24b7c700394725b859b25 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:33 +0100
-Subject: [PATCH 076/116] vfio-user/pci.c: rename vfio_user_instance_init() to
- vfio_user_pci_init()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [60/100] bbe07d177f7818de2d5acc76e523893873e4cd33 (rovick1/qemu-kvm)
-
-This is the more typical naming convention for QOM init() functions, in
-particular it changes the prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-26-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit de837b5cbd489410aab1eda00b4b50e45a85d5d6)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
-index 30f485fdbb..52561900fd 100644
---- a/hw/vfio-user/pci.c
-+++ b/hw/vfio-user/pci.c
-@@ -344,7 +344,7 @@ error:
- vfio_pci_put_device(vdev);
- }
-
--static void vfio_user_instance_init(Object *obj)
-+static void vfio_user_pci_init(Object *obj)
- {
- PCIDevice *pci_dev = PCI_DEVICE(obj);
- VFIOPCIDevice *vdev = VFIO_PCI_DEVICE(obj);
-@@ -468,7 +468,7 @@ static const TypeInfo vfio_user_pci_dev_info = {
- .parent = TYPE_VFIO_PCI_DEVICE,
- .instance_size = sizeof(VFIOUserPCIDevice),
- .class_init = vfio_user_pci_class_init,
-- .instance_init = vfio_user_instance_init,
-+ .instance_init = vfio_user_pci_init,
- .instance_finalize = vfio_user_instance_finalize,
- };
-
---
-2.52.0
-
diff --git a/kvm-vfio-user-pci.c-rename-vfio_user_pci_dev_class_init-.patch b/kvm-vfio-user-pci.c-rename-vfio_user_pci_dev_class_init-.patch
deleted file mode 100644
index 3da250a..0000000
--- a/kvm-vfio-user-pci.c-rename-vfio_user_pci_dev_class_init-.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From e50e324443d038ef125185ec9b306891e274eec4 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:31 +0100
-Subject: [PATCH 074/116] vfio-user/pci.c: rename
- vfio_user_pci_dev_class_init() to vfio_user_pci_class_init()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [58/100] 2921e31af8529dc03b463ac3e2b34959b5794b65 (rovick1/qemu-kvm)
-
-This changes the function prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-24-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit c833f7a5c66e1264bfaaa389467c5af8d9c49082)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
-index efceae69de..e2c5b5744c 100644
---- a/hw/vfio-user/pci.c
-+++ b/hw/vfio-user/pci.c
-@@ -446,7 +446,7 @@ static void vfio_user_pci_set_socket(Object *obj, Visitor *v, const char *name,
- }
- }
-
--static void vfio_user_pci_dev_class_init(ObjectClass *klass, const void *data)
-+static void vfio_user_pci_class_init(ObjectClass *klass, const void *data)
- {
- DeviceClass *dc = DEVICE_CLASS(klass);
- PCIDeviceClass *pdc = PCI_DEVICE_CLASS(klass);
-@@ -467,7 +467,7 @@ static const TypeInfo vfio_user_pci_dev_info = {
- .name = TYPE_VFIO_USER_PCI,
- .parent = TYPE_VFIO_PCI_DEVICE,
- .instance_size = sizeof(VFIOUserPCIDevice),
-- .class_init = vfio_user_pci_dev_class_init,
-+ .class_init = vfio_user_pci_class_init,
- .instance_init = vfio_user_instance_init,
- .instance_finalize = vfio_user_instance_finalize,
- };
---
-2.52.0
-
diff --git a/kvm-vfio-user-pci.c-rename-vfio_user_pci_dev_info-to-vfi.patch b/kvm-vfio-user-pci.c-rename-vfio_user_pci_dev_info-to-vfi.patch
deleted file mode 100644
index bb0bef3..0000000
--- a/kvm-vfio-user-pci.c-rename-vfio_user_pci_dev_info-to-vfi.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 34756ef0d3a3da9068878146fd00e83a1c55a08c Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:35 +0100
-Subject: [PATCH 078/116] vfio-user/pci.c: rename vfio_user_pci_dev_info to
- vfio_user_pci_info
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [62/100] 83106e7cacf0e4b91cbee8e17ecdb1a7976e6abf (rovick1/qemu-kvm)
-
-This changes the prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-28-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit d0776b8c60fcc5833fba1d2ce8e0780c429108bc)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/pci.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
-index d4f5c7b9d7..b53ed3b456 100644
---- a/hw/vfio-user/pci.c
-+++ b/hw/vfio-user/pci.c
-@@ -463,7 +463,7 @@ static void vfio_user_pci_class_init(ObjectClass *klass, const void *data)
- pdc->realize = vfio_user_pci_realize;
- }
-
--static const TypeInfo vfio_user_pci_dev_info = {
-+static const TypeInfo vfio_user_pci_info = {
- .name = TYPE_VFIO_USER_PCI,
- .parent = TYPE_VFIO_PCI_DEVICE,
- .instance_size = sizeof(VFIOUserPCIDevice),
-@@ -474,7 +474,7 @@ static const TypeInfo vfio_user_pci_dev_info = {
-
- static void register_vfio_user_dev_type(void)
- {
-- type_register_static(&vfio_user_pci_dev_info);
-+ type_register_static(&vfio_user_pci_info);
- }
-
-- type_init(register_vfio_user_dev_type)
-+type_init(register_vfio_user_dev_type)
---
-2.52.0
-
diff --git a/kvm-vfio-user-pci.c-rename-vfio_user_pci_dev_properties-.patch b/kvm-vfio-user-pci.c-rename-vfio_user_pci_dev_properties-.patch
deleted file mode 100644
index b5d7135..0000000
--- a/kvm-vfio-user-pci.c-rename-vfio_user_pci_dev_properties-.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From e6ebe1bacee5d50b07aed2837eb1844180ad32be Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:32 +0100
-Subject: [PATCH 075/116] vfio-user/pci.c: rename
- vfio_user_pci_dev_properties[] to vfio_user_pci_properties[]
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [59/100] 20d11845e15a6584e72e871dc56232c1eb942f13 (rovick1/qemu-kvm)
-
-This changes the prefix to match the name of the QOM type.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-25-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 78f4b77607b41909c294f15ae4e51d87e36aab4f)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/pci.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
-index e2c5b5744c..30f485fdbb 100644
---- a/hw/vfio-user/pci.c
-+++ b/hw/vfio-user/pci.c
-@@ -400,7 +400,7 @@ static void vfio_user_pci_reset(DeviceState *dev)
- vfio_pci_post_reset(vdev);
- }
-
--static const Property vfio_user_pci_dev_properties[] = {
-+static const Property vfio_user_pci_properties[] = {
- DEFINE_PROP_UINT32("x-pci-vendor-id", VFIOPCIDevice,
- vendor_id, PCI_ANY_ID),
- DEFINE_PROP_UINT32("x-pci-device-id", VFIOPCIDevice,
-@@ -452,7 +452,7 @@ static void vfio_user_pci_class_init(ObjectClass *klass, const void *data)
- PCIDeviceClass *pdc = PCI_DEVICE_CLASS(klass);
-
- device_class_set_legacy_reset(dc, vfio_user_pci_reset);
-- device_class_set_props(dc, vfio_user_pci_dev_properties);
-+ device_class_set_props(dc, vfio_user_pci_properties);
-
- object_class_property_add(klass, "socket", "SocketAddress", NULL,
- vfio_user_pci_set_socket, NULL, NULL);
---
-2.52.0
-
diff --git a/kvm-vfio-user-pci.c-update-VFIOUserPCIDevice-declaration.patch b/kvm-vfio-user-pci.c-update-VFIOUserPCIDevice-declaration.patch
deleted file mode 100644
index 07bcb5a..0000000
--- a/kvm-vfio-user-pci.c-update-VFIOUserPCIDevice-declaration.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From d98931cdfa112251a5cf4e9bfb6ea8cd12388d43 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:51 +0100
-Subject: [PATCH 038/116] vfio-user/pci.c: update VFIOUserPCIDevice declaration
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [22/100] 48c413bd4db7518a99030ec40b2de81f2bf596ba (rovick1/qemu-kvm)
-
-Update the VFIOUserPCIDevice declaration so that it is closer to our coding
-guidelines: add a blank line after the parent object.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: John Levon <john.levon@nutanix.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-12-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit b458e9e9e4c171622f19df18f5363c7ef4e8697f)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/pci.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
-index dfaa89498d..29cb592e9c 100644
---- a/hw/vfio-user/pci.c
-+++ b/hw/vfio-user/pci.c
-@@ -21,6 +21,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(VFIOUserPCIDevice, VFIO_USER_PCI)
-
- struct VFIOUserPCIDevice {
- VFIOPCIDevice device;
-+
- SocketAddress *socket;
- bool send_queued; /* all sends are queued */
- uint32_t wait_time; /* timeout for message replies */
---
-2.52.0
-
diff --git a/kvm-vfio-user-pci.c-use-QOM-casts-where-appropriate.patch b/kvm-vfio-user-pci.c-use-QOM-casts-where-appropriate.patch
deleted file mode 100644
index ce51cda..0000000
--- a/kvm-vfio-user-pci.c-use-QOM-casts-where-appropriate.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 05eecb8868a208bbb9c000e8c2a06b060a1c1250 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:52 +0100
-Subject: [PATCH 039/116] vfio-user/pci.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [23/100] e793696cd1ee5cbcf1b084f46e8e713f8f813dd5 (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOUserPCIDevice and VFIOPCIDevice instead
-of accessing device directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: John Levon <john.levon@nutanix.com>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-13-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 5d1219e358a559680fdc34b112e2b04806f5ff62)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/pci.c | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
-index 29cb592e9c..7b6a6514f6 100644
---- a/hw/vfio-user/pci.c
-+++ b/hw/vfio-user/pci.c
-@@ -214,8 +214,9 @@ static void vfio_user_compute_needs_reset(VFIODevice *vbasedev)
-
- static Object *vfio_user_pci_get_object(VFIODevice *vbasedev)
- {
-- VFIOUserPCIDevice *vdev = container_of(vbasedev, VFIOUserPCIDevice,
-- device.vbasedev);
-+ VFIOUserPCIDevice *vdev = VFIO_USER_PCI(container_of(vbasedev,
-+ VFIOPCIDevice,
-+ vbasedev));
-
- return OBJECT(vdev);
- }
-@@ -420,7 +421,7 @@ static void vfio_user_pci_set_socket(Object *obj, Visitor *v, const char *name,
- VFIOUserPCIDevice *udev = VFIO_USER_PCI(obj);
- bool success;
-
-- if (udev->device.vbasedev.proxy) {
-+ if (VFIO_PCI_BASE(udev)->vbasedev.proxy) {
- error_setg(errp, "Proxy is connected");
- return;
- }
---
-2.52.0
-
diff --git a/kvm-vfio-user-pci.c-use-QOM-casts-where-appropriate2.patch b/kvm-vfio-user-pci.c-use-QOM-casts-where-appropriate2.patch
deleted file mode 100644
index 998029e..0000000
--- a/kvm-vfio-user-pci.c-use-QOM-casts-where-appropriate2.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 2e7700817255deeae14c49b448ff5289f59b269c Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:26:00 +0100
-Subject: [PATCH 046/116] vfio-user/pci.c: use QOM casts where appropriate
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [30/100] 3fe414403346f5e653673bac6b19a0375b2283c3 (rovick1/qemu-kvm)
-
-Use QOM casts to convert between VFIOPCIDevice and PCIDevice instead of
-accessing pdev directly.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: John Levon <john.levon@nutanix.com>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-21-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit a49ef7a467c3ced0be048b02189092031e325d01)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/pci.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
-index c3947a8f2e..e2c309784f 100644
---- a/hw/vfio-user/pci.c
-+++ b/hw/vfio-user/pci.c
-@@ -65,7 +65,7 @@ static void vfio_user_msix_setup(VFIOPCIDevice *vdev)
- vdev->msix->pba_region = pba_reg;
-
- vfio_reg = vdev->bars[vdev->msix->pba_bar].mr;
-- msix_reg = &vdev->pdev.msix_pba_mmio;
-+ msix_reg = &PCI_DEVICE(vdev)->msix_pba_mmio;
- memory_region_init_io(pba_reg, OBJECT(vdev), &vfio_user_pba_ops, vdev,
- "VFIO MSIX PBA", int128_get64(msix_reg->size));
- memory_region_add_subregion_overlap(vfio_reg, vdev->msix->pba_offset,
-@@ -86,7 +86,7 @@ static void vfio_user_msix_teardown(VFIOPCIDevice *vdev)
-
- static void vfio_user_dma_read(VFIOPCIDevice *vdev, VFIOUserDMARW *msg)
- {
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- VFIOUserProxy *proxy = vdev->vbasedev.proxy;
- VFIOUserDMARW *res;
- MemTxResult r;
-@@ -134,7 +134,7 @@ static void vfio_user_dma_read(VFIOPCIDevice *vdev, VFIOUserDMARW *msg)
-
- static void vfio_user_dma_write(VFIOPCIDevice *vdev, VFIOUserDMARW *msg)
- {
-- PCIDevice *pdev = &vdev->pdev;
-+ PCIDevice *pdev = PCI_DEVICE(vdev);
- VFIOUserProxy *proxy = vdev->vbasedev.proxy;
- MemTxResult r;
-
---
-2.52.0
-
diff --git a/kvm-vfio-user-recycle-msg-on-failure.patch b/kvm-vfio-user-recycle-msg-on-failure.patch
deleted file mode 100644
index 7738d55..0000000
--- a/kvm-vfio-user-recycle-msg-on-failure.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From e199275276173ff9bba201c762b40dd9649dd843 Mon Sep 17 00:00:00 2001
-From: John Levon <john.levon@nutanix.com>
-Date: Wed, 3 Dec 2025 15:33:15 +0530
-Subject: [PATCH 111/116] vfio-user: recycle msg on failure
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [95/100] e51ea3292bfecfcca427eb6d71399af7c36a0868 (rovick1/qemu-kvm)
-
-If we fail to read an incoming request, recycle the message.
-
-Resolves: Coverity CID 1611807
-Resolves: Coverity CID 1611808
-Signed-off-by: John Levon <john.levon@nutanix.com>
-Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Link: https://lore.kernel.org/qemu-devel/20251203100316.3604456-6-john.levon@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 23c586abf2e12843894189c4742c8ea55c594cd5)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/proxy.c | 21 ++++++++++++++++-----
- 1 file changed, 16 insertions(+), 5 deletions(-)
-
-diff --git a/hw/vfio-user/proxy.c b/hw/vfio-user/proxy.c
-index f2601eada5..314dfd23d8 100644
---- a/hw/vfio-user/proxy.c
-+++ b/hw/vfio-user/proxy.c
-@@ -412,11 +412,22 @@ err:
- for (i = 0; i < numfds; i++) {
- close(fdp[i]);
- }
-- if (isreply && msg != NULL) {
-- /* force an error to keep sending thread from hanging */
-- vfio_user_set_error(msg->hdr, EINVAL);
-- msg->complete = true;
-- qemu_cond_signal(&msg->cv);
-+ if (msg != NULL) {
-+ if (msg->type == VFIO_MSG_REQ) {
-+ /*
-+ * Clean up the request message on failure. Change type back to
-+ * NOWAIT to free.
-+ */
-+ msg->type = VFIO_MSG_NOWAIT;
-+ vfio_user_recycle(proxy, msg);
-+ } else {
-+ /*
-+ * Report an error back to the sender. Sender will recycle msg.
-+ */
-+ vfio_user_set_error(msg->hdr, EINVAL);
-+ msg->complete = true;
-+ qemu_cond_signal(&msg->cv);
-+ }
- }
- return -1;
- }
---
-2.52.0
-
diff --git a/kvm-vfio-user-refactor-out-header-handling.patch b/kvm-vfio-user-refactor-out-header-handling.patch
deleted file mode 100644
index ed60f26..0000000
--- a/kvm-vfio-user-refactor-out-header-handling.patch
+++ /dev/null
@@ -1,159 +0,0 @@
-From 8769878dc551acd83b5dc68fd9cd22c6761bda7d Mon Sep 17 00:00:00 2001
-From: John Levon <john.levon@nutanix.com>
-Date: Wed, 3 Dec 2025 15:33:13 +0530
-Subject: [PATCH 109/116] vfio-user: refactor out header handling
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [93/100] a413ba0919ab7d1da9b2cb670782167da6f9a14b (rovick1/qemu-kvm)
-
-Simplify vfio_user_recv_one() by moving the header handling out to a
-helper function.
-
-Signed-off-by: John Levon <john.levon@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20251203100316.3604456-4-john.levon@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 7b884e2a27793e0ff5817ad04ecce85d0a90149d)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/proxy.c | 101 +++++++++++++++++++++++++------------------
- 1 file changed, 60 insertions(+), 41 deletions(-)
-
-diff --git a/hw/vfio-user/proxy.c b/hw/vfio-user/proxy.c
-index 82c76c6665..e0f9202535 100644
---- a/hw/vfio-user/proxy.c
-+++ b/hw/vfio-user/proxy.c
-@@ -218,6 +218,61 @@ static int vfio_user_complete(VFIOUserProxy *proxy, Error **errp)
- return 1;
- }
-
-+static int vfio_user_recv_hdr(VFIOUserProxy *proxy, Error **errp,
-+ VFIOUserHdr *hdr, int **fdp, size_t *numfdp,
-+ bool *isreply)
-+{
-+ struct iovec iov = {
-+ .iov_base = hdr,
-+ .iov_len = sizeof(*hdr),
-+ };
-+ int ret;
-+
-+ /*
-+ * Read header
-+ */
-+ ret = qio_channel_readv_full(proxy->ioc, &iov, 1, fdp, numfdp, 0,
-+ errp);
-+ if (ret == QIO_CHANNEL_ERR_BLOCK) {
-+ return ret;
-+ }
-+
-+ if (ret < 0) {
-+ error_setg_errno(errp, errno, "failed to read header");
-+ return -1;
-+ } else if (ret == 0) {
-+ error_setg(errp, "failed to read header: EOF");
-+ return -1;
-+ } else if (ret < sizeof(*hdr)) {
-+ error_setg(errp, "short read of header");
-+ return -1;
-+ }
-+
-+ /*
-+ * Validate header
-+ */
-+ if (hdr->size < sizeof(*hdr)) {
-+ error_setg(errp, "bad header size");
-+ return -1;
-+ }
-+
-+ switch (hdr->flags & VFIO_USER_TYPE) {
-+ case VFIO_USER_REQUEST:
-+ *isreply = false;
-+ break;
-+ case VFIO_USER_REPLY:
-+ *isreply = true;
-+ break;
-+ default:
-+ error_setg(errp, "unknown message type");
-+ return -1;
-+ }
-+
-+ trace_vfio_user_recv_hdr(proxy->sockname, hdr->id, hdr->command, hdr->size,
-+ hdr->flags);
-+ return 0;
-+}
-+
- /*
- * Receive and process one incoming message.
- *
-@@ -230,10 +285,6 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
- g_autofree int *fdp = NULL;
- VFIOUserFDs *reqfds;
- VFIOUserHdr hdr;
-- struct iovec iov = {
-- .iov_base = &hdr,
-- .iov_len = sizeof(hdr),
-- };
- bool isreply = false;
- int i, ret;
- size_t msgleft, numfds = 0;
-@@ -257,45 +308,13 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
- /* else fall into reading another msg */
- }
-
-- /*
-- * Read header
-- */
-- ret = qio_channel_readv_full(proxy->ioc, &iov, 1, &fdp, &numfds, 0,
-- errp);
-- if (ret == QIO_CHANNEL_ERR_BLOCK) {
-- return ret;
-- }
--
-- /* read error or other side closed connection */
-- if (ret <= 0) {
-- goto fatal;
-- }
--
-- if (ret < sizeof(hdr)) {
-- error_setg(errp, "short read of header");
-- goto fatal;
-- }
--
-- /*
-- * Validate header
-- */
-- if (hdr.size < sizeof(VFIOUserHdr)) {
-- error_setg(errp, "bad header size");
-- goto fatal;
-- }
-- switch (hdr.flags & VFIO_USER_TYPE) {
-- case VFIO_USER_REQUEST:
-- isreply = false;
-- break;
-- case VFIO_USER_REPLY:
-- isreply = true;
-- break;
-- default:
-- error_setg(errp, "unknown message type");
-+ ret = vfio_user_recv_hdr(proxy, errp, &hdr, &fdp, &numfds, &isreply);
-+ if (ret < 0) {
-+ if (ret == QIO_CHANNEL_ERR_BLOCK) {
-+ return ret;
-+ }
- goto fatal;
- }
-- trace_vfio_user_recv_hdr(proxy->sockname, hdr.id, hdr.command, hdr.size,
-- hdr.flags);
-
- /*
- * For replies, find the matching pending request.
---
-2.52.0
-
diff --git a/kvm-vfio-user-simplify-vfio_user_process.patch b/kvm-vfio-user-simplify-vfio_user_process.patch
deleted file mode 100644
index de9fb8b..0000000
--- a/kvm-vfio-user-simplify-vfio_user_process.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-From 7743a6caf368f97cbd1afd0bcd3a48e0cab718e9 Mon Sep 17 00:00:00 2001
-From: John Levon <john.levon@nutanix.com>
-Date: Wed, 3 Dec 2025 15:33:11 +0530
-Subject: [PATCH 107/116] vfio-user: simplify vfio_user_process()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [91/100] 0ed846d289b58aae4610e3848cce58447e23cebb (rovick1/qemu-kvm)
-
-It can figure out if it's a reply by itself, rather than passing that
-information in.
-
-Signed-off-by: John Levon <john.levon@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Link: https://lore.kernel.org/qemu-devel/20251203100316.3604456-2-john.levon@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit a8731f691df2bd9efd041d836ece27e3173555f2)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/proxy.c | 11 ++++-------
- 1 file changed, 4 insertions(+), 7 deletions(-)
-
-diff --git a/hw/vfio-user/proxy.c b/hw/vfio-user/proxy.c
-index bbd7ec243d..75845d7c89 100644
---- a/hw/vfio-user/proxy.c
-+++ b/hw/vfio-user/proxy.c
-@@ -147,8 +147,7 @@ VFIOUserFDs *vfio_user_getfds(int numfds)
- /*
- * Process a received message.
- */
--static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg,
-- bool isreply)
-+static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg)
- {
-
- /*
-@@ -157,7 +156,7 @@ static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg,
- *
- * Requests get queued for the BH.
- */
-- if (isreply) {
-+ if ((msg->hdr->flags & VFIO_USER_TYPE) == VFIO_USER_REPLY) {
- msg->complete = true;
- if (msg->type == VFIO_MSG_WAIT) {
- qemu_cond_signal(&msg->cv);
-@@ -187,7 +186,6 @@ static int vfio_user_complete(VFIOUserProxy *proxy, Error **errp)
- {
- VFIOUserMsg *msg = proxy->part_recv;
- size_t msgleft = proxy->recv_left;
-- bool isreply;
- char *data;
- int ret;
-
-@@ -214,8 +212,7 @@ static int vfio_user_complete(VFIOUserProxy *proxy, Error **errp)
- */
- proxy->part_recv = NULL;
- proxy->recv_left = 0;
-- isreply = (msg->hdr->flags & VFIO_USER_TYPE) == VFIO_USER_REPLY;
-- vfio_user_process(proxy, msg, isreply);
-+ vfio_user_process(proxy, msg);
-
- /* return positive value */
- return 1;
-@@ -381,7 +378,7 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
- data += ret;
- }
-
-- vfio_user_process(proxy, msg, isreply);
-+ vfio_user_process(proxy, msg);
- return 0;
-
- /*
---
-2.52.0
-
diff --git a/kvm-vfio-user-simplify-vfio_user_recv_one.patch b/kvm-vfio-user-simplify-vfio_user_recv_one.patch
deleted file mode 100644
index 86c837c..0000000
--- a/kvm-vfio-user-simplify-vfio_user_recv_one.patch
+++ /dev/null
@@ -1,143 +0,0 @@
-From 6c3aa471fd1589312012625089ec0ac63b74c879 Mon Sep 17 00:00:00 2001
-From: John Levon <john.levon@nutanix.com>
-Date: Wed, 3 Dec 2025 15:33:14 +0530
-Subject: [PATCH 110/116] vfio-user: simplify vfio_user_recv_one()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [94/100] 708ef469d0590eb7719766bcfe97b4873a61a3e0 (rovick1/qemu-kvm)
-
-This function was unnecessarily difficult to understand due to the
-separate handling of request and reply messages. Use common code for
-both where we can.
-
-Signed-off-by: John Levon <john.levon@nutanix.com>
-Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Link: https://lore.kernel.org/qemu-devel/20251203100316.3604456-5-john.levon@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 0df8baec95b76c93093efde37d1644508c3c7d2c)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio-user/proxy.c | 68 +++++++++++++++++++-------------------------
- 1 file changed, 30 insertions(+), 38 deletions(-)
-
-diff --git a/hw/vfio-user/proxy.c b/hw/vfio-user/proxy.c
-index e0f9202535..f2601eada5 100644
---- a/hw/vfio-user/proxy.c
-+++ b/hw/vfio-user/proxy.c
-@@ -281,15 +281,14 @@ static int vfio_user_recv_hdr(VFIOUserProxy *proxy, Error **errp,
- */
- static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
- {
-- VFIOUserMsg *msg = NULL;
- g_autofree int *fdp = NULL;
-- VFIOUserFDs *reqfds;
-- VFIOUserHdr hdr;
-+ VFIOUserMsg *msg = NULL;
- bool isreply = false;
-- int i, ret;
-- size_t msgleft, numfds = 0;
-+ size_t msgleft = 0;
-+ size_t numfds = 0;
- char *data = NULL;
-- char *buf = NULL;
-+ VFIOUserHdr hdr;
-+ int i, ret;
-
- /*
- * Complete any partial reads
-@@ -317,8 +316,8 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
- }
-
- /*
-- * For replies, find the matching pending request.
-- * For requests, reap incoming FDs.
-+ * Find the matching request if this is a reply, or initialize a new
-+ * server->client request.
- */
- if (isreply) {
- QTAILQ_FOREACH(msg, &proxy->pending, next) {
-@@ -332,51 +331,44 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
- }
- QTAILQ_REMOVE(&proxy->pending, msg, next);
-
-- /*
-- * Process any received FDs
-- */
-- if (numfds != 0) {
-- if (msg->fds == NULL || msg->fds->recv_fds < numfds) {
-- error_setg(errp, "unexpected FDs");
-- goto err;
-- }
-- msg->fds->recv_fds = numfds;
-- memcpy(msg->fds->fds, fdp, numfds * sizeof(int));
-- }
-- } else {
-- if (numfds != 0) {
-- reqfds = vfio_user_getfds(numfds);
-- memcpy(reqfds->fds, fdp, numfds * sizeof(int));
-- } else {
-- reqfds = NULL;
-- }
-- }
--
-- /*
-- * Put the whole message into a single buffer.
-- */
-- if (isreply) {
- if (hdr.size > msg->rsize) {
- error_setg(errp, "reply larger than recv buffer");
- goto err;
- }
-- *msg->hdr = hdr;
-- data = (char *)msg->hdr + sizeof(hdr);
- } else {
-+ void *buf;
-+
- if (hdr.size > proxy->max_xfer_size + sizeof(VFIOUserDMARW)) {
- error_setg(errp, "vfio_user_recv request larger than max");
- goto err;
- }
-+
- buf = g_malloc0(hdr.size);
-- memcpy(buf, &hdr, sizeof(hdr));
-- data = buf + sizeof(hdr);
-- msg = vfio_user_getmsg(proxy, (VFIOUserHdr *)buf, reqfds);
-+ msg = vfio_user_getmsg(proxy, buf, NULL);
- msg->type = VFIO_MSG_REQ;
- }
-
-+ *msg->hdr = hdr;
-+ data = (char *)msg->hdr + sizeof(hdr);
-+
-+ if (numfds != 0) {
-+ if (msg->type == VFIO_MSG_REQ) {
-+ msg->fds = vfio_user_getfds(numfds);
-+ } else {
-+ if (msg->fds == NULL || msg->fds->recv_fds < numfds) {
-+ error_setg(errp, "unexpected FDs in reply");
-+ goto err;
-+ }
-+ msg->fds->recv_fds = numfds;
-+ }
-+
-+ memcpy(msg->fds->fds, fdp, numfds * sizeof(int));
-+ }
-+
- /*
-- * Read rest of message.
-+ * Read rest of message into the data buffer.
- */
-+
- msgleft = hdr.size - sizeof(hdr);
- while (msgleft > 0) {
- ret = qio_channel_read(proxy->ioc, data, msgleft, errp);
---
-2.52.0
-
diff --git a/kvm-vfio-vfio-container-base.h-update-VFIOContainerBase-.patch b/kvm-vfio-vfio-container-base.h-update-VFIOContainerBase-.patch
deleted file mode 100644
index 65aaa86..0000000
--- a/kvm-vfio-vfio-container-base.h-update-VFIOContainerBase-.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From 9ef77c527a5069c6f74141e59a7e0041ff600574 Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:41 +0100
-Subject: [PATCH 029/116] vfio/vfio-container-base.h: update VFIOContainerBase
- declaration
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [13/100] 9e35dfbfb328dfc7be6d7d44699f7b3b77b3568a (rovick1/qemu-kvm)
-
-Update the VFIOContainerBase declaration to match our current coding
-guidelines: remove the explicit typedef (this is already handled by the
-OBJECT_DECLARE_TYPE() macro), add a blank line after the parent object,
-rename parent to parent_obj, and move the macro declaration next to the
-VFIOContainerBase struct declaration.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-2-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 42875d256d204e69b608f2bd265f85fae32dd4bd)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- include/hw/vfio/vfio-container-base.h | 13 +++++++------
- 1 file changed, 7 insertions(+), 6 deletions(-)
-
-diff --git a/include/hw/vfio/vfio-container-base.h b/include/hw/vfio/vfio-container-base.h
-index bded6e993f..acbd48a18a 100644
---- a/include/hw/vfio/vfio-container-base.h
-+++ b/include/hw/vfio/vfio-container-base.h
-@@ -33,8 +33,9 @@ typedef struct VFIOAddressSpace {
- /*
- * This is the base object for vfio container backends
- */
--typedef struct VFIOContainerBase {
-- Object parent;
-+struct VFIOContainerBase {
-+ Object parent_obj;
-+
- VFIOAddressSpace *space;
- MemoryListener listener;
- Error *error;
-@@ -51,7 +52,10 @@ typedef struct VFIOContainerBase {
- QLIST_HEAD(, VFIODevice) device_list;
- GList *iova_ranges;
- NotifierWithReturn cpr_reboot_notifier;
--} VFIOContainerBase;
-+};
-+
-+#define TYPE_VFIO_IOMMU "vfio-iommu"
-+OBJECT_DECLARE_TYPE(VFIOContainerBase, VFIOIOMMUClass, VFIO_IOMMU)
-
- typedef struct VFIOGuestIOMMU {
- VFIOContainerBase *bcontainer;
-@@ -105,14 +109,11 @@ vfio_container_get_page_size_mask(const VFIOContainerBase *bcontainer)
- return bcontainer->pgsizes;
- }
-
--#define TYPE_VFIO_IOMMU "vfio-iommu"
- #define TYPE_VFIO_IOMMU_LEGACY TYPE_VFIO_IOMMU "-legacy"
- #define TYPE_VFIO_IOMMU_SPAPR TYPE_VFIO_IOMMU "-spapr"
- #define TYPE_VFIO_IOMMU_IOMMUFD TYPE_VFIO_IOMMU "-iommufd"
- #define TYPE_VFIO_IOMMU_USER TYPE_VFIO_IOMMU "-user"
-
--OBJECT_DECLARE_TYPE(VFIOContainerBase, VFIOIOMMUClass, VFIO_IOMMU)
--
- struct VFIOIOMMUClass {
- ObjectClass parent_class;
-
---
-2.52.0
-
diff --git a/kvm-vfio-vfio-container.h-rename-VFIOContainer-bcontaine.patch b/kvm-vfio-vfio-container.h-rename-VFIOContainer-bcontaine.patch
deleted file mode 100644
index 9a07746..0000000
--- a/kvm-vfio-vfio-container.h-rename-VFIOContainer-bcontaine.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 849dde57c6e53aea022ee543a862ed4508556dbd Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:47 +0100
-Subject: [PATCH 034/116] vfio/vfio-container.h: rename VFIOContainer
- bcontainer field to parent_obj
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [18/100] 855ee391410e84df410bf0d60b908b57732e98a9 (rovick1/qemu-kvm)
-
-Now that nothing accesses the bcontainer field directly, rename bcontainer to
-parent_obj as per our current coding guidelines.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-8-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 507a118e9f8cc328c55adc531336e075fa8ee2d7)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- include/hw/vfio/vfio-container.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/hw/vfio/vfio-container.h b/include/hw/vfio/vfio-container.h
-index 50c91788d5..240f566993 100644
---- a/include/hw/vfio/vfio-container.h
-+++ b/include/hw/vfio/vfio-container.h
-@@ -26,7 +26,7 @@ typedef struct VFIOGroup {
- } VFIOGroup;
-
- struct VFIOContainer {
-- VFIOContainerBase bcontainer;
-+ VFIOContainerBase parent_obj;
-
- int fd; /* /dev/vfio/vfio, empowered by the attached groups */
- unsigned iommu_type;
---
-2.52.0
-
diff --git a/kvm-vfio-vfio-container.h-update-VFIOContainer-declarati.patch b/kvm-vfio-vfio-container.h-update-VFIOContainer-declarati.patch
deleted file mode 100644
index bb2a610..0000000
--- a/kvm-vfio-vfio-container.h-update-VFIOContainer-declarati.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 686d603502ea7af8420f9fee603cca00103159dc Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Tue, 15 Jul 2025 10:25:42 +0100
-Subject: [PATCH 030/116] vfio/vfio-container.h: update VFIOContainer
- declaration
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [14/100] 436abec7a08de2d3558242abbd20adc0330f6200 (rovick1/qemu-kvm)
-
-Update the VFIOContainer declaration so that it is closer to our coding
-guidelines: emove the explicit typedef (this is already handled by the
-OBJECT_DECLARE_TYPE() macro) and add a blank line after the parent object.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
-Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-3-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit 98c12de5aeb1cb464a9cde13cd7a53dd6520d3aa)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- include/hw/vfio/vfio-container.h | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/include/hw/vfio/vfio-container.h b/include/hw/vfio/vfio-container.h
-index 21e5807e48..50c91788d5 100644
---- a/include/hw/vfio/vfio-container.h
-+++ b/include/hw/vfio/vfio-container.h
-@@ -25,13 +25,14 @@ typedef struct VFIOGroup {
- bool ram_block_discard_allowed;
- } VFIOGroup;
-
--typedef struct VFIOContainer {
-+struct VFIOContainer {
- VFIOContainerBase bcontainer;
-+
- int fd; /* /dev/vfio/vfio, empowered by the attached groups */
- unsigned iommu_type;
- QLIST_HEAD(, VFIOGroup) group_list;
- VFIOContainerCPR cpr;
--} VFIOContainer;
-+};
-
- OBJECT_DECLARE_SIMPLE_TYPE(VFIOContainer, VFIO_IOMMU_LEGACY);
-
---
-2.52.0
-
diff --git a/kvm-vfio-vfio-iommufd.h-rename-VFIOContainer-bcontainer-.patch b/kvm-vfio-vfio-iommufd.h-rename-VFIOContainer-bcontainer-.patch
deleted file mode 100644
index 12d3c98..0000000
--- a/kvm-vfio-vfio-iommufd.h-rename-VFIOContainer-bcontainer-.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From b77a509616b7947e546491196ac97ca6cc34aede Mon Sep 17 00:00:00 2001
-From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Date: Thu, 25 Sep 2025 12:31:17 +0100
-Subject: [PATCH 059/116] vfio/vfio-iommufd.h: rename VFIOContainer bcontainer
- field to parent_obj
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Rodolfo Vick <None>
-RH-MergeRequest: 486: Add DMABUF support
-RH-Jira: RHEL-138494
-RH-Acked-by: Cédric Le Goater <clg@redhat.com>
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Commit: [43/100] 2676c22c782a92aa2ff910f437f6a1d830e01f7d (rovick1/qemu-kvm)
-
-Now that nothing accesses the bcontainer field directly, rename bcontainer to
-parent_obj as per our current coding guidelines.
-
-Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
-Reviewed-by: Cédric Le Goater <clg@redhat.com>
-Link: https://lore.kernel.org/qemu-devel/20250925113159.1760317-10-mark.caveayland@nutanix.com
-Signed-off-by: Cédric Le Goater <clg@redhat.com>
-(cherry picked from commit a7f185cbeca75555a7fa7272afbd3a06bc4f7f66)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- hw/vfio/vfio-iommufd.h | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/hw/vfio/vfio-iommufd.h b/hw/vfio/vfio-iommufd.h
-index 13f412aad7..6b28e1ff7b 100644
---- a/hw/vfio/vfio-iommufd.h
-+++ b/hw/vfio/vfio-iommufd.h
-@@ -22,12 +22,13 @@ typedef struct VFIOIOASHwpt {
-
- typedef struct IOMMUFDBackend IOMMUFDBackend;
-
--typedef struct VFIOIOMMUFDContainer {
-- VFIOContainer bcontainer;
-+struct VFIOIOMMUFDContainer {
-+ VFIOContainer parent_obj;
-+
- IOMMUFDBackend *be;
- uint32_t ioas_id;
- QLIST_HEAD(, VFIOIOASHwpt) hwpt_list;
--} VFIOIOMMUFDContainer;
-+};
-
- OBJECT_DECLARE_SIMPLE_TYPE(VFIOIOMMUFDContainer, VFIO_IOMMU_IOMMUFD);
-
---
-2.52.0
-
diff --git a/kvm-vhost-add-support-for-negotiating-extended-features.patch b/kvm-vhost-add-support-for-negotiating-extended-features.patch
deleted file mode 100644
index d3e50e5..0000000
--- a/kvm-vhost-add-support-for-negotiating-extended-features.patch
+++ /dev/null
@@ -1,292 +0,0 @@
-From 32cf8e1f3e289c67f49240e8301979d78801258b Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:22 +0200
-Subject: [PATCH 13/19] vhost: add support for negotiating extended features
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [8/14] 7546d4a0222e49da3a0536a703b89a015a80932c (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-Similar to virtio infra, vhost core maintains the features status
-in the full extended format and allows the devices to implement
-extended version of the getter/setter.
-
-Note that 'protocol_features' are not extended: they are only
-used by vhost-user, and the latter device is not going to implement
-extended features soon.
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <a0062c3b1847fb2baedd6cd8f6ef13b051d6beb2.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit 9f979ef0e01a2dd47d167c482a9e2d1dcdff2d3f)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- hw/virtio/vhost.c | 68 ++++++++++++++++++++++---------
- include/hw/virtio/vhost-backend.h | 6 +++
- include/hw/virtio/vhost.h | 56 +++++++++++++++++++++----
- 3 files changed, 103 insertions(+), 27 deletions(-)
-
-diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
-index 6557c58d12..5f485ad6cb 100644
---- a/hw/virtio/vhost.c
-+++ b/hw/virtio/vhost.c
-@@ -972,20 +972,34 @@ static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
- static int vhost_dev_set_features(struct vhost_dev *dev,
- bool enable_log)
- {
-- uint64_t features = dev->acked_features;
-+ uint64_t features[VIRTIO_FEATURES_NU64S];
- int r;
-+
-+ virtio_features_copy(features, dev->acked_features_ex);
- if (enable_log) {
-- features |= 0x1ULL << VHOST_F_LOG_ALL;
-+ virtio_add_feature_ex(features, VHOST_F_LOG_ALL);
- }
- if (!vhost_dev_has_iommu(dev)) {
-- features &= ~(0x1ULL << VIRTIO_F_IOMMU_PLATFORM);
-+ virtio_clear_feature_ex(features, VIRTIO_F_IOMMU_PLATFORM);
- }
- if (dev->vhost_ops->vhost_force_iommu) {
- if (dev->vhost_ops->vhost_force_iommu(dev) == true) {
-- features |= 0x1ULL << VIRTIO_F_IOMMU_PLATFORM;
-+ virtio_add_feature_ex(features, VIRTIO_F_IOMMU_PLATFORM);
- }
- }
-- r = dev->vhost_ops->vhost_set_features(dev, features);
-+
-+ if (virtio_features_use_ex(features) &&
-+ !dev->vhost_ops->vhost_set_features_ex) {
-+ r = -EINVAL;
-+ VHOST_OPS_DEBUG(r, "extended features without device support");
-+ goto out;
-+ }
-+
-+ if (dev->vhost_ops->vhost_set_features_ex) {
-+ r = dev->vhost_ops->vhost_set_features_ex(dev, features);
-+ } else {
-+ r = dev->vhost_ops->vhost_set_features(dev, features[0]);
-+ }
- if (r < 0) {
- VHOST_OPS_DEBUG(r, "vhost_set_features failed");
- goto out;
-@@ -1508,12 +1522,27 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq)
- }
- }
-
-+static int vhost_dev_get_features(struct vhost_dev *hdev,
-+ uint64_t *features)
-+{
-+ uint64_t features64;
-+ int r;
-+
-+ if (hdev->vhost_ops->vhost_get_features_ex) {
-+ return hdev->vhost_ops->vhost_get_features_ex(hdev, features);
-+ }
-+
-+ r = hdev->vhost_ops->vhost_get_features(hdev, &features64);
-+ virtio_features_from_u64(features, features64);
-+ return r;
-+}
-+
- int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
- VhostBackendType backend_type, uint32_t busyloop_timeout,
- Error **errp)
- {
-+ uint64_t features[VIRTIO_FEATURES_NU64S];
- unsigned int used, reserved, limit;
-- uint64_t features;
- int i, r, n_initialized_vqs = 0;
-
- hdev->vdev = NULL;
-@@ -1533,7 +1562,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
- goto fail;
- }
-
-- r = hdev->vhost_ops->vhost_get_features(hdev, &features);
-+ r = vhost_dev_get_features(hdev, features);
- if (r < 0) {
- error_setg_errno(errp, -r, "vhost_get_features failed");
- goto fail;
-@@ -1571,7 +1600,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
- }
- }
-
-- hdev->features = features;
-+ virtio_features_copy(hdev->features_ex, features);
-
- hdev->memory_listener = (MemoryListener) {
- .name = "vhost",
-@@ -1594,7 +1623,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
- };
-
- if (hdev->migration_blocker == NULL) {
-- if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) {
-+ if (!virtio_has_feature_ex(hdev->features_ex, VHOST_F_LOG_ALL)) {
- error_setg(&hdev->migration_blocker,
- "Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.");
- } else if (vhost_dev_log_is_shared(hdev) && !qemu_memfd_alloc_check()) {
-@@ -1859,28 +1888,27 @@ static void vhost_start_config_intr(struct vhost_dev *dev)
- }
- }
-
--uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bits,
-- uint64_t features)
-+void vhost_get_features_ex(struct vhost_dev *hdev,
-+ const int *feature_bits,
-+ uint64_t *features)
- {
- const int *bit = feature_bits;
-+
- while (*bit != VHOST_INVALID_FEATURE_BIT) {
-- uint64_t bit_mask = (1ULL << *bit);
-- if (!(hdev->features & bit_mask)) {
-- features &= ~bit_mask;
-+ if (!virtio_has_feature_ex(hdev->features_ex, *bit)) {
-+ virtio_clear_feature_ex(features, *bit);
- }
- bit++;
- }
-- return features;
- }
-
--void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits,
-- uint64_t features)
-+void vhost_ack_features_ex(struct vhost_dev *hdev, const int *feature_bits,
-+ const uint64_t *features)
- {
- const int *bit = feature_bits;
- while (*bit != VHOST_INVALID_FEATURE_BIT) {
-- uint64_t bit_mask = (1ULL << *bit);
-- if (features & bit_mask) {
-- hdev->acked_features |= bit_mask;
-+ if (virtio_has_feature_ex(features, *bit)) {
-+ virtio_add_feature_ex(hdev->acked_features_ex, *bit);
- }
- bit++;
- }
-diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h
-index d6df209a2f..ff94fa1734 100644
---- a/include/hw/virtio/vhost-backend.h
-+++ b/include/hw/virtio/vhost-backend.h
-@@ -95,6 +95,10 @@ typedef int (*vhost_new_worker_op)(struct vhost_dev *dev,
- struct vhost_worker_state *worker);
- typedef int (*vhost_free_worker_op)(struct vhost_dev *dev,
- struct vhost_worker_state *worker);
-+typedef int (*vhost_set_features_ex_op)(struct vhost_dev *dev,
-+ const uint64_t *features);
-+typedef int (*vhost_get_features_ex_op)(struct vhost_dev *dev,
-+ uint64_t *features);
- typedef int (*vhost_set_features_op)(struct vhost_dev *dev,
- uint64_t features);
- typedef int (*vhost_get_features_op)(struct vhost_dev *dev,
-@@ -186,6 +190,8 @@ typedef struct VhostOps {
- vhost_free_worker_op vhost_free_worker;
- vhost_get_vring_worker_op vhost_get_vring_worker;
- vhost_attach_vring_worker_op vhost_attach_vring_worker;
-+ vhost_set_features_ex_op vhost_set_features_ex;
-+ vhost_get_features_ex_op vhost_get_features_ex;
- vhost_set_features_op vhost_set_features;
- vhost_get_features_op vhost_get_features;
- vhost_set_backend_cap_op vhost_set_backend_cap;
-diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
-index 66be6afc88..08bbb4dfe9 100644
---- a/include/hw/virtio/vhost.h
-+++ b/include/hw/virtio/vhost.h
-@@ -107,9 +107,9 @@ struct vhost_dev {
- * future use should be discouraged and the variable retired as
- * its easy to confuse with the VirtIO backend_features.
- */
-- uint64_t features;
-- uint64_t acked_features;
-- uint64_t backend_features;
-+ VIRTIO_DECLARE_FEATURES(features);
-+ VIRTIO_DECLARE_FEATURES(acked_features);
-+ VIRTIO_DECLARE_FEATURES(backend_features);
-
- /**
- * @protocol_features: is the vhost-user only feature set by
-@@ -320,6 +320,20 @@ bool vhost_virtqueue_pending(struct vhost_dev *hdev, int n);
- void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n,
- bool mask);
-
-+/**
-+ * vhost_get_features_ex() - sanitize the extended features set
-+ * @hdev: common vhost_dev structure
-+ * @feature_bits: pointer to terminated table of feature bits
-+ * @features: original features set, filtered out on return
-+ *
-+ * This is the extended variant of vhost_get_features(), supporting the
-+ * the extended features set. Filter it with the intersection of what is
-+ * supported by the vhost backend (hdev->features) and the supported
-+ * feature_bits.
-+ */
-+void vhost_get_features_ex(struct vhost_dev *hdev,
-+ const int *feature_bits,
-+ uint64_t *features);
- /**
- * vhost_get_features() - return a sanitised set of feature bits
- * @hdev: common vhost_dev structure
-@@ -330,8 +344,28 @@ void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n,
- * is supported by the vhost backend (hdev->features), the supported
- * feature_bits and the requested feature set.
- */
--uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bits,
-- uint64_t features);
-+static inline uint64_t vhost_get_features(struct vhost_dev *hdev,
-+ const int *feature_bits,
-+ uint64_t features)
-+{
-+ uint64_t features_ex[VIRTIO_FEATURES_NU64S];
-+
-+ virtio_features_from_u64(features_ex, features);
-+ vhost_get_features_ex(hdev, feature_bits, features_ex);
-+ return features_ex[0];
-+}
-+
-+/**
-+ * vhost_ack_features_ex() - set vhost full set of acked_features
-+ * @hdev: common vhost_dev structure
-+ * @feature_bits: pointer to terminated table of feature bits
-+ * @features: requested feature set
-+ *
-+ * This sets the internal hdev->acked_features to the intersection of
-+ * the backends advertised features and the supported feature_bits.
-+ */
-+void vhost_ack_features_ex(struct vhost_dev *hdev, const int *feature_bits,
-+ const uint64_t *features);
-
- /**
- * vhost_ack_features() - set vhost acked_features
-@@ -342,8 +376,16 @@ uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bits,
- * This sets the internal hdev->acked_features to the intersection of
- * the backends advertised features and the supported feature_bits.
- */
--void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits,
-- uint64_t features);
-+static inline void vhost_ack_features(struct vhost_dev *hdev,
-+ const int *feature_bits,
-+ uint64_t features)
-+{
-+ uint64_t features_ex[VIRTIO_FEATURES_NU64S];
-+
-+ virtio_features_from_u64(features_ex, features);
-+ vhost_ack_features_ex(hdev, feature_bits, features_ex);
-+}
-+
- unsigned int vhost_get_max_memslots(void);
- unsigned int vhost_get_free_memslots(void);
-
---
-2.47.3
-
diff --git a/kvm-vhost-backend-implement-extended-features-support.patch b/kvm-vhost-backend-implement-extended-features-support.patch
deleted file mode 100644
index fe43faa..0000000
--- a/kvm-vhost-backend-implement-extended-features-support.patch
+++ /dev/null
@@ -1,133 +0,0 @@
-From d0e31af77cd51df8c17fa4d304571f8b1eb5ce29 Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:24 +0200
-Subject: [PATCH 15/19] vhost-backend: implement extended features support
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [10/14] bd12c2f08dad502a7359d4344a2220b10ac96a48 (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-Leverage the kernel extended features manipulation ioctls(), if
-available, and fallback to old ops otherwise. Error out when setting
-extended features but kernel support is not available.
-
-Note that extended support for get/set backend features is not needed,
-as the only feature that can be changed belongs to the 64 bit range.
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <150daade3d59e77629276920e014ee8e5fc12121.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit f412c1f57ab58fd595efee26264193759220ca6f)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- hw/virtio/vhost-backend.c | 62 ++++++++++++++++++++++++++++++++-------
- 1 file changed, 51 insertions(+), 11 deletions(-)
-
-diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c
-index 833804dd40..4367db0d95 100644
---- a/hw/virtio/vhost-backend.c
-+++ b/hw/virtio/vhost-backend.c
-@@ -20,6 +20,11 @@
- #include <linux/vhost.h>
- #include <sys/ioctl.h>
-
-+struct vhost_features {
-+ uint64_t count;
-+ uint64_t features[VIRTIO_FEATURES_NU64S];
-+};
-+
- static int vhost_kernel_call(struct vhost_dev *dev, unsigned long int request,
- void *arg)
- {
-@@ -182,12 +187,6 @@ static int vhost_kernel_get_vring_worker(struct vhost_dev *dev,
- return vhost_kernel_call(dev, VHOST_GET_VRING_WORKER, worker);
- }
-
--static int vhost_kernel_set_features(struct vhost_dev *dev,
-- uint64_t features)
--{
-- return vhost_kernel_call(dev, VHOST_SET_FEATURES, &features);
--}
--
- static int vhost_kernel_set_backend_cap(struct vhost_dev *dev)
- {
- uint64_t features;
-@@ -210,10 +209,51 @@ static int vhost_kernel_set_backend_cap(struct vhost_dev *dev)
- return 0;
- }
-
--static int vhost_kernel_get_features(struct vhost_dev *dev,
-- uint64_t *features)
-+static int vhost_kernel_set_features(struct vhost_dev *dev,
-+ const uint64_t *features)
- {
-- return vhost_kernel_call(dev, VHOST_GET_FEATURES, features);
-+ struct vhost_features farray;
-+ bool extended_in_use;
-+ int r;
-+
-+ farray.count = VIRTIO_FEATURES_NU64S;
-+ virtio_features_copy(farray.features, features);
-+ extended_in_use = virtio_features_use_ex(farray.features);
-+
-+ /*
-+ * Can't check for ENOTTY: for unknown ioctls the kernel interprets
-+ * the argument as a virtio queue id and most likely errors out validating
-+ * such id, instead of reporting an unknown operation.
-+ */
-+ r = vhost_kernel_call(dev, VHOST_SET_FEATURES_ARRAY, &farray);
-+ if (!r) {
-+ return 0;
-+ }
-+
-+ if (extended_in_use) {
-+ error_report("Trying to set extended features without kernel support");
-+ return -EINVAL;
-+ }
-+ return vhost_kernel_call(dev, VHOST_SET_FEATURES, &farray.features[0]);
-+}
-+
-+static int vhost_kernel_get_features(struct vhost_dev *dev, uint64_t *features)
-+{
-+ struct vhost_features farray;
-+ int r;
-+
-+ farray.count = VIRTIO_FEATURES_NU64S;
-+ r = vhost_kernel_call(dev, VHOST_GET_FEATURES_ARRAY, &farray);
-+ if (r) {
-+ memset(&farray, 0, sizeof(farray));
-+ r = vhost_kernel_call(dev, VHOST_GET_FEATURES, &farray.features[0]);
-+ }
-+ if (r) {
-+ return r;
-+ }
-+
-+ virtio_features_copy(features, farray.features);
-+ return 0;
- }
-
- static int vhost_kernel_set_owner(struct vhost_dev *dev)
-@@ -341,8 +381,8 @@ const VhostOps kernel_ops = {
- .vhost_attach_vring_worker = vhost_kernel_attach_vring_worker,
- .vhost_new_worker = vhost_kernel_new_worker,
- .vhost_free_worker = vhost_kernel_free_worker,
-- .vhost_set_features = vhost_kernel_set_features,
-- .vhost_get_features = vhost_kernel_get_features,
-+ .vhost_set_features_ex = vhost_kernel_set_features,
-+ .vhost_get_features_ex = vhost_kernel_get_features,
- .vhost_set_backend_cap = vhost_kernel_set_backend_cap,
- .vhost_set_owner = vhost_kernel_set_owner,
- .vhost_get_vq_index = vhost_kernel_get_vq_index,
---
-2.47.3
-
diff --git a/kvm-vhost-net-implement-extended-features-support.patch b/kvm-vhost-net-implement-extended-features-support.patch
deleted file mode 100644
index bf04384..0000000
--- a/kvm-vhost-net-implement-extended-features-support.patch
+++ /dev/null
@@ -1,237 +0,0 @@
-From 7eb0a4d5d5a03fd631b87c59dc531080f93a0640 Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:25 +0200
-Subject: [PATCH 16/19] vhost-net: implement extended features support
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [11/14] 48cf0458bd30eeca10dace74ca2a8871dc0c8bca (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-Provide extended version of the features manipulation helpers,
-and let the device initialization deal with the full features space,
-adjusting the relevant format strings accordingly.
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <69c78c432e28e146a8874b2a7d00e9cbd111b1ba.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit d55ad8c9a9a5edd8152f13fc97879d66972f103e)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- hw/net/vhost_net-stub.c | 8 +++-----
- hw/net/vhost_net.c | 45 +++++++++++++++++++++++------------------
- include/net/vhost_net.h | 33 +++++++++++++++++++++++++++---
- 3 files changed, 58 insertions(+), 28 deletions(-)
-
-diff --git a/hw/net/vhost_net-stub.c b/hw/net/vhost_net-stub.c
-index 7d49f82906..0740d5a2eb 100644
---- a/hw/net/vhost_net-stub.c
-+++ b/hw/net/vhost_net-stub.c
-@@ -46,9 +46,8 @@ void vhost_net_cleanup(struct vhost_net *net)
- {
- }
-
--uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features)
-+void vhost_net_get_features_ex(struct vhost_net *net, uint64_t *features)
- {
-- return features;
- }
-
- int vhost_net_get_config(struct vhost_net *net, uint8_t *config,
-@@ -62,13 +61,12 @@ int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
- return 0;
- }
-
--void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
-+void vhost_net_ack_features_ex(struct vhost_net *net, const uint64_t *features)
- {
- }
-
--uint64_t vhost_net_get_acked_features(VHostNetState *net)
-+void vhost_net_get_acked_features_ex(VHostNetState *net, uint64_t *features)
- {
-- return 0;
- }
-
- bool vhost_net_virtqueue_pending(VHostNetState *net, int idx)
-diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
-index 540492b37d..a8ee18a912 100644
---- a/hw/net/vhost_net.c
-+++ b/hw/net/vhost_net.c
-@@ -35,10 +35,9 @@
- #include "hw/virtio/virtio-bus.h"
- #include "linux-headers/linux/vhost.h"
-
--uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features)
-+void vhost_net_get_features_ex(struct vhost_net *net, uint64_t *features)
- {
-- return vhost_get_features(&net->dev, net->feature_bits,
-- features);
-+ vhost_get_features_ex(&net->dev, net->feature_bits, features);
- }
- int vhost_net_get_config(struct vhost_net *net, uint8_t *config,
- uint32_t config_len)
-@@ -51,10 +50,11 @@ int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
- return vhost_dev_set_config(&net->dev, data, offset, size, flags);
- }
-
--void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
-+void vhost_net_ack_features_ex(struct vhost_net *net, const uint64_t *features)
- {
-- net->dev.acked_features = net->dev.backend_features;
-- vhost_ack_features(&net->dev, net->feature_bits, features);
-+ virtio_features_copy(net->dev.acked_features_ex,
-+ net->dev.backend_features_ex);
-+ vhost_ack_features_ex(&net->dev, net->feature_bits, features);
- }
-
- uint64_t vhost_net_get_max_queues(VHostNetState *net)
-@@ -62,9 +62,9 @@ uint64_t vhost_net_get_max_queues(VHostNetState *net)
- return net->dev.max_queues;
- }
-
--uint64_t vhost_net_get_acked_features(VHostNetState *net)
-+void vhost_net_get_acked_features_ex(VHostNetState *net, uint64_t *features)
- {
-- return net->dev.acked_features;
-+ virtio_features_copy(features, net->dev.acked_features_ex);
- }
-
- void vhost_net_save_acked_features(NetClientState *nc)
-@@ -234,7 +234,8 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
- int r;
- bool backend_kernel = options->backend_type == VHOST_BACKEND_TYPE_KERNEL;
- struct vhost_net *net = g_new0(struct vhost_net, 1);
-- uint64_t features = 0;
-+ uint64_t missing_features[VIRTIO_FEATURES_NU64S];
-+ uint64_t features[VIRTIO_FEATURES_NU64S];
- Error *local_err = NULL;
-
- if (!options->net_backend) {
-@@ -247,6 +248,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
- net->save_acked_features = options->save_acked_features;
- net->max_tx_queue_size = options->max_tx_queue_size;
- net->is_vhost_user = options->is_vhost_user;
-+ virtio_features_clear(features);
-
- net->dev.max_queues = 1;
- net->dev.vqs = net->vqs;
-@@ -261,7 +263,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
- net->backend = r;
- net->dev.protocol_features = 0;
- } else {
-- net->dev.backend_features = 0;
-+ virtio_features_clear(net->dev.backend_features_ex);
- net->dev.protocol_features = 0;
- net->backend = -1;
-
-@@ -281,26 +283,29 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
- sizeof(struct virtio_net_hdr_mrg_rxbuf))) {
- net->dev.features &= ~(1ULL << VIRTIO_NET_F_MRG_RXBUF);
- }
-- if (~net->dev.features & net->dev.backend_features) {
-- fprintf(stderr, "vhost lacks feature mask 0x%" PRIx64
-- " for backend\n",
-- (uint64_t)(~net->dev.features & net->dev.backend_features));
-+
-+ if (virtio_features_andnot(missing_features,
-+ net->dev.backend_features_ex,
-+ net->dev.features_ex)) {
-+ fprintf(stderr, "vhost lacks feature mask 0x" VIRTIO_FEATURES_FMT
-+ " for backend\n", VIRTIO_FEATURES_PR(missing_features));
- goto fail;
- }
- }
-
- /* Set sane init value. Override when guest acks. */
- if (options->get_acked_features) {
-- features = options->get_acked_features(net->nc);
-- if (~net->dev.features & features) {
-- fprintf(stderr, "vhost lacks feature mask 0x%" PRIx64
-- " for backend\n",
-- (uint64_t)(~net->dev.features & features));
-+ virtio_features_from_u64(features,
-+ options->get_acked_features(net->nc));
-+ if (virtio_features_andnot(missing_features, features,
-+ net->dev.features_ex)) {
-+ fprintf(stderr, "vhost lacks feature mask 0x" VIRTIO_FEATURES_FMT
-+ " for backend\n", VIRTIO_FEATURES_PR(missing_features));
- goto fail;
- }
- }
-
-- vhost_net_ack_features(net, features);
-+ vhost_net_ack_features_ex(net, features);
-
- return net;
-
-diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h
-index 879781dad7..0225207491 100644
---- a/include/net/vhost_net.h
-+++ b/include/net/vhost_net.h
-@@ -2,6 +2,7 @@
- #define VHOST_NET_H
-
- #include "net/net.h"
-+#include "hw/virtio/virtio-features.h"
- #include "hw/virtio/vhost-backend.h"
-
- struct vhost_net;
-@@ -33,8 +34,26 @@ void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs,
-
- void vhost_net_cleanup(VHostNetState *net);
-
--uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features);
--void vhost_net_ack_features(VHostNetState *net, uint64_t features);
-+void vhost_net_get_features_ex(VHostNetState *net, uint64_t *features);
-+static inline uint64_t vhost_net_get_features(VHostNetState *net,
-+ uint64_t features)
-+{
-+ uint64_t features_array[VIRTIO_FEATURES_NU64S];
-+
-+ virtio_features_from_u64(features_array, features);
-+ vhost_net_get_features_ex(net, features_array);
-+ return features_array[0];
-+}
-+
-+void vhost_net_ack_features_ex(VHostNetState *net, const uint64_t *features);
-+static inline void vhost_net_ack_features(VHostNetState *net,
-+ uint64_t features)
-+{
-+ uint64_t features_array[VIRTIO_FEATURES_NU64S];
-+
-+ virtio_features_from_u64(features_array, features);
-+ vhost_net_ack_features_ex(net, features_array);
-+}
-
- int vhost_net_get_config(struct vhost_net *net, uint8_t *config,
- uint32_t config_len);
-@@ -51,7 +70,15 @@ VHostNetState *get_vhost_net(NetClientState *nc);
-
- int vhost_net_set_vring_enable(NetClientState *nc, int enable);
-
--uint64_t vhost_net_get_acked_features(VHostNetState *net);
-+void vhost_net_get_acked_features_ex(VHostNetState *net, uint64_t *features);
-+static inline uint64_t vhost_net_get_acked_features(VHostNetState *net)
-+{
-+ uint64_t features[VIRTIO_FEATURES_NU64S];
-+
-+ vhost_net_get_acked_features_ex(net, features);
-+ assert(!virtio_features_use_ex(features));
-+ return features[0];
-+}
-
- int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu);
-
---
-2.47.3
-
diff --git a/kvm-vhost-user-make-vhost_set_vring_file-synchronous.patch b/kvm-vhost-user-make-vhost_set_vring_file-synchronous.patch
deleted file mode 100644
index a6a8242..0000000
--- a/kvm-vhost-user-make-vhost_set_vring_file-synchronous.patch
+++ /dev/null
@@ -1,123 +0,0 @@
-From 2643a61dd6de41945d714aac210173754a7b5a7f Mon Sep 17 00:00:00 2001
-From: German Maglione <gmaglione@redhat.com>
-Date: Wed, 22 Oct 2025 18:24:05 +0200
-Subject: [PATCH 1/7] vhost-user: make vhost_set_vring_file() synchronous
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RH-Author: Hanna Czenczek <hreitz@redhat.com>
-RH-MergeRequest: 462: vhost-user: make vhost_set_vring_file() synchronous
-RH-Jira: RHEL-147425
-RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-RH-Acked-by: Eugenio Pérez <eperezma@redhat.com>
-RH-Commit: [1/1] 92476878c6fa5cb8ac1b308d2c8d4275767fd780 (hreitz/qemu-kvm-c-9-s)
-
-QEMU sends all of VHOST_USER_SET_VRING_KICK, _CALL, and _ERR without
-setting the NEED_REPLY flag, i.e. by the time the respective
-vhost_user_set_vring_*() function returns, it is completely up to chance
-whether the back-end has already processed the request and switched over
-to the new FD for interrupts.
-
-At least for vhost_user_set_vring_call(), that is a problem: It is
-called through vhost_virtqueue_mask(), which is generally used in the
-VirtioDeviceClass.guest_notifier_mask() implementation, which is in turn
-called by virtio_pci_one_vector_unmask(). The fact that we do not wait
-for the back-end to install the FD leads to a race there:
-
-Masking interrupts is implemented by redirecting interrupts to an
-internal event FD that is not connected to the guest. Unmasking then
-re-installs the guest-connected IRQ FD, then checks if there are pending
-interrupts left on the masked event FD, and if so, issues an interrupt
-to the guest.
-
-Because guest_notifier_mask() (through vhost_user_set_vring_call())
-doesn't wait for the back-end to switch over to the actual IRQ FD, it's
-possible we check for pending interrupts while the back-end is still
-using the masked event FD, and then we will lose interrupts that occur
-before the back-end finally does switch over.
-
-Fix this by setting NEED_REPLY on those VHOST_USER_SET_VRING_* messages,
-so when we get that reply, we know that the back-end is now using the
-new FD.
-
-We have a few reports of a virtiofs mount hanging:
-- https://gitlab.com/virtio-fs/virtiofsd/-/issues/101
-- https://gitlab.com/virtio-fs/virtiofsd/-/issues/133
-- https://gitlab.com/virtio-fs/virtiofsd/-/issues/213
-
-This is quite difficult bug to reproduce, even for the reporters.
-It only happens on production, every few weeks, and/or on 1 in 300 VMs.
-So, we are not 100% sure this fixes that issue. However, we think this
-is still a bug, and at least we have one report that claims this fixed
-the issue:
-
-https://gitlab.com/virtio-fs/virtiofsd/-/issues/133#note_2743209419
-
-Fixes: 5f6f6664bf24 ("Add vhost-user as a vhost backend.")
-Signed-off-by: German Maglione <gmaglione@redhat.com>
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
-Reviewed-by: Eugenio Pérez <eperezma@redhat.com>
-Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-Message-Id: <20251022162405.318672-1-gmaglione@redhat.com>
-(cherry picked from commit 1ba9a5220325dd5260a0c37b6299ce38364a5120)
-Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
----
- hw/virtio/vhost-user.c | 24 +++++++++++++++++++++++-
- 1 file changed, 23 insertions(+), 1 deletion(-)
-
-diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
-index 1e1d6b0d6e..3e1e1d8d7e 100644
---- a/hw/virtio/vhost-user.c
-+++ b/hw/virtio/vhost-user.c
-@@ -1327,8 +1327,11 @@ static int vhost_set_vring_file(struct vhost_dev *dev,
- VhostUserRequest request,
- struct vhost_vring_file *file)
- {
-+ int ret;
- int fds[VHOST_USER_MAX_RAM_SLOTS];
- size_t fd_num = 0;
-+ bool reply_supported = virtio_has_feature(dev->protocol_features,
-+ VHOST_USER_PROTOCOL_F_REPLY_ACK);
- VhostUserMsg msg = {
- .hdr.request = request,
- .hdr.flags = VHOST_USER_VERSION,
-@@ -1336,13 +1339,32 @@ static int vhost_set_vring_file(struct vhost_dev *dev,
- .hdr.size = sizeof(msg.payload.u64),
- };
-
-+ if (reply_supported) {
-+ msg.hdr.flags |= VHOST_USER_NEED_REPLY_MASK;
-+ }
-+
- if (file->fd > 0) {
- fds[fd_num++] = file->fd;
- } else {
- msg.payload.u64 |= VHOST_USER_VRING_NOFD_MASK;
- }
-
-- return vhost_user_write(dev, &msg, fds, fd_num);
-+ ret = vhost_user_write(dev, &msg, fds, fd_num);
-+ if (ret < 0) {
-+ return ret;
-+ }
-+
-+ if (reply_supported) {
-+ /*
-+ * wait for the back-end's confirmation that the new FD is active,
-+ * otherwise guest_notifier_mask() could check for pending interrupts
-+ * while the back-end is still using the masked event FD, losing
-+ * interrupts that occur before the back-end installs the FD
-+ */
-+ return process_message_reply(dev, &msg);
-+ }
-+
-+ return 0;
- }
-
- static int vhost_user_set_vring_kick(struct vhost_dev *dev,
---
-2.47.3
-
diff --git a/kvm-virtio-Fix-crash-when-sriov-pf-is-set-for-non-PCI-Ex.patch b/kvm-virtio-Fix-crash-when-sriov-pf-is-set-for-non-PCI-Ex.patch
deleted file mode 100644
index 0ea10be..0000000
--- a/kvm-virtio-Fix-crash-when-sriov-pf-is-set-for-non-PCI-Ex.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From e9d0e7db0e7e90fb8a71e3725cdceba7a83b665e Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Thu, 4 Dec 2025 18:26:57 +0100
-Subject: [PATCH 37/52] virtio: Fix crash when sriov-pf is set for
- non-PCI-Express device
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [30/45] 3987bd2c53e0f4cb44d10ad4724a42ccacc4a705 (kmwolf/centos-qemu-kvm)
-
-Setting the sriov-pf property on devices that aren't PCI Express causes
-an assertion failure:
-
- $ qemu-system-x86_64 \
- -blockdev null-co,node-name=null \
- -blockdev null-co,node-name=null2 \
- -device virtio-blk,drive=null,id=pf \
- -device virtio-blk,sriov-pf=pf,drive=null2
- qemu-system-x86_64: ../hw/pci/pcie.c:1062: void pcie_add_capability(PCIDevice *, uint16_t, uint8_t, uint16_t, uint16_t): Assertion `offset >= PCI_CONFIG_SPACE_SIZE' failed.
-
-This is because proxy->last_pcie_cap_offset is only initialised to a
-non-zero value in virtio_pci_realize() if it's a PCI Express device, and
-then virtio_pci_device_plugged() still tries to use it.
-
-To fix this, just skip the SR-IOV code for !pci_is_express(). Then the
-next thing pci_qdev_realize() does is call pcie_sriov_register_device(),
-which returns the appropriate error.
-
-Cc: qemu-stable@nongnu.org
-Fixes: d0c280d3fac6 ('pcie_sriov: Make a PCI device with user-created VF ARI-capable')
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-Message-Id: <20251204172657.174391-1-kwolf@redhat.com>
-(cherry picked from commit 623db856476806124e9ae45fbc39e75012261570)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- hw/virtio/virtio-pci.c | 20 +++++++++++---------
- 1 file changed, 11 insertions(+), 9 deletions(-)
-
-diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
-index 937e22f08a..044ecb4f41 100644
---- a/hw/virtio/virtio-pci.c
-+++ b/hw/virtio/virtio-pci.c
-@@ -2172,15 +2172,17 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
- PCI_BASE_ADDRESS_SPACE_IO, &proxy->bar);
- }
-
-- if (pci_is_vf(&proxy->pci_dev)) {
-- pcie_ari_init(&proxy->pci_dev, proxy->last_pcie_cap_offset);
-- proxy->last_pcie_cap_offset += PCI_ARI_SIZEOF;
-- } else {
-- res = pcie_sriov_pf_init_from_user_created_vfs(
-- &proxy->pci_dev, proxy->last_pcie_cap_offset, errp);
-- if (res > 0) {
-- proxy->last_pcie_cap_offset += res;
-- virtio_add_feature(&vdev->host_features, VIRTIO_F_SR_IOV);
-+ if (pci_is_express(&proxy->pci_dev)) {
-+ if (pci_is_vf(&proxy->pci_dev)) {
-+ pcie_ari_init(&proxy->pci_dev, proxy->last_pcie_cap_offset);
-+ proxy->last_pcie_cap_offset += PCI_ARI_SIZEOF;
-+ } else {
-+ res = pcie_sriov_pf_init_from_user_created_vfs(
-+ &proxy->pci_dev, proxy->last_pcie_cap_offset, errp);
-+ if (res > 0) {
-+ proxy->last_pcie_cap_offset += res;
-+ virtio_add_feature(&vdev->host_features, VIRTIO_F_SR_IOV);
-+ }
- }
- }
- }
---
-2.52.0
-
diff --git a/kvm-virtio-add-support-for-negotiating-extended-features.patch b/kvm-virtio-add-support-for-negotiating-extended-features.patch
deleted file mode 100644
index 53a5d72..0000000
--- a/kvm-virtio-add-support-for-negotiating-extended-features.patch
+++ /dev/null
@@ -1,133 +0,0 @@
-From d7e0acde126d1f5385096d6b7247de82ee6b0e8d Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:20 +0200
-Subject: [PATCH 11/19] virtio: add support for negotiating extended features
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [6/14] 56553123a4941b457a34af8be01b5757a97706e6 (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-The virtio specifications allows for a device features space up
-to 128 bits and more. Soon we are going to use some of the 'extended'
-bits features for the virtio net driver.
-
-Add support to allow extended features negotiation on a per
-devices basis. Devices willing to negotiated extended features
-need to implemented a new pair of features getter/setter, the
-core will conditionally use them instead of the basic one.
-
-Note that 'bad_features' don't need to be extended, as they are
-bound to the 64 bits limit.
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <9bb29d70adc3f2b8c7756d4e3cd076cffee87826.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit 64a6a336f42bc6305ab7589fd874cb4a3d403bd0)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- hw/virtio/virtio-bus.c | 11 ++++++++---
- hw/virtio/virtio.c | 14 +++++++++++---
- include/hw/virtio/virtio.h | 4 ++++
- 3 files changed, 23 insertions(+), 6 deletions(-)
-
-diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
-index 11adfbf3ab..cef944e015 100644
---- a/hw/virtio/virtio-bus.c
-+++ b/hw/virtio/virtio-bus.c
-@@ -62,9 +62,14 @@ void virtio_bus_device_plugged(VirtIODevice *vdev, Error **errp)
- }
-
- /* Get the features of the plugged device. */
-- assert(vdc->get_features != NULL);
-- vdev->host_features = vdc->get_features(vdev, vdev->host_features,
-- &local_err);
-+ if (vdc->get_features_ex) {
-+ vdc->get_features_ex(vdev, vdev->host_features_ex, &local_err);
-+ } else {
-+ assert(vdc->get_features != NULL);
-+ virtio_features_from_u64(vdev->host_features_ex,
-+ vdc->get_features(vdev, vdev->host_features,
-+ &local_err));
-+ }
- if (local_err) {
- error_propagate(errp, local_err);
- return;
-diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
-index bf53c211e5..34f977a3c9 100644
---- a/hw/virtio/virtio.c
-+++ b/hw/virtio/virtio.c
-@@ -3103,7 +3103,9 @@ static int virtio_set_features_nocheck(VirtIODevice *vdev, const uint64_t *val)
- bad = virtio_features_andnot(tmp, val, vdev->host_features_ex);
- virtio_features_and(tmp, val, vdev->host_features_ex);
-
-- if (k->set_features) {
-+ if (k->set_features_ex) {
-+ k->set_features_ex(vdev, val);
-+ } else if (k->set_features) {
- bad = bad || virtio_features_use_ex(tmp);
- k->set_features(vdev, tmp[0]);
- }
-@@ -3149,6 +3151,13 @@ virtio_set_features_nocheck_maybe_co(VirtIODevice *vdev,
- int virtio_set_features(VirtIODevice *vdev, uint64_t val)
- {
- uint64_t features[VIRTIO_FEATURES_NU64S];
-+
-+ virtio_features_from_u64(features, val);
-+ return virtio_set_features_ex(vdev, features);
-+}
-+
-+int virtio_set_features_ex(VirtIODevice *vdev, const uint64_t *features)
-+{
- int ret;
- /*
- * The driver must not attempt to set features after feature negotiation
-@@ -3158,13 +3167,12 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)
- return -EINVAL;
- }
-
-- if (val & (1ull << VIRTIO_F_BAD_FEATURE)) {
-+ if (features[0] & (1ull << VIRTIO_F_BAD_FEATURE)) {
- qemu_log_mask(LOG_GUEST_ERROR,
- "%s: guest driver for %s has enabled UNUSED(30) feature bit!\n",
- __func__, vdev->name);
- }
-
-- virtio_features_from_u64(features, val);
- ret = virtio_set_features_nocheck(vdev, features);
- if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) {
- /* VIRTIO_RING_F_EVENT_IDX changes the size of the caches. */
-diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
-index 39e4059a66..2aeb021fb3 100644
---- a/include/hw/virtio/virtio.h
-+++ b/include/hw/virtio/virtio.h
-@@ -178,6 +178,9 @@ struct VirtioDeviceClass {
- /* This is what a VirtioDevice must implement */
- DeviceRealize realize;
- DeviceUnrealize unrealize;
-+ void (*get_features_ex)(VirtIODevice *vdev, uint64_t *requested_features,
-+ Error **errp);
-+ void (*set_features_ex)(VirtIODevice *vdev, const uint64_t *val);
- uint64_t (*get_features)(VirtIODevice *vdev,
- uint64_t requested_features,
- Error **errp);
-@@ -373,6 +376,7 @@ void virtio_queue_reset(VirtIODevice *vdev, uint32_t queue_index);
- void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index);
- void virtio_update_irq(VirtIODevice *vdev);
- int virtio_set_features(VirtIODevice *vdev, uint64_t val);
-+int virtio_set_features_ex(VirtIODevice *vdev, const uint64_t *val);
-
- /* Base devices. */
- typedef struct VirtIOBlkConf VirtIOBlkConf;
---
-2.47.3
-
diff --git a/kvm-virtio-blk-add-missing-VIRTIO_BLK_T_SCSI_CMD-size-ch.patch b/kvm-virtio-blk-add-missing-VIRTIO_BLK_T_SCSI_CMD-size-ch.patch
deleted file mode 100644
index 9dbdd58..0000000
--- a/kvm-virtio-blk-add-missing-VIRTIO_BLK_T_SCSI_CMD-size-ch.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 2bfe6c3fa58eea53c6b230069b10c3f8521fef68 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Tue, 26 May 2026 11:49:57 -0400
-Subject: [PATCH 4/4] virtio-blk: add missing VIRTIO_BLK_T_SCSI_CMD size check
- (CVE-2026-48914)
-
-RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
-RH-MergeRequest: 501: virtio-blk: add missing VIRTIO_BLK_T_SCSI_CMD size check (CVE-2026-48914)
-RH-Jira: RHEL-184530
-RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [1/1] e2f65ed64020791c8b48c630b79d18371db30624 (stefanha/centos-stream-qemu-kvm)
-
-Check that the iovec containing struct virtio_scsi_inhdr is large enough
-before storing an error value there.
-
-Feifan Qian <bea1e@proton.me> pointed out that this can be used to
-corrupt heap memory when the descriptor uses an MMIO address and a
-length of 1, forcing QEMU to allocate a 1-byte heap bounce buffer.
-virtio_stl_p() stores 4 bytes and therefore corrupts whatever is beyond
-the bounce buffer.
-
-Fixes: CVE-2026-48914
-Fixes: f34e73cd69bd ("virtio-blk: report non-zero status when failing SG_IO requests")
-Reported-by: Feifan Qian <bea1e@proton.me>
-Cc: Paolo Bonzini <pbonzini@redhat.com>
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Message-ID: <20260526154957.1741622-1-stefanha@redhat.com>
-Reviewed-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-(cherry picked from commit aeea0c2804c42f24915467a1e4c70e649e39b8e0)
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- hw/block/virtio-blk.c | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
-index 9bab2716c1..a0678300b4 100644
---- a/hw/block/virtio-blk.c
-+++ b/hw/block/virtio-blk.c
-@@ -200,10 +200,16 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq *req)
-
- /*
- * The scsi inhdr is placed in the second-to-last input segment, just
-- * before the regular inhdr.
-+ * before the regular inhdr. VIRTIO implementations normally do not rely on
-+ * the precise message framing, but legacy implementations did and so we do
-+ * too for the legacy virtio-blk SCSI request type.
- *
- * Just put anything nonzero so that the ioctl fails in the guest.
- */
-+ if (elem->in_sg[elem->in_num - 2].iov_len != sizeof(*scsi)) {
-+ status = VIRTIO_BLK_S_IOERR;
-+ goto fail;
-+ }
- scsi = (void *)elem->in_sg[elem->in_num - 2].iov_base;
- virtio_stl_p(vdev, &scsi->errors, 255);
- status = VIRTIO_BLK_S_UNSUPP;
---
-2.52.0
-
diff --git a/kvm-virtio-blk-fix-zone-report-buffer-out-of-memory-CVE-.patch b/kvm-virtio-blk-fix-zone-report-buffer-out-of-memory-CVE-.patch
deleted file mode 100644
index 42915fb..0000000
--- a/kvm-virtio-blk-fix-zone-report-buffer-out-of-memory-CVE-.patch
+++ /dev/null
@@ -1,300 +0,0 @@
-From 488b339be87be50b40851e85aa42aa76adbe1782 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Fri, 10 Apr 2026 08:11:28 -0400
-Subject: [PATCH 40/52] virtio-blk: fix zone report buffer out-of-memory
- (CVE-2026-5761)
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [33/45] 28556c36d10da652192eb20874ce4b129b0a2b85 (kmwolf/centos-qemu-kvm)
-
-An internal buffer is used when processing VIRTIO_BLK_T_ZONE_REPORT
-requests. The buffer's size is controlled by the guest. A large value
-can result in g_malloc() failure and the QEMU process aborts, resulting
-in a Denial of Service (DoS) (most likely in cases where an untrusted
-guest application or a nested guest with virtio-blk passthrough is able
-to abort QEMU).
-
-Modify the zone report implementation to work incrementally with a
-bounded buffer size.
-
-This is purely a QEMU implementation issue and no VIRTIO spec changes
-are needed.
-
-Mingyuan Luo found this bug and provided a reproducer which I haven't
-put into tests/qtest/ because it requires a zoned storage device (e.g.
-root and modprobe null_blk):
-
-1) Prepare a zoned nullblk backend (/dev/nullb0):
-
-sudo modprobe -r null_blk || true
-sudo modprobe null_blk nr_devices=1 zoned=1
-sudo chmod 0666 /dev/nullb0
-cat /sys/block/nullb0/queue/zoned
-
-2) Create qtest input:
-
-cat >/tmp/vblk-zone-report-oom.qtest <<'EOF'
-outl 0xcf8 0x80002004
-outw 0xcfc 0x0007
-outl 0xcf8 0x80002010
-outl 0xcfc 0x0000c001
-outb 0xc012 0x00
-outb 0xc012 0x01
-outb 0xc012 0x03
-outl 0xc004 0x00000000
-outw 0xc00e 0x0000
-outl 0xc008 0x00000100
-outb 0xc012 0x07
-writel 0x00020000 0x00000010
-writel 0x00020004 0x00000000
-writeq 0x00020008 0x0000000000000000
-writeq 0x00100000 0x0000000000020000
-writel 0x00100008 0x00000010
-writew 0x0010000c 0x0001
-writew 0x0010000e 0x0001
-EOF
-
-for i in $(seq 1 1022); do
-d=$((0x00100000 + i * 16))
-n=$((i + 1))
-printf 'writeq 0x%08x 0x0000000000200000\n' "$d" >> /tmp/vblk-zone-report-oom.qtest
-printf 'writel 0x%08x 0x1fe00000\n' $((d + 8)) >> /tmp/vblk-zone-report-oom.qtest
-printf 'writew 0x%08x 0x0003\n' $((d + 12)) >> /tmp/vblk-zone-report-oom.qtest
-printf 'writew 0x%08x 0x%04x\n' $((d + 14)) "$n" >> /tmp/vblk-zone-report-oom.qtest
-done
-
-d=$((0x00100000 + 1023 * 16))
-printf 'writeq 0x%08x 0x0000000000200000\n' "$d" >> /tmp/vblk-zone-report-oom.qtest
-printf 'writel 0x%08x 0x1fe00000\n' $((d + 8)) >> /tmp/vblk-zone-report-oom.qtest
-printf 'writew 0x%08x 0x0002\n' $((d + 12)) >> /tmp/vblk-zone-report-oom.qtest
-printf 'writew 0x%08x 0x0000\n' $((d + 14)) >> /tmp/vblk-zone-report-oom.qtest
-cat >> /tmp/vblk-zone-report-oom.qtest <<'EOF'
-writew 0x00104000 0x0000
-writew 0x00104002 0x0001
-writew 0x00104004 0x0000
-outw 0xc010 0x0000
-EOF
-
-3) Run the qtest input with ASAN build (compile qemu with --enable-asan):
-
-build/qemu-system-x86_64 -display none \
--accel qtest -qtest stdio \
--machine pc -nodefaults -m 512M -monitor none -serial none \
--blockdev driver=host_device,node-name=disk0,filename=/dev/nullb0 \
--device virtio-blk-pci-transitional,drive=disk0,addr=04.0,queue-size=1024 \
-< /tmp/vblk-zone-report-oom.qtest
-
-Cc: Sam Li <faithilikerun@gmail.com>
-Cc: Damien Le Moal <dlemoal@kernel.org>
-Cc: Dmitry Fomichev <dmitry.fomichev@wdc.com>
-Fixes: CVE-2026-5761
-Fixes: 4f7366506a9 ("virtio-blk: add zoned storage emulation for zoned devices")
-Reported-by: Mingyuan Luo <myluo24@m.fudan.edu.cn>
-Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-(cherry picked from commit 4913ae36f9796c55d434dcbfa6bdb9ebb3e5e4b1)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- hw/block/virtio-blk.c | 100 ++++++++++++++++++++++++++++--------------
- 1 file changed, 67 insertions(+), 33 deletions(-)
-
-diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
-index a0678300b4..019b46fcf7 100644
---- a/hw/block/virtio-blk.c
-+++ b/hw/block/virtio-blk.c
-@@ -38,6 +38,9 @@
- #include "hw/virtio/virtio-blk-common.h"
- #include "qemu/coroutine.h"
-
-+/* Internal buffer size limit for zone report */
-+#define VIRTIO_BLK_MAX_ZONES_PER_BATCH 4096
-+
- static void virtio_blk_ioeventfd_attach(VirtIOBlock *s);
-
- static void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq,
-@@ -457,15 +460,22 @@ err:
- return err_status;
- }
-
-+typedef struct {
-+ unsigned int total_nr_zones; /* max zones to fill in this request */
-+ unsigned int nr_zones_done; /* how many zones have been filled in */
-+ int64_t iov_offset; /* current byte position in in_iov[] */
-+ int64_t offset; /* current zone report disk offset */
-+ unsigned int nr_zones; /* for zone report calls */
-+ unsigned int zones_per_batch; /* size of zone report buffer */
-+ BlockZoneDescriptor *zones; /* zone report buffer */
-+} ZoneReportData;
-+
- typedef struct ZoneCmdData {
- VirtIOBlockReq *req;
- struct iovec *in_iov;
- unsigned in_num;
- union {
-- struct {
-- unsigned int nr_zones;
-- BlockZoneDescriptor *zones;
-- } zone_report_data;
-+ ZoneReportData zone_report_data;
- struct {
- int64_t offset;
- } zone_append_data;
-@@ -522,16 +532,15 @@ static bool check_zoned_request(VirtIOBlock *s, int64_t offset, int64_t len,
- static void virtio_blk_zone_report_complete(void *opaque, int ret)
- {
- ZoneCmdData *data = opaque;
-+ ZoneReportData *zrd = &data->zone_report_data;
- VirtIOBlockReq *req = data->req;
- VirtIODevice *vdev = VIRTIO_DEVICE(req->dev);
- struct iovec *in_iov = data->in_iov;
- unsigned in_num = data->in_num;
-- int64_t zrp_size, n, j = 0;
-- int64_t nz = data->zone_report_data.nr_zones;
-+ int64_t n;
-+ unsigned nz = zrd->nr_zones;
- int8_t err_status = VIRTIO_BLK_S_OK;
-- struct virtio_blk_zone_report zrp_hdr = (struct virtio_blk_zone_report) {
-- .nr_zones = cpu_to_le64(nz),
-- };
-+ struct virtio_blk_zone_report zrp_hdr = {};
-
- trace_virtio_blk_zone_report_complete(vdev, req, nz, ret);
- if (ret) {
-@@ -539,28 +548,18 @@ static void virtio_blk_zone_report_complete(void *opaque, int ret)
- goto out;
- }
-
-- zrp_size = sizeof(struct virtio_blk_zone_report)
-- + sizeof(struct virtio_blk_zone_descriptor) * nz;
-- n = iov_from_buf(in_iov, in_num, 0, &zrp_hdr, sizeof(zrp_hdr));
-- if (n != sizeof(zrp_hdr)) {
-- virtio_error(vdev, "Driver provided input buffer that is too small!");
-- err_status = VIRTIO_BLK_S_ZONE_INVALID_CMD;
-- goto out;
-- }
--
-- for (size_t i = sizeof(zrp_hdr); i < zrp_size;
-- i += sizeof(struct virtio_blk_zone_descriptor), ++j) {
-+ for (unsigned j = 0; j < nz; j++) {
- struct virtio_blk_zone_descriptor desc =
- (struct virtio_blk_zone_descriptor) {
-- .z_start = cpu_to_le64(data->zone_report_data.zones[j].start
-+ .z_start = cpu_to_le64(zrd->zones[j].start
- >> BDRV_SECTOR_BITS),
-- .z_cap = cpu_to_le64(data->zone_report_data.zones[j].cap
-+ .z_cap = cpu_to_le64(zrd->zones[j].cap
- >> BDRV_SECTOR_BITS),
-- .z_wp = cpu_to_le64(data->zone_report_data.zones[j].wp
-+ .z_wp = cpu_to_le64(zrd->zones[j].wp
- >> BDRV_SECTOR_BITS),
- };
-
-- switch (data->zone_report_data.zones[j].type) {
-+ switch (zrd->zones[j].type) {
- case BLK_ZT_CONV:
- desc.z_type = VIRTIO_BLK_ZT_CONV;
- break;
-@@ -574,7 +573,7 @@ static void virtio_blk_zone_report_complete(void *opaque, int ret)
- g_assert_not_reached();
- }
-
-- switch (data->zone_report_data.zones[j].state) {
-+ switch (zrd->zones[j].state) {
- case BLK_ZS_RDONLY:
- desc.z_state = VIRTIO_BLK_ZS_RDONLY;
- break;
-@@ -604,18 +603,47 @@ static void virtio_blk_zone_report_complete(void *opaque, int ret)
- }
-
- /* TODO: it takes O(n^2) time complexity. Optimizations required. */
-- n = iov_from_buf(in_iov, in_num, i, &desc, sizeof(desc));
-+ n = iov_from_buf(in_iov, in_num, zrd->iov_offset, &desc, sizeof(desc));
- if (n != sizeof(desc)) {
- virtio_error(vdev, "Driver provided input buffer "
- "for descriptors that is too small!");
- err_status = VIRTIO_BLK_S_ZONE_INVALID_CMD;
-+ goto out;
- }
-+
-+ zrd->iov_offset += sizeof(desc);
-+ }
-+
-+ if (nz > 0) {
-+ BlockZoneDescriptor *zone = &zrd->zones[nz - 1];
-+ zrd->offset = zone->start + zone->length;
-+ }
-+
-+ zrd->nr_zones_done += nz;
-+
-+ /* Call zone report again if the end hasn't been reached yet */
-+ if (nz == zrd->zones_per_batch &&
-+ zrd->nr_zones_done < zrd->total_nr_zones) {
-+ zrd->nr_zones = MIN(zrd->zones_per_batch,
-+ zrd->total_nr_zones - zrd->nr_zones_done);
-+ blk_aio_zone_report(req->dev->blk, zrd->offset, &zrd->nr_zones,
-+ zrd->zones, virtio_blk_zone_report_complete, data);
-+ return;
-+ }
-+
-+ /* Fill in header now that all zones have been reported */
-+ zrp_hdr.nr_zones = cpu_to_le64(zrd->nr_zones_done);
-+ n = iov_from_buf(in_iov, in_num, 0, &zrp_hdr, sizeof(zrp_hdr));
-+ if (n != sizeof(zrp_hdr)) {
-+ virtio_error(vdev, "Driver provided input buffer that is too small!");
-+ err_status = VIRTIO_BLK_S_ZONE_INVALID_CMD;
-+ goto out;
- }
-
- out:
- virtio_blk_req_complete(req, err_status);
- g_free(req);
-- g_free(data->zone_report_data.zones);
-+ g_free(zrd->zones);
- g_free(data);
- }
-
-@@ -627,7 +655,8 @@ static void virtio_blk_handle_zone_report(VirtIOBlockReq *req,
- VirtIODevice *vdev = VIRTIO_DEVICE(s);
- unsigned int nr_zones;
- ZoneCmdData *data;
-- int64_t zone_size, offset;
-+ ZoneReportData *zrd;
-+ int64_t offset;
- uint8_t err_status;
-
- if (req->in_len < sizeof(struct virtio_blk_inhdr) +
-@@ -649,16 +678,21 @@ static void virtio_blk_handle_zone_report(VirtIOBlockReq *req,
- trace_virtio_blk_handle_zone_report(vdev, req,
- offset >> BDRV_SECTOR_BITS, nr_zones);
-
-- zone_size = sizeof(BlockZoneDescriptor) * nr_zones;
- data = g_malloc(sizeof(ZoneCmdData));
- data->req = req;
- data->in_iov = in_iov;
- data->in_num = in_num;
-- data->zone_report_data.nr_zones = nr_zones;
-- data->zone_report_data.zones = g_malloc(zone_size),
-
-- blk_aio_zone_report(s->blk, offset, &data->zone_report_data.nr_zones,
-- data->zone_report_data.zones,
-+ zrd = &data->zone_report_data;
-+ zrd->total_nr_zones = nr_zones;
-+ zrd->nr_zones_done = 0;
-+ zrd->iov_offset = sizeof(struct virtio_blk_zone_report);
-+ zrd->offset = offset;
-+ zrd->zones_per_batch = MIN(nr_zones, VIRTIO_BLK_MAX_ZONES_PER_BATCH);
-+ zrd->zones = g_malloc(zrd->zones_per_batch * sizeof(BlockZoneDescriptor));
-+
-+ zrd->nr_zones = zrd->zones_per_batch;
-+ blk_aio_zone_report(s->blk, offset, &zrd->nr_zones, zrd->zones,
- virtio_blk_zone_report_complete, data);
- return;
- out:
---
-2.52.0
-
diff --git a/kvm-virtio-introduce-extended-features-type.patch b/kvm-virtio-introduce-extended-features-type.patch
deleted file mode 100644
index caf0e14..0000000
--- a/kvm-virtio-introduce-extended-features-type.patch
+++ /dev/null
@@ -1,201 +0,0 @@
-From 4c9ae4b3a9e2c556dcf284924a154ed85534d77f Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:18 +0200
-Subject: [PATCH 09/19] virtio: introduce extended features type
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [4/14] fa4ef2d101589c700358f90be08943f1198503e4 (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-The virtio specifications allows for up to 128 bits for the
-device features. Soon we are going to use some of the 'extended'
-bits features (bit 64 and above) for the virtio net driver.
-
-Represent the virtio features bitmask with a fixed size array, and
-introduce a few helpers to help manipulate them.
-
-Most drivers will keep using only 64 bits features space: use union
-to allow them access the lower part of the extended space without any
-per driver change.
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <6a9bbb5eb33830f20afbcb7e64d300af4126dd98.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit b15a61fdae976eb1ca8f2deee6a63dc3407d7ec6)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- include/hw/virtio/virtio-features.h | 126 ++++++++++++++++++++++++++++
- include/hw/virtio/virtio.h | 7 +-
- 2 files changed, 130 insertions(+), 3 deletions(-)
- create mode 100644 include/hw/virtio/virtio-features.h
-
-diff --git a/include/hw/virtio/virtio-features.h b/include/hw/virtio/virtio-features.h
-new file mode 100644
-index 0000000000..e29b7fe48f
---- /dev/null
-+++ b/include/hw/virtio/virtio-features.h
-@@ -0,0 +1,126 @@
-+/*
-+ * Virtio features helpers
-+ *
-+ * Copyright 2025 Red Hat, Inc.
-+ *
-+ * SPDX-License-Identifier: GPL-2.0-or-later
-+ */
-+
-+#ifndef QEMU_VIRTIO_FEATURES_H
-+#define QEMU_VIRTIO_FEATURES_H
-+
-+#include "qemu/bitops.h"
-+
-+#define VIRTIO_FEATURES_FMT "%016"PRIx64"%016"PRIx64
-+#define VIRTIO_FEATURES_PR(f) (f)[1], (f)[0]
-+
-+#define VIRTIO_FEATURES_MAX 128
-+#define VIRTIO_FEATURES_BIT(b) BIT_ULL((b) % 64)
-+#define VIRTIO_FEATURES_U64(b) ((b) / 64)
-+#define VIRTIO_FEATURES_NU32S (VIRTIO_FEATURES_MAX / 32)
-+#define VIRTIO_FEATURES_NU64S (VIRTIO_FEATURES_MAX / 64)
-+
-+#define VIRTIO_DECLARE_FEATURES(name) \
-+ union { \
-+ uint64_t name; \
-+ uint64_t name##_ex[VIRTIO_FEATURES_NU64S]; \
-+ }
-+
-+#define VIRTIO_DEFINE_PROP_FEATURE(_name, _state, _field, _bit, _defval) \
-+ DEFINE_PROP_BIT64(_name, _state, _field[VIRTIO_FEATURES_U64(_bit)], \
-+ (_bit) % 64, _defval)
-+
-+static inline void virtio_features_clear(uint64_t *features)
-+{
-+ memset(features, 0, sizeof(features[0]) * VIRTIO_FEATURES_NU64S);
-+}
-+
-+static inline void virtio_features_from_u64(uint64_t *features, uint64_t from)
-+{
-+ virtio_features_clear(features);
-+ features[0] = from;
-+}
-+
-+static inline bool virtio_has_feature_ex(const uint64_t *features,
-+ unsigned int fbit)
-+{
-+ assert(fbit < VIRTIO_FEATURES_MAX);
-+ return features[VIRTIO_FEATURES_U64(fbit)] & VIRTIO_FEATURES_BIT(fbit);
-+}
-+
-+static inline void virtio_add_feature_ex(uint64_t *features,
-+ unsigned int fbit)
-+{
-+ assert(fbit < VIRTIO_FEATURES_MAX);
-+ features[VIRTIO_FEATURES_U64(fbit)] |= VIRTIO_FEATURES_BIT(fbit);
-+}
-+
-+static inline void virtio_clear_feature_ex(uint64_t *features,
-+ unsigned int fbit)
-+{
-+ assert(fbit < VIRTIO_FEATURES_MAX);
-+ features[VIRTIO_FEATURES_U64(fbit)] &= ~VIRTIO_FEATURES_BIT(fbit);
-+}
-+
-+static inline bool virtio_features_equal(const uint64_t *f1,
-+ const uint64_t *f2)
-+{
-+ return !memcmp(f1, f2, sizeof(uint64_t) * VIRTIO_FEATURES_NU64S);
-+}
-+
-+static inline bool virtio_features_use_ex(const uint64_t *features)
-+{
-+ int i;
-+
-+ for (i = 1; i < VIRTIO_FEATURES_NU64S; ++i) {
-+ if (features[i]) {
-+ return true;
-+ }
-+ }
-+ return false;
-+}
-+
-+static inline bool virtio_features_empty(const uint64_t *features)
-+{
-+ return !virtio_features_use_ex(features) && !features[0];
-+}
-+
-+static inline void virtio_features_copy(uint64_t *to, const uint64_t *from)
-+{
-+ memcpy(to, from, sizeof(to[0]) * VIRTIO_FEATURES_NU64S);
-+}
-+
-+static inline bool virtio_features_andnot(uint64_t *to, const uint64_t *f1,
-+ const uint64_t *f2)
-+{
-+ uint64_t diff = 0;
-+ int i;
-+
-+ for (i = 0; i < VIRTIO_FEATURES_NU64S; i++) {
-+ to[i] = f1[i] & ~f2[i];
-+ diff |= to[i];
-+ }
-+ return diff;
-+}
-+
-+static inline void virtio_features_and(uint64_t *to, const uint64_t *f1,
-+ const uint64_t *f2)
-+{
-+ int i;
-+
-+ for (i = 0; i < VIRTIO_FEATURES_NU64S; i++) {
-+ to[i] = f1[i] & f2[i];
-+ }
-+}
-+
-+static inline void virtio_features_or(uint64_t *to, const uint64_t *f1,
-+ const uint64_t *f2)
-+{
-+ int i;
-+
-+ for (i = 0; i < VIRTIO_FEATURES_NU64S; i++) {
-+ to[i] = f1[i] | f2[i];
-+ }
-+}
-+
-+#endif
-diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
-index c594764f23..39e4059a66 100644
---- a/include/hw/virtio/virtio.h
-+++ b/include/hw/virtio/virtio.h
-@@ -16,6 +16,7 @@
-
- #include "system/memory.h"
- #include "hw/qdev-core.h"
-+#include "hw/virtio/virtio-features.h"
- #include "net/net.h"
- #include "migration/vmstate.h"
- #include "qemu/event_notifier.h"
-@@ -121,9 +122,9 @@ struct VirtIODevice
- * backend (e.g. vhost) and could potentially be a subset of the
- * total feature set offered by QEMU.
- */
-- uint64_t host_features;
-- uint64_t guest_features;
-- uint64_t backend_features;
-+ VIRTIO_DECLARE_FEATURES(host_features);
-+ VIRTIO_DECLARE_FEATURES(guest_features);
-+ VIRTIO_DECLARE_FEATURES(backend_features);
-
- size_t config_len;
- void *config;
---
-2.47.3
-
diff --git a/kvm-virtio-net-implement-extended-features-support.patch b/kvm-virtio-net-implement-extended-features-support.patch
deleted file mode 100644
index 1af6377..0000000
--- a/kvm-virtio-net-implement-extended-features-support.patch
+++ /dev/null
@@ -1,331 +0,0 @@
-From cd61fca5f53b5047a432db36f33ee85edf4f6ac3 Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:26 +0200
-Subject: [PATCH 17/19] virtio-net: implement extended features support
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [12/14] 22829a4e87459998cbb2a658d24434f1e94c8597 (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-Use the extended types and helpers to manipulate the virtio_net
-features.
-
-Note that offloads are still 64bits wide, as per specification,
-and extended offloads will be mapped into such range.
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <bc5afdc5c1cb1a37238dd2b36004db3d46cbf211.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit 3a7741c3bdc3537de4159418d712debbd22e4df6)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- hw/net/virtio-net.c | 140 +++++++++++++++++++--------------
- include/hw/virtio/virtio-net.h | 2 +-
- 2 files changed, 83 insertions(+), 59 deletions(-)
-
-diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
-index b86ba1fd27..89cf008401 100644
---- a/hw/net/virtio-net.c
-+++ b/hw/net/virtio-net.c
-@@ -90,6 +90,19 @@
- VIRTIO_NET_RSS_HASH_TYPE_TCP_EX | \
- VIRTIO_NET_RSS_HASH_TYPE_UDP_EX)
-
-+/*
-+ * Features starting from VIRTIO_NET_FEATURES_MAP_MIN bit correspond
-+ * to guest offloads in the VIRTIO_NET_OFFLOAD_MAP range
-+ */
-+#define VIRTIO_NET_OFFLOAD_MAP_MIN 46
-+#define VIRTIO_NET_OFFLOAD_MAP_LENGTH 4
-+#define VIRTIO_NET_OFFLOAD_MAP MAKE_64BIT_MASK( \
-+ VIRTIO_NET_OFFLOAD_MAP_MIN, \
-+ VIRTIO_NET_OFFLOAD_MAP_LENGTH)
-+#define VIRTIO_NET_FEATURES_MAP_MIN 65
-+#define VIRTIO_NET_F2O_SHIFT (VIRTIO_NET_OFFLOAD_MAP_MIN - \
-+ VIRTIO_NET_FEATURES_MAP_MIN + 64)
-+
- static const VirtIOFeature feature_sizes[] = {
- {.flags = 1ULL << VIRTIO_NET_F_MAC,
- .end = endof(struct virtio_net_config, mac)},
-@@ -786,7 +799,14 @@ static void virtio_net_apply_guest_offloads(VirtIONet *n)
- qemu_set_offload(qemu_get_queue(n->nic)->peer, &ol);
- }
-
--static uint64_t virtio_net_guest_offloads_by_features(uint64_t features)
-+static uint64_t virtio_net_features_to_offload(const uint64_t *features)
-+{
-+ return (features[0] & ~VIRTIO_NET_OFFLOAD_MAP) |
-+ ((features[1] << VIRTIO_NET_F2O_SHIFT) & VIRTIO_NET_OFFLOAD_MAP);
-+}
-+
-+static uint64_t
-+virtio_net_guest_offloads_by_features(const uint64_t *features)
- {
- static const uint64_t guest_offloads_mask =
- (1ULL << VIRTIO_NET_F_GUEST_CSUM) |
-@@ -797,13 +817,13 @@ static uint64_t virtio_net_guest_offloads_by_features(uint64_t features)
- (1ULL << VIRTIO_NET_F_GUEST_USO4) |
- (1ULL << VIRTIO_NET_F_GUEST_USO6);
-
-- return guest_offloads_mask & features;
-+ return guest_offloads_mask & virtio_net_features_to_offload(features);
- }
-
- uint64_t virtio_net_supported_guest_offloads(const VirtIONet *n)
- {
- VirtIODevice *vdev = VIRTIO_DEVICE(n);
-- return virtio_net_guest_offloads_by_features(vdev->guest_features);
-+ return virtio_net_guest_offloads_by_features(vdev->guest_features_ex);
- }
-
- typedef struct {
-@@ -882,34 +902,39 @@ static void failover_add_primary(VirtIONet *n, Error **errp)
- error_propagate(errp, err);
- }
-
--static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features)
-+static void virtio_net_set_features(VirtIODevice *vdev,
-+ const uint64_t *in_features)
- {
-+ uint64_t features[VIRTIO_FEATURES_NU64S];
- VirtIONet *n = VIRTIO_NET(vdev);
- Error *err = NULL;
- int i;
-
-+ virtio_features_copy(features, in_features);
- if (n->mtu_bypass_backend &&
- !virtio_has_feature(vdev->backend_features, VIRTIO_NET_F_MTU)) {
-- features &= ~(1ULL << VIRTIO_NET_F_MTU);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_MTU);
- }
-
- virtio_net_set_multiqueue(n,
-- virtio_has_feature(features, VIRTIO_NET_F_RSS) ||
-- virtio_has_feature(features, VIRTIO_NET_F_MQ));
-+ virtio_has_feature_ex(features,
-+ VIRTIO_NET_F_RSS) ||
-+ virtio_has_feature_ex(features,
-+ VIRTIO_NET_F_MQ));
-
- virtio_net_set_mrg_rx_bufs(n,
-- virtio_has_feature(features,
-+ virtio_has_feature_ex(features,
- VIRTIO_NET_F_MRG_RXBUF),
-- virtio_has_feature(features,
-+ virtio_has_feature_ex(features,
- VIRTIO_F_VERSION_1),
-- virtio_has_feature(features,
-+ virtio_has_feature_ex(features,
- VIRTIO_NET_F_HASH_REPORT));
-
-- n->rsc4_enabled = virtio_has_feature(features, VIRTIO_NET_F_RSC_EXT) &&
-- virtio_has_feature(features, VIRTIO_NET_F_GUEST_TSO4);
-- n->rsc6_enabled = virtio_has_feature(features, VIRTIO_NET_F_RSC_EXT) &&
-- virtio_has_feature(features, VIRTIO_NET_F_GUEST_TSO6);
-- n->rss_data.redirect = virtio_has_feature(features, VIRTIO_NET_F_RSS);
-+ n->rsc4_enabled = virtio_has_feature_ex(features, VIRTIO_NET_F_RSC_EXT) &&
-+ virtio_has_feature_ex(features, VIRTIO_NET_F_GUEST_TSO4);
-+ n->rsc6_enabled = virtio_has_feature_ex(features, VIRTIO_NET_F_RSC_EXT) &&
-+ virtio_has_feature_ex(features, VIRTIO_NET_F_GUEST_TSO6);
-+ n->rss_data.redirect = virtio_has_feature_ex(features, VIRTIO_NET_F_RSS);
-
- if (n->has_vnet_hdr) {
- n->curr_guest_offloads =
-@@ -923,7 +948,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features)
- if (!get_vhost_net(nc->peer)) {
- continue;
- }
-- vhost_net_ack_features(get_vhost_net(nc->peer), features);
-+ vhost_net_ack_features_ex(get_vhost_net(nc->peer), features);
-
- /*
- * keep acked_features in NetVhostUserState up-to-date so it
-@@ -932,12 +957,14 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features)
- vhost_net_save_acked_features(nc->peer);
- }
-
-- if (virtio_has_feature(vdev->guest_features ^ features, VIRTIO_NET_F_CTRL_VLAN)) {
-- bool vlan = virtio_has_feature(features, VIRTIO_NET_F_CTRL_VLAN);
-+ if (virtio_has_feature_ex(features, VIRTIO_NET_F_CTRL_VLAN) !=
-+ virtio_has_feature_ex(vdev->guest_features_ex,
-+ VIRTIO_NET_F_CTRL_VLAN)) {
-+ bool vlan = virtio_has_feature_ex(features, VIRTIO_NET_F_CTRL_VLAN);
- memset(n->vlans, vlan ? 0 : 0xff, MAX_VLAN >> 3);
- }
-
-- if (virtio_has_feature(features, VIRTIO_NET_F_STANDBY)) {
-+ if (virtio_has_feature_ex(features, VIRTIO_NET_F_STANDBY)) {
- qapi_event_send_failover_negotiated(n->netclient_name);
- qatomic_set(&n->failover_primary_hidden, false);
- failover_add_primary(n, &err);
-@@ -1902,10 +1929,10 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
- virtio_error(vdev, "virtio-net unexpected empty queue: "
- "i %zd mergeable %d offset %zd, size %zd, "
- "guest hdr len %zd, host hdr len %zd "
-- "guest features 0x%" PRIx64,
-+ "guest features 0x" VIRTIO_FEATURES_FMT,
- i, n->mergeable_rx_bufs, offset, size,
- n->guest_hdr_len, n->host_hdr_len,
-- vdev->guest_features);
-+ VIRTIO_FEATURES_PR(vdev->guest_features_ex));
- }
- err = -1;
- goto err;
-@@ -3012,8 +3039,8 @@ static int virtio_net_pre_load_queues(VirtIODevice *vdev, uint32_t n)
- return 0;
- }
-
--static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
-- Error **errp)
-+static void virtio_net_get_features(VirtIODevice *vdev, uint64_t *features,
-+ Error **errp)
- {
- VirtIONet *n = VIRTIO_NET(vdev);
- NetClientState *nc = qemu_get_queue(n->nic);
-@@ -3027,68 +3054,67 @@ static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
- (supported_hash_types & peer_hash_types) == supported_hash_types;
-
- /* Firstly sync all virtio-net possible supported features */
-- features |= n->host_features;
-+ virtio_features_or(features, features, n->host_features_ex);
-
-- virtio_add_feature(&features, VIRTIO_NET_F_MAC);
-+ virtio_add_feature_ex(features, VIRTIO_NET_F_MAC);
-
- if (!peer_has_vnet_hdr(n)) {
-- virtio_clear_feature(&features, VIRTIO_NET_F_CSUM);
-- virtio_clear_feature(&features, VIRTIO_NET_F_HOST_TSO4);
-- virtio_clear_feature(&features, VIRTIO_NET_F_HOST_TSO6);
-- virtio_clear_feature(&features, VIRTIO_NET_F_HOST_ECN);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_CSUM);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_HOST_TSO4);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_HOST_TSO6);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_HOST_ECN);
-
-- virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_CSUM);
-- virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_TSO4);
-- virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_TSO6);
-- virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_ECN);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_CSUM);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_TSO4);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_TSO6);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_ECN);
-
-- virtio_clear_feature(&features, VIRTIO_NET_F_HOST_USO);
-- virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_USO4);
-- virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_USO6);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_HOST_USO);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_USO4);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_USO6);
-
-- virtio_clear_feature(&features, VIRTIO_NET_F_HASH_REPORT);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_HASH_REPORT);
- }
-
- if (!peer_has_vnet_hdr(n) || !peer_has_ufo(n)) {
-- virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_UFO);
-- virtio_clear_feature(&features, VIRTIO_NET_F_HOST_UFO);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_UFO);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_HOST_UFO);
- }
--
- if (!peer_has_uso(n)) {
-- virtio_clear_feature(&features, VIRTIO_NET_F_HOST_USO);
-- virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_USO4);
-- virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_USO6);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_HOST_USO);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_USO4);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_USO6);
- }
-
- if (!get_vhost_net(nc->peer)) {
- if (!use_own_hash) {
-- virtio_clear_feature(&features, VIRTIO_NET_F_HASH_REPORT);
-- virtio_clear_feature(&features, VIRTIO_NET_F_RSS);
-- } else if (virtio_has_feature(features, VIRTIO_NET_F_RSS)) {
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_HASH_REPORT);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_RSS);
-+ } else if (virtio_has_feature_ex(features, VIRTIO_NET_F_RSS)) {
- virtio_net_load_ebpf(n, errp);
- }
-
-- return features;
-+ return;
- }
-
- if (!use_peer_hash) {
-- virtio_clear_feature(&features, VIRTIO_NET_F_HASH_REPORT);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_HASH_REPORT);
-
- if (!use_own_hash || !virtio_net_attach_ebpf_to_backend(n->nic, -1)) {
- if (!virtio_net_load_ebpf(n, errp)) {
-- return features;
-+ return;
- }
-
-- virtio_clear_feature(&features, VIRTIO_NET_F_RSS);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_RSS);
- }
- }
-
-- features = vhost_net_get_features(get_vhost_net(nc->peer), features);
-- vdev->backend_features = features;
-+ vhost_net_get_features_ex(get_vhost_net(nc->peer), features);
-+ virtio_features_copy(vdev->backend_features_ex, features);
-
- if (n->mtu_bypass_backend &&
- (n->host_features & 1ULL << VIRTIO_NET_F_MTU)) {
-- features |= (1ULL << VIRTIO_NET_F_MTU);
-+ virtio_add_feature_ex(features, VIRTIO_NET_F_MTU);
- }
-
- /*
-@@ -3103,10 +3129,8 @@ static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
- * support it.
- */
- if (!virtio_has_feature(vdev->backend_features, VIRTIO_NET_F_CTRL_VQ)) {
-- virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_ANNOUNCE);
-+ virtio_clear_feature_ex(features, VIRTIO_NET_F_GUEST_ANNOUNCE);
- }
--
-- return features;
- }
-
- static int virtio_net_post_load_device(void *opaque, int version_id)
-@@ -4238,8 +4262,8 @@ static void virtio_net_class_init(ObjectClass *klass, const void *data)
- vdc->unrealize = virtio_net_device_unrealize;
- vdc->get_config = virtio_net_get_config;
- vdc->set_config = virtio_net_set_config;
-- vdc->get_features = virtio_net_get_features;
-- vdc->set_features = virtio_net_set_features;
-+ vdc->get_features_ex = virtio_net_get_features;
-+ vdc->set_features_ex = virtio_net_set_features;
- vdc->bad_features = virtio_net_bad_features;
- vdc->reset = virtio_net_reset;
- vdc->queue_reset = virtio_net_queue_reset;
-diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h
-index 73fdefc0dc..5b8ab7bda7 100644
---- a/include/hw/virtio/virtio-net.h
-+++ b/include/hw/virtio/virtio-net.h
-@@ -182,7 +182,7 @@ struct VirtIONet {
- uint32_t has_vnet_hdr;
- size_t host_hdr_len;
- size_t guest_hdr_len;
-- uint64_t host_features;
-+ VIRTIO_DECLARE_FEATURES(host_features);
- uint32_t rsc_timeout;
- uint8_t rsc4_enabled;
- uint8_t rsc6_enabled;
---
-2.47.3
-
diff --git a/kvm-virtio-pci-implement-support-for-extended-features.patch b/kvm-virtio-pci-implement-support-for-extended-features.patch
deleted file mode 100644
index 98821d9..0000000
--- a/kvm-virtio-pci-implement-support-for-extended-features.patch
+++ /dev/null
@@ -1,196 +0,0 @@
-From 71096da8a19183bbe11f28d5dfe6cf6cc38d9585 Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:21 +0200
-Subject: [PATCH 12/19] virtio-pci: implement support for extended features
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [7/14] 7d5683a98169722acb250f9e01344ec3d56faad4 (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-Extend the features configuration space to 128 bits. If the virtio
-device supports any extended features, allow the common read/write
-operation to access all of it, otherwise keep exposing only the
-lower 64 bits.
-
-On migration, save the 128 bit version of the features only if the
-upper bits are non zero. Relay on reset to clear all the feature
-space before load.
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <c0b81601f65b41ca8310eba8f05e2dcf3702de89.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit 712c79d6d374e7abe94599de5ba2d155d5a79955)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- hw/virtio/virtio-pci.c | 76 ++++++++++++++++++++++++++++++----
- include/hw/virtio/virtio-pci.h | 2 +-
- 2 files changed, 68 insertions(+), 10 deletions(-)
-
-diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
-index 0cdc16217f..d38d0a5e9a 100644
---- a/hw/virtio/virtio-pci.c
-+++ b/hw/virtio/virtio-pci.c
-@@ -110,6 +110,29 @@ static const VMStateDescription vmstate_virtio_pci_modern_queue_state = {
- }
- };
-
-+static bool virtio_pci_modern_state_features128_needed(void *opaque)
-+{
-+ VirtIOPCIProxy *proxy = opaque;
-+ uint32_t features = 0;
-+ int i;
-+
-+ for (i = 2; i < ARRAY_SIZE(proxy->guest_features); ++i) {
-+ features |= proxy->guest_features[i];
-+ }
-+ return features;
-+}
-+
-+static const VMStateDescription vmstate_virtio_pci_modern_state_features128 = {
-+ .name = "virtio_pci/modern_state/features128",
-+ .version_id = 1,
-+ .minimum_version_id = 1,
-+ .needed = &virtio_pci_modern_state_features128_needed,
-+ .fields = (const VMStateField[]) {
-+ VMSTATE_UINT32_SUB_ARRAY(guest_features, VirtIOPCIProxy, 2, 2),
-+ VMSTATE_END_OF_LIST()
-+ }
-+};
-+
- static bool virtio_pci_modern_state_needed(void *opaque)
- {
- VirtIOPCIProxy *proxy = opaque;
-@@ -117,6 +140,12 @@ static bool virtio_pci_modern_state_needed(void *opaque)
- return virtio_pci_modern(proxy);
- }
-
-+/*
-+ * Avoid silently breaking migration should the feature space increase
-+ * even more in the (far away) future
-+ */
-+QEMU_BUILD_BUG_ON(VIRTIO_FEATURES_NU32S != 4);
-+
- static const VMStateDescription vmstate_virtio_pci_modern_state_sub = {
- .name = "virtio_pci/modern_state",
- .version_id = 1,
-@@ -125,11 +154,15 @@ static const VMStateDescription vmstate_virtio_pci_modern_state_sub = {
- .fields = (const VMStateField[]) {
- VMSTATE_UINT32(dfselect, VirtIOPCIProxy),
- VMSTATE_UINT32(gfselect, VirtIOPCIProxy),
-- VMSTATE_UINT32_ARRAY(guest_features, VirtIOPCIProxy, 2),
-+ VMSTATE_UINT32_SUB_ARRAY(guest_features, VirtIOPCIProxy, 0, 2),
- VMSTATE_STRUCT_ARRAY(vqs, VirtIOPCIProxy, VIRTIO_QUEUE_MAX, 0,
- vmstate_virtio_pci_modern_queue_state,
- VirtIOPCIQueue),
- VMSTATE_END_OF_LIST()
-+ },
-+ .subsections = (const VMStateDescription * const []) {
-+ &vmstate_virtio_pci_modern_state_features128,
-+ NULL
- }
- };
-
-@@ -1478,6 +1511,19 @@ int virtio_pci_add_shm_cap(VirtIOPCIProxy *proxy,
- return virtio_pci_add_mem_cap(proxy, &cap.cap);
- }
-
-+static int virtio_pci_select_max(const VirtIODevice *vdev)
-+{
-+ int i;
-+
-+ for (i = VIRTIO_FEATURES_NU64S - 1; i > 0; i--) {
-+ if (vdev->host_features_ex[i]) {
-+ return (i + 1) * 2;
-+ }
-+ }
-+
-+ return 2;
-+}
-+
- static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr,
- unsigned size)
- {
-@@ -1495,18 +1541,21 @@ static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr,
- val = proxy->dfselect;
- break;
- case VIRTIO_PCI_COMMON_DF:
-- if (proxy->dfselect <= 1) {
-+ if (proxy->dfselect < virtio_pci_select_max(vdev)) {
- VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
-
-- val = (vdev->host_features & ~vdc->legacy_features) >>
-- (32 * proxy->dfselect);
-+ val = vdev->host_features_ex[proxy->dfselect >> 1] >>
-+ (32 * (proxy->dfselect & 1));
-+ if (proxy->dfselect <= 1) {
-+ val &= (~vdc->legacy_features) >> (32 * proxy->dfselect);
-+ }
- }
- break;
- case VIRTIO_PCI_COMMON_GFSELECT:
- val = proxy->gfselect;
- break;
- case VIRTIO_PCI_COMMON_GF:
-- if (proxy->gfselect < ARRAY_SIZE(proxy->guest_features)) {
-+ if (proxy->gfselect < virtio_pci_select_max(vdev)) {
- val = proxy->guest_features[proxy->gfselect];
- }
- break;
-@@ -1589,11 +1638,18 @@ static void virtio_pci_common_write(void *opaque, hwaddr addr,
- proxy->gfselect = val;
- break;
- case VIRTIO_PCI_COMMON_GF:
-- if (proxy->gfselect < ARRAY_SIZE(proxy->guest_features)) {
-+ if (proxy->gfselect < virtio_pci_select_max(vdev)) {
-+ uint64_t features[VIRTIO_FEATURES_NU64S];
-+ int i;
-+
- proxy->guest_features[proxy->gfselect] = val;
-- virtio_set_features(vdev,
-- (((uint64_t)proxy->guest_features[1]) << 32) |
-- proxy->guest_features[0]);
-+ virtio_features_clear(features);
-+ for (i = 0; i < ARRAY_SIZE(proxy->guest_features); ++i) {
-+ uint64_t cur = proxy->guest_features[i];
-+
-+ features[i >> 1] |= cur << ((i & 1) * 32);
-+ }
-+ virtio_set_features_ex(vdev, features);
- }
- break;
- case VIRTIO_PCI_COMMON_MSIX:
-@@ -2312,6 +2368,8 @@ static void virtio_pci_reset(DeviceState *qdev)
- virtio_bus_reset(bus);
- msix_unuse_all_vectors(&proxy->pci_dev);
-
-+ memset(proxy->guest_features, 0, sizeof(proxy->guest_features));
-+
- for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
- proxy->vqs[i].enabled = 0;
- proxy->vqs[i].reset = 0;
-diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h
-index eab5394898..639752977e 100644
---- a/include/hw/virtio/virtio-pci.h
-+++ b/include/hw/virtio/virtio-pci.h
-@@ -158,7 +158,7 @@ struct VirtIOPCIProxy {
- uint32_t nvectors;
- uint32_t dfselect;
- uint32_t gfselect;
-- uint32_t guest_features[2];
-+ uint32_t guest_features[VIRTIO_FEATURES_NU32S];
- VirtIOPCIQueue vqs[VIRTIO_QUEUE_MAX];
-
- VirtIOIRQFD *vector_irqfd;
---
-2.47.3
-
diff --git a/kvm-virtio-scsi-pass-the-same-cdb_size-to-virtio_scsi_po.patch b/kvm-virtio-scsi-pass-the-same-cdb_size-to-virtio_scsi_po.patch
deleted file mode 100644
index fad2908..0000000
--- a/kvm-virtio-scsi-pass-the-same-cdb_size-to-virtio_scsi_po.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From c1a573c922a2c99060dfb63413cd47db2c784ca6 Mon Sep 17 00:00:00 2001
-From: Paolo Bonzini <pbonzini@redhat.com>
-Date: Fri, 27 Mar 2026 22:00:09 +0100
-Subject: [PATCH 38/52] virtio-scsi: pass the same cdb_size to
- virtio_scsi_pop_req and virtio_scsi_handle_cmd_req_prepare
-
-RH-Author: Kevin Wolf <kwolf@redhat.com>
-RH-MergeRequest: 504: virt-storage: Backport stable branch fixes
-RH-Jira: RHEL-186384
-RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
-RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
-RH-Commit: [31/45] 6fe89d004c1a32f220b7104f5f7b2d9ee116d5f1 (kmwolf/centos-qemu-kvm)
-
-Ensure that there is no allocation/usage mismatch when requests
-are processed in virtio_scsi_handle_cmd_vq. To do this,
-retrieve the value once and pass it to both functions.
-
-For other calls to virtio_scsi_pop_req the extra size
-can be 0, because control and event requests fit
-entirely in VirtIOSCSIReq.
-
-Reported-by: Jihe Wang <wangjihe.mail@gmail.com>
-Tested-by: Jihe Wang <wangjihe.mail@gmail.com>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Fixes: CVE-2026-5763
-Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-(cherry picked from commit 79971302935472232a68073faddb085177e3ca54)
-Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
----
- hw/scsi/virtio-scsi.c | 26 +++++++++++++++-----------
- 1 file changed, 15 insertions(+), 11 deletions(-)
-
-diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
-index 34ae14f7bf..0ce4718407 100644
---- a/hw/scsi/virtio-scsi.c
-+++ b/hw/scsi/virtio-scsi.c
-@@ -231,16 +231,16 @@ static int virtio_scsi_parse_req(VirtIOSCSIReq *req,
- return 0;
- }
-
--static VirtIOSCSIReq *virtio_scsi_pop_req(VirtIOSCSI *s, VirtQueue *vq, QemuMutex *vq_lock)
-+static VirtIOSCSIReq *virtio_scsi_pop_req(VirtIOSCSI *s, VirtQueue *vq, size_t extra_req_size,
-+ QemuMutex *vq_lock)
- {
-- VirtIOSCSICommon *vs = (VirtIOSCSICommon *)s;
- VirtIOSCSIReq *req;
-
- if (vq_lock) {
- qemu_mutex_lock(vq_lock);
- }
-
-- req = virtqueue_pop(vq, sizeof(VirtIOSCSIReq) + vs->cdb_size);
-+ req = virtqueue_pop(vq, sizeof(VirtIOSCSIReq) + extra_req_size);
-
- if (vq_lock) {
- qemu_mutex_unlock(vq_lock);
-@@ -674,7 +674,7 @@ static void virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq)
- {
- VirtIOSCSIReq *req;
-
-- while ((req = virtio_scsi_pop_req(s, vq, &s->ctrl_lock))) {
-+ while ((req = virtio_scsi_pop_req(s, vq, 0, &s->ctrl_lock))) {
- virtio_scsi_handle_ctrl_req(s, req);
- }
- }
-@@ -842,13 +842,14 @@ static void virtio_scsi_fail_cmd_req(VirtIOSCSIReq *req)
- virtio_scsi_complete_cmd_req(req);
- }
-
--static int virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req)
-+static int virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req,
-+ size_t cdb_size)
- {
- VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
- SCSIDevice *d;
- int rc;
-
-- rc = virtio_scsi_parse_req(req, sizeof(VirtIOSCSICmdReq) + vs->cdb_size,
-+ rc = virtio_scsi_parse_req(req, sizeof(VirtIOSCSICmdReq) + cdb_size,
- sizeof(VirtIOSCSICmdResp) + vs->sense_size);
- if (rc < 0) {
- if (rc == -ENOTSUP) {
-@@ -870,7 +871,7 @@ static int virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req)
- }
- req->sreq = scsi_req_new(d, req->req.cmd.tag,
- virtio_scsi_get_lun(req->req.cmd.lun),
-- req->req.cmd.cdb, vs->cdb_size, req);
-+ req->req.cmd.cdb, cdb_size, req);
-
- if (req->sreq->cmd.mode != SCSI_XFER_NONE
- && (req->sreq->cmd.mode != req->mode ||
-@@ -905,12 +906,15 @@ static void virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq)
- QTAILQ_HEAD(, VirtIOSCSIReq) reqs = QTAILQ_HEAD_INITIALIZER(reqs);
-
- do {
-+ VirtIOSCSICommon *vs = (VirtIOSCSICommon *)s;
-+ size_t cdb_size = qatomic_read(&vs->cdb_size);
-+
- if (suppress_notifications) {
- virtio_queue_set_notification(vq, 0);
- }
-
-- while ((req = virtio_scsi_pop_req(s, vq, NULL))) {
-- ret = virtio_scsi_handle_cmd_req_prepare(s, req);
-+ while ((req = virtio_scsi_pop_req(s, vq, cdb_size, NULL))) {
-+ ret = virtio_scsi_handle_cmd_req_prepare(s, req, cdb_size);
- if (!ret) {
- QTAILQ_INSERT_TAIL(&reqs, req, next);
- } else if (ret == -EINVAL) {
-@@ -981,7 +985,7 @@ static void virtio_scsi_set_config(VirtIODevice *vdev,
- }
-
- vs->sense_size = virtio_ldl_p(vdev, &scsiconf->sense_size);
-- vs->cdb_size = virtio_ldl_p(vdev, &scsiconf->cdb_size);
-+ qatomic_set(&vs->cdb_size, virtio_ldl_p(vdev, &scsiconf->cdb_size));
- }
-
- static uint64_t virtio_scsi_get_features(VirtIODevice *vdev,
-@@ -1042,7 +1046,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s,
- return;
- }
-
-- req = virtio_scsi_pop_req(s, vs->event_vq, &s->event_lock);
-+ req = virtio_scsi_pop_req(s, vs->event_vq, 0, &s->event_lock);
- WITH_QEMU_LOCK_GUARD(&s->event_lock) {
- if (!req) {
- s->events_dropped = true;
---
-2.52.0
-
diff --git a/kvm-virtio-serialize-extended-features-state.patch b/kvm-virtio-serialize-extended-features-state.patch
deleted file mode 100644
index 97a19d7..0000000
--- a/kvm-virtio-serialize-extended-features-state.patch
+++ /dev/null
@@ -1,222 +0,0 @@
-From 0f4e78c05a49b1ab51bd057df02b5c42f7914ebf Mon Sep 17 00:00:00 2001
-From: Paolo Abeni <pabeni@redhat.com>
-Date: Mon, 22 Sep 2025 16:18:19 +0200
-Subject: [PATCH 10/19] virtio: serialize extended features state
-
-RH-Author: Laurent Vivier <lvivier@redhat.com>
-RH-MergeRequest: 456: backport support for GSO over UDP tunnel offload
-RH-Jira: RHEL-143785
-RH-Acked-by: Cindy Lu <lulu@redhat.com>
-RH-Acked-by: MST <mst@redhat.com>
-RH-Commit: [5/14] 3448a1d2d4b7b6952819257c1bc2f5e5dcee8935 (lvivier/qemu-kvm-centos)
-
-JIRA: https://issues.redhat.com/browse/RHEL-143785
-
-If the driver uses any of the extended features (i.e. 64 or above),
-store the extended features range (64-127 bits).
-
-At load time, let legacy features initialize the full features range
-and pass it to the set helper; sub-states loading will have filled-up
-the extended part as needed.
-
-This is one of the few spots that need explicitly to know and set
-in stone the extended features array size; add a build bug to prevent
-breaking the migration should such size change again in the future:
-more serialization plumbing will be needed.
-
-Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
-Acked-by: Jason Wang <jasowang@redhat.com>
-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Tested-by: Lei Yang <leiyang@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Message-ID: <d5d9d398675bee6c4c7d7308c5d3d5d3c6d17d87.1758549625.git.pabeni@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-(cherry picked from commit 0a49a97433279512a03f3d9f36164a46caf498c6)
-Signed-off-by: Laurent Vivier <lvivier@redhat.com>
----
- hw/virtio/virtio.c | 88 ++++++++++++++++++++++++++++++----------------
- 1 file changed, 57 insertions(+), 31 deletions(-)
-
-diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
-index 9a81ad912e..bf53c211e5 100644
---- a/hw/virtio/virtio.c
-+++ b/hw/virtio/virtio.c
-@@ -2964,6 +2964,30 @@ static const VMStateDescription vmstate_virtio_disabled = {
- }
- };
-
-+static bool virtio_128bit_features_needed(void *opaque)
-+{
-+ VirtIODevice *vdev = opaque;
-+
-+ return virtio_features_use_ex(vdev->host_features_ex);
-+}
-+
-+static const VMStateDescription vmstate_virtio_128bit_features = {
-+ .name = "virtio/128bit_features",
-+ .version_id = 1,
-+ .minimum_version_id = 1,
-+ .needed = &virtio_128bit_features_needed,
-+ .fields = (const VMStateField[]) {
-+ VMSTATE_UINT64(guest_features_ex[1], VirtIODevice),
-+ VMSTATE_END_OF_LIST()
-+ }
-+};
-+
-+/*
-+ * Avoid silently breaking migration should the feature space increase
-+ * even more in the (far away) future
-+ */
-+QEMU_BUILD_BUG_ON(VIRTIO_FEATURES_NU64S != 2);
-+
- static const VMStateDescription vmstate_virtio = {
- .name = "virtio",
- .version_id = 1,
-@@ -2973,6 +2997,7 @@ static const VMStateDescription vmstate_virtio = {
- },
- .subsections = (const VMStateDescription * const []) {
- &vmstate_virtio_device_endian,
-+ &vmstate_virtio_128bit_features,
- &vmstate_virtio_64bit_features,
- &vmstate_virtio_virtqueues,
- &vmstate_virtio_ringsize,
-@@ -3069,23 +3094,28 @@ const VMStateInfo virtio_vmstate_info = {
- .put = virtio_device_put,
- };
-
--static int virtio_set_features_nocheck(VirtIODevice *vdev, uint64_t val)
-+static int virtio_set_features_nocheck(VirtIODevice *vdev, const uint64_t *val)
- {
- VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
-- bool bad = (val & ~(vdev->host_features)) != 0;
-+ uint64_t tmp[VIRTIO_FEATURES_NU64S];
-+ bool bad;
-+
-+ bad = virtio_features_andnot(tmp, val, vdev->host_features_ex);
-+ virtio_features_and(tmp, val, vdev->host_features_ex);
-
-- val &= vdev->host_features;
- if (k->set_features) {
-- k->set_features(vdev, val);
-+ bad = bad || virtio_features_use_ex(tmp);
-+ k->set_features(vdev, tmp[0]);
- }
-- vdev->guest_features = val;
-+
-+ virtio_features_copy(vdev->guest_features_ex, tmp);
- return bad ? -1 : 0;
- }
-
- typedef struct VirtioSetFeaturesNocheckData {
- Coroutine *co;
- VirtIODevice *vdev;
-- uint64_t val;
-+ uint64_t val[VIRTIO_FEATURES_NU64S];
- int ret;
- } VirtioSetFeaturesNocheckData;
-
-@@ -3098,14 +3128,15 @@ static void virtio_set_features_nocheck_bh(void *opaque)
- }
-
- static int coroutine_mixed_fn
--virtio_set_features_nocheck_maybe_co(VirtIODevice *vdev, uint64_t val)
-+virtio_set_features_nocheck_maybe_co(VirtIODevice *vdev,
-+ const uint64_t *val)
- {
- if (qemu_in_coroutine()) {
- VirtioSetFeaturesNocheckData data = {
- .co = qemu_coroutine_self(),
- .vdev = vdev,
-- .val = val,
- };
-+ virtio_features_copy(data.val, val);
- aio_bh_schedule_oneshot(qemu_get_current_aio_context(),
- virtio_set_features_nocheck_bh, &data);
- qemu_coroutine_yield();
-@@ -3117,6 +3148,7 @@ virtio_set_features_nocheck_maybe_co(VirtIODevice *vdev, uint64_t val)
-
- int virtio_set_features(VirtIODevice *vdev, uint64_t val)
- {
-+ uint64_t features[VIRTIO_FEATURES_NU64S];
- int ret;
- /*
- * The driver must not attempt to set features after feature negotiation
-@@ -3132,7 +3164,8 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)
- __func__, vdev->name);
- }
-
-- ret = virtio_set_features_nocheck(vdev, val);
-+ virtio_features_from_u64(features, val);
-+ ret = virtio_set_features_nocheck(vdev, features);
- if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) {
- /* VIRTIO_RING_F_EVENT_IDX changes the size of the caches. */
- int i;
-@@ -3155,6 +3188,7 @@ void virtio_reset(void *opaque)
- {
- VirtIODevice *vdev = opaque;
- VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
-+ uint64_t features[VIRTIO_FEATURES_NU64S];
- int i;
-
- virtio_set_status(vdev, 0);
-@@ -3181,7 +3215,8 @@ void virtio_reset(void *opaque)
- vdev->start_on_kick = false;
- vdev->started = false;
- vdev->broken = false;
-- virtio_set_features_nocheck(vdev, 0);
-+ virtio_features_clear(features);
-+ virtio_set_features_nocheck(vdev, features);
- vdev->queue_sel = 0;
- vdev->status = 0;
- vdev->disabled = false;
-@@ -3264,7 +3299,7 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
- * Note: devices should always test host features in future - don't create
- * new dependencies like this.
- */
-- vdev->guest_features = features;
-+ virtio_features_from_u64(vdev->guest_features_ex, features);
-
- config_len = qemu_get_be32(f);
-
-@@ -3343,26 +3378,17 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
- vdev->device_endian = virtio_default_endian();
- }
-
-- if (virtio_64bit_features_needed(vdev)) {
-- /*
-- * Subsection load filled vdev->guest_features. Run them
-- * through virtio_set_features to sanity-check them against
-- * host_features.
-- */
-- uint64_t features64 = vdev->guest_features;
-- if (virtio_set_features_nocheck_maybe_co(vdev, features64) < 0) {
-- error_report("Features 0x%" PRIx64 " unsupported. "
-- "Allowed features: 0x%" PRIx64,
-- features64, vdev->host_features);
-- return -1;
-- }
-- } else {
-- if (virtio_set_features_nocheck_maybe_co(vdev, features) < 0) {
-- error_report("Features 0x%x unsupported. "
-- "Allowed features: 0x%" PRIx64,
-- features, vdev->host_features);
-- return -1;
-- }
-+ /*
-+ * guest_features_ex is fully initialized with u32 features and upper
-+ * bits have been filled as needed by the later load.
-+ */
-+ if (virtio_set_features_nocheck_maybe_co(vdev,
-+ vdev->guest_features_ex) < 0) {
-+ error_report("Features 0x" VIRTIO_FEATURES_FMT " unsupported. "
-+ "Allowed features: 0x" VIRTIO_FEATURES_FMT,
-+ VIRTIO_FEATURES_PR(vdev->guest_features_ex),
-+ VIRTIO_FEATURES_PR(vdev->host_features_ex));
-+ return -1;
- }
-
- if (!virtio_device_started(vdev, vdev->status) &&
---
-2.47.3
-
diff --git a/kvm-vmstate-Introduce-VMSTATE_VARRAY_INT32_ALLOC.patch b/kvm-vmstate-Introduce-VMSTATE_VARRAY_INT32_ALLOC.patch
deleted file mode 100644
index 2a520f4..0000000
--- a/kvm-vmstate-Introduce-VMSTATE_VARRAY_INT32_ALLOC.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 0539b459c8a134559b05dbfc3fc1244f64e89e62 Mon Sep 17 00:00:00 2001
-From: Eric Auger <eric.auger@redhat.com>
-Date: Fri, 6 Mar 2026 09:01:12 +0000
-Subject: [PATCH 001/116] vmstate: Introduce VMSTATE_VARRAY_INT32_ALLOC
-
-RH-Author: Eric Auger <eric.auger@redhat.com>
-RH-MergeRequest: 488: [rhel-10] Backport cross-kernel migration failure mitigation series
-RH-Jira: RHEL-174858
-RH-Acked-by: Mohammadfaiz Bawa <None>
-RH-Acked-by: Sebastian Ott <sebott@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Commit: [1/16] 54c0c7a95e98c7d6eb73119763121c3ba30e8c58 (eauger1/centos-qemu-kvm)
-
-Already existing VMSTATE_VARRAY_INT32 requires an array to be
-pre-allocated, however there are cases when the size is not known in
-advance and there is no real need to enforce it.
-
-Introduce VMSTATE_VARRAY_INT32_ALLOC as we currently have for UINT32
-and UINT16.
-
-The first user of this variant will be the target/arm/machine.c cpreg
-indexes/values arrays.
-
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Reviewed-by: Peter Xu <peterx@redhat.com>
-Message-id: 20260304101625.1962633-2-eric.auger@redhat.com
-Suggested-by: Peter Maydell <peter.maydell@linaro.org>
-Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-Reviewed-by: Peter Xu <peterx@redhat.com>
-Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-(cherry picked from commit f555338df754b37e042d5b88610c34b1d1845383)
-Signed-off-by: Eric Auger <eric.auger@redhat.com>
----
- include/migration/vmstate.h | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
-index 1ff7bd9ac4..ef2f0c5c93 100644
---- a/include/migration/vmstate.h
-+++ b/include/migration/vmstate.h
-@@ -432,6 +432,16 @@ extern const VMStateInfo vmstate_info_qlist;
- .offset = vmstate_offset_pointer(_state, _field, _type), \
- }
-
-+#define VMSTATE_VARRAY_INT32_ALLOC(_field, _state, _field_num, _version, _info, _type) {\
-+ .name = (stringify(_field)), \
-+ .version_id = (_version), \
-+ .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
-+ .info = &(_info), \
-+ .size = sizeof(_type), \
-+ .flags = VMS_VARRAY_INT32 | VMS_POINTER | VMS_ALLOC, \
-+ .offset = vmstate_offset_pointer(_state, _field, _type), \
-+}
-+
- #define VMSTATE_VARRAY_UINT32_ALLOC(_field, _state, _field_num, _version, _info, _type) {\
- .name = (stringify(_field)), \
- .version_id = (_version), \
---
-2.52.0
-
diff --git a/kvm-x86-create-new-rhel-10.2-specific-pc-q35-machine-typ.patch b/kvm-x86-create-new-rhel-10.2-specific-pc-q35-machine-typ.patch
deleted file mode 100644
index 06321af..0000000
--- a/kvm-x86-create-new-rhel-10.2-specific-pc-q35-machine-typ.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 95622c4261ef6e0eb6688196d87d3bed838aa91d Mon Sep 17 00:00:00 2001
-From: Sebastian Ott <sebott@redhat.com>
-Date: Wed, 29 Oct 2025 17:59:07 +0100
-Subject: [PATCH 08/10] x86: create new rhel 10.2 specific pc-q35 machine type
-
-RH-Author: Sebastian Ott <sebott@redhat.com>
-RH-MergeRequest: 416: x86, arm: create new rhel 9.8, 10.2 specific machine types
-RH-Jira: RHEL-105826 RHEL-105828
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Commit: [3/4] 7f5a5fa45696e579cd08fb3869884ce9543badd5 (seott1/cos-qemu-kvm)
-
-Signed-off-by: Sebastian Ott <sebott@redhat.com>
----
- hw/i386/pc_q35.c | 14 ++++++++++++--
- 1 file changed, 12 insertions(+), 2 deletions(-)
-
-diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
-index e5d10c0335..aea4735dd3 100644
---- a/hw/i386/pc_q35.c
-+++ b/hw/i386/pc_q35.c
-@@ -690,10 +690,20 @@ DEFINE_Q35_MACHINE(2, 6);
-
- /* Red Hat Enterprise Linux machine types */
-
--static void pc_q35_rhel_machine_10_0_0_options(MachineClass *m)
-+static void pc_q35_rhel_machine_10_2_0_options(MachineClass *m)
- {
- PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
- pc_q35_machine_options(m);
-+ m->desc = "RHEL-10.2.0 PC (Q35 + ICH9, 2009)";
-+ pcmc->smbios_stream_product = "RHEL";
-+ pcmc->smbios_stream_version = "10.2.0";
-+}
-+DEFINE_Q35_MACHINE_AS_LATEST(10, 2, 0);
-+
-+static void pc_q35_rhel_machine_10_0_0_options(MachineClass *m)
-+{
-+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
-+ pc_q35_rhel_machine_10_2_0_options(m);
- m->desc = "RHEL-10.0.0 PC (Q35 + ICH9, 2009)";
- pcmc->smbios_stream_product = "RHEL";
- pcmc->smbios_stream_version = "10.0.0";
-@@ -707,7 +717,7 @@ static void pc_q35_rhel_machine_10_0_0_options(MachineClass *m)
- compat_props_add(m->compat_props, pc_rhel_10_1_compat,
- pc_rhel_10_1_compat_len);
- }
--DEFINE_Q35_MACHINE_AS_LATEST(10, 0, 0);
-+DEFINE_Q35_MACHINE(10, 0, 0);
-
- static void pc_q35_rhel_machine_9_6_0_options(MachineClass *m)
- {
---
-2.47.3
-
diff --git a/kvm-x86-create-new-rhel-9.8-specific-pc-q35-machine-type.patch b/kvm-x86-create-new-rhel-9.8-specific-pc-q35-machine-type.patch
deleted file mode 100644
index 0354574..0000000
--- a/kvm-x86-create-new-rhel-9.8-specific-pc-q35-machine-type.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From ee136e68450beb87b55e3668538b3a52fdf98736 Mon Sep 17 00:00:00 2001
-From: Sebastian Ott <sebott@redhat.com>
-Date: Wed, 29 Oct 2025 18:05:21 +0100
-Subject: [PATCH 09/10] x86: create new rhel 9.8 specific pc-q35 machine type
-
-RH-Author: Sebastian Ott <sebott@redhat.com>
-RH-MergeRequest: 416: x86, arm: create new rhel 9.8, 10.2 specific machine types
-RH-Jira: RHEL-105826 RHEL-105828
-RH-Acked-by: Eric Auger <eric.auger@redhat.com>
-RH-Acked-by: Gavin Shan <gshan@redhat.com>
-RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
-RH-Commit: [4/4] 2bfa55e063b4551e8e3299cf4f7aa2520943076a (seott1/cos-qemu-kvm)
-
-Signed-off-by: Sebastian Ott <sebott@redhat.com>
----
- hw/i386/pc_q35.c | 17 ++++++++++++++---
- 1 file changed, 14 insertions(+), 3 deletions(-)
-
-diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
-index aea4735dd3..efbb5695c2 100644
---- a/hw/i386/pc_q35.c
-+++ b/hw/i386/pc_q35.c
-@@ -719,16 +719,27 @@ static void pc_q35_rhel_machine_10_0_0_options(MachineClass *m)
- }
- DEFINE_Q35_MACHINE(10, 0, 0);
-
-+static void pc_q35_rhel_machine_9_8_0_options(MachineClass *m)
-+{
-+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
-+ pc_q35_machine_options(m);
-+ m->desc = "RHEL-9.8.0 PC (Q35 + ICH9, 2009)";
-+ pcmc->smbios_stream_product = "RHEL";
-+ pcmc->smbios_stream_version = "9.8.0";
-+
-+ /* NB: remember to move this line to the *latest* RHEL 9 machine */
-+ compat_props_add(m->compat_props, hw_compat_rhel_9, hw_compat_rhel_9_len);
-+}
-+DEFINE_Q35_MACHINE(9, 8, 0);
-+
- static void pc_q35_rhel_machine_9_6_0_options(MachineClass *m)
- {
- PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
- pc_q35_rhel_machine_10_0_0_options(m);
-+ pc_q35_rhel_machine_9_8_0_options(m);
- m->desc = "RHEL-9.6.0 PC (Q35 + ICH9, 2009)";
- pcmc->smbios_stream_product = "RHEL";
- pcmc->smbios_stream_version = "9.6.0";
--
-- /* NB: remember to move this line to the *latest* RHEL 9 machine */
-- compat_props_add(m->compat_props, hw_compat_rhel_9, hw_compat_rhel_9_len);
- }
-
- DEFINE_Q35_MACHINE(9, 6, 0);
---
-2.47.3
-
diff --git a/qemu.spec b/qemu.spec
index fc63195..3520544 100644
--- a/qemu.spec
+++ b/qemu.spec
@@ -142,8 +142,8 @@ Obsoletes: %{name}-block-ssh <= %{epoch}:%{version} \
Summary: QEMU is a machine emulator and virtualizer
Name: qemu-kvm
-Version: 10.1.0
-Release: 28%{?rcrel}%{?dist}%{?cc_suffix}
+Version: 11.1.0
+Release: 1%{?rcrel}%{?dist}%{?cc_suffix}
# Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
# Epoch 15 used for RHEL 8
# Epoch 17 used for RHEL 9 (due to release versioning offset in RHEL 8.5)
@@ -166,16 +166,11 @@ Source28: 95-kvm-memlock.conf
Source30: kvm-s390x.conf
Source31: kvm-x86.conf
Source36: README.tests
-# Handling binary changes for MR 505
-Source40: IORT
-Source41: IORT.its_off
-Source42: IORT.smmuv3-dev
-Source43: IORT.smmuv3-legacy
#Patch0001: 0001-python-Replace-asyncio.get_event_loop-for-Python-3.14.patch
#Patch0002: 0002-Fix-curl-changes.patch
-Patch0003: 0003-avoid-perl-precedence-warning.patch
+#Patch0003: 0003-avoid-perl-precedence-warning.patch
Patch0004: 0004-Initial-redhat-build.patch
Patch0005: 0005-Enable-disable-devices-for-RHEL.patch
Patch0006: 0006-Machine-type-related-general-changes.patch
@@ -189,1502 +184,23 @@ Patch0013: 0013-Add-downstream-x86_64-versioned-pc-q35-machine-types.patch
Patch0014: 0014-Disable-virtio-net-pci-romfile-loading-on-riscv64.patch
Patch0015: 0015-Revert-meson-temporarily-disable-Wunused-function.patch
Patch0016: 0016-Enable-make-check.patch
-Patch0017: 0017-vfio-cap-number-of-devices-that-can-be-assigned.patch
-Patch0018: 0018-Add-support-statement-to-help-output.patch
-Patch0019: 0019-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch
-Patch0020: 0020-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch
-Patch0021: 0021-file-posix-Define-DM_MPATH_PROBE_PATHS.patch
-# For RHEL-112882 - [DEV Task]: Assertion `core->delayed_causes == 0' failed with e1000e NIC
-Patch22: kvm-e1000e-Prevent-crash-from-legacy-interrupt-firing-af.patch
-# For RHEL-119368 - [rhel10] Backport "arm/kvm: report registers we failed to set"
-Patch23: kvm-arm-kvm-report-registers-we-failed-to-set.patch
-# For RHEL-116443 - qemu crash after hot-unplug disk from the multifunction enabled bus,crash point PCIDevice *vf = dev->exp.sriov_pf.vf[i]
-Patch24: kvm-pcie_sriov-make-pcie_sriov_pf_exit-safe-on-non-SR-IO.patch
-# For RHEL-120253 - Backport fixes for PDCM and ARCH_CAPABILITIES migration incompatibility
-Patch25: kvm-target-i386-add-compatibility-property-for-arch_capa.patch
-# For RHEL-120253 - Backport fixes for PDCM and ARCH_CAPABILITIES migration incompatibility
-Patch26: kvm-target-i386-add-compatibility-property-for-pdcm-feat.patch
-# For RHEL-104009 - [IBM 10.2 FEAT] KVM: Enhance machine type definition to include CPI and PCI passthru capabilities (qemu)
-# For RHEL-105823 - Add new -rhel10.2.0 machine type to qemu-kvm [s390x]
-# For RHEL-73008 - [IBM 10.2 FEAT] KVM: Implement Control Program Identification (qemu)
-Patch27: kvm-qapi-machine-s390x-add-QAPI-event-SCLP_CPI_INFO_AVAI.patch
-# For RHEL-104009 - [IBM 10.2 FEAT] KVM: Enhance machine type definition to include CPI and PCI passthru capabilities (qemu)
-# For RHEL-105823 - Add new -rhel10.2.0 machine type to qemu-kvm [s390x]
-# For RHEL-73008 - [IBM 10.2 FEAT] KVM: Implement Control Program Identification (qemu)
-Patch28: kvm-tests-functional-add-tests-for-SCLP-event-CPI.patch
-# For RHEL-104009 - [IBM 10.2 FEAT] KVM: Enhance machine type definition to include CPI and PCI passthru capabilities (qemu)
-# For RHEL-105823 - Add new -rhel10.2.0 machine type to qemu-kvm [s390x]
-# For RHEL-73008 - [IBM 10.2 FEAT] KVM: Implement Control Program Identification (qemu)
-Patch29: kvm-redhat-Add-new-rhel9.8.0-and-rhel10.2.0-machine-type.patch
-# For RHEL-118810 - [RHEL 10.2] Windows 11 VM fails to boot up with ramfb='on' with QEMU 10.1
-Patch30: kvm-vfio-rename-field-to-num_initial_regions.patch
-# For RHEL-118810 - [RHEL 10.2] Windows 11 VM fails to boot up with ramfb='on' with QEMU 10.1
-Patch31: kvm-vfio-only-check-region-info-cache-for-initial-region.patch
-# For RHEL-105826 - Add new -rhel10.2.0 machine type to qemu-kvm [aarch64]
-# For RHEL-105828 - Add new -rhel10.2.0 machine type to qemu-kvm [x86_64]
-Patch32: kvm-arm-create-new-rhel-10.2-specific-virt-machine-type.patch
-# For RHEL-105826 - Add new -rhel10.2.0 machine type to qemu-kvm [aarch64]
-# For RHEL-105828 - Add new -rhel10.2.0 machine type to qemu-kvm [x86_64]
-Patch33: kvm-arm-create-new-rhel-9.8-specific-virt-machine-type.patch
-# For RHEL-105826 - Add new -rhel10.2.0 machine type to qemu-kvm [aarch64]
-# For RHEL-105828 - Add new -rhel10.2.0 machine type to qemu-kvm [x86_64]
-Patch34: kvm-x86-create-new-rhel-10.2-specific-pc-q35-machine-typ.patch
-# For RHEL-105826 - Add new -rhel10.2.0 machine type to qemu-kvm [aarch64]
-# For RHEL-105828 - Add new -rhel10.2.0 machine type to qemu-kvm [x86_64]
-Patch35: kvm-x86-create-new-rhel-9.8-specific-pc-q35-machine-type.patch
-# For RHEL-101929 - enable 'usb-bot' device for proper support of USB CD-ROM drives via libvirt
-Patch36: kvm-rh-enable-CONFIG_USB_STORAGE_BOT.patch
-# For RHEL-120116 - CVE-2025-11234 qemu-kvm: VNC WebSocket handshake use-after-free [rhel-10.2]
-Patch37: kvm-io-move-websock-resource-release-to-close-method.patch
-# For RHEL-120116 - CVE-2025-11234 qemu-kvm: VNC WebSocket handshake use-after-free [rhel-10.2]
-Patch38: kvm-io-fix-use-after-free-in-websocket-handshake-code.patch
-# For RHEL-126573 - VFIO migration using multifd should be disabled by default
-Patch39: kvm-vfio-Disable-VFIO-migration-with-MultiFD-support.patch
-# For RHEL-67323 - [aarch64] Support ACPI based PCI hotplug on ARM
-Patch40: kvm-hw-arm-virt-Use-ACPI-PCI-hotplug-by-default-from-10..patch
-# For RHEL-73800 - NVIDIA:Grace-Hopper:Backport support for user-creatable nested SMMUv3 - RHEL 10.1
-Patch41: kvm-hw-arm-smmu-common-Check-SMMU-has-PCIe-Root-Complex-.patch
-# For RHEL-73800 - NVIDIA:Grace-Hopper:Backport support for user-creatable nested SMMUv3 - RHEL 10.1
-Patch42: kvm-hw-arm-virt-acpi-build-Re-arrange-SMMUv3-IORT-build.patch
-# For RHEL-73800 - NVIDIA:Grace-Hopper:Backport support for user-creatable nested SMMUv3 - RHEL 10.1
-Patch43: kvm-hw-arm-virt-acpi-build-Update-IORT-for-multiple-smmu.patch
-# For RHEL-73800 - NVIDIA:Grace-Hopper:Backport support for user-creatable nested SMMUv3 - RHEL 10.1
-Patch44: kvm-hw-arm-virt-Factor-out-common-SMMUV3-dt-bindings-cod.patch
-# For RHEL-73800 - NVIDIA:Grace-Hopper:Backport support for user-creatable nested SMMUv3 - RHEL 10.1
-Patch45: kvm-hw-arm-virt-Add-an-SMMU_IO_LEN-macro.patch
-# For RHEL-73800 - NVIDIA:Grace-Hopper:Backport support for user-creatable nested SMMUv3 - RHEL 10.1
-Patch46: kvm-hw-pci-Introduce-pci_setup_iommu_per_bus-for-per-bus.patch
-# For RHEL-73800 - NVIDIA:Grace-Hopper:Backport support for user-creatable nested SMMUv3 - RHEL 10.1
-Patch47: kvm-hw-arm-virt-Allow-user-creatable-SMMUv3-dev-instanti.patch
-# For RHEL-73800 - NVIDIA:Grace-Hopper:Backport support for user-creatable nested SMMUv3 - RHEL 10.1
-Patch48: kvm-qemu-options.hx-Document-the-arm-smmuv3-device.patch
-# For RHEL-73800 - NVIDIA:Grace-Hopper:Backport support for user-creatable nested SMMUv3 - RHEL 10.1
-Patch49: kvm-bios-tables-test-Allow-for-smmuv3-test-data.patch
-# For RHEL-73800 - NVIDIA:Grace-Hopper:Backport support for user-creatable nested SMMUv3 - RHEL 10.1
-Patch50: kvm-qtest-bios-tables-test-Add-tests-for-legacy-smmuv3-a.patch
-# For RHEL-73800 - NVIDIA:Grace-Hopper:Backport support for user-creatable nested SMMUv3 - RHEL 10.1
-Patch51: kvm-qtest-bios-tables-test-Update-tables-for-smmuv3-test.patch
-Patch52: kvm-qtest-Do-not-run-bios-tables-test-on-aarch64.patch
-# For RHEL-126708 - [RHEL 10]snp guest fail to boot with hugepage
-Patch53: kvm-ram-block-attributes-fix-interaction-with-hugetlb-me.patch
-# For RHEL-126708 - [RHEL 10]snp guest fail to boot with hugepage
-Patch54: kvm-ram-block-attributes-Unify-the-retrieval-of-the-bloc.patch
-# For RHEL-128085 - VM crashes during boot when virtio device is attached through vfio_ccw
-Patch55: kvm-hw-s390x-Fix-a-possible-crash-with-passed-through-vi.patch
-# For RHEL-130704 - [rhel10] Fix the typo under vfio-pci device's enable-migration option
-Patch56: kvm-Fix-the-typo-of-vfio-pci-device-s-enable-migration-o.patch
-# For RHEL-120115 - The vf nic created using the IGB emulated nic can not obtain ip address
-Patch57: kvm-pcie_sriov-Fix-broken-MMIO-accesses-from-SR-IOV-VFs.patch
-# For RHEL-130478 - Migration from RHEL 10.2 to RHEL 10.1 with virt-rhel10.0.0 machine type fails on Grace
-Patch58: kvm-arm-fix-oob-access-in-compat-handling.patch
-# For RHEL-129540 - Assertion failure on drain with iothread and I/O load
-Patch59: kvm-block-backend-Fix-race-when-resuming-queued-requests.patch
-# For RHEL-121543 - The VM hit io error when do S3-PR integration on the pass-through failover multipath device
-Patch60: kvm-file-posix-Handle-suspended-dm-multipath-better-for-.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch61: kvm-accel-Add-Meson-and-config-support-for-MSHV-accelera.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch62: kvm-target-i386-emulate-Allow-instruction-decoding-from-.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch63: kvm-target-i386-mshv-Add-x86-decoder-emu-implementation.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch64: kvm-hw-intc-Generalize-APIC-helper-names-from-kvm_-to-ac.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch65: kvm-include-hw-hyperv-Add-MSHV-ABI-header-definitions.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch66: kvm-linux-headers-linux-Add-mshv.h-headers.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch67: kvm-accel-mshv-Add-accelerator-skeleton.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch68: kvm-accel-mshv-Register-memory-region-listeners.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch69: kvm-accel-mshv-Initialize-VM-partition.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch70: kvm-treewide-rename-qemu_wait_io_event-qemu_wait_io_even.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch71: kvm-accel-mshv-Add-vCPU-creation-and-execution-loop.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch72: kvm-accel-mshv-Add-vCPU-signal-handling.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch73: kvm-target-i386-mshv-Add-CPU-create-and-remove-logic.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch74: kvm-target-i386-mshv-Implement-mshv_store_regs.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch75: kvm-target-i386-mshv-Implement-mshv_get_standard_regs.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch76: kvm-target-i386-mshv-Implement-mshv_get_special_regs.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch77: kvm-target-i386-mshv-Implement-mshv_arch_put_registers.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch78: kvm-target-i386-mshv-Set-local-interrupt-controller-stat.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch79: kvm-target-i386-mshv-Register-CPUID-entries-with-MSHV.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch80: kvm-target-i386-mshv-Register-MSRs-with-MSHV.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch81: kvm-target-i386-mshv-Integrate-x86-instruction-decoder-e.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch82: kvm-target-i386-mshv-Write-MSRs-to-the-hypervisor.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch83: kvm-target-i386-mshv-Implement-mshv_vcpu_run.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch84: kvm-accel-mshv-Handle-overlapping-mem-mappings.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch85: kvm-qapi-accel-Allow-to-query-mshv-capabilities.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch86: kvm-target-i386-mshv-Use-preallocated-page-for-hvcall.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch87: kvm-docs-Add-mshv-to-documentation.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch88: kvm-MAINTAINERS-Add-maintainers-for-mshv-accelerator.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch89: kvm-accel-mshv-initialize-thread-name.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch90: kvm-accel-mshv-use-return-value-of-handle_pio_str_read.patch
-# For RHEL-134212 - [RHEL10.2] L1VH qemu downstream initial merge RHEL10.2
-Patch91: kvm-monitor-generalize-query-mshv-info-mshv-to-query-acc.patch
-# For RHEL-110003 - Expose block limits of block nodes in QMP and qemu-img
-Patch92: kvm-block-Improve-comments-in-BlockLimits.patch
-# For RHEL-110003 - Expose block limits of block nodes in QMP and qemu-img
-Patch93: kvm-block-Expose-block-limits-for-images-in-QMP.patch
-# For RHEL-110003 - Expose block limits of block nodes in QMP and qemu-img
-Patch94: kvm-qemu-img-info-Optionally-show-block-limits.patch
-# For RHEL-110003 - Expose block limits of block nodes in QMP and qemu-img
-Patch95: kvm-qemu-img-info-Add-cache-mode-option.patch
-# For RHEL-111853 - [Intel 10.0 FEAT] [SPR] TDX: Virt-QEMU: QEMU Support [rhel-10]
-Patch96: kvm-rh-configs-enable-CONFIG_TDX-for-x86_64.patch
-# For RHEL-108142 - QEMU crashes when stopping source VM during live migration
-Patch97: kvm-block-Fix-BDS-use-after-free-during-shutdown.patch
-# For RHEL-126707 - [qemu, rhel-10] increase default TSEG size
-Patch98: kvm-fix-pc_rhel_10_2_compat_len.patch
-# For RHEL-126707 - [qemu, rhel-10] increase default TSEG size
-Patch99: kvm-q35-increase-default-tseg-size.patch
-# For RHEL-139028 - Intel IOMMU VM freezes: "call_irq_handler: 3.37 No irq handler for vector"[rhel-10.2]
-Patch100: kvm-hw-intc-ioapic-Fix-ACCEL_KERNEL_GSI_IRQFD_POSSIBLE-t.patch
-# For RHEL-111853 - [Intel 10.0 FEAT] [SPR] TDX: Virt-QEMU: QEMU Support [rhel-10]
-Patch101: kvm-redhat-allow-5-level-paging-for-TDX-VMs.patch
-# For RHEL-79118 - [network-storage][rbd][core-dump]installation of guest failed sometimes with multiqueue enabled [rhel10]
-Patch102: kvm-rbd-Run-co-BH-CB-in-the-coroutine-s-AioContext.patch
-# For RHEL-79118 - [network-storage][rbd][core-dump]installation of guest failed sometimes with multiqueue enabled [rhel10]
-Patch103: kvm-curl-Fix-coroutine-waking.patch
-# For RHEL-79118 - [network-storage][rbd][core-dump]installation of guest failed sometimes with multiqueue enabled [rhel10]
-Patch104: kvm-block-io-Take-reqs_lock-for-tracked_requests.patch
-# For RHEL-79118 - [network-storage][rbd][core-dump]installation of guest failed sometimes with multiqueue enabled [rhel10]
-Patch105: kvm-qcow2-Re-initialize-lock-in-invalidate_cache.patch
-# For RHEL-79118 - [network-storage][rbd][core-dump]installation of guest failed sometimes with multiqueue enabled [rhel10]
-Patch106: kvm-qcow2-Fix-cache_clean_timer.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch107: kvm-net-bundle-all-offloads-in-a-single-struct.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch108: kvm-linux-headers-deal-with-counted_by-annotation.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch109: kvm-linux-headers-Update-to-Linux-v6.17-rc1.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch110: kvm-virtio-introduce-extended-features-type.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch111: kvm-virtio-serialize-extended-features-state.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch112: kvm-virtio-add-support-for-negotiating-extended-features.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch113: kvm-virtio-pci-implement-support-for-extended-features.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch114: kvm-vhost-add-support-for-negotiating-extended-features.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch115: kvm-qmp-update-virtio-features-map-to-support-extended-f.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch116: kvm-vhost-backend-implement-extended-features-support.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch117: kvm-vhost-net-implement-extended-features-support.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch118: kvm-virtio-net-implement-extended-features-support.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch119: kvm-net-implement-tunnel-probing.patch
-# For RHEL-143785 - backport support for GSO over UDP tunnel offload
-Patch120: kvm-net-implement-UDP-tunnel-features-offloading.patch
-# For RHEL-147425 - virtiofs: processes become stuck in request_wait_answer on virtiofs mounts
-Patch121: kvm-vhost-user-make-vhost_set_vring_file-synchronous.patch
-# For RHEL-132749 - Migrate SCSI PR state and preempt reservation upon live migration
-Patch122: kvm-scsi-generalize-scsi_SG_IO_FROM_DEV-to-scsi_SG_IO.patch
-# For RHEL-132749 - Migrate SCSI PR state and preempt reservation upon live migration
-Patch123: kvm-scsi-add-error-reporting-to-scsi_SG_IO.patch
-# For RHEL-132749 - Migrate SCSI PR state and preempt reservation upon live migration
-Patch124: kvm-scsi-track-SCSI-reservation-state-for-live-migration.patch
-# For RHEL-132749 - Migrate SCSI PR state and preempt reservation upon live migration
-Patch125: kvm-scsi-save-load-SCSI-reservation-state.patch
-# For RHEL-132749 - Migrate SCSI PR state and preempt reservation upon live migration
-Patch126: kvm-docs-add-SCSI-migrate-pr-documentation.patch
-# For RHEL-134989 - Hotplugged interface device can not be shown in the guest
-# For RHEL-146584 - [RHEL-10.2][ARM]: Unable to Check the mem prefetched size on Guest
-Patch127: kvm-Revert-hw-arm-virt-Use-ACPI-PCI-hotplug-by-default-f.patch
-# For RHEL-153058 - Qemu crashes with "double free" during restore --reset-nvram with uefi-vars secure boot
-Patch128: kvm-hw-uefi-add-variable-digest-to-vmstate.patch
-# For RHEL-144004 - [rhel-10] Regression in BLOCK_IO_ERROR event delivery with (w|r)error setting of 'stop' or 'enospc' due to event rate limiting
-Patch129: kvm-block-Never-drop-BLOCK_IO_ERROR-with-action-stop-for.patch
-# For RHEL-155601 - Mirror job can miss writes during startup, corrupting the copy [rhel-10.2]
-Patch130: kvm-mirror-Fix-missed-dirty-bitmap-writes-during-startup.patch
-# For RHEL-158224 - qemu-kvm: disk writes of fewer bytes than requested is a retry condition, not necessarily an indication of ENOSPC [rhel-10.2]
-Patch131: kvm-linux-aio-Put-all-parameters-into-qemu_laiocb.patch
-# For RHEL-158224 - qemu-kvm: disk writes of fewer bytes than requested is a retry condition, not necessarily an indication of ENOSPC [rhel-10.2]
-Patch132: kvm-linux-aio-Resubmit-tails-of-short-reads-writes.patch
-# For RHEL-158224 - qemu-kvm: disk writes of fewer bytes than requested is a retry condition, not necessarily an indication of ENOSPC [rhel-10.2]
-Patch133: kvm-block-io_uring-avoid-potentially-getting-stuck-after.patch
-# For RHEL-158224 - qemu-kvm: disk writes of fewer bytes than requested is a retry condition, not necessarily an indication of ENOSPC [rhel-10.2]
-Patch134: kvm-io-uring-Resubmit-tails-of-short-writes.patch
-# For RHEL-114231 - Add stats-intervals support to --blockdev
-Patch135: kvm-block-enable-stats-intervals-for-storage-devices.patch
-# For RHEL-114231 - Add stats-intervals support to --blockdev
-Patch136: kvm-qdev-Free-property-array-on-release.patch
-# For RHEL-158212 - qemu-kvm doesn't retry SG-IO on 05/25/00 (ILLEGAL REQUEST / LOGICAL UNIT NOT SUPPORTED) [rhel-10.3]
-Patch137: kvm-scsi-Don-t-consider-LOGICAL-UNIT-NOT-SUPPORTED-guest.patch
-# For RHEL-112608 - [ARM64] Windows 11 VM should install without TPM Bypass
-Patch138: kvm-hw-tpm-Factor-tpm_ppi_enabled-out.patch
-# For RHEL-112608 - [ARM64] Windows 11 VM should install without TPM Bypass
-Patch139: kvm-hw-tpm-Add-TPMIfClass-ppi_enabled-field.patch
-# For RHEL-112608 - [ARM64] Windows 11 VM should install without TPM Bypass
-Patch140: kvm-hw-tpm-Remove-CRBState-ppi_enabled-field.patch
-# For RHEL-112608 - [ARM64] Windows 11 VM should install without TPM Bypass
-Patch141: kvm-hw-tpm-Propagate-ppi_enabled-to-tpm_tis_reset-and-re.patch
-# For RHEL-112608 - [ARM64] Windows 11 VM should install without TPM Bypass
-Patch142: kvm-hw-tpm-Simplify-tpm_ppi_enabled.patch
-# For RHEL-112608 - [ARM64] Windows 11 VM should install without TPM Bypass
-Patch143: kvm-docs-specs-tpm-document-PPI-support-on-ARM64-virt.patch
-# For RHEL-112608 - [ARM64] Windows 11 VM should install without TPM Bypass
-Patch144: kvm-hw-acpi-tpm-parameterize-PPI-base-address-in-tpm_bui.patch
-# For RHEL-112608 - [ARM64] Windows 11 VM should install without TPM Bypass
-Patch145: kvm-hw-tpm-add-PPI-support-to-tpm-tis-device-for-ARM64-v.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch146: kvm-vmstate-Introduce-VMSTATE_VARRAY_INT32_ALLOC.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch147: kvm-target-arm-Move-compare_u64-to-helper.c.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch148: kvm-target-arm-Convert-init_cpreg_list-to-g_hash_table_f.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch149: kvm-target-arm-machine-Use-VMSTATE_VARRAY_INT32_ALLOC-fo.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch150: kvm-target-arm-kvm-Export-kvm_print_register_name.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch151: kvm-target-arm-kvm-Tweak-print_register_name-for-arm64-s.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch152: kvm-target-arm-machine-Trace-cpreg-names-which-do-not-ma.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch153: kvm-target-arm-machine-Trace-all-register-mismatches.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch154: kvm-target-arm-machine-Fix-detection-of-unknown-incoming.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch155: kvm-target-arm-cpu-Introduce-the-infrastructure-for-cpre.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch156: kvm-target-arm-machine-Handle-ToleranceNotOnBothEnds-mig.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch157: kvm-target-arm-machine-Handle-ToleranceOnlySrcTestValue-.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch158: kvm-target-arm-cpu64-Mitigate-migration-failures-due-to-.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch159: kvm-target-arm-cpu64-Define-cpreg-migration-tolerance-fo.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch160: kvm-target-arm-helper-Define-cpreg-migration-tolerance-f.patch
-# For RHEL-174858 - [rhel10] Backport qemu cross-kernel migration mitigation series
-Patch161: kvm-Revert-target-arm-Reinstate-bogus-AArch32-DBGDTRTX-r.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch162: kvm-hw-pci-host-gpex-acpi-Fix-_DSM-function-0-support-re.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch163: kvm-vfio-scsi-ui-Error-check-qio_channel_socket_connect_.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch164: kvm-vfio-igd-Enable-quirks-when-IGD-is-not-the-primary-d.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch165: kvm-vfio-Remove-vfio-amd-xgbe-device.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch166: kvm-vfio-Remove-vfio-calxeda-xgmac-device.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch167: kvm-hw-arm-virt-Include-system-system.h.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch168: kvm-vfio-Remove-vfio-platform.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch169: kvm-vfio-Move-vfio-region.h-under-hw-vfio.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch170: kvm-vfio-container-set-error-on-cpr-failure.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch171: kvm-vfio-Report-an-error-when-the-dma_max_mappings-limit.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch172: kvm-hw-vfio-user-add-x-pci-class-code.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch173: kvm-vfio-Introduce-helper-vfio_pci_from_vfio_device.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch174: kvm-vfio-vfio-container-base.h-update-VFIOContainerBase-.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch175: kvm-vfio-vfio-container.h-update-VFIOContainer-declarati.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch176: kvm-hw-vfio-cpr-legacy.c-use-QOM-casts-where-appropriate.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch177: kvm-hw-vfio-container.c-use-QOM-casts-where-appropriate.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch178: kvm-vfio-spapr.c-use-QOM-casts-where-appropriate.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch179: kvm-vfio-vfio-container.h-rename-VFIOContainer-bcontaine.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch180: kvm-vfio-user-container.h-update-VFIOUserContainer-decla.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch181: kvm-vfio-container.c-use-QOM-casts-where-appropriate.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch182: kvm-vfio-user-container.h-rename-VFIOUserContainer-bcont.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch183: kvm-vfio-user-pci.c-update-VFIOUserPCIDevice-declaration.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch184: kvm-vfio-user-pci.c-use-QOM-casts-where-appropriate.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch185: kvm-vfio-user-pci.c-rename-VFIOUserPCIDevice-device-fiel.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch186: kvm-vfio-pci.h-update-VFIOPCIDevice-declaration.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch187: kvm-vfio-pci.c-use-QOM-casts-where-appropriate.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch188: kvm-vfio-pci-quirks.c-use-QOM-casts-where-appropriate.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch189: kvm-vfio-cpr.c-use-QOM-casts-where-appropriate.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch190: kvm-vfio-igd.c-use-QOM-casts-where-appropriate.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch191: kvm-vfio-user-pci.c-use-QOM-casts-where-appropriate2.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch192: kvm-vfio-pci.h-rename-VFIOPCIDevice-pdev-field-to-parent.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch193: kvm-treewide-handle-result-of-qio_channel_set_blocking.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch194: kvm-vfio-pci-Do-not-unparent-in-instance_finalize.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch195: kvm-vfio-Do-not-unparent-in-instance_finalize.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch196: kvm-include-hw-vfio-vfio-container.h-rename-VFIOContaine.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch197: kvm-include-hw-vfio-vfio-container-base.h-rename-VFIOCon.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch198: kvm-include-hw-vfio-vfio-container.h-rename-file-to-vfio.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch199: kvm-include-hw-vfio-vfio-container-base.h-rename-file-to.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch200: kvm-hw-vfio-container.c-rename-file-to-container-legacy..patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch201: kvm-hw-vfio-container-base.c-rename-file-to-container.c.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch202: kvm-vfio-iommufd.c-use-QOM-casts-where-appropriate.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch203: kvm-vfio-cpr-iommufd.c-use-QOM-casts-where-appropriate.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch204: kvm-vfio-vfio-iommufd.h-rename-VFIOContainer-bcontainer-.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch205: kvm-vfio-spapr.c-use-QOM-casts-where-appropriate2.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch206: kvm-vfio-spapr.c-rename-VFIOContainer-bcontainer-field-t.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch207: kvm-vfio-pci.c-rename-vfio_instance_init-to-vfio_pci_ini.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch208: kvm-vfio-pci.c-rename-vfio_instance_finalize-to-vfio_pci.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch209: kvm-vfio-pci.c-rename-vfio_pci_dev_class_init-to-vfio_pc.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch210: kvm-vfio-pci.c-rename-vfio_pci_dev_info-to-vfio_pci_info.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch211: kvm-s390x-s390-pci-vfio.c-use-QOM-casts-where-appropriat.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch212: kvm-hw-vfio-types.h-rename-TYPE_VFIO_PCI_BASE-to-TYPE_VF.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch213: kvm-vfio-pci.c-rename-vfio_pci_base_dev_class_init-to-vf.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch214: kvm-vfio-pci.c-rename-vfio_pci_base_dev_info-to-vfio_pci.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch215: kvm-vfio-pci.c-rename-vfio_pci_dev_properties-to-vfio_pc.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch216: kvm-vfio-pci.c-rename-vfio_pci_dev_nohotplug_properties-.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch217: kvm-vfio-pci.c-rename-vfio_pci_nohotplug_dev_class_init-.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch218: kvm-vfio-pci.c-rename-vfio_pci_nohotplug_dev_info-to-vfi.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch219: kvm-vfio-user-pci.c-rename-vfio_user_pci_dev_class_init-.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch220: kvm-vfio-user-pci.c-rename-vfio_user_pci_dev_properties-.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch221: kvm-vfio-user-pci.c-rename-vfio_user_instance_init-to-vf.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch222: kvm-vfio-user-pci.c-rename-vfio_user_instance_finalize-t.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch223: kvm-vfio-user-pci.c-rename-vfio_user_pci_dev_info-to-vfi.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch224: kvm-include-hw-vfio-vfio-device.h-fix-include-header-gua.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch225: kvm-vfio-Remove-workaround-for-kernel-DMA-unmap-overflow.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch226: kvm-system-iommufd-Use-uint64_t-type-for-IOVA-mapping-si.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch227: kvm-hw-vfio-Reorder-vfio_container_query_dirty_bitmap-tr.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch228: kvm-hw-vfio-Avoid-ram_addr_t-in-vfio_container_query_dir.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch229: kvm-hw-vfio-Use-uint64_t-for-IOVA-mapping-size-in-vfio_c.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch230: kvm-migration-push-Error-errp-into-vmstate_subsection_lo.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch231: kvm-migration-push-Error-errp-into-vmstate_load_state.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch232: kvm-migration-Remove-error-variant-of-vmstate_save_state.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch233: kvm-migration-multi-mode-notifier.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch234: kvm-migration-add-cpr_walk_fd.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch235: kvm-oslib-qemu_clear_cloexec.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch236: kvm-migration-cpr-exec-command-parameter.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch237: kvm-migration-cpr-exec-save-and-load.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch238: kvm-migration-cpr-exec-mode.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch239: kvm-migration-cpr-exec-docs.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch240: kvm-vfio-cpr-exec-mode.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch241: kvm-hw-vfio-listener-Include-missing-exec-target_page.h-.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch242: kvm-hw-Remove-unnecessary-system-ram_addr.h-header.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch243: kvm-vfio-container-Remap-only-populated-parts-in-a-secti.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch244: kvm-vfio-cpr-legacy-drop-an-erroneous-assert.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch245: kvm-vfio-iommufd-Set-cpr.ioas_id-on-source-side-for-CPR-.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch246: kvm-vfio-iommufd-Restore-vbasedev-s-reference-to-hwpt-af.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch247: kvm-vfio-container-Support-unmap-all-in-one-ioctl.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch248: kvm-vfio-iommufd-Support-unmap-all-in-one-ioctl.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch249: kvm-vfio-listener-Add-an-assertion-for-unmap_all.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch250: kvm-vfio-Clean-up-includes.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch251: kvm-migration-set-correct-list-pointer-when-removing-not.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch252: kvm-vfio-user-simplify-vfio_user_process.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch253: kvm-vfio-user-clarify-partial-message-handling.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch254: kvm-vfio-user-refactor-out-header-handling.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch255: kvm-vfio-user-simplify-vfio_user_recv_one.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch256: kvm-vfio-user-recycle-msg-on-failure.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch257: kvm-include-hw-hyperv-Remove-unused-struct-mshv_vp_regis.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch258: kvm-linux-headers-Update-to-Linux-v6.18-rc3.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch259: kvm-linux-headers-Update-to-Linux-v6.19-rc1.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch260: kvm-hw-vfio-Add-helper-to-retrieve-device-feature.patch
-# For RHEL-138494 - NVIDIA:Grace-Hopper:Backport vfio: Add DMABUF support for PCI BAR regions - RHEL 10.3
-Patch261: kvm-hw-vfio-region-Create-dmabuf-for-PCI-BAR-per-region.patch
-# For RHEL-178767 - MSHV backport onto QEMU 10.1.0 is not able to launch MSHV guests
-Patch262: kvm-accel-mshv-Remove-remap-overlapping-mappings-code.patch
-# For RHEL-178767 - MSHV backport onto QEMU 10.1.0 is not able to launch MSHV guests
-Patch263: kvm-accel-mshv-implement-cpu_thread_is_idle-hook.patch
-# For RHEL-155807 - live migration failed the VM just register key only [rhel-10.3]
-Patch264: kvm-scsi-adjust-error_prepend-formatting.patch
-# For RHEL-155807 - live migration failed the VM just register key only [rhel-10.3]
-Patch265: kvm-scsi-always-send-valid-PREEMPT-TYPE-field.patch
-# For RHEL-155807 - live migration failed the VM just register key only [rhel-10.3]
-Patch266: kvm-scsi-register-again-after-PREEMPT-without-reservatio.patch
-# For RHEL-178846 - [aarch64] qemu-kvm crashes on --device tpm-tis-device,?
-Patch267: kvm-hw-tpm-tpm_tis_sysbus-defer-resource-allocation-to-r.patch
-# For RHEL-180750 - Backport in QEMU : vfio/container: Restrict dma_map_file() to shared RAM or RAM devices
-Patch268: kvm-vfio-container-Restrict-dma_map_file-to-shared-RAM-o.patch
-# For RHEL-153123 - live migration failed or get failed WSFC test result during WSFC testing [rhel-10.3]
-Patch269: kvm-scsi-change-buf_size-to-unsigned-int-in-scsi_SG_IO.patch
-# For RHEL-153123 - live migration failed or get failed WSFC test result during WSFC testing [rhel-10.3]
-Patch270: kvm-scsi-handle-reservation-changes-across-migration.patch
-# For RHEL-150900 - NVIDIA:Grace:Backport hw/vfio: Enable hugepfnmap for non-power-of-2 device memory regions - RHEL 10.3
-Patch271: kvm-hw-vfio-sort-and-validate-sparse-mmap-regions-by-off.patch
-# For RHEL-150900 - NVIDIA:Grace:Backport hw/vfio: Enable hugepfnmap for non-power-of-2 device memory regions - RHEL 10.3
-Patch272: kvm-vfio-Add-Error-parameter-to-vfio_region_setup.patch
-# For RHEL-150900 - NVIDIA:Grace:Backport hw/vfio: Enable hugepfnmap for non-power-of-2 device memory regions - RHEL 10.3
-Patch273: kvm-hw-vfio-align-mmap-to-power-of-2-of-region-size-for-.patch
-# For RHEL-184530 - CVE-2026-48914 qemu-kvm: Heap buffer overflow in virtio-blk SCSI request handling [rhel-10.3]
-Patch274: kvm-virtio-blk-add-missing-VIRTIO_BLK_T_SCSI_CMD-size-ch.patch
-# For RHEL-121686 - qemu-kvm hung during drain after double pause
-Patch275: kvm-blkdebug-Add-delay-ns-option.patch
-# For RHEL-121686 - qemu-kvm hung during drain after double pause
-Patch276: kvm-block-Add-blk_co_start-end_request-and-BDRV_REQ_NO_Q.patch
-# For RHEL-121686 - qemu-kvm hung during drain after double pause
-Patch277: kvm-block-Add-flags-parameter-to-blk_-_pdiscard.patch
-# For RHEL-121686 - qemu-kvm hung during drain after double pause
-Patch278: kvm-ide-Minimal-fix-for-deadlock-between-TRIM-and-drain.patch
-# For RHEL-121686 - qemu-kvm hung during drain after double pause
-Patch279: kvm-ide-Clean-up-ide_trim_co_entry-to-be-idiomatic-corou.patch
-# For RHEL-121686 - qemu-kvm hung during drain after double pause
-Patch280: kvm-ide-test-Factor-out-wait_dma_completion.patch
-# For RHEL-121686 - qemu-kvm hung during drain after double pause
-Patch281: kvm-ide-test-Test-reset-during-TRIM.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch282: kvm-block-graph-lock-fix-missed-wakeup-in-bdrv_graph_co_.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch283: kvm-block-curl-fix-curl-internal-handles-handling.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch284: kvm-block-curl.c-Use-explicit-long-constants-in-curl_eas.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch285: kvm-block-curl.c-Fix-CURLOPT_VERBOSE-parameter-type.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch286: kvm-block-curl-fix-concurrent-completion-handling.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch287: kvm-block-curl-free-s-password-in-cleanup-paths.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch288: kvm-nvme-Kick-and-check-completions-in-BDS-context.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch289: kvm-nvme-Note-in-which-AioContext-some-functions-run.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch290: kvm-block-remove-detached-header-option-from-opts-after-.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch291: kvm-block-fix-luks-amend-when-run-in-coroutine.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch292: kvm-qed-Don-t-try-to-flush-during-incoming-migration.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch293: kvm-block-vmdk-fix-OOB-read-in-vmdk_read_extent.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch294: kvm-block-throttle-groups-fix-deadlock-with-iolimits-and.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch295: kvm-throttle-group-Fix-race-condition-in-throttle_group_.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch296: kvm-qemu-img-Fix-amend-option-parse-error-handling.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch297: kvm-qemu-img-rebase-don-t-exceed-IO_BUF_SIZE-in-one-oper.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch298: kvm-python-backport-drop-Python3.6-workarounds.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch299: kvm-python-backport-Remove-deprecated-get_event_loop-cal.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch300: kvm-python-backport-avoid-creating-additional-event-loop.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch301: kvm-iotests-147-ensure-temporary-sockets-are-closed-befo.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch302: kvm-iotests-151-ensure-subprocesses-are-cleaned-up.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch303: kvm-tests-qemu-iotest-fix-iotest-024-with-qed-images.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch304: kvm-tests-qemu-iotests-Fix-check-for-existing-file-in-_r.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch305: kvm-async-access-bottom-half-flags-with-qatomic_read.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch306: kvm-block-linux-aio-bound-ioq_submit-recursion-depth.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch307: kvm-block-io-fallback-to-bounce-buffer-if-BLKZEROOUT-is-.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch308: kvm-file-posix-populate-pwrite_zeroes_alignment.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch309: kvm-block-use-pwrite_zeroes_alignment-when-writing-first.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch310: kvm-iotests-add-Linux-loop-device-image-creation-test.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch311: kvm-virtio-Fix-crash-when-sriov-pf-is-set-for-non-PCI-Ex.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch312: kvm-virtio-scsi-pass-the-same-cdb_size-to-virtio_scsi_po.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch313: kvm-hw-scsi-avoid-deadlock-upon-TMF-request-cancelling-w.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch314: kvm-virtio-blk-fix-zone-report-buffer-out-of-memory-CVE-.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch315: kvm-ide-Fix-potential-assertion-failure-on-VM-stop-for-P.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch316: kvm-block-Create-DEFAULT_BLOCK_CONF-macro.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch317: kvm-block-Add-more-defaults-to-DEFAULT_BLOCK_CONF.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch318: kvm-block-mirror-check-range-when-setting-zero-bitmap-fo.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch319: kvm-iotests-test-active-mirror-with-unaligned-small-writ.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch320: kvm-block-mirror-fix-assertion-failure-upon-duplicate-co.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch321: kvm-commit-Drain-nodes-across-all-of-bdrv_commit.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch322: kvm-qemu-io-Add-aio_discard-command.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch323: kvm-qcow2-Fix-corruption-on-discard-during-write-with-CO.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch324: kvm-iotests-046-Test-that-discard-write_zeroes-wait-for-.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch325: kvm-qcow2-Fix-data-loss-on-zero-write-with-detect-zeroes.patch
-# For RHEL-186384 - virt-storage: Backport stable branch fixes
-Patch326: kvm-block-Fix-crash-after-setting-latency-historygram-wi.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch327: kvm-backends-iommufd-Introduce-iommufd_backend_alloc_vio.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch328: kvm-backends-iommufd-Introduce-iommufd_backend_alloc_vde.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch329: kvm-hw-arm-smmu-common-Factor-out-common-helper-function.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch330: kvm-hw-arm-smmu-add-memory-regions-as-property-for-an-SM.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch331: kvm-hw-arm-smmuv3-Extract-common-definitions-to-smmuv3-c.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch332: kvm-hw-arm-smmu-common-Make-iommu-ops-part-of-SMMUState.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch333: kvm-hw-arm-smmuv3-accel-Introduce-smmuv3-accel-device.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch334: kvm-hw-arm-smmuv3-accel-Initialize-shared-system-address.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch335: kvm-hw-pci-pci-Move-pci_init_bus_master-after-adding-dev.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch336: kvm-hw-pci-Export-pci_device_get_iommu_bus_devfn-and-ret.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch337: kvm-hw-pci-pci-Add-optional-supports_address_space-callb.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch338: kvm-hw-pci-bridge-pci_expander_bridge-Move-TYPE_PXB_PCIE.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch339: kvm-hw-arm-smmuv3-accel-Restrict-accelerated-SMMUv3-to-v.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch340: kvm-hw-arm-smmuv3-Implement-get_viommu_cap-callback.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch341: kvm-hw-pci-Introduce-pci_device_get_viommu_flags.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch342: kvm-hw-pci-Introduce-pci_device_get_host_iommu_quirks.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch343: kvm-hw-arm-smmuv3-common-Define-STE-CD-fields-via-regist.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch344: kvm-hw-arm-smmuv3-common-Add-NSCFG-bit-definition-for-CD.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch345: kvm-hw-arm-smmuv3-common-Add-STE-CD-set-helpers-for-repe.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch346: kvm-hw-arm-smmuv3-accel-Add-set-unset_iommu_device-callb.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch347: kvm-hw-arm-smmuv3-propagate-smmuv3_cmdq_consume-errors-t.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch348: kvm-hw-arm-smmuv3-accel-Add-nested-vSTE-install-uninstal.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch349: kvm-hw-arm-smmuv3-accel-Install-SMMUv3-GBPA-based-hwpt.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch350: kvm-hw-pci-pci-Introduce-a-callback-to-retrieve-the-MSI-.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch351: kvm-hw-arm-smmuv3-accel-Implement-get_msi_direct_gpa-cal.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch352: kvm-hw-arm-virt-Set-msi-gpa-property.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch353: kvm-hw-arm-smmuv3-accel-Add-support-to-issue-invalidatio.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch354: kvm-hw-arm-smmuv3-Initialize-ID-registers-early-during-r.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch355: kvm-hw-arm-smmuv3-accel-Get-host-SMMUv3-hw-info-and-vali.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch356: kvm-hw-pci-host-gpex-Allow-to-generate-preserve-boot-con.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch357: kvm-hw-arm-virt-Set-PCI-preserve_config-for-accel-SMMUv3.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch358: kvm-tests-qtest-bios-tables-test-Prepare-for-IORT-reviso.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch359: kvm-hw-arm-virt-acpi-build-Add-IORT-RMR-regions-to-handl.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch360: kvm-tests-qtest-bios-tables-test-Update-IORT-blobs-after.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch361: kvm-hw-arm-smmuv3-Block-migration-when-accel-is-enabled.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch362: kvm-hw-arm-smmuv3-Add-accel-property-for-SMMUv3-device.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch363: kvm-hw-arm-smmuv3-accel-Add-a-property-to-specify-RIL-su.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch364: kvm-hw-arm-smmuv3-accel-Add-support-for-ATS.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch365: kvm-hw-arm-smmuv3-accel-Add-property-to-specify-OAS-bits.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch366: kvm-backends-iommufd-Retrieve-PASID-width-from-iommufd_b.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch367: kvm-backends-iommufd-Add-get_pasid_info-callback.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch368: kvm-hw-pci-Add-helper-to-insert-PCIe-extended-capability.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch369: kvm-hw-pci-Factor-out-common-PASID-capability-initializa.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch370: kvm-hw-vfio-pci-Synthesize-PASID-capability-for-vfio-pci.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch371: kvm-hw-arm-smmuv3-accel-Make-SubstreamID-support-configu.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch372: kvm-system-memory-Factor-address_space_is_io-out.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch373: kvm-target-i386-arch_memory_mapping-Use-address_space_me.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch374: kvm-hw-s390x-sclp-Use-address_space_memory_is_io-in-sclp.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch375: kvm-system-physmem-Remove-cpu_physical_memory_is_io.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch376: kvm-backends-iommufd-Introduce-iommufd_backend_alloc_vev.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch377: kvm-hw-arm-smmuv3-accel-Add-viommu-free-helper.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch378: kvm-hw-arm-smmuv3-accel-Allocate-vEVENTQ-for-accelerated.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch379: kvm-hw-arm-smmuv3-Introduce-a-helper-function-for-event-.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch380: kvm-hw-arm-smmuv3-accel-Read-and-propagate-host-vIOMMU-e.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch381: kvm-hw-arm-smmuv3-Correct-SMMUEN-field-name-in-CR0.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch382: kvm-hw-arm-smmuv3-Fix-CFGI_CD-handling-when-stage-1-is-u.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch383: kvm-hw-arm-smmuv3-accel-Check-ATS-compatibility-between-.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch384: kvm-hw-arm-smmuv3-accel-Change-ats-property-type-to-OnOf.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch385: kvm-hw-arm-smmuv3-accel-Change-ril-property-type-to-OnOf.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch386: kvm-qdev-Add-a-SsidSizeMode-property-type.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch387: kvm-hw-arm-smmuv3-accel-Change-ssidsize-property-type-to.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch388: kvm-qdev-Add-an-OasMode-property-type.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch389: kvm-hw-arm-smmuv3-accel-Change-oas-property-type-to-OasM.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch390: kvm-qemu-options.hx-Document-arm-smmuv3-device-s-accel-p.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch391: kvm-hw-arm-smmuv3-Have-smmuv3_accel_init-take-an-Error-p.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch392: kvm-hw-arm-smmuv3-Update-ATC-invalidation-check.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch393: kvm-hw-arm-smmuv3-Improve-accel-SMMUv3-usage-documentati.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch394: kvm-hw-arm-smmuv3-accel-Add-helper-for-resolving-auto-pa.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch395: kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-ats.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch396: kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-ril.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch397: kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-ssidsiz.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch398: kvm-hw-arm-smmuv3-accel-Implement-auto-value-for-oas.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch399: kvm-hw-arm-smmuv3-Set-default-ats-ril-ssidsize-oas-to-au.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch400: kvm-qemu-options.hx-Support-auto-for-accel-SMMUv3-proper.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch401: kvm-hw-pci-pci-Enforce-pci_setup_iommu_per_bus-is-called.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch402: kvm-vfio-iommufd-Force-creating-nesting-parent-HWPT.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch403: kvm-hw-vfio-iommufd-Control-dirty-tracking-for-nesting-p.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch404: kvm-backends-iommufd-Update-iommufd_backend_get_device_i.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch405: kvm-iommufd-Rename-all-the-idev-and-idevc-variables-to-h.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch406: kvm-backends-iommufd-Update-iommufd_backend_alloc_viommu.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch407: kvm-backends-iommufd-Introduce-iommufd_backend_alloc_hw_.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch408: kvm-backends-iommufd-Introduce-iommufd_backend_viommu_mm.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch409: kvm-system-iommufd-Remove-unused-viommu-pointer-from-IOM.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch410: kvm-hw-arm-smmuv3-accel-Introduce-CMDQV-ops-interface.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch411: kvm-hw-arm-smmuv3-Avoid-including-CONFIG_DEVICES-in-hw-h.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch412: kvm-hw-arm-tegra241-cmdqv-Add-Tegra241-CMDQV-ops-backend.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch413: kvm-hw-arm-smmuv3-accel-Wire-CMDQV-ops-into-accel-lifecy.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch414: kvm-hw-arm-virt-Use-stored-SMMUv3-device-list-for-IORT-b.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch415: kvm-hw-arm-tegra241-cmdqv-Probe-host-Tegra241-CMDQV-supp.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch416: kvm-hw-arm-tegra241-cmdqv-Implement-CMDQV-init.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch417: kvm-hw-arm-virt-Link-SMMUv3-CMDQV-resources-to-platform-.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch418: kvm-hw-arm-tegra241-cmdqv-Implement-CMDQV-vIOMMU-alloc-f.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch419: kvm-hw-arm-tegra241-cmdqv-mmap-host-VINTF-Page0-for-CMDQ.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch420: kvm-hw-arm-tegra241-cmdqv-Emulate-CMDQ-V-Config-region.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch421: kvm-hw-arm-tegra241-cmdqv-Emulate-VCMDQ-register-reads.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch422: kvm-hw-arm-tegra241-cmdqv-Emulate-VCMDQ-register-writes.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch423: kvm-hw-arm-tegra241-cmdqv-Allocate-HW-VCMDQs-once-config.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch424: kvm-hw-arm-tegra241-cmdqv-Route-allocated-VCMDQ-Page0-ac.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch425: kvm-memory-Allow-RAM-device-regions-to-skip-IOMMU-mappin.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch426: kvm-hw-arm-tegra241-cmdqv-Use-mmap-d-host-VINTF-page0-fo.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch427: kvm-hw-arm-smmuv3-accel-Introduce-common-helper-for-veve.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch428: kvm-hw-arm-tegra241-cmdqv-Read-and-propagate-Tegra241-CM.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch429: kvm-hw-arm-tegra241-cmdqv-Initialize-register-state-on-r.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch430: kvm-hw-arm-tegra241-cmdqv-Limit-queue-size-based-on-back.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch431: kvm-hw-arm-smmuv3-Add-per-device-identifier-property.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch432: kvm-hw-arm-smmuv3-accel-Introduce-helper-to-query-CMDQV-.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch433: kvm-hw-arm-virt-acpi-Advertise-Tegra241-CMDQV-nodes-in-D.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch434: kvm-hw-arm-smmuv3-accel-Enforce-viommu-association-when-.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch435: kvm-hw-arm-tegra241-cmdqv-Document-the-CMDQV-design-and-.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch436: kvm-hw-arm-smmuv3-Add-cmdqv-property-for-SMMUv3-device.patch
-# For RHEL-142465 - [RHEL-10.1][ARM]: Two smmuv3 devices can be attached to the same bus
-# For RHEL-160190 - NVIDIA:Backport hw/arm/smmuv3-accel: Support AUTO properties - RHEL 10.3
-# For RHEL-163596 - NVIDIA:Backport hw/arm/smmuv3-accel: Resolve AUTO properties - RHEL 10.3
-# For RHEL-73794 - NVIDIA:Grace-Hopper:Backport HW accelerated nesting support for arm SMMUv3 - RHEL 10.1
-# For RHEL-73796 - NVIDIA:Grace-Hopper:Backport vEVENTQ support for smmuv3 - RHEL 10.1
-# For RHEL-73798 - NVIDIA:Grace-Hopper:Backport CMDQV support - RHEL 10.1
-Patch437: kvm-rh-aarch64-rh-devices.mak-Add-CONFIG_TEGRA241_CMDQV.patch
-# For RHEL-113894 - [RHEL.10.2][virual network] Hit qemu coredump when removed an interface that the guest is using from the host
-Patch438: kvm-net-tap-linux.c-avoid-abort-when-setting-invalid-fd.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch439: kvm-crypto-only-verify-CA-certs-in-chain-of-trust.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch440: kvm-crypto-remove-extraneous-pointer-usage-in-gnutls-cer.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch441: kvm-crypto-fix-error-reporting-in-cert-chain-checks.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch442: kvm-crypto-allow-client-server-cert-chains.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch443: kvm-crypto-stop-requiring-key-encipherment-usage-in-x509.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch444: kvm-crypto-switch-to-newer-gnutls-API-for-distinguished-.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch445: kvm-crypto-remove-redundant-parameter-checking-CA-certs.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch446: kvm-crypto-add-missing-free-of-certs-array.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch447: kvm-crypto-replace-stat-with-access-for-credential-check.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch448: kvm-crypto-remove-redundant-access-checks-before-loading.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch449: kvm-crypto-move-check-for-TLS-creds-dir-property.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch450: kvm-crypto-use-g_autofree-when-loading-x509-credentials.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch451: kvm-crypto-remove-needless-indirection-via-parent_obj-fi.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch452: kvm-crypto-move-release-of-DH-parameters-into-TLS-creds-.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch453: kvm-crypto-shorten-the-endpoint-server-check-in-TLS-cred.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch454: kvm-crypto-remove-duplication-loading-x509-CA-cert.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch455: kvm-crypto-reduce-duplication-in-handling-TLS-priority-s.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch456: kvm-crypto-introduce-method-for-reloading-TLS-creds.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch457: kvm-crypto-introduce-a-wrapper-around-gnutls-credentials.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch458: kvm-crypto-fix-lifecycle-handling-of-gnutls-credentials-.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch459: kvm-crypto-make-TLS-credentials-structs-private.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch460: kvm-crypto-deprecate-use-of-external-dh-params.pem-file.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch461: kvm-crypto-avoid-loading-the-CA-certs-twice.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch462: kvm-crypto-avoid-loading-the-identity-certs-twice.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch463: kvm-crypto-expand-logic-to-cope-with-multiple-certificat.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch464: kvm-crypto-support-upto-5-parallel-certificate-identitie.patch
-# For RHEL-111934 - QEMU support for loading multiple sets of x509 certs for PQC hybrid mode
-Patch465: kvm-docs-creation-of-x509-certs-compliant-with-post-quan.patch
-# For RHEL-184675 - NVIDIA:Backport vfio/pci: add vfio-pci ATS control property - RHEL 10.3
-Patch466: kvm-iommufd-Introduce-handler-for-device-ATS-support.patch
-# For RHEL-184675 - NVIDIA:Backport vfio/pci: add vfio-pci ATS control property - RHEL 10.3
-Patch467: kvm-vfio-pci-Add-ats-property.patch
-# For RHEL-180837 - [aarch64] Live migration of TPM-equipped guests fails: Unknown ramblock "tpm-ppi" (qemu-kvm-10.1.0-19.el10 → older builds)
-Patch468: kvm-hw-core-platform-bus-guard-platform_bus_get_mmio_add.patch
-# For RHEL-180837 - [aarch64] Live migration of TPM-equipped guests fails: Unknown ramblock "tpm-ppi" (qemu-kvm-10.1.0-19.el10 → older builds)
-Patch469: kvm-hw-tpm-gate-PPI-support-on-tpm-tis-device-behind-a-d.patch
-# For RHEL-180837 - [aarch64] Live migration of TPM-equipped guests fails: Unknown ramblock "tpm-ppi" (qemu-kvm-10.1.0-19.el10 → older builds)
-Patch470: kvm-hw-tpm-default-tpm-tis-device-PPI-to-disabled.patch
-# For RHEL-192791 - RHEL10.0 - qemu s390x: interface harding fixes
-Patch471: kvm-s390x-css-limit-number-of-CHPIDs-in-description.patch
-# For RHEL-192791 - RHEL10.0 - qemu s390x: interface harding fixes
-Patch472: kvm-s390x-ioinst-Require-strict-length-and-format-for-SE.patch
-# For RHEL-192791 - RHEL10.0 - qemu s390x: interface harding fixes
-Patch473: kvm-s390x-pci-Shrink-RPCIT-ranges-to-registered-window.patch
-# For RHEL-192791 - RHEL10.0 - qemu s390x: interface harding fixes
-Patch474: kvm-s390x-pci-Tighten-region-detection-for-BAR-read-writ.patch
-# For RHEL-192791 - RHEL10.0 - qemu s390x: interface harding fixes
-Patch475: kvm-s390x-sclp-reject-invalid-write-event-data-headers.patch
-# For RHEL-192791 - RHEL10.0 - qemu s390x: interface harding fixes
-Patch476: kvm-s390x-kvm-clamp-stsi-3.2.2-size.patch
-# For RHEL-192791 - RHEL10.0 - qemu s390x: interface harding fixes
-Patch477: kvm-s390x-sclp-prevent-re-reading-the-sclp-header.patch
-# For RHEL-192791 - RHEL10.0 - qemu s390x: interface harding fixes
-Patch478: kvm-s390x-sclpcpi-check-event-length-field-before-readin.patch
-# For RHEL-192791 - RHEL10.0 - qemu s390x: interface harding fixes
-Patch479: kvm-s390x-css-firm-up-handling-of-chained-TIC-CCWs.patch
-# For RHEL-224652 - Backport vfio/region: Clarify dma-buf failure messages
-Patch480: kvm-vfio-region-Clarify-dma-buf-failure-messages.patch
-# For RHEL-151317 - RHEL10 - KVM full Boot order support -- Guest is crashing for the invalid boot device(<boot order='1'/> -- add-on qcow2 file)
-Patch481: kvm-pc-bios-s390-ccw-Always-reset-virtio-device-on-faile.patch
-# For RHEL-246035 - [RHEL10.3] Exhausted DMA bounce buffer on building cuda-samples in VM
-Patch482: kvm-system-memory-Use-memmove-for-directly-accessible-re.patch
-# For RHEL-246035 - [RHEL10.3] Exhausted DMA bounce buffer on building cuda-samples in VM
-Patch483: kvm-system-memory-Use-qemu_ram_move-for-directly-accessi.patch
-# For RHEL-246035 - [RHEL10.3] Exhausted DMA bounce buffer on building cuda-samples in VM
-Patch484: kvm-system-memory-Make-ram-device-region-directly-access.patch
+Patch0017: 0017-Add-support-statement-to-help-output.patch
+Patch0018: 0018-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch
+Patch0019: 0019-qcow2-Deprecation-warning-when-opening-v2-images-rw.patch
+Patch0020: 0020-file-posix-Define-DM_MPATH_PROBE_PATHS.patch
+Patch0021: 0021-system-memory-Use-memmove-for-directly-accessible-re.patch
+Patch0022: 0022-system-memory-Use-qemu_ram_move-for-directly-accessi.patch
+Patch0023: 0023-system-memory-Make-ram-device-region-directly-access.patch
+Patch0024: 0024-qga-Change-effective-user-group-ID-in-guest-ssh-comm.patch
+Patch0026: 0026-Add-new-compat-handling.patch
+Patch0027: 0027-hw-arm-virt-allow-to-dynamically-apply-kvm-psci-vers.patch
+Patch0028: 0028-hw-arm-virt-ensure-machine-type-compatibility.patch
+Patch0029: 0029-Disable-new-devices.patch
+Patch0030: 0030-x86-chain-pc-q35-rhel9.8.0-into-the-RHEL-10-compat-l.patch
+Patch0031: 0031-x86-pin-x-migrate-error-code-false-on-pre-10.4-RHEL-.patch
+Patch0032: 0032-hw-arm-virt-add-new-machine-type-virt-rhel10.4.0.patch
+Patch0033: 0033-s390x-add-new-machine-type-s390-ccw-virtio-rhel10.4..patch
+Patch0034: 0034-q35-add-new-machine-type-pc-q35-rhel10.4.0.patch
%if %{have_clang}
BuildRequires: clang
@@ -1705,6 +221,7 @@ BuildRequires: libaio-devel
BuildRequires: libblkio-devel
BuildRequires: liburing-devel
BuildRequires: python3-devel
+BuildRequires: python3-setuptools
BuildRequires: libattr-devel
BuildRequires: libusbx-devel >= %{libusbx_version}
%if %{have_usbredir}
@@ -1764,6 +281,7 @@ BuildRequires: capstone-devel
%ifarch %{valgrind_arches}
BuildRequires: valgrind-devel
%endif
+BuildRequires: python3-wheel
# Requires for qemu-kvm package
Requires: %{name}-core = %{epoch}:%{version}-%{release}
@@ -2024,9 +542,6 @@ This package provides the additional D-Bus audio driver for QEMU.
%setup -q -n qemu-%{version}%{?rcstr}
%autopatch -p1
-# Handling binary changes for MR 505
-cp %{SOURCE40} %{SOURCE41} %{SOURCE42} %{SOURCE43} tests/data/acpi/aarch64/virt/
-
%global qemu_kvm_build qemu_kvm_build
mkdir -p %{qemu_kvm_build}
@@ -2074,7 +589,6 @@ ulimit -n 10240
--disable-gcrypt \\\
--disable-gettext \\\
--disable-gio \\\
- --disable-glusterfs \\\
--disable-gnutls \\\
--disable-gtk \\\
--disable-guest-agent \\\
@@ -2107,6 +621,7 @@ ulimit -n 10240
--disable-multiprocess \\\
--disable-netmap \\\
--disable-nettle \\\
+ --disable-nitro \\\
--disable-numa \\\
--disable-nvmm \\\
--disable-opengl \\\
@@ -2186,7 +701,7 @@ run_configure() {
--docdir="%{_docdir}" \
--libexecdir="%{_libexecdir}" \
--extra-ldflags="%{build_ldflags}" \
- --extra-cflags="%{optflags} -Wno-string-plus-int -Wno-incompatible-pointer-types-discards-qualifiers" \
+ --extra-cflags="%{optflags} -Wno-string-plus-int -Wno-incompatible-pointer-types-discards-qualifiers -Wno-unused-but-set-global" \
--with-pkgversion="%{name}-%{version}-%{release}" \
--with-suffix="%{name}" \
--firmwarepath=%{firmwaredirs} \
@@ -2487,6 +1002,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/qemu-nsis.bmp
rm -rf %{buildroot}%{_datadir}/%{name}/npcm7xx_bootrom.bin
rm -rf %{buildroot}%{_datadir}/%{name}/npcm8xx_bootrom.bin
rm -rf %{buildroot}%{_datadir}/%{name}/ast27x0_bootrom.bin
+rm -rf %{buildroot}%{_datadir}/%{name}/u-boot-sam460.bin
+
+rm -rf %{buildroot}%{_datadir}/%{name}/dtb/pegasos*.dtb
# Remove virtfs-proxy-helper files
rm -rf %{buildroot}%{_libexecdir}/virtfs-proxy-helper
@@ -2503,8 +1021,6 @@ rm -rf %{buildroot}%{_mandir}/man1/virtfs-proxy-helper*
%ifnarch x86_64
rm -rf %{buildroot}%{_datadir}/%{name}/kvmvapic.bin
- rm -rf %{buildroot}%{_datadir}/%{name}/linuxboot.bin
- rm -rf %{buildroot}%{_datadir}/%{name}/multiboot.bin
rm -rf %{buildroot}%{_datadir}/%{name}/multiboot_dma.bin
rm -rf %{buildroot}%{_datadir}/%{name}/pvh.bin
%else
@@ -2649,6 +1165,7 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%{_datadir}/%{name}/dump-guest-memory.py*
%{_datadir}/%{name}/trace-events-all
%{_mandir}/man1/qemu-trace-stap.1*
+%{_mandir}/man1/qemu-vnc.1*
%files -n qemu-pr-helper
%{_bindir}/qemu-pr-helper
@@ -2678,8 +1195,6 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%config(noreplace) %{_sysconfdir}/modprobe.d/kvm.conf
%ifarch x86_64
- %{_datadir}/%{name}/linuxboot.bin
- %{_datadir}/%{name}/multiboot.bin
%{_datadir}/%{name}/multiboot_dma.bin
%{_datadir}/%{name}/kvmvapic.bin
%{_datadir}/%{name}/pvh.bin
@@ -2728,7 +1243,7 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%files tests
%{testsdir}
-%{_libdir}/%{name}/accel-qtest-%{kvm_target}.so
+%{_libdir}/%{name}/accel-qtest.so
%files block-blkio
%{_libdir}/%{name}/block-blkio.so
@@ -2767,6 +1282,18 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%endif
%changelog
+* Thu Oct 08 2026 Miroslav Rezanina <mrezanin@redhat.com> - 11.1.0-1
+- Rebase to QEMU 11.1.0
+- Added rhel-10.4 machine types
+- Resolves: RHEL-253076
+ (Handle rebase to QEMU 11.1.0 for RHEL 10.4)
+- Resolves: RHEL-260114
+ (Add new -rhel10.4.0 machine type to qemu-kvm [x86_64])
+- Resolves: RHEL-260116
+ (Add new -rhel10.4.0 machine type to qemu-kvm [aarch64])
+- Resolves: RHEL-260115
+ (Add new -rhel10.4.0 machine type to qemu-kvm [s390x])
+
* Mon Aug 24 2026 Miroslav Rezanina <mrezanin@redhat.com> - 10.1.0-28
- kvm-system-memory-Use-memmove-for-directly-accessible-re.patch [RHEL-246035]
- kvm-system-memory-Use-qemu_ram_move-for-directly-accessi.patch [RHEL-246035]
@@ -2782,7 +1309,7 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
* Tue Aug 11 2026 Miroslav Rezanina <mrezanin@redhat.com> - 10.1.0-26
- kvm-vfio-region-Clarify-dma-buf-failure-messages.patch [RHEL-224652]
- Resolves: RHEL-224652
- (Backport vfio/region: Clarify dma-buf failure messages )
+ (Backport vfio/region: Clarify dma-buf failure messages)
* Mon Aug 03 2026 Miroslav Rezanina <mrezanin@redhat.com> - 10.1.0-25
- kvm-hw-core-platform-bus-guard-platform_bus_get_mmio_add.patch [RHEL-180837]
diff --git a/sources b/sources
index 5790dab..6c7d46d 100644
--- a/sources
+++ b/sources
@@ -1,5 +1 @@
-SHA512 (qemu-10.1.0.tar.xz) = 20552a524b6b298181df1af7084b470ded3fe8d1505f05011dda3c33cbc3d91f518ce026b44ba1a8b7f34c64ae81afddceda383066f4772a3a2a6333a2638caf
-SHA512 (IORT) = d07279b02ce160141428bbc256ffe89fa7260cf7fcd8d4111ea59a1ae4e9f7aa6a2a94b6094f4fb26c08ccee3ca8cad467e8bd138bf908207e73af78bfc7e564
-SHA512 (IORT.its_off) = d514bd995e380762c27593e6769a2bf92b0fdbc4a187a134f6f41e2f87a8824a7c6fa993362ab7ec846628dcc0ad5e18000f60f2f5a3e30f1ed1131474e71983
-SHA512 (IORT.smmuv3-dev) = 432480e3992e5e7a2c6258e0ef6fd094eae13e9e76f8cbe4ee93bd10944fb6c07ce94fa25f9704741c9e6ccf6d99a867008453cb0815bb9517680b662f7f1a5e
-SHA512 (IORT.smmuv3-legacy) = 39609d956ae643fe17a4a1a5a0eed11326874982a2646c7337e21e994c8ff6c1ce08bf27396b5db74430a420e6cc628005a75ee7697c3c2dc829882dbe107b95
+SHA512 (qemu-11.1.0.tar.xz) = 17009c49b1a4f35b150f98c7c3955cb44bf9c63593f124276b328da97568f600724b8f26759fbac88e96e814bda389491713e34b3aae53fa515277f5a868ea5a
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-15 7:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-15 7:30 [rpms/qemu] eln: * Thu Oct 08 2026 Miroslav Rezanina <mrezanin@redhat.com> - 11.1.0-1 Miroslav Rezanina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox