From: Paul Mackerras <paulus@ozlabs.org>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Paul Mackerras via Linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [RFC PATCH 7/9] powerpc/mm/book3s-64: Shuffle read, write, execute and user bits in PTE
Date: Mon, 22 Feb 2016 09:36:16 +1100 [thread overview]
Message-ID: <20160221223616.GB30309@fergus.ozlabs.ibm.com> (raw)
In-Reply-To: <87si0m7c5t.fsf@linux.vnet.ibm.com>
On Sun, Feb 21, 2016 at 01:00:54PM +0530, Aneesh Kumar K.V wrote:
> Paul Mackerras <paulus@samba.org> writes:
>
> > This moves the _PAGE_EXEC, _PAGE_RW and _PAGE_USER bits around in
> > the Linux PTE on 64-bit Book 3S systems to correspond with the bit
> > positions used in radix mode by PowerISA v3.0 CPUs. This also adds
> > a _PAGE_READ bit corresponding to the read permission bit in the
> > radix PTE. _PAGE_READ is currently unused but could possibly be used
> > in future to improve pte_protnone().
> >
> > Signed-off-by: Paul Mackerras <paulus@samba.org>
> > ---
> > arch/powerpc/include/asm/book3s/64/hash.h | 10 ++++++----
> > 1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/powerpc/include/asm/book3s/64/hash.h b/arch/powerpc/include/asm/book3s/64/hash.h
> > index c8eba0e..0fc750c 100644
> > --- a/arch/powerpc/include/asm/book3s/64/hash.h
> > +++ b/arch/powerpc/include/asm/book3s/64/hash.h
> > @@ -13,9 +13,12 @@
> > * We could create separate kernel read-only if we used the 3 PP bits
> > * combinations that newer processors provide but we currently don't.
> > */
> > -#define _PAGE_BIT_SWAP_TYPE 2
> > -#define _PAGE_USER 0x00004 /* page may be accessed by userspace */
> > -#define _PAGE_EXEC 0x00008 /* execute permission */
> > +#define _PAGE_BIT_SWAP_TYPE 0
> > +
> > +#define _PAGE_EXEC 0x00001 /* execute permission */
> > +#define _PAGE_RW 0x00002 /* read & write access allowed */
> > +#define _PAGE_READ 0x00004 /* read access allowed */
> > +#define _PAGE_USER 0x00008 /* page may be accessed by userspace */
> > #define _PAGE_GUARDED 0x00010 /* G: guarded (side-effect) page */
> > /* M (memory coherence) is always set in the HPTE, so we don't need it here */
> > #define _PAGE_COHERENT 0x0
> > @@ -23,7 +26,6 @@
> > #define _PAGE_WRITETHRU 0x00040 /* W: cache write-through */
> > #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_BUSY 0x00800 /* software: PTE & hash are busy */
> > #define _PAGE_SPECIAL 0x10000 /* software: special page */
> >
>
>
> For radix, _PAGE_USER is the inverse of this right ?. Ie, we set that
> bit position to 1 to indicate privileged access only.
Right, we'll need a follow-on patch that changes this to a _PAGE_PRIV
bit and changes the logic that uses _PAGE_USER either that or a
_PAGE_PRIV bit. But at least we have the bit position reserved now.
> Also can you use constants like
> #define _PAGE_USER PPC_BIT(60)
I'd really rather not - that is harder for the casual reader to parse,
because they then have to go off and find out what exactly PPC_BIT
does. The only time that using PPC_BIT would help is when checking
that the bit definitions match the Power ISA, and that's presumably
done by intelligent people that can handle backwards bit numbering in
their heads. :)
Paul.
next prev parent reply other threads:[~2016-02-21 22:46 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 ` [RFC PATCH 6/9] powerpc/mm/book3s-64: Move HPTE-related bits in PTE to upper end Paul Mackerras
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 [this message]
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=20160221223616.GB30309@fergus.ozlabs.ibm.com \
--to=paulus@ozlabs.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.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).