All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: booti: do not force relocation if force_reloc is not set
@ 2021-04-06  7:50 Vitaly Wool
  2021-07-15  9:09 ` Leo Liang
  0 siblings, 1 reply; 2+ messages in thread
From: Vitaly Wool @ 2021-04-06  7:50 UTC (permalink / raw)
  To: u-boot

If force_reloc flag is not set and booti is called for an address
ouside RAM (i. e. QSPI NOR flash), we should honor that and not try
to force relocation in a bogus fashion.

Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com>
---
 arch/riscv/lib/image.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/lib/image.c b/arch/riscv/lib/image.c
index 7357d3b07d..2032c2c399 100644
--- a/arch/riscv/lib/image.c
+++ b/arch/riscv/lib/image.c
@@ -48,7 +48,12 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
 		return -EINVAL;
 	}
 	*size = lhdr->image_size;
-	*relocated_addr = gd->ram_base + lhdr->text_offset;
+	if (force_reloc ||
+	   (gd->ram_base <= image && image < gd->ram_base + gd->ram_size)) {
+		*relocated_addr = gd->ram_base + lhdr->text_offset;
+	} else {
+		*relocated_addr = image;
+	}
 
 	unmap_sysmem(lhdr);
 
-- 
2.29.2

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

* Re: [PATCH] riscv: booti: do not force relocation if force_reloc is not set
  2021-04-06  7:50 [PATCH] riscv: booti: do not force relocation if force_reloc is not set Vitaly Wool
@ 2021-07-15  9:09 ` Leo Liang
  0 siblings, 0 replies; 2+ messages in thread
From: Leo Liang @ 2021-07-15  9:09 UTC (permalink / raw)
  To: Vitaly Wool; +Cc: u-boot

On Tue, Apr 06, 2021 at 10:50:16AM +0300, Vitaly Wool wrote:
> If force_reloc flag is not set and booti is called for an address
> ouside RAM (i. e. QSPI NOR flash), we should honor that and not try
> to force relocation in a bogus fashion.
> 
> Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com>
> ---
>  arch/riscv/lib/image.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

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

end of thread, other threads:[~2021-07-15  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06  7:50 [PATCH] riscv: booti: do not force relocation if force_reloc is not set Vitaly Wool
2021-07-15  9:09 ` Leo Liang

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.