ppc/lv1call: Fix PS3 LV1 clobbering SRR

Christophe Leroy christophe.leroy at csgroup.eu
Wed Nov 19 00:57:25 AEDT 2025



Le 18/11/2025 à 14:42, René Rebe a écrit :
> [Vous ne recevez pas souvent de courriers de rene at exactco.de. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> Since a while booting a PS3 instantly yields:

Can you bisect to say since when, and add a Fixes: tag to the commit ?

> 
> <4>SRR0 was: c0000000000971b4 should be: c0000000002d55c4
> <4>SRR1 was: 8000000000008032 should be: 8000000000008032
> 
> Fix LV1 clobbering SRR by srr_regs_clobbered() each lv1 call.
> Attribute srr_regs_clobbered always_inline for use by modules.
> 
> Signed-off-by: René Rebe <rene at exactco.de>
> ---
>   arch/powerpc/include/asm/interrupt.h | 1 +
>   arch/powerpc/include/asm/lv1call.h   | 3 ++-
>   2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h
> index eb0e4a20b818..783c6f32a395 100644
> --- a/arch/powerpc/include/asm/interrupt.h
> +++ b/arch/powerpc/include/asm/interrupt.h
> @@ -106,6 +106,7 @@ static inline bool is_implicit_soft_masked(struct pt_regs *regs)
>          return search_kernel_soft_mask_table(regs->nip);
>   }
> 
> +__attribute__((always_inline))
>   static inline void srr_regs_clobbered(void)

Instead, use:

	static __always_inline void srr_regs_clobbered(void)

>   {
>          local_paca->srr_valid = 0;
> diff --git a/arch/powerpc/include/asm/lv1call.h b/arch/powerpc/include/asm/lv1call.h
> index ae70120953a8..48dd55a2b72e 100644
> --- a/arch/powerpc/include/asm/lv1call.h
> +++ b/arch/powerpc/include/asm/lv1call.h
> @@ -14,6 +14,7 @@
> 
>   #include <linux/types.h>
>   #include <linux/export.h>
> +#include <asm/interrupt.h>
> 
>   /* lv1 call declaration macros */
> 
> @@ -208,7 +209,7 @@
>   #define LV1_CALL(name, in, out, num)                               \
>     extern s64 _lv1_##name(LV1_##in##_IN_##out##_OUT_ARG_DECL);      \
>     static inline int lv1_##name(LV1_##in##_IN_##out##_OUT_ARG_DECL) \
> -    {return _lv1_##name(LV1_##in##_IN_##out##_OUT_ARGS);}
> +    {srr_regs_clobbered(); return _lv1_##name(LV1_##in##_IN_##out##_OUT_ARGS);}
>   #endif
> 
>   #endif /* !defined(__ASSEMBLER__) */
> --
> 2.46.0
> 
> --
> René Rebe, ExactCODE GmbH, Berlin, Germany
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fexactco.de%2F&data=05%7C02%7Cchristophe.leroy2%40cs-soprasteria.com%7C07bb94cfdba54489c90c08de26a85451%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638990705044093388%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C60000%7C%7C%7C&sdata=d2l1a1ibNVzGLwSDo1wDdHRoNWgvq7AkfZQp2Kp8uZE%3D&reserved=0https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ft2linux.com%2F&data=05%7C02%7Cchristophe.leroy2%40cs-soprasteria.com%7C07bb94cfdba54489c90c08de26a85451%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638990705044130420%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C60000%7C%7C%7C&sdata=hZcbQaXzPilNSfm3jJD%2B6476txQkBk%2F0XLr4bZ9E8Og%3D&reserved=0https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatreon.com%2Frenerebe&data=05%7C02%7Cchristophe.leroy2%40cs-soprasteria.com%7C07bb94cfdba54489c90c08de26a85451%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638990705044156412%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C60000%7C%7C%7C&sdata=IYCEMJEM8WCh8J0xPN6DWddnjJYrTavjC9GF2Nst0%2FA%3D&reserved=0
> 



More information about the Linuxppc-dev mailing list