All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: Dave Martin <dave.martin@linaro.org>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>,
	linux-arm-kernel@lists.infradead.org,
	Tony Lindgren <tony@atomide.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Jean Pihet <j-pihet@ti.com>,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH v4 0/5] ARM: omap[34]: Thumb-2 compatibility fixes
Date: Tue, 15 Feb 2011 08:15:20 -0800	[thread overview]
Message-ID: <87ei79uvdz.fsf@ti.com> (raw)
In-Reply-To: <AANLkTinz1055v7x0y2W_AYkbj+9h7z_cGtF4xn4=pkQ7@mail.gmail.com> (Dave Martin's message of "Tue, 15 Feb 2011 10:45:16 +0000")

Dave Martin <dave.martin@linaro.org> writes:

> On Mon, Feb 14, 2011 at 11:15 PM, Kevin Hilman <khilman@ti.com> wrote:
>> Hi Dave,
>>
>> Dave Martin <dave.martin@linaro.org> writes:
>>
>>> On Mon, Feb 14, 2011 at 10:00:23AM -0500, Nicolas Pitre wrote:
>>>> On Mon, 14 Feb 2011, Dave Martin wrote:
>>>>
>>>> > @@ -289,8 +297,20 @@ clean_l2:
>>>> >     *  - should be faster and will change with kernel
>>>> >     *  - 'might' have to copy address, load and jump to it
>>>> >     */
>>>> > +#ifdef CONFIG_THUMB2_KERNEL
>>>> > +  /* kernel is non-interworking : must do this from Thumb */
>>>> > +  adr     r1, . + 1
>>>> > +  bx      r1
>>>> > +  .thumb
>>>> > +#endif
>>>> >    ldr     r1, kernel_flush
>>>>
>>>> Didn't you mean this instead:
>>>>
>>>>      /* kernel is non-interworking : must do this from Thumb */
>>>>      adr     r1, 1f + 1
>>>>      bx      r1
>>>>      .thumb
>>>> 1:   ldr     r1, kernel_flush
>>>>      ...
>>>
>>> Note that this is intended as an experimental hack, not a real patch
>>> (apologies if I didn't make that clear...)
>>>
>>> Well, actually I meant "add r1, pc, #1" ... which means I was too
>>> busy trying to be clever... oops!
>>>
>>> That is of course exactly equivalent to your code...
>>>
>>>>
>>>> ?
>>>>
>>>> >    blx     r1
>>>> > +#ifdef CONFIG_THUMB2_KERNEL
>>>> > +  .align
>>>> > +  bx      pc
>>>> > +  nop
>>>> > +  .arm
>>>>
>>>> Also here, the .align has the potential to introduce a zero halfword in
>>>> the instruction stream before the bx.  What about:
>>>>
>>>>      adr     r3, 1f
>>>>      bx      r3
>>>>      .align
>>>>      .arm
>>>> 1:   ...
>>>
>>> .align inserts a 16-bit nop when misaligned in Thumb in a text section,
>>> and a word-aligned bx pc is a specific architecturally allowed way
>>> to do an inline switch to ARM.  The linker uses this trick for PLT
>>> veneers etc.
>>>
>>> A nicer fix for doing this sort of call from low-level code which
>>> might be ARM is to convert arch/arm/mm/*-v7.S to use "bx lr" to return.
>>>
>>> Generally, we can do this for all arches >= v5, without any
>>> incompatibility.  However, since the need for it will be rare and it
>>> will generate patch noise for not much real benefit,
>>> I haven't proposed this.
>>>
>>> Updated patch below.
>>
>> I tested the updated patch on top of your "dirty" branch I tested with
>> last week, and now see off-mode working just fine.
>
> Thanks for testing-- that's great news.
>
> I will have a think about whether the patch can be tidied up to revert
> most of the code back to Thumb, though that isn't essential.  If I've
> understood what's going on correctly, I think only the restore entry
> points, SMC call sites and the entry to omap3_sram_configure_core_dpll
> could need to be ARM; the rest shouldn't really make any difference...

Yes, that sounds right.

Kevin

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 0/5] ARM: omap[34]: Thumb-2 compatibility fixes
Date: Tue, 15 Feb 2011 08:15:20 -0800	[thread overview]
Message-ID: <87ei79uvdz.fsf@ti.com> (raw)
In-Reply-To: <AANLkTinz1055v7x0y2W_AYkbj+9h7z_cGtF4xn4=pkQ7@mail.gmail.com> (Dave Martin's message of "Tue, 15 Feb 2011 10:45:16 +0000")

Dave Martin <dave.martin@linaro.org> writes:

> On Mon, Feb 14, 2011 at 11:15 PM, Kevin Hilman <khilman@ti.com> wrote:
>> Hi Dave,
>>
>> Dave Martin <dave.martin@linaro.org> writes:
>>
>>> On Mon, Feb 14, 2011 at 10:00:23AM -0500, Nicolas Pitre wrote:
>>>> On Mon, 14 Feb 2011, Dave Martin wrote:
>>>>
>>>> > @@ -289,8 +297,20 @@ clean_l2:
>>>> > ? ? * ?- should be faster and will change with kernel
>>>> > ? ? * ?- 'might' have to copy address, load and jump to it
>>>> > ? ? */
>>>> > +#ifdef CONFIG_THUMB2_KERNEL
>>>> > + ?/* kernel is non-interworking : must do this from Thumb */
>>>> > + ?adr ? ? r1, . + 1
>>>> > + ?bx ? ? ?r1
>>>> > + ?.thumb
>>>> > +#endif
>>>> > ? ?ldr ? ? r1, kernel_flush
>>>>
>>>> Didn't you mean this instead:
>>>>
>>>> ? ? ?/* kernel is non-interworking : must do this from Thumb */
>>>> ? ? ?adr ? ? r1, 1f + 1
>>>> ? ? ?bx ? ? ?r1
>>>> ? ? ?.thumb
>>>> 1: ? ldr ? ? r1, kernel_flush
>>>> ? ? ?...
>>>
>>> Note that this is intended as an experimental hack, not a real patch
>>> (apologies if I didn't make that clear...)
>>>
>>> Well, actually I meant "add r1, pc, #1" ... which means I was too
>>> busy trying to be clever... oops!
>>>
>>> That is of course exactly equivalent to your code...
>>>
>>>>
>>>> ?
>>>>
>>>> > ? ?blx ? ? r1
>>>> > +#ifdef CONFIG_THUMB2_KERNEL
>>>> > + ?.align
>>>> > + ?bx ? ? ?pc
>>>> > + ?nop
>>>> > + ?.arm
>>>>
>>>> Also here, the .align has the potential to introduce a zero halfword in
>>>> the instruction stream before the bx. ?What about:
>>>>
>>>> ? ? ?adr ? ? r3, 1f
>>>> ? ? ?bx ? ? ?r3
>>>> ? ? ?.align
>>>> ? ? ?.arm
>>>> 1: ? ...
>>>
>>> .align inserts a 16-bit nop when misaligned in Thumb in a text section,
>>> and a word-aligned bx pc is a specific architecturally allowed way
>>> to do an inline switch to ARM. ?The linker uses this trick for PLT
>>> veneers etc.
>>>
>>> A nicer fix for doing this sort of call from low-level code which
>>> might be ARM is to convert arch/arm/mm/*-v7.S to use "bx lr" to return.
>>>
>>> Generally, we can do this for all arches >= v5, without any
>>> incompatibility. ?However, since the need for it will be rare and it
>>> will generate patch noise for not much real benefit,
>>> I haven't proposed this.
>>>
>>> Updated patch below.
>>
>> I tested the updated patch on top of your "dirty" branch I tested with
>> last week, and now see off-mode working just fine.
>
> Thanks for testing-- that's great news.
>
> I will have a think about whether the patch can be tidied up to revert
> most of the code back to Thumb, though that isn't essential.  If I've
> understood what's going on correctly, I think only the restore entry
> points, SMC call sites and the entry to omap3_sram_configure_core_dpll
> could need to be ARM; the rest shouldn't really make any difference...

Yes, that sounds right.

Kevin

  reply	other threads:[~2011-02-15 16:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09 15:01 [PATCH v4 0/5] ARM: omap[34]: Thumb-2 compatibility fixes Dave Martin
2011-02-09 15:01 ` Dave Martin
2011-02-09 15:01 ` [PATCH v4 1/5] ARM: omap4: Provide do_wfi() for Thumb-2 Dave Martin
2011-02-09 15:01   ` Dave Martin
2011-02-09 16:19   ` Nicolas Pitre
2011-02-09 16:19     ` Nicolas Pitre
2011-02-09 15:01 ` [PATCH v4 2/5] ARM: omap4: Convert END() to ENDPROC() for correct linkage with CONFIG_THUMB2_KERNEL Dave Martin
2011-02-09 15:01   ` Dave Martin
2011-02-09 15:01 ` [PATCH v4 3/5] ARM: omap3: Remove hand-encoded SMC instructions Dave Martin
2011-02-09 15:01   ` Dave Martin
2011-02-09 15:01 ` [PATCH v4 4/5] ARM: omap3: Thumb-2 compatibility for sram34xx.S Dave Martin
2011-02-09 15:01   ` Dave Martin
2011-02-09 15:01 ` [PATCH v4 5/5] ARM: omap3: Thumb-2 compatibility for sleep34xx.S Dave Martin
2011-02-09 15:01   ` Dave Martin
2011-02-11 23:31 ` [PATCH v4 0/5] ARM: omap[34]: Thumb-2 compatibility fixes Kevin Hilman
2011-02-11 23:31   ` Kevin Hilman
2011-02-14 13:17   ` Dave Martin
2011-02-14 13:17     ` Dave Martin
2011-02-14 15:00     ` Nicolas Pitre
2011-02-14 15:00       ` Nicolas Pitre
2011-02-14 15:37       ` Dave Martin
2011-02-14 15:37         ` Dave Martin
2011-02-14 20:10         ` Nicolas Pitre
2011-02-14 20:10           ` Nicolas Pitre
2011-02-14 23:15         ` Kevin Hilman
2011-02-14 23:15           ` Kevin Hilman
2011-02-15 10:45           ` Dave Martin
2011-02-15 10:45             ` Dave Martin
2011-02-15 16:15             ` Kevin Hilman [this message]
2011-02-15 16:15               ` Kevin Hilman

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=87ei79uvdz.fsf@ti.com \
    --to=khilman@ti.com \
    --cc=dave.martin@linaro.org \
    --cc=j-pihet@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=santosh.shilimkar@ti.com \
    --cc=tony@atomide.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.