Use newly introduced TDVMCALL_1() instead of __tdx_hypercall() to issue
MAP_GPA hypercall.

It cuts code bloat substantially:

Function                                     old     new   delta
tdx_enc_status_changed                       352     242    -110
tdx_kexec_finish                             645     530    -115
tdx_enc_status_change_prepare                326     181    -145
Total: Before=5553, After=5183, chg -6.66%

Signed-off-by: Kirill A. Shutemov <kirill.shute...@linux.intel.com>
---
 arch/x86/coco/tdx/tdx.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
index df3e10d899b3..7c874a50a319 100644
--- a/arch/x86/coco/tdx/tdx.c
+++ b/arch/x86/coco/tdx/tdx.c
@@ -797,15 +797,10 @@ static bool tdx_map_gpa(phys_addr_t start, phys_addr_t 
end, bool enc)
        }
 
        while (retry_count < max_retries_per_page) {
-               struct tdx_module_args args = {
-                       .r10 = TDX_HYPERCALL_STANDARD,
-                       .r11 = TDVMCALL_MAP_GPA,
-                       .r12 = start,
-                       .r13 = end - start };
-
-               u64 map_fail_paddr;
-               u64 ret = __tdx_hypercall(&args);
+               u64 map_fail_paddr, ret;
 
+               ret = TDVMCALL_1(TDVMCALL_MAP_GPA,
+                                start, end - start, 0, 0, map_fail_paddr);
                if (ret != TDVMCALL_STATUS_RETRY)
                        return !ret;
                /*
@@ -813,7 +808,6 @@ static bool tdx_map_gpa(phys_addr_t start, phys_addr_t end, 
bool enc)
                 * region starting at the GPA specified in R11. R11 comes
                 * from the untrusted VMM. Sanity check it.
                 */
-               map_fail_paddr = args.r11;
                if (map_fail_paddr < start || map_fail_paddr >= end)
                        return false;
 
-- 
2.43.0


Reply via email to