Re: [PATCH 5/5] hyperv: Use hvhdk.h instead of hyperv-tlfs.h in Hyper-V code
From: Nuno Das Neves
Date: Fri Oct 04 2024 - 19:36:50 EST
On 10/4/2024 12:11 PM, Simon Horman wrote:
> Hi,
>
> With this change in place I see allmodconfig x86_64 builds reporting that
> HV_REGISTER_FEATURES is undeclared.
>
> arch/arm64/hyperv/mshyperv.c: In function 'hyperv_init':
> arch/arm64/hyperv/mshyperv.c:53:26: error: 'HV_REGISTER_FEATURES' undeclared (first use in this function); did you mean 'HV_REGISTER_FEATURES_INFO'?
> 53 | hv_get_vpreg_128(HV_REGISTER_FEATURES, &result);
> | ^~~~~~~~~~~~~~~~~~~~
> | HV_REGISTER_FEATURES_INFO
> arch/arm64/hyperv/mshyperv.c:53:26: note: each undeclared identifier is reported only once for each function it appears in
> arch/arm64/hyperv/mshyperv.c:58:26: error: 'HV_REGISTER_ENLIGHTENMENTS' undeclared (first use in this function); did you mean 'HV_ACCESS_REENLIGHTENMENT'?
> 58 | hv_get_vpreg_128(HV_REGISTER_ENLIGHTENMENTS, &result);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> | HV_ACCESS_REENLIGHTENMENT
>
Ah, I did forgot to check arm64. Thanks for the catch, I'll be sure to
fix it for v2.
>
> And here too, with x86_64 allmodconfig.
>
> In file included from ./include/linux/string.h:390,
> from ./include/linux/efi.h:16,
> from arch/x86/hyperv/hv_init.c:12:
> arch/x86/hyperv/hv_init.c: In function 'get_vtl':
> ./include/linux/overflow.h:372:23: error: invalid application of 'sizeof' to incomplete type 'struct hv_get_vp_registers_input'
> 372 | sizeof(*(p)) + flex_array_size(p, member, count), \
> | ^
> ./include/linux/fortify-string.h:502:42: note: in definition of macro '__fortify_memset_chk'
> 502 | size_t __fortify_size = (size_t)(size); \
> | ^~~~
> arch/x86/hyperv/hv_init.c:427:9: note: in expansion of macro 'memset'
> 427 | memset(input, 0, struct_size(input, element, 1));
> | ^~~~~~
> arch/x86/hyperv/hv_init.c:427:26: note: in expansion of macro 'struct_size'
> 427 | memset(input, 0, struct_size(input, element, 1));
> | ^~~~~~~~~~~
>
> [errors trimmed for the sake of brevity]
>
> ...
>
Thanks
>
> And, likewise, with this patch applied I see a number of errors when
> compiling this file. This is with allmodconfig on x86_64 with:
>
> Modified: CONFIG_HYPERV=y (instead of m)
> Added: CONFIG_HYPERV_VTL_MODE=y
>
Thanks again,
Ah, I wish there was a way to check these different combinations of y/m
more easily.
> arch/x86/hyperv/hv_vtl.c: In function 'hv_vtl_bringup_vcpu':
> arch/x86/hyperv/hv_vtl.c:154:34: error: 'HVCALL_ENABLE_VP_VTL' undeclared (first use in this function)
> 154 | status = hv_do_hypercall(HVCALL_ENABLE_VP_VTL, input, NULL);
> | ^~~~~~~~~~~~~~~~~~~~
> arch/x86/hyperv/hv_vtl.c:154:34: note: each undeclared identifier is reported only once for each function it appears in
> In file included from ./include/linux/string.h:390,
> from ./include/linux/bitmap.h:13,
> from ./include/linux/cpumask.h:12,
> from ./arch/x86/include/asm/apic.h:5,
> from arch/x86/hyperv/hv_vtl.c:9:
> arch/x86/hyperv/hv_vtl.c: In function 'hv_vtl_apicid_to_vp_id':
> arch/x86/hyperv/hv_vtl.c:189:32: error: invalid application of 'sizeof' to incomplete type 'struct hv_get_vp_from_apic_id_in'
> 189 | memset(input, 0, sizeof(*input));
> | ^
> ./include/linux/fortify-string.h:502:42: note: in definition of macro '__fortify_memset_chk'
> 502 | size_t __fortify_size = (size_t)(size); \
> | ^~~~
> arch/x86/hyperv/hv_vtl.c:189:9: note: in expansion of macro 'memset'
> 189 | memset(input, 0, sizeof(*input));
> | ^~~~~~
> arch/x86/hyperv/hv_vtl.c:190:14: error: invalid use of undefined type 'struct hv_get_vp_from_apic_id_in'
> 190 | input->partition_id = HV_PARTITION_ID_SELF;
> | ^~
> arch/x86/hyperv/hv_vtl.c:191:14: error: invalid use of undefined type 'struct hv_get_vp_from_apic_id_in'
> 191 | input->apic_ids[0] = apic_id;
> | ^~
> arch/x86/hyperv/hv_vtl.c:195:45: error: 'HVCALL_GET_VP_ID_FROM_APIC_ID' undeclared (first use in this function)
> 195 | control = HV_HYPERCALL_REP_COMP_1 | HVCALL_GET_VP_ID_FROM_APIC_ID;
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ...
Looks like I'm missing a one or two definitions in the new headers, and the
names have changed slightly in couple of cases. I'll do some more thorough
checking and have it all fixed for v2.
I didn't know about this allmodconfig target, that will make it a bit easier!
Nuno