Hi Anirudh, kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master] [also build test ERROR on v6.18-rc5] [cannot apply to next-20251114] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Anirudh-Rayabharam/Drivers-hv-ioctl-for-self-targeted-passthrough-hvcalls/20251114-182039 base: linus/master patch link: https://lore.kernel.org/r/20251114095853.3482596-1-anirudh%40anirudhrb.com patch subject: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls config: x86_64-buildonly-randconfig-005-20251116 (https://download.01.org/0day-ci/archive/20251116/[email protected]/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251116/[email protected]/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 <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ All errors (new ones prefixed by >>): >> drivers/hv/mshv_root_main.c:125:2: error: use of undeclared identifier >> 'HVCALL_GET_PARTITION_PROPERTY_EX' 125 | HVCALL_GET_PARTITION_PROPERTY_EX, | ^ >> drivers/hv/mshv_root_main.c:175:18: error: invalid application of 'sizeof' >> to an incomplete type 'u16[]' (aka 'unsigned short[]') 175 | for (i = 0; i < ARRAY_SIZE(mshv_passthru_hvcalls); ++i) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~ drivers/hv/mshv_root_main.c:179:11: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]') 179 | if (i >= ARRAY_SIZE(mshv_passthru_hvcalls)) | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^ include/linux/compiler.h:55:47: note: expanded from macro 'if' 55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:57:52: note: expanded from macro '__trace_if_var' 57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) | ^~~~ drivers/hv/mshv_root_main.c:179:11: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]') 179 | if (i >= ARRAY_SIZE(mshv_passthru_hvcalls)) | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^ include/linux/compiler.h:55:47: note: expanded from macro 'if' 55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:57:61: note: expanded from macro '__trace_if_var' 57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) | ^~~~ drivers/hv/mshv_root_main.c:179:11: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]') 179 | if (i >= ARRAY_SIZE(mshv_passthru_hvcalls)) | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^ include/linux/compiler.h:55:47: note: expanded from macro 'if' 55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:57:86: note: expanded from macro '__trace_if_var' 57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) | ~~~~~~~~~~~~~~~~~^~~~~ include/linux/compiler.h:68:3: note: expanded from macro '__trace_if_value' 68 | (cond) ? \ | ^~~~ 5 errors generated. vim +/HVCALL_GET_PARTITION_PROPERTY_EX +125 drivers/hv/mshv_root_main.c 117 118 /* 119 * Only allow hypercalls that have a u64 partition id as the first member of 120 * the input structure. 121 * These are sorted by value. 122 */ 123 static u16 mshv_passthru_hvcalls[] = { 124 HVCALL_GET_PARTITION_PROPERTY, > 125 HVCALL_GET_PARTITION_PROPERTY_EX, 126 HVCALL_SET_PARTITION_PROPERTY, 127 HVCALL_INSTALL_INTERCEPT, 128 HVCALL_GET_VP_REGISTERS, 129 HVCALL_SET_VP_REGISTERS, 130 HVCALL_TRANSLATE_VIRTUAL_ADDRESS, 131 HVCALL_CLEAR_VIRTUAL_INTERRUPT, 132 HVCALL_REGISTER_INTERCEPT_RESULT, 133 HVCALL_ASSERT_VIRTUAL_INTERRUPT, 134 HVCALL_GET_GPA_PAGES_ACCESS_STATES, 135 HVCALL_SIGNAL_EVENT_DIRECT, 136 HVCALL_POST_MESSAGE_DIRECT, 137 HVCALL_GET_VP_CPUID_VALUES, 138 }; 139 140 static bool mshv_hvcall_is_async(u16 code) 141 { 142 switch (code) { 143 case HVCALL_SET_PARTITION_PROPERTY: 144 return true; 145 default: 146 break; 147 } 148 return false; 149 } 150 151 static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, 152 bool partition_locked, 153 void __user *user_args) 154 { 155 u64 status; 156 int ret = 0, i; 157 bool is_async; 158 struct mshv_root_hvcall args; 159 struct page *page; 160 unsigned int pages_order; 161 void *input_pg = NULL; 162 void *output_pg = NULL; 163 u64 pt_id = partition ? partition->pt_id : HV_PARTITION_ID_SELF; 164 165 if (copy_from_user(&args, user_args, sizeof(args))) 166 return -EFAULT; 167 168 if (args.status || !args.in_ptr || args.in_sz < sizeof(u64) || 169 mshv_field_nonzero(args, rsvd) || args.in_sz > HV_HYP_PAGE_SIZE) 170 return -EINVAL; 171 172 if (args.out_ptr && (!args.out_sz || args.out_sz > HV_HYP_PAGE_SIZE)) 173 return -EINVAL; 174 > 175 for (i = 0; i < ARRAY_SIZE(mshv_passthru_hvcalls); ++i) 176 if (args.code == mshv_passthru_hvcalls[i]) 177 break; 178 179 if (i >= ARRAY_SIZE(mshv_passthru_hvcalls)) 180 return -EINVAL; 181 182 is_async = mshv_hvcall_is_async(args.code); 183 if (is_async) { 184 /* async hypercalls can only be called from partition fd */ 185 if (!partition || !partition_locked) 186 return -EINVAL; 187 ret = mshv_init_async_handler(partition); 188 if (ret) 189 return ret; 190 } 191 192 pages_order = args.out_ptr ? 1 : 0; 193 page = alloc_pages(GFP_KERNEL, pages_order); 194 if (!page) 195 return -ENOMEM; 196 input_pg = page_address(page); 197 198 if (args.out_ptr) 199 output_pg = (char *)input_pg + PAGE_SIZE; 200 else 201 output_pg = NULL; 202 203 if (copy_from_user(input_pg, (void __user *)args.in_ptr, 204 args.in_sz)) { 205 ret = -EFAULT; 206 goto free_pages_out; 207 } 208 209 /* 210 * NOTE: This only works because all the allowed hypercalls' input 211 * structs begin with a u64 partition_id field. 212 */ 213 *(u64 *)input_pg = pt_id; 214 215 if (args.reps) 216 status = hv_do_rep_hypercall(args.code, args.reps, 0, 217 input_pg, output_pg); 218 else 219 status = hv_do_hypercall(args.code, input_pg, output_pg); 220 221 if (hv_result(status) == HV_STATUS_CALL_PENDING) { 222 if (is_async) { 223 mshv_async_hvcall_handler(partition, &status); 224 } else { /* Paranoia check. This shouldn't happen! */ 225 ret = -EBADFD; 226 goto free_pages_out; 227 } 228 } 229 230 if (hv_result(status) == HV_STATUS_INSUFFICIENT_MEMORY) { 231 ret = hv_call_deposit_pages(NUMA_NO_NODE, pt_id, 1); 232 if (!ret) 233 ret = -EAGAIN; 234 } else if (!hv_result_success(status)) { 235 ret = hv_result_to_errno(status); 236 } 237 238 /* 239 * Always return the status and output data regardless of result. 240 * The VMM may need it to determine how to proceed. E.g. the status may 241 * contain the number of reps completed if a rep hypercall partially 242 * succeeded. 243 */ 244 args.status = hv_result(status); 245 args.reps = args.reps ? hv_repcomp(status) : 0; 246 if (copy_to_user(user_args, &args, sizeof(args))) 247 ret = -EFAULT; 248 249 if (output_pg && 250 copy_to_user((void __user *)args.out_ptr, output_pg, args.out_sz)) 251 ret = -EFAULT; 252 253 free_pages_out: 254 free_pages((unsigned long)input_pg, pages_order); 255 256 return ret; 257 } 258 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
