linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: npiggin@gmail.com, paulus@samba.org, mpe@ellerman.id.au
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH v4 8/8] powerpc/mm/hash/4K: Update the vmalloc start for hash 4K config
Date: Wed, 17 Apr 2019 18:29:20 +0530	[thread overview]
Message-ID: <20190417125920.785-9-aneesh.kumar@linux.ibm.com> (raw)
In-Reply-To: <20190417125920.785-1-aneesh.kumar@linux.ibm.com>

This updates hash 4k VMALLOC_START to 0xc008000000000000. Our page table
still limit max addr to 64TB. But with hash translation we map only
vmalloc and IO region and we ignore top bits (0xc008) when mapping the
addr to page table. That means VMALLOC_START get mapped as 0 addr on
linux page table.

With this we have for 4K

 kernel vmalloc start   = 0xc008000000000000
 kernel IO start        = 0xc008100000000000
 kernel vmemmap start   = 0xc008200000000000

64K hash, 64K radix and 4k radix:

  kernel vmalloc start   = 0xc008000000000000
  kernel IO start        = 0xc00a000000000000
  kernel vmemmap start   = 0xc00c000000000000

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 arch/powerpc/include/asm/book3s/64/hash-4k.h  |  8 +++++++-
 arch/powerpc/include/asm/book3s/64/hash-64k.h |  2 +-
 arch/powerpc/include/asm/book3s/64/mmu-hash.h | 11 +++++------
 arch/powerpc/include/asm/book3s/64/mmu.h      |  9 ++++++++-
 4 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h
index 64eaf187f891..73058c933560 100644
--- a/arch/powerpc/include/asm/book3s/64/hash-4k.h
+++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h
@@ -26,7 +26,13 @@
  * Define the address range of the kernel non-linear virtual area
  * 16TB
  */
-#define H_KERN_VIRT_START	ASM_CONST(0xc000100000000000)
+#define H_KERN_VIRT_START	ASM_CONST(0xc008000000000000)
+/*
+ * Even though we use 2PB address here, For mapping to linux
+ * page table we ignore these bits. Hash only map vmalloc
+ * and I/O region in linux page table.
+ */
+#define H_KERN_EA_MASK		ASM_CONST(~0xc008000000000000)
 
 #ifndef __ASSEMBLY__
 #define H_PTE_TABLE_SIZE	(sizeof(pte_t) << H_PTE_INDEX_SIZE)
diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h b/arch/powerpc/include/asm/book3s/64/hash-64k.h
index 24ca63beba14..0d0ea957bdfd 100644
--- a/arch/powerpc/include/asm/book3s/64/hash-64k.h
+++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h
@@ -24,7 +24,7 @@
  * 2PB
  */
 #define H_KERN_VIRT_START	ASM_CONST(0xc008000000000000)
-
+#define H_KERN_EA_MASK		ASM_CONST(~0xc000000000000000)
 /*
  * 64k aligned address free up few of the lower bits of RPN for us
  * We steal that here. For more deatils look at pte_pfn/pfn_pte()
diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
index 5d2adf3c1325..8be2cbbf8ef2 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
@@ -742,12 +742,6 @@ static inline unsigned long get_vsid(unsigned long context, unsigned long ea,
 	unsigned long vsid_bits;
 	unsigned long protovsid;
 
-	/*
-	 * Bad address. We return VSID 0 for that
-	 */
-	if ((ea & EA_MASK)  >= H_PGTABLE_RANGE)
-		return 0;
-
 	if (!mmu_has_feature(MMU_FTR_68_BIT_VA))
 		va_bits = 65;
 
@@ -807,6 +801,11 @@ static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
 
 	if (!is_kernel_addr(ea))
 		return 0;
+	/*
+	 * Bad address. We return VSID 0 for that
+	 */
+	if ((ea & H_KERN_EA_MASK) >= H_PGTABLE_RANGE)
+		return 0;
 
 	context = get_kernel_context(ea);
 	return get_vsid(context, ea, ssize);
diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h b/arch/powerpc/include/asm/book3s/64/mmu.h
index 1ceee000c18d..cab8deb2501e 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu.h
@@ -232,8 +232,15 @@ static inline int get_user_context(mm_context_t *ctx, unsigned long ea)
 static inline unsigned long get_user_vsid(mm_context_t *ctx,
 					  unsigned long ea, int ssize)
 {
-	unsigned long context = get_user_context(ctx, ea);
+	unsigned long context;
 
+	/*
+	 * Bad address. We return VSID 0 for that
+	 */
+	if (ea >= H_PGTABLE_RANGE)
+		return 0;
+
+	context = get_user_context(ctx, ea);
 	return get_vsid(context, ea, ssize);
 }
 
-- 
2.20.1


      parent reply	other threads:[~2019-04-17 13:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 12:59 [PATCH v4 0/8] Update hash MMU kernel mapping to be in sync with radix Aneesh Kumar K.V
2019-04-17 12:59 ` [PATCH v4 1/8] powerpc/mm/hash64: Add a variable to track the end of IO mapping Aneesh Kumar K.V
2019-04-21 14:19   ` [v4, " Michael Ellerman
2019-04-17 12:59 ` [PATCH v4 2/8] powerpc/mm/hash64: Map all the kernel regions in the same 0xc range Aneesh Kumar K.V
2019-04-17 22:27   ` kbuild test robot
2019-04-18  3:47   ` Aneesh Kumar K.V
2019-04-17 12:59 ` [PATCH v4 3/8] powerpc/mm: Validate address values against different region limits Aneesh Kumar K.V
2019-04-17 12:59 ` [PATCH v4 4/8] powerpc/mm: Drop the unnecessary region check Aneesh Kumar K.V
2019-04-17 12:59 ` [PATCH v4 5/8] powerpc/mm/hash: Simplify the region id calculation Aneesh Kumar K.V
2019-04-17 12:59 ` [PATCH v4 6/8] powerpc/mm: Print kernel map details to dmesg Aneesh Kumar K.V
2019-04-17 12:59 ` [PATCH v4 7/8] powerpc/mm/hash: Rename KERNEL_REGION_ID to LINEAR_MAP_REGION_ID Aneesh Kumar K.V
2019-04-17 12:59 ` Aneesh Kumar K.V [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190417125920.785-9-aneesh.kumar@linux.ibm.com \
    --to=aneesh.kumar@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).