From: Marc Zyngier <maz@kernel.org> mainline inclusion from mainline-6.12 commit d4db98791aa5316677a1da9bfa0788068c9863dc category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/8904 CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... ---------------------------------------------------------------------- As we are about to check for the advertisement of FPMR support to a guest in a number of places, add a predicate that will gate most of the support code for FPMR. Reviewed-by: Mark Brown <broonie@kernel.org> Tested-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20240820131802.3547589-3-maz@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org> Conflicts: arch/arm64/include/asm/kvm_host.h [Modifications adapt to kaki breakage.] Signed-off-by: Qinxin Xia <xiaqinxin@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- arch/arm64/include/asm/kvm_host.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index e4b3fd9bc8ef..da553b005182 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -1449,4 +1449,11 @@ extern bool kvm_ncsnp_support; extern bool kvm_dvmbm_support; extern bool enable_vmovp_elision; +#ifdef CONFIG_ENABLE_KVM_FPMR +#define kvm_has_fpmr(k) \ + (system_supports_fpmr() && \ + (FIELD_GET(ID_AA64PFR2_EL1_FPMR_MASK, \ + kvm_read_vm_id_reg((k), SYS_ID_AA64PFR2_EL1)) >= \ + ID_AA64PFR2_EL1_FPMR_IMP)) +#endif #endif /* __ARM64_KVM_HOST_H__ */ -- 2.25.1