[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z1bUbfl8vfVvA0zW@intel.com>
Date: Mon, 9 Dec 2024 19:28:45 +0800
From: Chao Gao <chao.gao@...el.com>
To: Binbin Wu <binbin.wu@...ux.intel.com>
CC: <pbonzini@...hat.com>, <seanjc@...gle.com>, <kvm@...r.kernel.org>,
<rick.p.edgecombe@...el.com>, <kai.huang@...el.com>,
<adrian.hunter@...el.com>, <reinette.chatre@...el.com>,
<xiaoyao.li@...el.com>, <tony.lindgren@...ux.intel.com>,
<isaku.yamahata@...el.com>, <yan.y.zhao@...el.com>, <michael.roth@....com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/7] KVM: TDX: Add a place holder for handler of TDX
hypercalls (TDG.VP.VMCALL)
On Sun, Dec 01, 2024 at 11:53:51AM +0800, Binbin Wu wrote:
>From: Isaku Yamahata <isaku.yamahata@...el.com>
>
>Add a place holder and related helper functions for preparation of
>TDG.VP.VMCALL handling.
>
>The TDX module specification defines TDG.VP.VMCALL API (TDVMCALL for short)
>for the guest TD to call hypercall to VMM. When the guest TD issues a
>TDVMCALL, the guest TD exits to VMM with a new exit reason. The arguments
>from the guest TD and returned values from the VMM are passed in the guest
>registers. The guest RCX register indicates which registers are used.
>Define helper functions to access those registers.
>
>A new VMX exit reason TDCALL is added to indicate the exit is due to TDVMCALL
>from the guest TD. Define the TDCALL exit reason and add a place holder to
>handle such exit.
>
>Co-developed-by: Xiaoyao Li <xiaoyao.li@...el.com>
>Signed-off-by: Xiaoyao Li <xiaoyao.li@...el.com>
>Signed-off-by: Sean Christopherson <sean.j.christopherson@...el.com>
>Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
>Co-developed-by: Binbin Wu <binbin.wu@...ux.intel.com>
>Signed-off-by: Binbin Wu <binbin.wu@...ux.intel.com>
Reviewed-by: Chao Gao <chao.gao@...el.com>
>---
>Hypercalls exit to userspace breakout:
>- Update changelog.
>- Drop the unused tdx->tdvmcall. (Chao)
>- Use TDVMCALL_STATUS prefix for TDX call status codes (Binbin)
>---
> arch/x86/include/uapi/asm/vmx.h | 4 ++-
> arch/x86/kvm/vmx/tdx.c | 48 +++++++++++++++++++++++++++++++++
> 2 files changed, 51 insertions(+), 1 deletion(-)
>
>diff --git a/arch/x86/include/uapi/asm/vmx.h b/arch/x86/include/uapi/asm/vmx.h
>index a5faf6d88f1b..6a9f268a2d2c 100644
>--- a/arch/x86/include/uapi/asm/vmx.h
>+++ b/arch/x86/include/uapi/asm/vmx.h
>@@ -92,6 +92,7 @@
> #define EXIT_REASON_TPAUSE 68
> #define EXIT_REASON_BUS_LOCK 74
> #define EXIT_REASON_NOTIFY 75
>+#define EXIT_REASON_TDCALL 77
>
> #define VMX_EXIT_REASONS \
> { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \
>@@ -155,7 +156,8 @@
> { EXIT_REASON_UMWAIT, "UMWAIT" }, \
> { EXIT_REASON_TPAUSE, "TPAUSE" }, \
> { EXIT_REASON_BUS_LOCK, "BUS_LOCK" }, \
>- { EXIT_REASON_NOTIFY, "NOTIFY" }
>+ { EXIT_REASON_NOTIFY, "NOTIFY" }, \
>+ { EXIT_REASON_TDCALL, "TDCALL" }
Side topic:
Strictly speaking, TDCALL vm-exit handling can happen for normal VMs. so, KVM may
need to handle it by injecting #UD. Of course, it is not necessary for this series.
Powered by blists - more mailing lists