[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200911192601.9591-3-krish.sadhukhan@oracle.com>
Date: Fri, 11 Sep 2020 19:25:59 +0000
From: Krish Sadhukhan <krish.sadhukhan@...cle.com>
To: kvm@...r.kernel.org
Cc: pbonzini@...hat.com, jmattson@...gle.com, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, x86@...nel.org,
sean.j.christopherson@...el.com, vkuznets@...hat.com,
wanpengli@...cent.com, joro@...tes.org,
dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
linux-kernel@...r.kernel.org, hpa@...or.com
Subject: [PATCH 2/4 v3] x86: AMD: Add hardware-enforced cache coherency as a CPUID feature
In some hardware implementations, coherency between the encrypted and
unencrypted mappings of the same physical page is enforced. In such a system,
it is not required for software to flush the page from all CPU caches in the
system prior to changing the value of the C-bit for a page. This hardware-
enforced cache coherency is indicated by EAX[10] in CPUID leaf 0x8000001f.
Suggested-by: Tom Lendacky <thomas.lendacky@....com>
Signed-off-by: Krish Sadhukhan <krish.sadhukhan@...cle.com>
---
arch/x86/include/asm/cpufeatures.h | 1 +
arch/x86/kernel/cpu/scattered.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index 81335e6fe47d..0e5b27ee5931 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -293,6 +293,7 @@
#define X86_FEATURE_FENCE_SWAPGS_USER (11*32+ 4) /* "" LFENCE in user entry SWAPGS path */
#define X86_FEATURE_FENCE_SWAPGS_KERNEL (11*32+ 5) /* "" LFENCE in kernel entry SWAPGS path */
#define X86_FEATURE_SPLIT_LOCK_DETECT (11*32+ 6) /* #AC for split lock */
+#define X86_FEATURE_HW_CACHE_COHERENCY (11*32+ 7) /* AMD hardware-enforced cache coherency */
/* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
#define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */
diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
index 033c112e03fc..57394fee1d35 100644
--- a/arch/x86/kernel/cpu/scattered.c
+++ b/arch/x86/kernel/cpu/scattered.c
@@ -41,6 +41,7 @@ static const struct cpuid_bit cpuid_bits[] = {
{ X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 },
{ X86_FEATURE_SME, CPUID_EAX, 0, CPUID_AMD_SME, 0 },
{ X86_FEATURE_SEV, CPUID_EAX, 1, CPUID_AMD_SME, 0 },
+ { X86_FEATURE_HW_CACHE_COHERENCY, CPUID_EAX, 10, CPUID_AMD_SME, 0 },
{ 0, 0, 0, 0, 0 }
};
--
2.18.4
Powered by blists - more mailing lists