[PATCH 3/3] hw/ppc/virtex_ml507: Replace tswap32() by stl_endian_p()

Philippe Mathieu-Daudé posted 3 patches 1 month, 3 weeks ago
[PATCH 3/3] hw/ppc/virtex_ml507: Replace tswap32() by stl_endian_p()
Posted by Philippe Mathieu-Daudé 1 month, 3 weeks ago
Replace the target-specific tswap32() call by stl_endian_p()
which does the same but takes the endianness as argument, thus
is target-agnostic.
Get the vCPU endianness calling ppc_cpu_is_big_endian().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/virtex_ml507.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index c49da1f46f..135dcbde06 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -141,7 +141,7 @@ static void main_cpu_reset(void *opaque)
 
     /* Create a mapping for the kernel.  */
     mmubooke_create_initial_mapping(env, 0, 0);
-    env->gpr[6] = tswap32(EPAPR_MAGIC);
+    stl_endian_p(ppc_cpu_is_big_endian(CPU(cpu)), &env->gpr[6], EPAPR_MAGIC);
     env->gpr[7] = bi->ima_size;
 }
 
-- 
2.45.2


Re: [PATCH 3/3] hw/ppc/virtex_ml507: Replace tswap32() by stl_endian_p()
Posted by BALATON Zoltan 1 month, 3 weeks ago
On Mon, 30 Sep 2024, Philippe Mathieu-Daudé wrote:
> Replace the target-specific tswap32() call by stl_endian_p()
> which does the same but takes the endianness as argument, thus
> is target-agnostic.
> Get the vCPU endianness calling ppc_cpu_is_big_endian().

I don't know about virtex but maybe the same comment applies as for 
sam460ex.

Regards,
BALATON Zoltan

> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/ppc/virtex_ml507.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
> index c49da1f46f..135dcbde06 100644
> --- a/hw/ppc/virtex_ml507.c
> +++ b/hw/ppc/virtex_ml507.c
> @@ -141,7 +141,7 @@ static void main_cpu_reset(void *opaque)
>
>     /* Create a mapping for the kernel.  */
>     mmubooke_create_initial_mapping(env, 0, 0);
> -    env->gpr[6] = tswap32(EPAPR_MAGIC);
> +    stl_endian_p(ppc_cpu_is_big_endian(CPU(cpu)), &env->gpr[6], EPAPR_MAGIC);
>     env->gpr[7] = bi->ima_size;
> }
>
>