[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240517141938.4177174-19-kirill.shutemov@linux.intel.com>
Date: Fri, 17 May 2024 17:19:36 +0300
From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>,
Dexuan Cui <decui@...rosoft.com>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Peter Zijlstra <peterz@...radead.org>
Cc: linux-coco@...ts.linux.dev,
linux-kernel@...r.kernel.org,
linux-hyperv@...r.kernel.org,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: [PATCH 18/20] x86/tdx: Convert VP_VEINFO_GET tdcall to use new TDCALL_5() macro
Use newly introduced TDCALL_5() instead of tdcall() to issue
VP_VEINFO_GET tdcall.
It cuts code bloat substantially:
Function old new delta
tdx_get_ve_info 253 116 -137
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
---
arch/x86/coco/tdx/tdx.c | 31 +++++++------------------------
1 file changed, 7 insertions(+), 24 deletions(-)
diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
index 6559f3842f67..42436a43bb49 100644
--- a/arch/x86/coco/tdx/tdx.c
+++ b/arch/x86/coco/tdx/tdx.c
@@ -615,32 +615,15 @@ __init bool tdx_early_handle_ve(struct pt_regs *regs)
void tdx_get_ve_info(struct ve_info *ve)
{
- struct tdx_module_args args = {};
+ u64 instr_info, ret;
- /*
- * Called during #VE handling to retrieve the #VE info from the
- * TDX module.
- *
- * This has to be called early in #VE handling. A "nested" #VE which
- * occurs before this will raise a #DF and is not recoverable.
- *
- * The call retrieves the #VE info from the TDX module, which also
- * clears the "#VE valid" flag. This must be done before anything else
- * because any #VE that occurs while the valid flag is set will lead to
- * #DF.
- *
- * Note, the TDX module treats virtual NMIs as inhibited if the #VE
- * valid flag is set. It means that NMI=>#VE will not result in a #DF.
- */
- tdcall(TDG_VP_VEINFO_GET, &args);
+ ret = TDCALL_5(TDG_VP_VEINFO_GET, 0, 0, 0, 0,
+ ve->exit_reason, ve->exit_qual, ve->gla, ve->gpa, instr_info);
- /* Transfer the output parameters */
- ve->exit_reason = args.rcx;
- ve->exit_qual = args.rdx;
- ve->gla = args.r8;
- ve->gpa = args.r9;
- ve->instr_len = lower_32_bits(args.r10);
- ve->instr_info = upper_32_bits(args.r10);
+ BUG_ON(ret);
+
+ ve->instr_len = lower_32_bits(instr_info);
+ ve->instr_info = upper_32_bits(instr_info);
}
/*
--
2.43.0
Powered by blists - more mailing lists