Skip to contentSkip to conversation

x86/tdx: Explicitly include <linux/errno.h> in <asm/tdx.h>

PATCH In review Kai Huang 3 participants 6 messages Jun 6, 2023

Subsystems (2)
lore
Share & tools
lore

Kai Huang

author
#0 lore raw

PATCH 1/1 x86/tdx: Explicitly include <linux/errno.h> in <asm/tdx.h>

Currently, in <asm/tdx.h> tdx_kvm_hypercall() simply returns -ENODEV when TDX guest isn't enabled in the Kconfig w/o having <linux/errno.h> header explicitly included. Although the current code doesn't have build error, in general it is a good practice to explicitly include the header to make sure any future patch which uses <asm/tdx.h> won't get build error due to error code not being defined.

Fixes cfb8ec7a31f2 ("x86/tdx: Wire up KVM hypercalls")
Cc Kuppuswamy Sathyanarayanan <[email protected]>
Cc Kirill A. Shutemov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Isaku Yamahata <[email protected]>
---
 arch/x86/include/asm/tdx.h | 1 +
 1 file changed, 1 insertion(+)
arch/x86/include/asm/tdx.h +1 -0
index 28d889c9aa16..0f303c9abee8 100644
@@ -5,6 +5,7 @@
 
 #include <linux/init.h>
 #include <linux/bits.h>
+#include <linux/errno.h>
 #include <asm/ptrace.h>
 #include <asm/shared/tdx.h>
 

base-commit: 122333d6bd229af279cdb35d1b874b71b3b9ccfb

Signature · 1 line
2.40.1
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Kai Huang

Currently, in <asm/tdx.h> tdx_kvm_hypercall() simply returns -ENODEV when TDX guest isn't enabled in the Kconfig w/o having <linux/errno.h> header explicitly included. Although the current code doesn't have build error, in general it is a good practice to explicitly include the header to make sure any future patch which uses <asm/tdx.h> won't get build error due to error code not being defined.

Quoted 7 lines
Fixes cfb8ec7a31f2 ("x86/tdx: Wire up KVM hypercalls")
Cc Kuppuswamy Sathyanarayanan <[email protected]>
Cc Kirill A. Shutemov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Isaku Yamahata <[email protected]>
Signature · 1 line
  Kiryl Shutsemau / Kirill A. Shutemov
Reviewed-by on v1 1/1
#2 lore raw
In reply to Kai Huang
Quoted 2 lines · Kai Huang

Currently, in <asm/tdx.h> tdx_kvm_hypercall() simply returns -ENODEV when TDX guest isn't enabled in the Kconfig w/o having <linux/errno.h>

Maybe you can explicitly say "CONFIG_INTEL_TDX_GUEST is not enabled"

Quoted 4 lines

header explicitly included. Although the current code doesn't have build error, in general it is a good practice to explicitly include the header to make sure any future patch which uses <asm/tdx.h> won't get build error due to error code not being defined.

Otherwise, it looks fine.

Quoted 26 lines
Fixes cfb8ec7a31f2 ("x86/tdx: Wire up KVM hypercalls")
Cc Kuppuswamy Sathyanarayanan <[email protected]>
Cc Kirill A. Shutemov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Isaku Yamahata <[email protected]>
---
 arch/x86/include/asm/tdx.h | 1 +
 1 file changed, 1 insertion(+)
arch/x86/include/asm/tdx.h +1 -0
index 28d889c9aa16..0f303c9abee8 100644
@@ -5,6 +5,7 @@
 
 #include <linux/init.h>
 #include <linux/bits.h>
+#include <linux/errno.h>
 #include <asm/ptrace.h>
 #include <asm/shared/tdx.h>
 

base-commit: 122333d6bd229af279cdb35d1b874b71b3b9ccfb

Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
author
#3 lore raw
Quoted 6 lines · Sathyanarayanan Kuppuswamy
Quoted 2 lines · Kai Huang

Currently, in <asm/tdx.h> tdx_kvm_hypercall() simply returns -ENODEV when TDX guest isn't enabled in the Kconfig w/o having <linux/errno.h>

Maybe you can explicitly say "CONFIG_INTEL_TDX_GUEST is not enabled"

It also can be disabled by !CONFIG_KVM_GUEST.

#4 lore raw
Quoted 9 lines · Kai
Quoted 6 lines · Sathyanarayanan Kuppuswamy
Quoted 2 lines · Kai Huang

Currently, in <asm/tdx.h> tdx_kvm_hypercall() simply returns -ENODEV when TDX guest isn't enabled in the Kconfig w/o having <linux/errno.h>

Maybe you can explicitly say "CONFIG_INTEL_TDX_GUEST is not enabled"

It also can be disabled by !CONFIG_KVM_GUEST.

Borislav has already fixed it during unaccepted memory patchset application. He used <asm/errno.h>, not <linux/errno.h>.

See [1] and [2].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=75d090fd167acab4d7eda7e2b65729e877c0fd64
[2] https://lore.kernel.org/all/20230606161606.GDZH9bxhrGnFkaLl2A@fat_crate.local

Signature · 1 line
  Kiryl Shutsemau / Kirill A. Shutemov
author
#5 lore raw
Quoted 11 lines · Kirill A. Shutemov
Quoted 9 lines · Kai
Quoted 6 lines · Sathyanarayanan Kuppuswamy
Quoted 2 lines · Kai Huang

Currently, in <asm/tdx.h> tdx_kvm_hypercall() simply returns -ENODEV when TDX guest isn't enabled in the Kconfig w/o having <linux/errno.h>

Maybe you can explicitly say "CONFIG_INTEL_TDX_GUEST is not enabled"

It also can be disabled by !CONFIG_KVM_GUEST.

Quoted 8 lines

Borislav has already fixed it during unaccepted memory patchset application. He used <asm/errno.h>, not <linux/errno.h>.

See [1] and [2].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=75d090fd167acab4d7eda7e2b65729e877c0fd64
[2] https://lore.kernel.org/all/20230606161606.GDZH9bxhrGnFkaLl2A@fat_crate.local

Wonderful, then we can drop this one :)