[RFC PATCH 5/9] powerpc/4xx: Move machine_check_4xx() into platforms/4xx

Christophe LEROY christophe.leroy at c-s.fr
Thu Mar 2 22:11:15 AEDT 2017



Le 17/02/2017 à 07:32, Michael Ellerman a écrit :
> Now that we have 4xx platform directory we can move the 4xx machine
> check handler in there. Again we drop get_mc_reason() and replace it
> with regs->dsisr directly (which is actually SPRN_ESR).

The same can also be done for the 8xx.
I can propose a patch once you've commited your patches, to avoid 
conflict on traps.c

Or I do it now and you apply your patches over it ?

Christophe

>
> Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
> ---
>  arch/powerpc/kernel/traps.c                | 18 +-----------------
>  arch/powerpc/platforms/4xx/Makefile        |  2 +-
>  arch/powerpc/platforms/4xx/machine_check.c | 26 ++++++++++++++++++++++++++
>  3 files changed, 28 insertions(+), 18 deletions(-)
>  create mode 100644 arch/powerpc/platforms/4xx/machine_check.c
>
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index 41aa472f8ab1..37cbfd7af41d 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -409,23 +409,7 @@ static inline int check_io_access(struct pt_regs *regs)
>  #define clear_single_step(regs)	((regs)->msr &= ~MSR_SE)
>  #endif
>
> -#if defined(CONFIG_4xx)
> -int machine_check_4xx(struct pt_regs *regs)
> -{
> -	unsigned long reason = get_mc_reason(regs);
> -
> -	if (reason & ESR_IMCP) {
> -		printk("Instruction");
> -		mtspr(SPRN_ESR, reason & ~ESR_IMCP);
> -	} else
> -		printk("Data");
> -	printk(" machine check in kernel mode.\n");
> -
> -	return 0;
> -}
> -
> -
> -#elif defined(CONFIG_E500)
> +#if defined(CONFIG_E500)
>  int machine_check_e500mc(struct pt_regs *regs)
>  {
>  	unsigned long mcsr = mfspr(SPRN_MCSR);
> diff --git a/arch/powerpc/platforms/4xx/Makefile b/arch/powerpc/platforms/4xx/Makefile
> index 0d4b65c88d66..9779c32db34e 100644
> --- a/arch/powerpc/platforms/4xx/Makefile
> +++ b/arch/powerpc/platforms/4xx/Makefile
> @@ -1,4 +1,4 @@
> -obj-y				+= uic.o
> +obj-y				+= uic.o machine_check.o
>  obj-$(CONFIG_PPC4xx_OCM)	+= ocm.o
>  obj-$(CONFIG_4xx_SOC)		+= soc.o
>  obj-$(CONFIG_PCI)		+= pci.o
> diff --git a/arch/powerpc/platforms/4xx/machine_check.c b/arch/powerpc/platforms/4xx/machine_check.c
> new file mode 100644
> index 000000000000..aa039dfaf82f
> --- /dev/null
> +++ b/arch/powerpc/platforms/4xx/machine_check.c
> @@ -0,0 +1,26 @@
> +/*
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/printk.h>
> +#include <linux/ptrace.h>
> +
> +#include <asm/reg.h>
> +
> +int machine_check_4xx(struct pt_regs *regs)
> +{
> +	unsigned long reason = regs->dsisr;
> +
> +	if (reason & ESR_IMCP) {
> +		printk("Instruction");
> +		mtspr(SPRN_ESR, reason & ~ESR_IMCP);
> +	} else
> +		printk("Data");
> +	printk(" machine check in kernel mode.\n");
> +
> +	return 0;
> +}
>


More information about the Linuxppc-dev mailing list