Subject: Re: [PATCH 6/8] arm64: entry: convert el0_sync to C

From: Mark Rutland <[email-masked]>
Date: Fri, 4 Oct 2019 13:57:49 +0100

On Thu, Oct 03, 2019 at 06:16:40PM +0100, James Morse wrote:
> From: Mark Rutland <[email-masked]>
> 
> This is largely a 1-1 conversion of asm to C, with a couple of caveats.
> 
> The el0_sync{_compat} switches explicitly handle all the EL0 debug
> cases, so el0_dbg doesn't have to try to bail out for unexpected EL1
> debug ESR values. This also means that an unexpected vector catch from
> AArch32 is routed to el0_inv.
> 
> We *could* merge the native and compat switches, which would make the
> diffstat negative, but I've tried to stay as close to the existing
> assembly as possible for the moment.
> 
> Signed-off-by: Mark Rutland <[email-masked]>
> [split out of a bigger series, added nokprobes. removed irq trace
>  calls as the C helpers do this. renamed el0_dbg's use of FAR]
> Signed-off-by: James Morse <[email-masked]>
> Cc: Julien Thierry <[email-masked]>
> ---
>  arch/arm64/include/asm/asm-uaccess.h |  10 --
>  arch/arm64/kernel/entry-common.c     | 221 +++++++++++++++++++++++++++
>  arch/arm64/kernel/entry.S            | 206 +------------------------
>  3 files changed, 226 insertions(+), 211 deletions(-)

[...]

> +static void notrace el0_dbg(struct pt_regs *regs, unsigned long esr)
> +{
> +	unsigned long addr_if_watchpoint = read_sysreg(far_el1);
> +
> +	if (system_uses_irq_prio_masking())
> +		gic_write_pmr(GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET);
> +
> +	user_exit_irqoff();
> +	do_debug_exception(addr_if_watchpoint, esr, regs);
> +	local_daif_restore(DAIF_PROCCTX_NOIRQ);
> +}
> +NOKPROBE_SYMBOL(el0_dbg);

I think that it'd be best to stick with 'far' here, and only have the
'addr_if_watchpoint' name within do_debug_exception(), where it used to
be 'addr'. That way all of this code consistently uses 'far'.

Otherwise this all looks good to me:

Reviewed-by: Mark Rutland <[email-masked]>

Thanks for all the rework and cleanup!

Mark.

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel