Commit 99d3d491 authored by Ravi Bangoria's avatar Ravi Bangoria Committed by Sasha Levin

powerpc: Emulation support for load/store instructions on LE

[ Upstream commit e148bd17 ]

emulate_step() uses a number of underlying kernel functions that were
initially not enabled for LE. This has been rectified since. So, fix
emulate_step() for LE for the corresponding instructions.

Cc: stable@vger.kernel.org # v3.18+
Reported-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 38178517
...@@ -1806,8 +1806,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) ...@@ -1806,8 +1806,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
goto instr_done; goto instr_done;
case LARX: case LARX:
if (regs->msr & MSR_LE)
return 0;
if (op.ea & (size - 1)) if (op.ea & (size - 1))
break; /* can't handle misaligned */ break; /* can't handle misaligned */
err = -EFAULT; err = -EFAULT;
...@@ -1829,8 +1827,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) ...@@ -1829,8 +1827,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
goto ldst_done; goto ldst_done;
case STCX: case STCX:
if (regs->msr & MSR_LE)
return 0;
if (op.ea & (size - 1)) if (op.ea & (size - 1))
break; /* can't handle misaligned */ break; /* can't handle misaligned */
err = -EFAULT; err = -EFAULT;
...@@ -1854,8 +1850,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) ...@@ -1854,8 +1850,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
goto ldst_done; goto ldst_done;
case LOAD: case LOAD:
if (regs->msr & MSR_LE)
return 0;
err = read_mem(&regs->gpr[op.reg], op.ea, size, regs); err = read_mem(&regs->gpr[op.reg], op.ea, size, regs);
if (!err) { if (!err) {
if (op.type & SIGNEXT) if (op.type & SIGNEXT)
...@@ -1867,8 +1861,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) ...@@ -1867,8 +1861,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
#ifdef CONFIG_PPC_FPU #ifdef CONFIG_PPC_FPU
case LOAD_FP: case LOAD_FP:
if (regs->msr & MSR_LE)
return 0;
if (size == 4) if (size == 4)
err = do_fp_load(op.reg, do_lfs, op.ea, size, regs); err = do_fp_load(op.reg, do_lfs, op.ea, size, regs);
else else
...@@ -1877,15 +1869,11 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) ...@@ -1877,15 +1869,11 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
#endif #endif
#ifdef CONFIG_ALTIVEC #ifdef CONFIG_ALTIVEC
case LOAD_VMX: case LOAD_VMX:
if (regs->msr & MSR_LE)
return 0;
err = do_vec_load(op.reg, do_lvx, op.ea & ~0xfUL, regs); err = do_vec_load(op.reg, do_lvx, op.ea & ~0xfUL, regs);
goto ldst_done; goto ldst_done;
#endif #endif
#ifdef CONFIG_VSX #ifdef CONFIG_VSX
case LOAD_VSX: case LOAD_VSX:
if (regs->msr & MSR_LE)
return 0;
err = do_vsx_load(op.reg, do_lxvd2x, op.ea, regs); err = do_vsx_load(op.reg, do_lxvd2x, op.ea, regs);
goto ldst_done; goto ldst_done;
#endif #endif
...@@ -1908,8 +1896,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) ...@@ -1908,8 +1896,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
goto instr_done; goto instr_done;
case STORE: case STORE:
if (regs->msr & MSR_LE)
return 0;
if ((op.type & UPDATE) && size == sizeof(long) && if ((op.type & UPDATE) && size == sizeof(long) &&
op.reg == 1 && op.update_reg == 1 && op.reg == 1 && op.update_reg == 1 &&
!(regs->msr & MSR_PR) && !(regs->msr & MSR_PR) &&
...@@ -1922,8 +1908,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) ...@@ -1922,8 +1908,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
#ifdef CONFIG_PPC_FPU #ifdef CONFIG_PPC_FPU
case STORE_FP: case STORE_FP:
if (regs->msr & MSR_LE)
return 0;
if (size == 4) if (size == 4)
err = do_fp_store(op.reg, do_stfs, op.ea, size, regs); err = do_fp_store(op.reg, do_stfs, op.ea, size, regs);
else else
...@@ -1932,15 +1916,11 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) ...@@ -1932,15 +1916,11 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
#endif #endif
#ifdef CONFIG_ALTIVEC #ifdef CONFIG_ALTIVEC
case STORE_VMX: case STORE_VMX:
if (regs->msr & MSR_LE)
return 0;
err = do_vec_store(op.reg, do_stvx, op.ea & ~0xfUL, regs); err = do_vec_store(op.reg, do_stvx, op.ea & ~0xfUL, regs);
goto ldst_done; goto ldst_done;
#endif #endif
#ifdef CONFIG_VSX #ifdef CONFIG_VSX
case STORE_VSX: case STORE_VSX:
if (regs->msr & MSR_LE)
return 0;
err = do_vsx_store(op.reg, do_stxvd2x, op.ea, regs); err = do_vsx_store(op.reg, do_stxvd2x, op.ea, regs);
goto ldst_done; goto ldst_done;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment