From e4745a1a9709a1560675b28ca8b0ada9e737ee3f Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Mon, 13 Jan 2025 04:55:59 -0500 Subject: [PATCH] * Mon Jan 13 2025 Miroslav Rezanina - 9.1.0-10 - kvm-qdev-Fix-set_pci_devfn-to-visit-option-only-once.patch [RHEL-43412] - kvm-tests-avocado-hotplug_blk-Fix-addr-in-device_add-com.patch [RHEL-43412] - kvm-qdev-monitor-avoid-QemuOpts-in-QMP-device_add.patch [RHEL-43412] - kvm-vl-use-qmp_device_add-in-qemu_create_cli_devices.patch [RHEL-43412] - kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch [RHEL-57668] - kvm-vhost-fail-device-start-if-iotlb-update-fails.patch [RHEL-73005] - kvm-virtio-net-disable-USO-for-all-RHEL9.patch [RHEL-69500] - Resolves: RHEL-43412 (qom-get iothread-vq-mapping is empty on new hotplug disk [rhel-10.0-beta]) - Resolves: RHEL-57668 ([RFE] [HPEMC] [RHEL-10.0] qemu-kvm: support up to 4096 VCPUs) - Resolves: RHEL-73005 (qemu-kvm: vhost: reports error while updating IOTLB entries) - Resolves: RHEL-69500 ([Stable_Guest_ABI][USO][9.6.0-machine-type]From 10.0 to RHEL.9.6.0 the guest with 9.6 machine type only, the guest crashed with - qemu-kvm: Features 0x1c0010130afffa7 unsupported. Allowed features: 0x10179bfffe7) --- kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch | 72 ++++++++++ ..._pci_devfn-to-visit-option-only-once.patch | 128 +++++++++++++++++ ...tor-avoid-QemuOpts-in-QMP-device_add.patch | 131 ++++++++++++++++++ ...tplug_blk-Fix-addr-in-device_add-com.patch | 51 +++++++ ...l-device-start-if-iotlb-update-fails.patch | 63 +++++++++ ...virtio-net-disable-USO-for-all-RHEL9.patch | 125 +++++++++++++++++ ...evice_add-in-qemu_create_cli_devices.patch | 65 +++++++++ qemu-kvm.spec | 33 ++++- 8 files changed, 667 insertions(+), 1 deletion(-) create mode 100644 kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch create mode 100644 kvm-qdev-Fix-set_pci_devfn-to-visit-option-only-once.patch create mode 100644 kvm-qdev-monitor-avoid-QemuOpts-in-QMP-device_add.patch create mode 100644 kvm-tests-avocado-hotplug_blk-Fix-addr-in-device_add-com.patch create mode 100644 kvm-vhost-fail-device-start-if-iotlb-update-fails.patch create mode 100644 kvm-virtio-net-disable-USO-for-all-RHEL9.patch create mode 100644 kvm-vl-use-qmp_device_add-in-qemu_create_cli_devices.patch diff --git a/kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch b/kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch new file mode 100644 index 0000000..2764ab4 --- /dev/null +++ b/kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch @@ -0,0 +1,72 @@ +From b270420c34cd990b1bcbe506c3fb0ef6f76d21a8 Mon Sep 17 00:00:00 2001 +From: Ani Sinha +Date: Wed, 8 Jan 2025 15:10:22 +0530 +Subject: [PATCH 5/7] pc: q35: Bump max_cpus to 4096 vcpus + +RH-Author: Ani Sinha +RH-MergeRequest: 317: pc: q35: Bump max_cpus to 4096 vcpus +RH-Jira: RHEL-57668 +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] 35242a1fa8fc21f7d73422d23074cd8da5f74781 (anisinha/centos-qemu-kvm) + +This is the downstream change equivalent of the upstream QEMU commit +e4e98c7e ("pc: q35: Bump max_cpus to 4096 vcpus") + +Since upstream Linux kernel commit +f10a570b093e6 ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") +Linux kernel can support upto a maximum number of 4096 vcpus when MAXSMP is +enabled in the kernel. This upstream change has been backported to c9s kernel +already. Please see JIRA https://issues.redhat.com/browse/RHEL-11579 and the +following commit authored by Vitaly Kuznetsov: +a85f846be686b0a ("KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs") + +At present, QEMU has been tested to correctly boot a linux guest with 4096 +vcpus using edk2 that has the fixes corresponding to the following two upstream +edk2 PRs: + +https://github.com/tianocore/edk2/pull/5410 +https://github.com/tianocore/edk2/pull/5418 + +The changes corresponding to the above two upstream edk2 PRs has been included +in the downstream c9s edk2 with the following MR: +https://gitlab.com/redhat/centos-stream/src/edk2/-/merge_requests/59 + +So bump up the value max_cpus to 4096 for RHEL q35 machines versions 9.6 and +newer. Q35 RHEL machines versions 9.4 and older continue to support 710 maximum +vcpus as before for compatibility reasons. + +See also +https://gitlab.com/redhat/centos-stream/src/qemu-kvm/-/merge_requests/236 +https://gitlab.com/redhat/centos-stream/src/qemu-kvm/-/merge_requests/273 + +Signed-off-by: Ani Sinha +--- + hw/i386/pc_q35.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c +index 37f54062c8..506f9dc0c0 100644 +--- a/hw/i386/pc_q35.c ++++ b/hw/i386/pc_q35.c +@@ -344,7 +344,7 @@ static void pc_q35_machine_options(MachineClass *m) + m->default_display = "std"; + m->default_nic = "e1000e"; + m->no_floppy = 1; +- m->max_cpus = 710; ++ m->max_cpus = 4096; + m->no_parallel = 1; + machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE); + machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE); +@@ -698,6 +698,9 @@ static void pc_q35_rhel_machine_9_4_0_options(MachineClass *m) + { + PCMachineClass *pcmc = PC_MACHINE_CLASS(m); + pc_q35_rhel_machine_9_6_0_options(m); ++ ++ /* older RHEL machines continue to support 710 vcpus */ ++ m->max_cpus = 710; + m->desc = "RHEL-9.4.0 PC (Q35 + ICH9, 2009)"; + pcmc->smbios_stream_product = "RHEL"; + pcmc->smbios_stream_version = "9.4.0"; +-- +2.39.3 + diff --git a/kvm-qdev-Fix-set_pci_devfn-to-visit-option-only-once.patch b/kvm-qdev-Fix-set_pci_devfn-to-visit-option-only-once.patch new file mode 100644 index 0000000..c58f4f5 --- /dev/null +++ b/kvm-qdev-Fix-set_pci_devfn-to-visit-option-only-once.patch @@ -0,0 +1,128 @@ +From 33607f8bd2e0d56e854131c4e70c770b88fa5441 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Tue, 19 Nov 2024 13:03:53 +0100 +Subject: [PATCH 1/7] qdev: Fix set_pci_devfn() to visit option only once + +RH-Author: Stefan Hajnoczi +RH-MergeRequest: 312: qdev-monitor: avoid QemuOpts in QMP device_add +RH-Jira: RHEL-43412 +RH-Acked-by: Kevin Wolf +RH-Acked-by: Hanna Czenczek +RH-Commit: [1/4] 4d9ce49f16904d34d4f751f1dec3a53abfe8c8a8 (stefanha/centos-stream-qemu-kvm) + +pci_devfn properties accept either a string or an integer as input. To +implement this, set_pci_devfn() first tries to visit the option as a +string, and if that fails, it visits it as an integer instead. While the +QemuOpts visitor happens to accept this, it is invalid according to the +visitor interface. QObject input visitors run into an assertion failure +when this is done. + +QObject input visitors are used with the JSON syntax version of -device +on the command line: + +$ ./qemu-system-x86_64 -enable-kvm -M q35 -device pcie-pci-bridge,id=pci.1,bus=pcie.0 -blockdev null-co,node-name=disk -device '{ "driver": "virtio-blk-pci", "drive": "disk", "id": "virtio-disk0", "bus": "pci.1", "addr": 1 }' +qemu-system-x86_64: ../qapi/qobject-input-visitor.c:143: QObject *qobject_input_try_get_object(QObjectInputVisitor *, const char *, _Bool): Assertion `removed' failed. + +The proper way to accept both strings and integers is using the +alternate mechanism, which tells us the type of the input before it's +visited. With this information, we can directly visit it as the right +type. + +This fixes set_pci_devfn() by using the alternate mechanism. + +Cc: qemu-stable@nongnu.org +Reported-by: Peter Maydell +Signed-off-by: Kevin Wolf +Message-ID: <20241119120353.57812-1-kwolf@redhat.com> +Acked-by: Paolo Bonzini +Reviewed-by: Markus Armbruster +Signed-off-by: Kevin Wolf +(cherry picked from commit 5102f9df4a9a7adfbd902f9515c3f8f53dba288e) +Signed-off-by: Stefan Hajnoczi +--- + hw/core/qdev-properties-system.c | 54 +++++++++++++++++++++----------- + 1 file changed, 36 insertions(+), 18 deletions(-) + +diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c +index 5cd527cdba..b182dc293a 100644 +--- a/hw/core/qdev-properties-system.c ++++ b/hw/core/qdev-properties-system.c +@@ -820,39 +820,57 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) + { + Property *prop = opaque; ++ g_autofree GenericAlternate *alt; + int32_t value, *ptr = object_field_prop_ptr(obj, prop); + unsigned int slot, fn, n; +- char *str; ++ g_autofree char *str = NULL; ++ ++ if (!visit_start_alternate(v, name, &alt, sizeof(*alt), errp)) { ++ return; ++ } ++ ++ switch (alt->type) { ++ case QTYPE_QSTRING: ++ if (!visit_type_str(v, name, &str, errp)) { ++ goto out; ++ } + +- if (!visit_type_str(v, name, &str, NULL)) { ++ if (sscanf(str, "%x.%x%n", &slot, &fn, &n) != 2) { ++ fn = 0; ++ if (sscanf(str, "%x%n", &slot, &n) != 1) { ++ goto invalid; ++ } ++ } ++ if (str[n] != '\0' || fn > 7 || slot > 31) { ++ goto invalid; ++ } ++ *ptr = slot << 3 | fn; ++ break; ++ ++ case QTYPE_QNUM: + if (!visit_type_int32(v, name, &value, errp)) { +- return; ++ goto out; + } + if (value < -1 || value > 255) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + name ? name : "null", "a value between -1 and 255"); +- return; ++ goto out; + } + *ptr = value; +- return; +- } ++ break; + +- if (sscanf(str, "%x.%x%n", &slot, &fn, &n) != 2) { +- fn = 0; +- if (sscanf(str, "%x%n", &slot, &n) != 1) { +- goto invalid; +- } +- } +- if (str[n] != '\0' || fn > 7 || slot > 31) { +- goto invalid; ++ default: ++ error_setg(errp, "Invalid parameter type for '%s', expected int or str", ++ name ? name : "null"); ++ goto out; + } +- *ptr = slot << 3 | fn; +- g_free(str); +- return; ++ ++ goto out; + + invalid: + error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str); +- g_free(str); ++out: ++ visit_end_alternate(v, (void **) &alt); + } + + static int print_pci_devfn(Object *obj, Property *prop, char *dest, +-- +2.39.3 + diff --git a/kvm-qdev-monitor-avoid-QemuOpts-in-QMP-device_add.patch b/kvm-qdev-monitor-avoid-QemuOpts-in-QMP-device_add.patch new file mode 100644 index 0000000..9de3875 --- /dev/null +++ b/kvm-qdev-monitor-avoid-QemuOpts-in-QMP-device_add.patch @@ -0,0 +1,131 @@ +From de4f7c3b6dbba3eb8450cd7714ae93787009cd17 Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 27 Aug 2024 15:27:50 -0400 +Subject: [PATCH 3/7] qdev-monitor: avoid QemuOpts in QMP device_add +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Stefan Hajnoczi +RH-MergeRequest: 312: qdev-monitor: avoid QemuOpts in QMP device_add +RH-Jira: RHEL-43412 +RH-Acked-by: Kevin Wolf +RH-Acked-by: Hanna Czenczek +RH-Commit: [3/4] 7c45f3791491cd66ec2476ef0aa515b5bffba456 (stefanha/centos-stream-qemu-kvm) + +The QMP device_add monitor command converts the QDict arguments to +QemuOpts and then back again to QDict. This process only supports scalar +types. Device properties like virtio-blk-pci's iothread-vq-mapping (an +array of objects) are silently dropped by qemu_opts_from_qdict() during +the QemuOpts conversion even though QAPI is capable of validating them. +As a result, hotplugging virtio-blk-pci devices with the +iothread-vq-mapping property does not work as expected (the property is +ignored). + +Get rid of the QemuOpts conversion in qmp_device_add() and call +qdev_device_add_from_qdict() with from_json=true. Using the QMP +command's QDict arguments directly allows non-scalar properties. + +The HMP is also adjusted since qmp_device_add()'s now expects properly +typed JSON arguments and cannot be used from HMP anymore. Move the code +that was previously in qmp_device_add() (with QemuOpts conversion and +from_json=false) into hmp_device_add() so that its behavior is +unchanged. + +This patch changes the behavior of QMP device_add but not HMP +device_add. QMP clients that sent incorrectly typed device_add QMP +commands no longer work. This is a breaking change but clients should be +using the correct types already. See the netdev_add QAPIfication in +commit db2a380c8457 for similar reasoning and object-add in commit +9151e59a8b6e. Unlike those commits, we continue to rely on 'gen': false +for the time being. + +Markus helped me figure this out and even provided a draft patch. The +code ended up very close to what he suggested. + +Suggested-by: Markus Armbruster +Cc: Daniel P. Berrangé +Signed-off-by: Stefan Hajnoczi +Message-ID: <20240827192751.948633-2-stefanha@redhat.com> +Reviewed-by: Daniel P. Berrangé +Reviewed-by: Kevin Wolf +Signed-off-by: Kevin Wolf +(cherry picked from commit be93fd53723cbdca675bd9ed112dae5cabbe1e91) +Signed-off-by: Stefan Hajnoczi +--- + system/qdev-monitor.c | 42 ++++++++++++++++++++++++++++-------------- + 1 file changed, 28 insertions(+), 14 deletions(-) + +diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c +index 6af6ef7d66..8b27cc42b0 100644 +--- a/system/qdev-monitor.c ++++ b/system/qdev-monitor.c +@@ -849,18 +849,9 @@ void hmp_info_qdm(Monitor *mon, const QDict *qdict) + + void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp) + { +- QemuOpts *opts; + DeviceState *dev; + +- opts = qemu_opts_from_qdict(qemu_find_opts("device"), qdict, errp); +- if (!opts) { +- return; +- } +- if (!monitor_cur_is_qmp() && qdev_device_help(opts)) { +- qemu_opts_del(opts); +- return; +- } +- dev = qdev_device_add(opts, errp); ++ dev = qdev_device_add_from_qdict(qdict, true, errp); + if (!dev) { + /* + * Drain all pending RCU callbacks. This is done because +@@ -872,9 +863,6 @@ void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp) + * to the user + */ + drain_call_rcu(); +- +- qemu_opts_del(opts); +- return; + } + object_unref(OBJECT(dev)); + } +@@ -967,8 +955,34 @@ void qmp_device_del(const char *id, Error **errp) + void hmp_device_add(Monitor *mon, const QDict *qdict) + { + Error *err = NULL; ++ QemuOpts *opts; ++ DeviceState *dev; + +- qmp_device_add((QDict *)qdict, NULL, &err); ++ opts = qemu_opts_from_qdict(qemu_find_opts("device"), qdict, &err); ++ if (!opts) { ++ goto out; ++ } ++ if (qdev_device_help(opts)) { ++ qemu_opts_del(opts); ++ return; ++ } ++ dev = qdev_device_add(opts, &err); ++ if (!dev) { ++ /* ++ * Drain all pending RCU callbacks. This is done because ++ * some bus related operations can delay a device removal ++ * (in this case this can happen if device is added and then ++ * removed due to a configuration error) ++ * to a RCU callback, but user might expect that this interface ++ * will finish its job completely once qmp command returns result ++ * to the user ++ */ ++ drain_call_rcu(); ++ ++ qemu_opts_del(opts); ++ } ++ object_unref(dev); ++out: + hmp_handle_error(mon, err); + } + +-- +2.39.3 + diff --git a/kvm-tests-avocado-hotplug_blk-Fix-addr-in-device_add-com.patch b/kvm-tests-avocado-hotplug_blk-Fix-addr-in-device_add-com.patch new file mode 100644 index 0000000..93fe1e0 --- /dev/null +++ b/kvm-tests-avocado-hotplug_blk-Fix-addr-in-device_add-com.patch @@ -0,0 +1,51 @@ +From 693f65e183cc578eed213b1ea5dc11e9c2697f15 Mon Sep 17 00:00:00 2001 +From: Kevin Wolf +Date: Fri, 22 Nov 2024 23:40:42 +0100 +Subject: [PATCH 2/7] tests/avocado/hotplug_blk: Fix addr in device_add command + +RH-Author: Stefan Hajnoczi +RH-MergeRequest: 312: qdev-monitor: avoid QemuOpts in QMP device_add +RH-Jira: RHEL-43412 +RH-Acked-by: Kevin Wolf +RH-Acked-by: Hanna Czenczek +RH-Commit: [2/4] 7e2d360d3bb8e606d868c17d6032f9fb8ee15814 (stefanha/centos-stream-qemu-kvm) + +pci_devfn properties accept both integer and string values, but +integer 1 and string '1' have different meanings: The integer value +means device 0, function 1 whereas the string value '1' is short for +'1.0' and means device 1, function 0. + +This test wants the string version so that the device actually becomes +visible for the guest. device_add hides the problem because it goes +through QemuOpts, which turns all properties into strings - this is a +QEMU bug that we want to fix, but that cancelled out the bug in this +test. + +Fix the test first so that device_add can be fixed afterwards. + +Signed-off-by: Kevin Wolf +Message-ID: <20241122224042.149258-1-kwolf@redhat.com> +Reviewed-by: Markus Armbruster +Signed-off-by: Kevin Wolf +(cherry picked from commit 770de685353e8c495ad4773fbd4bc0db997e4dfd) +Signed-off-by: Stefan Hajnoczi +--- + tests/avocado/hotplug_blk.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/avocado/hotplug_blk.py b/tests/avocado/hotplug_blk.py +index d55ded1c1d..b36bca02ec 100644 +--- a/tests/avocado/hotplug_blk.py ++++ b/tests/avocado/hotplug_blk.py +@@ -33,7 +33,7 @@ def plug(self) -> None: + 'drive': 'disk', + 'id': 'virtio-disk0', + 'bus': 'pci.1', +- 'addr': 1 ++ 'addr': '1', + } + + self.assert_no_vda() +-- +2.39.3 + diff --git a/kvm-vhost-fail-device-start-if-iotlb-update-fails.patch b/kvm-vhost-fail-device-start-if-iotlb-update-fails.patch new file mode 100644 index 0000000..854bb04 --- /dev/null +++ b/kvm-vhost-fail-device-start-if-iotlb-update-fails.patch @@ -0,0 +1,63 @@ +From 2b12ea393b9a5d8392cb510406626f4c99c9f4c5 Mon Sep 17 00:00:00 2001 +From: Prasad Pandit +Date: Thu, 7 Nov 2024 17:02:47 +0530 +Subject: [PATCH 6/7] vhost: fail device start if iotlb update fails + +RH-Author: Prasad Pandit +RH-MergeRequest: 318: vhost: fail device start if iotlb update fails +RH-Jira: RHEL-73005 +RH-Acked-by: Stefano Garzarella +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] f185f02378ebbf36a38aef0ea608b70c637a4816 (pjp/cs-qemu-kvm) + +While starting a vhost device, updating iotlb entries +via 'vhost_device_iotlb_miss' may return an error. + + qemu-kvm: vhost_device_iotlb_miss: + 700871,700871: Fail to update device iotlb + +Fail device start when such an error occurs. + +Jira: https://issues.redhat.com/browse/RHEL-73005 +Signed-off-by: Prasad Pandit +Message-Id: <20241107113247.46532-1-ppandit@redhat.com> +Reviewed-by: Michael S. Tsirkin +Signed-off-by: Michael S. Tsirkin +Reviewed-by: Stefano Garzarella +(cherry picked from commit 571bdc97b83646dfd3746ec56fb2f70bca55b9a2) +Signed-off-by: Prasad Pandit +--- + hw/virtio/vhost.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c +index 06fc71746e..e25fdce3dd 100644 +--- a/hw/virtio/vhost.c ++++ b/hw/virtio/vhost.c +@@ -2151,11 +2151,22 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings) + * vhost-kernel code requires for this.*/ + for (i = 0; i < hdev->nvqs; ++i) { + struct vhost_virtqueue *vq = hdev->vqs + i; +- vhost_device_iotlb_miss(hdev, vq->used_phys, true); ++ r = vhost_device_iotlb_miss(hdev, vq->used_phys, true); ++ if (r) { ++ goto fail_iotlb; ++ } + } + } + vhost_start_config_intr(hdev); + return 0; ++fail_iotlb: ++ if (vhost_dev_has_iommu(hdev) && ++ hdev->vhost_ops->vhost_set_iotlb_callback) { ++ hdev->vhost_ops->vhost_set_iotlb_callback(hdev, false); ++ } ++ if (hdev->vhost_ops->vhost_dev_start) { ++ hdev->vhost_ops->vhost_dev_start(hdev, false); ++ } + fail_start: + if (vrings) { + vhost_dev_set_vring_enable(hdev, false); +-- +2.39.3 + diff --git a/kvm-virtio-net-disable-USO-for-all-RHEL9.patch b/kvm-virtio-net-disable-USO-for-all-RHEL9.patch new file mode 100644 index 0000000..07fb75e --- /dev/null +++ b/kvm-virtio-net-disable-USO-for-all-RHEL9.patch @@ -0,0 +1,125 @@ +From 76376a85ff5cbe555db6a6d729fcb83f56988f25 Mon Sep 17 00:00:00 2001 +From: "Michael S. Tsirkin" +Date: Wed, 6 Nov 2024 17:29:35 -0500 +Subject: [PATCH 7/7] virtio-net: disable USO for all RHEL9 + +RH-Author: MST +RH-MergeRequest: 319: virtio-net migration: ensure compatibility of rhel9* +RH-Jira: RHEL-69500 +RH-Acked-by: Peter Xu +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] c7518d8293e1cfdd928f0ce454249ecb7bd7117a (mstredhat/qemu-kvm-centos) + +With commit 298dae99b77f ("virtio-net: disable USO for RHEL9") +we fixed migration for 9.6 but we forgot to apply the fix +for 9.6 when it was created. + +To help us not forget in 9.7 and beyond, create a generic RHEL9 compat +and apply it. + +Upstream status: n/a: upstream has no guarantee if kernel features change +Tested: lightly on developer's machine. +JIRA: https://issues.redhat.com/browse/RHEL-69500 +Signed-off-by: Michael S. Tsirkin + +Patch-name: kvm-virtio-net-disable-USO-for-RHEL9.patch +Patch-id: 83 +Patch-present-in-specfile: True +--- + hw/arm/virt.c | 3 +++ + hw/core/machine.c | 13 ++++++++----- + hw/i386/pc_q35.c | 3 +++ + hw/s390x/s390-virtio-ccw.c | 3 +++ + include/hw/boards.h | 3 +++ + 5 files changed, 20 insertions(+), 5 deletions(-) + +diff --git a/hw/arm/virt.c b/hw/arm/virt.c +index 078098ec3a..6d55bba241 100644 +--- a/hw/arm/virt.c ++++ b/hw/arm/virt.c +@@ -3595,6 +3595,9 @@ DEFINE_VIRT_MACHINE_AS_LATEST(10, 0, 0) + static void virt_rhel_machine_9_6_0_options(MachineClass *mc) + { + virt_rhel_machine_10_0_0_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_VIRT_MACHINE(9, 6, 0) + +diff --git a/hw/core/machine.c b/hw/core/machine.c +index 04d180eac4..1ee0e1dee8 100644 +--- a/hw/core/machine.c ++++ b/hw/core/machine.c +@@ -327,6 +327,14 @@ GlobalProperty hw_compat_rhel_10_0[] = { + }; + const size_t hw_compat_rhel_10_0_len = G_N_ELEMENTS(hw_compat_rhel_10_0); + ++/* Apply this to all RHEL9 boards going backward and forward */ ++GlobalProperty hw_compat_rhel_9[] = { ++ /* supported by userspace, but RHEL 9 *kernels* do not support USO. */ ++ { TYPE_VIRTIO_NET, "host_uso", "off"}, ++ { TYPE_VIRTIO_NET, "guest_uso4", "off"}, ++ { TYPE_VIRTIO_NET, "guest_uso6", "off"}, ++}; ++const size_t hw_compat_rhel_9_len = G_N_ELEMENTS(hw_compat_rhel_9); + + GlobalProperty hw_compat_rhel_9_5[] = { + /* hw_compat_rhel_9_5 from hw_compat_8_2 */ +@@ -337,11 +345,6 @@ GlobalProperty hw_compat_rhel_9_5[] = { + { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "64" }, + /* hw_compat_rhel_9_5 from hw_compat_8_2 */ + { "virtio-gpu-device", "x-scanout-vmstate-version", "1" }, +- /* supported by userspace, but RHEL 9 *kernels* do not support USO. */ +- /* TODO: if we ever add 9.6 compat, this has to be there, too */ +- { TYPE_VIRTIO_NET, "host_uso", "off"}, +- { TYPE_VIRTIO_NET, "guest_uso4", "off"}, +- { TYPE_VIRTIO_NET, "guest_uso6", "off"}, + }; + const size_t hw_compat_rhel_9_5_len = G_N_ELEMENTS(hw_compat_rhel_9_5); + +diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c +index 506f9dc0c0..b2b8124225 100644 +--- a/hw/i386/pc_q35.c ++++ b/hw/i386/pc_q35.c +@@ -690,6 +690,9 @@ static void pc_q35_rhel_machine_9_6_0_options(MachineClass *m) + m->alias = NULL; + 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_BUGFIX(9, 6, 0); +diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c +index 0347dc69ca..2e276ad72b 100644 +--- a/hw/s390x/s390-virtio-ccw.c ++++ b/hw/s390x/s390-virtio-ccw.c +@@ -1305,6 +1305,9 @@ static void ccw_rhel_machine_9_6_0_instance_options(MachineState *machine) + static void ccw_rhel_machine_9_6_0_class_options(MachineClass *mc) + { + 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/boards.h b/include/hw/boards.h +index ac917b87fb..83d11de42f 100644 +--- a/include/hw/boards.h ++++ b/include/hw/boards.h +@@ -805,6 +805,9 @@ extern const size_t hw_compat_2_1_len; + extern GlobalProperty hw_compat_rhel_10_0[]; + extern const size_t hw_compat_rhel_10_0_len; + ++extern GlobalProperty hw_compat_rhel_9[]; ++extern const size_t hw_compat_rhel_9_len; ++ + extern GlobalProperty hw_compat_rhel_9_5[]; + extern const size_t hw_compat_rhel_9_5_len; + +-- +2.39.3 + diff --git a/kvm-vl-use-qmp_device_add-in-qemu_create_cli_devices.patch b/kvm-vl-use-qmp_device_add-in-qemu_create_cli_devices.patch new file mode 100644 index 0000000..987eed8 --- /dev/null +++ b/kvm-vl-use-qmp_device_add-in-qemu_create_cli_devices.patch @@ -0,0 +1,65 @@ +From 59fe7329e9f1660a3b26e5147de2df348b1bbaed Mon Sep 17 00:00:00 2001 +From: Stefan Hajnoczi +Date: Tue, 27 Aug 2024 15:27:51 -0400 +Subject: [PATCH 4/7] vl: use qmp_device_add() in qemu_create_cli_devices() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Stefan Hajnoczi +RH-MergeRequest: 312: qdev-monitor: avoid QemuOpts in QMP device_add +RH-Jira: RHEL-43412 +RH-Acked-by: Kevin Wolf +RH-Acked-by: Hanna Czenczek +RH-Commit: [4/4] b581207df4723f8a278452c92cb1b71a207aabe8 (stefanha/centos-stream-qemu-kvm) + +qemu_create_cli_devices() should use qmp_device_add() to match the +behavior of the QMP monitor. A comment explained that libvirt changes +implementing strict CLI syntax were needed. + +Peter Krempa has confirmed that modern libvirt uses +the same JSON for -device (CLI) and device_add (QMP). Go ahead and use +qmp_device_add(). + +Cc: Peter Krempa +Reviewed-by: Markus Armbruster +Signed-off-by: Stefan Hajnoczi +Message-ID: <20240827192751.948633-3-stefanha@redhat.com> +Reviewed-by: Daniel P. Berrangé +Reviewed-by: Kevin Wolf +Signed-off-by: Kevin Wolf +(cherry picked from commit 11bf1d6aa06138e93b274e942d6992af63ffc510) +Signed-off-by: Stefan Hajnoczi +--- + system/vl.c | 14 ++++---------- + 1 file changed, 4 insertions(+), 10 deletions(-) + +diff --git a/system/vl.c b/system/vl.c +index 5359231bf5..900d471f5e 100644 +--- a/system/vl.c ++++ b/system/vl.c +@@ -2661,17 +2661,11 @@ static void qemu_create_cli_devices(void) + qemu_opts_foreach(qemu_find_opts("device"), + device_init_func, NULL, &error_fatal); + QTAILQ_FOREACH(opt, &device_opts, next) { +- DeviceState *dev; ++ QObject *ret_data = NULL; ++ + loc_push_restore(&opt->loc); +- /* +- * TODO Eventually we should call qmp_device_add() here to make sure it +- * behaves the same, but QMP still has to accept incorrectly typed +- * options until libvirt is fixed and we want to be strict on the CLI +- * from the start, so call qdev_device_add_from_qdict() directly for +- * now. +- */ +- dev = qdev_device_add_from_qdict(opt->opts, true, &error_fatal); +- object_unref(OBJECT(dev)); ++ qmp_device_add(opt->opts, &ret_data, &error_fatal); ++ assert(ret_data == NULL); /* error_fatal aborts */ + loc_pop(&opt->loc); + } + rom_reset_order_override(); +-- +2.39.3 + diff --git a/qemu-kvm.spec b/qemu-kvm.spec index 441a247..accbade 100644 --- a/qemu-kvm.spec +++ b/qemu-kvm.spec @@ -143,7 +143,7 @@ Obsoletes: %{name}-block-ssh <= %{epoch}:%{version} \ Summary: QEMU is a machine emulator and virtualizer Name: qemu-kvm Version: 9.1.0 -Release: 9%{?rcrel}%{?dist}%{?cc_suffix} +Release: 10%{?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) @@ -396,6 +396,20 @@ Patch109: kvm-s390x-cpumodel-gen17-model.patch Patch110: kvm-qga-skip-bind-mounts-in-fs-list.patch # For RHEL-67108 - [aarch64] [rhel-10.0] Backport some important post 9.1 qemu fixes Patch111: kvm-hw-char-pl011-Use-correct-masks-for-IBRD-and-FBRD.patch +# For RHEL-43412 - qom-get iothread-vq-mapping is empty on new hotplug disk [rhel-10.0-beta] +Patch112: kvm-qdev-Fix-set_pci_devfn-to-visit-option-only-once.patch +# For RHEL-43412 - qom-get iothread-vq-mapping is empty on new hotplug disk [rhel-10.0-beta] +Patch113: kvm-tests-avocado-hotplug_blk-Fix-addr-in-device_add-com.patch +# For RHEL-43412 - qom-get iothread-vq-mapping is empty on new hotplug disk [rhel-10.0-beta] +Patch114: kvm-qdev-monitor-avoid-QemuOpts-in-QMP-device_add.patch +# For RHEL-43412 - qom-get iothread-vq-mapping is empty on new hotplug disk [rhel-10.0-beta] +Patch115: kvm-vl-use-qmp_device_add-in-qemu_create_cli_devices.patch +# For RHEL-57668 - [RFE] [HPEMC] [RHEL-10.0] qemu-kvm: support up to 4096 VCPUs +Patch116: kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch +# For RHEL-73005 - qemu-kvm: vhost: reports error while updating IOTLB entries +Patch117: kvm-vhost-fail-device-start-if-iotlb-update-fails.patch +# For RHEL-69500 - [Stable_Guest_ABI][USO][9.6.0-machine-type]From 10.0 to RHEL.9.6.0 the guest with 9.6 machine type only, the guest crashed with - qemu-kvm: Features 0x1c0010130afffa7 unsupported. Allowed features: 0x10179bfffe7 +Patch118: kvm-virtio-net-disable-USO-for-all-RHEL9.patch %if %{have_clang} BuildRequires: clang @@ -1462,6 +1476,23 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %endif %changelog +* Mon Jan 13 2025 Miroslav Rezanina - 9.1.0-10 +- kvm-qdev-Fix-set_pci_devfn-to-visit-option-only-once.patch [RHEL-43412] +- kvm-tests-avocado-hotplug_blk-Fix-addr-in-device_add-com.patch [RHEL-43412] +- kvm-qdev-monitor-avoid-QemuOpts-in-QMP-device_add.patch [RHEL-43412] +- kvm-vl-use-qmp_device_add-in-qemu_create_cli_devices.patch [RHEL-43412] +- kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch [RHEL-57668] +- kvm-vhost-fail-device-start-if-iotlb-update-fails.patch [RHEL-73005] +- kvm-virtio-net-disable-USO-for-all-RHEL9.patch [RHEL-69500] +- Resolves: RHEL-43412 + (qom-get iothread-vq-mapping is empty on new hotplug disk [rhel-10.0-beta]) +- Resolves: RHEL-57668 + ([RFE] [HPEMC] [RHEL-10.0] qemu-kvm: support up to 4096 VCPUs) +- Resolves: RHEL-73005 + (qemu-kvm: vhost: reports error while updating IOTLB entries) +- Resolves: RHEL-69500 + ([Stable_Guest_ABI][USO][9.6.0-machine-type]From 10.0 to RHEL.9.6.0 the guest with 9.6 machine type only, the guest crashed with - qemu-kvm: Features 0x1c0010130afffa7 unsupported. Allowed features: 0x10179bfffe7) + * Mon Jan 06 2025 Miroslav Rezanina - 9.1.0-9 - kvm-linux-headers-Update-to-Linux-v6.12-rc5.patch [RHEL-32665] - kvm-s390x-cpumodel-add-msa10-subfunctions.patch [RHEL-32665]