From 10568bab569bc40034cc973f26fbb0a768dcc3e3 Mon Sep 17 00:00:00 2001 From: Jiaqi Gao Date: Thu, 6 Apr 2023 22:28:43 -0400 Subject: [PATCH] tdx-tdcall: use shared GPA for `TDG.VP.VMCALL` Address of command and response buffer should be shared GPA according to GHCI. Signed-off-by: Jiaqi Gao --- tdx-tdcall/src/tdx.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tdx-tdcall/src/tdx.rs b/tdx-tdcall/src/tdx.rs index 1775613d..c73c90b4 100644 --- a/tdx-tdcall/src/tdx.rs +++ b/tdx-tdcall/src/tdx.rs @@ -411,8 +411,8 @@ pub fn tdvmcall_service( interrupt: u64, wait_time: u64, ) -> Result<(), TdVmcallError> { - let command = command.as_ptr() as u64; - let response = response.as_mut_ptr() as u64; + let command = command.as_ptr() as u64 | *SHARED_MASK; + let response = response.as_mut_ptr() as u64 | *SHARED_MASK; // Ensure the address is aligned to 4K bytes if (command & 0xfff) != 0 || (response & 0xfff) != 0 {