[PATCH-for-11.0 v3 20/22] target/ppc: Inline cpu_ldl_data_ra() calls in ICBI helper

Philippe Mathieu-Daudé posted 22 patches 2 months, 2 weeks ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Laurent Vivier <laurent@vivier.eu>, Brian Cain <brian.cain@oss.qualcomm.com>, Helge Deller <deller@gmx.de>, Zhao Liu <zhao1.liu@intel.com>, Eduardo Habkost <eduardo@habkost.net>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <arikalo@gmail.com>, Nicholas Piggin <npiggin@gmail.com>, Chinmay Rath <rathc@linux.ibm.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Yoshinori Sato <yoshinori.sato@nifty.com>, Ilya Leoshkevich <iii@linux.ibm.com>, David Hildenbrand <david@kernel.org>, Thomas Huth <thuth@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
[PATCH-for-11.0 v3 20/22] target/ppc: Inline cpu_ldl_data_ra() calls in ICBI helper
Posted by Philippe Mathieu-Daudé 2 months, 2 weeks ago
Inline the cpu_ldl_data_ra() call in preparation of
removing it. Since the returned value is discarded,
don't bother to set the access endianness.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/ppc/mem_helper.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c
index a43726d4223..cff385b6020 100644
--- a/target/ppc/mem_helper.c
+++ b/target/ppc/mem_helper.c
@@ -344,14 +344,18 @@ void helper_dcbzl(CPUPPCState *env, target_ulong addr)
 
 void helper_icbi(CPUPPCState *env, target_ulong addr)
 {
+    unsigned mmu_idx = cpu_mmu_index(env_cpu(env), false);
+    MemOpIdx oi = make_memop_idx(MO_UL | MO_UNALN, mmu_idx);
+
     addr &= ~(env->dcache_line_size - 1);
     /*
      * Invalidate one cache line :
      * PowerPC specification says this is to be treated like a load
      * (not a fetch) by the MMU. To be sure it will be so,
-     * do the load "by hand".
+     * do the load "by hand". As the returned data is not consumed,
+     * endianness is irrelevant.
      */
-    cpu_ldl_data_ra(env, addr, GETPC());
+    cpu_ldl_mmu(env, addr, oi, GETPC());
 }
 
 void helper_icbiep(CPUPPCState *env, target_ulong addr)
-- 
2.51.0


Re: [PATCH-for-11.0 v3 20/22] target/ppc: Inline cpu_ldl_data_ra() calls in ICBI helper
Posted by Richard Henderson 1 month, 4 weeks ago
On 11/26/25 14:21, Philippe Mathieu-Daudé wrote:
> Inline the cpu_ldl_data_ra() call in preparation of
> removing it. Since the returned value is discarded,
> don't bother to set the access endianness.
> 

Hah!  The previous patch could have used the same comment.
Or maybe moving that hunk here.


> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/ppc/mem_helper.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c
> index a43726d4223..cff385b6020 100644
> --- a/target/ppc/mem_helper.c
> +++ b/target/ppc/mem_helper.c
> @@ -344,14 +344,18 @@ void helper_dcbzl(CPUPPCState *env, target_ulong addr)
>   
>   void helper_icbi(CPUPPCState *env, target_ulong addr)
>   {
> +    unsigned mmu_idx = cpu_mmu_index(env_cpu(env), false);
> +    MemOpIdx oi = make_memop_idx(MO_UL | MO_UNALN, mmu_idx);
> +
>       addr &= ~(env->dcache_line_size - 1);
>       /*
>        * Invalidate one cache line :
>        * PowerPC specification says this is to be treated like a load
>        * (not a fetch) by the MMU. To be sure it will be so,
> -     * do the load "by hand".
> +     * do the load "by hand". As the returned data is not consumed,
> +     * endianness is irrelevant.
>        */
> -    cpu_ldl_data_ra(env, addr, GETPC());
> +    cpu_ldl_mmu(env, addr, oi, GETPC());
>   }
>   
>   void helper_icbiep(CPUPPCState *env, target_ulong addr)


Re: [PATCH-for-11.0 v3 20/22] target/ppc: Inline cpu_ldl_data_ra() calls in ICBI helper
Posted by Philippe Mathieu-Daudé 2 weeks, 5 days ago
On 12/12/25 18:01, Richard Henderson wrote:
> On 11/26/25 14:21, Philippe Mathieu-Daudé wrote:
>> Inline the cpu_ldl_data_ra() call in preparation of
>> removing it. Since the returned value is discarded,
>> don't bother to set the access endianness.
>>
> 
> Hah!  The previous patch could have used the same comment.
> Or maybe moving that hunk here.

Ah indeed, I wanted the helper_icbiep() hunk here, thanks.

> 
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   target/ppc/mem_helper.c | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c
>> index a43726d4223..cff385b6020 100644
>> --- a/target/ppc/mem_helper.c
>> +++ b/target/ppc/mem_helper.c
>> @@ -344,14 +344,18 @@ void helper_dcbzl(CPUPPCState *env, target_ulong 
>> addr)
>>   void helper_icbi(CPUPPCState *env, target_ulong addr)
>>   {
>> +    unsigned mmu_idx = cpu_mmu_index(env_cpu(env), false);
>> +    MemOpIdx oi = make_memop_idx(MO_UL | MO_UNALN, mmu_idx);
>> +
>>       addr &= ~(env->dcache_line_size - 1);
>>       /*
>>        * Invalidate one cache line :
>>        * PowerPC specification says this is to be treated like a load
>>        * (not a fetch) by the MMU. To be sure it will be so,
>> -     * do the load "by hand".
>> +     * do the load "by hand". As the returned data is not consumed,
>> +     * endianness is irrelevant.
>>        */
>> -    cpu_ldl_data_ra(env, addr, GETPC());
>> +    cpu_ldl_mmu(env, addr, oi, GETPC());
>>   }
>>   void helper_icbiep(CPUPPCState *env, target_ulong addr)
>