From: Paul Mackerras <paulus@samba.org>
To: linuxppc-dev@lists.ozlabs.org
Cc: Michael Ellerman <mpe@ellerman.id.au>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Paul Mackerras <paulus@samba.org>
Subject: [RFC PATCH 6/9] powerpc/mm/book3s-64: Move HPTE-related bits in PTE to upper end
Date: Sat, 20 Feb 2016 17:12:37 +1100 [thread overview]
Message-ID: <1455948760-24710-7-git-send-email-paulus@samba.org> (raw)
In-Reply-To: <1455948760-24710-1-git-send-email-paulus@samba.org>
This moves the _PAGE_HASHPTE, _PAGE_F_GIX and _PAGE_F_SECOND fields in
the Linux PTE on 64-bit Book 3S systems to the most significant byte.
Of the 5 bits, one is a software-use bit and the other four are
reserved bit positions in the PowerISA v3.0 radix PTE format.
Using these bits is OK because these bits are all to do with tracking
the HPTE(s) associated with the Linux PTE, and therefore won't be
needed in radix mode. This frees up bit positions in the lower two
bytes.
Signed-off-by: Paul Mackerras <paulus@samba.org>
---
arch/powerpc/include/asm/book3s/64/hash.h | 8 ++++----
arch/powerpc/mm/hugetlbpage-hash64.c | 5 +++--
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/include/asm/book3s/64/hash.h b/arch/powerpc/include/asm/book3s/64/hash.h
index 8f077c1..c8eba0e 100644
--- a/arch/powerpc/include/asm/book3s/64/hash.h
+++ b/arch/powerpc/include/asm/book3s/64/hash.h
@@ -24,11 +24,7 @@
#define _PAGE_DIRTY 0x00080 /* C: page changed */
#define _PAGE_ACCESSED 0x00100 /* R: page referenced */
#define _PAGE_RW 0x00200 /* software: user write access allowed */
-#define _PAGE_HASHPTE 0x00400 /* software: pte has an associated HPTE */
#define _PAGE_BUSY 0x00800 /* software: PTE & hash are busy */
-#define _PAGE_F_GIX 0x07000 /* full page: hidx bits */
-#define _PAGE_F_GIX_SHIFT 12
-#define _PAGE_F_SECOND 0x08000 /* Whether to use secondary hash or not */
#define _PAGE_SPECIAL 0x10000 /* software: special page */
#ifdef CONFIG_MEM_SOFT_DIRTY
@@ -37,6 +33,10 @@
#define _PAGE_SOFT_DIRTY 0x00000
#endif
+#define _PAGE_F_GIX_SHIFT 57
+#define _PAGE_F_GIX (7ul << 57) /* HPTE index within HPTEG */
+#define _PAGE_F_SECOND (1ul << 60) /* HPTE is in 2ndary HPTEG */
+#define _PAGE_HASHPTE (1ul << 61) /* PTE has associated HPTE */
#define _PAGE_PTE (1ul << 62) /* distinguishes PTEs from pointers */
#define _PAGE_PRESENT (1ul << 63) /* pte contains a translation */
diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c b/arch/powerpc/mm/hugetlbpage-hash64.c
index e2138c7..8555fce 100644
--- a/arch/powerpc/mm/hugetlbpage-hash64.c
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -76,7 +76,7 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
if (old_pte & _PAGE_F_SECOND)
hash = ~hash;
slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
- slot += (old_pte & _PAGE_F_GIX) >> 12;
+ slot += (old_pte & _PAGE_F_GIX) >> _PAGE_F_GIX_SHIFT;
if (ppc_md.hpte_updatepp(slot, rflags, vpn, mmu_psize,
mmu_psize, ssize, flags) == -1)
@@ -105,7 +105,8 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
return -1;
}
- new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX);
+ new_pte |= (slot << _PAGE_F_GIX_SHIFT) &
+ (_PAGE_F_SECOND | _PAGE_F_GIX);
}
/*
--
2.5.0
next prev parent reply other threads:[~2016-02-20 6:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-20 6:12 [RFC PATCH 0/9] powerpc/mm: Restructure Linux PTE on Book3S/64 to radix format Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 1/9] powerpc/mm/book3s-64: Clean up some obsolete or misleading comments Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 2/9] powerpc/mm/book3s-64: Free up 7 high-order bits in the Linux PTE Paul Mackerras
2016-02-20 16:16 ` Aneesh Kumar K.V
2016-02-21 22:43 ` Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 3/9] powerpc/mm/64: Use physical addresses in upper page table tree levels Paul Mackerras
2016-02-20 16:35 ` Aneesh Kumar K.V
2016-02-21 22:45 ` Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 4/9] powerpc/mm/book3s-64: Move _PAGE_PRESENT to the most significant bit Paul Mackerras
2016-02-20 8:33 ` kbuild test robot
2016-02-20 16:41 ` Aneesh Kumar K.V
2016-02-21 22:40 ` Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 5/9] powerpc/mm/book3s-64: Move _PAGE_PTE to 2nd " Paul Mackerras
2016-02-20 6:12 ` Paul Mackerras [this message]
2016-02-20 6:12 ` [RFC PATCH 7/9] powerpc/mm/book3s-64: Shuffle read, write, execute and user bits in PTE Paul Mackerras
2016-02-21 7:30 ` Aneesh Kumar K.V
2016-02-21 22:36 ` Paul Mackerras
2016-02-22 0:27 ` Michael Ellerman
2016-02-20 6:12 ` [RFC PATCH 8/9] powerpc/mm/book3s-64: Move software-used " Paul Mackerras
2016-02-20 6:12 ` [RFC PATCH 9/9] powerpc/mm/book3s-64: Expand the real page number field of the Linux PTE Paul Mackerras
2016-02-20 14:40 ` [RFC PATCH 0/9] powerpc/mm: Restructure Linux PTE on Book3S/64 to radix format Aneesh Kumar K.V
2016-02-20 15:32 ` Aneesh Kumar K.V
2016-02-21 7:41 ` Aneesh Kumar K.V
2016-02-21 22:31 ` Paul Mackerras
2016-02-22 0:30 ` Michael Ellerman
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=1455948760-24710-7-git-send-email-paulus@samba.org \
--to=paulus@samba.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/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).