qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 00/11] s390x and qtest patches 2024-06-24
@ 2024-06-24  9:10 Thomas Huth
  2024-06-24  9:10 ` [PULL 01/11] hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool Thomas Huth
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Thomas Huth @ 2024-06-24  9:10 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson

The following changes since commit c9ba79baca7c673098361e3a687f72d458e0d18a:

  Merge tag 'pull-target-arm-20240622' of https://git.linaro.org/people/pmaydell/qemu-arm into staging (2024-06-22 09:56:49 -0700)

are available in the Git repository at:

  https://gitlab.com/thuth/qemu.git tags/pull-request-2024-06-24

for you to fetch changes up to d6a7c3f44cf3f60c066dbf087ef79d4b12acc642:

  target/s390x: Add a CONFIG switch to disable legacy CPUs (2024-06-24 08:22:30 +0200)

----------------------------------------------------------------
* s390x error reporting clean ups
* fix memleak in qos_fuzz.c
* use correct byte order for pid field in s390x dumps
* Add a CONFIG switch to disable legacy s390x CPUs

----------------------------------------------------------------
Cédric Le Goater (6):
      hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool
      s390x/css: Make CCWDeviceClass::realize return bool
      hw/s390x/ccw: Remove local Error variable from s390_ccw_realize()
      s390x/css: Make S390CCWDeviceClass::realize return bool
      vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize()
      vfio/{ap, ccw}: Use warn_report_err() for IRQ notifier registration errors

Dmitry Frolov (1):
      tests/qtest/fuzz: fix memleak in qos_fuzz.c

Omar Sandoval (1):
      target/s390x/arch_dump: use correct byte order for pid

Thomas Huth (2):
      MAINTAINERS: Cover all tests/qtest/migration-* files
      target/s390x: Add a CONFIG switch to disable legacy CPUs

Zhenzhong Duan (1):
      vfio/ccw: Fix the missed unrealize() call in error path

 MAINTAINERS                 |  3 ++-
 hw/s390x/ccw-device.h       |  2 +-
 include/hw/s390x/s390-ccw.h |  2 +-
 hw/s390x/ccw-device.c       |  3 ++-
 hw/s390x/s390-ccw.c         | 29 +++++++++++++----------------
 hw/s390x/s390-virtio-ccw.c  |  5 +++++
 hw/vfio/ap.c                |  2 +-
 hw/vfio/ccw.c               | 18 ++++++++----------
 target/s390x/arch_dump.c    |  2 +-
 target/s390x/cpu_models.c   |  9 +++++++++
 tests/qtest/fuzz/qos_fuzz.c |  1 +
 target/s390x/Kconfig        |  5 +++++
 12 files changed, 49 insertions(+), 32 deletions(-)



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PULL 01/11] hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool
  2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
@ 2024-06-24  9:10 ` Thomas Huth
  2024-06-24  9:10 ` [PULL 02/11] s390x/css: Make CCWDeviceClass::realize return bool Thomas Huth
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2024-06-24  9:10 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson
  Cc: Cédric Le Goater, Zhenzhong Duan, Anthony Krowiak,
	Eric Farman

From: Cédric Le Goater <clg@redhat.com>

Since s390_ccw_get_dev_info() takes an 'Error **' argument, best
practices suggest to return a bool. See the qapi/error.h Rules
section. While at it, modify the call in s390_ccw_realize().

Signed-off-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20240522170107.289532-2-clg@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/s390x/s390-ccw.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c
index 5261e66724..a06e91dfb3 100644
--- a/hw/s390x/s390-ccw.c
+++ b/hw/s390x/s390-ccw.c
@@ -71,7 +71,7 @@ IOInstEnding s390_ccw_store(SubchDev *sch)
     return ret;
 }
 
-static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
+static bool s390_ccw_get_dev_info(S390CCWDevice *cdev,
                                   char *sysfsdev,
                                   Error **errp)
 {
@@ -84,12 +84,12 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
         error_setg(errp, "No host device provided");
         error_append_hint(errp,
                           "Use -device vfio-ccw,sysfsdev=PATH_TO_DEVICE\n");
-        return;
+        return false;
     }
 
     if (!realpath(sysfsdev, dev_path)) {
         error_setg_errno(errp, errno, "Host device '%s' not found", sysfsdev);
-        return;
+        return false;
     }
 
     cdev->mdevid = g_path_get_basename(dev_path);
@@ -98,13 +98,14 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
     tmp = g_path_get_basename(tmp_dir);
     if (sscanf(tmp, "%2x.%1x.%4x", &cssid, &ssid, &devid) != 3) {
         error_setg_errno(errp, errno, "Failed to read %s", tmp);
-        return;
+        return false;
     }
 
     cdev->hostid.cssid = cssid;
     cdev->hostid.ssid = ssid;
     cdev->hostid.devid = devid;
     cdev->hostid.valid = true;
+    return true;
 }
 
 static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
@@ -116,8 +117,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
     int ret;
     Error *err = NULL;
 
-    s390_ccw_get_dev_info(cdev, sysfsdev, &err);
-    if (err) {
+    if (!s390_ccw_get_dev_info(cdev, sysfsdev, &err)) {
         goto out_err_propagate;
     }
 
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PULL 02/11] s390x/css: Make CCWDeviceClass::realize return bool
  2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
  2024-06-24  9:10 ` [PULL 01/11] hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool Thomas Huth
@ 2024-06-24  9:10 ` Thomas Huth
  2024-06-24  9:10 ` [PULL 03/11] hw/s390x/ccw: Remove local Error variable from s390_ccw_realize() Thomas Huth
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2024-06-24  9:10 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson
  Cc: Cédric Le Goater, Zhenzhong Duan, Anthony Krowiak,
	Eric Farman

From: Cédric Le Goater <clg@redhat.com>

Since the realize() handler of CCWDeviceClass takes an 'Error **'
argument, best practices suggest to return a bool. See the api/error.h
Rules section. While at it, modify the call in s390_ccw_realize().

Signed-off-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20240522170107.289532-3-clg@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/s390x/ccw-device.h | 2 +-
 hw/s390x/ccw-device.c | 3 ++-
 hw/s390x/s390-ccw.c   | 3 +--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/s390x/ccw-device.h b/hw/s390x/ccw-device.h
index 6dff95225d..5feeb0ee7a 100644
--- a/hw/s390x/ccw-device.h
+++ b/hw/s390x/ccw-device.h
@@ -36,7 +36,7 @@ extern const VMStateDescription vmstate_ccw_dev;
 struct CCWDeviceClass {
     DeviceClass parent_class;
     void (*unplug)(HotplugHandler *, DeviceState *, Error **);
-    void (*realize)(CcwDevice *, Error **);
+    bool (*realize)(CcwDevice *, Error **);
     void (*refill_ids)(CcwDevice *);
 };
 
diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c
index fb8c1acc64..a7d682e5af 100644
--- a/hw/s390x/ccw-device.c
+++ b/hw/s390x/ccw-device.c
@@ -31,9 +31,10 @@ static void ccw_device_refill_ids(CcwDevice *dev)
     dev->subch_id.valid = true;
 }
 
-static void ccw_device_realize(CcwDevice *dev, Error **errp)
+static bool ccw_device_realize(CcwDevice *dev, Error **errp)
 {
     ccw_device_refill_ids(dev);
+    return true;
 }
 
 static Property ccw_device_properties[] = {
diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c
index a06e91dfb3..4b8ede701d 100644
--- a/hw/s390x/s390-ccw.c
+++ b/hw/s390x/s390-ccw.c
@@ -137,8 +137,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
         goto out_err;
     }
 
-    ck->realize(ccw_dev, &err);
-    if (err) {
+    if (!ck->realize(ccw_dev, &err)) {
         goto out_err;
     }
 
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PULL 03/11] hw/s390x/ccw: Remove local Error variable from s390_ccw_realize()
  2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
  2024-06-24  9:10 ` [PULL 01/11] hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool Thomas Huth
  2024-06-24  9:10 ` [PULL 02/11] s390x/css: Make CCWDeviceClass::realize return bool Thomas Huth
@ 2024-06-24  9:10 ` Thomas Huth
  2024-06-24  9:10 ` [PULL 04/11] s390x/css: Make S390CCWDeviceClass::realize return bool Thomas Huth
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2024-06-24  9:10 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson
  Cc: Cédric Le Goater, Zhenzhong Duan, Anthony Krowiak,
	Eric Farman

From: Cédric Le Goater <clg@redhat.com>

Use the 'Error **errp' argument of s390_ccw_realize() instead and
remove the error_propagate() call.

Signed-off-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20240522170107.289532-4-clg@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/s390x/s390-ccw.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c
index 4b8ede701d..b3d14c61d7 100644
--- a/hw/s390x/s390-ccw.c
+++ b/hw/s390x/s390-ccw.c
@@ -115,13 +115,12 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
     DeviceState *parent = DEVICE(ccw_dev);
     SubchDev *sch;
     int ret;
-    Error *err = NULL;
 
-    if (!s390_ccw_get_dev_info(cdev, sysfsdev, &err)) {
-        goto out_err_propagate;
+    if (!s390_ccw_get_dev_info(cdev, sysfsdev, errp)) {
+        return;
     }
 
-    sch = css_create_sch(ccw_dev->devno, &err);
+    sch = css_create_sch(ccw_dev->devno, errp);
     if (!sch) {
         goto out_mdevid_free;
     }
@@ -132,12 +131,12 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
     ccw_dev->sch = sch;
     ret = css_sch_build_schib(sch, &cdev->hostid);
     if (ret) {
-        error_setg_errno(&err, -ret, "%s: Failed to build initial schib",
+        error_setg_errno(errp, -ret, "%s: Failed to build initial schib",
                          __func__);
         goto out_err;
     }
 
-    if (!ck->realize(ccw_dev, &err)) {
+    if (!ck->realize(ccw_dev, errp)) {
         goto out_err;
     }
 
@@ -151,8 +150,6 @@ out_err:
     g_free(sch);
 out_mdevid_free:
     g_free(cdev->mdevid);
-out_err_propagate:
-    error_propagate(errp, err);
 }
 
 static void s390_ccw_unrealize(S390CCWDevice *cdev)
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PULL 04/11] s390x/css: Make S390CCWDeviceClass::realize return bool
  2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
                   ` (2 preceding siblings ...)
  2024-06-24  9:10 ` [PULL 03/11] hw/s390x/ccw: Remove local Error variable from s390_ccw_realize() Thomas Huth
@ 2024-06-24  9:10 ` Thomas Huth
  2024-06-24  9:10 ` [PULL 05/11] vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize() Thomas Huth
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2024-06-24  9:10 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson
  Cc: Cédric Le Goater, Zhenzhong Duan, Anthony Krowiak,
	Eric Farman

From: Cédric Le Goater <clg@redhat.com>

Since the realize() handler of S390CCWDeviceClass takes an 'Error **'
argument, best practices suggest to return a bool. See the api/error.h
Rules section. While at it, modify the call in vfio_ccw_realize().

Signed-off-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20240522170107.289532-5-clg@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 include/hw/s390x/s390-ccw.h | 2 +-
 hw/s390x/s390-ccw.c         | 7 ++++---
 hw/vfio/ccw.c               | 3 +--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/hw/s390x/s390-ccw.h b/include/hw/s390x/s390-ccw.h
index 2c807ee3a1..2e0a709981 100644
--- a/include/hw/s390x/s390-ccw.h
+++ b/include/hw/s390x/s390-ccw.h
@@ -31,7 +31,7 @@ struct S390CCWDevice {
 
 struct S390CCWDeviceClass {
     CCWDeviceClass parent_class;
-    void (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp);
+    bool (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp);
     void (*unrealize)(S390CCWDevice *dev);
     IOInstEnding (*handle_request) (SubchDev *sch);
     int (*handle_halt) (SubchDev *sch);
diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c
index b3d14c61d7..3c09750550 100644
--- a/hw/s390x/s390-ccw.c
+++ b/hw/s390x/s390-ccw.c
@@ -108,7 +108,7 @@ static bool s390_ccw_get_dev_info(S390CCWDevice *cdev,
     return true;
 }
 
-static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
+static bool s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
 {
     CcwDevice *ccw_dev = CCW_DEVICE(cdev);
     CCWDeviceClass *ck = CCW_DEVICE_GET_CLASS(ccw_dev);
@@ -117,7 +117,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
     int ret;
 
     if (!s390_ccw_get_dev_info(cdev, sysfsdev, errp)) {
-        return;
+        return false;
     }
 
     sch = css_create_sch(ccw_dev->devno, errp);
@@ -142,7 +142,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
 
     css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid,
                           parent->hotplugged, 1);
-    return;
+    return true;
 
 out_err:
     css_subch_assign(sch->cssid, sch->ssid, sch->schid, sch->devno, NULL);
@@ -150,6 +150,7 @@ out_err:
     g_free(sch);
 out_mdevid_free:
     g_free(cdev->mdevid);
+    return false;
 }
 
 static void s390_ccw_unrealize(S390CCWDevice *cdev)
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 2600e62e37..9a8e052711 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -582,8 +582,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
 
     /* Call the class init function for subchannel. */
     if (cdc->realize) {
-        cdc->realize(cdev, vcdev->vdev.sysfsdev, &err);
-        if (err) {
+        if (!cdc->realize(cdev, vcdev->vdev.sysfsdev, &err)) {
             goto out_err_propagate;
         }
     }
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PULL 05/11] vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize()
  2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
                   ` (3 preceding siblings ...)
  2024-06-24  9:10 ` [PULL 04/11] s390x/css: Make S390CCWDeviceClass::realize return bool Thomas Huth
@ 2024-06-24  9:10 ` Thomas Huth
  2024-06-24  9:10 ` [PULL 06/11] vfio/ccw: Fix the missed unrealize() call in error path Thomas Huth
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2024-06-24  9:10 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson
  Cc: Cédric Le Goater, Zhenzhong Duan, Anthony Krowiak,
	Eric Farman

From: Cédric Le Goater <clg@redhat.com>

The local error variable is kept for vfio_ccw_register_irq_notifier()
because it is not considered as a failing condition. We will change
how error reporting is done in following changes.

Remove the error_propagate() call.

Cc: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20240522170107.289532-6-clg@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/vfio/ccw.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 9a8e052711..a468fa2342 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -582,8 +582,8 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
 
     /* Call the class init function for subchannel. */
     if (cdc->realize) {
-        if (!cdc->realize(cdev, vcdev->vdev.sysfsdev, &err)) {
-            goto out_err_propagate;
+        if (!cdc->realize(cdev, vcdev->vdev.sysfsdev, errp)) {
+            return;
         }
     }
 
@@ -596,17 +596,17 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
         goto out_attach_dev_err;
     }
 
-    if (!vfio_ccw_get_region(vcdev, &err)) {
+    if (!vfio_ccw_get_region(vcdev, errp)) {
         goto out_region_err;
     }
 
-    if (!vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX, &err)) {
+    if (!vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX, errp)) {
         goto out_io_notifier_err;
     }
 
     if (vcdev->crw_region) {
         if (!vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_CRW_IRQ_INDEX,
-                                            &err)) {
+                                            errp)) {
             goto out_irq_notifier_err;
         }
     }
@@ -634,8 +634,6 @@ out_attach_dev_err:
     if (cdc->unrealize) {
         cdc->unrealize(cdev);
     }
-out_err_propagate:
-    error_propagate(errp, err);
 }
 
 static void vfio_ccw_unrealize(DeviceState *dev)
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PULL 06/11] vfio/ccw: Fix the missed unrealize() call in error path
  2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
                   ` (4 preceding siblings ...)
  2024-06-24  9:10 ` [PULL 05/11] vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize() Thomas Huth
@ 2024-06-24  9:10 ` Thomas Huth
  2024-06-24  9:10 ` [PULL 07/11] vfio/{ap, ccw}: Use warn_report_err() for IRQ notifier registration errors Thomas Huth
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2024-06-24  9:10 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson
  Cc: Zhenzhong Duan, Cédric Le Goater, Eric Farman

From: Zhenzhong Duan <zhenzhong.duan@intel.com>

When get name failed, we should call unrealize() so that
vfio_ccw_realize() is self contained.

Fixes: 909a6254eda ("vfio/ccw: Make vfio cdev pre-openable by passing a file handle")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.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>
Message-ID: <20240522170107.289532-7-clg@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/vfio/ccw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index a468fa2342..36f2677a44 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -588,7 +588,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
     }
 
     if (!vfio_device_get_name(vbasedev, errp)) {
-        return;
+        goto out_unrealize;
     }
 
     if (!vfio_attach_device(cdev->mdevid, vbasedev,
@@ -631,6 +631,7 @@ out_region_err:
     vfio_detach_device(vbasedev);
 out_attach_dev_err:
     g_free(vbasedev->name);
+out_unrealize:
     if (cdc->unrealize) {
         cdc->unrealize(cdev);
     }
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PULL 07/11] vfio/{ap, ccw}: Use warn_report_err() for IRQ notifier registration errors
  2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
                   ` (5 preceding siblings ...)
  2024-06-24  9:10 ` [PULL 06/11] vfio/ccw: Fix the missed unrealize() call in error path Thomas Huth
@ 2024-06-24  9:10 ` Thomas Huth
  2024-06-24  9:10 ` [PULL 08/11] tests/qtest/fuzz: fix memleak in qos_fuzz.c Thomas Huth
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2024-06-24  9:10 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson
  Cc: Cédric Le Goater, Zhenzhong Duan, Anthony Krowiak,
	Eric Farman

From: Cédric Le Goater <clg@redhat.com>

vfio_ccw_register_irq_notifier() and vfio_ap_register_irq_notifier()
errors are currently reported using error_report_err(). Since they are
not considered as failing conditions, using warn_report_err() is more
appropriate.

Signed-off-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20240522170107.289532-8-clg@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/vfio/ap.c  | 2 +-
 hw/vfio/ccw.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index c12531a788..0c4354e3e7 100644
--- a/hw/vfio/ap.c
+++ b/hw/vfio/ap.c
@@ -172,7 +172,7 @@ static void vfio_ap_realize(DeviceState *dev, Error **errp)
          * Report this error, but do not make it a failing condition.
          * Lack of this IRQ in the host does not prevent normal operation.
          */
-        error_report_err(err);
+        warn_report_err(err);
     }
 
     return;
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 36f2677a44..1f8e1272c7 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -616,7 +616,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
          * Report this error, but do not make it a failing condition.
          * Lack of this IRQ in the host does not prevent normal operation.
          */
-        error_report_err(err);
+        warn_report_err(err);
     }
 
     return;
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PULL 08/11] tests/qtest/fuzz: fix memleak in qos_fuzz.c
  2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
                   ` (6 preceding siblings ...)
  2024-06-24  9:10 ` [PULL 07/11] vfio/{ap, ccw}: Use warn_report_err() for IRQ notifier registration errors Thomas Huth
@ 2024-06-24  9:10 ` Thomas Huth
  2024-06-24  9:10 ` [PULL 09/11] target/s390x/arch_dump: use correct byte order for pid Thomas Huth
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2024-06-24  9:10 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson; +Cc: Dmitry Frolov, Alexander Bulekov

From: Dmitry Frolov <frolov@swemel.ru>

Found with fuzzing for qemu-8.2, but also relevant for master

Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
Message-ID: <20240521103106.119021-3-frolov@swemel.ru>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/qtest/fuzz/qos_fuzz.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/qtest/fuzz/qos_fuzz.c b/tests/qtest/fuzz/qos_fuzz.c
index b71e945c5f..d3839bf999 100644
--- a/tests/qtest/fuzz/qos_fuzz.c
+++ b/tests/qtest/fuzz/qos_fuzz.c
@@ -180,6 +180,7 @@ static void walk_path(QOSGraphNode *orig_path, int len)
 
         fuzz_path_vec = path_vec;
     } else {
+        g_string_free(cmd_line, true);
         g_free(path_vec);
     }
 
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PULL 09/11] target/s390x/arch_dump: use correct byte order for pid
  2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
                   ` (7 preceding siblings ...)
  2024-06-24  9:10 ` [PULL 08/11] tests/qtest/fuzz: fix memleak in qos_fuzz.c Thomas Huth
@ 2024-06-24  9:10 ` Thomas Huth
  2024-06-24  9:10 ` [PULL 10/11] MAINTAINERS: Cover all tests/qtest/migration-* files Thomas Huth
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2024-06-24  9:10 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson; +Cc: Omar Sandoval

From: Omar Sandoval <osandov@osandov.com>

The pid field of prstatus needs to be big endian like all of the other
fields.

Fixes: f738f296eaae ("s390x/arch_dump: pass cpuid into notes sections")
Signed-off-by: Omar Sandoval <osandov@osandov.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <5929f76d536d355afd04af51bf293695a1065118.1718771802.git.osandov@osandov.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 target/s390x/arch_dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/arch_dump.c b/target/s390x/arch_dump.c
index 7e8a1b4fc0..029d91d93a 100644
--- a/target/s390x/arch_dump.c
+++ b/target/s390x/arch_dump.c
@@ -102,7 +102,7 @@ static void s390x_write_elf64_prstatus(Note *note, S390CPU *cpu, int id)
         regs->acrs[i] = cpu_to_be32(cpu->env.aregs[i]);
         regs->gprs[i] = cpu_to_be64(cpu->env.regs[i]);
     }
-    note->contents.prstatus.pid = id;
+    note->contents.prstatus.pid = cpu_to_be32(id);
 }
 
 static void s390x_write_elf64_fpregset(Note *note, S390CPU *cpu, int id)
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PULL 10/11] MAINTAINERS: Cover all tests/qtest/migration-* files
  2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
                   ` (8 preceding siblings ...)
  2024-06-24  9:10 ` [PULL 09/11] target/s390x/arch_dump: use correct byte order for pid Thomas Huth
@ 2024-06-24  9:10 ` Thomas Huth
  2024-06-24  9:10 ` [PULL 11/11] target/s390x: Add a CONFIG switch to disable legacy CPUs Thomas Huth
  2024-06-24 20:50 ` [PULL 00/11] s390x and qtest patches 2024-06-24 Richard Henderson
  11 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2024-06-24  9:10 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson
  Cc: Philippe Mathieu-Daudé, Fabiano Rosas, Peter Xu

Beside migration-test.c, there is nowadays migration-helpers.[ch],
too, so update the entry in the migration section to also cover these
files now.
While we're at it, exclude these files in the common qtest section,
since the migration test is well covered by the migration maintainers
already. Since the test is under very active development, it was causing
a lot of distraction to the generic qtest maintainers with regards to
the patches that need to be reviewed by the migration maintainers anyway.

Message-ID: <20240619055447.129943-1-thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 MAINTAINERS | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index cef54de759..f144b5af44 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3312,6 +3312,7 @@ F: tests/qtest/
 F: docs/devel/qgraph.rst
 F: docs/devel/qtest.rst
 X: tests/qtest/bios-tables-test*
+X: tests/qtest/migration-*
 
 Device Fuzzing
 M: Alexander Bulekov <alxndr@bu.edu>
@@ -3408,7 +3409,7 @@ F: include/qemu/userfaultfd.h
 F: migration/
 F: scripts/vmstate-static-checker.py
 F: tests/vmstate-static-checker-data/
-F: tests/qtest/migration-test.c
+F: tests/qtest/migration-*
 F: docs/devel/migration/
 F: qapi/migration.json
 F: tests/migration/
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PULL 11/11] target/s390x: Add a CONFIG switch to disable legacy CPUs
  2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
                   ` (9 preceding siblings ...)
  2024-06-24  9:10 ` [PULL 10/11] MAINTAINERS: Cover all tests/qtest/migration-* files Thomas Huth
@ 2024-06-24  9:10 ` Thomas Huth
  2025-03-07 15:27   ` Philippe Mathieu-Daudé
  2024-06-24 20:50 ` [PULL 00/11] s390x and qtest patches 2024-06-24 Richard Henderson
  11 siblings, 1 reply; 16+ messages in thread
From: Thomas Huth @ 2024-06-24  9:10 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson

The oldest model that IBM still supports is the z13. Considering
that each generation can "emulate" the previous two generations
in hardware (via the "IBC" feature of the CPUs), this means that
everything that is older than z114/196 is not an officially supported
CPU model anymore. The Linux kernel still support the z10, so if
we also take this into account, everything older than that can
definitely be considered as a legacy CPU model.

For downstream builds of QEMU, we would like to be able to disable
these legacy CPUs in the build. Thus add a CONFIG switch that can be
used to disable them (and old machine types that use them by default).

Message-Id: <20240614125019.588928-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/s390x/s390-virtio-ccw.c | 5 +++++
 target/s390x/cpu_models.c  | 9 +++++++++
 target/s390x/Kconfig       | 5 +++++
 3 files changed, 19 insertions(+)

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 3d0bc3e7f2..cd063f8b64 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -47,6 +47,7 @@
 #include "migration/blocker.h"
 #include "qapi/visitor.h"
 #include "hw/s390x/cpu-topology.h"
+#include CONFIG_DEVICES
 
 static Error *pv_mig_blocker;
 
@@ -1126,6 +1127,8 @@ static void ccw_machine_2_12_class_options(MachineClass *mc)
 }
 DEFINE_CCW_MACHINE(2_12, "2.12", false);
 
+#ifdef CONFIG_S390X_LEGACY_CPUS
+
 static void ccw_machine_2_11_instance_options(MachineState *machine)
 {
     static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V2_11 };
@@ -1272,6 +1275,8 @@ static void ccw_machine_2_4_class_options(MachineClass *mc)
 }
 DEFINE_CCW_MACHINE(2_4, "2.4", false);
 
+#endif
+
 static void ccw_machine_register_types(void)
 {
     type_register_static(&ccw_machine_info);
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index efb508cd2e..a27f4b6f79 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -25,6 +25,7 @@
 #ifndef CONFIG_USER_ONLY
 #include "sysemu/sysemu.h"
 #include "target/s390x/kvm/pv.h"
+#include CONFIG_DEVICES
 #endif
 
 #define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, _desc) \
@@ -47,6 +48,13 @@
  * generation 15 one base feature and one optional feature have been deprecated.
  */
 static S390CPUDef s390_cpu_defs[] = {
+    /*
+     * Linux requires at least z10 nowadays, and IBM only supports recent CPUs
+     * (see https://www.ibm.com/support/pages/ibm-mainframe-life-cycle-history),
+     * so we consider older CPUs as legacy that can optionally be disabled via
+     * the CONFIG_S390X_LEGACY_CPUS config switch.
+     */
+#if defined(CONFIG_S390X_LEGACY_CPUS) || defined(CONFIG_USER_ONLY)
     CPUDEF_INIT(0x2064, 7, 1, 38, 0x00000000U, "z900", "IBM zSeries 900 GA1"),
     CPUDEF_INIT(0x2064, 7, 2, 38, 0x00000000U, "z900.2", "IBM zSeries 900 GA2"),
     CPUDEF_INIT(0x2064, 7, 3, 38, 0x00000000U, "z900.3", "IBM zSeries 900 GA3"),
@@ -64,6 +72,7 @@ static S390CPUDef s390_cpu_defs[] = {
     CPUDEF_INIT(0x2096, 9, 2, 40, 0x00000000U, "z9BC", "IBM System z9 BC GA1"),
     CPUDEF_INIT(0x2094, 9, 3, 40, 0x00000000U, "z9EC.3", "IBM System z9 EC GA3"),
     CPUDEF_INIT(0x2096, 9, 3, 40, 0x00000000U, "z9BC.2", "IBM System z9 BC GA2"),
+#endif
     CPUDEF_INIT(0x2097, 10, 1, 43, 0x00000000U, "z10EC", "IBM System z10 EC GA1"),
     CPUDEF_INIT(0x2097, 10, 2, 43, 0x00000000U, "z10EC.2", "IBM System z10 EC GA2"),
     CPUDEF_INIT(0x2098, 10, 2, 43, 0x00000000U, "z10BC", "IBM System z10 BC GA1"),
diff --git a/target/s390x/Kconfig b/target/s390x/Kconfig
index d886be48b4..8a95f2bc3f 100644
--- a/target/s390x/Kconfig
+++ b/target/s390x/Kconfig
@@ -2,3 +2,8 @@ config S390X
     bool
     select PCI
     select S390_FLIC
+
+config S390X_LEGACY_CPUS
+    bool
+    default y
+    depends on S390X
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PULL 00/11] s390x and qtest patches 2024-06-24
  2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
                   ` (10 preceding siblings ...)
  2024-06-24  9:10 ` [PULL 11/11] target/s390x: Add a CONFIG switch to disable legacy CPUs Thomas Huth
@ 2024-06-24 20:50 ` Richard Henderson
  11 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2024-06-24 20:50 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel

On 6/24/24 02:10, Thomas Huth wrote:
> The following changes since commit c9ba79baca7c673098361e3a687f72d458e0d18a:
> 
>    Merge tag 'pull-target-arm-20240622' ofhttps://git.linaro.org/people/pmaydell/qemu-arm  into staging (2024-06-22 09:56:49 -0700)
> 
> are available in the Git repository at:
> 
>    https://gitlab.com/thuth/qemu.git  tags/pull-request-2024-06-24
> 
> for you to fetch changes up to d6a7c3f44cf3f60c066dbf087ef79d4b12acc642:
> 
>    target/s390x: Add a CONFIG switch to disable legacy CPUs (2024-06-24 08:22:30 +0200)
> 
> ----------------------------------------------------------------
> * s390x error reporting clean ups
> * fix memleak in qos_fuzz.c
> * use correct byte order for pid field in s390x dumps
> * Add a CONFIG switch to disable legacy s390x CPUs
> 
> ---------------

Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/9.1 as appropriate.


r~



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PULL 11/11] target/s390x: Add a CONFIG switch to disable legacy CPUs
  2024-06-24  9:10 ` [PULL 11/11] target/s390x: Add a CONFIG switch to disable legacy CPUs Thomas Huth
@ 2025-03-07 15:27   ` Philippe Mathieu-Daudé
  2025-03-07 15:33     ` Thomas Huth
  0 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-07 15:27 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel; +Cc: Christian Borntraeger, Richard Henderson

Hi Thomas,

On 24/6/24 11:10, Thomas Huth wrote:
> The oldest model that IBM still supports is the z13. Considering
> that each generation can "emulate" the previous two generations
> in hardware (via the "IBC" feature of the CPUs), this means that
> everything that is older than z114/196 is not an officially supported
> CPU model anymore. The Linux kernel still support the z10, so if
> we also take this into account, everything older than that can
> definitely be considered as a legacy CPU model.
> 
> For downstream builds of QEMU, we would like to be able to disable
> these legacy CPUs in the build. Thus add a CONFIG switch that can be
> used to disable them (and old machine types that use them by default).
> 
> Message-Id: <20240614125019.588928-1-thuth@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   hw/s390x/s390-virtio-ccw.c | 5 +++++
>   target/s390x/cpu_models.c  | 9 +++++++++
>   target/s390x/Kconfig       | 5 +++++
>   3 files changed, 19 insertions(+)
> 
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index 3d0bc3e7f2..cd063f8b64 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -47,6 +47,7 @@
>   #include "migration/blocker.h"
>   #include "qapi/visitor.h"
>   #include "hw/s390x/cpu-topology.h"
> +#include CONFIG_DEVICES
>   
>   static Error *pv_mig_blocker;
>   
> @@ -1126,6 +1127,8 @@ static void ccw_machine_2_12_class_options(MachineClass *mc)
>   }
>   DEFINE_CCW_MACHINE(2_12, "2.12", false);
>   
> +#ifdef CONFIG_S390X_LEGACY_CPUS
> +
>   static void ccw_machine_2_11_instance_options(MachineState *machine)
>   {
>       static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V2_11 };
> @@ -1272,6 +1275,8 @@ static void ccw_machine_2_4_class_options(MachineClass *mc)
>   }
>   DEFINE_CCW_MACHINE(2_4, "2.4", false);
>   
> +#endif
> +
>   static void ccw_machine_register_types(void)
>   {
>       type_register_static(&ccw_machine_info);
> diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
> index efb508cd2e..a27f4b6f79 100644
> --- a/target/s390x/cpu_models.c
> +++ b/target/s390x/cpu_models.c
> @@ -25,6 +25,7 @@
>   #ifndef CONFIG_USER_ONLY
>   #include "sysemu/sysemu.h"
>   #include "target/s390x/kvm/pv.h"
> +#include CONFIG_DEVICES
>   #endif
>   
>   #define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, _desc) \
> @@ -47,6 +48,13 @@
>    * generation 15 one base feature and one optional feature have been deprecated.
>    */
>   static S390CPUDef s390_cpu_defs[] = {
> +    /*
> +     * Linux requires at least z10 nowadays, and IBM only supports recent CPUs
> +     * (see https://www.ibm.com/support/pages/ibm-mainframe-life-cycle-history),
> +     * so we consider older CPUs as legacy that can optionally be disabled via
> +     * the CONFIG_S390X_LEGACY_CPUS config switch.
> +     */
> +#if defined(CONFIG_S390X_LEGACY_CPUS) || defined(CONFIG_USER_ONLY)
>       CPUDEF_INIT(0x2064, 7, 1, 38, 0x00000000U, "z900", "IBM zSeries 900 GA1"),
>       CPUDEF_INIT(0x2064, 7, 2, 38, 0x00000000U, "z900.2", "IBM zSeries 900 GA2"),
>       CPUDEF_INIT(0x2064, 7, 3, 38, 0x00000000U, "z900.3", "IBM zSeries 900 GA3"),
> @@ -64,6 +72,7 @@ static S390CPUDef s390_cpu_defs[] = {
>       CPUDEF_INIT(0x2096, 9, 2, 40, 0x00000000U, "z9BC", "IBM System z9 BC GA1"),
>       CPUDEF_INIT(0x2094, 9, 3, 40, 0x00000000U, "z9EC.3", "IBM System z9 EC GA3"),
>       CPUDEF_INIT(0x2096, 9, 3, 40, 0x00000000U, "z9BC.2", "IBM System z9 BC GA2"),
> +#endif
>       CPUDEF_INIT(0x2097, 10, 1, 43, 0x00000000U, "z10EC", "IBM System z10 EC GA1"),
>       CPUDEF_INIT(0x2097, 10, 2, 43, 0x00000000U, "z10EC.2", "IBM System z10 EC GA2"),
>       CPUDEF_INIT(0x2098, 10, 2, 43, 0x00000000U, "z10BC", "IBM System z10 BC GA1"),
> diff --git a/target/s390x/Kconfig b/target/s390x/Kconfig
> index d886be48b4..8a95f2bc3f 100644
> --- a/target/s390x/Kconfig
> +++ b/target/s390x/Kconfig
> @@ -2,3 +2,8 @@ config S390X
>       bool
>       select PCI
>       select S390_FLIC
> +
> +config S390X_LEGACY_CPUS
> +    bool
> +    default y

Do we have plan to deprecate or switch that off?

> +    depends on S390X



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PULL 11/11] target/s390x: Add a CONFIG switch to disable legacy CPUs
  2025-03-07 15:27   ` Philippe Mathieu-Daudé
@ 2025-03-07 15:33     ` Thomas Huth
  2025-03-07 16:01       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 16+ messages in thread
From: Thomas Huth @ 2025-03-07 15:33 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Christian Borntraeger, Richard Henderson

On 07/03/2025 16.27, Philippe Mathieu-Daudé wrote:
> Hi Thomas,
> 
> On 24/6/24 11:10, Thomas Huth wrote:
>> The oldest model that IBM still supports is the z13. Considering
>> that each generation can "emulate" the previous two generations
>> in hardware (via the "IBC" feature of the CPUs), this means that
>> everything that is older than z114/196 is not an officially supported
>> CPU model anymore. The Linux kernel still support the z10, so if
>> we also take this into account, everything older than that can
>> definitely be considered as a legacy CPU model.
>>
>> For downstream builds of QEMU, we would like to be able to disable
>> these legacy CPUs in the build. Thus add a CONFIG switch that can be
>> used to disable them (and old machine types that use them by default).
>>
>> Message-Id: <20240614125019.588928-1-thuth@redhat.com>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>   hw/s390x/s390-virtio-ccw.c | 5 +++++
>>   target/s390x/cpu_models.c  | 9 +++++++++
>>   target/s390x/Kconfig       | 5 +++++
>>   3 files changed, 19 insertions(+)
>>
>> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
>> index 3d0bc3e7f2..cd063f8b64 100644
>> --- a/hw/s390x/s390-virtio-ccw.c
>> +++ b/hw/s390x/s390-virtio-ccw.c
>> @@ -47,6 +47,7 @@
>>   #include "migration/blocker.h"
>>   #include "qapi/visitor.h"
>>   #include "hw/s390x/cpu-topology.h"
>> +#include CONFIG_DEVICES
>>   static Error *pv_mig_blocker;
>> @@ -1126,6 +1127,8 @@ static void 
>> ccw_machine_2_12_class_options(MachineClass *mc)
>>   }
>>   DEFINE_CCW_MACHINE(2_12, "2.12", false);
>> +#ifdef CONFIG_S390X_LEGACY_CPUS
>> +
>>   static void ccw_machine_2_11_instance_options(MachineState *machine)
>>   {
>>       static const S390FeatInit qemu_cpu_feat = 
>> { S390_FEAT_LIST_QEMU_V2_11 };
>> @@ -1272,6 +1275,8 @@ static void 
>> ccw_machine_2_4_class_options(MachineClass *mc)
>>   }
>>   DEFINE_CCW_MACHINE(2_4, "2.4", false);
>> +#endif
>> +
>>   static void ccw_machine_register_types(void)
>>   {
>>       type_register_static(&ccw_machine_info);
>> diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
>> index efb508cd2e..a27f4b6f79 100644
>> --- a/target/s390x/cpu_models.c
>> +++ b/target/s390x/cpu_models.c
>> @@ -25,6 +25,7 @@
>>   #ifndef CONFIG_USER_ONLY
>>   #include "sysemu/sysemu.h"
>>   #include "target/s390x/kvm/pv.h"
>> +#include CONFIG_DEVICES
>>   #endif
>>   #define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, _desc) \
>> @@ -47,6 +48,13 @@
>>    * generation 15 one base feature and one optional feature have been 
>> deprecated.
>>    */
>>   static S390CPUDef s390_cpu_defs[] = {
>> +    /*
>> +     * Linux requires at least z10 nowadays, and IBM only supports recent 
>> CPUs
>> +     * (see https://www.ibm.com/support/pages/ibm-mainframe-life-cycle- 
>> history),
>> +     * so we consider older CPUs as legacy that can optionally be 
>> disabled via
>> +     * the CONFIG_S390X_LEGACY_CPUS config switch.
>> +     */
>> +#if defined(CONFIG_S390X_LEGACY_CPUS) || defined(CONFIG_USER_ONLY)
>>       CPUDEF_INIT(0x2064, 7, 1, 38, 0x00000000U, "z900", "IBM zSeries 900 
>> GA1"),
>>       CPUDEF_INIT(0x2064, 7, 2, 38, 0x00000000U, "z900.2", "IBM zSeries 
>> 900 GA2"),
>>       CPUDEF_INIT(0x2064, 7, 3, 38, 0x00000000U, "z900.3", "IBM zSeries 
>> 900 GA3"),
>> @@ -64,6 +72,7 @@ static S390CPUDef s390_cpu_defs[] = {
>>       CPUDEF_INIT(0x2096, 9, 2, 40, 0x00000000U, "z9BC", "IBM System z9 BC 
>> GA1"),
>>       CPUDEF_INIT(0x2094, 9, 3, 40, 0x00000000U, "z9EC.3", "IBM System z9 
>> EC GA3"),
>>       CPUDEF_INIT(0x2096, 9, 3, 40, 0x00000000U, "z9BC.2", "IBM System z9 
>> BC GA2"),
>> +#endif
>>       CPUDEF_INIT(0x2097, 10, 1, 43, 0x00000000U, "z10EC", "IBM System z10 
>> EC GA1"),
>>       CPUDEF_INIT(0x2097, 10, 2, 43, 0x00000000U, "z10EC.2", "IBM System 
>> z10 EC GA2"),
>>       CPUDEF_INIT(0x2098, 10, 2, 43, 0x00000000U, "z10BC", "IBM System z10 
>> BC GA1"),
>> diff --git a/target/s390x/Kconfig b/target/s390x/Kconfig
>> index d886be48b4..8a95f2bc3f 100644
>> --- a/target/s390x/Kconfig
>> +++ b/target/s390x/Kconfig
>> @@ -2,3 +2,8 @@ config S390X
>>       bool
>>       select PCI
>>       select S390_FLIC
>> +
>> +config S390X_LEGACY_CPUS
>> +    bool
>> +    default y
> 
> Do we have plan to deprecate or switch that off?

No, this is mainly a config knob for downstream builds that do not want to 
include legacy CPUs, but for upstream it should be fine to keep those around.

Why do you ask?

  Thomas



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PULL 11/11] target/s390x: Add a CONFIG switch to disable legacy CPUs
  2025-03-07 15:33     ` Thomas Huth
@ 2025-03-07 16:01       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-07 16:01 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel; +Cc: Christian Borntraeger, Richard Henderson

On 7/3/25 16:33, Thomas Huth wrote:
> On 07/03/2025 16.27, Philippe Mathieu-Daudé wrote:
>> Hi Thomas,
>>
>> On 24/6/24 11:10, Thomas Huth wrote:
>>> The oldest model that IBM still supports is the z13. Considering
>>> that each generation can "emulate" the previous two generations
>>> in hardware (via the "IBC" feature of the CPUs), this means that
>>> everything that is older than z114/196 is not an officially supported
>>> CPU model anymore. The Linux kernel still support the z10, so if
>>> we also take this into account, everything older than that can
>>> definitely be considered as a legacy CPU model.
>>>
>>> For downstream builds of QEMU, we would like to be able to disable
>>> these legacy CPUs in the build. Thus add a CONFIG switch that can be
>>> used to disable them (and old machine types that use them by default).
>>>
>>> Message-Id: <20240614125019.588928-1-thuth@redhat.com>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>>   hw/s390x/s390-virtio-ccw.c | 5 +++++
>>>   target/s390x/cpu_models.c  | 9 +++++++++
>>>   target/s390x/Kconfig       | 5 +++++
>>>   3 files changed, 19 insertions(+)
>>>
>>> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
>>> index 3d0bc3e7f2..cd063f8b64 100644
>>> --- a/hw/s390x/s390-virtio-ccw.c
>>> +++ b/hw/s390x/s390-virtio-ccw.c
>>> @@ -47,6 +47,7 @@
>>>   #include "migration/blocker.h"
>>>   #include "qapi/visitor.h"
>>>   #include "hw/s390x/cpu-topology.h"
>>> +#include CONFIG_DEVICES
>>>   static Error *pv_mig_blocker;
>>> @@ -1126,6 +1127,8 @@ static void 
>>> ccw_machine_2_12_class_options(MachineClass *mc)
>>>   }
>>>   DEFINE_CCW_MACHINE(2_12, "2.12", false);
>>> +#ifdef CONFIG_S390X_LEGACY_CPUS
>>> +
>>>   static void ccw_machine_2_11_instance_options(MachineState *machine)
>>>   {
>>>       static const S390FeatInit qemu_cpu_feat = 
>>> { S390_FEAT_LIST_QEMU_V2_11 };
>>> @@ -1272,6 +1275,8 @@ static void 
>>> ccw_machine_2_4_class_options(MachineClass *mc)
>>>   }
>>>   DEFINE_CCW_MACHINE(2_4, "2.4", false);
>>> +#endif
>>> +
>>>   static void ccw_machine_register_types(void)
>>>   {
>>>       type_register_static(&ccw_machine_info);
>>> diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
>>> index efb508cd2e..a27f4b6f79 100644
>>> --- a/target/s390x/cpu_models.c
>>> +++ b/target/s390x/cpu_models.c
>>> @@ -25,6 +25,7 @@
>>>   #ifndef CONFIG_USER_ONLY
>>>   #include "sysemu/sysemu.h"
>>>   #include "target/s390x/kvm/pv.h"
>>> +#include CONFIG_DEVICES
>>>   #endif
>>>   #define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, 
>>> _desc) \
>>> @@ -47,6 +48,13 @@
>>>    * generation 15 one base feature and one optional feature have 
>>> been deprecated.
>>>    */
>>>   static S390CPUDef s390_cpu_defs[] = {
>>> +    /*
>>> +     * Linux requires at least z10 nowadays, and IBM only supports 
>>> recent CPUs
>>> +     * (see https://www.ibm.com/support/pages/ibm-mainframe-life- 
>>> cycle- history),
>>> +     * so we consider older CPUs as legacy that can optionally be 
>>> disabled via
>>> +     * the CONFIG_S390X_LEGACY_CPUS config switch.
>>> +     */
>>> +#if defined(CONFIG_S390X_LEGACY_CPUS) || defined(CONFIG_USER_ONLY)
>>>       CPUDEF_INIT(0x2064, 7, 1, 38, 0x00000000U, "z900", "IBM zSeries 
>>> 900 GA1"),
>>>       CPUDEF_INIT(0x2064, 7, 2, 38, 0x00000000U, "z900.2", "IBM 
>>> zSeries 900 GA2"),
>>>       CPUDEF_INIT(0x2064, 7, 3, 38, 0x00000000U, "z900.3", "IBM 
>>> zSeries 900 GA3"),
>>> @@ -64,6 +72,7 @@ static S390CPUDef s390_cpu_defs[] = {
>>>       CPUDEF_INIT(0x2096, 9, 2, 40, 0x00000000U, "z9BC", "IBM System 
>>> z9 BC GA1"),
>>>       CPUDEF_INIT(0x2094, 9, 3, 40, 0x00000000U, "z9EC.3", "IBM 
>>> System z9 EC GA3"),
>>>       CPUDEF_INIT(0x2096, 9, 3, 40, 0x00000000U, "z9BC.2", "IBM 
>>> System z9 BC GA2"),
>>> +#endif
>>>       CPUDEF_INIT(0x2097, 10, 1, 43, 0x00000000U, "z10EC", "IBM 
>>> System z10 EC GA1"),
>>>       CPUDEF_INIT(0x2097, 10, 2, 43, 0x00000000U, "z10EC.2", "IBM 
>>> System z10 EC GA2"),
>>>       CPUDEF_INIT(0x2098, 10, 2, 43, 0x00000000U, "z10BC", "IBM 
>>> System z10 BC GA1"),
>>> diff --git a/target/s390x/Kconfig b/target/s390x/Kconfig
>>> index d886be48b4..8a95f2bc3f 100644
>>> --- a/target/s390x/Kconfig
>>> +++ b/target/s390x/Kconfig
>>> @@ -2,3 +2,8 @@ config S390X
>>>       bool
>>>       select PCI
>>>       select S390_FLIC
>>> +
>>> +config S390X_LEGACY_CPUS
>>> +    bool
>>> +    default y
>>
>> Do we have plan to deprecate or switch that off?
> 
> No, this is mainly a config knob for downstream builds that do not want 
> to include legacy CPUs, but for upstream it should be fine to keep those 
> around.
> 
> Why do you ask?

WRT single binary, trying to split target/ VS hw/, I was hoping Kconfig
switches would only affect hw/. CPUs are odd devices sitting in between.

Generic registration of QOM types isn't a trivial task neither...

Anyway I can postpone this file analysis, since s390x is a "simple"
target in my setup :)


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-03-07 16:03 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-24  9:10 [PULL 00/11] s390x and qtest patches 2024-06-24 Thomas Huth
2024-06-24  9:10 ` [PULL 01/11] hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool Thomas Huth
2024-06-24  9:10 ` [PULL 02/11] s390x/css: Make CCWDeviceClass::realize return bool Thomas Huth
2024-06-24  9:10 ` [PULL 03/11] hw/s390x/ccw: Remove local Error variable from s390_ccw_realize() Thomas Huth
2024-06-24  9:10 ` [PULL 04/11] s390x/css: Make S390CCWDeviceClass::realize return bool Thomas Huth
2024-06-24  9:10 ` [PULL 05/11] vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize() Thomas Huth
2024-06-24  9:10 ` [PULL 06/11] vfio/ccw: Fix the missed unrealize() call in error path Thomas Huth
2024-06-24  9:10 ` [PULL 07/11] vfio/{ap, ccw}: Use warn_report_err() for IRQ notifier registration errors Thomas Huth
2024-06-24  9:10 ` [PULL 08/11] tests/qtest/fuzz: fix memleak in qos_fuzz.c Thomas Huth
2024-06-24  9:10 ` [PULL 09/11] target/s390x/arch_dump: use correct byte order for pid Thomas Huth
2024-06-24  9:10 ` [PULL 10/11] MAINTAINERS: Cover all tests/qtest/migration-* files Thomas Huth
2024-06-24  9:10 ` [PULL 11/11] target/s390x: Add a CONFIG switch to disable legacy CPUs Thomas Huth
2025-03-07 15:27   ` Philippe Mathieu-Daudé
2025-03-07 15:33     ` Thomas Huth
2025-03-07 16:01       ` Philippe Mathieu-Daudé
2024-06-24 20:50 ` [PULL 00/11] s390x and qtest patches 2024-06-24 Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).