From: Andreas Schwab <schwab@suse.de>
To: "Clément Léger" <cleger@rivosinc.com>
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-riscv@lists.infradead.org,
Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Shuah Khan <shuah@kernel.org>, Alexandre Ghiti <alex@ghiti.fr>
Subject: Re: [PATCH v4] selftests: riscv: add misaligned access testing
Date: Thu, 10 Jul 2025 16:23:00 +0200 [thread overview]
Message-ID: <mvma55cgm63.fsf@suse.de> (raw)
In-Reply-To: <5db9ec69-d0e4-4113-a989-ac75d0f1e5dd@rivosinc.com> (=?utf-8?Q?=22Cl=C3=A9ment=09L=C3=A9ger=22's?= message of "Thu, 10 Jul 2025 16:10:03 +0200")
On Jul 10 2025, Clément Léger wrote:
> On 10/07/2025 15:53, Andreas Schwab wrote:
>> On Jul 10 2025, Clément Léger wrote:
>>
>>> This selftest tests all the currently emulated instructions (except for
>>> the RV32 compressed ones which are left as a future exercise for a RV32
>>> user). For the FPU instructions, all the FPU registers are tested.
>>
>> If that didn't catch the missing sign extension that I just fixed in
>> <https://lore.kernel.org/linux-riscv/mvmikk0goil.fsf@suse.de>, you
>> should consider extending the tests.
>>
>
> Hi Andreas, you link doesn't work and I didn't find anything about sign
> extension except a patch you wrote for arch_cmpxg().
lore.k.o is currently down, here's the patch I have sent:
From 77c8255da24ee4fac54e2371594d7210d1ddee19 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Thu, 10 Jul 2025 13:52:35 +0200
Subject: [PATCH] riscv: traps_misaligned: properly sign extend value in
misaligned load handler
Add missing cast to signed long.
Signed-off-by: Andreas Schwab <schwab@suse.de>
---
arch/riscv/kernel/traps_misaligned.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/traps_misaligned.c b/arch/riscv/kernel/traps_misaligned.c
index 93043924fe6c..f760e4fcc052 100644
--- a/arch/riscv/kernel/traps_misaligned.c
+++ b/arch/riscv/kernel/traps_misaligned.c
@@ -461,7 +461,7 @@ static int handle_scalar_misaligned_load(struct pt_regs *regs)
}
if (!fp)
- SET_RD(insn, regs, val.data_ulong << shift >> shift);
+ SET_RD(insn, regs, (long)(val.data_ulong << shift) >> shift);
else if (len == 8)
set_f64_rd(insn, regs, val.data_u64);
else
--
2.50.0
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
next prev parent reply other threads:[~2025-07-10 14:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 13:35 Clément Léger
2025-07-10 13:53 ` Andreas Schwab
2025-07-10 14:10 ` Clément Léger
2025-07-10 14:23 ` Andreas Schwab [this message]
2025-07-10 14:29 ` Clément Léger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mvma55cgm63.fsf@suse.de \
--to=schwab@suse.de \
--cc=alex@ghiti.fr \
--cc=cleger@rivosinc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®