diff mbox series

[v2,1/4] KVM: TDX: Fix definition of tdx_guest_nr_guest_keyids()

Message ID 20250318-vverma7-cleanup_x86_ops-v2-1-701e82d6b779@intel.com (mailing list archive)
State New
Headers show
Series KVM: TDX: Cleanup the kvm_x86_ops structure for vmx/tdx | expand

Commit Message

Verma, Vishal L March 18, 2025, 6:35 a.m. UTC
When CONFIG_INTEL_TDX_HOST=n, the above definition produced an
unused-function warning with gcc.

  error: ‘tdx_get_nr_guest_keyids’ defined but not used [-Werror=unused-function]
    198 | static u32 tdx_get_nr_guest_keyids(void) { return 0; }
        |            ^~~~~~~~~~~~~~~~~~~~~~~

Make the definition 'inline' so that in the config disabled case, the
whole thing can be optimized away.

Cc: Sean Christopherson <seanjc@google.com>
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 arch/x86/include/asm/tdx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Edgecombe, Rick P March 18, 2025, 3:33 p.m. UTC | #1
On Tue, 2025-03-18 at 00:35 -0600, Vishal Verma wrote:
> When CONFIG_INTEL_TDX_HOST=n, the above definition produced an
> unused-function warning with gcc.
> 
>   error: ‘tdx_get_nr_guest_keyids’ defined but not used [-Werror=unused-function]
>     198 | static u32 tdx_get_nr_guest_keyids(void) { return 0; }
>         |            ^~~~~~~~~~~~~~~~~~~~~~~
> 
> Make the definition 'inline' so that in the config disabled case, the
> whole thing can be optimized away.

This looks to be fixed in the current kvm-coco-queue. Can you double check?

> 
> Cc: Sean Christopherson <seanjc@google.com>
> Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
>  arch/x86/include/asm/tdx.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h
> index e6b003fe7f5e..fbc22bf39cfd 100644
> --- a/arch/x86/include/asm/tdx.h
> +++ b/arch/x86/include/asm/tdx.h
> @@ -195,7 +195,7 @@ u64 tdh_phymem_page_wbinvd_hkid(u64 hkid, struct page *page);
>  static inline void tdx_init(void) { }
>  static inline int tdx_cpu_enable(void) { return -ENODEV; }
>  static inline int tdx_enable(void)  { return -ENODEV; }
> -static u32 tdx_get_nr_guest_keyids(void) { return 0; }
> +static inline u32 tdx_get_nr_guest_keyids(void) { return 0; }
>  static inline const char *tdx_dump_mce_info(struct mce *m) { return NULL; }
>  static inline const struct tdx_sys_info *tdx_get_sysinfo(void) { return NULL; }
>  #endif	/* CONFIG_INTEL_TDX_HOST */
>
Verma, Vishal L March 18, 2025, 4:31 p.m. UTC | #2
On Tue, 2025-03-18 at 15:33 +0000, Edgecombe, Rick P wrote:
> On Tue, 2025-03-18 at 00:35 -0600, Vishal Verma wrote:
> > When CONFIG_INTEL_TDX_HOST=n, the above definition produced an
> > unused-function warning with gcc.
> > 
> >   error: ‘tdx_get_nr_guest_keyids’ defined but not used [-
> > Werror=unused-function]
> >     198 | static u32 tdx_get_nr_guest_keyids(void) { return 0; }
> >         |            ^~~~~~~~~~~~~~~~~~~~~~~
> > 
> > Make the definition 'inline' so that in the config disabled case,
> > the
> > whole thing can be optimized away.
> 
> This looks to be fixed in the current kvm-coco-queue. Can you double
> check?
> 
> 
Indeed it is, I will drop it for the next revision.
diff mbox series

Patch

diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h
index e6b003fe7f5e..fbc22bf39cfd 100644
--- a/arch/x86/include/asm/tdx.h
+++ b/arch/x86/include/asm/tdx.h
@@ -195,7 +195,7 @@  u64 tdh_phymem_page_wbinvd_hkid(u64 hkid, struct page *page);
 static inline void tdx_init(void) { }
 static inline int tdx_cpu_enable(void) { return -ENODEV; }
 static inline int tdx_enable(void)  { return -ENODEV; }
-static u32 tdx_get_nr_guest_keyids(void) { return 0; }
+static inline u32 tdx_get_nr_guest_keyids(void) { return 0; }
 static inline const char *tdx_dump_mce_info(struct mce *m) { return NULL; }
 static inline const struct tdx_sys_info *tdx_get_sysinfo(void) { return NULL; }
 #endif	/* CONFIG_INTEL_TDX_HOST */