* [PATCH 0/2] riscv: Resolve module loading issues
@ 2023-11-17 19:56 Charlie Jenkins
2023-11-17 19:56 ` [PATCH 1/2] Support rv32 ULEB128 test Charlie Jenkins
2023-11-17 19:56 ` [PATCH 2/2] Correct type casting in module loading Charlie Jenkins
0 siblings, 2 replies; 5+ messages in thread
From: Charlie Jenkins @ 2023-11-17 19:56 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Randy Dunlap
Cc: Palmer Dabbelt, linux-riscv, linux-kernel, Charlie Jenkins
Previous commits caused compilation of module linking tests to
fail on rv32 toolchains with uleb128 support. The first patch resolves
that issue. The second patch resolves the type issues pointed out by
sparse.
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
---
Charlie Jenkins (2):
Support rv32 ULEB128 test
Correct type casting in module loading
arch/riscv/kernel/module.c | 8 ++++----
arch/riscv/kernel/tests/module_test/test_uleb128.S | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
---
base-commit: 9bacdd8996c77c42ca004440be610692275ff9d0
change-id: 20231117-module_fixup-699787d9c567
--
- Charlie
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] Support rv32 ULEB128 test
2023-11-17 19:56 [PATCH 0/2] riscv: Resolve module loading issues Charlie Jenkins
@ 2023-11-17 19:56 ` Charlie Jenkins
2023-11-21 17:31 ` Randy Dunlap
2023-11-17 19:56 ` [PATCH 2/2] Correct type casting in module loading Charlie Jenkins
1 sibling, 1 reply; 5+ messages in thread
From: Charlie Jenkins @ 2023-11-17 19:56 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Randy Dunlap
Cc: Palmer Dabbelt, linux-riscv, linux-kernel, Charlie Jenkins
Use opcodes available to both rv32 and rv64 in uleb128 module linking
test.
Fixes: af71bc194916 ("riscv: Add tests for riscv module loading")
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
---
arch/riscv/kernel/tests/module_test/test_uleb128.S | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/riscv/kernel/tests/module_test/test_uleb128.S b/arch/riscv/kernel/tests/module_test/test_uleb128.S
index 90f22049d553..8515ed7cd8c1 100644
--- a/arch/riscv/kernel/tests/module_test/test_uleb128.S
+++ b/arch/riscv/kernel/tests/module_test/test_uleb128.S
@@ -6,13 +6,13 @@
.text
.global test_uleb_basic
test_uleb_basic:
- ld a0, second
+ lw a0, second
addi a0, a0, -127
ret
.global test_uleb_large
test_uleb_large:
- ld a0, fourth
+ lw a0, fourth
addi a0, a0, -0x07e8
ret
@@ -22,10 +22,10 @@ first:
second:
.reloc second, R_RISCV_SET_ULEB128, second
.reloc second, R_RISCV_SUB_ULEB128, first
- .dword 0
+ .word 0
third:
.space 1000
fourth:
.reloc fourth, R_RISCV_SET_ULEB128, fourth
.reloc fourth, R_RISCV_SUB_ULEB128, third
- .dword 0
+ .word 0
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] Correct type casting in module loading
2023-11-17 19:56 [PATCH 0/2] riscv: Resolve module loading issues Charlie Jenkins
2023-11-17 19:56 ` [PATCH 1/2] Support rv32 ULEB128 test Charlie Jenkins
@ 2023-11-17 19:56 ` Charlie Jenkins
2023-11-21 21:33 ` Samuel Holland
1 sibling, 1 reply; 5+ messages in thread
From: Charlie Jenkins @ 2023-11-17 19:56 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Randy Dunlap
Cc: Palmer Dabbelt, linux-riscv, linux-kernel, Charlie Jenkins
Make static variables static and use __le16.
Fixes: 8fd6c5142395 ("riscv: Add remaining module relocations")
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
---
arch/riscv/kernel/module.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c
index 56a8c78e9e21..9f2dc2c0e436 100644
--- a/arch/riscv/kernel/module.c
+++ b/arch/riscv/kernel/module.c
@@ -45,9 +45,9 @@ void process_accumulated_relocations(struct module *me);
int add_relocation_to_accumulate(struct module *me, int type, void *location,
unsigned int hashtable_bits, Elf_Addr v);
-struct hlist_head *relocation_hashtable;
+static struct hlist_head *relocation_hashtable;
-struct list_head used_buckets_list;
+static struct list_head used_buckets_list;
/*
* The auipc+jalr instruction pair can reach any PC-relative offset
@@ -64,7 +64,7 @@ static bool riscv_insn_valid_32bit_offset(ptrdiff_t val)
static int riscv_insn_rmw(void *location, u32 keep, u32 set)
{
- u16 *parcel = location;
+ __le16 *parcel = location;
u32 insn = (u32)le16_to_cpu(parcel[0]) | (u32)le16_to_cpu(parcel[1]) << 16;
insn &= keep;
@@ -77,7 +77,7 @@ static int riscv_insn_rmw(void *location, u32 keep, u32 set)
static int riscv_insn_rvc_rmw(void *location, u16 keep, u16 set)
{
- u16 *parcel = location;
+ __le16 *parcel = location;
u16 insn = le16_to_cpu(*parcel);
insn &= keep;
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Support rv32 ULEB128 test
2023-11-17 19:56 ` [PATCH 1/2] Support rv32 ULEB128 test Charlie Jenkins
@ 2023-11-21 17:31 ` Randy Dunlap
0 siblings, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2023-11-21 17:31 UTC (permalink / raw)
To: Charlie Jenkins, Paul Walmsley, Palmer Dabbelt, Albert Ou
Cc: Palmer Dabbelt, linux-riscv, linux-kernel
On 11/17/23 11:56, Charlie Jenkins wrote:
> Use opcodes available to both rv32 and rv64 in uleb128 module linking
> test.
>
> Fixes: af71bc194916 ("riscv: Add tests for riscv module loading")
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Thanks.
> ---
> arch/riscv/kernel/tests/module_test/test_uleb128.S | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/riscv/kernel/tests/module_test/test_uleb128.S b/arch/riscv/kernel/tests/module_test/test_uleb128.S
> index 90f22049d553..8515ed7cd8c1 100644
> --- a/arch/riscv/kernel/tests/module_test/test_uleb128.S
> +++ b/arch/riscv/kernel/tests/module_test/test_uleb128.S
> @@ -6,13 +6,13 @@
> .text
> .global test_uleb_basic
> test_uleb_basic:
> - ld a0, second
> + lw a0, second
> addi a0, a0, -127
> ret
>
> .global test_uleb_large
> test_uleb_large:
> - ld a0, fourth
> + lw a0, fourth
> addi a0, a0, -0x07e8
> ret
>
> @@ -22,10 +22,10 @@ first:
> second:
> .reloc second, R_RISCV_SET_ULEB128, second
> .reloc second, R_RISCV_SUB_ULEB128, first
> - .dword 0
> + .word 0
> third:
> .space 1000
> fourth:
> .reloc fourth, R_RISCV_SET_ULEB128, fourth
> .reloc fourth, R_RISCV_SUB_ULEB128, third
> - .dword 0
> + .word 0
>
--
~Randy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Correct type casting in module loading
2023-11-17 19:56 ` [PATCH 2/2] Correct type casting in module loading Charlie Jenkins
@ 2023-11-21 21:33 ` Samuel Holland
0 siblings, 0 replies; 5+ messages in thread
From: Samuel Holland @ 2023-11-21 21:33 UTC (permalink / raw)
To: Charlie Jenkins
Cc: Palmer Dabbelt, linux-riscv, linux-kernel, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Randy Dunlap
On 2023-11-17 1:56 PM, Charlie Jenkins wrote:
> Make static variables static and use __le16.
>
> Fixes: 8fd6c5142395 ("riscv: Add remaining module relocations")
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> ---
> arch/riscv/kernel/module.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
Tested-by: Samuel Holland <samuel.holland@sifive.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-11-21 21:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-17 19:56 [PATCH 0/2] riscv: Resolve module loading issues Charlie Jenkins
2023-11-17 19:56 ` [PATCH 1/2] Support rv32 ULEB128 test Charlie Jenkins
2023-11-21 17:31 ` Randy Dunlap
2023-11-17 19:56 ` [PATCH 2/2] Correct type casting in module loading Charlie Jenkins
2023-11-21 21:33 ` Samuel Holland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®