Message ID | ae0b961d80ab90e43c6eff4a675e00ff80ab3b9f.1708933498.git.isaku.yamahata@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v19,001/130] x86/virt/tdx: Rename _offset to _member for TD_SYSINFO_MAP() macro | expand |
On Mon, Feb 26, 2024 at 12:25:30AM -0800, isaku.yamahata@intel.com wrote: > diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h > index fdfd41511b02..28c4a62b7dba 100644 > --- a/arch/x86/include/asm/shared/tdx.h > +++ b/arch/x86/include/asm/shared/tdx.h > @@ -26,7 +26,13 @@ > #define TDVMCALL_GET_QUOTE 0x10002 > #define TDVMCALL_REPORT_FATAL_ERROR 0x10003 > > -#define TDVMCALL_STATUS_RETRY 1 Oops, I accidentally removed this constant to break tdx guest build. diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h index ef1c8e5a2944..1367a5941499 100644 --- a/arch/x86/include/asm/shared/tdx.h +++ b/arch/x86/include/asm/shared/tdx.h @@ -28,6 +28,8 @@ #define TDVMCALL_REPORT_FATAL_ERROR 0x10003 #define TDVMCALL_SETUP_EVENT_NOTIFY_INTERRUPT 0x10004 +#define TDVMCALL_STATUS_RETRY 1 + /* * TDG.VP.VMCALL Status Codes (returned in R10) */
On 2/27/2024 3:27 AM, Isaku Yamahata wrote: > On Mon, Feb 26, 2024 at 12:25:30AM -0800, > isaku.yamahata@intel.com wrote: > >> diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h >> index fdfd41511b02..28c4a62b7dba 100644 >> --- a/arch/x86/include/asm/shared/tdx.h >> +++ b/arch/x86/include/asm/shared/tdx.h >> @@ -26,7 +26,13 @@ >> #define TDVMCALL_GET_QUOTE 0x10002 >> #define TDVMCALL_REPORT_FATAL_ERROR 0x10003 >> >> -#define TDVMCALL_STATUS_RETRY 1 > Oops, I accidentally removed this constant to break tdx guest build. Is this the same as "TDVMCALL_RETRY" added in the patch? Since both tdx guest code and VMM share the same header file, maybe it needs another patch to change the code in guest or you just follow the naming style of the exist code? > > diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h > index ef1c8e5a2944..1367a5941499 100644 > --- a/arch/x86/include/asm/shared/tdx.h > +++ b/arch/x86/include/asm/shared/tdx.h > @@ -28,6 +28,8 @@ > #define TDVMCALL_REPORT_FATAL_ERROR 0x10003 > #define TDVMCALL_SETUP_EVENT_NOTIFY_INTERRUPT 0x10004 > > +#define TDVMCALL_STATUS_RETRY 1 > + > /* > * TDG.VP.VMCALL Status Codes (returned in R10) > */
On Thu, Mar 14, 2024 at 03:45:49PM +0800, Binbin Wu <binbin.wu@linux.intel.com> wrote: > > > On 2/27/2024 3:27 AM, Isaku Yamahata wrote: > > On Mon, Feb 26, 2024 at 12:25:30AM -0800, > > isaku.yamahata@intel.com wrote: > > > > > diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h > > > index fdfd41511b02..28c4a62b7dba 100644 > > > --- a/arch/x86/include/asm/shared/tdx.h > > > +++ b/arch/x86/include/asm/shared/tdx.h > > > @@ -26,7 +26,13 @@ > > > #define TDVMCALL_GET_QUOTE 0x10002 > > > #define TDVMCALL_REPORT_FATAL_ERROR 0x10003 > > > -#define TDVMCALL_STATUS_RETRY 1 > > Oops, I accidentally removed this constant to break tdx guest build. > > Is this the same as "TDVMCALL_RETRY" added in the patch? Since both tdx > guest code and VMM share the same header file, maybe it needs another patch > to change the code in guest or you just follow the naming style of the exist > code? The style in other TDX place is without STATUS. I don't want to play bike shedding. For now I'd like to leave TDVMCALL_STATUS_RETRY, not add TDVMCALL_RETRY, and keep other TDVMCALL_*.
diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h index fdfd41511b02..28c4a62b7dba 100644 --- a/arch/x86/include/asm/shared/tdx.h +++ b/arch/x86/include/asm/shared/tdx.h @@ -26,7 +26,13 @@ #define TDVMCALL_GET_QUOTE 0x10002 #define TDVMCALL_REPORT_FATAL_ERROR 0x10003 -#define TDVMCALL_STATUS_RETRY 1 +/* + * TDG.VP.VMCALL Status Codes (returned in R10) + */ +#define TDVMCALL_SUCCESS 0x0000000000000000ULL +#define TDVMCALL_RETRY 0x0000000000000001ULL +#define TDVMCALL_INVALID_OPERAND 0x8000000000000000ULL +#define TDVMCALL_TDREPORT_FAILED 0x8000000000000001ULL /* * Bitmasks of exposed registers (with VMM). diff --git a/arch/x86/kvm/vmx/tdx_errno.h b/arch/x86/kvm/vmx/tdx_errno.h new file mode 100644 index 000000000000..5366bf476d2c --- /dev/null +++ b/arch/x86/kvm/vmx/tdx_errno.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* architectural status code for SEAMCALL */ + +#ifndef __KVM_X86_TDX_ERRNO_H +#define __KVM_X86_TDX_ERRNO_H + +#define TDX_SEAMCALL_STATUS_MASK 0xFFFFFFFF00000000ULL + +/* + * TDX SEAMCALL Status Codes (returned in RAX) + */ +#define TDX_NON_RECOVERABLE_VCPU 0x4000000100000000ULL +#define TDX_INTERRUPTED_RESUMABLE 0x8000000300000000ULL +#define TDX_OPERAND_INVALID 0xC000010000000000ULL +#define TDX_OPERAND_BUSY 0x8000020000000000ULL +#define TDX_PREVIOUS_TLB_EPOCH_BUSY 0x8000020100000000ULL +#define TDX_VCPU_NOT_ASSOCIATED 0x8000070200000000ULL +#define TDX_KEY_GENERATION_FAILED 0x8000080000000000ULL +#define TDX_KEY_STATE_INCORRECT 0xC000081100000000ULL +#define TDX_KEY_CONFIGURED 0x0000081500000000ULL +#define TDX_NO_HKID_READY_TO_WBCACHE 0x0000082100000000ULL +#define TDX_FLUSHVP_NOT_DONE 0x8000082400000000ULL +#define TDX_EPT_ENTRY_STATE_INCORRECT 0xC0000B0D00000000ULL + +/* + * TDX module operand ID, appears in 31:0 part of error code as + * detail information + */ +#define TDX_OPERAND_ID_RCX 0x01 +#define TDX_OPERAND_ID_TDR 0x80 +#define TDX_OPERAND_ID_SEPT 0x92 +#define TDX_OPERAND_ID_TD_EPOCH 0xa9 + +#endif /* __KVM_X86_TDX_ERRNO_H */