armv8: fsl-lsch3: Rewrite MMU translation table entries
PATCH v2 1/1 armv8: fsl-lsch3: Rewrite MMU translation table entries
This patch rewrites MMU translation table entries to achieve:
a) Start with all table entries as "invalid".
b) Rewrite the table entries as "device-ngnrne" for cache-inhibit access.
c) Rewrite the table entries as "normal" for cache-enabled access.
---
Changes in v2:
- Rebase the patch.
- Fix build error for emu and emu_D4 defconfig.
arch/arm/cpu/armv8/cache_v8.c | 17 +- arch/arm/cpu/armv8/fsl-lsch3/README | 71 ++++ arch/arm/cpu/armv8/fsl-lsch3/cpu.c | 462 +++++++++++++++++---------- arch/arm/include/asm/arch-fsl-lsch3/config.h | 1 + arch/arm/include/asm/armv8/mmu.h | 8 +- 5 files changed, 380 insertions(+), 179 deletions(-)
arch/arm/cpu/armv8/cache_v8.c +13 -4
@@ -12,13 +12,22 @@DECLARE_GLOBAL_DATA_PTR ;#ifndef CONFIG_SYS_DCACHE_OFF -void set_pgtable_section (u64 *page_table,u64 index,u64 section, -u64 memory_type) +inline void set_pgtable_section (u64 *page_table,u64 index,u64 section, +u64 memory_type,u64 share) {u64 value; value = section |PMD_TYPE_SECT |PMD_SECT_AF ; value |=PMD_ATTRINDX (memory_type); + value |= share; + page_table[index] = value; +} + +inline void set_pgtable_table (u64 *page_table,u64 index,u64 *table_addr) +{ +u64 value; + + value = (u64 )table_addr |PMD_TYPE_TABLE ; page_table[index] = value; }
@@ -32,7 +41,7 @@ static void mmu_setup(void)/* Setup an identity-mapping for all spaces */ for (i =0 ; i < (PGTABLE_SIZE >>3 ); i++) {set_pgtable_section (page_table, i, i <<SECTION_SHIFT , -MT_DEVICE_NGNRNE ); +MT_DEVICE_NGNRNE ,PMD_SECT_NON_SHARE ); }/* Setup an identity-mapping for all RAM space */
@@ -42,7 +51,7 @@ static void mmu_setup(void)for (j = start >>SECTION_SHIFT ; j < end >>SECTION_SHIFT ; j++) {set_pgtable_section (page_table, j, j <<SECTION_SHIFT , -MT_NORMAL ); +MT_NORMAL ,PMD_SECT_NON_SHARE ); } }
arch/arm/cpu/armv8/fsl-lsch3/README +71 -0
74 lines not on this page · raw message
arch/arm/cpu/armv8/fsl-lsch3/cpu.c +288 -174
505 lines not on this page · raw message
arch/arm/include/asm/arch-fsl-lsch3/config.h +1 -0
@@ -18,6 +18,7 @@#define CONFIG_MP #define CONFIG_SYS_FSL_OCRAM_BASE 0x18000000/* initial RAM */ +#define CONFIG_SYS_FSL_OCRAM_SIZE 0x00200000/* 2M */ /* Link Definitions */ #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_FSL_OCRAM_BASE + 0xfff0)
arch/arm/include/asm/armv8/mmu.h +7 -1
@@ -65,6 +65,7 @@/* * Section */ +#define PMD_SECT_NON_SHARE (0 << 8)#define PMD_SECT_OUTER_SHARE (2 << 8)#define PMD_SECT_INNER_SHARE (3 << 8)#define PMD_SECT_AF (1 << 10)
@@ -110,8 +111,13 @@ TCR_T0SZ(VA_BITS))#ifndef __ASSEMBLY__ +void set_pgtable_section (u64 *page_table,u64 index, -u64 section,u64 memory_type); +u64 section,u64 memory_type, +u64 share); +void set_pgtable_table (u64 *page_table,u64 index, +u64 *table_addr); +static inline void set_ttbr_tcr_mair (int el,u64 table,u64 tcr,u64 attr) { asmvolatile ("dsb sy" );
Signature · 1 line
2.1.0.27.g96db324
PATCH v2 1/1 armv8: fsl-lsch3: Rewrite MMU translation table entries
Quoted 6 lines · Alison Wang
This patch rewrites MMU translation table entries to achieve:
a) Start with all table entries as "invalid".
b) Rewrite the table entries as "device-ngnrne" for cache-inhibit access.
c) Rewrite the table entries as "normal" for cache-enabled access.
Quoted 7 lines
Signed-off-by Alison Wang <[email protected]>Signed-off-by York Sun <[email protected]>---
Changes in v2:
- Rebase the patch.
- Fix build error for emu andemu_D4defconfig.
Alison,
We don't rewrite the "device-ngnrne" and "normal" separately. I would put the commit message as
This patch rewrites MMU translation table entries. To start, all table entries are written as "invalid", then "device-ngnrnr" and "normal" are written to the entries to enable access to specific addresses.
York
PATCH v2 1/1 armv8: fsl-lsch3: Rewrite MMU translation table entries
York,
Quoted 15 lines · Alison Wang
Quoted 6 lines
This patch rewrites MMU translation table entries to achieve:
a) Start with all table entries as "invalid".
b) Rewrite the table entries as "device-ngnrne" for cache-inhibit access.
c) Rewrite the table entries as "normal" for cache-enabled access.Quoted 7 lines
Signed-off-by Alison Wang <[email protected]>Signed-off-by York Sun <[email protected]>---
Changes in v2:
- Rebase the patch.
- Fix build error for emu andemu_D4defconfig.
Quoted 9 lines
Alison,
We don't rewrite the "device-ngnrne" and "normal" separately. I would put the commit message as
This patch rewrites MMU translation table entries. To start, all table entries are written as "invalid", then "device-ngnrnr" and "normal" are written to the entries to enable access to specific addresses.
[Alison Wang] Agree. Thanks.
Best Regards,
Alison Wang
PATCH v2 1/1 armv8: fsl-lsch3: Rewrite MMU translation table entries
OK. I will change the commit message. You don't need to send an update.
York
-------- Original message --------
From: Wang Huan-B18965
Date:08/03/2015 19:03 (GMT-08:00)
To: Sun York-R58495 , u-boot at lists.denx.de
Subject: RE: [PATCH v2] armv8: fsl-lsch3: Rewrite MMU translation table entries
York,
Quoted 15 lines · Alison Wang
Quoted 6 lines
This patch rewrites MMU translation table entries to achieve:
a) Start with all table entries as "invalid".
b) Rewrite the table entries as "device-ngnrne" for cache-inhibit access.
c) Rewrite the table entries as "normal" for cache-enabled access.Quoted 7 lines
Signed-off-by Alison Wang <[email protected]>Signed-off-by York Sun <[email protected]>---
Changes in v2:
- Rebase the patch.
- Fix build error for emu andemu_D4defconfig.
Quoted 9 lines
Alison,
We don't rewrite the "device-ngnrne" and "normal" separately. I would put the commit message as
This patch rewrites MMU translation table entries. To start, all table entries are written as "invalid", then "device-ngnrnr" and "normal" are written to the entries to enable access to specific addresses.
[Alison Wang] Agree. Thanks.
Best Regards,
Alison Wang