RISC-V: selftests: cbo: Ensure asm operands match constraints, take 2
PATCH 1/1 RISC-V: selftests: cbo: Ensure asm operands match constraints, take 2
Commit 0de65288d75f ("RISC-V: selftests: cbo: Ensure asm operands match constraints") attempted to ensure MK_CBO() would always provide to a compile-time constant when given a constant, but cpu_to_le32() isn't necessarily going to do that. Switch to manually shifting the bytes, when needed, to finally get this right.
--- tools/testing/selftests/riscv/hwprobe/cbo.c | 2 +- tools/testing/selftests/riscv/hwprobe/hwprobe.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
tools/testing/selftests/riscv/hwprobe/cbo.c +1 -1
@@ -19,7 +19,7 @@#include "hwprobe.h" #include "../../kselftest.h" -#define MK_CBO (fn) cpu_to_le32((fn) << 20 | 10 << 15 | 2 << 12 | 0 << 7 | 15) +#define MK_CBO (fn) le32_bswap((uint32_t)(fn) << 20 | 10 << 15 | 2 << 12 | 0 << 7 | 15)static char mem[4096 ]__aligned(4096) = { [0 ...4095 ] =0xa5 };
tools/testing/selftests/riscv/hwprobe/hwprobe.h +10 -0
@@ -4,6 +4,16 @@#include <stddef.h> #include <asm/hwprobe.h> +#if __BYTE_ORDER == __BIG_ENDIAN +# define le32_bswap (_x) \ + ((((_x) & 0x000000ffU) << 24) | \ + (((_x) & 0x0000ff00U) << 8) | \ + (((_x) & 0x00ff0000U) >> 8) | \ + (((_x) & 0xff000000U) >> 24)) +#else +# define le32_bswap (_x) (_x) +#endif +/* * Rather than relying on having a new enough libc to define this, just do it * ourselves. This way we don't need to be coupled to a new-enough libc to
Signature · 7 lines
2.44.0 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 11 lines · Andrew Jones
Commit
0de65288d75f("RISC-V: selftests: cbo: Ensure asm operands match constraints") attempted to ensureMK_CBO()would always provide to a compile-time constant when given a constant, butcpu_to_le32()isn't necessarily going to do that. Switch to manually shifting the bytes, when needed, to finally get this right.Reported-by Woodrow Shen <[email protected]>Closes https://lore.kernel.org/all/CABquHATcBTUwfLpd9sPObBgNobqQKEAZ2yxk+TWSpyO5xvpXpg@mail.gmail.com/ open hereFixes a29e2a48afe3 ("RISC-V: selftests: Add CBO tests")Fixes 0de65288d75f ("RISC-V: selftests: cbo: Ensure asm operands match constraints")Signed-off-by Andrew Jones <[email protected]>
This has been sitting in patchwork for a while and I don't see a message from either the reporter saying this was a good fix or from the selftests maintainer that it has been picked up. I was gonna mark it "handled elsewhere" but I noticed that this was only sent to the riscv maintainers so we should probably harass Palmer today to pick this up?
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 13 lines · Conor Dooley
Quoted 11 lines · Andrew Jones
Commit
0de65288d75f("RISC-V: selftests: cbo: Ensure asm operands match constraints") attempted to ensureMK_CBO()would always provide to a compile-time constant when given a constant, butcpu_to_le32()isn't necessarily going to do that. Switch to manually shifting the bytes, when needed, to finally get this right.Reported-by Woodrow Shen <[email protected]>Closes https://lore.kernel.org/all/CABquHATcBTUwfLpd9sPObBgNobqQKEAZ2yxk+TWSpyO5xvpXpg@mail.gmail.com/ open hereFixes a29e2a48afe3 ("RISC-V: selftests: Add CBO tests")Fixes 0de65288d75f ("RISC-V: selftests: cbo: Ensure asm operands match constraints")Signed-off-by Andrew Jones <[email protected]>
Quoted 6 lines
This has been sitting in patchwork for a while and I don't see a message from either the reporter saying this was a good fix or from the selftests maintainer that it has been picked up. I was gonna mark it "handled elsewhere" but I noticed that this was only sent to the riscv maintainers so we should probably harass Palmer today to pick this up?
Yup. Thanks for the reminder to follow up!
drew
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi Andrew and Conor,
I was missing this thread and just now this patch was verified by my local, thank you for reminding me.
Cheers,
Quoted 22 lines · Andrew Jones
Quoted 13 lines · Conor Dooley
Quoted 11 lines · Andrew Jones
Commit
0de65288d75f("RISC-V: selftests: cbo: Ensure asm operands match constraints") attempted to ensureMK_CBO()would always provide to a compile-time constant when given a constant, butcpu_to_le32()isn't necessarily going to do that. Switch to manually shifting the bytes, when needed, to finally get this right.Reported-by Woodrow Shen <[email protected]>Closes https://lore.kernel.org/all/CABquHATcBTUwfLpd9sPObBgNobqQKEAZ2yxk+TWSpyO5xvpXpg@mail.gmail.com/ open hereFixes a29e2a48afe3 ("RISC-V: selftests: Add CBO tests")Fixes 0de65288d75f ("RISC-V: selftests: cbo: Ensure asm operands match constraints")Signed-off-by Andrew Jones <[email protected]>Quoted 6 lines
This has been sitting in patchwork for a while and I don't see a message from either the reporter saying this was a good fix or from the selftests maintainer that it has been picked up. I was gonna mark it "handled elsewhere" but I noticed that this was only sent to the riscv maintainers so we should probably harass Palmer today to pick this up?
Quoted 3 lines
Yup. Thanks for the reminder to follow up!
drew
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt <[email protected]>:
Hello:
This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <[email protected]>:
Quoted 6 lines · On Fri, 22 Mar 2024 14:47:28 +0100 you wrote:
Commit
0de65288d75f("RISC-V: selftests: cbo: Ensure asm operands match constraints") attempted to ensureMK_CBO()would always provide to a compile-time constant when given a constant, butcpu_to_le32()isn't necessarily going to do that. Switch to manually shifting the bytes, when needed, to finally get this right.
Quoted 7 lines
Reported-by Woodrow Shen <[email protected]>Closes https://lore.kernel.org/all/CABquHATcBTUwfLpd9sPObBgNobqQKEAZ2yxk+TWSpyO5xvpXpg@mail.gmail.com/ open hereFixes a29e2a48afe3 ("RISC-V: selftests: Add CBO tests")Fixes 0de65288d75f ("RISC-V: selftests: cbo: Ensure asm operands match constraints")Signed-off-by Andrew Jones <[email protected]>[...]
Here is the summary with links:
- RISC-V: selftests: cbo: Ensure asm operands match constraints, take 2
https://git.kernel.org/riscv/c/f6b56df883d4
You are awesome, thank you!
Signature · 9 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv