[PATCH v3 0/3] KVM: riscv: add check_supported_reg() into get-reg-list test

From: Yong-Xuan Wang

Date: Fri May 29 2026 - 02:33:32 EST


This series addresses a bug in the SBI FWFT (Firmware Features) extension
where features could remain exposed to guests after their dependent ISA
extensions are disabled at runtime, and improves the related selftest
infrastructure.

The bug (patch 1) occurred because FWFT feature support was cached at vCPU
initialization time. When userspace subsequently disabled ISA extensions
via KVM ONE_REG, the cached support status was not updated, leading to
stale feature exposure.

The selftest improvements (patches 2-3) enhance the get-reg-list test by
refactoring the extension sublist infrastructure and splitting FWFT
feature testing into separate, properly-gated sublists.

---
Changes in v3:
- Restore 'supported' field with init() callback for initialization probing
(sashiko-bot)
- Add NULL checks before calling feature->supported() in all functions
- Fix isa_ext_enabled tracking logic and restore isa_ext_cant_disable array
- Add sbi_ext_enabled tracking and enhance dependency checking (sashiko-bot)
- Refine code organization and variable naming consistency (sashiko-bot)
- Link to v2: https://patch.msgid.link/20260526-kvm-get_reg_list-v2-v2-0-7940a401454a@xxxxxxxxxx

Changes in v2:
- Fix FWFT stale feature exposure by removing static 'supported' field
- Refactor get-reg-list test to use unified extension sublist macros
- Split FWFT testing into per-feature sublists with runtime checks
(Andrew)

To: Anup Patel <anup@xxxxxxxxxxxxxx>
To: Atish Patra <atish.patra@xxxxxxxxx>
To: Paul Walmsley <pjw@xxxxxxxxxx>
To: Palmer Dabbelt <palmer@xxxxxxxxxxx>
To: Albert Ou <aou@xxxxxxxxxxxxxxxxx>
To: Alexandre Ghiti <alex@xxxxxxxx>
To: Clément Léger <cleger@xxxxxxxxxxxx>
To: Andrew Jones <ajones@xxxxxxxxxxxxxxxx>
To: Paolo Bonzini <pbonzini@xxxxxxxxxx>
To: Shuah Khan <shuah@xxxxxxxxxx>
Cc: greentime.hu@xxxxxxxxxx
Cc: vincent.chen@xxxxxxxxxx
Cc: zong.li@xxxxxxxxxx
Cc: kvm@xxxxxxxxxxxxxxx
Cc: kvm-riscv@xxxxxxxxxxxxxxxxxxx
Cc: linux-riscv@xxxxxxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: linux-kselftest@xxxxxxxxxxxxxxx

---
Yong-Xuan Wang (3):
KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes
KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros
KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists

arch/riscv/kvm/vcpu_sbi_fwft.c | 32 ++++-
tools/testing/selftests/kvm/riscv/get-reg-list.c | 168 +++++++++++++++--------
2 files changed, 140 insertions(+), 60 deletions(-)
---
base-commit: c7832534a8160276cccb9a8cc8cafb5614c579d0
change-id: 20260526-kvm-get_reg_list-v2-f9f36961ac6c