[intel-tdx:kvm 91/94] arch/x86/kvm/boot/seam/tdx.c:1002:3: error: 'ret' undeclared; did you mean 'net'?

From: kernel test robot
Date: Sat Jul 03 2021 - 02:26:16 EST


tree: https://github.com/intel/tdx.git kvm
head: a9119ab747d6880e39258627c6b6c693b803f794
commit: d58bccc5f7a06949bed29e658b65ce3e212d3a03 [91/94] KVM: TDX: Support VM-preserving TDX module update
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/intel/tdx/commit/d58bccc5f7a06949bed29e658b65ce3e212d3a03
git remote add intel-tdx https://github.com/intel/tdx.git
git fetch --no-tags intel-tdx kvm
git checkout d58bccc5f7a06949bed29e658b65ce3e212d3a03
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

arch/x86/kvm/boot/seam/tdx.c: In function 'tdx_seam_init':
>> arch/x86/kvm/boot/seam/tdx.c:1002:3: error: 'ret' undeclared (first use in this function); did you mean 'net'?
1002 | ret = seam_load_module(seamldr.data, seamldr.size, NULL);
| ^~~
| net
arch/x86/kvm/boot/seam/tdx.c:1002:3: note: each undeclared identifier is reported only once for each function it appears in
>> arch/x86/kvm/boot/seam/tdx.c:1002:9: error: too many arguments to function 'seam_load_module'
1002 | ret = seam_load_module(seamldr.data, seamldr.size, NULL);
| ^~~~~~~~~~~~~~~~
In file included from arch/x86/kvm/boot/seam/tdx.c:12:
arch/x86/include/asm/kvm_boot.h:13:12: note: declared here
13 | int __init seam_load_module(void *seamldr, unsigned long seamldr_size);
| ^~~~~~~~~~~~~~~~
>> arch/x86/kvm/boot/seam/tdx.c:1043:3: error: 'use_p_seamldr' undeclared (first use in this function)
1043 | use_p_seamldr = true;
| ^~~~~~~~~~~~~
>> arch/x86/kvm/boot/seam/tdx.c:1060:2: error: 'params' undeclared (first use in this function); did you mean 'parameq'?
1060 | params = init_seamldr_params(module.data, module.size,
| ^~~~~~
| parameq
arch/x86/kvm/boot/seam/tdx.c:1065:8: error: too many arguments to function 'seam_load_module'
1065 | ret = seam_load_module(seamldr.data, seamldr.size, params);
| ^~~~~~~~~~~~~~~~
In file included from arch/x86/kvm/boot/seam/tdx.c:12:
arch/x86/include/asm/kvm_boot.h:13:12: note: declared here
13 | int __init seam_load_module(void *seamldr, unsigned long seamldr_size);
| ^~~~~~~~~~~~~~~~
>> arch/x86/kvm/boot/seam/tdx.c:1044:3: error: label 'init_seam' used but not defined
1044 | goto init_seam;
| ^~~~
arch/x86/kvm/boot/seam/tdx.c: In function 'tdx_init':
arch/x86/kvm/boot/seam/tdx.c:1326:6: error: 'use_p_seamldr' undeclared (first use in this function)
1326 | if (use_p_seamldr) {
| ^~~~~~~~~~~~~


vim +1002 arch/x86/kvm/boot/seam/tdx.c

972
973 void __init tdx_seam_init(void)
974 {
975 const char *np_seamldr_name = "intel-seam/np-seamldr.acm";
976 struct cpio_data module, sigstruct, seamldr;
977 unsigned long vmcs;
978
979 if (cmdline_find_option_bool(boot_command_line, "disable_tdx"))
980 return;
981
982 /*
983 * Don't load/configure SEAM if not all CPUs can be brought up during
984 * smp_init(), TDX must execute TDH_SYS_LP_INIT on all logical processors.
985 */
986 if (!tdx_all_cpus_available())
987 goto error;
988
989 if (!tdx_get_firmware(&seamldr, np_seamldr_name)) {
990 pr_err("no np-seamldr found\n");
991 goto error;
992 }
993
994 /* Try NP-SEAMLDR first */
995 if (is_np_seamldr_supported()) {
996 if (!tdx_get_firmware(&seamldr, tdx_npseamldr_name)) {
997 pr_err("Cannot found np-seamldr:%s falls back to old seamldr\n",
998 tdx_npseamldr_name);
999 goto fallback;
1000 }
1001
> 1002 ret = seam_load_module(seamldr.data, seamldr.size, NULL);
1003 if (ret) {
1004 pr_err("Failed to launch seamldr %d\n", ret);
1005 goto error;
1006 }
1007
1008 vmcs = (unsigned long)memblock_alloc(PAGE_SIZE, PAGE_SIZE);
1009 if (!vmcs) {
1010 pr_err("Failed to alloc vmcs\n");
1011 goto error;
1012 }
1013
1014 ret = tdx_init_vmxon_vmcs((void *)vmcs);
1015 if (ret) {
1016 pr_err("Failed to init vmcs\n");
1017 memblock_free(__pa(vmcs), PAGE_SIZE);
1018 goto error;
1019 }
1020
1021 cpu_vmxon(__pa(vmcs));
1022
1023 ret = seamldr_info(__pa(&p_seamldr_info));
1024
1025 cpu_vmxoff();
1026 memblock_free(__pa(vmcs), PAGE_SIZE);
1027
1028 if (ret) {
1029 pr_err("Failed to get seamldr info %d\n", ret);
1030 goto error;
1031 }
1032 pr_info("TDX P-SEAMLDR: "
1033 "attributes 0x%0x vendor_id 0x%x "
1034 "build_date %d build_num 0x%x "
1035 "minor_version 0x%x major_version 0x%x.\n",
1036 p_seamldr_info.attributes,
1037 p_seamldr_info.vendor_id,
1038 p_seamldr_info.build_date,
1039 p_seamldr_info.build_num,
1040 p_seamldr_info.minor_version,
1041 p_seamldr_info.major_version);
1042
> 1043 use_p_seamldr = true;
> 1044 goto init_seam;
1045 }
1046
1047 fallback:
1048 pr_info("np-seamldr isn't supported. Fall back to the old loading method\n");
1049
1050 if (!tdx_get_firmware(&module, tdx_module_name))
1051 goto error;
1052
1053 /* Use the kernel's fake SEAMLDR when running as a VM. */
1054 if (!tdx_get_firmware(&sigstruct, tdx_sigstruct_name))
1055 goto error;
1056
1057 if (!tdx_get_firmware(&seamldr, tdx_seamldr_name))
1058 goto error;
1059
> 1060 params = init_seamldr_params(module.data, module.size,
1061 sigstruct.data, sigstruct.size);
1062 if (IS_ERR(params))
1063 goto error;
1064
1065 ret = seam_load_module(seamldr.data, seamldr.size, params);
1066
1067 free_seamldr_params(params);
1068 if (ret)
1069 goto error;
1070
1071 pr_info("TDX P-SEAMLDR: "
1072 "attributes 0x%0x vendor_id 0x%x "
1073 "build_date %d build_num 0x%x "
1074 "minor_version 0x%x major_version 0x%x.\n",
1075 p_seamldr_info.attributes,
1076 p_seamldr_info.vendor_id,
1077 p_seamldr_info.build_date,
1078 p_seamldr_info.build_num,
1079 p_seamldr_info.minor_version,
1080 p_seamldr_info.major_version);
1081
1082 if (build_tdsysinfo_and_cmrs_from_e820() || construct_tdmrs())
1083 goto error;
1084
1085 setup_force_cpu_cap(X86_FEATURE_TDX);
1086 pr_info("tdx module successfully initialized.\n");
1087 return;
1088
1089 error:
1090 pr_err("can't load/init TDX module. disabling TDX feature.\n");
1091 setup_clear_cpu_cap(X86_FEATURE_TDX);
1092 }
1093

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

Attachment: .config.gz
Description: application/gzip