[PATCH 1/3] arm64: mm: Support Common Not Private translations
From: Vladimir Murzin <hidden>
Date: 2017-10-11 08:49:09
On 10/10/17 16:19, James Morse wrote:
Hi Vladimir, On 09/10/17 13:55, Vladimir Murzin wrote:quoted
Common Not Private (CNP) is a feature of ARMv8.2 extension which allows translation table entries to be shared between different PEs in the same inner shareable domain, so the hardware can use this fact to optimise the caching of such entries in the TLB.quoted
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 21e2c95..8d098a1 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c@@ -1211,6 +1224,14 @@ cpufeature_pan_not_uao(const struct arm64_cpu_capabilities *entry, int __unused) return (cpus_have_const_cap(ARM64_HAS_PAN) && !cpus_have_const_cap(ARM64_HAS_UAO)); } +#ifdef CONFIG_ARM64_CNP +static int cpu_enable_cnp(void *__unused) +{ + cpu_replace_ttbr1(swapper_pg_dir);All the other callers of cpu_replace_ttbr1() wrap swapper_pg_dir in lm_alias(). I'm pretty sure this is so that virt_to_phys() works when swapper_pg_dir's address is in the vmalloc range. CONFIG_DEBUG_VIRTUAL should catch problems like this.
Indeed it did!
(Nit: you shouldn't need the #ifdeffery, the only caller of this function is in the same file, so the compiler should do the right thing)
I'll look into it. Thanks Vladimir
quoted
+ return 0; +} +#endif /* CONFIG_ARM64_CNP */ + /* * We emulate only the following system register space. * Op0 = 0x3, CRn = 0x0, Op1 = 0x0, CRm = [0, 4 - 7]