linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Kevin Cernekee <cernekee@gmail.com>
Cc: David Daney <ddaney@caviumnetworks.com>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] MIPS: Replace _PAGE_READ with _PAGE_NO_READ
Date: Fri, 13 May 2011 16:56:05 +0100	[thread overview]
Message-ID: <20110513155605.GA30674@linux-mips.org> (raw)
In-Reply-To: <BANLkTikcyEzjOWt9pWToE=89dySSEYbw_g@mail.gmail.com>

On Fri, May 13, 2011 at 08:46:18AM -0700, Kevin Cernekee wrote:

> >> On hardware that does not support RI/XI, EntryLo bits 31:30 / 63:62 will
> >> remain unset and RI/XI permissions will not be enforced.
> >
> > Nice idea but it breaks on 64-bit hardware running 32-bit kernels.  On
> > those the RI/XI bits written to c0_entrylo0/1 31:30 will be interpreted as
> > physical address bits 37:36.
> 
> Hmm, are you sure?  (Unfortunately I do not have a 64-bit machine to
> test it on.)
> 
> I did not touch David's existing build_update_entries(), which makes a
> point not to set the RI/XI bits when the RIXI feature is disabled:
> 
>         if (kernel_uses_smartmips_rixi) {
>                 UASM_i_SRL(p, tmp, tmp, ilog2(_PAGE_NO_EXEC));
>                 UASM_i_SRL(p, ptep, ptep, ilog2(_PAGE_NO_EXEC));
>                 UASM_i_ROTR(p, tmp, tmp, ilog2(_PAGE_GLOBAL) -
> ilog2(_PAGE_NO_EXEC));
>                 if (r4k_250MHZhwbug())
>                         UASM_i_MTC0(p, 0, C0_ENTRYLO0);
>                 UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */
>                 UASM_i_ROTR(p, ptep, ptep, ilog2(_PAGE_GLOBAL) -
> ilog2(_PAGE_NO_EXEC));
>         } else {
>                 UASM_i_SRL(p, tmp, tmp, ilog2(_PAGE_GLOBAL)); /*
> convert to entrylo0 */
>                 if (r4k_250MHZhwbug())
>                         UASM_i_MTC0(p, 0, C0_ENTRYLO0);
>                 UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */
>                 UASM_i_SRL(p, ptep, ptep, ilog2(_PAGE_GLOBAL)); /*
> convert to entrylo1 */
>                 if (r45k_bvahwbug())
>                         uasm_i_mfc0(p, tmp, C0_INDEX);
>         }
> 
> If RIXI is enabled, it shifts the SW bits off the end of the register,
> then rotates the RI/XI bits into place.
> 
> If RIXI is disabled, it shifts the SW bits + RI/XI bits off the end of
> the register.  It should not be setting bits 31:30 or 63:62, ever.
> 
> (A side issue here is that ROTR is a MIPS R2 instruction, so we could
> never remove the old handler and use the RIXI version of the TLB
> handler on an R1 machine.)
> 
> If setting EntryLo bits 31:30 for RI/XI is illegal on a 64-bit system
> running a 32-bit kernel, I suspect we will have a problem with the
> existing RIXI TLB update code, regardless of whether my changes are
> applied.

I'm not totally certain with my explanation but it seemed like a good
working hypothesis.  Jayachandran C. bisected this morning's linux-queue
on his Netlogic XLR which is MIPS64 R1 and found this comment causing
the problem.

  Ralf

  reply	other threads:[~2011-05-13 15:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-16 16:44 [PATCH 1/4] MIPS: Replace _PAGE_READ with _PAGE_NO_READ Kevin Cernekee
2011-04-16 16:44 ` [PATCH 2/4] MIPS: Add dummy _PAGE_NO_EXEC field for R3000 and 64BIT_PHYS_ADDR cases Kevin Cernekee
2011-05-12 14:12   ` Ralf Baechle
2011-04-16 16:44 ` [PATCH 3/4] MIPS: Clean up protection_map[] initialization Kevin Cernekee
2011-05-12 14:12   ` Ralf Baechle
2011-04-16 16:44 ` [PATCH 4/4] MIPS: Remove unused PAGE_* definitions Kevin Cernekee
2011-05-12 14:12   ` Ralf Baechle
2011-04-18 17:32 ` [PATCH 1/4] MIPS: Replace _PAGE_READ with _PAGE_NO_READ David Daney
2011-04-18 18:24   ` Kevin Cernekee
2011-04-18 18:52     ` David Daney
2011-05-12 14:12 ` Ralf Baechle
2011-05-13 15:07 ` Ralf Baechle
2011-05-13 15:46   ` Kevin Cernekee
2011-05-13 15:56     ` Ralf Baechle [this message]
2011-05-13 16:55       ` Kevin Cernekee
2011-05-13 17:36         ` Jayachandran C.
2011-05-13 17:51           ` Kevin Cernekee
2011-05-13 18:45             ` Jayachandran C.
2011-05-13 18:57               ` David Daney
2011-05-13 22:00                 ` Arnaud Patard
2011-05-13 22:06               ` Kevin Cernekee
2011-05-14  5:13                 ` Jayachandran C.
2011-05-14  6:02                   ` Kevin Cernekee
2011-05-13 17:17       ` David Daney

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=20110513155605.GA30674@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=cernekee@gmail.com \
    --cc=ddaney@caviumnetworks.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.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).