[PATCHv3 4/5] arm64: Emulate CP15 Barrier instructions
Catalin Marinas
catalin.marinas at arm.com
Wed Nov 5 06:51:17 PST 2014
On Mon, Oct 27, 2014 at 06:40:06PM +0000, Punit Agrawal wrote:
> +static int cp15barrier_handler(struct pt_regs *regs, u32 instr)
> +{
> + perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, regs->pc);
> +
> + switch (arm_check_condition(instr, regs->pstate)) {
> + case ARM_OPCODE_CONDTEST_PASS:
> + break;
> + case ARM_OPCODE_CONDTEST_FAIL:
> + /* Condition failed - return to next instruction */
> + goto ret;
> + case ARM_OPCODE_CONDTEST_UNCOND:
> + /* If unconditional encoding - not a barrier instruction */
> + return -EFAULT;
> + default:
> + return -EINVAL;
> + }
> +
> + switch (aarch32_insn_mcr_extract_crm(instr)) {
> + case 10:
> + /*
> + * dmb - mcr p15, 0, Rt, c7, c10, 5
> + * dsb - mcr p15, 0, Rt, c7, c10, 4
> + */
> + if (aarch32_insn_mcr_extract_opc2(instr) == 5)
> + dmb(sy);
> + else
> + dsb(sy);
> + break;
> + case 5:
> + /*
> + * isb - mcr p15, 0, Rt, c7, c5, 4
> + */
> + isb();
> + break;
> + }
IIRC we concluded that an isb() isn't needed here as taking an exception
or returning from one would act as an instruction barrier.
--
Catalin
More information about the linux-arm-kernel
mailing list