Skip to contentSkip to conversation

firmware: Minor optimization for relocate

PATCH New Dongdong Zhang 3 participants 5 messages Nov 29, 2022 – Dec 5, 2022

lore
Share & tools
lore
#0 lore raw

cover firmware: Minor optimization for relocate

The t3 register stores the address of _load_end. If relocation is not required, it is unnecessary to calculate the address of _load_end.

This can reduce the operation time of two instructions.

Dongdong Zhang (1):
firmware: Minor optimization for relocate

 firmware/fw_base.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 firmware: Minor optimization for relocate

The t3 register stores the address of _load_end. If relocation is not required, it is unnecessary to calculate the address of _load_end.

This can reduce the operation time of two instructions.

---
 firmware/fw_base.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
firmware/fw_base.S +1 -1
index 07be4c4..3f622b3 100644
@@ -128,9 +128,9 @@ _relocate:
 	REG_L	t1, 0(t1)
 	lla	t2, _load_start
 	REG_L	t2, 0(t2)
+	beq	t0, t2, _relocate_done
 	sub	t3, t1, t0
 	add	t3, t3, t2
-	beq	t0, t2, _relocate_done
 	lla	t4, _relocate_done
 	sub	t4, t4, t2
 	add	t4, t4, t0
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/1 firmware: Minor optimization for relocate

Quoted 2 lines · Dongdong Zhang

The t3 register stores the address of _load_end. If relocation is not required, it is unnecessary to calculate the address of _load_end.

nits: commit messages should be written like about 70 characters per line.

Quoted 8 lines

This can reduce the operation time of two instructions.

---
 firmware/fw_base.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#3 lore raw

PATCH 1/1 firmware: Minor optimization for relocate

Hi, Bin

Thank you for your review, and I will pay attention to the style of the commit message next time.

Quoted 19 lines

-----????-----???:"Bin Meng" <[email protected]>????:2022-11-29 15:51:33 (???)???:"Dongdong Zhang" <[email protected]>??:opensbi at lists.infradead.org??:Re: [PATCH 1/1] firmware: Minor optimization for relocate

Quoted 2 lines · Dongdong Zhang

The t3 register stores the address of _load_end. If relocation is not required, it is unnecessary to calculate the address of _load_end.

nits: commit messages should be written like about 70 characters per line.

Quoted 8 lines

This can reduce the operation time of two instructions.

---
 firmware/fw_base.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Applied
#4 lore raw

PATCH 1/1 firmware: Minor optimization for relocate

In reply to Dongdong Zhang
Quoted 6 lines · Dongdong Zhang

The t3 register stores the address of _load_end. If relocation is not required, it is unnecessary to calculate the address of _load_end.

This can reduce the operation time of two instructions.

Looks good to me.

I have taken care of Bin's comment at the time of merging this patch.

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 27 lines
---
 firmware/fw_base.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
firmware/fw_base.S +1 -2
index 07be4c4..3f622b3 100644
@@ -128,9 +128,9 @@ _relocate:
        REG_L   t1, 0(t1)
        lla     t2, _load_start
        REG_L   t2, 0(t2)
+       beq     t0, t2, _relocate_done
        sub     t3, t1, t0
        add     t3, t3, t2
-       beq     t0, t2, _relocate_done
        lla     t4, _relocate_done
        sub     t4, t4, t2
        add     t4, t4, t0
--

2.17.1

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi