]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
RISC-V: add vector crypto extension validation checks
authorConor Dooley <conor.dooley@microchip.com>
Wed, 12 Mar 2025 13:11:45 +0000 (13:11 +0000)
committerAlexandre Ghiti <alexghiti@rivosinc.com>
Tue, 25 Mar 2025 14:10:08 +0000 (14:10 +0000)
commit38077ec8fc11fa62e85a3a7630cfa9f2b8fd9f65
tree170f8756de6dea792faada8afb72757dd2b09c1b
parent9324571e9eea231321acf0a3d0fbc85a6e0f6ff6
RISC-V: add vector crypto extension validation checks

Using Clement's new validation callbacks, support checking that
dependencies have been satisfied for the vector crpyto extensions.
Currently riscv_isa_extension_available(<vector crypto>) will return
true on systems that support the extensions but vector itself has been
disabled by the kernel, adding validation callbacks will prevent such a
scenario from occuring and make the behaviour of the extension detection
functions more consistent with user expectations - it's not expected to
have to check for vector AND the specific crypto extension.

The Unpriv spec states:
| The Zvknhb and Zvbc Vector Crypto Extensions --and accordingly the
| composite extensions Zvkn, Zvknc, Zvkng, and Zvksc-- require a Zve64x
| base, or application ("V") base Vector Extension. All of the other
| Vector Crypto Extensions can be built on any embedded (Zve*) or
| application ("V") base Vector Extension.

While this could be used as the basis for checking that the correct base
for individual crypto extensions, but that's not really the kernel's job
in my opinion and it is sufficient to leave that sort of precision to
the dt-bindings. The kernel only needs to make sure that vector, in some
form, is available.

Link: https://github.com/riscv/riscv-isa-manual/blob/main/src/vector-crypto.adoc#extensions-overview
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20250312-entertain-shaking-b664142c2f99@spud
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
arch/riscv/kernel/cpufeature.c