[PATCH 1/9] powerpc/47x: Guard 47x cputable entries with CONFIG_PPC_47x

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 1/9] powerpc/47x: Guard 47x cputable entries with CONFIG_PPC_47x

Michael Ellerman-2
Currently we build the 47x cputable entries even when CONFIG_PPC_47x is
disabled. That means a kernel built without CONFIG_PPC_47x will claim to
support a 47x CPU and start booting, only to break somewhere later
because it doesn't have 47x support compiled in.

So guard the 47x cputable entries with CONFIG_PPC_47x. Note that this is
inside the #ifdef CONFIG_44x section, because 47x depends on 44x.

Signed-off-by: Michael Ellerman <[hidden email]>
---
 arch/powerpc/kernel/cputable.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 6f849832a669..080bf51e0104 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -1936,6 +1936,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
  .machine_check = machine_check_440A,
  .platform = "ppc440",
  },
+#ifdef CONFIG_PPC_47x
  { /* 476 DD2 core */
  .pvr_mask = 0xffffffff,
  .pvr_value = 0x11a52080,
@@ -1992,6 +1993,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
  .machine_check = machine_check_47x,
  .platform = "ppc470",
  },
+#endif /* CONFIG_PPC_47x */
  { /* default match */
  .pvr_mask = 0x00000000,
  .pvr_value = 0x00000000,
--
2.7.4

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 2/9] powerpc/44x: Simplify CONFIG_44x checks in Makefile

Michael Ellerman-2
The entire 44x directory is omitted if CONFIG_44x is not enabled, so
within the 44x/Makefile CONFIG_44x is always y. So convert
obj-$(CONFIG_44x) to the more obvious obj-y.

Signed-off-by: Michael Ellerman <[hidden email]>
---
 arch/powerpc/platforms/44x/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
index 72b824160660..71a7fccef675 100644
--- a/arch/powerpc/platforms/44x/Makefile
+++ b/arch/powerpc/platforms/44x/Makefile
@@ -1,6 +1,6 @@
-obj-$(CONFIG_44x) += misc_44x.o
+obj-y += misc_44x.o
 ifneq ($(CONFIG_PPC4xx_CPM),y)
-obj-$(CONFIG_44x) += idle.o
+obj-y += idle.o
 endif
 obj-$(CONFIG_PPC44x_SIMPLE) += ppc44x_simple.o
 obj-$(CONFIG_EBONY) += ebony.o
--
2.7.4

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 3/9] powerpc/44x: Move 44x machine check handlers into platforms/44x

Michael Ellerman-2
In reply to this post by Michael Ellerman-2
We have several 44x machine check handlers defined in traps.c. It would
be preferable if they were split out with the platforms that use them.
Do that.

In the process, drop get_mc_reason() and instead just open code the
lookup of reason from regs->dsisr. This avoids a pointless layer of
abstraction.

We know to use regs->dsisr because 44x enables BOOKE which enables
PPC_ADV_DEBUG_REGS, and FSL_BOOKE is not enabled on 44x builds.

Signed-off-by: Michael Ellerman <[hidden email]>
---
 arch/powerpc/kernel/traps.c                | 74 ------------------------
 arch/powerpc/platforms/44x/Makefile        |  2 +-
 arch/powerpc/platforms/44x/machine_check.c | 90 ++++++++++++++++++++++++++++++
 3 files changed, 91 insertions(+), 75 deletions(-)
 create mode 100644 arch/powerpc/platforms/44x/machine_check.c

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index bfcfd9ef09f2..84f228aefb84 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -441,81 +441,7 @@ int machine_check_4xx(struct pt_regs *regs)
  return 0;
 }
 
-int machine_check_440A(struct pt_regs *regs)
-{
- unsigned long reason = get_mc_reason(regs);
-
- printk("Machine check in kernel mode.\n");
- if (reason & ESR_IMCP){
- printk("Instruction Synchronous Machine Check exception\n");
- mtspr(SPRN_ESR, reason & ~ESR_IMCP);
- }
- else {
- u32 mcsr = mfspr(SPRN_MCSR);
- if (mcsr & MCSR_IB)
- printk("Instruction Read PLB Error\n");
- if (mcsr & MCSR_DRB)
- printk("Data Read PLB Error\n");
- if (mcsr & MCSR_DWB)
- printk("Data Write PLB Error\n");
- if (mcsr & MCSR_TLBP)
- printk("TLB Parity Error\n");
- if (mcsr & MCSR_ICP){
- flush_instruction_cache();
- printk("I-Cache Parity Error\n");
- }
- if (mcsr & MCSR_DCSP)
- printk("D-Cache Search Parity Error\n");
- if (mcsr & MCSR_DCFP)
- printk("D-Cache Flush Parity Error\n");
- if (mcsr & MCSR_IMPE)
- printk("Machine Check exception is imprecise\n");
-
- /* Clear MCSR */
- mtspr(SPRN_MCSR, mcsr);
- }
- return 0;
-}
-
-int machine_check_47x(struct pt_regs *regs)
-{
- unsigned long reason = get_mc_reason(regs);
- u32 mcsr;
 
- printk(KERN_ERR "Machine check in kernel mode.\n");
- if (reason & ESR_IMCP) {
- printk(KERN_ERR
-       "Instruction Synchronous Machine Check exception\n");
- mtspr(SPRN_ESR, reason & ~ESR_IMCP);
- return 0;
- }
- mcsr = mfspr(SPRN_MCSR);
- if (mcsr & MCSR_IB)
- printk(KERN_ERR "Instruction Read PLB Error\n");
- if (mcsr & MCSR_DRB)
- printk(KERN_ERR "Data Read PLB Error\n");
- if (mcsr & MCSR_DWB)
- printk(KERN_ERR "Data Write PLB Error\n");
- if (mcsr & MCSR_TLBP)
- printk(KERN_ERR "TLB Parity Error\n");
- if (mcsr & MCSR_ICP) {
- flush_instruction_cache();
- printk(KERN_ERR "I-Cache Parity Error\n");
- }
- if (mcsr & MCSR_DCSP)
- printk(KERN_ERR "D-Cache Search Parity Error\n");
- if (mcsr & PPC47x_MCSR_GPR)
- printk(KERN_ERR "GPR Parity Error\n");
- if (mcsr & PPC47x_MCSR_FPR)
- printk(KERN_ERR "FPR Parity Error\n");
- if (mcsr & PPC47x_MCSR_IPR)
- printk(KERN_ERR "Machine Check exception is imprecise\n");
-
- /* Clear MCSR */
- mtspr(SPRN_MCSR, mcsr);
-
- return 0;
-}
 #elif defined(CONFIG_E500)
 int machine_check_e500mc(struct pt_regs *regs)
 {
diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
index 71a7fccef675..2c5651992369 100644
--- a/arch/powerpc/platforms/44x/Makefile
+++ b/arch/powerpc/platforms/44x/Makefile
@@ -1,4 +1,4 @@
-obj-y += misc_44x.o
+obj-y += misc_44x.o machine_check.o
 ifneq ($(CONFIG_PPC4xx_CPM),y)
 obj-y += idle.o
 endif
diff --git a/arch/powerpc/platforms/44x/machine_check.c b/arch/powerpc/platforms/44x/machine_check.c
new file mode 100644
index 000000000000..439766a8fcbd
--- /dev/null
+++ b/arch/powerpc/platforms/44x/machine_check.c
@@ -0,0 +1,90 @@
+/*
+ * 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_440A(struct pt_regs *regs)
+{
+ unsigned long reason = regs->dsisr;
+
+ printk("Machine check in kernel mode.\n");
+ if (reason & ESR_IMCP){
+ printk("Instruction Synchronous Machine Check exception\n");
+ mtspr(SPRN_ESR, reason & ~ESR_IMCP);
+ }
+ else {
+ u32 mcsr = mfspr(SPRN_MCSR);
+ if (mcsr & MCSR_IB)
+ printk("Instruction Read PLB Error\n");
+ if (mcsr & MCSR_DRB)
+ printk("Data Read PLB Error\n");
+ if (mcsr & MCSR_DWB)
+ printk("Data Write PLB Error\n");
+ if (mcsr & MCSR_TLBP)
+ printk("TLB Parity Error\n");
+ if (mcsr & MCSR_ICP){
+ flush_instruction_cache();
+ printk("I-Cache Parity Error\n");
+ }
+ if (mcsr & MCSR_DCSP)
+ printk("D-Cache Search Parity Error\n");
+ if (mcsr & MCSR_DCFP)
+ printk("D-Cache Flush Parity Error\n");
+ if (mcsr & MCSR_IMPE)
+ printk("Machine Check exception is imprecise\n");
+
+ /* Clear MCSR */
+ mtspr(SPRN_MCSR, mcsr);
+ }
+ return 0;
+}
+
+#ifdef CONFIG_PPC_47x
+int machine_check_47x(struct pt_regs *regs)
+{
+ unsigned long reason = regs->dsisr;
+ u32 mcsr;
+
+ printk(KERN_ERR "Machine check in kernel mode.\n");
+ if (reason & ESR_IMCP) {
+ printk(KERN_ERR
+       "Instruction Synchronous Machine Check exception\n");
+ mtspr(SPRN_ESR, reason & ~ESR_IMCP);
+ return 0;
+ }
+ mcsr = mfspr(SPRN_MCSR);
+ if (mcsr & MCSR_IB)
+ printk(KERN_ERR "Instruction Read PLB Error\n");
+ if (mcsr & MCSR_DRB)
+ printk(KERN_ERR "Data Read PLB Error\n");
+ if (mcsr & MCSR_DWB)
+ printk(KERN_ERR "Data Write PLB Error\n");
+ if (mcsr & MCSR_TLBP)
+ printk(KERN_ERR "TLB Parity Error\n");
+ if (mcsr & MCSR_ICP) {
+ flush_instruction_cache();
+ printk(KERN_ERR "I-Cache Parity Error\n");
+ }
+ if (mcsr & MCSR_DCSP)
+ printk(KERN_ERR "D-Cache Search Parity Error\n");
+ if (mcsr & PPC47x_MCSR_GPR)
+ printk(KERN_ERR "GPR Parity Error\n");
+ if (mcsr & PPC47x_MCSR_FPR)
+ printk(KERN_ERR "FPR Parity Error\n");
+ if (mcsr & PPC47x_MCSR_IPR)
+ printk(KERN_ERR "Machine Check exception is imprecise\n");
+
+ /* Clear MCSR */
+ mtspr(SPRN_MCSR, mcsr);
+
+ return 0;
+}
+#endif /* CONFIG_PPC_47x */
--
2.7.4

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 4/9] powerpc/4xx: Create 4xx pseudo-platform in platforms/4xx

Michael Ellerman-2
In reply to this post by Michael Ellerman-2
We have a lot of code in sysdev for supporting 4xx, ie. either 40x or
44x. Instead it would be cleaner if it was all in platforms/4xx.

This is slightly odd in that we don't actually define any machines in
the 4xx platform, as is usual for a platform directory. But still it
seems like a better result to have all this related code in a directory
by itself.

Signed-off-by: Michael Ellerman <[hidden email]>
---
 arch/powerpc/platforms/4xx/Makefile                            |  8 ++++++++
 arch/powerpc/{sysdev/ppc4xx_cpm.c => platforms/4xx/cpm.c}      |  0
 arch/powerpc/{sysdev/ppc4xx_gpio.c => platforms/4xx/gpio.c}    |  0
 .../{sysdev/ppc4xx_hsta_msi.c => platforms/4xx/hsta_msi.c}     |  0
 arch/powerpc/{sysdev/ppc4xx_msi.c => platforms/4xx/msi.c}      |  0
 arch/powerpc/{sysdev/ppc4xx_ocm.c => platforms/4xx/ocm.c}      |  0
 arch/powerpc/{sysdev/ppc4xx_pci.c => platforms/4xx/pci.c}      |  2 +-
 arch/powerpc/{sysdev/ppc4xx_pci.h => platforms/4xx/pci.h}      |  0
 arch/powerpc/{sysdev/ppc4xx_soc.c => platforms/4xx/soc.c}      |  0
 arch/powerpc/{sysdev => platforms/4xx}/uic.c                   |  0
 arch/powerpc/platforms/Makefile                                |  1 +
 arch/powerpc/sysdev/Makefile                                   | 10 ----------
 12 files changed, 10 insertions(+), 11 deletions(-)
 create mode 100644 arch/powerpc/platforms/4xx/Makefile
 rename arch/powerpc/{sysdev/ppc4xx_cpm.c => platforms/4xx/cpm.c} (100%)
 rename arch/powerpc/{sysdev/ppc4xx_gpio.c => platforms/4xx/gpio.c} (100%)
 rename arch/powerpc/{sysdev/ppc4xx_hsta_msi.c => platforms/4xx/hsta_msi.c} (100%)
 rename arch/powerpc/{sysdev/ppc4xx_msi.c => platforms/4xx/msi.c} (100%)
 rename arch/powerpc/{sysdev/ppc4xx_ocm.c => platforms/4xx/ocm.c} (100%)
 rename arch/powerpc/{sysdev/ppc4xx_pci.c => platforms/4xx/pci.c} (99%)
 rename arch/powerpc/{sysdev/ppc4xx_pci.h => platforms/4xx/pci.h} (100%)
 rename arch/powerpc/{sysdev/ppc4xx_soc.c => platforms/4xx/soc.c} (100%)
 rename arch/powerpc/{sysdev => platforms/4xx}/uic.c (100%)

diff --git a/arch/powerpc/platforms/4xx/Makefile b/arch/powerpc/platforms/4xx/Makefile
new file mode 100644
index 000000000000..0d4b65c88d66
--- /dev/null
+++ b/arch/powerpc/platforms/4xx/Makefile
@@ -0,0 +1,8 @@
+obj-y += uic.o
+obj-$(CONFIG_PPC4xx_OCM) += ocm.o
+obj-$(CONFIG_4xx_SOC) += soc.o
+obj-$(CONFIG_PCI) += pci.o
+obj-$(CONFIG_PPC4xx_HSTA_MSI) += hsta_msi.o
+obj-$(CONFIG_PPC4xx_MSI) += msi.o
+obj-$(CONFIG_PPC4xx_CPM) += cpm.o
+obj-$(CONFIG_PPC4xx_GPIO) += gpio.o
diff --git a/arch/powerpc/sysdev/ppc4xx_cpm.c b/arch/powerpc/platforms/4xx/cpm.c
similarity index 100%
rename from arch/powerpc/sysdev/ppc4xx_cpm.c
rename to arch/powerpc/platforms/4xx/cpm.c
diff --git a/arch/powerpc/sysdev/ppc4xx_gpio.c b/arch/powerpc/platforms/4xx/gpio.c
similarity index 100%
rename from arch/powerpc/sysdev/ppc4xx_gpio.c
rename to arch/powerpc/platforms/4xx/gpio.c
diff --git a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c b/arch/powerpc/platforms/4xx/hsta_msi.c
similarity index 100%
rename from arch/powerpc/sysdev/ppc4xx_hsta_msi.c
rename to arch/powerpc/platforms/4xx/hsta_msi.c
diff --git a/arch/powerpc/sysdev/ppc4xx_msi.c b/arch/powerpc/platforms/4xx/msi.c
similarity index 100%
rename from arch/powerpc/sysdev/ppc4xx_msi.c
rename to arch/powerpc/platforms/4xx/msi.c
diff --git a/arch/powerpc/sysdev/ppc4xx_ocm.c b/arch/powerpc/platforms/4xx/ocm.c
similarity index 100%
rename from arch/powerpc/sysdev/ppc4xx_ocm.c
rename to arch/powerpc/platforms/4xx/ocm.c
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/platforms/4xx/pci.c
similarity index 99%
rename from arch/powerpc/sysdev/ppc4xx_pci.c
rename to arch/powerpc/platforms/4xx/pci.c
index 086aca69ecae..6713edc93a55 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/platforms/4xx/pci.c
@@ -32,7 +32,7 @@
 #include <asm/dcr-regs.h>
 #include <mm/mmu_decl.h>
 
-#include "ppc4xx_pci.h"
+#include "pci.h"
 
 static int dma_offset_set;
 
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.h b/arch/powerpc/platforms/4xx/pci.h
similarity index 100%
rename from arch/powerpc/sysdev/ppc4xx_pci.h
rename to arch/powerpc/platforms/4xx/pci.h
diff --git a/arch/powerpc/sysdev/ppc4xx_soc.c b/arch/powerpc/platforms/4xx/soc.c
similarity index 100%
rename from arch/powerpc/sysdev/ppc4xx_soc.c
rename to arch/powerpc/platforms/4xx/soc.c
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/platforms/4xx/uic.c
similarity index 100%
rename from arch/powerpc/sysdev/uic.c
rename to arch/powerpc/platforms/4xx/uic.c
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index 469ef170d218..d7a55ecfaee5 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_FSL_ULI1575) += fsl_uli1575.o
 
 obj-$(CONFIG_PPC_PMAC) += powermac/
 obj-$(CONFIG_PPC_CHRP) += chrp/
+obj-$(CONFIG_4xx) += 4xx/
 obj-$(CONFIG_40x) += 40x/
 obj-$(CONFIG_44x) += 44x/
 obj-$(CONFIG_PPC_MPC512x) += 512x/
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index c0ae11d4f62f..9e70421ad323 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -36,19 +36,9 @@ obj-$(CONFIG_AXON_RAM) += axonram.o
 obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o
 obj-$(CONFIG_PPC_I8259) += i8259.o
 obj-$(CONFIG_IPIC) += ipic.o
-obj-$(CONFIG_4xx) += uic.o
-obj-$(CONFIG_PPC4xx_OCM) += ppc4xx_ocm.o
-obj-$(CONFIG_4xx_SOC) += ppc4xx_soc.o
 obj-$(CONFIG_XILINX_VIRTEX) += xilinx_intc.o
 obj-$(CONFIG_XILINX_PCI) += xilinx_pci.o
 obj-$(CONFIG_OF_RTC) += of_rtc.o
-ifeq ($(CONFIG_PCI),y)
-obj-$(CONFIG_4xx) += ppc4xx_pci.o
-endif
-obj-$(CONFIG_PPC4xx_HSTA_MSI) += ppc4xx_hsta_msi.o
-obj-$(CONFIG_PPC4xx_MSI) += ppc4xx_msi.o
-obj-$(CONFIG_PPC4xx_CPM) += ppc4xx_cpm.o
-obj-$(CONFIG_PPC4xx_GPIO) += ppc4xx_gpio.o
 
 obj-$(CONFIG_CPM) += cpm_common.o
 obj-$(CONFIG_CPM2) += cpm2.o cpm2_pic.o
--
2.7.4

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Michael Ellerman-2
In reply to this post by Michael Ellerman-2
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).

Signed-off-by: Michael Ellerman <[hidden email]>
---
 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 84f228aefb84..c1ecc4193c3f 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -426,23 +426,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;
+}
--
2.7.4

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 6/9] powerpc/traps: Inline get_mc_reason()

Michael Ellerman-2
In reply to this post by Michael Ellerman-2
get_mc_reason() no longer provides (if it ever really did) any
meaningful abstraction, so remove it.

Signed-off-by: Michael Ellerman <[hidden email]>
---
 arch/powerpc/kernel/traps.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index c1ecc4193c3f..a4f6ddae526e 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -397,11 +397,6 @@ static inline int check_io_access(struct pt_regs *regs)
 /* On 4xx, the reason for the machine check or program exception
    is in the ESR. */
 #define get_reason(regs) ((regs)->dsisr)
-#ifndef CONFIG_FSL_BOOKE
-#define get_mc_reason(regs) ((regs)->dsisr)
-#else
-#define get_mc_reason(regs) (mfspr(SPRN_MCSR))
-#endif
 #define REASON_FP ESR_FP
 #define REASON_ILLEGAL (ESR_PIL | ESR_PUO)
 #define REASON_PRIVILEGED ESR_PPR
@@ -415,7 +410,6 @@ static inline int check_io_access(struct pt_regs *regs)
 /* On non-4xx, the reason for the machine check or program
    exception is in the MSR. */
 #define get_reason(regs) ((regs)->msr)
-#define get_mc_reason(regs) ((regs)->msr)
 #define REASON_TM 0x200000
 #define REASON_FP 0x100000
 #define REASON_ILLEGAL 0x80000
@@ -528,7 +522,7 @@ int machine_check_e500mc(struct pt_regs *regs)
 
 int machine_check_e500(struct pt_regs *regs)
 {
- unsigned long reason = get_mc_reason(regs);
+ unsigned long reason = mfspr(SPRN_MCSR);
 
  if (reason & MCSR_BUS_RBERR) {
  if (fsl_rio_mcheck_exception(regs))
@@ -575,7 +569,7 @@ int machine_check_generic(struct pt_regs *regs)
 #elif defined(CONFIG_E200)
 int machine_check_e200(struct pt_regs *regs)
 {
- unsigned long reason = get_mc_reason(regs);
+ unsigned long reason = mfspr(SPRN_MCSR);
 
  printk("Machine check in kernel mode.\n");
  printk("Caused by (from MCSR=%lx): ", reason);
@@ -600,7 +594,7 @@ int machine_check_e200(struct pt_regs *regs)
 #elif defined(CONFIG_PPC_8xx)
 int machine_check_8xx(struct pt_regs *regs)
 {
- unsigned long reason = get_mc_reason(regs);
+ unsigned long reason = regs->msr;
 
  pr_err("Machine check in kernel mode.\n");
  pr_err("Caused by (from SRR1=%lx): ", reason);
@@ -625,7 +619,7 @@ int machine_check_8xx(struct pt_regs *regs)
 #else
 int machine_check_generic(struct pt_regs *regs)
 {
- unsigned long reason = get_mc_reason(regs);
+ unsigned long reason = regs->msr;
 
  printk("Machine check in kernel mode.\n");
  printk("Caused by (from SRR1=%lx): ", reason);
--
2.7.4

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 7/9] powerpc/traps: machine_check_generic() is only used on 32-bit

Michael Ellerman-2
In reply to this post by Michael Ellerman-2
Make it clear that the fallback version of machine_check_generic() is
only used on 32-bit configs.

Signed-off-by: Michael Ellerman <[hidden email]>
---
 arch/powerpc/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index a4f6ddae526e..2dd842e97710 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -616,7 +616,7 @@ int machine_check_8xx(struct pt_regs *regs)
  return 0;
 #endif
 }
-#else
+#elif defined(CONFIG_PPC32)
 int machine_check_generic(struct pt_regs *regs)
 {
  unsigned long reason = regs->msr;
--
2.7.4

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 8/9] powerpc/mce: Move 64-bit machine check code into mce.c

Michael Ellerman-2
In reply to this post by Michael Ellerman-2
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 <[hidden email]>
---
 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 e0e131e662ed..9b2ea7e71c06 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);
@@ -446,3 +449,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 2dd842e97710..4d584f08c8ea 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -312,39 +312,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
--
2.7.4

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 9/9] powerpc/traps: Use SRR1 defines for program check reasons

Michael Ellerman-2
In reply to this post by Michael Ellerman-2
Currently we open code the reason codes for program checks. Instead use
the existing SRR1 defines.

Signed-off-by: Michael Ellerman <[hidden email]>
---
 arch/powerpc/include/asm/reg.h |  1 +
 arch/powerpc/kernel/traps.c    | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 73be2f71dbbb..c0600e9e0ff5 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -724,6 +724,7 @@
   * may not be recoverable */
 #define  SRR1_WS_DEEPER 0x00020000 /* Some resources not maintained */
 #define  SRR1_WS_DEEP 0x00010000 /* All resources maintained */
+#define   SRR1_PROGTM 0x00200000 /* TM Bad Thing */
 #define   SRR1_PROGFPE 0x00100000 /* Floating Point Enabled */
 #define   SRR1_PROGILL 0x00080000 /* Illegal instruction */
 #define   SRR1_PROGPRIV 0x00040000 /* Privileged instruction */
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 4d584f08c8ea..9107f7f86058 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -377,11 +377,11 @@ static inline int check_io_access(struct pt_regs *regs)
 /* On non-4xx, the reason for the machine check or program
    exception is in the MSR. */
 #define get_reason(regs) ((regs)->msr)
-#define REASON_TM 0x200000
-#define REASON_FP 0x100000
-#define REASON_ILLEGAL 0x80000
-#define REASON_PRIVILEGED 0x40000
-#define REASON_TRAP 0x20000
+#define REASON_TM SRR1_PROGTM
+#define REASON_FP SRR1_PROGFPE
+#define REASON_ILLEGAL SRR1_PROGILL
+#define REASON_PRIVILEGED SRR1_PROGPRIV
+#define REASON_TRAP SRR1_PROGTRAP
 
 #define single_stepping(regs) ((regs)->msr & MSR_SE)
 #define clear_single_step(regs) ((regs)->msr &= ~MSR_SE)
--
2.7.4

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [1/9] powerpc/47x: Guard 47x cputable entries with CONFIG_PPC_47x

Michael Ellerman-3
In reply to this post by Michael Ellerman-2
On Tue, 2017-08-08 at 06:39:17 UTC, Michael Ellerman wrote:
> Currently we build the 47x cputable entries even when CONFIG_PPC_47x is
> disabled. That means a kernel built without CONFIG_PPC_47x will claim to
> support a 47x CPU and start booting, only to break somewhere later
> because it doesn't have 47x support compiled in.
>
> So guard the 47x cputable entries with CONFIG_PPC_47x. Note that this is
> inside the #ifdef CONFIG_44x section, because 47x depends on 44x.
>
> Signed-off-by: Michael Ellerman <[hidden email]>

Series applied to powerpc next.

https://git.kernel.org/powerpc/c/13fef7f9da13ab6cc22d456315e887

cheers
Loading...