armv8: fsl-lsch3: Rewrite MMU translation table entries
PATCH v3 1/1 armv8: fsl-lsch3: Rewrite MMU translation table entries
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.
---
Changes in v3:
- Make only the first 4MB cache-enabled for IFC Region #1.
- Make only the first 64MB cache-enabled for QBMAN portal. 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 | 474 +++++++++++++++++---------- arch/arm/include/asm/arch-fsl-lsch3/config.h | 1 + arch/arm/include/asm/armv8/mmu.h | 8 +- 5 files changed, 392 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 +300 -174
517 lines not on this page · raw message
arch/arm/include/asm/arch-fsl-lsch3/config.h +1 -0
@@ -19,6 +19,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
York Sun
AppliedPATCH v3 1/1 armv8: fsl-lsch3: Rewrite MMU translation table entries
Quoted 6 lines · Alison Wang
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.
Signed-off-by Alison Wang <[email protected]>Signed-off-by York Sun <[email protected]>
Quoted 7 lines
---
Changes in v3:
- Make only the first 4MB cache-enabled for IFC Region #1.
- Make only the first 64MB cache-enabled for QBMAN portal. Changes in v2:
- Rebase the patch.
- Fix build error for emu andemu_D4defconfig.
Applied to fsl-qoriq master branch. Awaiting upstream.
York