[PATCH 1/6] hw/alpha: Use explicit little-endian LD/ST API

Philippe Mathieu-Daudé posted 6 patches 1 month, 2 weeks ago
Maintainers: Laurent Vivier <laurent@vivier.eu>, Richard Henderson <richard.henderson@linaro.org>
There is a newer version of this series
[PATCH 1/6] hw/alpha: Use explicit little-endian LD/ST API
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
The Alpha architecture uses little endianness. Directly
use the little-endian LD/ST API.

Mechanical change running:

  $ for a in uw w l q; do \
      sed -i -e "s/ld${a}_p(/ld${a}_le_p(/" \
        $(git grep -wlE '(ld|st)u?[wlq]_p' hw/alpha/);
    done

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/alpha/dp264.c   | 11 +++++------
 hw/alpha/typhoon.c |  4 ++--
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index b6155646ef7..203b9ce92d7 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -194,12 +194,11 @@ static void clipper_init(MachineState *machine)
             load_image_targphys(initrd_filename, initrd_base,
                                 ram_size - initrd_base, NULL);
 
-            address_space_stq(&address_space_memory, param_offset + 0x100,
-                              initrd_base + 0xfffffc0000000000ULL,
-                              MEMTXATTRS_UNSPECIFIED,
-                              NULL);
-            address_space_stq(&address_space_memory, param_offset + 0x108,
-                              initrd_size, MEMTXATTRS_UNSPECIFIED, NULL);
+            address_space_stq_le(&address_space_memory, param_offset + 0x100,
+                                 initrd_base + 0xfffffc0000000000ULL,
+                                 MEMTXATTRS_UNSPECIFIED, NULL);
+            address_space_stq_le(&address_space_memory, param_offset + 0x108,
+                                 initrd_size, MEMTXATTRS_UNSPECIFIED, NULL);
         }
     }
 }
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index 4c56f981d71..0a039dc8a31 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -622,8 +622,8 @@ static bool make_iommu_tlbe(hwaddr taddr, hwaddr mask, IOMMUTLBEntry *ret)
    translation, given the address of the PTE.  */
 static bool pte_translate(hwaddr pte_addr, IOMMUTLBEntry *ret)
 {
-    uint64_t pte = address_space_ldq(&address_space_memory, pte_addr,
-                                     MEMTXATTRS_UNSPECIFIED, NULL);
+    uint64_t pte = address_space_ldq_le(&address_space_memory, pte_addr,
+                                        MEMTXATTRS_UNSPECIFIED, NULL);
 
     /* Check valid bit.  */
     if ((pte & 1) == 0) {
-- 
2.52.0


Re: [PATCH 1/6] hw/alpha: Use explicit little-endian LD/ST API
Posted by Richard Henderson 1 month, 1 week ago
On 12/25/25 03:00, Philippe Mathieu-Daudé wrote:
> The Alpha architecture uses little endianness. Directly
> use the little-endian LD/ST API.
> 
> Mechanical change running:
> 
>    $ for a in uw w l q; do \
>        sed -i -e "s/ld${a}_p(/ld${a}_le_p(/" \
>          $(git grep -wlE '(ld|st)u?[wlq]_p' hw/alpha/);
>      done
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   hw/alpha/dp264.c   | 11 +++++------
>   hw/alpha/typhoon.c |  4 ++--
>   2 files changed, 7 insertions(+), 8 deletions(-)

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

r~

Re: [PATCH 1/6] hw/alpha: Use explicit little-endian LD/ST API
Posted by Manos Pitsidianakis 1 month, 2 weeks ago
On Wed, Dec 24, 2025 at 6:00 PM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> The Alpha architecture uses little endianness. Directly
> use the little-endian LD/ST API.
>
> Mechanical change running:
>
>   $ for a in uw w l q; do \
>       sed -i -e "s/ld${a}_p(/ld${a}_le_p(/" \
>         $(git grep -wlE '(ld|st)u?[wlq]_p' hw/alpha/);
>     done
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

>  hw/alpha/dp264.c   | 11 +++++------
>  hw/alpha/typhoon.c |  4 ++--
>  2 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index b6155646ef7..203b9ce92d7 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -194,12 +194,11 @@ static void clipper_init(MachineState *machine)
>              load_image_targphys(initrd_filename, initrd_base,
>                                  ram_size - initrd_base, NULL);
>
> -            address_space_stq(&address_space_memory, param_offset + 0x100,
> -                              initrd_base + 0xfffffc0000000000ULL,
> -                              MEMTXATTRS_UNSPECIFIED,
> -                              NULL);
> -            address_space_stq(&address_space_memory, param_offset + 0x108,
> -                              initrd_size, MEMTXATTRS_UNSPECIFIED, NULL);
> +            address_space_stq_le(&address_space_memory, param_offset + 0x100,
> +                                 initrd_base + 0xfffffc0000000000ULL,
> +                                 MEMTXATTRS_UNSPECIFIED, NULL);
> +            address_space_stq_le(&address_space_memory, param_offset + 0x108,
> +                                 initrd_size, MEMTXATTRS_UNSPECIFIED, NULL);
>          }
>      }
>  }
> diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
> index 4c56f981d71..0a039dc8a31 100644
> --- a/hw/alpha/typhoon.c
> +++ b/hw/alpha/typhoon.c
> @@ -622,8 +622,8 @@ static bool make_iommu_tlbe(hwaddr taddr, hwaddr mask, IOMMUTLBEntry *ret)
>     translation, given the address of the PTE.  */
>  static bool pte_translate(hwaddr pte_addr, IOMMUTLBEntry *ret)
>  {
> -    uint64_t pte = address_space_ldq(&address_space_memory, pte_addr,
> -                                     MEMTXATTRS_UNSPECIFIED, NULL);
> +    uint64_t pte = address_space_ldq_le(&address_space_memory, pte_addr,
> +                                        MEMTXATTRS_UNSPECIFIED, NULL);
>
>      /* Check valid bit.  */
>      if ((pte & 1) == 0) {
> --
> 2.52.0
>