[PATCH 1/4] ARM: catch pending imprecise abort on unmask

Russell King - ARM Linux linux at arm.linux.org.uk
Thu Oct 15 00:21:49 PDT 2015


On Wed, Oct 14, 2015 at 04:48:30PM +0200, Lucas Stach wrote:
> Install a non-faulting handler just before unmasking imprecise aborts
> and switch back to the regular one after unmasking is done.
> 
> This catches any pending imprecise abort that the firmware/bootloader
> may have left behind that would normally crash the kernel at that point.
> As there are apparently a lot of bootlaoders out there that do such a
> thing it makes sense to handle it in the common startup code.
> 
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> ---
>  arch/arm/mm/fault.c | 15 +++++++++++++++
>  arch/arm/mm/fault.h |  2 ++
>  arch/arm/mm/mmu.c   | 19 ++++++++++++++++++-
>  3 files changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
> index 0d629b8f973f..519f694ec9db 100644
> --- a/arch/arm/mm/fault.c
> +++ b/arch/arm/mm/fault.c
> @@ -538,6 +538,21 @@ hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, struct pt_regs *)
>  	fsr_info[nr].name = name;
>  }
>  
> +void * __init
> +swap_fault_function(int nr,
> +		    int (*fn)(unsigned long, unsigned int, struct pt_regs *))
> +{
> +	void *old_fn;
> +
> +	if (nr < 0 || nr >= ARRAY_SIZE(fsr_info))
> +		BUG();
> +
> +	old_fn = fsr_info[nr].fn;
> +	fsr_info[nr].fn = fn;
> +
> +	return old_fn;
> +}
> +

Please move the abort enable and handler into fault.c - I don't want this
exposed to the rest of the kernel as people will get the impression that
they can make use of this, even though it's not in arch/arm/include/, as
a way to hook and then subsequently unhook a handler.

Thanks.

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.



More information about the linux-arm-kernel mailing list