Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1685675

[PATCH 1/7] powerpc/8xx: Ensures RAM mapped with LTLB is seen as block mapped on 8xx.

From Christophe Leroy <christophe.leroy@c-s.fr>
Newsgroups linux.kernel
Subject [PATCH 1/7] powerpc/8xx: Ensures RAM mapped with LTLB is seen as block mapped on 8xx.
Date 2017-07-12 12:10 +0200
Message-ID <u2mKJ-6Tu-15@gated-at.bofh.it> (permalink)
References <u2mKJ-6Tu-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On the 8xx, the RAM mapped with LTLBs must be seen as block mapped,
just like areas mapped with BATs on standard PPC32.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/mm/8xx_mmu.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/8xx_mmu.c b/arch/powerpc/mm/8xx_mmu.c
index f4c6472f2fc4..f3a00cef9c34 100644
--- a/arch/powerpc/mm/8xx_mmu.c
+++ b/arch/powerpc/mm/8xx_mmu.c
@@ -22,8 +22,11 @@
 
 extern int __map_without_ltlbs;
 
+static unsigned long block_mapped_ram;
+
 /*
- * Return PA for this VA if it is in IMMR area, or 0
+ * Return PA for this VA if it is in an area mapped with LTLBs.
+ * Otherwise, returns 0
  */
 phys_addr_t v_block_mapped(unsigned long va)
 {
@@ -33,11 +36,13 @@ phys_addr_t v_block_mapped(unsigned long va)
 		return 0;
 	if (va >= VIRT_IMMR_BASE && va < VIRT_IMMR_BASE + IMMR_SIZE)
 		return p + va - VIRT_IMMR_BASE;
+	if (va >= PAGE_OFFSET && va < PAGE_OFFSET + block_mapped_ram)
+		return __pa(va);
 	return 0;
 }
 
 /*
- * Return VA for a given PA or 0 if not mapped
+ * Return VA for a given PA mapped with LTLBs or 0 if not mapped
  */
 unsigned long p_block_mapped(phys_addr_t pa)
 {
@@ -47,6 +52,8 @@ unsigned long p_block_mapped(phys_addr_t pa)
 		return 0;
 	if (pa >= p && pa < p + IMMR_SIZE)
 		return VIRT_IMMR_BASE + pa - p;
+	if (pa < block_mapped_ram)
+		return (unsigned long)__va(pa);
 	return 0;
 }
 
@@ -133,6 +140,8 @@ unsigned long __init mmu_mapin_ram(unsigned long top)
 	if (mapped)
 		memblock_set_current_limit(mapped);
 
+	block_mapped_ram = mapped;
+
 	return mapped;
 }
 
-- 
2.12.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/7] Prepare 8xx for CONFIG_STRICT_KERNEL_RWX Christophe Leroy <christophe.leroy@c-s.fr> - 2017-07-12 12:10 +0200
  [PATCH 5/7] powerpc/8xx: Do not allow Pinned TLBs with  STRICT_KERNEL_RWX or DEBUG_PAGEALLOC Christophe Leroy <christophe.leroy@c-s.fr> - 2017-07-12 12:10 +0200
  [PATCH 1/7] powerpc/8xx: Ensures RAM mapped with LTLB is seen as  block mapped on 8xx. Christophe Leroy <christophe.leroy@c-s.fr> - 2017-07-12 12:10 +0200
  [PATCH 2/7] powerpc/8xx: Remove macro that checks kernel address Christophe Leroy <christophe.leroy@c-s.fr> - 2017-07-12 12:10 +0200
  [PATCH 6/7] powerpc/8xx: mark init functions with __init Christophe Leroy <christophe.leroy@c-s.fr> - 2017-07-12 12:10 +0200
  [PATCH 3/7] powerpc/32: Avoid risk of unrecoverable TLBmiss inside  entry_32.S Christophe Leroy <christophe.leroy@c-s.fr> - 2017-07-12 12:20 +0200

csiph-web