[SRU][J:linux-bluefield][PATCH v1 1/7] arm64/sme: Implement ZA context switching

Stav Aviram saviram at nvidia.com
Thu Aug 7 13:33:19 UTC 2025


From: Mark Brown <broonie at kernel.org>

BugLink: https://bugs.launchpad.net/bugs/2119457

Allocate space for storing ZA on first access to SME and use that to save
and restore ZA state when context switching. We do this by using the vector
form of the LDR and STR ZA instructions, these do not require streaming
mode and have implementation recommendations that they avoid contention
issues in shared SMCU implementations.

Since ZA is architecturally guaranteed to be zeroed when enabled we do not
need to explicitly zero ZA, either we will be restoring from a saved copy
or trapping on first use of SME so we know that ZA must be disabled.

Signed-off-by: Mark Brown <broonie at kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas at arm.com>
Link: https://lore.kernel.org/r/20220419112247.711548-16-broonie@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas at arm.com>
(backported from commit 0033cd9339642f9b7bef23f96aa2e7277ab51cce)
[Conflict resolution: Removed complete SME ZA register context switching
implementation (7 files, ~190 lines) since SME is not supported in
linux-bluefield-5.15. Only kept minimal KVM compatibility change (u64
svcr field) to maintain API compatibility.]
Signed-off-by: Stav Aviram <saviram at nvidia.com>
---
 arch/arm64/include/asm/kvm_host.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index e19da01dc03c..94a3d4994dc3 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -295,6 +295,7 @@ struct kvm_vcpu_arch {
 	void *sve_state;
 	enum fp_type fp_type;
 	unsigned int sve_max_vl;
+	u64 svcr;
 
 	/* Stage 2 paging state used by the hardware on next switch */
 	struct kvm_s2_mmu *hw_mmu;
-- 
2.34.1




More information about the kernel-team mailing list