From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Today there are two separate locations where TDX error codes are defined:
arch/x86/include/asm/tdx.h
arch/x86/kvm/vmx/tdx_errno.h
They have some overlap that is already defined similarly. Reduce the
duplication by unifying the architectural error codes at:
asm/shared/tdx_errno.h
...and update the headers that contained the duplicated definitions to
include the new unified header.
"asm/shared" is used for sharing TDX code between the early compressed
code and the normal kernel code. While the compressed code for the guest
doesn't use these error code header definitions today, it does make the
types of calls that return the values they define. So place the defines in
"shared" location so that it can, but leave such cleanups for future
changes.
[Rick: enhance log]
[Vishal: reduce to a simple move of architectural defines only]
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Reviewed-by: Chao Gao <chao.gao@intel.com>
---
arch/x86/include/asm/shared/tdx.h | 1 +
arch/x86/{kvm/vmx => include/asm/shared}/tdx_errno.h | 7 +++----
arch/x86/kvm/vmx/tdx.h | 1 -
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h
index 8bc074c8d7c6..6a1646fc2b2f 100644
--- a/arch/x86/include/asm/shared/tdx.h
+++ b/arch/x86/include/asm/shared/tdx.h
@@ -4,6 +4,7 @@
#include <linux/bits.h>
#include <linux/types.h>
+#include <asm/shared/tdx_errno.h>
#define TDX_HYPERCALL_STANDARD 0
diff --git a/arch/x86/kvm/vmx/tdx_errno.h b/arch/x86/include/asm/shared/tdx_errno.h
similarity index 92%
rename from arch/x86/kvm/vmx/tdx_errno.h
rename to arch/x86/include/asm/shared/tdx_errno.h
index 6ff4672c4181..3c1e8ce716e3 100644
--- a/arch/x86/kvm/vmx/tdx_errno.h
+++ b/arch/x86/include/asm/shared/tdx_errno.h
@@ -1,8 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* architectural status code for SEAMCALL */
-
-#ifndef __KVM_X86_TDX_ERRNO_H
-#define __KVM_X86_TDX_ERRNO_H
+#ifndef _ASM_X86_SHARED_TDX_ERRNO_H
+#define _ASM_X86_SHARED_TDX_ERRNO_H
#define TDX_SEAMCALL_STATUS_MASK 0xFFFFFFFF00000000ULL
@@ -37,4 +36,4 @@
#define TDX_OPERAND_ID_SEPT 0x92
#define TDX_OPERAND_ID_TD_EPOCH 0xa9
-#endif /* __KVM_X86_TDX_ERRNO_H */
+#endif /* _ASM_X86_SHARED_TDX_ERRNO_H */
diff --git a/arch/x86/kvm/vmx/tdx.h b/arch/x86/kvm/vmx/tdx.h
index b5cd2ffb303e..ac8323a68b16 100644
--- a/arch/x86/kvm/vmx/tdx.h
+++ b/arch/x86/kvm/vmx/tdx.h
@@ -3,7 +3,6 @@
#define __KVM_X86_VMX_TDX_H
#include "tdx_arch.h"
-#include "tdx_errno.h"
#ifdef CONFIG_KVM_INTEL_TDX
#include "common.h"
--
2.53.0
On Thu, Apr 02, 2026, Vishal Verma wrote:
> From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
>
> Today there are two separate locations where TDX error codes are defined:
>
> arch/x86/include/asm/tdx.h
> arch/x86/kvm/vmx/tdx_errno.h
>
> They have some overlap that is already defined similarly. Reduce the
> duplication by unifying the architectural error codes at:
>
> asm/shared/tdx_errno.h
>
> ...and update the headers that contained the duplicated definitions to
> include the new unified header.
>
> "asm/shared" is used for sharing TDX code between the early compressed
> code and the normal kernel code. While the compressed code for the guest
> doesn't use these error code header definitions today, it does make the
> types of calls that return the values they define. So place the defines in
> "shared" location so that it can, but leave such cleanups for future
> changes.
>
> [Rick: enhance log]
> [Vishal: reduce to a simple move of architectural defines only]
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Nit, when calling out minor amendments, IMO the blurb in the square braces should
be after the previous SoB so that there's a clear, consistent chain of handling
and ordering. I.e.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
[Rick: enhance log]
Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
[Vishal: reduce to a simple move of architectural defines only]
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
That makes it clear the Kirill signed off on something, then Rick tweaked the
changelog and signed off on _that_, and Vishal came along and simplified the
path.
Acked-by: Sean Christopherson <seanjc@google.com>
> Reviewed-by: Chao Gao <chao.gao@intel.com>
> ---
> arch/x86/include/asm/shared/tdx.h | 1 +
> arch/x86/{kvm/vmx => include/asm/shared}/tdx_errno.h | 7 +++----
> arch/x86/kvm/vmx/tdx.h | 1 -
> 3 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h
> index 8bc074c8d7c6..6a1646fc2b2f 100644
> --- a/arch/x86/include/asm/shared/tdx.h
> +++ b/arch/x86/include/asm/shared/tdx.h
> @@ -4,6 +4,7 @@
>
> #include <linux/bits.h>
> #include <linux/types.h>
> +#include <asm/shared/tdx_errno.h>
>
> #define TDX_HYPERCALL_STANDARD 0
>
> diff --git a/arch/x86/kvm/vmx/tdx_errno.h b/arch/x86/include/asm/shared/tdx_errno.h
> similarity index 92%
> rename from arch/x86/kvm/vmx/tdx_errno.h
> rename to arch/x86/include/asm/shared/tdx_errno.h
> index 6ff4672c4181..3c1e8ce716e3 100644
> --- a/arch/x86/kvm/vmx/tdx_errno.h
> +++ b/arch/x86/include/asm/shared/tdx_errno.h
> @@ -1,8 +1,7 @@
> /* SPDX-License-Identifier: GPL-2.0 */
> /* architectural status code for SEAMCALL */
> -
> -#ifndef __KVM_X86_TDX_ERRNO_H
> -#define __KVM_X86_TDX_ERRNO_H
> +#ifndef _ASM_X86_SHARED_TDX_ERRNO_H
> +#define _ASM_X86_SHARED_TDX_ERRNO_H
>
> #define TDX_SEAMCALL_STATUS_MASK 0xFFFFFFFF00000000ULL
>
> @@ -37,4 +36,4 @@
> #define TDX_OPERAND_ID_SEPT 0x92
> #define TDX_OPERAND_ID_TD_EPOCH 0xa9
>
> -#endif /* __KVM_X86_TDX_ERRNO_H */
> +#endif /* _ASM_X86_SHARED_TDX_ERRNO_H */
> diff --git a/arch/x86/kvm/vmx/tdx.h b/arch/x86/kvm/vmx/tdx.h
> index b5cd2ffb303e..ac8323a68b16 100644
> --- a/arch/x86/kvm/vmx/tdx.h
> +++ b/arch/x86/kvm/vmx/tdx.h
> @@ -3,7 +3,6 @@
> #define __KVM_X86_VMX_TDX_H
>
> #include "tdx_arch.h"
> -#include "tdx_errno.h"
For the record, the defines in tdx_errno.h are only ever used by arch/x86/kvm/vmx/tdx.c,
and that file already included asm/shared/tdx.h by way of arch/x86/include/asm/tdx.h.
> #ifdef CONFIG_KVM_INTEL_TDX
> #include "common.h"
>
> --
> 2.53.0
>
On Thu, 2026-04-02 at 10:47 -0700, Sean Christopherson wrote: > On Thu, Apr 02, 2026, Vishal Verma wrote: > > From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> > > > > Today there are two separate locations where TDX error codes are defined: > > > > arch/x86/include/asm/tdx.h > > arch/x86/kvm/vmx/tdx_errno.h > > > > They have some overlap that is already defined similarly. Reduce the > > duplication by unifying the architectural error codes at: > > > > asm/shared/tdx_errno.h > > > > ...and update the headers that contained the duplicated definitions to > > include the new unified header. > > > > "asm/shared" is used for sharing TDX code between the early compressed > > code and the normal kernel code. While the compressed code for the guest > > doesn't use these error code header definitions today, it does make the > > types of calls that return the values they define. So place the defines in > > "shared" location so that it can, but leave such cleanups for future > > changes. > > > > [Rick: enhance log] > > [Vishal: reduce to a simple move of architectural defines only] > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> > > Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com> > > Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> > > Nit, when calling out minor amendments, IMO the blurb in the square braces should > be after the previous SoB so that there's a clear, consistent chain of handling > and ordering. I.e. > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> > [Rick: enhance log] > Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com> > [Vishal: reduce to a simple move of architectural defines only] > Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> > > That makes it clear the Kirill signed off on something, then Rick tweaked the > changelog and signed off on _that_, and Vishal came along and simplified the > path. > That is indeed what I'm used to seeing/doing as well, I changed it to this style after re-reading the tag ordering guidelines in maintainer- tip.rst: https://docs.kernel.org/process/maintainer-tip.html#ordering-of-commit-tags If the handler made modifications to the patch or the changelog, then this should be mentioned after the changelog text and above all commit tags in the following format: ... changelog text ends. [ handler: Replaced foo by bar and updated changelog ] First-tag: ..... Although now I see I screwed even that up slightly - it calls for a blank line after the [ ... ] notes.
© 2016 - 2026 Red Hat, Inc.