[PATCH 3/4] hw/microblaze: Remove the big-endian variants of ml605 and xlnx-zynqmp-pmu

Thomas Huth posted 4 patches 7 months ago
Maintainers: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Alistair Francis <alistair@alistair23.me>, Peter Maydell <peter.maydell@linaro.org>
[PATCH 3/4] hw/microblaze: Remove the big-endian variants of ml605 and xlnx-zynqmp-pmu
Posted by Thomas Huth 7 months ago
From: Thomas Huth <thuth@redhat.com>

Both machines were added with little-endian in mind only (the
"endianness" CPU property was hard-wired to "true", see commits
133d23b3ad1 and a88bbb006a52), so the variants that showed up
on the big endian target likely never worked. We deprecated these
non-working machine variants two releases ago, and so far nobody
complained, so it should be fine now to disable them. Hard-wire
the machines to little endian now.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 docs/about/deprecated.rst           |  6 ------
 docs/about/removed-features.rst     |  9 +++++++++
 hw/microblaze/petalogix_ml605_mmu.c | 15 ++++-----------
 hw/microblaze/xlnx-zynqmp-pmu.c     |  7 +------
 4 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 1a1b423030c..8c5fe6fb274 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -293,12 +293,6 @@ deprecated; use the new name ``dtb-randomness`` instead. The new name
 better reflects the way this property affects all random data within
 the device tree blob, not just the ``kaslr-seed`` node.
 
-Big-Endian variants of MicroBlaze ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` machines (since 9.2)
-''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-Both ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` were added for little endian
-CPUs. Big endian support is not tested.
-
 Mips ``mipssim`` machine (since 10.0)
 '''''''''''''''''''''''''''''''''''''
 
diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
index 063284d4f8a..9df5aba0bb6 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -1082,6 +1082,15 @@ This machine was removed because PPC 405 CPU have no known users,
 firmware images are not available, OpenWRT dropped support in 2019,
 U-Boot in 2017, and Linux in 2024.
 
+Big-Endian variants of ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` machines (removed in 10.1)
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+Both the MicroBlaze ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` machines
+were added for little endian CPUs. Big endian support was never tested
+and likely never worked. Starting with QEMU v10.1, the machines are now
+only available as little-endian machines.
+
+
 linux-user mode CPUs
 --------------------
 
diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c
index bea6b689fd1..6e923c49cfc 100644
--- a/hw/microblaze/petalogix_ml605_mmu.c
+++ b/hw/microblaze/petalogix_ml605_mmu.c
@@ -80,8 +80,6 @@ petalogix_ml605_init(MachineState *machine)
     MemoryRegion *phys_lmb_bram = g_new(MemoryRegion, 1);
     MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
     qemu_irq irq[32];
-    EndianMode endianness = TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG
-                                              : ENDIAN_MODE_LITTLE;
 
     /* init CPUs */
     cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
@@ -113,7 +111,7 @@ petalogix_ml605_init(MachineState *machine)
 
 
     dev = qdev_new("xlnx.xps-intc");
-    qdev_prop_set_enum(dev, "endianness", endianness);
+    qdev_prop_set_enum(dev, "endianness", ENDIAN_MODE_LITTLE);
     qdev_prop_set_uint32(dev, "kind-of-intr", 1 << TIMER_IRQ);
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, INTC_BASEADDR);
@@ -129,7 +127,7 @@ petalogix_ml605_init(MachineState *machine)
 
     /* 2 timers at irq 2 @ 100 Mhz.  */
     dev = qdev_new("xlnx.xps-timer");
-    qdev_prop_set_enum(dev, "endianness", endianness);
+    qdev_prop_set_enum(dev, "endianness", ENDIAN_MODE_LITTLE);
     qdev_prop_set_uint32(dev, "one-timer-only", 0);
     qdev_prop_set_uint32(dev, "clock-frequency", 100 * 1000000);
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
@@ -177,7 +175,7 @@ petalogix_ml605_init(MachineState *machine)
         SSIBus *spi;
 
         dev = qdev_new("xlnx.xps-spi");
-        qdev_prop_set_enum(dev, "endianness", endianness);
+        qdev_prop_set_enum(dev, "endianness", ENDIAN_MODE_LITTLE);
         qdev_prop_set_uint8(dev, "num-ss-bits", NUM_SPI_FLASHES);
         busdev = SYS_BUS_DEVICE(dev);
         sysbus_realize_and_unref(busdev, &error_fatal);
@@ -218,12 +216,7 @@ petalogix_ml605_init(MachineState *machine)
 
 static void petalogix_ml605_machine_init(MachineClass *mc)
 {
-    if (TARGET_BIG_ENDIAN) {
-        mc->desc = "PetaLogix linux refdesign for xilinx ml605 (big endian)";
-        mc->deprecation_reason = "big endian support is not tested";
-    } else {
-        mc->desc = "PetaLogix linux refdesign for xilinx ml605 (little endian)";
-    }
+    mc->desc = "PetaLogix linux refdesign for xilinx ml605 (little endian)";
     mc->init = petalogix_ml605_init;
 }
 
diff --git a/hw/microblaze/xlnx-zynqmp-pmu.c b/hw/microblaze/xlnx-zynqmp-pmu.c
index ed40b5f2e05..e909802bb74 100644
--- a/hw/microblaze/xlnx-zynqmp-pmu.c
+++ b/hw/microblaze/xlnx-zynqmp-pmu.c
@@ -181,12 +181,7 @@ static void xlnx_zynqmp_pmu_init(MachineState *machine)
 
 static void xlnx_zynqmp_pmu_machine_init(MachineClass *mc)
 {
-    if (TARGET_BIG_ENDIAN) {
-        mc->desc = "Xilinx ZynqMP PMU machine (big endian)";
-        mc->deprecation_reason = "big endian support is not tested";
-    } else {
-        mc->desc = "Xilinx ZynqMP PMU machine (little endian)";
-    }
+    mc->desc = "Xilinx ZynqMP PMU machine (little endian)";
     mc->init = xlnx_zynqmp_pmu_init;
 }
 
-- 
2.49.0
Re: [PATCH 3/4] hw/microblaze: Remove the big-endian variants of ml605 and xlnx-zynqmp-pmu
Posted by Philippe Mathieu-Daudé 6 months, 3 weeks ago
On 15/5/25 15:20, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> Both machines were added with little-endian in mind only (the
> "endianness" CPU property was hard-wired to "true", see commits
> 133d23b3ad1 and a88bbb006a52), so the variants that showed up
> on the big endian target likely never worked. We deprecated these
> non-working machine variants two releases ago, and so far nobody
> complained, so it should be fine now to disable them. Hard-wire
> the machines to little endian now.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   docs/about/deprecated.rst           |  6 ------
>   docs/about/removed-features.rst     |  9 +++++++++
>   hw/microblaze/petalogix_ml605_mmu.c | 15 ++++-----------
>   hw/microblaze/xlnx-zynqmp-pmu.c     |  7 +------
>   4 files changed, 14 insertions(+), 23 deletions(-)

\o/ :~)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Re: [PATCH 3/4] hw/microblaze: Remove the big-endian variants of ml605 and xlnx-zynqmp-pmu
Posted by Richard Henderson 6 months, 3 weeks ago
On 5/15/25 14:20, Thomas Huth wrote:
> From: Thomas Huth<thuth@redhat.com>
> 
> Both machines were added with little-endian in mind only (the
> "endianness" CPU property was hard-wired to "true", see commits
> 133d23b3ad1 and a88bbb006a52), so the variants that showed up
> on the big endian target likely never worked. We deprecated these
> non-working machine variants two releases ago, and so far nobody
> complained, so it should be fine now to disable them. Hard-wire
> the machines to little endian now.
> 
> Signed-off-by: Thomas Huth<thuth@redhat.com>
> ---
>   docs/about/deprecated.rst           |  6 ------
>   docs/about/removed-features.rst     |  9 +++++++++
>   hw/microblaze/petalogix_ml605_mmu.c | 15 ++++-----------
>   hw/microblaze/xlnx-zynqmp-pmu.c     |  7 +------
>   4 files changed, 14 insertions(+), 23 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
Re: [PATCH 3/4] hw/microblaze: Remove the big-endian variants of ml605 and xlnx-zynqmp-pmu
Posted by Philippe Mathieu-Daudé 7 months ago
On 15/5/25 15:20, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> Both machines were added with little-endian in mind only (the
> "endianness" CPU property was hard-wired to "true", see commits
> 133d23b3ad1 and a88bbb006a52), so the variants that showed up
> on the big endian target likely never worked. We deprecated these
> non-working machine variants two releases ago, and so far nobody
> complained, so it should be fine now to disable them. Hard-wire
> the machines to little endian now.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   docs/about/deprecated.rst           |  6 ------
>   docs/about/removed-features.rst     |  9 +++++++++
>   hw/microblaze/petalogix_ml605_mmu.c | 15 ++++-----------
>   hw/microblaze/xlnx-zynqmp-pmu.c     |  7 +------
>   4 files changed, 14 insertions(+), 23 deletions(-)

\o/

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

I won't be able to look at the rest of this series until in 10 days,
feel free to merge if necessary.

Thanks!

Phil.

Re: [PATCH 3/4] hw/microblaze: Remove the big-endian variants of ml605 and xlnx-zynqmp-pmu
Posted by Thomas Huth 7 months ago
On 16/05/2025 17.00, Philippe Mathieu-Daudé wrote:
> On 15/5/25 15:20, Thomas Huth wrote:
>> From: Thomas Huth <thuth@redhat.com>
>>
>> Both machines were added with little-endian in mind only (the
>> "endianness" CPU property was hard-wired to "true", see commits
>> 133d23b3ad1 and a88bbb006a52), so the variants that showed up
>> on the big endian target likely never worked. We deprecated these
>> non-working machine variants two releases ago, and so far nobody
>> complained, so it should be fine now to disable them. Hard-wire
>> the machines to little endian now.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>   docs/about/deprecated.rst           |  6 ------
>>   docs/about/removed-features.rst     |  9 +++++++++
>>   hw/microblaze/petalogix_ml605_mmu.c | 15 ++++-----------
>>   hw/microblaze/xlnx-zynqmp-pmu.c     |  7 +------
>>   4 files changed, 14 insertions(+), 23 deletions(-)
> 
> \o/
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Thanks!

> I won't be able to look at the rest of this series until in 10 days,
> feel free to merge if necessary.

Maybe you could at least provide a quick comment on the idea of controlling 
the endianness of the s3adsp1800 machine via a machine property? (since your 
original idea was to do it via different machine names instead ... does the 
property sound acceptable to you?)

  Thomas


Re: [PATCH 3/4] hw/microblaze: Remove the big-endian variants of ml605 and xlnx-zynqmp-pmu
Posted by Philippe Mathieu-Daudé 6 months, 3 weeks ago
On 16/5/25 16:06, Thomas Huth wrote:
> On 16/05/2025 17.00, Philippe Mathieu-Daudé wrote:
>> On 15/5/25 15:20, Thomas Huth wrote:
>>> From: Thomas Huth <thuth@redhat.com>
>>>
>>> Both machines were added with little-endian in mind only (the
>>> "endianness" CPU property was hard-wired to "true", see commits
>>> 133d23b3ad1 and a88bbb006a52), so the variants that showed up
>>> on the big endian target likely never worked. We deprecated these
>>> non-working machine variants two releases ago, and so far nobody
>>> complained, so it should be fine now to disable them. Hard-wire
>>> the machines to little endian now.
>>>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>>   docs/about/deprecated.rst           |  6 ------
>>>   docs/about/removed-features.rst     |  9 +++++++++
>>>   hw/microblaze/petalogix_ml605_mmu.c | 15 ++++-----------
>>>   hw/microblaze/xlnx-zynqmp-pmu.c     |  7 +------
>>>   4 files changed, 14 insertions(+), 23 deletions(-)
>>
>> \o/
>>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
> Thanks!
> 
>> I won't be able to look at the rest of this series until in 10 days,
>> feel free to merge if necessary.
> 
> Maybe you could at least provide a quick comment on the idea of 
> controlling the endianness of the s3adsp1800 machine via a machine 
> property? (since your original idea was to do it via different machine 
> names instead ... does the property sound acceptable to you?)

IIRC my goal was to remove TARGET_BIG_ENDIAN from hw/, but I was
aiming for heterogeneous binary, trying to not introduce any changes
for users. Now we are only considering "single binary" and we have
the TargetInfo API, so things are simpler.

Using the TargetInfo API, that would be:

-- >8 --
@@ -26,7 +26,8 @@
  #include "qemu/osdep.h"
  #include "qemu/units.h"
  #include "qapi/error.h"
+#include "qemu/target-info.h"
  #include "hw/sysbus.h"
  #include "net/net.h"
  #include "hw/block/flash.h"
@@ -71,13 +83,16 @@ petalogix_s3adsp1800_init(MachineState *machine)
      MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
      qemu_irq irq[32];
      MemoryRegion *sysmem = get_system_memory();
-    EndianMode endianness = TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG
-                                              : ENDIAN_MODE_LITTLE;
+    EndianMode endianness = psms->endianness;
+
+    if (endianness == ENDIAN_MODE_UNSPECIFIED) {
+        endianness = target_endian_mode();
+    }

---

(NB target_endian_mode is not on the list yet)

Re: [PATCH 3/4] hw/microblaze: Remove the big-endian variants of ml605 and xlnx-zynqmp-pmu
Posted by Thomas Huth 6 months, 3 weeks ago
On 25/05/2025 21.19, Philippe Mathieu-Daudé wrote:
> On 16/5/25 16:06, Thomas Huth wrote:
>> On 16/05/2025 17.00, Philippe Mathieu-Daudé wrote:
>>> On 15/5/25 15:20, Thomas Huth wrote:
>>>> From: Thomas Huth <thuth@redhat.com>
>>>>
>>>> Both machines were added with little-endian in mind only (the
>>>> "endianness" CPU property was hard-wired to "true", see commits
>>>> 133d23b3ad1 and a88bbb006a52), so the variants that showed up
>>>> on the big endian target likely never worked. We deprecated these
>>>> non-working machine variants two releases ago, and so far nobody
>>>> complained, so it should be fine now to disable them. Hard-wire
>>>> the machines to little endian now.
>>>>
>>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>>> ---
>>>>   docs/about/deprecated.rst           |  6 ------
>>>>   docs/about/removed-features.rst     |  9 +++++++++
>>>>   hw/microblaze/petalogix_ml605_mmu.c | 15 ++++-----------
>>>>   hw/microblaze/xlnx-zynqmp-pmu.c     |  7 +------
>>>>   4 files changed, 14 insertions(+), 23 deletions(-)
>>>
>>> \o/
>>>
>>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>
>> Thanks!
>>
>>> I won't be able to look at the rest of this series until in 10 days,
>>> feel free to merge if necessary.
>>
>> Maybe you could at least provide a quick comment on the idea of 
>> controlling the endianness of the s3adsp1800 machine via a machine 
>> property? (since your original idea was to do it via different machine 
>> names instead ... does the property sound acceptable to you?)
> 
> IIRC my goal was to remove TARGET_BIG_ENDIAN from hw/, but I was
> aiming for heterogeneous binary, trying to not introduce any changes
> for users. Now we are only considering "single binary" and we have
> the TargetInfo API, so things are simpler.
> 
> Using the TargetInfo API, that would be:
> 
> -- >8 --
> @@ -26,7 +26,8 @@
>   #include "qemu/osdep.h"
>   #include "qemu/units.h"
>   #include "qapi/error.h"
> +#include "qemu/target-info.h"
>   #include "hw/sysbus.h"
>   #include "net/net.h"
>   #include "hw/block/flash.h"
> @@ -71,13 +83,16 @@ petalogix_s3adsp1800_init(MachineState *machine)
>       MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
>       qemu_irq irq[32];
>       MemoryRegion *sysmem = get_system_memory();
> -    EndianMode endianness = TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG
> -                                              : ENDIAN_MODE_LITTLE;
> +    EndianMode endianness = psms->endianness;
> +
> +    if (endianness == ENDIAN_MODE_UNSPECIFIED) {
> +        endianness = target_endian_mode();
> +    }

But one of the ideas of this series here is to finally deprecate 
qemu-system-microblazeel, so we need a way that the user can use to 
configure the endianness of the machine. Does the property look like an 
acceptable way for this to you?

  Thomas