linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] ARM: runtime patching of __virt_to_phys() and __phys_to_virt()
Date: Tue, 4 Jan 2011 20:17:08 +0000	[thread overview]
Message-ID: <20110104201708.GD24935@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <8ya39p8h4ui.fsf@huya.qualcomm.com>

On Tue, Jan 04, 2011 at 11:00:05AM -0800, David Brown wrote:
> On Tue, Jan 04 2011, Nicolas Pitre wrote:
> 
> > On Tue, 4 Jan 2011, David Brown wrote:
> >
> >> Any idea how much it would hurt other targets to have the
> >> __virt_to_phys() and __phys_to_virt() have a 16-bit fixup, even if only
> >> the upper 8 bits are used?
> >
> > Probably not that much.  But let's make it work satisfactorily for the 
> > general case first, and then we might consider and test variations that 
> > could accommodate msm.
> 
> Sounds like a good plan.  We've got quite a few other things to clean up
> before we can build for more than one arch anyway.

Actually, we can do this quite easily.  Having a config symbol which
gets enabled when MSM is added, which then enables two consecutive
__pv_fixups gives us 16-bits to play with.

As I originally intended with my implementation, the value field of the
instruction can be used to identify what this fixup is about - and we
can put that to use by selecting either bits 31-24 or 23-16 of the
offset value.

This still allows optimizations to happen with instruction scheduling -
eg, for the MSM kernel I've just built with this enabled:

c000b320:       e2844001        add     r4, r4, #1      ; 0x1
c000b324:       e59f3264        ldr     r3, [pc, #612]  ; c000b590 <setup_arch+0x690>
c000b328:       e2844000        add     r4, r4, #0      ; 0x0
c000b32c:       e2833001        add     r3, r3, #1      ; 0x1
c000b330:       e59f5228        ldr     r5, [pc, #552]  ; c000b560 <setup_arch+0x660>
c000b334:       e2833000        add     r3, r3, #0      ; 0x0

The first and second adds comprise one translation, the second pair are
a second translation, and as you can see, the compiler scheduled the
loads inbetween.

  reply	other threads:[~2011-01-04 20:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-04  8:20 [PATCH 0/4] variable PHYS_OFFSET support Nicolas Pitre
2011-01-04  8:20 ` [PATCH 1/4] ARM: runtime patching of __virt_to_phys() and __phys_to_virt() Nicolas Pitre
2011-01-04  8:45   ` Russell King - ARM Linux
2011-01-04 14:32     ` Nicolas Pitre
2011-01-04 16:53       ` Russell King - ARM Linux
2011-01-04 17:50         ` Nicolas Pitre
2011-01-04 18:06           ` Russell King - ARM Linux
2011-01-04 18:25             ` David Brown
2011-01-04 18:33               ` Nicolas Pitre
2011-01-04 19:00                 ` David Brown
2011-01-04 20:17                   ` Russell King - ARM Linux [this message]
2011-01-04 18:29             ` Nicolas Pitre
2011-01-04  8:20 ` [PATCH 2/4] ARM: make PHYS_OFFSET actually variable Nicolas Pitre
2011-01-04 12:30   ` Russell King - ARM Linux
2011-01-04 17:54     ` Nicolas Pitre
2011-01-04  8:20 ` [PATCH 3/4] ARM: module support for CONFIG_ARM_PATCH_PHYS_VIRT Nicolas Pitre
2011-01-04 10:06   ` Russell King - ARM Linux
2011-01-04  8:20 ` [PATCH 4/4] ARM: support for Thumb-2 instructions with CONFIG_ARM_PATCH_PHYS_VIRT Nicolas Pitre
2011-01-10 22:20   ` Dave Martin
2011-01-10 22:45     ` Nicolas Pitre
2011-01-10 23:24       ` Russell King - ARM Linux
2011-01-10 23:57         ` Nicolas Pitre
2011-01-04 10:41 ` [PATCH 0/4] variable PHYS_OFFSET support Russell King - ARM Linux
2011-01-04 14:37   ` Nicolas Pitre

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=20110104201708.GD24935@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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).