lkml.org 
[lkml]   [2021]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v7 05/12] x86/tdx: Add TDX guest support to intel_cc_platform_has()
Date
TDX architecture provides a way for VM guests to be highly secure and
isolated (from untrusted VMM). To achieve this requirement, any data
coming from VMM cannot be completely trusted. TDX guest fixes this
issue by hardening the IO drivers against the attack from the VMM.
So, when adding hardening fixes to the generic drivers, to protect
custom fixes use cc_platform_has() API.

Also add TDX guest support to intel_cc_platform_has() API to protect
the TDX specific fixes

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
---

Change since v6:
* Used cc_platform_has() in place of prot_guest_has().
* Rebased on top of Tom Landecky's CC platform support patch series.
https://lore.kernel.org/linux-iommu/f9951644147e27772bf4512325e8ba6472e363b7.1631141919.git.thomas.lendacky@amd.com/T/

Changes since v5:
* Replaced tdx_prot_guest_has() with intel_prot_guest_has() to
keep the Intel call non TDX specific.
* Added TDX guest support to intel_prot_guest_has().

Changes since v4:
* Rebased on top of Tom Lendacky's protected guest changes.
* Moved memory encryption related protected guest flags in
tdx_prot_guest_has() to the patch that actually uses them.

arch/x86/Kconfig | 1 +
arch/x86/kernel/cpu/intel.c | 7 +++++++
include/linux/cc_platform.h | 9 +++++++++
3 files changed, 17 insertions(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 6ed6afee0424..561af965d39e 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -871,6 +871,7 @@ config INTEL_TDX_GUEST
depends on SECURITY
select X86_X2APIC
select SECURITY_LOCKDOWN_LSM
+ select ARCH_HAS_CC_PLATFORM
help
Provide support for running in a trusted domain on Intel processors
equipped with Trusted Domain eXtensions. TDX is a new Intel
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 5f45d51020b7..57779bd18873 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -64,6 +64,13 @@ static bool cpu_model_supports_sld __ro_after_init;
#ifdef CONFIG_ARCH_HAS_CC_PLATFORM
bool intel_cc_platform_has(enum cc_attr attr)
{
+ switch (attr) {
+ case CC_ATTR_GUEST_TDX:
+ return cpu_feature_enabled(X86_FEATURE_TDX_GUEST);
+ default:
+ return false;
+ }
+
return false;
}
EXPORT_SYMBOL_GPL(intel_cc_platform_has);
diff --git a/include/linux/cc_platform.h b/include/linux/cc_platform.h
index 253f3ea66cd8..e38430e6e396 100644
--- a/include/linux/cc_platform.h
+++ b/include/linux/cc_platform.h
@@ -61,6 +61,15 @@ enum cc_attr {
* Examples include SEV-ES.
*/
CC_ATTR_GUEST_STATE_ENCRYPT,
+
+ /**
+ * @CC_ATTR_GUEST_TDX: Trusted Domain Extension Support
+ *
+ * The platform/OS is running as a TDX guest/virtual machine.
+ *
+ * Examples include SEV-ES.
+ */
+ CC_ATTR_GUEST_TDX,
};

#ifdef CONFIG_ARCH_HAS_CC_PLATFORM
--
2.25.1
\
 
 \ /
  Last update: 2021-09-16 20:38    [W:0.177 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site