qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] hw/s390x: Remove s390-ccw-virtio-4.2 machine
@ 2025-10-20  9:48 Philippe Mathieu-Daudé
  2025-10-20  9:49 ` [PATCH v2 1/3] hw/s390x/ccw: Remove deprecated " Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-20  9:48 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eric Farman, Philippe Mathieu-Daudé, Ilya Leoshkevich,
	qemu-s390x, Thomas Huth, Eduardo Habkost, Yanan Wang, Zhao Liu,
	Marcel Apfelbaum, Halil Pasic, Jason Herne, David Hildenbrand,
	Matthew Rosato, Richard Henderson, Christian Borntraeger

Since v1:
- Do not remove s390-ccw-virtio-5.0 -> 7.2 machines (Thomas)
- Remove MachineClass::fixup_ram_size (Thomas)

Remove the deprecated s390-ccw-virtio-4.2 machine, which is
older than 6 years. Remove resulting dead code.

Philippe Mathieu-Daudé (3):
  hw/s390x/ccw: Remove deprecated s390-ccw-virtio-4.2 machine
  hw/s390x/ccw: Remove SCLPDevice::increment_size field
  hw/core/machine: Remove MachineClass::fixup_ram_size callback

 include/hw/boards.h        |  7 -------
 include/hw/s390x/sclp.h    |  5 +----
 hw/core/machine.c          |  3 ---
 hw/s390x/s390-virtio-ccw.c | 33 ---------------------------------
 hw/s390x/sclp.c            | 34 +++-------------------------------
 5 files changed, 4 insertions(+), 78 deletions(-)

-- 
2.51.0



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

* [PATCH v2 1/3] hw/s390x/ccw: Remove deprecated s390-ccw-virtio-4.2 machine
  2025-10-20  9:48 [PATCH v2 0/3] hw/s390x: Remove s390-ccw-virtio-4.2 machine Philippe Mathieu-Daudé
@ 2025-10-20  9:49 ` Philippe Mathieu-Daudé
  2025-10-20 10:20   ` Thomas Huth
  2025-10-20  9:49 ` [PATCH v2 2/3] hw/s390x/ccw: Remove SCLPDevice::increment_size field Philippe Mathieu-Daudé
  2025-10-20  9:49 ` [PATCH v2 3/3] hw/core/machine: Remove MachineClass::fixup_ram_size callback Philippe Mathieu-Daudé
  2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-20  9:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eric Farman, Philippe Mathieu-Daudé, Ilya Leoshkevich,
	qemu-s390x, Thomas Huth, Eduardo Habkost, Yanan Wang, Zhao Liu,
	Marcel Apfelbaum, Halil Pasic, Jason Herne, David Hildenbrand,
	Matthew Rosato, Richard Henderson, Christian Borntraeger

This machine has been supported for a period of more than 6 years.
According to our versioned machine support policy (see commit
ce80c4fa6ff "docs: document special exception for machine type
deprecation & removal") it can now be removed.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/s390x/s390-virtio-ccw.c | 33 ---------------------------------
 1 file changed, 33 deletions(-)

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index ad2c48188a8..64b81345f1e 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -715,26 +715,6 @@ static void s390_nmi(NMIState *n, int cpu_index, Error **errp)
     s390_cpu_restart(S390_CPU(cs));
 }
 
-static ram_addr_t s390_fixup_ram_size(ram_addr_t sz)
-{
-    /* same logic as in sclp.c */
-    int increment_size = 20;
-    ram_addr_t newsz;
-
-    while ((sz >> increment_size) > MAX_STORAGE_INCREMENTS) {
-        increment_size++;
-    }
-    newsz = sz >> increment_size << increment_size;
-
-    if (sz != newsz) {
-        qemu_printf("Ram size %" PRIu64 "MB was fixed up to %" PRIu64
-                    "MB to match machine restrictions. Consider updating "
-                    "the guest definition.\n", (uint64_t) (sz / MiB),
-                    (uint64_t) (newsz / MiB));
-    }
-    return newsz;
-}
-
 static inline bool machine_get_aes_key_wrap(Object *obj, Error **errp)
 {
     S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
@@ -1165,19 +1145,6 @@ static void ccw_machine_5_0_class_options(MachineClass *mc)
 }
 DEFINE_CCW_MACHINE(5, 0);
 
-static void ccw_machine_4_2_instance_options(MachineState *machine)
-{
-    ccw_machine_5_0_instance_options(machine);
-}
-
-static void ccw_machine_4_2_class_options(MachineClass *mc)
-{
-    ccw_machine_5_0_class_options(mc);
-    mc->fixup_ram_size = s390_fixup_ram_size;
-    compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len);
-}
-DEFINE_CCW_MACHINE(4, 2);
-
 static void ccw_machine_register_types(void)
 {
     type_register_static(&ccw_machine_info);
-- 
2.51.0



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

* [PATCH v2 2/3] hw/s390x/ccw: Remove SCLPDevice::increment_size field
  2025-10-20  9:48 [PATCH v2 0/3] hw/s390x: Remove s390-ccw-virtio-4.2 machine Philippe Mathieu-Daudé
  2025-10-20  9:49 ` [PATCH v2 1/3] hw/s390x/ccw: Remove deprecated " Philippe Mathieu-Daudé
@ 2025-10-20  9:49 ` Philippe Mathieu-Daudé
  2025-10-20 10:23   ` Thomas Huth
  2025-10-20  9:49 ` [PATCH v2 3/3] hw/core/machine: Remove MachineClass::fixup_ram_size callback Philippe Mathieu-Daudé
  2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-20  9:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eric Farman, Philippe Mathieu-Daudé, Ilya Leoshkevich,
	qemu-s390x, Thomas Huth, Eduardo Habkost, Yanan Wang, Zhao Liu,
	Marcel Apfelbaum, Halil Pasic, Jason Herne, David Hildenbrand,
	Matthew Rosato, Richard Henderson, Christian Borntraeger

The SCLPDevice::increment_size field was only used by the
s390-ccw-virtio-4.2 machine, which got removed. Remove it
as now unused, along with the sclp_memory_init() method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/s390x/sclp.h |  5 +----
 hw/s390x/sclp.c         | 34 +++-------------------------------
 2 files changed, 4 insertions(+), 35 deletions(-)

diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h
index d32f6180e0d..33f01f85bb1 100644
--- a/include/hw/s390x/sclp.h
+++ b/include/hw/s390x/sclp.h
@@ -197,12 +197,9 @@ OBJECT_DECLARE_TYPE(SCLPDevice, SCLPDeviceClass,
 struct SCLPEventFacility;
 
 struct SCLPDevice {
-    /* private */
     DeviceState parent_obj;
-    struct SCLPEventFacility *event_facility;
-    int increment_size;
 
-    /* public */
+    struct SCLPEventFacility *event_facility;
 };
 
 struct SCLPDeviceClass {
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index 8602a566a49..c9a9c4bb375 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -110,7 +110,7 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
     ReadInfo *read_info = (ReadInfo *) sccb;
     MachineState *machine = MACHINE(qdev_get_machine());
     int cpu_count;
-    int rnsize, rnmax;
+    int rnmax;
     int required_len = SCCB_REQ_LEN(ReadInfo, machine->possible_cpus->len);
     int offset_cpu = s390_has_feat(S390_FEAT_EXTENDED_LENGTH_SCCB) ?
                      offsetof(ReadInfo, entries) :
@@ -153,21 +153,14 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
 
     read_info->mha_pow = s390_get_mha_pow();
     read_info->hmfai = cpu_to_be32(s390_get_hmfai());
-
-    rnsize = 1 << (sclp->increment_size - 20);
-    if (rnsize <= 128) {
-        read_info->rnsize = rnsize;
-    } else {
-        read_info->rnsize = 0;
-        read_info->rnsize2 = cpu_to_be32(rnsize);
-    }
+    read_info->rnsize = 1;
 
     /*
      * We don't support standby memory. maxram_size is used for sizing the
      * memory device region, which is not exposed through SCLP but through
      * diag500.
      */
-    rnmax = machine->ram_size >> sclp->increment_size;
+    rnmax = machine->ram_size >> 20;
     if (rnmax < 0x10000) {
         read_info->rnmax = cpu_to_be16(rnmax);
     } else {
@@ -406,25 +399,6 @@ static void sclp_realize(DeviceState *dev, Error **errp)
     }
 }
 
-static void sclp_memory_init(SCLPDevice *sclp)
-{
-    MachineState *machine = MACHINE(qdev_get_machine());
-    MachineClass *machine_class = MACHINE_GET_CLASS(qdev_get_machine());
-    ram_addr_t initial_mem = machine->ram_size;
-    int increment_size = 20;
-
-    /* The storage increment size is a multiple of 1M and is a power of 2.
-     * For some machine types, the number of storage increments must be
-     * MAX_STORAGE_INCREMENTS or fewer.
-     * The variable 'increment_size' is an exponent of 2 that can be
-     * used to calculate the size (in bytes) of an increment. */
-    while (machine_class->fixup_ram_size != NULL &&
-           (initial_mem >> increment_size) > MAX_STORAGE_INCREMENTS) {
-        increment_size++;
-    }
-    sclp->increment_size = increment_size;
-}
-
 static void sclp_init(Object *obj)
 {
     SCLPDevice *sclp = SCLP(obj);
@@ -434,8 +408,6 @@ static void sclp_init(Object *obj)
     object_property_add_child(obj, TYPE_SCLP_EVENT_FACILITY, new);
     object_unref(new);
     sclp->event_facility = EVENT_FACILITY(new);
-
-    sclp_memory_init(sclp);
 }
 
 static void sclp_class_init(ObjectClass *oc, const void *data)
-- 
2.51.0



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

* [PATCH v2 3/3] hw/core/machine: Remove MachineClass::fixup_ram_size callback
  2025-10-20  9:48 [PATCH v2 0/3] hw/s390x: Remove s390-ccw-virtio-4.2 machine Philippe Mathieu-Daudé
  2025-10-20  9:49 ` [PATCH v2 1/3] hw/s390x/ccw: Remove deprecated " Philippe Mathieu-Daudé
  2025-10-20  9:49 ` [PATCH v2 2/3] hw/s390x/ccw: Remove SCLPDevice::increment_size field Philippe Mathieu-Daudé
@ 2025-10-20  9:49 ` Philippe Mathieu-Daudé
  2025-10-20 10:24   ` Thomas Huth
  2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-20  9:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eric Farman, Philippe Mathieu-Daudé, Ilya Leoshkevich,
	qemu-s390x, Thomas Huth, Eduardo Habkost, Yanan Wang, Zhao Liu,
	Marcel Apfelbaum, Halil Pasic, Jason Herne, David Hildenbrand,
	Matthew Rosato, Richard Henderson, Christian Borntraeger

The MachineClass::fixup_ram_size callback, which was added
in commit 5c30ef937f5 ("vl/s390x: fixup ram sizes for compat
machines"), was only used by the s390-ccw-virtio-4.2 machine,
which got removed. Remove it as now unused.

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/boards.h | 7 -------
 hw/core/machine.c   | 3 ---
 2 files changed, 10 deletions(-)

diff --git a/include/hw/boards.h b/include/hw/boards.h
index 665b6201214..d0a69cd490b 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -250,12 +250,6 @@ typedef struct {
  *    It also will be used as a way to option into "-m" option support.
  *    If it's not set by board, '-m' will be ignored and generic code will
  *    not create default RAM MemoryRegion.
- * @fixup_ram_size:
- *    Amends user provided ram size (with -m option) using machine
- *    specific algorithm. To be used by old machine types for compat
- *    purposes only.
- *    Applies only to default memory backend, i.e., explicit memory backend
- *    wasn't used.
  * @smbios_memory_device_size:
  *    Default size of memory device,
  *    SMBIOS 3.1.0 "7.18 Memory Device (Type 17)"
@@ -325,7 +319,6 @@ struct MachineClass {
                                                          unsigned cpu_index);
     const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine);
     int64_t (*get_default_cpu_node_id)(const MachineState *ms, int idx);
-    ram_addr_t (*fixup_ram_size)(ram_addr_t size);
     uint64_t smbios_memory_device_size;
     bool (*create_default_memdev)(MachineState *ms, const char *path,
                                   Error **errp);
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 681adbb7ac5..7aec3916e80 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -648,9 +648,6 @@ static void machine_set_mem(Object *obj, Visitor *v, const char *name,
         mem->size = mc->default_ram_size;
     }
     mem->size = QEMU_ALIGN_UP(mem->size, 8192);
-    if (mc->fixup_ram_size) {
-        mem->size = mc->fixup_ram_size(mem->size);
-    }
     if ((ram_addr_t)mem->size != mem->size) {
         error_setg(errp, "ram size %llu exceeds permitted maximum %llu",
                    (unsigned long long)mem->size,
-- 
2.51.0



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

* Re: [PATCH v2 1/3] hw/s390x/ccw: Remove deprecated s390-ccw-virtio-4.2 machine
  2025-10-20  9:49 ` [PATCH v2 1/3] hw/s390x/ccw: Remove deprecated " Philippe Mathieu-Daudé
@ 2025-10-20 10:20   ` Thomas Huth
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2025-10-20 10:20 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Eric Farman, Ilya Leoshkevich, qemu-s390x, Eduardo Habkost,
	Yanan Wang, Zhao Liu, Marcel Apfelbaum, Halil Pasic, Jason Herne,
	David Hildenbrand, Matthew Rosato, Richard Henderson,
	Christian Borntraeger

On 20/10/2025 11.49, Philippe Mathieu-Daudé wrote:
> This machine has been supported for a period of more than 6 years.
> According to our versioned machine support policy (see commit
> ce80c4fa6ff "docs: document special exception for machine type
> deprecation & removal") it can now be removed.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/s390x/s390-virtio-ccw.c | 33 ---------------------------------
>   1 file changed, 33 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH v2 2/3] hw/s390x/ccw: Remove SCLPDevice::increment_size field
  2025-10-20  9:49 ` [PATCH v2 2/3] hw/s390x/ccw: Remove SCLPDevice::increment_size field Philippe Mathieu-Daudé
@ 2025-10-20 10:23   ` Thomas Huth
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2025-10-20 10:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Eric Farman, Ilya Leoshkevich, qemu-s390x, Eduardo Habkost,
	Yanan Wang, Zhao Liu, Marcel Apfelbaum, Halil Pasic, Jason Herne,
	David Hildenbrand, Matthew Rosato, Richard Henderson,
	Christian Borntraeger

On 20/10/2025 11.49, Philippe Mathieu-Daudé wrote:
> The SCLPDevice::increment_size field was only used by the
> s390-ccw-virtio-4.2 machine, which got removed. Remove it
> as now unused, along with the sclp_memory_init() method.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/s390x/sclp.h |  5 +----
>   hw/s390x/sclp.c         | 34 +++-------------------------------
>   2 files changed, 4 insertions(+), 35 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH v2 3/3] hw/core/machine: Remove MachineClass::fixup_ram_size callback
  2025-10-20  9:49 ` [PATCH v2 3/3] hw/core/machine: Remove MachineClass::fixup_ram_size callback Philippe Mathieu-Daudé
@ 2025-10-20 10:24   ` Thomas Huth
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2025-10-20 10:24 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Eric Farman, Ilya Leoshkevich, qemu-s390x, Eduardo Habkost,
	Yanan Wang, Zhao Liu, Marcel Apfelbaum, Halil Pasic, Jason Herne,
	David Hildenbrand, Matthew Rosato, Richard Henderson,
	Christian Borntraeger

On 20/10/2025 11.49, Philippe Mathieu-Daudé wrote:
> The MachineClass::fixup_ram_size callback, which was added
> in commit 5c30ef937f5 ("vl/s390x: fixup ram sizes for compat
> machines"), was only used by the s390-ccw-virtio-4.2 machine,
> which got removed. Remove it as now unused.
> 
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/boards.h | 7 -------
>   hw/core/machine.c   | 3 ---
>   2 files changed, 10 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

end of thread, other threads:[~2025-10-20 10:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20  9:48 [PATCH v2 0/3] hw/s390x: Remove s390-ccw-virtio-4.2 machine Philippe Mathieu-Daudé
2025-10-20  9:49 ` [PATCH v2 1/3] hw/s390x/ccw: Remove deprecated " Philippe Mathieu-Daudé
2025-10-20 10:20   ` Thomas Huth
2025-10-20  9:49 ` [PATCH v2 2/3] hw/s390x/ccw: Remove SCLPDevice::increment_size field Philippe Mathieu-Daudé
2025-10-20 10:23   ` Thomas Huth
2025-10-20  9:49 ` [PATCH v2 3/3] hw/core/machine: Remove MachineClass::fixup_ram_size callback Philippe Mathieu-Daudé
2025-10-20 10:24   ` Thomas Huth

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).