Skip to contentSkip to conversation

powerpc/powernv: Move SCOM access code into powernv platform

PATCH Superseded Andrew Donnellan 2 participants 3 messages May 8, 2019 – May 9, 2019 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/powernv: Move SCOM access code into powernv platform

The powernv platform is the only one that directly accesses SCOMs. Move the support code to platforms/powernv, and get rid of the PPC_SCOM Kconfig option, as SCOM support is always selected when compiling for powernv.

This also means that the Kconfig item for CONFIG_SCOM_DEBUGFS will actually show up in menuconfig, as previously it was the only labelled option in sysdev/Kconfig and wasn't actually in a menu.

---
 arch/powerpc/include/asm/scom.h                   | 4 ++--
 arch/powerpc/platforms/powernv/Kconfig            | 5 ++++-
 arch/powerpc/platforms/powernv/Makefile           | 2 +-
 arch/powerpc/{sysdev => platforms/powernv}/scom.c | 0
 arch/powerpc/sysdev/Kconfig                       | 7 -------
 arch/powerpc/sysdev/Makefile                      | 2 --
 6 files changed, 7 insertions(+), 13 deletions(-)
 rename arch/powerpc/{sysdev => platforms/powernv}/scom.c (100%)
arch/powerpc/include/asm/scom.h +2 -2
index f5cde45b1161..acc6532a9a9e 100644
@@ -23,7 +23,7 @@
 
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
-#ifdef CONFIG_PPC_SCOM
+#ifdef CONFIG_PPC_POWERNV
 
 /*
  * The SCOM bus is a sideband bus used for accessing various internal
@@ -161,7 +161,7 @@ static inline int scom_write(scom_map_t map, u64 reg, u64 value)
 }
 
 
-#endif /* CONFIG_PPC_SCOM */
+#endif /* CONFIG_PPC_POWERNV */
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_SCOM_H */
arch/powerpc/platforms/powernv/Kconfig +4 -1
index 850eee860cf2..938803eab0ad 100644
@@ -12,7 +12,6 @@ config PPC_POWERNV
 	select EPAPR_BOOT
 	select PPC_INDIRECT_PIO
 	select PPC_UDBG_16550
-	select PPC_SCOM
 	select ARCH_RANDOM
 	select CPU_FREQ
 	select PPC_DOORBELL
@@ -47,3 +46,7 @@ config PPC_VAS
 	  VAS adapters are found in POWER9 based systems.
 
 	  If unsure, say N.
+
+config SCOM_DEBUGFS
+	bool "Expose SCOM controllers via debugfs"
+	depends on DEBUG_FS
arch/powerpc/platforms/powernv/Makefile +1 -1
index da2e99efbd04..4b1644150135 100644
@@ -4,12 +4,12 @@ obj-y			+= idle.o opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
 obj-y			+= rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o
 obj-y			+= opal-msglog.o opal-hmi.o opal-power.o opal-irqchip.o
 obj-y			+= opal-kmsg.o opal-powercap.o opal-psr.o opal-sensor-groups.o
+obj-y			+= opal-xscom.o scom.o
 
 obj-$(CONFIG_SMP)	+= smp.o subcore.o subcore-asm.o
 obj-$(CONFIG_PCI)	+= pci.o pci-ioda.o npu-dma.o pci-ioda-tce.o
 obj-$(CONFIG_CXL_BASE)	+= pci-cxl.o
 obj-$(CONFIG_EEH)	+= eeh-powernv.o
-obj-$(CONFIG_PPC_SCOM)	+= opal-xscom.o
 obj-$(CONFIG_MEMORY_FAILURE)	+= opal-memory-errors.o
 obj-$(CONFIG_OPAL_PRD)	+= opal-prd.o
 obj-$(CONFIG_PERF_EVENTS) += opal-imc.o
arch/powerpc/platforms/powernv/scom.c renamed from arch/powerpc/sysdev/scom.c +0 -0
similarity index 100%
rename from arch/powerpc/sysdev/scom.c
rename to arch/powerpc/platforms/powernv/scom.c
arch/powerpc/sysdev/Kconfig +0 -7
index e0dbec780fe9..7808d279ff1d 100644
@@ -28,13 +28,6 @@ config PPC_MSI_BITMAP
 source "arch/powerpc/sysdev/xics/Kconfig"
 source "arch/powerpc/sysdev/xive/Kconfig"
 
-config PPC_SCOM
-	bool
-
-config SCOM_DEBUGFS
-	bool "Expose SCOM controllers via debugfs"
-	depends on PPC_SCOM && DEBUG_FS
-
 config GE_FPGA
 	bool
 
arch/powerpc/sysdev/Makefile +0 -2
index aaf23283ba0c..35d52d1d2fc0 100644
@@ -51,8 +51,6 @@ ifdef CONFIG_SUSPEND
 obj-$(CONFIG_PPC_BOOK3S_32)	+= 6xx-suspend.o
 endif
 
-obj-$(CONFIG_PPC_SCOM)		+= scom.o
-
 obj-$(CONFIG_PPC_EARLY_DEBUG_MEMCONS)	+= udbg_memcons.o
 
 obj-$(CONFIG_PPC_XICS)		+= xics/
Signature · 1 line
2.20.1
#1 lore raw
Quoted 3 lines · Andrew Donnellan

The powernv platform is the only one that directly accesses SCOMs. Move the support code to platforms/powernv, and get rid of the PPC_SCOM Kconfig option, as SCOM support is always selected when compiling for powernv.

This code was used on WSP / A2, back in the past which is why it originally lived in sysdev.

Quoted 7 lines

This also means that the Kconfig item for CONFIG_SCOM_DEBUGFS will actually show up in menuconfig, as previously it was the only labelled option in sysdev/Kconfig and wasn't actually in a menu.

---
 arch/powerpc/include/asm/scom.h                   | 4 ++--

Can't scom.h move into powernv as well?

And do we even need the whole scom_controller abstraction?

If we ever have another platform that needs it we can always bring it back.

cheers

Quoted 105 lines
 arch/powerpc/platforms/powernv/Kconfig            | 5 ++++-
 arch/powerpc/platforms/powernv/Makefile           | 2 +-
 arch/powerpc/{sysdev => platforms/powernv}/scom.c | 0
 arch/powerpc/sysdev/Kconfig                       | 7 -------
 arch/powerpc/sysdev/Makefile                      | 2 --
 6 files changed, 7 insertions(+), 13 deletions(-)
 rename arch/powerpc/{sysdev => platforms/powernv}/scom.c (100%)
arch/powerpc/include/asm/scom.h +2 -2
index f5cde45b1161..acc6532a9a9e 100644
@@ -23,7 +23,7 @@
 
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
-#ifdef CONFIG_PPC_SCOM
+#ifdef CONFIG_PPC_POWERNV
 
 /*
  * The SCOM bus is a sideband bus used for accessing various internal
@@ -161,7 +161,7 @@ static inline int scom_write(scom_map_t map, u64 reg, u64 value)
 }
 
 
-#endif /* CONFIG_PPC_SCOM */
+#endif /* CONFIG_PPC_POWERNV */
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_SCOM_H */
arch/powerpc/platforms/powernv/Kconfig +4 -1
index 850eee860cf2..938803eab0ad 100644
@@ -12,7 +12,6 @@ config PPC_POWERNV
 	select EPAPR_BOOT
 	select PPC_INDIRECT_PIO
 	select PPC_UDBG_16550
-	select PPC_SCOM
 	select ARCH_RANDOM
 	select CPU_FREQ
 	select PPC_DOORBELL
@@ -47,3 +46,7 @@ config PPC_VAS
 	  VAS adapters are found in POWER9 based systems.
 
 	  If unsure, say N.
+
+config SCOM_DEBUGFS
+	bool "Expose SCOM controllers via debugfs"
+	depends on DEBUG_FS
arch/powerpc/platforms/powernv/Makefile +1 -1
index da2e99efbd04..4b1644150135 100644
@@ -4,12 +4,12 @@ obj-y			+= idle.o opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
 obj-y			+= rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o
 obj-y			+= opal-msglog.o opal-hmi.o opal-power.o opal-irqchip.o
 obj-y			+= opal-kmsg.o opal-powercap.o opal-psr.o opal-sensor-groups.o
+obj-y			+= opal-xscom.o scom.o
 
 obj-$(CONFIG_SMP)	+= smp.o subcore.o subcore-asm.o
 obj-$(CONFIG_PCI)	+= pci.o pci-ioda.o npu-dma.o pci-ioda-tce.o
 obj-$(CONFIG_CXL_BASE)	+= pci-cxl.o
 obj-$(CONFIG_EEH)	+= eeh-powernv.o
-obj-$(CONFIG_PPC_SCOM)	+= opal-xscom.o
 obj-$(CONFIG_MEMORY_FAILURE)	+= opal-memory-errors.o
 obj-$(CONFIG_OPAL_PRD)	+= opal-prd.o
 obj-$(CONFIG_PERF_EVENTS) += opal-imc.o
arch/powerpc/platforms/powernv/scom.c renamed from arch/powerpc/sysdev/scom.c +0 -0
similarity index 100%
rename from arch/powerpc/sysdev/scom.c
rename to arch/powerpc/platforms/powernv/scom.c
arch/powerpc/sysdev/Kconfig +0 -7
index e0dbec780fe9..7808d279ff1d 100644
@@ -28,13 +28,6 @@ config PPC_MSI_BITMAP
 source "arch/powerpc/sysdev/xics/Kconfig"
 source "arch/powerpc/sysdev/xive/Kconfig"
 
-config PPC_SCOM
-	bool
-
-config SCOM_DEBUGFS
-	bool "Expose SCOM controllers via debugfs"
-	depends on PPC_SCOM && DEBUG_FS
-
 config GE_FPGA
 	bool
 
arch/powerpc/sysdev/Makefile +0 -2
index aaf23283ba0c..35d52d1d2fc0 100644
@@ -51,8 +51,6 @@ ifdef CONFIG_SUSPEND
 obj-$(CONFIG_PPC_BOOK3S_32)	+= 6xx-suspend.o
 endif
 
-obj-$(CONFIG_PPC_SCOM)		+= scom.o
-
 obj-$(CONFIG_PPC_EARLY_DEBUG_MEMCONS)	+= udbg_memcons.o
 
 obj-$(CONFIG_PPC_XICS)		+= xics/
Signature · 1 line
2.20.1
#2 lore raw
Quoted 13 lines · Michael Ellerman
Quoted 3 lines · Andrew Donnellan

The powernv platform is the only one that directly accesses SCOMs. Move the support code to platforms/powernv, and get rid of the PPC_SCOM Kconfig option, as SCOM support is always selected when compiling for powernv.

This code was used on WSP / A2, back in the past which is why it originally lived in sysdev.

Quoted 4 lines

This also means that the Kconfig item for CONFIG_SCOM_DEBUGFS will actually show up in menuconfig, as previously it was the only labelled option in sysdev/Kconfig and wasn't actually in a menu.

Quoted 6 lines
Quoted 3 lines
---
  arch/powerpc/include/asm/scom.h                   | 4 ++--

Can't scom.h move into powernv as well?

...looks like it can.

Quoted 1 line

And do we even need the whole scom_controller abstraction?

Probably not. Looks like there's some completely dead code in there too.

Will send a v2.

Quoted 112 lines

If we ever have another platform that needs it we can always bring it back.

cheers

Quoted 105 lines
  arch/powerpc/platforms/powernv/Kconfig            | 5 ++++-
  arch/powerpc/platforms/powernv/Makefile           | 2 +-
  arch/powerpc/{sysdev => platforms/powernv}/scom.c | 0
  arch/powerpc/sysdev/Kconfig                       | 7 -------
  arch/powerpc/sysdev/Makefile                      | 2 --
  6 files changed, 7 insertions(+), 13 deletions(-)

rename arch/powerpc/{sysdev => platforms/powernv}/scom.c (100%)

arch/powerpc/include/asm/scom.h +2 -2
index f5cde45b1161..acc6532a9a9e 100644
@@ -23,7 +23,7 @@
 
  #ifdef __KERNEL__
  #ifndef __ASSEMBLY__
-#ifdef CONFIG_PPC_SCOM
+#ifdef CONFIG_PPC_POWERNV
 
  /*
   * The SCOM bus is a sideband bus used for accessing various internal
@@ -161,7 +161,7 @@ static inline int scom_write(scom_map_t map, u64 reg, u64 value)
  }
 
 
-#endif /* CONFIG_PPC_SCOM */
+#endif /* CONFIG_PPC_POWERNV */
  #endif /* __ASSEMBLY__ */
  #endif /* __KERNEL__ */
  #endif /* _ASM_POWERPC_SCOM_H */
arch/powerpc/platforms/powernv/Kconfig +4 -1
index 850eee860cf2..938803eab0ad 100644
@@ -12,7 +12,6 @@ config PPC_POWERNV
  	select EPAPR_BOOT
  	select PPC_INDIRECT_PIO
  	select PPC_UDBG_16550
-	select PPC_SCOM
  	select ARCH_RANDOM
  	select CPU_FREQ
  	select PPC_DOORBELL
@@ -47,3 +46,7 @@ config PPC_VAS
  	  VAS adapters are found in POWER9 based systems.
 
  	  If unsure, say N.
+
+config SCOM_DEBUGFS
+	bool "Expose SCOM controllers via debugfs"
+	depends on DEBUG_FS
arch/powerpc/platforms/powernv/Makefile +1 -1
index da2e99efbd04..4b1644150135 100644
@@ -4,12 +4,12 @@ obj-y			+= idle.o opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
  obj-y			+= rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o
  obj-y			+= opal-msglog.o opal-hmi.o opal-power.o opal-irqchip.o
  obj-y			+= opal-kmsg.o opal-powercap.o opal-psr.o opal-sensor-groups.o
+obj-y			+= opal-xscom.o scom.o
 
  obj-$(CONFIG_SMP)	+= smp.o subcore.o subcore-asm.o
  obj-$(CONFIG_PCI)	+= pci.o pci-ioda.o npu-dma.o pci-ioda-tce.o
  obj-$(CONFIG_CXL_BASE)	+= pci-cxl.o
  obj-$(CONFIG_EEH)	+= eeh-powernv.o
-obj-$(CONFIG_PPC_SCOM)	+= opal-xscom.o
  obj-$(CONFIG_MEMORY_FAILURE)	+= opal-memory-errors.o
  obj-$(CONFIG_OPAL_PRD)	+= opal-prd.o
  obj-$(CONFIG_PERF_EVENTS) += opal-imc.o
arch/powerpc/platforms/powernv/scom.c renamed from arch/powerpc/sysdev/scom.c +0 -0
similarity index 100%
rename from arch/powerpc/sysdev/scom.c
rename to arch/powerpc/platforms/powernv/scom.c
arch/powerpc/sysdev/Kconfig +0 -7
index e0dbec780fe9..7808d279ff1d 100644
@@ -28,13 +28,6 @@ config PPC_MSI_BITMAP
  source "arch/powerpc/sysdev/xics/Kconfig"
  source "arch/powerpc/sysdev/xive/Kconfig"
 
-config PPC_SCOM
-	bool
-
-config SCOM_DEBUGFS
-	bool "Expose SCOM controllers via debugfs"
-	depends on PPC_SCOM && DEBUG_FS
-
  config GE_FPGA
  	bool
 
arch/powerpc/sysdev/Makefile +0 -2
index aaf23283ba0c..35d52d1d2fc0 100644
@@ -51,8 +51,6 @@ ifdef CONFIG_SUSPEND
  obj-$(CONFIG_PPC_BOOK3S_32)	+= 6xx-suspend.o
  endif
 
-obj-$(CONFIG_PPC_SCOM)		+= scom.o
-
  obj-$(CONFIG_PPC_EARLY_DEBUG_MEMCONS)	+= udbg_memcons.o
 
  obj-$(CONFIG_PPC_XICS)		+= xics/
Signature · 1 line
2.20.1
Signature · 2 lines
Andrew Donnellan              OzLabs, ADL Canberra
[email protected]             IBM Australia Limited