All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RFC PATCH] SPL: FIT: Align loading address for header
@ 2016-04-28  8:36 Michal Simek
  2016-05-01 18:54 ` Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Michal Simek @ 2016-04-28  8:36 UTC (permalink / raw)
  To: u-boot

If bl_len is not aligned it can caused a problem because another code
expects that start is aligned.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Not sure if this is the right way how to ensure it.
But patch is pointing to the problem. For example if bl_len is 1.
---
 common/spl/spl_fit.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index e301927c87ac..08e432a52dbb 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -119,6 +119,7 @@ int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit)
 	 * be before CONFIG_SYS_TEXT_BASE.
 	 */
 	fit = (void *)(CONFIG_SYS_TEXT_BASE - size - info->bl_len);
+	fit = (void *)ALIGN((ulong)fit, 8);
 	sectors = (size + info->bl_len - 1) / info->bl_len;
 	count = info->read(info, sector, sectors, fit);
 	debug("fit read sector %lx, sectors=%d, dst=%p, count=%lu\n",
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [RFC PATCH] SPL: FIT: Align loading address for header
  2016-04-28  8:36 [U-Boot] [RFC PATCH] SPL: FIT: Align loading address for header Michal Simek
@ 2016-05-01 18:54 ` Simon Glass
  2016-05-02  3:46 ` Lokesh Vutla
  2016-05-30 17:56 ` [U-Boot] [U-Boot, RFC] " Tom Rini
  2 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2016-05-01 18:54 UTC (permalink / raw)
  To: u-boot

On 28 April 2016 at 02:36, Michal Simek <michal.simek@xilinx.com> wrote:
> If bl_len is not aligned it can caused a problem because another code
> expects that start is aligned.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> Not sure if this is the right way how to ensure it.
> But patch is pointing to the problem. For example if bl_len is 1.

I suppose this is a non-block device. OK.

> ---
>  common/spl/spl_fit.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index e301927c87ac..08e432a52dbb 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -119,6 +119,7 @@ int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit)
>          * be before CONFIG_SYS_TEXT_BASE.
>          */
>         fit = (void *)(CONFIG_SYS_TEXT_BASE - size - info->bl_len);
> +       fit = (void *)ALIGN((ulong)fit, 8);
>         sectors = (size + info->bl_len - 1) / info->bl_len;
>         count = info->read(info, sector, sectors, fit);
>         debug("fit read sector %lx, sectors=%d, dst=%p, count=%lu\n",
> --
> 1.9.1
>

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [RFC PATCH] SPL: FIT: Align loading address for header
  2016-04-28  8:36 [U-Boot] [RFC PATCH] SPL: FIT: Align loading address for header Michal Simek
  2016-05-01 18:54 ` Simon Glass
@ 2016-05-02  3:46 ` Lokesh Vutla
  2016-05-02  7:53   ` Michal Simek
  2016-05-30 17:56 ` [U-Boot] [U-Boot, RFC] " Tom Rini
  2 siblings, 1 reply; 9+ messages in thread
From: Lokesh Vutla @ 2016-05-02  3:46 UTC (permalink / raw)
  To: u-boot



On Thursday 28 April 2016 02:06 PM, Michal Simek wrote:
> If bl_len is not aligned it can caused a problem because another code
> expects that start is aligned.

What about loading of U-boot image and dtb image? I have posted a
similar patch for solving this[1]. Can you see if it helps?

[1] http://patchwork.ozlabs.org/patch/606958/

Thanks and regards,
Lokesh

> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
> Not sure if this is the right way how to ensure it.
> But patch is pointing to the problem. For example if bl_len is 1.

> ---
>  common/spl/spl_fit.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index e301927c87ac..08e432a52dbb 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -119,6 +119,7 @@ int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit)
>  	 * be before CONFIG_SYS_TEXT_BASE.
>  	 */
>  	fit = (void *)(CONFIG_SYS_TEXT_BASE - size - info->bl_len);
> +	fit = (void *)ALIGN((ulong)fit, 8);
>  	sectors = (size + info->bl_len - 1) / info->bl_len;
>  	count = info->read(info, sector, sectors, fit);
>  	debug("fit read sector %lx, sectors=%d, dst=%p, count=%lu\n",
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [RFC PATCH] SPL: FIT: Align loading address for header
  2016-05-02  3:46 ` Lokesh Vutla
@ 2016-05-02  7:53   ` Michal Simek
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Simek @ 2016-05-02  7:53 UTC (permalink / raw)
  To: u-boot

Hi,

On 2.5.2016 05:46, Lokesh Vutla wrote:
> 
> 
> On Thursday 28 April 2016 02:06 PM, Michal Simek wrote:
>> If bl_len is not aligned it can caused a problem because another code
>> expects that start is aligned.
> 
> What about loading of U-boot image and dtb image? I have posted a
> similar patch for solving this[1]. Can you see if it helps?
> 
> [1] http://patchwork.ozlabs.org/patch/606958/

I have created this before I saw your patch. I am happy with your patch.
Please ignore this one.

Thanks,
Michal

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [U-Boot, RFC] SPL: FIT: Align loading address for header
  2016-04-28  8:36 [U-Boot] [RFC PATCH] SPL: FIT: Align loading address for header Michal Simek
  2016-05-01 18:54 ` Simon Glass
  2016-05-02  3:46 ` Lokesh Vutla
@ 2016-05-30 17:56 ` Tom Rini
  2016-05-31  4:29   ` Lokesh Vutla
  2 siblings, 1 reply; 9+ messages in thread
From: Tom Rini @ 2016-05-30 17:56 UTC (permalink / raw)
  To: u-boot

On Thu, Apr 28, 2016 at 10:36:11AM +0200, Michal Simek wrote:

> If bl_len is not aligned it can caused a problem because another code
> expects that start is aligned.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160530/fb1beb65/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [U-Boot, RFC] SPL: FIT: Align loading address for header
  2016-05-30 17:56 ` [U-Boot] [U-Boot, RFC] " Tom Rini
@ 2016-05-31  4:29   ` Lokesh Vutla
  2016-05-31 14:09     ` Tom Rini
  0 siblings, 1 reply; 9+ messages in thread
From: Lokesh Vutla @ 2016-05-31  4:29 UTC (permalink / raw)
  To: u-boot



On Monday 30 May 2016 11:26 PM, Tom Rini wrote:
> On Thu, Apr 28, 2016 at 10:36:11AM +0200, Michal Simek wrote:
> 
>> If bl_len is not aligned it can caused a problem because another code
>> expects that start is aligned.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> Applied to u-boot/master, thanks!

This patch is not required and should not be applied.

Thanks and regards,
Lokesh

> 
> 
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [U-Boot, RFC] SPL: FIT: Align loading address for header
  2016-05-31  4:29   ` Lokesh Vutla
@ 2016-05-31 14:09     ` Tom Rini
  2016-05-31 14:12       ` Lokesh Vutla
  0 siblings, 1 reply; 9+ messages in thread
From: Tom Rini @ 2016-05-31 14:09 UTC (permalink / raw)
  To: u-boot

On Tue, May 31, 2016 at 09:59:47AM +0530, Lokesh Vutla wrote:
> 
> 
> On Monday 30 May 2016 11:26 PM, Tom Rini wrote:
> > On Thu, Apr 28, 2016 at 10:36:11AM +0200, Michal Simek wrote:
> > 
> >> If bl_len is not aligned it can caused a problem because another code
> >> expects that start is aligned.
> >>
> >> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> >> Reviewed-by: Simon Glass <sjg@chromium.org>
> > 
> > Applied to u-boot/master, thanks!
> 
> This patch is not required and should not be applied.

Did you both agree on "spl: Allow to load a FIT containing U-Boot from
FS" instead then?  And thus what's in the tree needs a little re-work
since I made the above apply on top of this one instead?  Sorry/thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160531/c35a252c/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [U-Boot, RFC] SPL: FIT: Align loading address for header
  2016-05-31 14:09     ` Tom Rini
@ 2016-05-31 14:12       ` Lokesh Vutla
  2016-05-31 14:15         ` Tom Rini
  0 siblings, 1 reply; 9+ messages in thread
From: Lokesh Vutla @ 2016-05-31 14:12 UTC (permalink / raw)
  To: u-boot



On Tuesday 31 May 2016 07:39 PM, Tom Rini wrote:
> On Tue, May 31, 2016 at 09:59:47AM +0530, Lokesh Vutla wrote:
>>
>>
>> On Monday 30 May 2016 11:26 PM, Tom Rini wrote:
>>> On Thu, Apr 28, 2016 at 10:36:11AM +0200, Michal Simek wrote:
>>>
>>>> If bl_len is not aligned it can caused a problem because another code
>>>> expects that start is aligned.
>>>>
>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>
>>> Applied to u-boot/master, thanks!
>>
>> This patch is not required and should not be applied.
> 
> Did you both agree on "spl: Allow to load a FIT containing U-Boot from
> FS" instead then?  And thus what's in the tree needs a little re-work
> since I made the above apply on top of this one instead?  Sorry/thanks!

Yes, Michal as well agreed that this is not required[1]. This patch
might work but it can fail in corner cases.

If you want I can send a fix patch on top of latest.

[1] http://patchwork.ozlabs.org/patch/616065/

Thanks and regards,
Lokesh

> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [U-Boot, RFC] SPL: FIT: Align loading address for header
  2016-05-31 14:12       ` Lokesh Vutla
@ 2016-05-31 14:15         ` Tom Rini
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2016-05-31 14:15 UTC (permalink / raw)
  To: u-boot

On Tue, May 31, 2016 at 07:42:42PM +0530, Lokesh Vutla wrote:
> 
> 
> On Tuesday 31 May 2016 07:39 PM, Tom Rini wrote:
> > On Tue, May 31, 2016 at 09:59:47AM +0530, Lokesh Vutla wrote:
> >>
> >>
> >> On Monday 30 May 2016 11:26 PM, Tom Rini wrote:
> >>> On Thu, Apr 28, 2016 at 10:36:11AM +0200, Michal Simek wrote:
> >>>
> >>>> If bl_len is not aligned it can caused a problem because another code
> >>>> expects that start is aligned.
> >>>>
> >>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> >>>> Reviewed-by: Simon Glass <sjg@chromium.org>
> >>>
> >>> Applied to u-boot/master, thanks!
> >>
> >> This patch is not required and should not be applied.
> > 
> > Did you both agree on "spl: Allow to load a FIT containing U-Boot from
> > FS" instead then?  And thus what's in the tree needs a little re-work
> > since I made the above apply on top of this one instead?  Sorry/thanks!
> 
> Yes, Michal as well agreed that this is not required[1]. This patch
> might work but it can fail in corner cases.
> 
> If you want I can send a fix patch on top of latest.

Yes please, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160531/969eb16b/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-05-31 14:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-28  8:36 [U-Boot] [RFC PATCH] SPL: FIT: Align loading address for header Michal Simek
2016-05-01 18:54 ` Simon Glass
2016-05-02  3:46 ` Lokesh Vutla
2016-05-02  7:53   ` Michal Simek
2016-05-30 17:56 ` [U-Boot] [U-Boot, RFC] " Tom Rini
2016-05-31  4:29   ` Lokesh Vutla
2016-05-31 14:09     ` Tom Rini
2016-05-31 14:12       ` Lokesh Vutla
2016-05-31 14:15         ` Tom Rini

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.