From 71aed0d95c56c4e302e7767eaca0960e98900695 Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Thu, 5 Dec 2024 00:54:47 -0500 Subject: [PATCH] * Thu Dec 05 2024 Miroslav Rezanina - 9.1.0-6 - kvm-virtio-net-Add-queues-before-loading-them.patch [RHEL-69477] - kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch [RHEL-68440] - kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch [RHEL-68440] - kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch [RHEL-68440] - kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch [RHEL-68440] - kvm-scsi-fix-allocation-for-s390x-loadparm.patch [RHEL-68440] - kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch [RHEL-68440] - kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch [RHEL-68440] - kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch [RHEL-68440] - kvm-vnc-fix-crash-when-no-console-attached.patch [RHEL-61633] - Resolves: RHEL-69477 (qemu crashed when migrate vm with multiqueue from rhel9.4 to rhel9.6) - Resolves: RHEL-68440 (The new "boot order" feature is sometimes not working as expected [RHEL 9]) - Resolves: RHEL-61633 (Qemu-kvm crashed if no display device setting and switching display by remote-viewer [rhel-9]) --- ...index-Make-it-clear-that-s390x-can-a.patch | 45 ++++ ...x-bootdevices-Update-loadparm-docume.patch | 65 ++++++ ...property-to-scsi-disk-devices-for-bo.patch | 221 ++++++++++++++++++ ...t-loadparm-property-to-devices-that-.patch | 113 +++++++++ ...-Re-initialize-receive-queue-index-b.patch | 45 ++++ ...itialize-cdrom-type-to-false-for-eac.patch | 43 ++++ ...itialize-machine-loadparm-before-pro.patch | 55 +++++ ...si-fix-allocation-for-s390x-loadparm.patch | 48 ++++ ...o-net-Add-queues-before-loading-them.patch | 94 ++++++++ ...c-fix-crash-when-no-console-attached.patch | 61 +++++ qemu-kvm.spec | 40 +++- 11 files changed, 829 insertions(+), 1 deletion(-) create mode 100644 kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch create mode 100644 kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch create mode 100644 kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch create mode 100644 kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch create mode 100644 kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch create mode 100644 kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch create mode 100644 kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch create mode 100644 kvm-scsi-fix-allocation-for-s390x-loadparm.patch create mode 100644 kvm-virtio-net-Add-queues-before-loading-them.patch create mode 100644 kvm-vnc-fix-crash-when-no-console-attached.patch diff --git a/kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch b/kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch new file mode 100644 index 0000000..0956149 --- /dev/null +++ b/kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch @@ -0,0 +1,45 @@ +From 5a0451f82a143dbaa0f75543a75c8e4560ac477f Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Mon, 11 Nov 2024 11:55:06 +0100 +Subject: [PATCH 03/10] docs/system/bootindex: Make it clear that s390x can + also boot from virtio-net +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [2/8] 2921f4532ad7b0891dea251a4d768776170c6271 (thuth/qemu-kvm-cs9) + +Let's make it clear that s390x can also boot from virtio-net, to avoid +that people think that s390x can only boot from disk devices. + +Reported-by: Boris Fiuczynski +Message-ID: <20241111105506.264640-1-thuth@redhat.com> +Reviewed-by: Prasad Pandit +Reviewed-by: Boris Fiuczynski +Signed-off-by: Thomas Huth +(cherry picked from commit b8c5fdc6588f82d95807be0eb2215d215a3ba16e) +--- + docs/system/bootindex.rst | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/docs/system/bootindex.rst b/docs/system/bootindex.rst +index 988f7b3beb..5e1b33ee22 100644 +--- a/docs/system/bootindex.rst ++++ b/docs/system/bootindex.rst +@@ -53,7 +53,7 @@ booting. For instance, the x86 PC BIOS boot specification allows only one + disk to be bootable. If boot from disk fails for some reason, the x86 BIOS + won't retry booting from other disk. It can still try to boot from + floppy or net, though. In the case of s390x BIOS, the BIOS will try up to +-8 total devices, any number of which may be disks. ++8 total devices, any number of which may be disks or virtio-net devices. + + Sometimes, firmware cannot map the device path QEMU wants firmware to + boot from to a boot method. It doesn't happen for devices the firmware +-- +2.39.3 + diff --git a/kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch b/kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch new file mode 100644 index 0000000..900b9ab --- /dev/null +++ b/kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch @@ -0,0 +1,65 @@ +From 255d789ab8fbc5a79236e0943a222371ceded164 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Thu, 14 Nov 2024 19:27:42 -0500 +Subject: [PATCH 02/10] docs/system/s390x/bootdevices: Update loadparm + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/8] df997bcf56bad83b5d4832dbf6c3298abd15b249 (thuth/qemu-kvm-cs9) + +Update documentation to include per-device loadparm support. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241115002742.3576842-1-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 0271fdc650b212533b8aeaecbedfe8ccf6bbbef3) +--- + docs/system/s390x/bootdevices.rst | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --git a/docs/system/s390x/bootdevices.rst b/docs/system/s390x/bootdevices.rst +index 1a1a764c1c..97b3914785 100644 +--- a/docs/system/s390x/bootdevices.rst ++++ b/docs/system/s390x/bootdevices.rst +@@ -79,7 +79,29 @@ The second way to use this parameter is to use a number in the range from 0 + to 31. The numbers that can be used here correspond to the numbers that are + shown when using the ``PROMPT`` option, and the s390-ccw bios will then try + to automatically boot the kernel that is associated with the given number. +-Note that ``0`` can be used to boot the default entry. ++Note that ``0`` can be used to boot the default entry. If the machine ++``loadparm`` is not assigned a value, then the default entry is used. ++ ++By default, the machine ``loadparm`` applies to all boot devices. If multiple ++devices are assigned a ``bootindex`` and the ``loadparm`` is to be different ++between them, an independent ``loadparm`` may be assigned on a per-device basis. ++ ++An example guest using per-device ``loadparm``:: ++ ++ qemu-system-s390x -drive if=none,id=dr1,file=primary.qcow2 \ ++ -device virtio-blk,drive=dr1,bootindex=1 \ ++ -drive if=none,id=dr2,file=secondary.qcow2 \ ++ -device virtio-blk,drive=dr2,bootindex=2,loadparm=3 ++ ++In this case, the primary boot device will attempt to IPL using the default ++entry (because no ``loadparm`` is specified for this device or for the ++machine). If that device fails to boot, the secondary device will attempt to ++IPL using entry number 3. ++ ++If a ``loadparm`` is specified on both the machine and a device, the per-device ++value will superseded the machine value. Per-device ``loadparm`` values are ++only used for devices with an assigned ``bootindex``. The machine ``loadparm`` ++is used when attempting to boot without a ``bootindex``. + + + Booting from a network device +-- +2.39.3 + diff --git a/kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch b/kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch new file mode 100644 index 0000000..14fe2f0 --- /dev/null +++ b/kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch @@ -0,0 +1,221 @@ +From 7aa02e169dde52b4a7f6ec832a3fe55027fbd5e2 Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Fri, 15 Nov 2024 15:12:02 +0100 +Subject: [PATCH 05/10] hw: Add "loadparm" property to scsi disk devices for + booting on s390x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [4/8] 7e3444e1fda776ca3b6de246b2dd696edf4980dd (thuth/qemu-kvm-cs9) + +While adding the new flexible boot order feature on s390x recently, +we missed to add the "loadparm" property to the scsi-hd and scsi-cd +devices. This property is required on s390x to pass the information +to the boot loader about which kernel should be started or whether +the boot menu should be shown. But even more serious: The missing +property is now causing trouble with the corresponding libvirt patches +that assume that the "loadparm" property is either settable for all +bootable devices (when the "boot order" feature is implemented in +QEMU), or none (meaning the behaviour of older QEMUs that only allowed +one "loadparm" at the machine level). To fix this broken situation, +let's implement the "loadparm" property in for the SCSI devices, too. + +Message-ID: <20241115141202.1877294-1-thuth@redhat.com> +Acked-by: Eric Farman +Signed-off-by: Thomas Huth +(cherry picked from commit 429442e52d94f890fa194a151e8cd649b04e9e63) +--- + hw/core/qdev-properties-system.c | 26 +++++++++++++++++ + hw/s390x/ipl.c | 19 ++++--------- + hw/scsi/scsi-disk.c | 43 +++++++++++++++++++++++++++++ + include/hw/qdev-properties-system.h | 3 ++ + 4 files changed, 78 insertions(+), 13 deletions(-) + +diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c +index f13350b4fb..5cd527cdba 100644 +--- a/hw/core/qdev-properties-system.c ++++ b/hw/core/qdev-properties-system.c +@@ -58,6 +58,32 @@ static bool check_prop_still_unset(Object *obj, const char *name, + return false; + } + ++bool qdev_prop_sanitize_s390x_loadparm(uint8_t *loadparm, const char *str, ++ Error **errp) ++{ ++ int i, len; ++ ++ len = strlen(str); ++ if (len > 8) { ++ error_setg(errp, "'loadparm' can only contain up to 8 characters"); ++ return false; ++ } ++ ++ for (i = 0; i < len; i++) { ++ uint8_t c = qemu_toupper(str[i]); /* mimic HMC */ ++ ++ if (qemu_isalnum(c) || c == '.' || c == ' ') { ++ loadparm[i] = c; ++ } else { ++ error_setg(errp, ++ "invalid character in 'loadparm': '%c' (ASCII 0x%02x)", ++ c, c); ++ return false; ++ } ++ } ++ ++ return true; ++} + + /* --- drive --- */ + +diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c +index 5fbd43c346..8101825dfe 100644 +--- a/hw/s390x/ipl.c ++++ b/hw/s390x/ipl.c +@@ -418,21 +418,9 @@ static uint64_t s390_ipl_map_iplb_chain(IplParameterBlock *iplb_chain) + + void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp) + { +- int i; +- + /* Initialize the loadparm with spaces */ + memset(loadparm, ' ', LOADPARM_LEN); +- for (i = 0; i < LOADPARM_LEN && str[i]; i++) { +- uint8_t c = qemu_toupper(str[i]); /* mimic HMC */ +- +- if (qemu_isalnum(c) || c == '.' || c == ' ') { +- loadparm[i] = c; +- } else { +- error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%02x)", +- c, c); +- return; +- } +- } ++ qdev_prop_sanitize_s390x_loadparm(loadparm, str, errp); + } + + void s390_ipl_convert_loadparm(char *ascii_lp, uint8_t *ebcdic_lp) +@@ -452,6 +440,7 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) + SCSIDevice *sd; + int devtype; + uint8_t *lp; ++ g_autofree void *scsi_lp = NULL; + + /* + * Currently allow IPL only from CCW devices. +@@ -463,6 +452,10 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) + switch (devtype) { + case CCW_DEVTYPE_SCSI: + sd = SCSI_DEVICE(dev_st); ++ scsi_lp = object_property_get_str(OBJECT(sd), "loadparm", NULL); ++ if (scsi_lp && strlen(scsi_lp) > 0) { ++ lp = scsi_lp; ++ } + iplb->len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN); + iplb->blk0_len = + cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN - S390_IPLB_HEADER_LEN); +diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c +index 4d94b2b816..7566a5f531 100644 +--- a/hw/scsi/scsi-disk.c ++++ b/hw/scsi/scsi-disk.c +@@ -32,6 +32,7 @@ + #include "migration/vmstate.h" + #include "hw/scsi/emulation.h" + #include "scsi/constants.h" ++#include "sysemu/arch_init.h" + #include "sysemu/block-backend.h" + #include "sysemu/blockdev.h" + #include "hw/block/block.h" +@@ -111,6 +112,7 @@ struct SCSIDiskState { + char *vendor; + char *product; + char *device_id; ++ char *loadparm; /* only for s390x */ + bool tray_open; + bool tray_locked; + /* +@@ -3135,6 +3137,43 @@ BlockAIOCB *scsi_dma_writev(int64_t offset, QEMUIOVector *iov, + return blk_aio_pwritev(s->qdev.conf.blk, offset, iov, 0, cb, cb_opaque); + } + ++static char *scsi_property_get_loadparm(Object *obj, Error **errp) ++{ ++ return g_strdup(SCSI_DISK_BASE(obj)->loadparm); ++} ++ ++static void scsi_property_set_loadparm(Object *obj, const char *value, ++ Error **errp) ++{ ++ void *lp_str; ++ ++ if (object_property_get_int(obj, "bootindex", NULL) < 0) { ++ error_setg(errp, "'loadparm' is only valid for boot devices"); ++ return; ++ } ++ ++ lp_str = g_malloc0(strlen(value)); ++ if (!qdev_prop_sanitize_s390x_loadparm(lp_str, value, errp)) { ++ g_free(lp_str); ++ return; ++ } ++ SCSI_DISK_BASE(obj)->loadparm = lp_str; ++} ++ ++static void scsi_property_add_specifics(DeviceClass *dc) ++{ ++ ObjectClass *oc = OBJECT_CLASS(dc); ++ ++ /* The loadparm property is only supported on s390x */ ++ if (arch_type & QEMU_ARCH_S390X) { ++ object_class_property_add_str(oc, "loadparm", ++ scsi_property_get_loadparm, ++ scsi_property_set_loadparm); ++ object_class_property_set_description(oc, "loadparm", ++ "load parameter (s390x only)"); ++ } ++} ++ + static void scsi_disk_base_class_initfn(ObjectClass *klass, void *data) + { + DeviceClass *dc = DEVICE_CLASS(klass); +@@ -3218,6 +3257,8 @@ static void scsi_hd_class_initfn(ObjectClass *klass, void *data) + dc->desc = "virtual SCSI disk"; + device_class_set_props(dc, scsi_hd_properties); + dc->vmsd = &vmstate_scsi_disk_state; ++ ++ scsi_property_add_specifics(dc); + } + + static const TypeInfo scsi_hd_info = { +@@ -3258,6 +3299,8 @@ static void scsi_cd_class_initfn(ObjectClass *klass, void *data) + dc->desc = "virtual SCSI CD-ROM"; + device_class_set_props(dc, scsi_cd_properties); + dc->vmsd = &vmstate_scsi_disk_state; ++ ++ scsi_property_add_specifics(dc); + } + + static const TypeInfo scsi_cd_info = { +diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properties-system.h +index 438f65389f..88e4257ad0 100644 +--- a/include/hw/qdev-properties-system.h ++++ b/include/hw/qdev-properties-system.h +@@ -3,6 +3,9 @@ + + #include "hw/qdev-properties.h" + ++bool qdev_prop_sanitize_s390x_loadparm(uint8_t *loadparm, const char *str, ++ Error **errp); ++ + extern const PropertyInfo qdev_prop_chr; + extern const PropertyInfo qdev_prop_macaddr; + extern const PropertyInfo qdev_prop_reserved_region; +-- +2.39.3 + diff --git a/kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch b/kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch new file mode 100644 index 0000000..3395dec --- /dev/null +++ b/kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch @@ -0,0 +1,113 @@ +From ffffba85b269096d25fef307b342b8f576610d34 Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Wed, 13 Nov 2024 12:47:41 +0100 +Subject: [PATCH 04/10] hw/s390x: Restrict "loadparm" property to devices that + can be used for booting +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [3/8] e381997b44f5b8c80a90ae99f5ae5d863f6d5aa5 (thuth/qemu-kvm-cs9) + +Commit bb185de423 ("s390x: Add individual loadparm assignment to +CCW device") added a "loadparm" property to all CCW devices. This +was a little bit unfortunate, since this property is only useful +for devices that can be used for booting, but certainly it is not +useful for devices like virtio-gpu or virtio-tablet. + +Thus let's restrict the property to CCW devices that we can boot from +(i.e. virtio-block, virtio-net and vfio-ccw devices). + +Message-ID: <20241113114741.681096-1-thuth@redhat.com> +Reviewed-by: Philippe Mathieu-Daudé +Reviewed-by: Jared Rossi +Signed-off-by: Thomas Huth +(cherry picked from commit 6e7c96ae61e0542e97d385084f1f2281a0331054) +--- + hw/s390x/ccw-device.c | 4 +--- + hw/s390x/ccw-device.h | 5 +++++ + hw/s390x/virtio-ccw-blk.c | 1 + + hw/s390x/virtio-ccw-net.c | 1 + + hw/vfio/ccw.c | 1 + + 5 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c +index 4e54f34b1c..d7bb364579 100644 +--- a/hw/s390x/ccw-device.c ++++ b/hw/s390x/ccw-device.c +@@ -73,7 +73,7 @@ static void ccw_device_set_loadparm(Object *obj, Visitor *v, + s390_ipl_fmt_loadparm(dev->loadparm, val, errp); + } + +-static const PropertyInfo ccw_loadparm = { ++const PropertyInfo ccw_loadparm = { + .name = "ccw_loadparm", + .description = "Up to 8 chars in set of [A-Za-z0-9. ] to pass" + " to the guest loader/kernel", +@@ -85,8 +85,6 @@ static Property ccw_device_properties[] = { + DEFINE_PROP_CSS_DEV_ID("devno", CcwDevice, devno), + DEFINE_PROP_CSS_DEV_ID_RO("dev_id", CcwDevice, dev_id), + DEFINE_PROP_CSS_DEV_ID_RO("subch_id", CcwDevice, subch_id), +- DEFINE_PROP("loadparm", CcwDevice, loadparm, ccw_loadparm, +- typeof(uint8_t[8])), + DEFINE_PROP_END_OF_LIST(), + }; + +diff --git a/hw/s390x/ccw-device.h b/hw/s390x/ccw-device.h +index 1e1737c0f3..4439feb140 100644 +--- a/hw/s390x/ccw-device.h ++++ b/hw/s390x/ccw-device.h +@@ -51,4 +51,9 @@ static inline CcwDevice *to_ccw_dev_fast(DeviceState *d) + + OBJECT_DECLARE_TYPE(CcwDevice, CCWDeviceClass, CCW_DEVICE) + ++extern const PropertyInfo ccw_loadparm; ++ ++#define DEFINE_PROP_CCW_LOADPARM(_n, _s, _f) \ ++ DEFINE_PROP(_n, _s, _f, ccw_loadparm, typeof(uint8_t[8])) ++ + #endif +diff --git a/hw/s390x/virtio-ccw-blk.c b/hw/s390x/virtio-ccw-blk.c +index 8e0e58b77d..2364432c6e 100644 +--- a/hw/s390x/virtio-ccw-blk.c ++++ b/hw/s390x/virtio-ccw-blk.c +@@ -48,6 +48,7 @@ static Property virtio_ccw_blk_properties[] = { + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), ++ DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), + DEFINE_PROP_END_OF_LIST(), + }; + +diff --git a/hw/s390x/virtio-ccw-net.c b/hw/s390x/virtio-ccw-net.c +index 484e617659..a4a3f65c7e 100644 +--- a/hw/s390x/virtio-ccw-net.c ++++ b/hw/s390x/virtio-ccw-net.c +@@ -51,6 +51,7 @@ static Property virtio_ccw_net_properties[] = { + VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev, + VIRTIO_CCW_MAX_REV), ++ DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), + DEFINE_PROP_END_OF_LIST(), + }; + +diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c +index 115862f430..99f16614ad 100644 +--- a/hw/vfio/ccw.c ++++ b/hw/vfio/ccw.c +@@ -662,6 +662,7 @@ static Property vfio_ccw_properties[] = { + DEFINE_PROP_LINK("iommufd", VFIOCCWDevice, vdev.iommufd, + TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *), + #endif ++ DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), + DEFINE_PROP_END_OF_LIST(), + }; + +-- +2.39.3 + diff --git a/kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch b/kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch new file mode 100644 index 0000000..8a5c675 --- /dev/null +++ b/kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch @@ -0,0 +1,45 @@ +From 7e73d3ad9a7e3f047f8ef79131065e4386e1bc00 Mon Sep 17 00:00:00 2001 +From: Thomas Huth +Date: Mon, 11 Nov 2024 14:11:20 +0100 +Subject: [PATCH 09/10] pc-bios/s390-ccw: Re-initialize receive queue index + before each boot attempt +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [8/8] 3337c7737fa2eb33f1a27230ae1d6e0f2580a539 (thuth/qemu-kvm-cs9) + +Now that we can boot from multiple boot devices, we have to make sure +to reinitialize static variables like rx_last_idx to avoid that they +contain garbage data during the second boot attempt (which can lead to +crashes when the code tries to access the wrong ring data). + +Message-ID: <20241111131120.317796-1-thuth@redhat.com> +Reviewed-by: Jared Rossi +Signed-off-by: Thomas Huth +(cherry picked from commit 6ba1f714c00f8839a8df9f643e0058f00da3fd25) +--- + pc-bios/s390-ccw/virtio-net.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/pc-bios/s390-ccw/virtio-net.c b/pc-bios/s390-ccw/virtio-net.c +index f9854a22c3..578c89d0c5 100644 +--- a/pc-bios/s390-ccw/virtio-net.c ++++ b/pc-bios/s390-ccw/virtio-net.c +@@ -51,6 +51,8 @@ int virtio_net_init(void *mac_addr) + void *buf; + int i; + ++ rx_last_idx = 0; ++ + vdev->guest_features[0] = VIRTIO_NET_F_MAC_BIT; + virtio_setup_ccw(vdev); + +-- +2.39.3 + diff --git a/kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch b/kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch new file mode 100644 index 0000000..ebf1a48 --- /dev/null +++ b/kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch @@ -0,0 +1,43 @@ +From 32ddd9e68b04cb231fa0adcaeacbbe6373a1972f Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Fri, 8 Nov 2024 14:41:36 -0500 +Subject: [PATCH 07/10] pc-bios/s390x: Initialize cdrom type to false for each + IPL device +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [6/8] 994d24c3292a38f5bc7fd87d7227e5beb8abc30b (thuth/qemu-kvm-cs9) + +Clear information about cdrom type so that current IPL device isn't tainted +by stale data from previous devices. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241108194136.2833932-1-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 8c797468116d19940fb758efa749eae414616e3a) +--- + pc-bios/s390-ccw/main.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c +index a4d1c05aac..7509755e36 100644 +--- a/pc-bios/s390-ccw/main.c ++++ b/pc-bios/s390-ccw/main.c +@@ -242,6 +242,7 @@ static bool find_boot_device(void) + static int virtio_setup(void) + { + VDev *vdev = virtio_get_device(); ++ vdev->is_cdrom = false; + int ret; + + switch (vdev->senseid.cu_model) { +-- +2.39.3 + diff --git a/kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch b/kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch new file mode 100644 index 0000000..f0764e6 --- /dev/null +++ b/kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch @@ -0,0 +1,55 @@ +From d5fd6b575f36c09bb6ef11d3e1e4e698577637c3 Mon Sep 17 00:00:00 2001 +From: Jared Rossi +Date: Thu, 14 Nov 2024 11:19:52 -0500 +Subject: [PATCH 08/10] pc-bios/s390x: Initialize machine loadparm before + probing IPL devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [7/8] 5f9bca4a83d6a1bde08504d2655f486708765e6e (thuth/qemu-kvm-cs9) + +Commit bb185de423 ("s390x: Add individual loadparm assignment to +CCW device") allowed boot devices to be assigned a loadparm value independent +of the machine value, however, when no boot devices are defined, the machine +loadparm becomes ignored. Therefore, let's check the machine loadparm +prior to probing the devices. + +Signed-off-by: Jared Rossi +Reviewed-by: Thomas Huth +Message-ID: <20241114161952.3508554-1-jrossi@linux.ibm.com> +Signed-off-by: Thomas Huth +(cherry picked from commit 1056ca1e70dc6e0458238141bcebfb7810cede6d) +--- + 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 7509755e36..76bf743900 100644 +--- a/pc-bios/s390-ccw/main.c ++++ b/pc-bios/s390-ccw/main.c +@@ -191,7 +191,7 @@ static void boot_setup(void) + { + char lpmsg[] = "LOADPARM=[________]\n"; + +- if (memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) { ++ if (have_iplb && memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) { + ebcdic_to_ascii((char *) iplb.loadparm, loadparm_str, LOADPARM_LEN); + } else { + sclp_get_loadparm_ascii(loadparm_str); +@@ -316,6 +316,7 @@ void main(void) + css_setup(); + have_iplb = store_iplb(&iplb); + if (!have_iplb) { ++ boot_setup(); + probe_boot_device(); + } + +-- +2.39.3 + diff --git a/kvm-scsi-fix-allocation-for-s390x-loadparm.patch b/kvm-scsi-fix-allocation-for-s390x-loadparm.patch new file mode 100644 index 0000000..d2a9833 --- /dev/null +++ b/kvm-scsi-fix-allocation-for-s390x-loadparm.patch @@ -0,0 +1,48 @@ +From 15f5e84210537514394b18e9dc6c710ad1218ecd Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Tue, 19 Nov 2024 22:31:22 +0100 +Subject: [PATCH 06/10] scsi: fix allocation for s390x loadparm +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Thomas Huth +RH-MergeRequest: 298: [c9s] Fixes for the new s390x "boot order" feature +RH-Jira: RHEL-68440 +RH-Acked-by: Cédric Le Goater +RH-Acked-by: Miroslav Rezanina +RH-Commit: [5/8] 6a0e420261eb0521d4f979d2a6c250ee4aae7606 (thuth/qemu-kvm-cs9) + +Coverity reports a possible buffer overrun due to a non-NUL-terminated +string in scsi_property_set_loadparm(). While things are not so easy, +because qdev_prop_sanitize_s390x_loadparm is designed to operate on a +buffer that is not NUL-terminated, in this case the string *does* have +to be NUL-terminated because it is read by scsi_property_get_loadparm +and s390_build_iplb. + +Reviewed-by: jrossi@linux.ibm.com +Cc: thuth@redhat.com +Fixes: 429442e52d9 ("hw: Add "loadparm" property to scsi disk devices for booting on s390x", 2024-11-18) +Signed-off-by: Paolo Bonzini +(cherry picked from commit b73d7eff1eedb2399cd594bc872d5db13506d951) +Signed-off-by: Thomas Huth +--- + hw/scsi/scsi-disk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c +index 7566a5f531..de0c295173 100644 +--- a/hw/scsi/scsi-disk.c ++++ b/hw/scsi/scsi-disk.c +@@ -3152,7 +3152,7 @@ static void scsi_property_set_loadparm(Object *obj, const char *value, + return; + } + +- lp_str = g_malloc0(strlen(value)); ++ lp_str = g_malloc0(strlen(value) + 1); + if (!qdev_prop_sanitize_s390x_loadparm(lp_str, value, errp)) { + g_free(lp_str); + return; +-- +2.39.3 + diff --git a/kvm-virtio-net-Add-queues-before-loading-them.patch b/kvm-virtio-net-Add-queues-before-loading-them.patch new file mode 100644 index 0000000..0474c68 --- /dev/null +++ b/kvm-virtio-net-Add-queues-before-loading-them.patch @@ -0,0 +1,94 @@ +From 873e57548d92eb916656b6304a780f63958aa9fe Mon Sep 17 00:00:00 2001 +From: Akihiko Odaki +Date: Tue, 22 Oct 2024 15:49:01 +0900 +Subject: [PATCH 01/10] virtio-net: Add queues before loading them +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: 小田喜陽彦 +RH-MergeRequest: 299: virtio-net: Add queues before loading them +RH-Jira: RHEL-69477 +RH-Acked-by: Laurent Vivier +RH-Acked-by: Jason Wang +RH-Commit: [1/1] 7bd06d5f9c0f0ce3d211204c404451d7002bb7fb (akihiko.odaki/qemu-kvm) + +Call virtio_net_set_multiqueue() to add queues before loading their +states. Otherwise the loaded queues will not have handlers and elements +in them will not be processed. + +Cc: qemu-stable@nongnu.org +Fixes: 8c49756825da ("virtio-net: Add only one queue pair when realizing") +Reported-by: Laurent Vivier +Signed-off-by: Akihiko Odaki +Acked-by: Michael S. Tsirkin +Signed-off-by: Jason Wang +(cherry picked from commit 9379ea9db3c0064fa2787db0794a23a30f7b2d2d) +--- + hw/net/virtio-net.c | 10 ++++++++++ + hw/virtio/virtio.c | 7 +++++++ + include/hw/virtio/virtio.h | 2 ++ + 3 files changed, 19 insertions(+) + +diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c +index ed33a32877..90d05f94d4 100644 +--- a/hw/net/virtio-net.c ++++ b/hw/net/virtio-net.c +@@ -3032,6 +3032,15 @@ static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue) + virtio_net_set_queue_pairs(n); + } + ++static int virtio_net_pre_load_queues(VirtIODevice *vdev) ++{ ++ virtio_net_set_multiqueue(VIRTIO_NET(vdev), ++ virtio_has_feature(vdev->guest_features, VIRTIO_NET_F_RSS) || ++ virtio_has_feature(vdev->guest_features, VIRTIO_NET_F_MQ)); ++ ++ return 0; ++} ++ + static int virtio_net_post_load_device(void *opaque, int version_id) + { + VirtIONet *n = opaque; +@@ -4010,6 +4019,7 @@ static void virtio_net_class_init(ObjectClass *klass, void *data) + vdc->guest_notifier_mask = virtio_net_guest_notifier_mask; + vdc->guest_notifier_pending = virtio_net_guest_notifier_pending; + vdc->legacy_features |= (0x1 << VIRTIO_NET_F_GSO); ++ vdc->pre_load_queues = virtio_net_pre_load_queues; + vdc->post_load = virtio_net_post_load_virtio; + vdc->vmsd = &vmstate_virtio_net_device; + vdc->primary_unplug_pending = primary_unplug_pending; +diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c +index 9e10cbc058..10f24a58dd 100644 +--- a/hw/virtio/virtio.c ++++ b/hw/virtio/virtio.c +@@ -3251,6 +3251,13 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) + config_len--; + } + ++ if (vdc->pre_load_queues) { ++ ret = vdc->pre_load_queues(vdev); ++ if (ret) { ++ return ret; ++ } ++ } ++ + num = qemu_get_be32(f); + + if (num > VIRTIO_QUEUE_MAX) { +diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h +index 0fcbc5c0c6..953dfca27c 100644 +--- a/include/hw/virtio/virtio.h ++++ b/include/hw/virtio/virtio.h +@@ -210,6 +210,8 @@ struct VirtioDeviceClass { + void (*guest_notifier_mask)(VirtIODevice *vdev, int n, bool mask); + int (*start_ioeventfd)(VirtIODevice *vdev); + void (*stop_ioeventfd)(VirtIODevice *vdev); ++ /* Called before loading queues. Useful to add queues before loading. */ ++ int (*pre_load_queues)(VirtIODevice *vdev); + /* Saving and loading of a device; trying to deprecate save/load + * use vmsd for new devices. + */ +-- +2.39.3 + diff --git a/kvm-vnc-fix-crash-when-no-console-attached.patch b/kvm-vnc-fix-crash-when-no-console-attached.patch new file mode 100644 index 0000000..39d808a --- /dev/null +++ b/kvm-vnc-fix-crash-when-no-console-attached.patch @@ -0,0 +1,61 @@ +From b38e94f0f0d45f8edd30828d4bb620430e604048 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Tue, 20 Aug 2024 17:11:12 +0400 +Subject: [PATCH 10/10] vnc: fix crash when no console attached +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Marc-André Lureau +RH-MergeRequest: 300: vnc: fix crash when no console attached +RH-Jira: RHEL-61633 +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] 91fc70408701fa1e20ed8fefb8cdf424451dcc20 (marcandre.lureau-rh/qemu-kvm-centos) + +JIRA: https://issues.redhat.com/browse/RHEL-61633 + +Since commit e99441a3793b5 ("ui/curses: Do not use console_select()") +qemu_text_console_put_keysym() no longer checks for NULL console +argument, which leads to a later crash: + +Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. +0x00005555559ee186 in qemu_text_console_handle_keysym (s=0x0, keysym=31) at ../ui/console-vc.c:332 +332 } else if (s->echo && (keysym == '\r' || keysym == '\n')) { +(gdb) bt + #0 0x00005555559ee186 in qemu_text_console_handle_keysym (s=0x0, keysym=31) at ../ui/console-vc.c:332 + #1 0x00005555559e18e5 in qemu_text_console_put_keysym (s=, keysym=) at ../ui/console.c:303 + #2 0x00005555559f2e88 in do_key_event (vs=vs@entry=0x5555579045c0, down=down@entry=1, keycode=keycode@entry=60, sym=sym@entry=65471) at ../ui/vnc.c:2034 + #3 0x00005555559f845c in ext_key_event (vs=0x5555579045c0, down=1, sym=65471, keycode=) at ../ui/vnc.c:2070 + #4 protocol_client_msg (vs=0x5555579045c0, data=, len=) at ../ui/vnc.c:2514 + #5 0x00005555559f515c in vnc_client_read (vs=0x5555579045c0) at ../ui/vnc.c:1607 + +Fixes: e99441a3793b5 ("ui/curses: Do not use console_select()") +Fixes: https://issues.redhat.com/browse/RHEL-50529 +Cc: qemu-stable@nongnu.org +Signed-off-by: Marc-André Lureau +Reviewed-by: Akihiko Odaki +Reviewed-by: Michael Tokarev +Signed-off-by: Michael Tokarev + +(cherry picked from commit 0e60fc80938d9ce84274a36ddfaaa640bdef2be8) +Signed-off-by: Marc-André Lureau +--- + ui/vnc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ui/vnc.c b/ui/vnc.c +index dae5d51210..5057ec8680 100644 +--- a/ui/vnc.c ++++ b/ui/vnc.c +@@ -1935,7 +1935,7 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) + } + + qkbd_state_key_event(vs->vd->kbd, qcode, down); +- if (!qemu_console_is_graphic(vs->vd->dcl.con)) { ++ if (QEMU_IS_TEXT_CONSOLE(vs->vd->dcl.con)) { + QemuTextConsole *con = QEMU_TEXT_CONSOLE(vs->vd->dcl.con); + bool numlock = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_NUMLOCK); + bool control = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CTRL); +-- +2.39.3 + diff --git a/qemu-kvm.spec b/qemu-kvm.spec index 24f1b5b..f04d33d 100644 --- a/qemu-kvm.spec +++ b/qemu-kvm.spec @@ -149,7 +149,7 @@ Obsoletes: %{name}-block-ssh <= %{epoch}:%{version} \ Summary: QEMU is a machine emulator and virtualizer Name: qemu-kvm Version: 9.1.0 -Release: 5%{?rcrel}%{?dist}%{?cc_suffix} +Release: 6%{?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) @@ -274,6 +274,26 @@ Patch66: kvm-migration-Ensure-vmstate_save-sets-errp.patch Patch67: kvm-vfio-container-Fix-container-object-destruction.patch # For RHEL-68289 - [RHEL-9.6] QEMU core dump on applying merge property to memory backend Patch68: kvm-hostmem-Apply-merge-property-after-the-memory-region.patch +# For RHEL-69477 - qemu crashed when migrate vm with multiqueue from rhel9.4 to rhel9.6 +Patch69: kvm-virtio-net-Add-queues-before-loading-them.patch +# For RHEL-68440 - The new "boot order" feature is sometimes not working as expected [RHEL 9] +Patch70: kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch +# For RHEL-68440 - The new "boot order" feature is sometimes not working as expected [RHEL 9] +Patch71: kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch +# For RHEL-68440 - The new "boot order" feature is sometimes not working as expected [RHEL 9] +Patch72: kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch +# For RHEL-68440 - The new "boot order" feature is sometimes not working as expected [RHEL 9] +Patch73: kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch +# For RHEL-68440 - The new "boot order" feature is sometimes not working as expected [RHEL 9] +Patch74: kvm-scsi-fix-allocation-for-s390x-loadparm.patch +# For RHEL-68440 - The new "boot order" feature is sometimes not working as expected [RHEL 9] +Patch75: kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch +# For RHEL-68440 - The new "boot order" feature is sometimes not working as expected [RHEL 9] +Patch76: kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch +# For RHEL-68440 - The new "boot order" feature is sometimes not working as expected [RHEL 9] +Patch77: kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch +# For RHEL-61633 - Qemu-kvm crashed if no display device setting and switching display by remote-viewer [rhel-9] +Patch78: kvm-vnc-fix-crash-when-no-console-attached.patch %if %{have_clang} BuildRequires: clang @@ -1340,6 +1360,24 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %endif %changelog +* Thu Dec 05 2024 Miroslav Rezanina - 9.1.0-6 +- kvm-virtio-net-Add-queues-before-loading-them.patch [RHEL-69477] +- kvm-docs-system-s390x-bootdevices-Update-loadparm-docume.patch [RHEL-68440] +- kvm-docs-system-bootindex-Make-it-clear-that-s390x-can-a.patch [RHEL-68440] +- kvm-hw-s390x-Restrict-loadparm-property-to-devices-that-.patch [RHEL-68440] +- kvm-hw-Add-loadparm-property-to-scsi-disk-devices-for-bo.patch [RHEL-68440] +- kvm-scsi-fix-allocation-for-s390x-loadparm.patch [RHEL-68440] +- kvm-pc-bios-s390x-Initialize-cdrom-type-to-false-for-eac.patch [RHEL-68440] +- kvm-pc-bios-s390x-Initialize-machine-loadparm-before-pro.patch [RHEL-68440] +- kvm-pc-bios-s390-ccw-Re-initialize-receive-queue-index-b.patch [RHEL-68440] +- kvm-vnc-fix-crash-when-no-console-attached.patch [RHEL-61633] +- Resolves: RHEL-69477 + (qemu crashed when migrate vm with multiqueue from rhel9.4 to rhel9.6) +- Resolves: RHEL-68440 + (The new "boot order" feature is sometimes not working as expected [RHEL 9]) +- Resolves: RHEL-61633 + (Qemu-kvm crashed if no display device setting and switching display by remote-viewer [rhel-9]) + * Mon Nov 25 2024 Jon Maloy - 9.1.0-5 - kvm-vfio-container-Fix-container-object-destruction.patch [RHEL-67935] - kvm-hostmem-Apply-merge-property-after-the-memory-region.patch [RHEL-68289]