Skip to content

[PW_SID:956712] riscv: add SBI FWFT misaligned exception delegation support#341

Closed
linux-riscv-bot wants to merge 15 commits into
workflow__riscv__fixesfrom
pw956712
Closed

[PW_SID:956712] riscv: add SBI FWFT misaligned exception delegation support#341
linux-riscv-bot wants to merge 15 commits into
workflow__riscv__fixesfrom
pw956712

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 956712 applied to workflow__riscv__fixes

Name: riscv: add SBI FWFT misaligned exception delegation support
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=956712
Version: 6

Linux RISC-V bot and others added 15 commits April 16, 2025 18:23
The Firmware Features extension (FWFT) was added as part of the SBI 3.0
specification. Add SBI definitions to use this extension.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
Tested-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Deepak Gupta <debug@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
A few parenthesis in check for SBI version/extension were useless,
remove them.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
A few new errors have been added with SBI V3.0, maps them as close as
possible to errno values.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
This SBI extensions enables supervisor mode to control feature that are
under M-mode control (For instance, Svadu menvcfg ADUE bit, Ssdbltrp
DTE, etc). Add an interface to set local features for a specific cpu
mask as well as for the online cpu mask.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add FWFT extension calls. This will be ratified in SBI V3.0 hence, it is
provided as a separate commit that can be left out if needed.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Now that the kernel can handle misaligned accesses in S-mode, request
misaligned access exception delegation from SBI. This uses the FWFT SBI
extension defined in SBI version 3.0.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…bing

schedule_on_each_cpu() was used without any good reason while documented
as very slow. This call was in the boot path, so better use
on_each_cpu() for scalar misaligned checking. Vector misaligned check
still needs to use schedule_on_each_cpu() since it requires irqs to be
enabled but that's less of a problem since this code is ran in a kthread.
Add a comment to explicit that.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
misaligned_access_speed is defined under CONFIG_RISCV_SCALAR_MISALIGNED
but was used under CONFIG_RISCV_PROBE_UNALIGNED_ACCESS. Fix that by
using the correct config option.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Split the code that check for the uniformity of misaligned accesses
performance on all cpus from check_unaligned_access_emulated_all_cpus()
to its own function which will be used for delegation check. No
functional changes intended.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Checking for the delegability of the misaligned access trap is needed
for the KVM FWFT extension implementation. Add a function to get the
delegability of the misaligned trap exception.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The FWFT SBI extension will need to dynamically allocate memory and do
init time specific initialization. Add an init/deinit callbacks that
allows to do so.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Currently, only the STA extension needed a reset function but that's
going to be the case for FWFT as well. Add a reset callback that can be
implemented by SBI extensions.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add basic infrastructure to support the FWFT extension in KVM.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
SBI_FWFT_MISALIGNED_DELEG needs hedeleg to be modified to delegate
misaligned load/store exceptions. Save and restore it during CPU
load/put.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Deepak Gupta <debug@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v6,01/14] riscv: sbi: add Firmware Feature (FWFT) SBI extensions definitions"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 103.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v6,01/14] riscv: sbi: add Firmware Feature (FWFT) SBI extensions definitions"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 984.99 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot force-pushed the workflow__riscv__fixes branch from 6c2725a to c8da138 Compare April 24, 2025 20:46
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v6,01/14] riscv: sbi: add Firmware Feature (FWFT) SBI extensions definitions"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1303.80 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v6,01/14] riscv: sbi: add Firmware Feature (FWFT) SBI extensions definitions"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v6,01/14] riscv: sbi: add Firmware Feature (FWFT) SBI extensions definitions"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.38 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v6,01/14] riscv: sbi: add Firmware Feature (FWFT) SBI extensions definitions"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.75 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v6,01/14] riscv: sbi: add Firmware Feature (FWFT) SBI extensions definitions"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 38.87 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v6,01/14] riscv: sbi: add Firmware Feature (FWFT) SBI extensions definitions"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v6,01/14] riscv: sbi: add Firmware Feature (FWFT) SBI extensions definitions"
kdoc
Desc: Detects for kdoc errors
Duration: 0.85 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v6,01/14] riscv: sbi: add Firmware Feature (FWFT) SBI extensions definitions"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v6,01/14] riscv: sbi: add Firmware Feature (FWFT) SBI extensions definitions"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v6,01/14] riscv: sbi: add Firmware Feature (FWFT) SBI extensions definitions"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v6,02/14] riscv: sbi: remove useless parenthesis"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 101.91 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v6,02/14] riscv: sbi: remove useless parenthesis"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 956.69 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 12: "[v6,12/14] RISC-V: KVM: add SBI extension reset callback"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 12: "[v6,12/14] RISC-V: KVM: add SBI extension reset callback"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 12: "[v6,12/14] RISC-V: KVM: add SBI extension reset callback"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 13: "[v6,13/14] RISC-V: KVM: add support for FWFT SBI extension"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 102.16 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 13: "[v6,13/14] RISC-V: KVM: add support for FWFT SBI extension"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 986.02 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 13: "[v6,13/14] RISC-V: KVM: add support for FWFT SBI extension"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1309.06 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 13: "[v6,13/14] RISC-V: KVM: add support for FWFT SBI extension"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 21.56 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 13: "[v6,13/14] RISC-V: KVM: add support for FWFT SBI extension"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.67 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 13: "[v6,13/14] RISC-V: KVM: add support for FWFT SBI extension"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 3.45 seconds
Result: WARNING
Output:

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#61: 
new file mode 100644

WARNING: 'ment' may be misspelled - perhaps 'meant'?
#71: FILE: arch/riscv/include/asm/kvm_vcpu_sbi_fwft.h:6:
+ *     Clément Léger <cleger@rivosinc.com>
            ^^^^

WARNING: 'ment' may be misspelled - perhaps 'meant'?
#145: FILE: arch/riscv/kvm/vcpu_sbi_fwft.c:6:
+ *     Clément Léger <cleger@rivosinc.com>
            ^^^^

CHECK: Consider using #include <linux/cpufeature.h> instead of <asm/cpufeature.h>
#151: FILE: arch/riscv/kvm/vcpu_sbi_fwft.c:12:
+#include <asm/cpufeature.h>

total: 0 errors, 3 warnings, 1 checks, 292 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 7db56466edaa ("RISC-V: KVM: add support for FWFT SBI extension") 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, 3 warnings, 1 checks, 292 lines checked
CHECK: Consider using #include <linux/cpufeature.h> instead of <asm/cpufeature.h>
WARNING: 'ment' may be misspelled - perhaps 'meant'?
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 13: "[v6,13/14] RISC-V: KVM: add support for FWFT SBI extension"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 39.61 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 13: "[v6,13/14] RISC-V: KVM: add support for FWFT SBI extension"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 13: "[v6,13/14] RISC-V: KVM: add support for FWFT SBI extension"
kdoc
Desc: Detects for kdoc errors
Duration: 0.85 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 13: "[v6,13/14] RISC-V: KVM: add support for FWFT SBI extension"
module-param
Desc: Detect module_param changes
Duration: 0.86 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 13: "[v6,13/14] RISC-V: KVM: add support for FWFT SBI extension"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 13: "[v6,13/14] RISC-V: KVM: add support for FWFT SBI extension"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 14: "[v6,14/14] RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 104.69 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 14: "[v6,14/14] RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 958.38 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 14: "[v6,14/14] RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1268.16 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 14: "[v6,14/14] RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.00 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 14: "[v6,14/14] RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 14: "[v6,14/14] RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.86 seconds
Result: WARNING
Output:

CHECK: Alignment should match open parenthesis
#73: FILE: arch/riscv/kvm/vcpu_sbi_fwft.c:79:
+static long kvm_sbi_fwft_set_misaligned_delegation(struct kvm_vcpu *vcpu,
+					struct kvm_sbi_fwft_config *conf,

CHECK: Alignment should match open parenthesis
#87: FILE: arch/riscv/kvm/vcpu_sbi_fwft.c:93:
+static long kvm_sbi_fwft_get_misaligned_delegation(struct kvm_vcpu *vcpu,
+					struct kvm_sbi_fwft_config *conf,

total: 0 errors, 0 warnings, 2 checks, 70 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 cb70b0f140b5 ("RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG") 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, 0 warnings, 2 checks, 70 lines checked
CHECK: Alignment should match open parenthesis


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 14: "[v6,14/14] RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 38.63 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 14: "[v6,14/14] RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 14: "[v6,14/14] RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG"
kdoc
Desc: Detects for kdoc errors
Duration: 0.90 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 14: "[v6,14/14] RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 14: "[v6,14/14] RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 14: "[v6,14/14] RISC-V: KVM: add support for SBI_FWFT_MISALIGNED_DELEG"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot force-pushed the workflow__riscv__fixes branch from c8da138 to 4d9ad71 Compare April 30, 2025 11:41
@linux-riscv-bot linux-riscv-bot deleted the pw956712 branch May 2, 2025 01:03
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