On 2021/01/20 03:16PM, Ananth N Mavinakayanahalli wrote: > We currently unconditionally try to newer emulate instructions on older ^^^^^ never? Or: "emulate newer"?
> Power versions that could cause issues. Gate it. > > Signed-off-by: Ananth N Mavinakayanahalli <ana...@linux.ibm.com> > --- > arch/powerpc/lib/sstep.c | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) Thanks! > > diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c > index bf7a7d62ae8b..ed119858e5e9 100644 > --- a/arch/powerpc/lib/sstep.c > +++ b/arch/powerpc/lib/sstep.c > @@ -1528,6 +1528,8 @@ int analyse_instr(struct instruction_op *op, const > struct pt_regs *regs, > goto compute_done; > > case 19: > + if (!cpu_has_feature(CPU_FTR_ARCH_300)) > + return -1; > if (((word >> 1) & 0x1f) == 2) { > /* addpcis */ > imm = (short) (word & 0xffc1); /* d0 + d2 fields */ The cpu feature check should be within the if condition above since there are other instructions under opcode 19. This is not an issue right now as we don't emulate any of the others after this point, but it would be good to restrict the change to specific instructions. Rest of the changes below look good to me. The only other v3.0 instruction we need to gate is the 'scv' instruction. It would be good to handle that too. - Naveen