All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/5] KVM: riscv: Fix stale FWFT feature exposure and enhance selftests
@ 2026-06-01 10:26 ` Yong-Xuan Wang
  0 siblings, 0 replies; 40+ messages in thread
From: Yong-Xuan Wang @ 2026-06-01 10:26 UTC (permalink / raw)
  To: Anup Patel, Atish Patra, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, Clément Léger, Andrew Jones,
	Paolo Bonzini, Shuah Khan
  Cc: greentime.hu, vincent.chen, zong.li, kvm, kvm-riscv, linux-riscv,
	linux-kernel, linux-kselftest, inochiama, Yong-Xuan Wang

This series fixes three bugs in the SBI FWFT (Firmware Features) extension
and improves the related selftest infrastructure.
The bugs are:
1. Missing CSR dirty marking: When userspace sets FWFT feature values via
   KVM_SET_ONE_REG, modified CSRs (e.g., henvcfg.PMM for pointer masking)
   are not marked dirty, leading to stale state after vCPU scheduling or
   migration.
2. Hardware probing side effects: The try_to_set_pmm() function modifies
   HENVCFG.PMM during hardware capability detection but fails to restore
   the original value, leaving the CSR in an altered state that affects
   subsequent operations.
3. Stale feature exposure: FWFT feature support is cached at vCPU
   initialization time. When userspace subsequently disables ISA extensions
   via KVM_SET_ONE_REG, the cached support status is not updated, allowing
   guests to access features that depend on disabled extensions.
Patches 1-3 fix these bugs separately.

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

---
Changes in v5:
- Add CSR dirty marking fix (new patch 1/5) (sashiko-bot)
- Split original FWFT bug fix into two focused patches
  - Add init() callback with try_to_set_pmm() restoration fix (new patch
    2/5) (sashiko-bot)
  - Keep runtime supported() checks as separate patch (patch 3/5)
- Link to v4: https://patch.msgid.link/20260601-kvm-get_reg_list-v2-v4-0-c88abc81ebda@sifive.com

Changes in v4:
- Rename the title of cover letter
- Disable preemption when running try_to_set_pmm() (sashiko-bot)
- Remove check_supported_reg() (sashiko-bot)
- Link to v3: https://patch.msgid.link/20260528-kvm-get_reg_list-v2-v3-0-170969a8599f@sifive.com

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@sifive.com

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@brainfault.org>
To: Atish Patra <atish.patra@linux.dev>
To: Paul Walmsley <pjw@kernel.org>
To: Palmer Dabbelt <palmer@dabbelt.com>
To: Albert Ou <aou@eecs.berkeley.edu>
To: Alexandre Ghiti <alex@ghiti.fr>
To: Clément Léger <cleger@rivosinc.com>
To: Andrew Jones <ajones@ventanamicro.com>
To: Paolo Bonzini <pbonzini@redhat.com>
To: Shuah Khan <shuah@kernel.org>
Cc: greentime.hu@sifive.com
Cc: vincent.chen@sifive.com
Cc: zong.li@sifive.com
Cc: kvm@vger.kernel.org
Cc: kvm-riscv@lists.infradead.org
Cc: linux-riscv@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org

---
Yong-Xuan Wang (5):
      KVM: RISC-V: SBI FWFT: Mark vCPU CSRs dirty after setting feature value
      KVM: RISC-V: SBI FWFT: Add optional init() callback for hardware probing
      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                   |  44 +++++++-
 tools/testing/selftests/kvm/riscv/get-reg-list.c | 138 ++++++++++++++---------
 2 files changed, 125 insertions(+), 57 deletions(-)
---
base-commit: c7832534a8160276cccb9a8cc8cafb5614c579d0
change-id: 20260526-kvm-get_reg_list-v2-f9f36961ac6c


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

^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2026-06-05 16:17 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-01 10:26 [PATCH v5 0/5] KVM: riscv: Fix stale FWFT feature exposure and enhance selftests Yong-Xuan Wang
2026-06-01 10:26 ` Yong-Xuan Wang
2026-06-01 10:26 ` Yong-Xuan Wang
2026-06-01 10:26 ` [PATCH v5 1/5] KVM: RISC-V: SBI FWFT: Mark vCPU CSRs dirty after setting feature value Yong-Xuan Wang
2026-06-01 10:26   ` Yong-Xuan Wang
2026-06-01 10:26   ` Yong-Xuan Wang
2026-06-01 11:04   ` sashiko-bot
2026-06-05 15:30   ` Anup Patel
2026-06-05 15:30     ` Anup Patel
2026-06-05 15:30     ` Anup Patel
2026-06-01 10:26 ` [PATCH v5 2/5] KVM: RISC-V: SBI FWFT: Add optional init() callback for hardware probing Yong-Xuan Wang
2026-06-01 10:26   ` Yong-Xuan Wang
2026-06-01 10:26   ` Yong-Xuan Wang
2026-06-05 16:11   ` Anup Patel
2026-06-05 16:11     ` Anup Patel
2026-06-05 16:11     ` Anup Patel
2026-06-01 10:26 ` [PATCH v5 3/5] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes Yong-Xuan Wang
2026-06-01 10:26   ` Yong-Xuan Wang
2026-06-01 10:26   ` Yong-Xuan Wang
2026-06-01 11:37   ` sashiko-bot
2026-06-05 16:12   ` Anup Patel
2026-06-05 16:12     ` Anup Patel
2026-06-05 16:12     ` Anup Patel
2026-06-01 10:26 ` [PATCH v5 4/5] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros Yong-Xuan Wang
2026-06-01 10:26   ` Yong-Xuan Wang
2026-06-01 10:26   ` Yong-Xuan Wang
2026-06-05 16:13   ` Anup Patel
2026-06-05 16:13     ` Anup Patel
2026-06-05 16:13     ` Anup Patel
2026-06-01 10:26 ` [PATCH v5 5/5] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists Yong-Xuan Wang
2026-06-01 10:26   ` Yong-Xuan Wang
2026-06-01 10:26   ` Yong-Xuan Wang
2026-06-01 11:54   ` sashiko-bot
2026-06-04  9:28     ` Yong-Xuan Wang
2026-06-05 16:14   ` Anup Patel
2026-06-05 16:14     ` Anup Patel
2026-06-05 16:14     ` Anup Patel
2026-06-05 16:16 ` [PATCH v5 0/5] KVM: riscv: Fix stale FWFT feature exposure and enhance selftests Anup Patel
2026-06-05 16:16   ` Anup Patel
2026-06-05 16:16   ` Anup Patel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.