Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

arm64/mm: Add lpa2_is_enabled() kvm_lpa2_is_enabled() stubs

Add stub functions which is initially always return false. These provide
the hooks that we need to update the range-based TLBI routines, whose
operands are encoded differently depending on whether lpa2 is enabled or
not.

The kernel and kvm will enable the use of lpa2 asynchronously in future,
and part of that enablement will involve fleshing out their respective
hook to advertise when it is using lpa2.

Since the kernel's decision to use lpa2 relies on more than just whether
the HW supports the feature, it can't just use the same static key as
kvm. This is another reason to use separate functions. lpa2_is_enabled()
is already implemented as part of Ard's kernel lpa2 series. Since kvm
will make its decision solely based on HW support, kvm_lpa2_is_enabled()
will be defined as system_supports_lpa2() once kvm starts using lpa2.

Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20231127111737.1897081-3-ryan.roberts@arm.com

authored by

Ryan Roberts and committed by
Marc Zyngier
936a4ec2 e2768b79

+4
+2
arch/arm64/include/asm/kvm_pgtable.h
··· 25 25 #define KVM_PGTABLE_MIN_BLOCK_LEVEL 2U 26 26 #endif 27 27 28 + #define kvm_lpa2_is_enabled() false 29 + 28 30 static inline u64 kvm_get_parange(u64 mmfr0) 29 31 { 30 32 u64 parange = cpuid_feature_extract_unsigned_field(mmfr0,
+2
arch/arm64/include/asm/pgtable-prot.h
··· 71 71 #define PTE_MAYBE_NG (arm64_use_ng_mappings ? PTE_NG : 0) 72 72 #define PMD_MAYBE_NG (arm64_use_ng_mappings ? PMD_SECT_NG : 0) 73 73 74 + #define lpa2_is_enabled() false 75 + 74 76 /* 75 77 * If we have userspace only BTI we don't want to mark kernel pages 76 78 * guarded even if the system does support BTI.