From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Cc: Scott Wood <scottwood@freescale.com>,
"linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>,
Rex Feany <RFeany@mrv.com>
Subject: Re: [PATCH 2/6] 8xx: Update TLB asm so it behaves as linux mm expects.
Date: Fri, 09 Oct 2009 08:04:03 +1100 [thread overview]
Message-ID: <1255035843.2146.39.camel@pasglop> (raw)
In-Reply-To: <1255008298-19949-3-git-send-email-Joakim.Tjernlund@transmode.se>
On Thu, 2009-10-08 at 15:24 +0200, Joakim Tjernlund wrote:
> +#define _PAGE_RW 0x0400 /* lsb PP bits, inverted in HW */
> +#define _PAGE_USER 0x0800 /* msb PP bits */
>
> + /* r10=(r10&~_PAGE_PRESENT)|((r10&_PAGE_ACCESSED)>>5) */
> + rlwimi. r10, r10, 27, 31, 31
> + beq- cr0, 2f /* Can be removed, costs a ITLB Err */
Did you mean
+ /* r10=(r10&~_PAGE_PRESENT)|((r10&_PAGE_ACCESSED)>>4) */
+ rlwimi. r10, r10, 28, 30, 31
+ beq- cr0, 2f /* Can be removed, costs a ITLB Err */
Which would still be incorrect. You want -both- to be set,
and your code will move on if -any- is set. Might want to add
a ~ of the whole thing maybe and invert the condition ?
I find it easier to just do li rX, requested_bits, and then, andc.
rscratch, rX, rPTE
> +#if 0 /* Dont' bother with PP lsb, bit 21 for now */
> + /* r10 = (r10 & ~0x0400) | ((r10 & _PAGE_EXEC) << 7) */
> + rlwimi r10, r10, 7, 21, 21 /* Set _PAGE_EXEC << 7 */
> +#endif
I don't get that one. Don't bother with _PAGE_EXEC, there's no
control of execute permission that works on 8xx. It's #if 0 anyway.
You still need to massage the PP bits into place. I don't see that
happening.
As it is, your PTE contains for bit 20 and 21, which translates to:
PTE: Translates to PP bits:
RW: 0 USER: 0 00 supervisor RW (ok)
RW: 0 USER: 1 01 supervisor RW user RO (WRONG)
RW: 1 USER: 0 10 supervisor RW user RW (WRONG)
RW: 1 USER: 1 11 supervisor RO user RO (WRONG)
I would suggest you do the stuff I suggested initially with RW and USER
being an "index" into a pre-cooked immediate value with all the encodings
which also gives you the extended encoding for supervisor RO for free.
> + /* Need to know if load/store -> force a TLB Error
> + * by copying ACCESSED to PRESENT.
> + */
> + /* r10=(r10&~_PAGE_PRESENT)|((r10&_PAGE_ACCESSED)>>5) */
> + rlwimi r10, r10, 27, 31, 31
That doesn't sound right, just like ITLB... you need to AND those two
bits in a way or another, or basically test that they are both set
(or neither is set)
> +#if 0 /* Not yet */
> + /* Honour kernel RO, User NA */
> + andi. r11, r10, _PAGE_USER | _PAGE_RW
> + bne- cr0, 5f
> + ori r10,r10, 0x200 /* Extended encoding, bit 22 */
> #endif
> - mfspr r11, SPRN_MD_TWC /* get the pte address again */
> - stw r10, 0(r11)
> +5: xori r10, r10, _PAGE_RW /* invert RW bit */
Well, you are missing that xori from the ITLB miss I think. Also, that
changes the table above to:
PTE: Translates to PP bits:
RW: 0 USER: 0 10 supervisor RW user RW (WRONG)
RW: 0 USER: 1 11 supervisor RO user RO (ok)
RW: 1 USER: 0 00 supervisor RW (ok)
RW: 1 USER: 1 01 supervisor RW user RO (WRONG)
So it's still not right :-)
Cheers,
Ben.
next prev parent reply other threads:[~2009-10-08 21:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-08 13:24 [PATCH 0/6] 8xx MMU fixes Joakim Tjernlund
2009-10-08 13:24 ` [PATCH 1/6] 8xx: DTLB Error must check for more errors Joakim Tjernlund
2009-10-08 13:24 ` [PATCH 2/6] 8xx: Update TLB asm so it behaves as linux mm expects Joakim Tjernlund
2009-10-08 13:24 ` [PATCH 3/6] 8xx: invalidate non present TLBs Joakim Tjernlund
2009-10-08 13:24 ` [PATCH 4/6] 8xx: Tag DAR with 0x00f0 to catch buggy instructions Joakim Tjernlund
2009-10-08 13:24 ` [PATCH 5/6] 8xx: Fixup DAR from buggy dcbX instructions Joakim Tjernlund
2009-10-08 13:24 ` [PATCH 6/6] 8xx: start using dcbX instructions in various copy routines Joakim Tjernlund
2009-10-08 21:04 ` Benjamin Herrenschmidt [this message]
2009-10-08 22:44 ` [PATCH 2/6] 8xx: Update TLB asm so it behaves as linux mm expects Joakim Tjernlund
2009-10-09 0:53 ` Benjamin Herrenschmidt
2009-10-09 6:16 ` Joakim Tjernlund
2009-10-09 6:30 ` Benjamin Herrenschmidt
2009-10-08 20:48 ` [PATCH 1/6] 8xx: DTLB Error must check for more errors Benjamin Herrenschmidt
2009-10-09 0:15 ` [PATCH 0/6] 8xx MMU fixes Rex Feany
2009-10-09 6:00 ` Joakim Tjernlund
2009-10-09 6:46 ` Rex Feany
2009-10-09 11:04 ` Joakim Tjernlund
2009-10-09 12:30 ` Joakim Tjernlund
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=1255035843.2146.39.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=Joakim.Tjernlund@transmode.se \
--cc=RFeany@mrv.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=scottwood@freescale.com \
/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).