[PATCH 0/8] target/loongarch: Use explicit little-endian LD/ST API

Philippe Mathieu-Daudé posted 8 patches 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251224161456.89707-1-philmd@linaro.org
Maintainers: Laurent Vivier <laurent@vivier.eu>, Song Gao <gaosong@loongson.cn>, Bibo Mao <maobibo@loongson.cn>, Jiaxun Yang <jiaxun.yang@flygoat.com>
configs/targets/loongarch64-linux-user.mak    |  1 +
configs/targets/loongarch64-softmmu.mak       |  1 +
hw/loongarch/virt.c                           | 18 ++---
target/loongarch/cpu_helper.c                 | 12 +--
target/loongarch/tcg/iocsr_helper.c           | 24 +++---
target/loongarch/tcg/tcg_cpu.c                |  4 +-
target/loongarch/tcg/tlb_helper.c             | 10 ++-
target/loongarch/tcg/translate.c              |  3 +-
.../tcg/insn_trans/trans_atomic.c.inc         | 80 +++++++++----------
.../tcg/insn_trans/trans_fmemory.c.inc        | 32 ++++----
.../tcg/insn_trans/trans_memory.c.inc         | 64 +++++++--------
.../loongarch/tcg/insn_trans/trans_vec.c.inc  | 16 ++--
12 files changed, 136 insertions(+), 129 deletions(-)
[PATCH 0/8] target/loongarch: Use explicit little-endian LD/ST API
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
LoongArch is little-endian. Use the explicit 'little'
endianness instead of the 'native' one.
Remove some target_ulong uses. Forbid further uses of
legacy APIs.

tag: https://gitlab.com/philmd/qemu/-/tags/endian_loongarch-v1
CI: https://gitlab.com/philmd/qemu/-/pipelines/2231223066

Philippe Mathieu-Daudé (8):
  hw/loongarch: Use explicit little-endian LD/ST API
  target/loongarch: Replace target_ulong -> uint64_t for DMW and
    TLBRBADV
  target/loongarch: Use hwaddr type for physical addresses
  target/loongarch: Replace MO_TE -> MO_LE
  target/loongarch: Inline cpu_ldl_code() call in cpu_do_interrupt()
  target/loongarch: Use explicit little-endian LD/ST API
  target/loongarch: Inline translator_ldl()
  configs/targets: Forbid LoongArch to use legacy native endianness APIs

 configs/targets/loongarch64-linux-user.mak    |  1 +
 configs/targets/loongarch64-softmmu.mak       |  1 +
 hw/loongarch/virt.c                           | 18 ++---
 target/loongarch/cpu_helper.c                 | 12 +--
 target/loongarch/tcg/iocsr_helper.c           | 24 +++---
 target/loongarch/tcg/tcg_cpu.c                |  4 +-
 target/loongarch/tcg/tlb_helper.c             | 10 ++-
 target/loongarch/tcg/translate.c              |  3 +-
 .../tcg/insn_trans/trans_atomic.c.inc         | 80 +++++++++----------
 .../tcg/insn_trans/trans_fmemory.c.inc        | 32 ++++----
 .../tcg/insn_trans/trans_memory.c.inc         | 64 +++++++--------
 .../loongarch/tcg/insn_trans/trans_vec.c.inc  | 16 ++--
 12 files changed, 136 insertions(+), 129 deletions(-)

-- 
2.52.0


Re: [PATCH 0/8] target/loongarch: Use explicit little-endian LD/ST API
Posted by Bibo Mao 1 month, 2 weeks ago

On 2025/12/25 上午12:14, Philippe Mathieu-Daudé wrote:
> LoongArch is little-endian. Use the explicit 'little'
> endianness instead of the 'native' one.
> Remove some target_ulong uses. Forbid further uses of
> legacy APIs.
> 
> tag: https://gitlab.com/philmd/qemu/-/tags/endian_loongarch-v1
> CI: https://gitlab.com/philmd/qemu/-/pipelines/2231223066
> 
> Philippe Mathieu-Daudé (8):
>    hw/loongarch: Use explicit little-endian LD/ST API
>    target/loongarch: Replace target_ulong -> uint64_t for DMW and
>      TLBRBADV
>    target/loongarch: Use hwaddr type for physical addresses
>    target/loongarch: Replace MO_TE -> MO_LE
>    target/loongarch: Inline cpu_ldl_code() call in cpu_do_interrupt()
>    target/loongarch: Use explicit little-endian LD/ST API
>    target/loongarch: Inline translator_ldl()
>    configs/targets: Forbid LoongArch to use legacy native endianness APIs
> 
>   configs/targets/loongarch64-linux-user.mak    |  1 +
>   configs/targets/loongarch64-softmmu.mak       |  1 +
>   hw/loongarch/virt.c                           | 18 ++---
>   target/loongarch/cpu_helper.c                 | 12 +--
>   target/loongarch/tcg/iocsr_helper.c           | 24 +++---
>   target/loongarch/tcg/tcg_cpu.c                |  4 +-
>   target/loongarch/tcg/tlb_helper.c             | 10 ++-
>   target/loongarch/tcg/translate.c              |  3 +-
>   .../tcg/insn_trans/trans_atomic.c.inc         | 80 +++++++++----------
>   .../tcg/insn_trans/trans_fmemory.c.inc        | 32 ++++----
>   .../tcg/insn_trans/trans_memory.c.inc         | 64 +++++++--------
>   .../loongarch/tcg/insn_trans/trans_vec.c.inc  | 16 ++--
>   12 files changed, 136 insertions(+), 129 deletions(-)
> 
Thanks for doing this on LoongArch, this series looks good to me.

Reviewed-by: Bibo Mao <maobibo@loongson.cn>


Re: [PATCH 0/8] target/loongarch: Use explicit little-endian LD/ST API
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
On 25/12/25 03:17, Bibo Mao wrote:
> 
> 
> On 2025/12/25 上午12:14, Philippe Mathieu-Daudé wrote:
>> LoongArch is little-endian. Use the explicit 'little'
>> endianness instead of the 'native' one.
>> Remove some target_ulong uses. Forbid further uses of
>> legacy APIs.
>>
>> tag: https://gitlab.com/philmd/qemu/-/tags/endian_loongarch-v1
>> CI: https://gitlab.com/philmd/qemu/-/pipelines/2231223066
>>
>> Philippe Mathieu-Daudé (8):
>>    hw/loongarch: Use explicit little-endian LD/ST API
>>    target/loongarch: Replace target_ulong -> uint64_t for DMW and
>>      TLBRBADV
>>    target/loongarch: Use hwaddr type for physical addresses
>>    target/loongarch: Replace MO_TE -> MO_LE
>>    target/loongarch: Inline cpu_ldl_code() call in cpu_do_interrupt()
>>    target/loongarch: Use explicit little-endian LD/ST API
>>    target/loongarch: Inline translator_ldl()
>>    configs/targets: Forbid LoongArch to use legacy native endianness APIs
>>
>>   configs/targets/loongarch64-linux-user.mak    |  1 +
>>   configs/targets/loongarch64-softmmu.mak       |  1 +
>>   hw/loongarch/virt.c                           | 18 ++---
>>   target/loongarch/cpu_helper.c                 | 12 +--
>>   target/loongarch/tcg/iocsr_helper.c           | 24 +++---
>>   target/loongarch/tcg/tcg_cpu.c                |  4 +-
>>   target/loongarch/tcg/tlb_helper.c             | 10 ++-
>>   target/loongarch/tcg/translate.c              |  3 +-
>>   .../tcg/insn_trans/trans_atomic.c.inc         | 80 +++++++++----------
>>   .../tcg/insn_trans/trans_fmemory.c.inc        | 32 ++++----
>>   .../tcg/insn_trans/trans_memory.c.inc         | 64 +++++++--------
>>   .../loongarch/tcg/insn_trans/trans_vec.c.inc  | 16 ++--
>>   12 files changed, 136 insertions(+), 129 deletions(-)
>>
> Thanks for doing this on LoongArch, this series looks good to me.

Thanks. Low hanging fruit, so better to clean it now (by blocking
further legacy API uses) than later. These changes makes LoongArch
closer to be used in heterogenous setup :)

> 
> Reviewed-by: Bibo Mao <maobibo@loongson.cn>
>