Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <florian.fainelli@broadcom.com>
To: Ard Biesheuvel <ardb@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	"William (Zhenghao) Zhang" <william.zhang@broadcom.com>
Cc: Broadcom Kernel List <bcm-kernel-feedback-list@broadcom.com>,
	Farhad Hussain <farhad.hussain@broadcom.com>,
	Russell King <linux@armlinux.org.uk>,
	Karl Mehltretter <kmehltretter@gmail.com>,
	Sasha Levin <sashal@kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ARM: use a register-indirect load for TEXT_OFFSET in head.S
Date: Tue, 1 Dec 2026 14:25:42 -0800	[thread overview]
Message-ID: <749ccbbf-a6ea-4243-b6f1-3a300d376c23@broadcom.com> (raw)
In-Reply-To: <c54d8a08-22be-4ee0-9092-3224a02d0a1b@app.fastmail.com>

CC William,

On 12/1/26 14:06, Ard Biesheuvel wrote:
> Hi Florian,
> 
> On Tue, 1 Dec 2026, at 20:18, Florian Fainelli wrote:
>> From: Farhad Hussain <farhad.hussain@broadcom.com>
>>
>> add/sub with #TEXT_OFFSET requires TEXT_OFFSET to fit ARM's 8-bit
>> rotated immediate encoding. Platforms that need to run the kernel
>> from a start address above the default (e.g. to avoid colliding with
>> a firmware-reserved low-memory region) can end up with a TEXT_OFFSET
>> that no longer fits, breaking the build. Load it into a register with
>> ldr =TEXT_OFFSET instead, which works unconditionally and has no
>> effect on normal configurations where the immediate already fit.
>>
>> Signed-off-by: Farhad Hussain <farhad.hussain@broadcom.com>
>> [florian: commit message, forward porting]
>> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
>> ---
>>   arch/arm/boot/compressed/head.S | 3 ++-
>>   arch/arm/kernel/head.S          | 6 ++++--
>>   2 files changed, 6 insertions(+), 3 deletions(-)
>>
> 
> We currently have
> 
> arch/arm/Makefile:textofs-y     := 0x00008000
> arch/arm/Makefile:textofs-$(CONFIG_ARCH_REALTEK)  := 0x00108000
> arch/arm/Makefile:textofs-$(CONFIG_SA1111) := 0x00208000
> arch/arm/Makefile:textofs-$(CONFIG_ARCH_QCOM_RESERVE_SMEM) := 0x00208000
> arch/arm/Makefile:textofs-$(CONFIG_ARCH_MESON) := 0x00208000
> arch/arm/Makefile:textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000
> 
> none of which appear to need this. So which value of TEXT_OFFSET
> are you using, and is this platform supported upstream?

The value that triggered this was 0x01008000 with ARCH_BCMBCA using 
OP-TEE and it was using a local textofs-y override rather than what is 
currently upstream.

Thanks to your message this had me go back to the SDK's history and it 
looks like this was corrected earlier this year to 0x8000.

Let's drop this for now, unless you object William?
-- 
Florian


      reply	other threads:[~2026-12-01 22:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 19:18 [PATCH] ARM: use a register-indirect load for TEXT_OFFSET in head.S Florian Fainelli
2026-12-01 22:06 ` Ard Biesheuvel
2026-12-01 22:25   ` Florian Fainelli [this message]

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=749ccbbf-a6ea-4243-b6f1-3a300d376c23@broadcom.com \
    --to=florian.fainelli@broadcom.com \
    --cc=ardb@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=farhad.hussain@broadcom.com \
    --cc=kmehltretter@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=sashal@kernel.org \
    --cc=william.zhang@broadcom.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