Skip to content

Commit

Permalink
x86/hyper-v: Add hyperv Isolation VM check in the cc_platform_has()
Browse files Browse the repository at this point in the history
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.

Hyper-V Isolation VMs need to adjust the SWIOTLB size just like SEV
guests. Add a hyperv_cc_platform_has() variant which enables that.

Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
Acked-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20211213071407.314309-3-ltykernel@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
  • Loading branch information
Tianyu Lan authored and Wei Liu committed Dec 20, 2021
1 parent 1a5e91d commit c789b90
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/x86/kernel/cc_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/cc_platform.h>
#include <linux/mem_encrypt.h>

#include <asm/mshyperv.h>
#include <asm/processor.h>

static bool __maybe_unused intel_cc_platform_has(enum cc_attr attr)
Expand Down Expand Up @@ -58,12 +59,19 @@ static bool amd_cc_platform_has(enum cc_attr attr)
#endif
}

static bool hyperv_cc_platform_has(enum cc_attr attr)
{
return attr == CC_ATTR_GUEST_MEM_ENCRYPT;
}

bool cc_platform_has(enum cc_attr 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);

0 comments on commit c789b90

Please sign in to comment.