summaryrefslogtreecommitdiff
path: root/drivers/hv
diff options
context:
space:
mode:
authorDexuan Cui <decui@microsoft.com>2023-08-24 01:07:04 -0700
committerWei Liu <wei.liu@kernel.org>2023-08-25 00:04:56 +0000
commitd6e0228d265f29348a01780ff306321c399d8b95 (patch)
tree5c05fed6d87e9444003f911e73389ce926def88c /drivers/hv
parent08e9d12077fcc7c4c4579d7dcd8093b59b01369e (diff)
downloadlwn-d6e0228d265f29348a01780ff306321c399d8b95.tar.gz
lwn-d6e0228d265f29348a01780ff306321c399d8b95.zip
x86/hyperv: Support hypercalls for fully enlightened TDX guests
A fully enlightened TDX guest on Hyper-V (i.e. without the paravisor) only uses the GHCI call rather than hv_hypercall_pg. Do not initialize hypercall_pg for such a guest. In hv_common_cpu_init(), the hyperv_pcpu_input_arg page needs to be decrypted in such a guest. Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Reviewed-by: Tianyu Lan <tiala@microsoft.com> Signed-off-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: Wei Liu <wei.liu@kernel.org> Link: https://lore.kernel.org/r/20230824080712.30327-3-decui@microsoft.com
Diffstat (limited to 'drivers/hv')
-rw-r--r--drivers/hv/hv_common.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c
index da3307533f4d..897bbb96f411 100644
--- a/drivers/hv/hv_common.c
+++ b/drivers/hv/hv_common.c
@@ -381,10 +381,10 @@ int hv_common_cpu_init(unsigned int cpu)
*outputarg = (char *)(*inputarg) + HV_HYP_PAGE_SIZE;
}
- if (hv_isolation_type_en_snp()) {
+ if (hv_isolation_type_en_snp() || hv_isolation_type_tdx()) {
ret = set_memory_decrypted((unsigned long)*inputarg, pgcount);
if (ret) {
- kfree(*inputarg);
+ /* It may be unsafe to free *inputarg */
*inputarg = NULL;
return ret;
}
@@ -567,3 +567,9 @@ u64 __weak hv_ghcb_hypercall(u64 control, void *input, void *output, u32 input_s
return HV_STATUS_INVALID_PARAMETER;
}
EXPORT_SYMBOL_GPL(hv_ghcb_hypercall);
+
+u64 __weak hv_tdx_hypercall(u64 control, u64 param1, u64 param2)
+{
+ return HV_STATUS_INVALID_PARAMETER;
+}
+EXPORT_SYMBOL_GPL(hv_tdx_hypercall);