ARM: mmu: Set domain permissions to client access
cover ARM: mmu: Set domain permissions to client access
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by
<Vincent Stehle <[email protected]>
[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
R Sricharan (2):
ARM: mmu: Introduce weak dram_bank_setup function
ARM: mmu: Set domain permissions to client access
arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 1 + arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 13 ++++++++- 5 files changed, 65 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
PATCH 1/2 ARM: mmu: Introduce weak dram_bank_setup function
Introduce a weak version of dram_bank_setup function to allow a platform specific function.
This is used in the subsequent patch to setup dram region without 'XN' attribute in order to enable the region under client permissions.
--- arch/arm/include/asm/cache.h | 1 + arch/arm/lib/cache-cp15.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
arch/arm/include/asm/cache.h +1 -0
@@ -42,6 +42,7 @@ static inline void invalidate_l2_cache(void)void l2_cache_enable (void );void l2_cache_disable (void ); +void dram_bank_mmu_setup (int bank);/* * The current upper bound for ARM L1 data cache line sizes is 64 bytes. We * use that value for aligning DMA buffers unless the board config has specified
arch/arm/lib/cache-cp15.c +3 -1
@@ -23,6 +23,8 @@#include <common.h> #include <asm/system.h> +#include <asm/cache.h> +#include <linux/compiler.h> #if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))
@@ -77,7 +79,7 @@ void mmu_set_region_dcache_behaviour(u32 start, int size,mmu_page_table_flush ((u32)&page_table[start], (u32)&page_table[end]); } -static inline void dram_bank_mmu_setup (int bank) +__weak void dram_bank_mmu_setup (int bank) {bd_t *bd = gd->bd;int i;
Signature · 1 line
1.7.9.5
PATCH 1/2 ARM: mmu: Introduce weak dram_bank_setup function
In reply to R SricharanIntroduce a weak version of dram_bank_setup function to allow a platform specific function.
This is used in the subsequent patch to setup dram region without 'XN' attribute in order to enable the region under client permissions.
--- arch/arm/include/asm/cache.h | 1 + arch/arm/lib/cache-cp15.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
arch/arm/include/asm/cache.h +1 -0
@@ -42,6 +42,7 @@ static inline void invalidate_l2_cache(void)void l2_cache_enable (void );void l2_cache_disable (void ); +void dram_bank_mmu_setup (int bank);/* * The current upper bound for ARM L1 data cache line sizes is 64 bytes. We * use that value for aligning DMA buffers unless the board config has specified
arch/arm/lib/cache-cp15.c +3 -1
@@ -23,6 +23,8 @@#include <common.h> #include <asm/system.h> +#include <asm/cache.h> +#include <linux/compiler.h> #if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))
@@ -77,7 +79,7 @@ void mmu_set_region_dcache_behaviour(u32 start, int size,mmu_page_table_flush ((u32)&page_table[start], (u32)&page_table[end]); } -static inline void dram_bank_mmu_setup (int bank) +__weak void dram_bank_mmu_setup (int bank) {bd_t *bd = gd->bd;int i;
Signature · 1 line
1.7.9.5
PATCH 2/2 ARM: mmu: Set domain permissions to client access
In reply to R SricharanThe 'XN' execute never bit is set in the pagetables. This will prevent speculative prefetches to non executable regions. But the domain permissions are set as master in the DACR register. So the pagetable attribute for 'XN' is not effective. Change the permissions to client.
This fixes lot of speculative prefetch aborts seen on OMAP5 secure devices.
--- arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 7 +++++ 4 files changed, 59 insertions(+)
arch/arm/cpu/armv7/cache_v7.c +3 -0
@@ -340,6 +340,9 @@ void mmu_page_table_flush(unsigned long start, unsigned long stop) { } +void arm_init_domains (void ) +{ +}#endif /* #ifndef CONFIG_SYS_DCACHE_OFF */ #ifndef CONFIG_SYS_ICACHE_OFF
arch/arm/cpu/armv7/omap-common/hwinit-common.c +35 -0
@@ -32,6 +32,12 @@#include <asm/arch/sys_proto.h> #include <asm/sizes.h> #include <asm/emif.h> +#include <asm/cache.h> +#include <asm/system.h> + +#define ARMV7_DCACHE_WRITEBACK 0xe +#define ARMV7_DOMAIN_CLIENT 1 +#define ARMV7_DOMAIN_MASK (0x3 << 0)DECLARE_GLOBAL_DATA_PTR ;
@@ -258,4 +264,33 @@ void enable_caches(void)/* Enable D-cache. I-cache is already enabled in start.S */ dcache_enable(); } + +void dram_bank_mmu_setup (int bank) +{ +bd_t *bd = gd->bd; +int i; + +u32 start = bd->bi_dram[bank].start >>20 ; +u32 size = bd->bi_dram[bank].size >>20 ; +u32 end = start + size; + +debug ("%s: bank: %d\n" , __func__, bank); +for (i = start; i < end; i++) +set_section_dcache (i,ARMV7_DCACHE_WRITEBACK ); + +} + +void arm_init_domains (void ) +{ +u32 reg; + + reg =get_dacr (); +/* +* Set DOMAIN to client access so that all permissions +* set in pagetables are validated by the mmu. +*/ + reg &= ~ARMV7_DOMAIN_MASK ; + reg |=ARMV7_DOMAIN_CLIENT ; +set_dacr (reg); +}#endif
arch/arm/include/asm/system.h +14 -0
@@ -75,6 +75,20 @@ static inline void set_cr(unsigned int val)isb (); } +static inline unsigned int get_dacr (void ) +{ +unsigned int val; + asm("mrc p15, 0, %0, c3, c0, 0 @ get DACR" :"=r" (val) : :"cc" ); +return val; +} + +static inline void set_dacr (unsigned int val) +{ + asmvolatile ("mcr p15, 0, %0, c3, c0, 0 @ set DACR" + : :"r" (val) :"cc" ); +isb (); +} +/* options available for data cache on each page */ enum dcache_option {DCACHE_OFF =0x12 ,
arch/arm/lib/cache-cp15.c +7 -0
@@ -36,6 +36,10 @@ void __arm_init_before_mmu(void)void arm_init_before_mmu (void ) __attribute__((weak,alias ("__arm_init_before_mmu" ))); +__weak void arm_init_domains (void ) +{ +} +static void cp_delay (void ) {volatile int i;
@@ -117,6 +121,9 @@ static inline void mmu_setup(void)/* Set the access control to all-supervisor */ asmvolatile ("mcr p15, 0, %0, c3, c0, 0" : :"r" (~0 )); + +arm_init_domains (); +/* and enable the mmu */ reg =get_cr ();/* get control reg. */ cp_delay ();
Signature · 1 line
1.7.9.5
cover ARM: mmu: Set domain permissions to client access
In reply to R SricharanHi R Sicharan, Vincent,
Quoted 20 lines · R Sricharan
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by
<Vincent Stehle <[email protected]>[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
R Sricharan (2):
ARM: mmu: Introduce weakdram_bank_setupfunction
ARM: mmu: Set domain permissions to client access
Quoted 6 lines
arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 1 + arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 13 ++++++++- 5 files changed, 65 insertions(+), 1 deletion(-)
Does that mean the rest of Vincent's patch set is not needed any more?
Amicalement,
Signature · 1 line
Albert.
cover ARM: mmu: Set domain permissions to client access
Hi,
Quoted 25 lines · Albert ARIBAUD
Hi R Sicharan, Vincent,
Quoted 20 lines · R Sricharan
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by
<Vincent Stehle <[email protected]>[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
R Sricharan (2):
ARM: mmu: Introduce weakdram_bank_setupfunction
ARM: mmu: Set domain permissions to client access
Quoted 8 lines
Quoted 6 lines
arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 1 + arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 13 ++++++++- 5 files changed, 65 insertions(+), 1 deletion(-)Does that mean the rest of Vincent's patch set is not needed any more?
Except for one patch that i have mentioned, rest are needed
http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
Regards,
Sricharan
cover ARM: mmu: Set domain permissions to client access
Hi,
Quoted 36 lines · R Sricharan
Hi,
Quoted 33 lines · Albert ARIBAUD
Hi R Sicharan, Vincent,
On Tue, 8 Jan 2013 23:38:22 +0530, R Sricharan <[email protected]>
wrote: i meantQuoted 27 lines
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by
<Vincent Stehle <[email protected]>[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
R Sricharan (2):
ARM: mmu: Introduce weakdram_bank_setupfunction
ARM: mmu: Set domain permissions to client accessarch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 1 + arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 13 ++++++++- 5 files changed, 65 insertions(+), 1 deletion(-)
Quoted 5 lines
Quoted 1 line
Does that mean the rest of Vincent's patch set is not needed any more?
Except for one patch that i have mentioned, rest are needed
http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
Sorry..
i meant Except for one patch, rest are "not needed"
Regards,
Sricharan
cover ARM: mmu: Set domain permissions to client access
Hi R,
Quoted 38 lines · R Sricharan
Hi,
Quoted 36 lines · R Sricharan
Hi,
Quoted 33 lines · Albert ARIBAUD
Hi R Sicharan, Vincent,
On Tue, 8 Jan 2013 23:38:22 +0530, R Sricharan <[email protected]>
wrote: i meantQuoted 27 lines
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by
<Vincent Stehle <[email protected]>[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
R Sricharan (2):
ARM: mmu: Introduce weakdram_bank_setupfunction
ARM: mmu: Set domain permissions to client accessarch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 1 + arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 13 ++++++++- 5 files changed, 65 insertions(+), 1 deletion(-)
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Does that mean the rest of Vincent's patch set is not needed any more?
Except for one patch that i have mentioned, rest are needed
http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.htmlSorry..
i meant Except for one patch, rest are "not needed"
Sorry, I may not have made myself clear enough. Does your patchset replace Vincent's patches 2/3 and 3/3 and should I consider them "superseded"?
Quoted 2 lines
Regards,
Sricharan
Amicalement,
Signature · 1 line
Albert.
cover ARM: mmu: Set domain permissions to client access
Quoted 46 lines · Albert ARIBAUD
Hi R,
Quoted 41 lines · R Sricharan
Hi,
Quoted 39 lines · R Sricharan
Hi,
Quoted 33 lines · Albert ARIBAUD
Hi R Sicharan, Vincent,
On Tue, 8 Jan 2013 23:38:22 +0530, R Sricharan <[email protected]>
wrote: i meantQuoted 20 lines
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by
<Vincent Stehle <[email protected]>[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
R Sricharan (2):
ARM: mmu: Introduce weakdram_bank_setupfunction
ARM: mmu: Set domain permissions to client accessQuoted 7 lines
arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 1 + arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 13 ++++++++- 5 files changed, 65 insertions(+), 1 deletion(-)Quoted 1 line
Does that mean the rest of Vincent's patch set is not needed any more?
Except for one patch that i have mentioned, rest are needed
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.htmlSorry..
i meant Except for one patch, rest are "not needed"Sorry, I may not have made myself clear enough. Does your patchset replace Vincent's patches 2/3 and 3/3 and should I consider them "superseded"?
Yes, you are correct.
Regards,
Sricharan
cover ARM: mmu: Set domain permissions to client access
In reply to R Sricharan(sorry for any duplicate of this mail)
Hi R Sricharan,
Quoted 20 lines · R Sricharan
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by
<Vincent Stehle <[email protected]>[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
R Sricharan (2):
ARM: mmu: Introduce weakdram_bank_setupfunction
ARM: mmu: Set domain permissions to client access
Quoted 7 lines
arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 1 + arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 13 ++++++++- 5 files changed, 65 insertions(+), 1 deletion(-)
Series applied to u-boot-arm/master, thanks!
Amicalement,
Signature · 1 line
Albert.
cover ARM: mmu: Set domain permissions to client access - build warnings!
Quoted 35 lines · Albert ARIBAUD
(sorry for any duplicate of this mail)
Hi R Sricharan,
Quoted 20 lines · R Sricharan
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by
<Vincent Stehle <[email protected]>[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
R Sricharan (2):
ARM: mmu: Introduce weakdram_bank_setupfunction
ARM: mmu: Set domain permissions to client accessQuoted 7 lines
arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 1 + arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 13 ++++++++- 5 files changed, 65 insertions(+), 1 deletion(-)
Quoted 1 line
Series applied to u-boot-arm/master, thanks!
Correction: I'd wrongly inferred from the testing done on OMAP5 that the series would build fine. However it appears that for targets omap4_sdp4430, omap4_panda and omap5_evm, patch 2/2 has warnings:
hwinit-common.c: In function 'dram_bank_mmu_setup':
hwinit-common.c:279:3: warning: implicit declaration of function 'set_section_dcache' [-Wimplicit-function-declaration]
Luckily, I had not committed to the git repo yet.
R Sicharan, can you please check and fix this warning?
Amicalement,
Signature · 1 line
Albert.
cover ARM: mmu: Set domain permissions to client access - build warnings!
Hi Albert,
Quoted 46 lines · Albert ARIBAUD
Quoted 27 lines · Albert ARIBAUD
(sorry for any duplicate of this mail)
Hi R Sricharan,
Quoted 20 lines · R Sricharan
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by
<Vincent Stehle<[email protected]>[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
R Sricharan (2):
ARM: mmu: Introduce weakdram_bank_setupfunction
ARM: mmu: Set domain permissions to client accessQuoted 8 lines
Quoted 7 lines
arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 1 + arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 13 ++++++++- 5 files changed, 65 insertions(+), 1 deletion(-)Series applied to u-boot-arm/master, thanks!
Correction: I'd wrongly inferred from the testing done on OMAP5 that the series would build fine. However it appears that for targets
omap4_sdp4430,omap4_pandaandomap5_evm, patch 2/2 has warnings:
hwinit-common.c: In function 'dram_bank_mmu_setup':
hwinit-common.c:279:3: warning: implicit declaration of function 'set_section_dcache' [-Wimplicit-function-declaration]
Quoted 5 lines
Luckily, I had not committed to the git repo yet.
R Sicharan, can you please check and fix this warning?
Amicalement,
Oh, thats because as i mentioned above, it depends on the below patch from vincent .
http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
I did not repost it though. I will do it now for clarity.
Regards,
Sricharan
PATCH RESEND 1/1 ARM: cache: declare set_section_dcache
From: Vincent Stehl? <[email protected]>
We declare the set_section_dcache function globally in the cache header, for later use by e.g. machine specific code.
--- arch/arm/include/asm/cache.h | 1 + 1 file changed, 1 insertion(+)
arch/arm/include/asm/cache.h +1 -0
@@ -41,6 +41,7 @@ static inline void invalidate_l2_cache(void)void l2_cache_enable (void );void l2_cache_disable (void ); +void set_section_dcache (int section,enum dcache_option option);/* * The current upper bound for ARM L1 data cache line sizes is 64 bytes. We
Signature · 1 line
1.7.9.5
cover ARM: mmu: Set domain permissions to client access - build warnings!
In reply to Sricharan RHi Sricharan,
Quoted 53 lines · Sricharan R
Hi Albert,
Quoted 50 lines · Albert ARIBAUD
Quoted 27 lines · Albert ARIBAUD
(sorry for any duplicate of this mail)
Hi R Sricharan,
Quoted 20 lines · R Sricharan
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by
<Vincent Stehle<[email protected]>[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
R Sricharan (2):
ARM: mmu: Introduce weakdram_bank_setupfunction
ARM: mmu: Set domain permissions to client accessQuoted 8 lines
Quoted 7 lines
arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 1 + arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 13 ++++++++- 5 files changed, 65 insertions(+), 1 deletion(-)Series applied to u-boot-arm/master, thanks!
Correction: I'd wrongly inferred from the testing done on OMAP5 that the series would build fine. However it appears that for targets
omap4_sdp4430,omap4_pandaandomap5_evm, patch 2/2 has warnings:
hwinit-common.c: In function 'dram_bank_mmu_setup':
hwinit-common.c:279:3: warning: implicit declaration of function 'set_section_dcache' [-Wimplicit-function-declaration]Luckily, I had not committed to the git repo yet.
R Sicharan, can you please check and fix this warning?
Quoted 7 lines
Quoted 1 line
Amicalement,
Oh, thats because as i mentioned above, it depends on the below patch from vincent .
http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.htmlI did not repost it though. I will do it now for clarity.
Ok -- Vincent's patch was not in my Patchwork TODO and I had read patches 1/2 and 2/2 in Patchwork, but I had not read the cover letter thoroughly enough so I had missed the dependency.
(Cc:ing Vincent and Tom)
Vincent's patch series is delegated to Tom and marked "superseded" in Patchwork but I don't see any later, superseding, series. What can/should I make of it?
Quoted 2 lines
Regards,
Sricharan
Amicalement,
Signature · 1 line
Albert.
cover ARM: mmu: Set domain permissions to client access - build warnings!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 39 lines · Albert ARIBAUD
Hi Sricharan,
Quoted 34 lines · Sricharan R
Hi Albert,
Quoted 31 lines · Albert ARIBAUD
Quoted 28 lines · Albert ARIBAUD
(sorry for any duplicate of this mail)
Hi R Sricharan,
Quoted 21 lines · R Sricharan
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by <Vincent Stehle<[email protected]>
[1]
http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
R Sricharan (2):
Quoted 38 lines
Quoted 26 lines
Quoted 26 lines
Quoted 11 lines
Quoted 11 lines
ARM: mmu: Introduce weak
dram_bank_setupfunction ARM: mmu:
Set domain permissions to client access
arch/arm/cpu/armv7/cache_v7.c| 3 ++arch/arm/cpu/armv7/omap-common/hwinit-common.c| 35
++++++++++++++++++++++++arch/arm/include/asm/cache.h
| 1 +arch/arm/include/asm/system.h|
14 ++++++++++arch/arm/lib/cache-cp15.c
| 13 ++++++++- 5 files changed, 65 insertions(+), 1
deletion(-)Quoted 1 line
Series applied to u-boot-arm/master, thanks!
Correction: I'd wrongly inferred from the testing done on OMAP5 that the series would build fine. However it appears that for targets
omap4_sdp4430,omap4_pandaandomap5_evm, patch 2/2 has warnings:
hwinit-common.c: In function 'dram_bank_mmu_setup':
hwinit-common.c:279:3: warning: implicit declaration of function 'set_section_dcache' [-Wimplicit-function-declaration]Luckily, I had not committed to the git repo yet.
R Sicharan, can you please check and fix this warning?
Quoted 7 lines
Quoted 1 line
Amicalement,
Oh, thats because as i mentioned above, it depends on the below patch from vincent .
http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
I did not repost it though. I will do it now for clarity.
Ok -- Vincent's patch was not in my Patchwork TODO and I had read patches 1/2 and 2/2 in Patchwork, but I had not read the cover letter thoroughly enough so I had missed the dependency.
Quoted 5 lines
(Cc:ing Vincent and Tom)
Vincent's patch series is delegated to Tom and marked "superseded" in Patchwork but I don't see any later, superseding, series. What can/should I make of it?
It's possible I mis-read things and it shouldn't be superseded. Can you list all of the patches that Albert should apply please? Thanks!
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRMLl9AAoJENk4IS6UOR1WPX4P+wRRwsSgPm5edbbBN/TkBi6a x1LIMEKYC2QN73ea8czz4oeOR76MXidQUdYRmimJ2qzYRaEq9Y9ulFjIs0zc/6Gu ydnO4eeb8keU27ItlmKubnEOwsev/wtZNIQhvwJJNvuSiG9rBvKAGDh9L8UQrq3t cwhqWpNhL4isoYG/rB2BDHKrwB62DboOzmaNHACpVaCZNg606QH+eHnget1CWBCD p2O88TSkOVoQHVAj76mdgm8+9WE/mlqn5h4RUU81U3DHiAuTDg0N+J1IJPd3zjhP 86zvj1q4i3JuZySg+IdxouiPTqnw88ZYJ2XHtQvAeDGr5Q680Gb1k18vMIRGlNtv AVx9ipQHaOFXSbTQzlmTNT4EutseaGVa5Ioj3vUkRozBONIfuDmEZAnE+YXFfgQV OQZzidbWLOSFbfDPSi6XMUgtXVEtUPP6eGPV0sv5HUvfYr+3zUMtFwdGqe47X1lC z5V1xpug2mOvU0+6l1nO1egxdRM1JlHroV33oRBXMFoUZUowpobGWeJubjw7WB86 39qoR4xwnyPup3+HHlKVBXmRg6j7jayOUdU0o69kJYO7M0QB/CjADePpSDTrcb9n lkk5KSYVQRzbOar7n9J6jiYoL5WFdj7uSCLpfQ5u/b26r/U2I/YGWPj/w6oGR9+v +3tp/XeRDuXUQkplQEd7
=jW2y
-----END PGP SIGNATURE-----
R
cover ARM: mmu: Set domain permissions to client access - build warnings!
Hi Tom/Albert,
________________________________________
From: Rini, Tom
Sent: Friday, March 01, 2013 7:51 PM
To: Albert ARIBAUD
Cc: R, Sricharan; U-Boot; Stehle, Vincent
Subject: Re: [U-Boot] [PATCH 0/2] ARM: mmu: Set domain permissions to client access - build warnings!
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 39 lines · Albert ARIBAUD
Hi Sricharan,
Quoted 34 lines · Sricharan R
Hi Albert,
Quoted 31 lines · Albert ARIBAUD
Quoted 28 lines · Albert ARIBAUD
(sorry for any duplicate of this mail)
Hi R Sricharan,
Quoted 21 lines · R Sricharan
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by <Vincent Stehle<[email protected]>
[1]
http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
R Sricharan (2):
Quoted 38 lines
Quoted 26 lines
Quoted 26 lines
Quoted 11 lines
Quoted 11 lines
ARM: mmu: Introduce weak
dram_bank_setupfunction ARM: mmu:
Set domain permissions to client access
arch/arm/cpu/armv7/cache_v7.c| 3 ++arch/arm/cpu/armv7/omap-common/hwinit-common.c| 35
++++++++++++++++++++++++arch/arm/include/asm/cache.h
| 1 +arch/arm/include/asm/system.h|
14 ++++++++++arch/arm/lib/cache-cp15.c
| 13 ++++++++- 5 files changed, 65 insertions(+), 1
deletion(-)Quoted 1 line
Series applied to u-boot-arm/master, thanks!
Correction: I'd wrongly inferred from the testing done on OMAP5 that the series would build fine. However it appears that for targets
omap4_sdp4430,omap4_pandaandomap5_evm, patch 2/2 has warnings:
hwinit-common.c: In function 'dram_bank_mmu_setup':
hwinit-common.c:279:3: warning: implicit declaration of function 'set_section_dcache' [-Wimplicit-function-declaration]Luckily, I had not committed to the git repo yet.
R Sicharan, can you please check and fix this warning?
Quoted 7 lines
Quoted 1 line
Amicalement,
Oh, thats because as i mentioned above, it depends on the below patch from vincent .
http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
I did not repost it though. I will do it now for clarity.
Ok -- Vincent's patch was not in my Patchwork TODO and I had read patches 1/2 and 2/2 in Patchwork, but I had not read the cover letter thoroughly enough so I had missed the dependency.
Quoted 8 lines
(Cc:ing Vincent and Tom)
Vincent's patch series is delegated to Tom and marked "superseded" in Patchwork but I don't see any later, superseding, series. What can/should I make of it?
It's possible I mis-read things and it shouldn't be superseded. Can you list all of the patches that Albert should apply please? Thanks!
Sorry, i should have mentioned this clearly previously.
I reposted it again. (ie) only the below patch from Vincent should be applied first.
http://www.mail-archive.com/u-boot at lists.denx.de/msg107190.html
Apologies for the confusion..
Regards,
Sricharan
cover ARM: mmu: Set domain permissions to client access - build warnings!
Hi Sricharan,
Quoted 99 lines · Sricharan
Hi Tom/Albert,
________________________________________
From: Rini, Tom
Sent: Friday, March 01, 2013 7:51 PM
To: Albert ARIBAUD
Cc: R, Sricharan; U-Boot; Stehle, Vincent
Subject: Re: [U-Boot] [PATCH 0/2] ARM: mmu: Set domain permissions to client access - build warnings!-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 39 lines · Albert ARIBAUD
Hi Sricharan,
Quoted 34 lines · Sricharan R
Hi Albert,
Quoted 31 lines · Albert ARIBAUD
Quoted 28 lines · Albert ARIBAUD
(sorry for any duplicate of this mail)
Hi R Sricharan,
Quoted 21 lines · R Sricharan
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This series depends on [1] the patch sent by <Vincent Stehle<[email protected]>
[1]
http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.htmlR Sricharan (2):
Quoted 38 lines
Quoted 26 lines
Quoted 26 lines
Quoted 11 lines
Quoted 11 lines
ARM: mmu: Introduce weak
dram_bank_setupfunction ARM: mmu:
Set domain permissions to client access
arch/arm/cpu/armv7/cache_v7.c| 3 ++arch/arm/cpu/armv7/omap-common/hwinit-common.c| 35
++++++++++++++++++++++++arch/arm/include/asm/cache.h
| 1 +arch/arm/include/asm/system.h|
14 ++++++++++arch/arm/lib/cache-cp15.c
| 13 ++++++++- 5 files changed, 65 insertions(+), 1
deletion(-)Quoted 1 line
Series applied to u-boot-arm/master, thanks!
Correction: I'd wrongly inferred from the testing done on OMAP5 that the series would build fine. However it appears that for targets
omap4_sdp4430,omap4_pandaandomap5_evm, patch 2/2 has warnings:
hwinit-common.c: In function 'dram_bank_mmu_setup':
hwinit-common.c:279:3: warning: implicit declaration of function 'set_section_dcache' [-Wimplicit-function-declaration]Luckily, I had not committed to the git repo yet.
R Sicharan, can you please check and fix this warning?
Quoted 7 lines
Quoted 1 line
Amicalement,
Oh, thats because as i mentioned above, it depends on the below patch from vincent .
http://www.mail-archive.com/u-boot at lists.denx.de/msg102709.html
I did not repost it though. I will do it now for clarity.
Ok -- Vincent's patch was not in my Patchwork TODO and I had read patches 1/2 and 2/2 in Patchwork, but I had not read the cover letter thoroughly enough so I had missed the dependency.
Quoted 8 lines
(Cc:ing Vincent and Tom)
Vincent's patch series is delegated to Tom and marked "superseded" in Patchwork but I don't see any later, superseding, series. What can/should I make of it?
It's possible I mis-read things and it shouldn't be superseded. Can you list all of the patches that Albert should apply please? Thanks!
Quoted 6 lines
Sorry, i should have mentioned this clearly previously.
I reposted it again. (ie) only the below patch from Vincent should be applied first.
http://www.mail-archive.com/u-boot at lists.denx.de/msg107190.htmlApologies for the confusion..
Just to be clear: to apply Sricharan's series, patch 1/3 of Vincent's series is reqired, but I think Vincent's series should be applied in one go, not patch by patch. Basically, this means we need Vincent's series to be applied first, then we can apply Sricharan's.
Quoted 2 lines
Regards,
Sricharan
Amicalement,
Signature · 1 line
Albert.
cover ARM: mmu: Set domain permissions to client access - build warnings!
Quoted 2 lines · Albert ARIBAUD
(..) Basically, this means we need Vincent's series to be applied first, then we can apply Sricharan's.
Hi,
I think this is too much trouble for a "one liner". Please feel free to squash.
Best regards,
V.
cover ARM: mmu: Set domain permissions to client access
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This is a repost of the older series to include Vincent's patch in the same one.
R Sricharan (2):
ARM: mmu: Introduce weak dram_bank_setup function
ARM: mmu: Set domain permissions to client access
Vincent Stehl? (1):
ARM: cache: declare set_section_dcache
arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 2 ++ arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 11 +++++++- 5 files changed, 64 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
PATCH RESEND 1/3 ARM: cache: declare set_section_dcache
From: Vincent Stehl? <[email protected]>
We declare the set_section_dcache function globally in the cache header, for later use by e.g. machine specific code.
--- arch/arm/include/asm/cache.h | 1 + 1 file changed, 1 insertion(+)
arch/arm/include/asm/cache.h +1 -0
@@ -41,6 +41,7 @@ static inline void invalidate_l2_cache(void)void l2_cache_enable (void );void l2_cache_disable (void ); +void set_section_dcache (int section,enum dcache_option option);/* * The current upper bound for ARM L1 data cache line sizes is 64 bytes. We
Signature · 1 line
1.7.9.5
PATCH RESEND 2/3 ARM: mmu: Introduce weak dram_bank_setup function
In reply to Sricharan RFrom: R Sricharan <[email protected]>
Introduce a weak version of dram_bank_setup function to allow a platform specific function.
This is used in the subsequent patch to setup dram region without 'XN' attribute in order to enable the region under client permissions.
--- arch/arm/include/asm/cache.h | 1 + arch/arm/lib/cache-cp15.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
arch/arm/include/asm/cache.h +1 -0
@@ -43,6 +43,7 @@ void l2_cache_enable(void);void l2_cache_disable (void );void set_section_dcache (int section,enum dcache_option option); +void dram_bank_mmu_setup (int bank);/* * The current upper bound for ARM L1 data cache line sizes is 64 bytes. We * use that value for aligning DMA buffers unless the board config has specified
arch/arm/lib/cache-cp15.c +3 -1
@@ -23,6 +23,8 @@#include <common.h> #include <asm/system.h> +#include <asm/cache.h> +#include <linux/compiler.h> #if !(defined(CONFIG_SYS_ICACHE_OFF ) && defined(CONFIG_SYS_DCACHE_OFF ))
@@ -77,7 +79,7 @@ void mmu_set_region_dcache_behaviour(u32 start, int size,mmu_page_table_flush ((u32)&page_table[start], (u32)&page_table[end]); } -static inline void dram_bank_mmu_setup (int bank) +__weak void dram_bank_mmu_setup (int bank) {bd_t *bd = gd->bd;int i;
Signature · 1 line
1.7.9.5
PATCH RESEND 3/3 ARM: mmu: Set domain permissions to client access
In reply to Sricharan RFrom: R Sricharan <[email protected]>
The 'XN' execute never bit is set in the pagetables. This will prevent speculative prefetches to non executable regions. But the domain permissions are set as master in the DACR register. So the pagetable attribute for 'XN' is not effective. Change the permissions to client.
This fixes lot of speculative prefetch aborts seen on OMAP5 secure devices.
--- arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 7 +++++ 4 files changed, 59 insertions(+)
arch/arm/cpu/armv7/cache_v7.c +3 -0
@@ -340,6 +340,9 @@ void mmu_page_table_flush(unsigned long start, unsigned long stop) { } +void arm_init_domains (void ) +{ +}#endif /* #ifndef CONFIG_SYS_DCACHE_OFF */ #ifndef CONFIG_SYS_ICACHE_OFF
arch/arm/cpu/armv7/omap-common/hwinit-common.c +35 -0
@@ -32,6 +32,12 @@#include <asm/arch/sys_proto.h> #include <asm/sizes.h> #include <asm/emif.h> +#include <asm/cache.h> +#include <asm/system.h> + +#define ARMV7_DCACHE_WRITEBACK 0xe +#define ARMV7_DOMAIN_CLIENT 1 +#define ARMV7_DOMAIN_MASK (0x3 << 0)DECLARE_GLOBAL_DATA_PTR ;
@@ -258,4 +264,33 @@ void enable_caches(void)/* Enable D-cache. I-cache is already enabled in start.S */ dcache_enable(); } + +void dram_bank_mmu_setup (int bank) +{ +bd_t *bd = gd->bd; +int i; + +u32 start = bd->bi_dram[bank].start >>20 ; +u32 size = bd->bi_dram[bank].size >>20 ; +u32 end = start + size; + +debug ("%s: bank: %d\n" , __func__, bank); +for (i = start; i < end; i++) +set_section_dcache (i,ARMV7_DCACHE_WRITEBACK ); + +} + +void arm_init_domains (void ) +{ +u32 reg; + + reg =get_dacr (); +/* +* Set DOMAIN to client access so that all permissions +* set in pagetables are validated by the mmu. +*/ + reg &= ~ARMV7_DOMAIN_MASK ; + reg |=ARMV7_DOMAIN_CLIENT ; +set_dacr (reg); +}#endif
arch/arm/include/asm/system.h +14 -0
@@ -81,6 +81,20 @@ static inline void set_cr(unsigned int val)isb (); } +static inline unsigned int get_dacr (void ) +{ +unsigned int val; + asm("mrc p15, 0, %0, c3, c0, 0 @ get DACR" :"=r" (val) : :"cc" ); +return val; +} + +static inline void set_dacr (unsigned int val) +{ + asmvolatile ("mcr p15, 0, %0, c3, c0, 0 @ set DACR" + : :"r" (val) :"cc" ); +isb (); +} +/* options available for data cache on each page */ enum dcache_option {DCACHE_OFF =0x12 ,
arch/arm/lib/cache-cp15.c +7 -0
@@ -36,6 +36,10 @@ void __arm_init_before_mmu(void)void arm_init_before_mmu (void ) __attribute__((weak,alias ("__arm_init_before_mmu" ))); +__weak void arm_init_domains (void ) +{ +} +static void cp_delay (void ) {volatile int i;
@@ -117,6 +121,9 @@ static inline void mmu_setup(void)/* Set the access control to all-supervisor */ asmvolatile ("mcr p15, 0, %0, c3, c0, 0" : :"r" (~0 )); + +arm_init_domains (); +/* and enable the mmu */ reg =get_cr ();/* get control reg. */ cp_delay ();
Signature · 1 line
1.7.9.5
cover ARM: mmu: Set domain permissions to client access
In reply to Sricharan RHi Albert,
Quoted 23 lines · Sricharan R
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This is a repost of the older series to include Vincent's patch in the same one.
R Sricharan (2):
ARM: mmu: Introduce weakdram_bank_setupfunction
ARM: mmu: Set domain permissions to client accessVincent Stehl? (1):
ARM: cache: declareset_section_dcache
Quoted 7 lines
arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 2 ++ arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 11 +++++++- 5 files changed, 64 insertions(+), 1 deletion(-)
Is this ok to get in now ?
Regards,
Sricharan
cover ARM: mmu: Set domain permissions to client access
In reply to Sricharan RHi Sricharan,
Quoted 23 lines · Sricharan R
Currently for ARM based cpu's, mmu pagetable attributes are set with manager permissions for all 4GB address space. Because of this the 'execute never (XN)' permission is never checked on read sensitive regions which results in speculative aborts.
This series changes the domain permissions of the full 4GB space to client access for OMAP socs. This avoids all the speculative aborts that are currently seen on OMAP5 secure devices.
Tested on OMAP5 SDP (HS) soc.
This is a repost of the older series to include Vincent's patch in the same one.
R Sricharan (2):
ARM: mmu: Introduce weakdram_bank_setupfunction
ARM: mmu: Set domain permissions to client accessVincent Stehl? (1):
ARM: cache: declareset_section_dcache
Quoted 7 lines
arch/arm/cpu/armv7/cache_v7.c | 3 ++ arch/arm/cpu/armv7/omap-common/hwinit-common.c | 35 ++++++++++++++++++++++++ arch/arm/include/asm/cache.h | 2 ++ arch/arm/include/asm/system.h | 14 ++++++++++ arch/arm/lib/cache-cp15.c | 11 +++++++- 5 files changed, 64 insertions(+), 1 deletion(-)
Series applied to u-boot-arm/master, thanks!
Amicalement,
Signature · 1 line
Albert.
cover ARM: mmu: Set domain permissions to client access - build warnings!
In reply to Vincent StehléHi,
Quoted 12 lines · Vincent Stehl?
Quoted 2 lines · Albert ARIBAUD
(..) Basically, this means we need Vincent's series to be applied first, then we can apply Sricharan's.
Hi,
I think this is too much trouble for a "one liner". Please feel free to squash.
Best regards,
V.
Ok, i reposted the series again after squashing.
http://www.mail-archive.com/u-boot at lists.denx.de/msg107487.html
Regards,
Sricharan