public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Darwin Rambo <drambo@broadcom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: Allow u-boot to run from offset base address
Date: Thu, 15 May 2014 07:21:09 -0700	[thread overview]
Message-ID: <5374CD55.3010703@broadcom.com> (raw)
In-Reply-To: <1400107265.16796.8.camel@yellow>


On 14-05-14 03:41 PM, Jeroen Hofstee wrote:
> Hello Darwin,
>
> On wo, 2014-05-14 at 15:05 -0700, Darwin Rambo wrote:
>
>> +#ifdef CONFIG_ARM64
>> +	/*
>> +	 * Fix relocation if u-boot is not on an aligned address.
>> +	 */
>> +	{
>> +		int offset = CONFIG_SYS_TEXT_BASE % 4096;
>> +		if (offset) {
>> +			addr += offset;
>> +			debug("Relocation Addr bumped to 0x%08lx\n", addr);
>> +		}
>> +	}
>> +#endif
>> +
> Do you really want to check a define at runtime? Placement is typically
> at the end of RAM and allocation goes down, not up as in this patch.
> Aren't you overlapping memory here?

Yes, I wanted the runtime check since the adjustment to the relocation
address is also done at runtime.

There is no overlap here. The reason is that the original masking operation
to mask to a 4K boundary removed the small offset and backed up too far. So
adding the lost offset is guaranteed to not overlap, and furthermore, correct
the relocation offset so that arm64 images can run at smaller alignments than
we normally use. This might even be a generic fix but can't be tested easily
by me.

>
>>   
>>   static int setup_reloc(void)
>>   {
>> +#ifdef CONFIG_ARM64
>> +	/*
>> +	 * Fix relocation if u-boot is not on an aligned address.
>> +	 */
>> +	int offset = CONFIG_SYS_TEXT_BASE % 4096;
>> +	if (offset) {
>> +		gd->relocaddr += offset;
>> +		debug("Relocation Addr bumped to 0x%08lx\n", gd->relocaddr);
>> +	}
>> +#endif
>>   	gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
>>   	memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
>>   
> This is a generic file, hell breaks loose if you start using arch /
> board / pre bootloader specific workarounds here afaiac.

I don't disagree with this statement. Please see my other comments to
Wolfgang on this topic.

>
> lucky for you, I am not a u-boot maintainer, but this looks at least a
> bit weird, glancing at it.
>
> Regards,
> Jeroen
>
Thanks for your comments Jeroen. They are appreciated.
Darwin

  reply	other threads:[~2014-05-15 14:21 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 22:05 [U-Boot] [PATCH] arm: Allow u-boot to run from offset base address Darwin Rambo
2014-05-14 22:41 ` Jeroen Hofstee
2014-05-15 14:21   ` Darwin Rambo [this message]
2014-05-15 15:21     ` Wolfgang Denk
2014-05-15 16:07       ` Darwin Rambo
2014-05-15 19:19         ` Wolfgang Denk
2014-05-26  9:50           ` Albert ARIBAUD
2014-05-26 16:11             ` Darwin Rambo
2014-06-02  7:26               ` Albert ARIBAUD
2014-06-03  0:37                 ` Darwin Rambo
2014-06-09 10:23                   ` Albert ARIBAUD
2014-06-09 20:45                     ` Steve Rae
2014-06-09 20:56                       ` Jeroen Hofstee
2014-06-10  5:16                       ` Albert ARIBAUD
2014-06-10 17:56                         ` Steve Rae
2014-06-10 18:13                           ` Wolfgang Denk
2014-06-10 19:38                             ` Steve Rae
2014-06-10 20:35                               ` Wolfgang Denk
2014-06-10 23:15                                 ` Steve Rae
2014-06-11  4:49                                   ` Wolfgang Denk
2014-06-11  6:45                                     ` Albert ARIBAUD
2014-06-11 18:56                                       ` Steve Rae
2014-06-11 21:16                                         ` Wolfgang Denk
2014-06-25 12:52                                           ` Albert ARIBAUD
2014-06-10 21:20                               ` Albert ARIBAUD
2014-06-11  0:14                                 ` Steve Rae
2014-06-11  5:02                                   ` Wolfgang Denk
2014-06-11  4:38                                 ` Wolfgang Denk
2014-05-15  4:26 ` Wolfgang Denk
2014-05-15 14:16   ` Darwin Rambo
2014-05-15 15:16     ` Wolfgang Denk

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=5374CD55.3010703@broadcom.com \
    --to=drambo@broadcom.com \
    --cc=u-boot@lists.denx.de \
    /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