linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [intel-tdx:guest-upstream 24/33] arch/x86/mm/mem_encrypt.c:69:13: warning: no previous prototype for function 'mem_encrypt_init'
@ 2022-01-26  3:34 kernel test robot
  2022-01-26 11:59 ` [PATCH] x86/mm: Fix warning on build with X86_MEM_ENCRYPT=y Kirill A. Shutemov
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2022-01-26  3:34 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: llvm, kbuild-all, linux-kernel, Sean Christopherson,
	Kuppuswamy Sathyanarayanan, Andi Kleen, Tony Luck

tree:   https://github.com/intel/tdx.git guest-upstream
head:   5891b2d3ab5941ec7f5fefaa09fdd84a46ec82f5
commit: 0484e85cb3942b81e2b07162a363bda055c762a0 [24/33] x86/mm/cpa: Add support for TDX shared memory
config: x86_64-allmodconfig (https://download.01.org/0day-ci/archive/20220126/202201261113.3P3URW2n-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 997e128e2a78f5a5434fc75997441ae1ee76f8a4)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel/tdx/commit/0484e85cb3942b81e2b07162a363bda055c762a0
        git remote add intel-tdx https://github.com/intel/tdx.git
        git fetch --no-tags intel-tdx guest-upstream
        git checkout 0484e85cb3942b81e2b07162a363bda055c762a0
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/mm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> arch/x86/mm/mem_encrypt.c:69:13: warning: no previous prototype for function 'mem_encrypt_init' [-Wmissing-prototypes]
   void __init mem_encrypt_init(void)
               ^
   arch/x86/mm/mem_encrypt.c:69:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __init mem_encrypt_init(void)
   ^
   static 
   1 warning generated.


vim +/mem_encrypt_init +69 arch/x86/mm/mem_encrypt.c

20f07a044a76ae Kirill A. Shutemov 2021-12-06  67  
20f07a044a76ae Kirill A. Shutemov 2021-12-06  68  /* Architecture __weak replacement functions */
20f07a044a76ae Kirill A. Shutemov 2021-12-06 @69  void __init mem_encrypt_init(void)
20f07a044a76ae Kirill A. Shutemov 2021-12-06  70  {
20f07a044a76ae Kirill A. Shutemov 2021-12-06  71  	if (!cc_platform_has(CC_ATTR_MEM_ENCRYPT))
20f07a044a76ae Kirill A. Shutemov 2021-12-06  72  		return;
20f07a044a76ae Kirill A. Shutemov 2021-12-06  73  
20f07a044a76ae Kirill A. Shutemov 2021-12-06  74  	/* Call into SWIOTLB to update the SWIOTLB DMA buffers */
20f07a044a76ae Kirill A. Shutemov 2021-12-06  75  	swiotlb_update_mem_attributes();
20f07a044a76ae Kirill A. Shutemov 2021-12-06  76  
20f07a044a76ae Kirill A. Shutemov 2021-12-06  77  	print_mem_encrypt_feature_info();
20f07a044a76ae Kirill A. Shutemov 2021-12-06  78  }
20f07a044a76ae Kirill A. Shutemov 2021-12-06  79  

:::::: The code at line 69 was first introduced by commit
:::::: 20f07a044a76aebaaa0603038857229b5c460d69 x86/sev: Move common memory encryption code to mem_encrypt.c

:::::: TO: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
:::::: CC: Borislav Petkov <bp@suse.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] x86/mm: Fix warning on build with X86_MEM_ENCRYPT=y
  2022-01-26  3:34 [intel-tdx:guest-upstream 24/33] arch/x86/mm/mem_encrypt.c:69:13: warning: no previous prototype for function 'mem_encrypt_init' kernel test robot
@ 2022-01-26 11:59 ` Kirill A. Shutemov
  2022-01-26 18:57   ` David Rientjes
  0 siblings, 1 reply; 3+ messages in thread
From: Kirill A. Shutemov @ 2022-01-26 11:59 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen
  Cc: x86, thomas.lendacky, lkp, ak, kbuild-all, linux-kernel,
	sathyanarayanan.kuppuswamy, tony.luck, Kirill A. Shutemov

So far, AMD_MEM_ENCRYPT is the only user of X86_MEM_ENCRYPT. TDX will be
the second. It will make mem_encrypt.c build without AMD_MEM_ENCRYPT,
which triggers a warning:

arch/x86/mm/mem_encrypt.c:69:13: warning: no previous prototype for
	function 'mem_encrypt_init' [-Wmissing-prototypes]

Fix it by moving mem_encrypt_init() declaration outside of #ifdef
CONFIG_AMD_MEM_ENCRYPT.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Fixes: 20f07a044a76 ("x86/sev: Move common memory encryption code to mem_encrypt.c")
---
 arch/x86/include/asm/mem_encrypt.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h
index e2c6f433ed10..88ceaf3648b3 100644
--- a/arch/x86/include/asm/mem_encrypt.h
+++ b/arch/x86/include/asm/mem_encrypt.h
@@ -49,9 +49,6 @@ void __init early_set_mem_enc_dec_hypercall(unsigned long vaddr, int npages,
 
 void __init mem_encrypt_free_decrypted_mem(void);
 
-/* Architecture __weak replacement functions */
-void __init mem_encrypt_init(void);
-
 void __init sev_es_init_vc_handling(void);
 
 #define __bss_decrypted __section(".bss..decrypted")
@@ -89,6 +86,9 @@ static inline void mem_encrypt_free_decrypted_mem(void) { }
 
 #endif	/* CONFIG_AMD_MEM_ENCRYPT */
 
+/* Architecture __weak replacement functions */
+void __init mem_encrypt_init(void);
+
 /*
  * The __sme_pa() and __sme_pa_nodebug() macros are meant for use when
  * writing to or comparing values from the cr3 register.  Having the
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/mm: Fix warning on build with X86_MEM_ENCRYPT=y
  2022-01-26 11:59 ` [PATCH] x86/mm: Fix warning on build with X86_MEM_ENCRYPT=y Kirill A. Shutemov
@ 2022-01-26 18:57   ` David Rientjes
  0 siblings, 0 replies; 3+ messages in thread
From: David Rientjes @ 2022-01-26 18:57 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: tglx, mingo, bp, dave.hansen, x86, thomas.lendacky, lkp, ak,
	kbuild-all, linux-kernel, sathyanarayanan.kuppuswamy, tony.luck

On Wed, 26 Jan 2022, Kirill A. Shutemov wrote:

> So far, AMD_MEM_ENCRYPT is the only user of X86_MEM_ENCRYPT. TDX will be
> the second. It will make mem_encrypt.c build without AMD_MEM_ENCRYPT,
> which triggers a warning:
> 
> arch/x86/mm/mem_encrypt.c:69:13: warning: no previous prototype for
> 	function 'mem_encrypt_init' [-Wmissing-prototypes]
> 
> Fix it by moving mem_encrypt_init() declaration outside of #ifdef
> CONFIG_AMD_MEM_ENCRYPT.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Fixes: 20f07a044a76 ("x86/sev: Move common memory encryption code to mem_encrypt.c")

Acked-by: David Rientjes <rientjes@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-26 18:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26  3:34 [intel-tdx:guest-upstream 24/33] arch/x86/mm/mem_encrypt.c:69:13: warning: no previous prototype for function 'mem_encrypt_init' kernel test robot
2022-01-26 11:59 ` [PATCH] x86/mm: Fix warning on build with X86_MEM_ENCRYPT=y Kirill A. Shutemov
2022-01-26 18:57   ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).