public inbox for opensbi@lists.infradead.org
 help / color / mirror / Atom feed
From: Bo Gan <ganboing@gmail.com>
To: Andrew Jones <andrew.jones@oss.qualcomm.com>,
	Bo Gan <ganboing@gmail.com>
Cc: opensbi@lists.infradead.org, dramforever@live.com,
	anup.patel@oss.qualcomm.com, anup@brainfault.org,
	cleger@rivosinc.com, samuel.holland@sifive.com
Subject: Re: [PATCH 6/7] lib: sbi: Rework load/store emulator instruction decoding
Date: Wed, 11 Feb 2026 02:36:26 -0800	[thread overview]
Message-ID: <18716d93-ed49-4c30-80b3-0956306df776@gmail.com> (raw)
In-Reply-To: <3joqam2xgawjrhjyao7q7ulni23x5b73lk7twirld2lpiw2xf6@slh6pvojkksv>

Hi Andrew,

On 2/10/26 08:08, Andrew Jones wrote:
> On Tue, Feb 10, 2026 at 01:40:43AM -0800, Bo Gan wrote:
> ...
>> Validation:
>> The patch is validated to have fixed the issue with test cases running
>> on a modified version of QEMU that exposes misaligned faults [1], and
>> a further modified version that removes tinst transformation [2]. The
>> S-mode OS is a local build of Debian Trixie 6.12 kernel that enables
>> COMPAT (RV32), and the U-mode test application exercises all integer
>> and floating-point load/store (RVIFD64/32+RVC64/32) instructions with
>> all possible imm values. The patch is also tested on real HW (Sifive
>> P550/ESWIN EIC7700), which only supports RV64. On P550, the same test
>> was validated both in U mode and VU mode, where the host runs a 6.12
>> ESWIN vendor kernel that has some ESWIN SoC device driver patches [3]
>> applied, and the guest runs the exact same Debian Trixie 6.12 kernel
>> mentioned above.
>>
>> [1] https://github.com/ganboing/qemu/tree/ganboing-misalign
>> [2] https://github.com/ganboing/qemu/tree/ganboing-misalign-no-tinst
>> [3] https://github.com/sifiveinc/riscv-linux/tree/rel/kernel-6.12/hifive-premier-p550
>>
> 
> Hi Bo,
> 
> It'd be nice if we could integrate emulation tests into a test suite that
> gets run frequently in order to catch regressions. We have already started
> using the kvm-unit-tests[4] framework for SBI testing so adding emulation

Good to know. I wasn't aware of this project. I'll definitely take a look
and see if I can upstream the test cases there. I guess it can be utilized
to test misaligned handler in both M mode OpenSBI and the KVM SBI layer,
depending on whether host Linux/KVM enables misaligned exc delegation,
correct?

> tests there would make sense. If special QEMU behavior is needed then we
> should get cpu properties that enable those behaviors upstreamed so we can
> turn them on when running the tests.

I think this is done by others for sure. I was actually inspired by this
https://lore.kernel.org/all/20241211211933.198792-1-fkonrad@amd.com/
series by Frederic to hack QEMU. Similar patches have been done by others
such as Clément mentioned in this series:
https://lore.kernel.org/all/20250106154847.1100344-1-cleger@rivosinc.com/
I'd like to hear from folks to understand if there're any roadblocks
exposing the misaligned fault in QEMU (gated by a config flag), before
attempting.

Spoiler alert: Linux's misaligned handler seems to be affected by the
same insn decoding issue where there's no checking of previous XLEN. I'm
yet to check if Linux is affected by other issues in this patchset, too.
Once this change is merged in OpenSBI, I'll also be looking into fixing
Linux and adding my test cases into Linux/selftests as well.

> 
> [4] https://gitlab.com/kvm-unit-tests/kvm-unit-tests
> 
> Thanks,
> drew

Bo

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

  reply	other threads:[~2026-02-11 10:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-10  9:40 [PATCH 0/7] Fixes for load/store misaligned and access faults Bo Gan
2026-02-10  9:40 ` [PATCH 1/7] include: sbi: Add more mstatus and instruction encoding Bo Gan
2026-03-20  4:40   ` Anup Patel
2026-02-10  9:40 ` [PATCH 2/7] include: sbi: Add sbi_regs_prev_xlen Bo Gan
2026-03-20  4:42   ` Anup Patel
2026-02-10  9:40 ` [PATCH 3/7] include: sbi: Add GET_RDS_NUM/SET(_FP32/_FP64)_RDS macros Bo Gan
2026-03-20  4:44   ` Anup Patel
2026-02-10  9:40 ` [PATCH 4/7] include: sbi: set FS dirty in vsstatus when V=1 Bo Gan
2026-03-20  4:45   ` Anup Patel
2026-02-10  9:40 ` [PATCH 5/7] lib: sbi: Do not override emulator callback for vector load/store Bo Gan
2026-03-20  5:13   ` Anup Patel
2026-03-21  4:50     ` Bo Gan
2026-02-10  9:40 ` [PATCH 6/7] lib: sbi: Rework load/store emulator instruction decoding Bo Gan
2026-02-10 16:08   ` Andrew Jones
2026-02-11 10:36     ` Bo Gan [this message]
2026-02-11 15:01       ` Andrew Jones
2026-04-02  0:02   ` Bo Gan
2026-02-10  9:40 ` [PATCH 7/7] [NOT-FOR-UPSTREAM] Test program for misaligned load/store Bo Gan

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=18716d93-ed49-4c30-80b3-0956306df776@gmail.com \
    --to=ganboing@gmail.com \
    --cc=andrew.jones@oss.qualcomm.com \
    --cc=anup.patel@oss.qualcomm.com \
    --cc=anup@brainfault.org \
    --cc=cleger@rivosinc.com \
    --cc=dramforever@live.com \
    --cc=opensbi@lists.infradead.org \
    --cc=samuel.holland@sifive.com \
    /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