mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: psci: Remove unused code in psci_entry()
@ 2018-06-15  4:21 Andrey Smirnov
  2018-06-15  4:21 ` [PATCH 2/3] ARM: psci: Make use of set_ttbr() in armv7_secure_monitor_install() Andrey Smirnov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrey Smirnov @ 2018-06-15  4:21 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Remove what looks like a leftover code that doesn't appear to be
referenced anywhere.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 arch/arm/cpu/psci.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/arch/arm/cpu/psci.c b/arch/arm/cpu/psci.c
index 435ec92cc..f63f66855 100644
--- a/arch/arm/cpu/psci.c
+++ b/arch/arm/cpu/psci.c
@@ -139,12 +139,6 @@ static unsigned long psci_system_reset(void)
 void psci_entry(u32 r0, u32 r1, u32 r2, u32 r3, u32 r4, u32 r5, u32 r6,
 		struct arm_smccc_res *res)
 {
-	int mmuon;
-	unsigned long ttb;
-
-	mmuon = get_cr() & CR_M;
-	asm volatile ("mrc p15, 0, %0, c2, c0, 0" : "=r"(ttb));
-
 	psci_printf("%s entry, function: 0x%08x\n", __func__, r0);
 
 	switch (r0) {
-- 
2.17.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] ARM: psci: Make use of set_ttbr() in armv7_secure_monitor_install()
  2018-06-15  4:21 [PATCH 1/3] ARM: psci: Remove unused code in psci_entry() Andrey Smirnov
@ 2018-06-15  4:21 ` Andrey Smirnov
  2018-06-15  4:21 ` [PATCH 3/3] ARM: mmu: psci: Make use of get_ttbr() Andrey Smirnov
  2018-06-18  6:59 ` [PATCH 1/3] ARM: psci: Remove unused code in psci_entry() Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Andrey Smirnov @ 2018-06-15  4:21 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 arch/arm/cpu/sm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/cpu/sm.c b/arch/arm/cpu/sm.c
index 5808dfd92..b0bf16405 100644
--- a/arch/arm/cpu/sm.c
+++ b/arch/arm/cpu/sm.c
@@ -193,8 +193,7 @@ int armv7_secure_monitor_install(void)
 	armv7_init_nonsec();
 	__armv7_secure_monitor_install();
 
-	asm volatile ("mcr p15, 0, %0, c2, c0, 0" : : "r"(ttb));
-
+	set_ttbr((void *)ttb);
 	set_vbar(vbar);
 
 	if (mmuon) {
-- 
2.17.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] ARM: mmu: psci: Make use of get_ttbr()
  2018-06-15  4:21 [PATCH 1/3] ARM: psci: Remove unused code in psci_entry() Andrey Smirnov
  2018-06-15  4:21 ` [PATCH 2/3] ARM: psci: Make use of set_ttbr() in armv7_secure_monitor_install() Andrey Smirnov
@ 2018-06-15  4:21 ` Andrey Smirnov
  2018-06-18  6:59 ` [PATCH 1/3] ARM: psci: Remove unused code in psci_entry() Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Andrey Smirnov @ 2018-06-15  4:21 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Introduce a simple inline function to get TTBR and use it in mmu.c and
sm.c

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 arch/arm/cpu/mmu.c | 4 +---
 arch/arm/cpu/mmu.h | 9 +++++++++
 arch/arm/cpu/sm.c  | 3 +--
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
index 7e2e5bf7e..9e765514d 100644
--- a/arch/arm/cpu/mmu.c
+++ b/arch/arm/cpu/mmu.c
@@ -453,10 +453,8 @@ static int mmu_init(void)
 		 * Early MMU code has already enabled the MMU. We assume a
 		 * flat 1:1 section mapping in this case.
 		 */
-		asm volatile ("mrc  p15,0,%0,c2,c0,0" : "=r"(ttb));
-
 		/* Clear unpredictable bits [13:0] */
-		ttb = (uint32_t *)((unsigned long)ttb & ~0x3fff);
+		ttb = (uint32_t *)(get_ttbr() & ~0x3fff);
 
 		if (!request_sdram_region("ttb", (unsigned long)ttb, SZ_16K))
 			/*
diff --git a/arch/arm/cpu/mmu.h b/arch/arm/cpu/mmu.h
index e5bb37025..2e425e092 100644
--- a/arch/arm/cpu/mmu.h
+++ b/arch/arm/cpu/mmu.h
@@ -19,6 +19,15 @@ static inline void __mmu_cache_off(void) {}
 static inline void __mmu_cache_flush(void) {}
 #endif
 
+static inline unsigned long get_ttbr(void)
+{
+	unsigned long ttb;
+
+	asm volatile ("mrc p15, 0, %0, c2, c0, 0" : "=r"(ttb));
+
+	return ttb;
+}
+
 static inline void set_ttbr(void *ttb)
 {
 	asm volatile ("mcr  p15,0,%0,c2,c0,0" : : "r"(ttb) /*:*/);
diff --git a/arch/arm/cpu/sm.c b/arch/arm/cpu/sm.c
index b0bf16405..cb0bac106 100644
--- a/arch/arm/cpu/sm.c
+++ b/arch/arm/cpu/sm.c
@@ -187,8 +187,7 @@ int armv7_secure_monitor_install(void)
 	mmuon = get_cr() & CR_M;
 
 	vbar = get_vbar();
-
-	asm volatile ("mrc p15, 0, %0, c2, c0, 0" : "=r"(ttb));
+	ttb = get_ttbr();
 
 	armv7_init_nonsec();
 	__armv7_secure_monitor_install();
-- 
2.17.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] ARM: psci: Remove unused code in psci_entry()
  2018-06-15  4:21 [PATCH 1/3] ARM: psci: Remove unused code in psci_entry() Andrey Smirnov
  2018-06-15  4:21 ` [PATCH 2/3] ARM: psci: Make use of set_ttbr() in armv7_secure_monitor_install() Andrey Smirnov
  2018-06-15  4:21 ` [PATCH 3/3] ARM: mmu: psci: Make use of get_ttbr() Andrey Smirnov
@ 2018-06-18  6:59 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2018-06-18  6:59 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Thu, Jun 14, 2018 at 09:21:00PM -0700, Andrey Smirnov wrote:
> Remove what looks like a leftover code that doesn't appear to be
> referenced anywhere.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  arch/arm/cpu/psci.c | 6 ------
>  1 file changed, 6 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/cpu/psci.c b/arch/arm/cpu/psci.c
> index 435ec92cc..f63f66855 100644
> --- a/arch/arm/cpu/psci.c
> +++ b/arch/arm/cpu/psci.c
> @@ -139,12 +139,6 @@ static unsigned long psci_system_reset(void)
>  void psci_entry(u32 r0, u32 r1, u32 r2, u32 r3, u32 r4, u32 r5, u32 r6,
>  		struct arm_smccc_res *res)
>  {
> -	int mmuon;
> -	unsigned long ttb;
> -
> -	mmuon = get_cr() & CR_M;
> -	asm volatile ("mrc p15, 0, %0, c2, c0, 0" : "=r"(ttb));
> -
>  	psci_printf("%s entry, function: 0x%08x\n", __func__, r0);
>  
>  	switch (r0) {
> -- 
> 2.17.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-18  6:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-15  4:21 [PATCH 1/3] ARM: psci: Remove unused code in psci_entry() Andrey Smirnov
2018-06-15  4:21 ` [PATCH 2/3] ARM: psci: Make use of set_ttbr() in armv7_secure_monitor_install() Andrey Smirnov
2018-06-15  4:21 ` [PATCH 3/3] ARM: mmu: psci: Make use of get_ttbr() Andrey Smirnov
2018-06-18  6:59 ` [PATCH 1/3] ARM: psci: Remove unused code in psci_entry() Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox