mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Huang, Kai" <kai.huang@intel.com>
To: lkp <lkp@intel.com>
Cc: "kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"oe-kbuild-all@lists.linux.dev" <oe-kbuild-all@lists.linux.dev>,
	"x86@kernel.org" <x86@kernel.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Subject: Re: [tip:x86/tdx 10/12] arch/x86/coco/tdx/tdx.c:729:32: warning: excess elements in struct initializer
Date: Tue, 12 Sep 2023 23:25:42 +0000	[thread overview]
Message-ID: <796ab6f9815c4fa3e4ea87985acc83b5315e42f2.camel@intel.com> (raw)
In-Reply-To: <202309130740.KtUrIwC5-lkp@intel.com>


Sorry this is due to the v4 Unify TDCALL/SEAMCALL and TDVMCALL assembly patchset
was based on old tip/x86/tdx before 6.6, thus didn't contain changing to those
new patches.

I've sent patches to Dave to fix.

On Wed, 2023-09-13 at 07:14 +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/tdx
> head:   d6cb0f01644c5cd2bc51b88df933e07849cfaa76
> commit: 8cb19d6ef21bbf7e109336f895574ed2a267ea08 [10/12] x86/tdx: Remove 'struct tdx_hypercall_args'
> config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230913/202309130740.KtUrIwC5-lkp@intel.com/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230913/202309130740.KtUrIwC5-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202309130740.KtUrIwC5-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
>    arch/x86/coco/tdx/tdx.c: In function 'tdx_map_gpa':
>    arch/x86/coco/tdx/tdx.c:726:24: error: variable 'args' has initializer but incomplete type
>      726 |                 struct tdx_hypercall_args args = {
>          |                        ^~~~~~~~~~~~~~~~~~
>    arch/x86/coco/tdx/tdx.c:727:26: error: 'struct tdx_hypercall_args' has no member named 'r10'
>      727 |                         .r10 = TDX_HYPERCALL_STANDARD,
>          |                          ^~~
>    In file included from arch/x86/include/asm/tdx.h:11,
>                     from arch/x86/coco/tdx/tdx.c:11:
>    arch/x86/include/asm/shared/tdx.h:8:33: warning: excess elements in struct initializer
>        8 | #define TDX_HYPERCALL_STANDARD  0
>          |                                 ^
>    arch/x86/coco/tdx/tdx.c:727:32: note: in expansion of macro 'TDX_HYPERCALL_STANDARD'
>      727 |                         .r10 = TDX_HYPERCALL_STANDARD,
>          |                                ^~~~~~~~~~~~~~~~~~~~~~
>    arch/x86/include/asm/shared/tdx.h:8:33: note: (near initialization for 'args')
>        8 | #define TDX_HYPERCALL_STANDARD  0
>          |                                 ^
>    arch/x86/coco/tdx/tdx.c:727:32: note: in expansion of macro 'TDX_HYPERCALL_STANDARD'
>      727 |                         .r10 = TDX_HYPERCALL_STANDARD,
>          |                                ^~~~~~~~~~~~~~~~~~~~~~
>    arch/x86/coco/tdx/tdx.c:728:26: error: 'struct tdx_hypercall_args' has no member named 'r11'
>      728 |                         .r11 = TDVMCALL_MAP_GPA,
>          |                          ^~~
>    arch/x86/include/asm/shared/tdx.h:25:41: warning: excess elements in struct initializer
>       25 | #define TDVMCALL_MAP_GPA                0x10001
>          |                                         ^~~~~~~
>    arch/x86/coco/tdx/tdx.c:728:32: note: in expansion of macro 'TDVMCALL_MAP_GPA'
>      728 |                         .r11 = TDVMCALL_MAP_GPA,
>          |                                ^~~~~~~~~~~~~~~~
>    arch/x86/include/asm/shared/tdx.h:25:41: note: (near initialization for 'args')
>       25 | #define TDVMCALL_MAP_GPA                0x10001
>          |                                         ^~~~~~~
>    arch/x86/coco/tdx/tdx.c:728:32: note: in expansion of macro 'TDVMCALL_MAP_GPA'
>      728 |                         .r11 = TDVMCALL_MAP_GPA,
>          |                                ^~~~~~~~~~~~~~~~
>    arch/x86/coco/tdx/tdx.c:729:26: error: 'struct tdx_hypercall_args' has no member named 'r12'
>      729 |                         .r12 = start,
>          |                          ^~~
> > > arch/x86/coco/tdx/tdx.c:729:32: warning: excess elements in struct initializer
>      729 |                         .r12 = start,
>          |                                ^~~~~
>    arch/x86/coco/tdx/tdx.c:729:32: note: (near initialization for 'args')
>    arch/x86/coco/tdx/tdx.c:730:26: error: 'struct tdx_hypercall_args' has no member named 'r13'
>      730 |                         .r13 = end - start };
>          |                          ^~~
>    arch/x86/coco/tdx/tdx.c:730:32: warning: excess elements in struct initializer
>      730 |                         .r13 = end - start };
>          |                                ^~~
>    arch/x86/coco/tdx/tdx.c:730:32: note: (near initialization for 'args')
>    arch/x86/coco/tdx/tdx.c:726:43: error: storage size of 'args' isn't known
>      726 |                 struct tdx_hypercall_args args = {
>          |                                           ^~~~
>    arch/x86/coco/tdx/tdx.c:733:27: error: implicit declaration of function '__tdx_hypercall_ret'; did you mean '__tdx_hypercall'? [-Werror=implicit-function-declaration]
>      733 |                 u64 ret = __tdx_hypercall_ret(&args);
>          |                           ^~~~~~~~~~~~~~~~~~~
>          |                           __tdx_hypercall
> > > arch/x86/coco/tdx/tdx.c:726:43: warning: unused variable 'args' [-Wunused-variable]
>      726 |                 struct tdx_hypercall_args args = {
>          |                                           ^~~~
>    cc1: some warnings being treated as errors
> 
> 
> vim +729 arch/x86/coco/tdx/tdx.c
> 
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  707  
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  708  /*
> 019b383d1132e4 Dexuan Cui         2023-08-10  709   * Notify the VMM about page mapping conversion. More info about ABI
> 019b383d1132e4 Dexuan Cui         2023-08-10  710   * can be found in TDX Guest-Host-Communication Interface (GHCI),
> 019b383d1132e4 Dexuan Cui         2023-08-10  711   * section "TDG.VP.VMCALL<MapGPA>".
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  712   */
> 019b383d1132e4 Dexuan Cui         2023-08-10  713  static bool tdx_map_gpa(phys_addr_t start, phys_addr_t end, bool enc)
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  714  {
> 019b383d1132e4 Dexuan Cui         2023-08-10  715  	/* Retrying the hypercall a second time should succeed; use 3 just in case */
> 019b383d1132e4 Dexuan Cui         2023-08-10  716  	const int max_retries_per_page = 3;
> 019b383d1132e4 Dexuan Cui         2023-08-10  717  	int retry_count = 0;
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  718  
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  719  	if (!enc) {
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  720  		/* Set the shared (decrypted) bits: */
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  721  		start |= cc_mkdec(0);
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  722  		end   |= cc_mkdec(0);
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  723  	}
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  724  
> 019b383d1132e4 Dexuan Cui         2023-08-10  725  	while (retry_count < max_retries_per_page) {
> 019b383d1132e4 Dexuan Cui         2023-08-10 @726  		struct tdx_hypercall_args args = {
> 019b383d1132e4 Dexuan Cui         2023-08-10  727  			.r10 = TDX_HYPERCALL_STANDARD,
> 019b383d1132e4 Dexuan Cui         2023-08-10  728  			.r11 = TDVMCALL_MAP_GPA,
> 019b383d1132e4 Dexuan Cui         2023-08-10 @729  			.r12 = start,
> 019b383d1132e4 Dexuan Cui         2023-08-10  730  			.r13 = end - start };
> 019b383d1132e4 Dexuan Cui         2023-08-10  731  
> 019b383d1132e4 Dexuan Cui         2023-08-10  732  		u64 map_fail_paddr;
> 019b383d1132e4 Dexuan Cui         2023-08-10  733  		u64 ret = __tdx_hypercall_ret(&args);
> 019b383d1132e4 Dexuan Cui         2023-08-10  734  
> 019b383d1132e4 Dexuan Cui         2023-08-10  735  		if (ret != TDVMCALL_STATUS_RETRY)
> 019b383d1132e4 Dexuan Cui         2023-08-10  736  			return !ret;
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  737  		/*
> 019b383d1132e4 Dexuan Cui         2023-08-10  738  		 * The guest must retry the operation for the pages in the
> 019b383d1132e4 Dexuan Cui         2023-08-10  739  		 * region starting at the GPA specified in R11. R11 comes
> 019b383d1132e4 Dexuan Cui         2023-08-10  740  		 * from the untrusted VMM. Sanity check it.
> 7dbde763162989 Kirill A. Shutemov 2022-04-06  741  		 */
> 019b383d1132e4 Dexuan Cui         2023-08-10  742  		map_fail_paddr = args.r11;
> 019b383d1132e4 Dexuan Cui         2023-08-10  743  		if (map_fail_paddr < start || map_fail_paddr >= end)
> 019b383d1132e4 Dexuan Cui         2023-08-10  744  			return false;
> 019b383d1132e4 Dexuan Cui         2023-08-10  745  
> 019b383d1132e4 Dexuan Cui         2023-08-10  746  		/* "Consume" a retry without forward progress */
> 019b383d1132e4 Dexuan Cui         2023-08-10  747  		if (map_fail_paddr == start) {
> 019b383d1132e4 Dexuan Cui         2023-08-10  748  			retry_count++;
> 019b383d1132e4 Dexuan Cui         2023-08-10  749  			continue;
> 019b383d1132e4 Dexuan Cui         2023-08-10  750  		}
> 019b383d1132e4 Dexuan Cui         2023-08-10  751  
> 019b383d1132e4 Dexuan Cui         2023-08-10  752  		start = map_fail_paddr;
> 019b383d1132e4 Dexuan Cui         2023-08-10  753  		retry_count = 0;
> 019b383d1132e4 Dexuan Cui         2023-08-10  754  	}
> 019b383d1132e4 Dexuan Cui         2023-08-10  755  
> 019b383d1132e4 Dexuan Cui         2023-08-10  756  	return false;
> 019b383d1132e4 Dexuan Cui         2023-08-10  757  }
> 019b383d1132e4 Dexuan Cui         2023-08-10  758  
> 
> :::::: The code at line 729 was first introduced by commit
> :::::: 019b383d1132e4051de0d2e43254454b86538cf4 x86/tdx: Retry partially-completed page conversion hypercalls
> 
> :::::: TO: Dexuan Cui <decui@microsoft.com>
> :::::: CC: Dave Hansen <dave.hansen@linux.intel.com>
> 


      reply	other threads:[~2023-09-12 23:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 23:14 kernel test robot
2023-09-12 23:25 ` Huang, Kai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=796ab6f9815c4fa3e4ea87985acc83b5315e42f2.camel@intel.com \
    --to=kai.huang@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®