* [PATCH FOR-NEXT] riscv: Add norvc after .option arch in runtime const
@ 2025-03-31 18:45 Charlie Jenkins
2025-03-31 18:54 ` Palmer Dabbelt
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Charlie Jenkins @ 2025-03-31 18:45 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Klara Modin
Cc: linux-riscv, linux-kernel, Charlie Jenkins
.option arch clobbers .option norvc. Prevent gas from emitting
compressed instructions in the runtime const alternative blocks by
setting .option norvc after .option arch. This issue starts appearing on
gcc 15, which adds zca to the march.
Reported by: Klara Modin <klarasmodin@gmail.com>
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Fixes: a44fb5722199 ("riscv: Add runtime constant support")
Closes: https://lore.kernel.org/all/cc8f3525-20b7-445b-877b-2add28a160a2@gmail.com/
---
arch/riscv/include/asm/runtime-const.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/riscv/include/asm/runtime-const.h b/arch/riscv/include/asm/runtime-const.h
index c07d049fdd5d2999c57d8a90e7363829c5462368..451fd76b881152919f22de8f5c56b51171acbf3c 100644
--- a/arch/riscv/include/asm/runtime-const.h
+++ b/arch/riscv/include/asm/runtime-const.h
@@ -56,6 +56,7 @@
#define RISCV_RUNTIME_CONST_64_ZBA \
".option push\n\t" \
".option arch,+zba\n\t" \
+ ".option norvc\n\t" \
"slli %[__tmp],%[__tmp],32\n\t" \
"add.uw %[__ret],%[__ret],%[__tmp]\n\t" \
"nop\n\t" \
@@ -65,6 +66,7 @@
#define RISCV_RUNTIME_CONST_64_ZBKB \
".option push\n\t" \
".option arch,+zbkb\n\t" \
+ ".option norvc\n\t" \
"pack %[__ret],%[__ret],%[__tmp]\n\t" \
"nop\n\t" \
"nop\n\t" \
---
base-commit: b2117b630c48be69d2782ed79fefe35dcd192ce6
change-id: 20250331-fix_runtime_const_norvc-407af1f24541
--
- Charlie
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH FOR-NEXT] riscv: Add norvc after .option arch in runtime const
2025-03-31 18:45 [PATCH FOR-NEXT] riscv: Add norvc after .option arch in runtime const Charlie Jenkins
@ 2025-03-31 18:54 ` Palmer Dabbelt
2025-03-31 19:39 ` Klara Modin
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Palmer Dabbelt @ 2025-03-31 18:54 UTC (permalink / raw)
To: Charlie Jenkins
Cc: Paul Walmsley, aou, Alexandre Ghiti, klarasmodin, linux-riscv,
linux-kernel, Charlie Jenkins
On Mon, 31 Mar 2025 11:45:24 PDT (-0700), Charlie Jenkins wrote:
> .option arch clobbers .option norvc. Prevent gas from emitting
> compressed instructions in the runtime const alternative blocks by
> setting .option norvc after .option arch. This issue starts appearing on
> gcc 15, which adds zca to the march.
There's some clunkiness around ".option arch" and ".option rvc". So
this might be an assembler bug, but IMO it's sane to just work around it
in Linux -- at a bare minimum it'll manifest for users, as binutils
already released (and GCC 15 is just enabling the Kconfig that triggers
the bug).
> Reported by: Klara Modin <klarasmodin@gmail.com>
There shouldn't be a newline here, I'll just drop it.
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> Fixes: a44fb5722199 ("riscv: Add runtime constant support")
> Closes: https://lore.kernel.org/all/cc8f3525-20b7-445b-877b-2add28a160a2@gmail.com/
> ---
> arch/riscv/include/asm/runtime-const.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/include/asm/runtime-const.h b/arch/riscv/include/asm/runtime-const.h
> index c07d049fdd5d2999c57d8a90e7363829c5462368..451fd76b881152919f22de8f5c56b51171acbf3c 100644
> --- a/arch/riscv/include/asm/runtime-const.h
> +++ b/arch/riscv/include/asm/runtime-const.h
> @@ -56,6 +56,7 @@
> #define RISCV_RUNTIME_CONST_64_ZBA \
> ".option push\n\t" \
> ".option arch,+zba\n\t" \
> + ".option norvc\n\t" \
> "slli %[__tmp],%[__tmp],32\n\t" \
> "add.uw %[__ret],%[__ret],%[__tmp]\n\t" \
> "nop\n\t" \
> @@ -65,6 +66,7 @@
> #define RISCV_RUNTIME_CONST_64_ZBKB \
> ".option push\n\t" \
> ".option arch,+zbkb\n\t" \
> + ".option norvc\n\t" \
> "pack %[__ret],%[__ret],%[__tmp]\n\t" \
> "nop\n\t" \
> "nop\n\t" \
>
> ---
> base-commit: b2117b630c48be69d2782ed79fefe35dcd192ce6
> change-id: 20250331-fix_runtime_const_norvc-407af1f24541
Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH FOR-NEXT] riscv: Add norvc after .option arch in runtime const
2025-03-31 18:45 [PATCH FOR-NEXT] riscv: Add norvc after .option arch in runtime const Charlie Jenkins
2025-03-31 18:54 ` Palmer Dabbelt
@ 2025-03-31 19:39 ` Klara Modin
2025-04-01 9:27 ` Clément Léger
2025-04-01 14:10 ` patchwork-bot+linux-riscv
3 siblings, 0 replies; 5+ messages in thread
From: Klara Modin @ 2025-03-31 19:39 UTC (permalink / raw)
To: Charlie Jenkins, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti
Cc: linux-riscv, linux-kernel
On 2025-03-31 20:45, Charlie Jenkins wrote:
> .option arch clobbers .option norvc. Prevent gas from emitting
> compressed instructions in the runtime const alternative blocks by
> setting .option norvc after .option arch. This issue starts appearing on
> gcc 15, which adds zca to the march.
>
> Reported by: Klara Modin <klarasmodin@gmail.com>
>
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> Fixes: a44fb5722199 ("riscv: Add runtime constant support")
> Closes: https://lore.kernel.org/all/cc8f3525-20b7-445b-877b-2add28a160a2@gmail.com/
> ---
> arch/riscv/include/asm/runtime-const.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/include/asm/runtime-const.h b/arch/riscv/include/asm/runtime-const.h
> index c07d049fdd5d2999c57d8a90e7363829c5462368..451fd76b881152919f22de8f5c56b51171acbf3c 100644
> --- a/arch/riscv/include/asm/runtime-const.h
> +++ b/arch/riscv/include/asm/runtime-const.h
> @@ -56,6 +56,7 @@
> #define RISCV_RUNTIME_CONST_64_ZBA \
> ".option push\n\t" \
> ".option arch,+zba\n\t" \
> + ".option norvc\n\t" \
> "slli %[__tmp],%[__tmp],32\n\t" \
> "add.uw %[__ret],%[__ret],%[__tmp]\n\t" \
> "nop\n\t" \
> @@ -65,6 +66,7 @@
> #define RISCV_RUNTIME_CONST_64_ZBKB \
> ".option push\n\t" \
> ".option arch,+zbkb\n\t" \
> + ".option norvc\n\t" \
> "pack %[__ret],%[__ret],%[__tmp]\n\t" \
> "nop\n\t" \
> "nop\n\t" \
>
> ---
> base-commit: b2117b630c48be69d2782ed79fefe35dcd192ce6
> change-id: 20250331-fix_runtime_const_norvc-407af1f24541
Thanks!
Tested-by: Klara Modin <klarasmodin@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH FOR-NEXT] riscv: Add norvc after .option arch in runtime const
2025-03-31 18:45 [PATCH FOR-NEXT] riscv: Add norvc after .option arch in runtime const Charlie Jenkins
2025-03-31 18:54 ` Palmer Dabbelt
2025-03-31 19:39 ` Klara Modin
@ 2025-04-01 9:27 ` Clément Léger
2025-04-01 14:10 ` patchwork-bot+linux-riscv
3 siblings, 0 replies; 5+ messages in thread
From: Clément Léger @ 2025-04-01 9:27 UTC (permalink / raw)
To: Charlie Jenkins, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Klara Modin
Cc: linux-riscv, linux-kernel
On 31/03/2025 20:45, Charlie Jenkins wrote:
> .option arch clobbers .option norvc. Prevent gas from emitting
> compressed instructions in the runtime const alternative blocks by
> setting .option norvc after .option arch. This issue starts appearing on
> gcc 15, which adds zca to the march.
>
> Reported by: Klara Modin <klarasmodin@gmail.com>
>
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> Fixes: a44fb5722199 ("riscv: Add runtime constant support")
> Closes: https://lore.kernel.org/all/cc8f3525-20b7-445b-877b-2add28a160a2@gmail.com/
> ---
> arch/riscv/include/asm/runtime-const.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/include/asm/runtime-const.h b/arch/riscv/include/asm/runtime-const.h
> index c07d049fdd5d2999c57d8a90e7363829c5462368..451fd76b881152919f22de8f5c56b51171acbf3c 100644
> --- a/arch/riscv/include/asm/runtime-const.h
> +++ b/arch/riscv/include/asm/runtime-const.h
> @@ -56,6 +56,7 @@
> #define RISCV_RUNTIME_CONST_64_ZBA \
> ".option push\n\t" \
> ".option arch,+zba\n\t" \
> + ".option norvc\n\t" \
Hey Charlie,
Could ".option arch,+zba,-c" be used as well ? That way, c is treated
like any other arch option. Or does norvc has other side effects ?
Thanks,
Clément
> "slli %[__tmp],%[__tmp],32\n\t" \
> "add.uw %[__ret],%[__ret],%[__tmp]\n\t" \
> "nop\n\t" \
> @@ -65,6 +66,7 @@
> #define RISCV_RUNTIME_CONST_64_ZBKB \
> ".option push\n\t" \
> ".option arch,+zbkb\n\t" \
> + ".option norvc\n\t" \
> "pack %[__ret],%[__ret],%[__tmp]\n\t" \
> "nop\n\t" \
> "nop\n\t" \
>
> ---
> base-commit: b2117b630c48be69d2782ed79fefe35dcd192ce6
> change-id: 20250331-fix_runtime_const_norvc-407af1f24541
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH FOR-NEXT] riscv: Add norvc after .option arch in runtime const
2025-03-31 18:45 [PATCH FOR-NEXT] riscv: Add norvc after .option arch in runtime const Charlie Jenkins
` (2 preceding siblings ...)
2025-04-01 9:27 ` Clément Léger
@ 2025-04-01 14:10 ` patchwork-bot+linux-riscv
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+linux-riscv @ 2025-04-01 14:10 UTC (permalink / raw)
To: Charlie Jenkins
Cc: linux-riscv, paul.walmsley, palmer, aou, alex, klarasmodin,
linux-kernel
Hello:
This patch was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:
On Mon, 31 Mar 2025 11:45:24 -0700 you wrote:
> .option arch clobbers .option norvc. Prevent gas from emitting
> compressed instructions in the runtime const alternative blocks by
> setting .option norvc after .option arch. This issue starts appearing on
> gcc 15, which adds zca to the march.
>
> Reported by: Klara Modin <klarasmodin@gmail.com>
>
> [...]
Here is the summary with links:
- [FOR-NEXT] riscv: Add norvc after .option arch in runtime const
https://git.kernel.org/riscv/c/95c18b7ccdd1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-01 14:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-31 18:45 [PATCH FOR-NEXT] riscv: Add norvc after .option arch in runtime const Charlie Jenkins
2025-03-31 18:54 ` Palmer Dabbelt
2025-03-31 19:39 ` Klara Modin
2025-04-01 9:27 ` Clément Léger
2025-04-01 14:10 ` patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox