linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Thomas De Schampheleire <patrickdepinguin+linuxppc@gmail.com>
Cc: linuxppc-dev <linuxppc-dev@ozlabs.org>,
	Tabi Timur-B04825 <B04825@freescale.com>
Subject: Re: Mapping an executable page
Date: Tue, 14 Jun 2011 15:26:01 -0500	[thread overview]
Message-ID: <20110614152601.6258d3a6@schlenkerla.am.freescale.net> (raw)
In-Reply-To: <BANLkTimhKOvY8XA=_20rjtkZ0Um45o2Bow@mail.gmail.com>

On Tue, 14 Jun 2011 10:56:31 +0200
Thomas De Schampheleire <patrickdepinguin+linuxppc@gmail.com> wrote:

> * Therefore, to make sure that the mapping I intended with __ioremap()
> is actually reflected in the TLB tables, I added dummy reads of each
> page in the TLB, prior to jumping to the boot code, as follows:
>                 /* make sure memory is read, once every 4Kbyte is enough */
>                 for (p = vaddr; p < vaddr + map_size; p += 0x1000) {
>                         unsigned long dummy = *(volatile unsigned long *)p;
>                         (void)dummy;
>                 }
> 
> * After these changes (make sure all code is mapped + make sure to
> read all pages so that the TLBs are updated), my scenario works fine.

This is fragile -- you are assuming that it's possible to fit this
set of pages in TLB0 all at once, and that none of them will be
evicted/invalidated by the time you're done.

If you really need to do this, I sugest using settlbcam() from
arch/powerpc/mm/fsl_booke_mmu.c to create TLB1 entries with IPROT set.

Better still if you could live with whatever memory the kernel has already
pinned.

-Scott

  parent reply	other threads:[~2011-06-14 20:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-27 13:25 Mapping an executable page Thomas De Schampheleire
2011-05-29 14:53 ` Tabi Timur-B04825
2011-06-14  8:56   ` Thomas De Schampheleire
2011-06-14 20:02     ` Timur Tabi
2011-06-14 20:07       ` Timur Tabi
2011-06-22  7:49         ` Thomas De Schampheleire
2011-06-22 11:40           ` Tabi Timur-B04825
2011-06-22 12:53             ` Thomas De Schampheleire
2011-06-22  7:44       ` Thomas De Schampheleire
2011-06-14 20:26     ` Scott Wood [this message]
2011-06-22  7:52       ` Thomas De Schampheleire
2011-05-31 16:01 ` McClintock Matthew-B29882

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=20110614152601.6258d3a6@schlenkerla.am.freescale.net \
    --to=scottwood@freescale.com \
    --cc=B04825@freescale.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=patrickdepinguin+linuxppc@gmail.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).