diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index e02c15e4ab31..0f0efafffd42 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -67,6 +67,7 @@ enum kvm_mode kvm_get_mode(void); DECLARE_STATIC_KEY_FALSE(userspace_irqchip_in_use); extern unsigned int kvm_sve_max_vl; +extern unsigned int kvm_host_sve_max_vl; int kvm_arm_init_sve(void); u32 __attribute_const__ kvm_target_cpu(void); diff --git a/arch/arm64/include/asm/kvm_hyp.h b/arch/arm64/include/asm/kvm_hyp.h index 199a0170745b..40d93a5daa62 100644 --- a/arch/arm64/include/asm/kvm_hyp.h +++ b/arch/arm64/include/asm/kvm_hyp.h @@ -130,6 +130,7 @@ extern u64 kvm_nvhe_sym(id_aa64mmfr2_el1_sys_val); extern unsigned long kvm_nvhe_sym(__icache_flags); extern unsigned int kvm_nvhe_sym(kvm_arm_vmid_bits); extern bool kvm_nvhe_sym(smccc_trng_available); +extern unsigned int kvm_nvhe_sym(kvm_host_sve_max_vl); struct kvm_nvhe_clock_data { u32 mult; diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 5d2d56655d4c..1c15e5b78e9e 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -2018,6 +2018,7 @@ static void kvm_hyp_init_symbols(void) kvm_nvhe_sym(__icache_flags) = __icache_flags; kvm_nvhe_sym(kvm_arm_vmid_bits) = kvm_arm_vmid_bits; kvm_nvhe_sym(smccc_trng_available) = smccc_trng_available; + kvm_nvhe_sym(kvm_host_sve_max_vl) = kvm_host_sve_max_vl; } int kvm_hyp_init_events(void); diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c index c6e2c426c451..d7ab28852994 100644 --- a/arch/arm64/kvm/hyp/nvhe/pkvm.c +++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c @@ -25,6 +25,8 @@ unsigned long __icache_flags; /* Used by kvm_get_vttbr(). */ unsigned int kvm_arm_vmid_bits; +unsigned int kvm_host_sve_max_vl; + /* * The currently loaded hyp vCPU for each physical CPU. Used only when * protected KVM is enabled, but for both protected and non-protected VMs. diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index 5e48878f25e8..2ede29175bf0 100644 --- a/arch/arm64/kvm/reset.c +++ b/arch/arm64/kvm/reset.c @@ -33,11 +33,13 @@ static u32 kvm_ipa_limit; unsigned int kvm_sve_max_vl; +unsigned int kvm_host_sve_max_vl; int kvm_arm_init_sve(void) { if (system_supports_sve()) { kvm_sve_max_vl = sve_max_virtualisable_vl(); + kvm_host_sve_max_vl = sve_max_vl(); /* * The get_sve_reg()/set_sve_reg() ioctl interface will need