Re: [PATCH 17/27] sparc32: Drop run-time patching of ASI instructions

From: Sam Ravnborg
Date: Sat Feb 17 2024 - 07:00:51 EST


Hi Andreas,

> > diff --git a/arch/sparc/include/asm/winmacro.h b/arch/sparc/include/asm/winmacro.h
> > index b6e911f5d93c..c496b04cdfaf 100644
> > --- a/arch/sparc/include/asm/winmacro.h
> > +++ b/arch/sparc/include/asm/winmacro.h
> > @@ -108,18 +108,11 @@
> > 661: rd %tbr, %idreg; \
> > srl %idreg, 10, %idreg; \
> > and %idreg, 0xc, %idreg; \
>
> These three lines, including the label, should also be removed as they
> are not for LEON. Additionally, I think it would be best to split out
> removing the cpuid instruction fixups to one patch and the MMU ASI
> instruction fixups to another patch.

Nice catch!
I will fix this and split up in two patches in v2.
It will take some days before I have v2 ready, and I will base it on top
of your for-next branch in the sparc.git tree.

Sam

>
> > - .section .cpuid_patch, "ax"; \
> > - /* Instruction location. */ \
> > - .word 661b; \
> > - /* SUN4D implementation. */ \
> > - lda [%g0] ASI_M_VIKING_TMP1, %idreg; \
> > - sll %idreg, 2, %idreg; \
> > - nop; \
> > - /* LEON implementation. */ \
> > + \
> > rd %asr17, %idreg; \
> > srl %idreg, 0x1c, %idreg; \
> > sll %idreg, 0x02, %idreg; \
> > - .previous; \
> > + \
> > sethi %hi(current_set), %dest_reg; \
> > or %dest_reg, %lo(current_set), %dest_reg;\
> > ld [%idreg + %dest_reg], %dest_reg;
> > diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
> > index 0f2417ee3f95..9cf8f87e8c42 100644
> > --- a/arch/sparc/kernel/entry.S
> > +++ b/arch/sparc/kernel/entry.S
>
> The hard_smp_processor_id function also needs to be reduced to just the
> LEON code. With the patching removed, SMP otherwise breaks with CPUs
> other than CPU 0 getting stuck.
>
> Thanks,
> Andreas