--- v7
+++ v4
@@ -1,26 +1,20 @@
From: Tianyu Lan <Tianyu.Lan@microsoft.com>
-Hyper-V provides Isolation VM for confidential computing support and
-guest memory is encrypted in it. Places checking cc_platform_has()
-with GUEST_MEM_ENCRYPT attr should return "True" in Isolation vm. e.g,
-swiotlb bounce buffer size needs to adjust according to memory size
-in the sev_setup_arch(). Add GUEST_MEM_ENCRYPT check for Hyper-V Isolation
-VM.
+Hyper-V provides Isolation VM which has memory encrypt support. Add
+hyperv_cc_platform_has() and return true for check of GUEST_MEM_ENCRYPT
+attribute.
Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
---
-Change since v6:
- * Change the order in the cc_platform_has() and check sev first.
-
Change since v3:
* Change code style of checking GUEST_MEM attribute in the
hyperv_cc_platform_has().
---
- arch/x86/kernel/cc_platform.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
+ arch/x86/kernel/cc_platform.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
diff --git a/arch/x86/kernel/cc_platform.c b/arch/x86/kernel/cc_platform.c
-index 03bb2f343ddb..6cb3a675e686 100644
+index 03bb2f343ddb..27c06b32e7c4 100644
--- a/arch/x86/kernel/cc_platform.c
+++ b/arch/x86/kernel/cc_platform.c
@@ -11,6 +11,7 @@
@@ -31,26 +25,27 @@
#include <asm/processor.h>
static bool __maybe_unused intel_cc_platform_has(enum cc_attr attr)
-@@ -58,12 +59,19 @@ static bool amd_cc_platform_has(enum cc_attr attr)
+@@ -58,9 +59,20 @@ static bool amd_cc_platform_has(enum cc_attr attr)
#endif
}
+static bool hyperv_cc_platform_has(enum cc_attr attr)
+{
++#ifdef CONFIG_HYPERV
+ return attr == CC_ATTR_GUEST_MEM_ENCRYPT;
++#else
++ return false;
++#endif
+}
bool cc_platform_has(enum cc_attr attr)
{
++ if (hv_is_isolation_supported())
++ return hyperv_cc_platform_has(attr);
++
if (sme_me_mask)
return amd_cc_platform_has(attr);
-+ if (hv_is_isolation_supported())
-+ return hyperv_cc_platform_has(attr);
-+
- return false;
- }
- EXPORT_SYMBOL_GPL(cc_platform_has);
--
2.25.1