Skip to content

[PW_SID:1101400] KVM: riscv: add check_supported_reg() into get-reg-list test#2022

Open
linux-riscv-bot wants to merge 3 commits into
workflow__riscv__fixesfrom
pw1101400
Open

[PW_SID:1101400] KVM: riscv: add check_supported_reg() into get-reg-list test#2022
linux-riscv-bot wants to merge 3 commits into
workflow__riscv__fixesfrom
pw1101400

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 1101400 applied to workflow__riscv__fixes

Name: KVM: riscv: add check_supported_reg() into get-reg-list test
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1101400
Version: 2

yong-xuan added 3 commits May 27, 2026 07:04
…sion changes

Fix a bug where FWFT features could be incorrectly exposed to guests
after userspace disables their dependent ISA extensions at runtime.

The 'supported' field in kvm_sbi_fwft_config was set once during vCPU
initialization based on the initial hardware/extension availability.
However, when userspace subsequently disables ISA extensions  via the
KVM ONE_REG interface, the 'supported' field was not updated. This caused
the following issues:

1. FWFT features would remain visible and accessible to guests even
   after their prerequisite ISA extensions were disabled
2. Guests could configure FWFT features that depend on disabled
   extensions, leading to undefined behavior
3. The static 'supported' flag and the dynamic supported() callback
   could disagree about feature availability

Remove the redundant static 'supported' field from kvm_sbi_fwft_config
and replace all conf->supported checks with feature->supported(vcpu)
calls that check the current vCPU ISA extension state. This can ensure
the feature availability is always determined at runtime based on the
current configuration, not initialization-time snapshots.

Fixes: 6b72fd1 ("RISC-V: KVM: add support for FWFT SBI extension")

Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Refactor the get-reg-list test to use unified sublist macros for ISA
and SBI extensions, eliminating code duplication and improving
maintainability.

Previously, each extension had its own hand-coded sublist definition
(e.g., SUBLIST_ZICBOM, SUBLIST_AIA, etc.) and the config structures
repeated the same pattern. This made the code verbose and error-prone.

Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…sublists

Divide the monolithic SBI FWFT (Firmware Features) register list into
separate sublists, each testing a specific FWFT feature independently
with proper dependency checking.

Previously, all FWFT features were tested together in a single sublist.
This caused issues because:
1. Not all FWFT features are available on all platforms
2. Some features depend on specific ISA extensions (e.g., pointer_masking
requires Smnpm)
3. Tests would fail if any single feature was unavailable

Add the feature-specific SBI FWFT sublists with the following
improvements:
- Add check_supported_reg() function to validate register availability
  based on required ISA extensions
- Add check_fwft_feature() helper to verify FWFT feature availability
  at runtime
- Update filter_reg() to handle per-feature FWFT register filtering

Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/3] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 141.18 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/3] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1067.89 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/3] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1449.37 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/3] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.95 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/3] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/3] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.02 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/3] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 87.42 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/3] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/3] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes"
kdoc
Desc: Detects for kdoc errors
Duration: 0.90 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/3] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/3] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 1.22 seconds
Result: ERROR
Output:

Commit: 4ab0e8e4e48ca ("KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes")
	Fixes tag: Fixes: 6b72fd170592 ("RISC-V: KVM: add support for FWFT SBI extension")
	Has these problem(s):
		- empty lines surround the Fixes tag
Problems with Fixes tag: 1


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2,1/3] KVM: RISC-V: SBI FWFT: Fix stale feature exposure after runtime extension changes"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/3] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.12 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/3] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1017.37 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/3] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1384.17 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/3] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.60 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/3] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.36 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/3] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 5.89 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/3] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 87.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/3] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/3] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros"
kdoc
Desc: Detects for kdoc errors
Duration: 0.85 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/3] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/3] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v2,2/3] KVM: riscv: selftests: Refactor ISA and SBI extension sublist macros"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.40 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/3] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 139.65 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/3] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1018.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/3] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1382.70 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/3] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.61 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/3] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.48 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/3] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 2.06 seconds
Result: WARNING
Output:

WARNING: line length of 115 exceeds 100 columns
#46: FILE: tools/testing/selftests/kvm/riscv/get-reg-list.c:34:
+	case KVM_REG_RISCV_SBI_STATE | KVM_REG_RISCV_SBI_FWFT | KVM_REG_RISCV_SBI_FWFT_REG(pointer_masking.enable):

WARNING: line length of 114 exceeds 100 columns
#47: FILE: tools/testing/selftests/kvm/riscv/get-reg-list.c:35:
+	case KVM_REG_RISCV_SBI_STATE | KVM_REG_RISCV_SBI_FWFT | KVM_REG_RISCV_SBI_FWFT_REG(pointer_masking.flags):

WARNING: line length of 114 exceeds 100 columns
#48: FILE: tools/testing/selftests/kvm/riscv/get-reg-list.c:36:
+	case KVM_REG_RISCV_SBI_STATE | KVM_REG_RISCV_SBI_FWFT | KVM_REG_RISCV_SBI_FWFT_REG(pointer_masking.value):

WARNING: line length of 116 exceeds 100 columns
#66: FILE: tools/testing/selftests/kvm/riscv/get-reg-list.c:167:
+	case KVM_REG_RISCV_SBI_STATE | KVM_REG_RISCV_SBI_FWFT | KVM_REG_RISCV_SBI_FWFT_REG(misaligned_deleg.enable):

WARNING: line length of 115 exceeds 100 columns
#67: FILE: tools/testing/selftests/kvm/riscv/get-reg-list.c:168:
+	case KVM_REG_RISCV_SBI_STATE | KVM_REG_RISCV_SBI_FWFT | KVM_REG_RISCV_SBI_FWFT_REG(misaligned_deleg.flags):

WARNING: line length of 115 exceeds 100 columns
#68: FILE: tools/testing/selftests/kvm/riscv/get-reg-list.c:169:
+	case KVM_REG_RISCV_SBI_STATE | KVM_REG_RISCV_SBI_FWFT | KVM_REG_RISCV_SBI_FWFT_REG(misaligned_deleg.value):

WARNING: line length of 119 exceeds 100 columns
#158: FILE: tools/testing/selftests/kvm/riscv/get-reg-list.c:959:
+	KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_SINGLE | KVM_RISCV_SBI_EXT_FWFT,

total: 0 errors, 7 warnings, 0 checks, 159 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 5623e8f371bd ("KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 7 warnings, 0 checks, 159 lines checked
WARNING: line length of 114 exceeds 100 columns
WARNING: line length of 115 exceeds 100 columns
WARNING: line length of 116 exceeds 100 columns
WARNING: line length of 119 exceeds 100 columns


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/3] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 86.55 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/3] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/3] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists"
kdoc
Desc: Detects for kdoc errors
Duration: 0.87 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/3] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/3] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v2,3/3] KVM: riscv: selftests: Split SBI FWFT into separate feature-specific sublists"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.32 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants