]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
powerpc/sstep: Emulate prefixed instructions only when CPU_FTR_ARCH_31 is set
authorBalamuruhan S <bala24@linux.ibm.com>
Sun, 11 Oct 2020 05:09:04 +0000 (10:39 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 10 Dec 2020 13:09:09 +0000 (00:09 +1100)
Unconditional emulation of prefixed instructions will allow
emulation of them on Power10 predecessors which might cause
issues. Restrict that.

Fixes: 3920742b92f5 ("powerpc sstep: Add support for prefixed fixed-point arithmetic")
Fixes: 50b80a12e4cc ("powerpc sstep: Add support for prefixed load/stores")
Signed-off-by: Balamuruhan S <bala24@linux.ibm.com>
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Reviewed-by: Sandipan Das <sandipan@linux.ibm.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201011050908.72173-2-ravi.bangoria@linux.ibm.com
arch/powerpc/lib/sstep.c

index 855457ed09b5460262c69b7ce84ea7465917212e..bf2cd3d42125dc0bb95ee9207e5b4d2c56fa476f 100644 (file)
@@ -1346,6 +1346,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
        switch (opcode) {
 #ifdef __powerpc64__
        case 1:
+               if (!cpu_has_feature(CPU_FTR_ARCH_31))
+                       return -1;
+
                prefix_r = GET_PREFIX_R(word);
                ra = GET_PREFIX_RA(suffix);
                rd = (suffix >> 21) & 0x1f;
@@ -2733,6 +2736,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
                }
                break;
        case 1: /* Prefixed instructions */
+               if (!cpu_has_feature(CPU_FTR_ARCH_31))
+                       return -1;
+
                prefix_r = GET_PREFIX_R(word);
                ra = GET_PREFIX_RA(suffix);
                op->update_reg = ra;