[SRU,Zesty,3/4] powerpc/mce: Move 64-bit machine check code into mce.c

Message ID 1508881286-16823-4-git-send-email-mauricfo@linux.vnet.ibm.com
State New
Headers show
Series
  • Fixes for LP:1721070
Related show

Commit Message

Mauricio Faria de Oliveira Oct. 24, 2017, 9:41 p.m.
From: Michael Ellerman <mpe@ellerman.id.au>

BugLink: http://bugs.launchpad.net/bugs/1721070

We already have mce.c which is built for 64bit and contains other parts
of the machine check code, so move these bits in there too.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry-picked from commit 77de988c7eab8f476f4bbee77c383c5c1e79090a)
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/mce.c   | 33 +++++++++++++++++++++++++++++++++
 arch/powerpc/kernel/traps.c | 33 ---------------------------------
 2 files changed, 33 insertions(+), 33 deletions(-)

Comments

Kleber Souza Oct. 26, 2017, 1:29 p.m. | #1
On 10/24/17 23:41, Mauricio Faria de Oliveira wrote:
> From: Michael Ellerman <mpe@ellerman.id.au>
> 
> BugLink: http://bugs.launchpad.net/bugs/1721070
> 
> We already have mce.c which is built for 64bit and contains other parts
> of the machine check code, so move these bits in there too.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> (cherry-picked from commit 77de988c7eab8f476f4bbee77c383c5c1e79090a)

This commit is ccd3cd361341b71ae2afa596f6b470fcb32a916e upstream. This
can be fixed when applying the patch.

> Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
> ---
>  arch/powerpc/kernel/mce.c   | 33 +++++++++++++++++++++++++++++++++
>  arch/powerpc/kernel/traps.c | 33 ---------------------------------
>  2 files changed, 33 insertions(+), 33 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c
> index b23b32385583..520d89c4344d 100644
> --- a/arch/powerpc/kernel/mce.c
> +++ b/arch/powerpc/kernel/mce.c
> @@ -22,11 +22,14 @@
>  #undef DEBUG
>  #define pr_fmt(fmt) "mce: " fmt
>  
> +#include <linux/hardirq.h>
>  #include <linux/types.h>
>  #include <linux/ptrace.h>
>  #include <linux/percpu.h>
>  #include <linux/export.h>
>  #include <linux/irq_work.h>
> +
> +#include <asm/machdep.h>
>  #include <asm/mce.h>
>  
>  static DEFINE_PER_CPU(int, mce_nest_count);
> @@ -434,3 +437,33 @@ uint64_t get_mce_fault_addr(struct machine_check_event *evt)
>  	return 0;
>  }
>  EXPORT_SYMBOL(get_mce_fault_addr);
> +
> +/*
> + * This function is called in real mode. Strictly no printk's please.
> + *
> + * regs->nip and regs->msr contains srr0 and ssr1.
> + */
> +long machine_check_early(struct pt_regs *regs)
> +{
> +	long handled = 0;
> +
> +	__this_cpu_inc(irq_stat.mce_exceptions);
> +
> +	if (cur_cpu_spec && cur_cpu_spec->machine_check_early)
> +		handled = cur_cpu_spec->machine_check_early(regs);
> +	return handled;
> +}
> +
> +long hmi_exception_realmode(struct pt_regs *regs)
> +{
> +	__this_cpu_inc(irq_stat.hmi_exceptions);
> +
> +	wait_for_subcore_guest_exit();
> +
> +	if (ppc_md.hmi_exception_early)
> +		ppc_md.hmi_exception_early(regs);
> +
> +	wait_for_tb_resync();
> +
> +	return 0;
> +}
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index b89feec2a142..1c22783147f5 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -293,39 +293,6 @@ void system_reset_exception(struct pt_regs *regs)
>  	/* What should we do here? We could issue a shutdown or hard reset. */
>  }
>  
> -#ifdef CONFIG_PPC64
> -/*
> - * This function is called in real mode. Strictly no printk's please.
> - *
> - * regs->nip and regs->msr contains srr0 and ssr1.
> - */
> -long machine_check_early(struct pt_regs *regs)
> -{
> -	long handled = 0;
> -
> -	__this_cpu_inc(irq_stat.mce_exceptions);
> -
> -	if (cur_cpu_spec && cur_cpu_spec->machine_check_early)
> -		handled = cur_cpu_spec->machine_check_early(regs);
> -	return handled;
> -}
> -
> -long hmi_exception_realmode(struct pt_regs *regs)
> -{
> -	__this_cpu_inc(irq_stat.hmi_exceptions);
> -
> -	wait_for_subcore_guest_exit();
> -
> -	if (ppc_md.hmi_exception_early)
> -		ppc_md.hmi_exception_early(regs);
> -
> -	wait_for_tb_resync();
> -
> -	return 0;
> -}
> -
> -#endif
> -
>  /*
>   * I/O accesses can cause machine checks on powermacs.
>   * Check if the NIP corresponds to the address of a sync
>
Mauricio Faria de Oliveira Oct. 26, 2017, 2 p.m. | #2
On 10/26/2017 11:29 AM, Kleber Souza wrote:
>> (cherry-picked from commit 77de988c7eab8f476f4bbee77c383c5c1e79090a)
> This commit is ccd3cd361341b71ae2afa596f6b470fcb32a916e upstream. This
> can be fixed when applying the patch.

Sorry, thanks for fixing it, Kleber.

Patch

diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c
index b23b32385583..520d89c4344d 100644
--- a/arch/powerpc/kernel/mce.c
+++ b/arch/powerpc/kernel/mce.c
@@ -22,11 +22,14 @@ 
 #undef DEBUG
 #define pr_fmt(fmt) "mce: " fmt
 
+#include <linux/hardirq.h>
 #include <linux/types.h>
 #include <linux/ptrace.h>
 #include <linux/percpu.h>
 #include <linux/export.h>
 #include <linux/irq_work.h>
+
+#include <asm/machdep.h>
 #include <asm/mce.h>
 
 static DEFINE_PER_CPU(int, mce_nest_count);
@@ -434,3 +437,33 @@  uint64_t get_mce_fault_addr(struct machine_check_event *evt)
 	return 0;
 }
 EXPORT_SYMBOL(get_mce_fault_addr);
+
+/*
+ * This function is called in real mode. Strictly no printk's please.
+ *
+ * regs->nip and regs->msr contains srr0 and ssr1.
+ */
+long machine_check_early(struct pt_regs *regs)
+{
+	long handled = 0;
+
+	__this_cpu_inc(irq_stat.mce_exceptions);
+
+	if (cur_cpu_spec && cur_cpu_spec->machine_check_early)
+		handled = cur_cpu_spec->machine_check_early(regs);
+	return handled;
+}
+
+long hmi_exception_realmode(struct pt_regs *regs)
+{
+	__this_cpu_inc(irq_stat.hmi_exceptions);
+
+	wait_for_subcore_guest_exit();
+
+	if (ppc_md.hmi_exception_early)
+		ppc_md.hmi_exception_early(regs);
+
+	wait_for_tb_resync();
+
+	return 0;
+}
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index b89feec2a142..1c22783147f5 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -293,39 +293,6 @@  void system_reset_exception(struct pt_regs *regs)
 	/* What should we do here? We could issue a shutdown or hard reset. */
 }
 
-#ifdef CONFIG_PPC64
-/*
- * This function is called in real mode. Strictly no printk's please.
- *
- * regs->nip and regs->msr contains srr0 and ssr1.
- */
-long machine_check_early(struct pt_regs *regs)
-{
-	long handled = 0;
-
-	__this_cpu_inc(irq_stat.mce_exceptions);
-
-	if (cur_cpu_spec && cur_cpu_spec->machine_check_early)
-		handled = cur_cpu_spec->machine_check_early(regs);
-	return handled;
-}
-
-long hmi_exception_realmode(struct pt_regs *regs)
-{
-	__this_cpu_inc(irq_stat.hmi_exceptions);
-
-	wait_for_subcore_guest_exit();
-
-	if (ppc_md.hmi_exception_early)
-		ppc_md.hmi_exception_early(regs);
-
-	wait_for_tb_resync();
-
-	return 0;
-}
-
-#endif
-
 /*
  * I/O accesses can cause machine checks on powermacs.
  * Check if the NIP corresponds to the address of a sync