Re: [PATCH] x86/tdx: Explicitly include <linux/errno.h> in <asm/tdx.h>

From: Sathyanarayanan Kuppuswamy
Date: Tue Jun 06 2023 - 09:17:55 EST




On 6/5/23 8:40 PM, Kai Huang wrote:
> 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"


> 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.

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>

>
> Fixes: cfb8ec7a31f2 ("x86/tdx: Wire up KVM hypercalls")
> Suggested-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>
> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> Cc: Isaku Yamahata <isaku.yamahata@xxxxxxxxx>
> Signed-off-by: Kai Huang <kai.huang@xxxxxxxxx>
> ---
> arch/x86/include/asm/tdx.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h
> index 28d889c9aa16..0f303c9abee8 100644
> --- a/arch/x86/include/asm/tdx.h
> +++ b/arch/x86/include/asm/tdx.h
> @@ -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

--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer