Skip to contentSkip to conversation

ARM: PSCI: Rework the DT handler slightly

PATCH In review Tom Rini 2 participants 3 messages Mar 6, 2015 – Mar 9, 2015 Arm (32-bit)

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 ARM: PSCI: Rework the DT handler slightly

The way the PSCI DT update happens currently means we pull in <asm/armv7.h> everywhere, including on ARMv8 and that in turn brings in <asm/io.h> for some non-PSCI related things that header needs to deal with.

To fix this, we rework the hook slightly. A good portion of arch/arm/cpu/armv7/virt-dt.c is common looking and I hope that when PSCI is needed on ARMv8 we can re-use this by and large. So rename the current hook to psci_update_dt(), move the prototype to <asm/psci.h> and add an #ifdef that will make re-use later easier.

Cc Marc Zyngier <[email protected]>
Cc York Sun <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Albert ARIBAUD <[email protected]>
---
 arch/arm/cpu/armv7/virt-dt.c |    4 +++-
 arch/arm/include/asm/armv7.h |    1 -
 arch/arm/include/asm/psci.h  |    4 ++++
 arch/arm/lib/bootm-fdt.c     |    4 ++--
 4 files changed, 9 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/virt-dt.c +3 -1
index ad19e4c..9408e33 100644
@@ -88,10 +88,12 @@ static int fdt_psci(void *fdt)
 	return 0;
 }
 
-int armv7_update_dt(void *fdt)
+int psci_update_dt(void *fdt)
 {
+#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV7_VIRT)
 	if (!armv7_boot_nonsec())
 		return 0;
+#endif
 #ifndef CONFIG_ARMV7_SECURE_BASE
 	/* secure code lives in RAM, keep it alive */
 	fdt_add_mem_rsv(fdt, (unsigned long)__secure_start,
arch/arm/include/asm/armv7.h +0 -1
index edb3b80..c3cc508 100644
@@ -124,7 +124,6 @@ void v7_outer_cache_inval_range(u32 start, u32 end);
 #if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV7_VIRT)
 
 int armv7_init_nonsec(void);
-int armv7_update_dt(void *fdt);
 bool armv7_boot_nonsec(void);
 
 /* defined in assembly file */
arch/arm/include/asm/psci.h +4 -0
index 704b4b0..50a3ca4 100644
@@ -32,4 +32,8 @@
 #define ARM_PSCI_RET_INVAL		(-2)
 #define ARM_PSCI_RET_DENIED		(-3)
 
+#ifndef __ASSEMBLY__
+int psci_update_dt(void *fdt);
+#endif /* ! __ASSEMBLY__ */
+
 #endif /* __ARM_PSCI_H__ */
arch/arm/lib/bootm-fdt.c +2 -2
index d4f1578..665a3bc 100644
@@ -17,7 +17,7 @@
 
 #include <common.h>
 #include <fdt_support.h>
-#include <asm/armv7.h>
+#include <asm/psci.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -38,7 +38,7 @@ int arch_fixup_fdt(void *blob)
 	if (ret)
 		return ret;
 
-	ret = armv7_update_dt(blob);
+	ret = psci_update_dt(blob);
 #endif
 	return ret;
 }
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 ARM: PSCI: Rework the DT handler slightly

Quoted 83 lines · Tom Rini

The way the PSCI DT update happens currently means we pull in <asm/armv7.h> everywhere, including on ARMv8 and that in turn brings in <asm/io.h> for some non-PSCI related things that header needs to deal with.

To fix this, we rework the hook slightly. A good portion of arch/arm/cpu/armv7/virt-dt.c is common looking and I hope that when PSCI is needed on ARMv8 we can re-use this by and large. So rename the current hook to psci_update_dt(), move the prototype to <asm/psci.h> and add an #ifdef that will make re-use later easier.

Cc Marc Zyngier <[email protected]>
Cc York Sun <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Albert ARIBAUD <[email protected]>
---
 arch/arm/cpu/armv7/virt-dt.c |    4 +++-
 arch/arm/include/asm/armv7.h |    1 -
 arch/arm/include/asm/psci.h  |    4 ++++
 arch/arm/lib/bootm-fdt.c     |    4 ++--
 4 files changed, 9 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/virt-dt.c +3 -1
index ad19e4c..9408e33 100644
@@ -88,10 +88,12 @@ static int fdt_psci(void *fdt)
 	return 0;
 }
 
-int armv7_update_dt(void *fdt)
+int psci_update_dt(void *fdt)
 {
+#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV7_VIRT)
 	if (!armv7_boot_nonsec())
 		return 0;
+#endif
 #ifndef CONFIG_ARMV7_SECURE_BASE
 	/* secure code lives in RAM, keep it alive */
 	fdt_add_mem_rsv(fdt, (unsigned long)__secure_start,
arch/arm/include/asm/armv7.h +0 -1
index edb3b80..c3cc508 100644
@@ -124,7 +124,6 @@ void v7_outer_cache_inval_range(u32 start, u32 end);
 #if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV7_VIRT)
 
 int armv7_init_nonsec(void);
-int armv7_update_dt(void *fdt);
 bool armv7_boot_nonsec(void);
 
 /* defined in assembly file */
arch/arm/include/asm/psci.h +4 -0
index 704b4b0..50a3ca4 100644
@@ -32,4 +32,8 @@
 #define ARM_PSCI_RET_INVAL		(-2)
 #define ARM_PSCI_RET_DENIED		(-3)
 
+#ifndef __ASSEMBLY__
+int psci_update_dt(void *fdt);
+#endif /* ! __ASSEMBLY__ */
+
 #endif /* __ARM_PSCI_H__ */
arch/arm/lib/bootm-fdt.c +1 -1
index d4f1578..665a3bc 100644
@@ -17,7 +17,7 @@
 
 #include <common.h>
 #include <fdt_support.h>
-#include <asm/armv7.h>
+#include <asm/psci.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 

arch/arm/lib/bootm-fdt.c int arch_fixup_fdt(void *blob) · line 44

Quoted 8 lines
arch/arm/lib/bootm-fdt.c +1 -1
@@ -38,7 +38,7 @@ int arch_fixup_fdt(void *blob)
 	if (ret)
 		return ret;
 
-	ret = armv7_update_dt(blob);
+	ret = psci_update_dt(blob);
 #endif
 	return ret;
 }

Tested on armv8 targets.

author
#2 lore raw
In reply to Tom Rini
Quoted 11 lines · Tom Rini

The way the PSCI DT update happens currently means we pull in <asm/armv7.h> everywhere, including on ARMv8 and that in turn brings in <asm/io.h> for some non-PSCI related things that header needs to deal with.

To fix this, we rework the hook slightly. A good portion of arch/arm/cpu/armv7/virt-dt.c is common looking and I hope that when PSCI is needed on ARMv8 we can re-use this by and large. So rename the current hook to psci_update_dt(), move the prototype to <asm/psci.h> and add an #ifdef that will make re-use later easier.

Quoted 8 lines
Cc Marc Zyngier <[email protected]>
Cc York Sun <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Albert ARIBAUD <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150309/cb9ef363/attachment.sig>