Message ID | 1727985064-18362-6-git-send-email-nunodasneves@linux.microsoft.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Add new headers for Hyper-V Dom0 | expand |
Hi Nuno, On Thu, Oct 03, 2024 at 12:51:04PM -0700, Nuno Das Neves wrote: > diff --git a/arch/arm64/hyperv/hv_core.c b/arch/arm64/hyperv/hv_core.c > index 9d1969b875e9..bb7f28f74bf4 100644 > --- a/arch/arm64/hyperv/hv_core.c > +++ b/arch/arm64/hyperv/hv_core.c > @@ -14,6 +14,7 @@ > #include <linux/arm-smccc.h> > #include <linux/module.h> > #include <asm-generic/bug.h> > +#define HYPERV_NONTLFS_HEADERS > #include <asm/mshyperv.h> > Perhaps it would be cleaner to introduce a new header file to be included, containing the new define and including <asm/mshyperv.h> instead. Stas
On Thu, Oct 03, 2024 at 12:51:04PM -0700, Nuno Das Neves wrote: > To move toward importing headers from Hyper-V directly, switch to > using hvhdk.h in all Hyper-V code. KVM code that uses Hyper-V > definitions from hyperv-tlfs.h remains untouched. > > Add HYPERV_NONTLFS_HEADERS everywhere mshyperv.h, asm/svm.h, > clocksource/hyperv_timer.h is included in Hyper-V code. > > Replace hyperv-tlfs.h with hvhdk.h directly in linux/hyperv.h, and > define HYPERV_NONTLFS_HEADERS there, since it is only used in > Hyper-V device code. > > Update a couple of definitions to updated names found in the new > headers: HV_EXT_MEM_HEAT_HINT, HV_SUBNODE_TYPE_ANY. > > Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com> ... > diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c > index b1a4de4eee29..62b2a270ae65 100644 > --- a/arch/arm64/hyperv/mshyperv.c > +++ b/arch/arm64/hyperv/mshyperv.c > @@ -15,6 +15,7 @@ > #include <linux/errno.h> > #include <linux/version.h> > #include <linux/cpuhotplug.h> > +#define HYPERV_NONTLFS_HEADERS > #include <asm/mshyperv.h> > > static bool hyperv_initialized; 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 > diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c > index 6d83ceb7f1ba..5f4053c49658 100644 > --- a/arch/x86/entry/vdso/vma.c > +++ b/arch/x86/entry/vdso/vma.c > @@ -25,6 +25,7 @@ > #include <asm/page.h> > #include <asm/desc.h> > #include <asm/cpufeature.h> > +#define HYPERV_NONTLFS_HEADERS > #include <clocksource/hyperv_timer.h> > > #undef _ASM_X86_VVAR_H > diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c > index f022d5f64fb6..4fe3b3b13256 100644 > --- a/arch/x86/hyperv/hv_apic.c > +++ b/arch/x86/hyperv/hv_apic.c > @@ -26,6 +26,7 @@ > #include <linux/slab.h> > #include <linux/cpuhotplug.h> > #include <asm/hypervisor.h> > +#define HYPERV_NONTLFS_HEADERS > #include <asm/mshyperv.h> > #include <asm/apic.h> > > diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c > index fc3c3d76c181..680c4abc456e 100644 > --- a/arch/x86/hyperv/hv_init.c > +++ b/arch/x86/hyperv/hv_init.c > @@ -19,6 +19,7 @@ > #include <asm/sev.h> > #include <asm/ibt.h> > #include <asm/hypervisor.h> > +#define HYPERV_NONTLFS_HEADERS > #include <asm/mshyperv.h> > #include <asm/idtentry.h> > #include <asm/set_memory.h> 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] ... > diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c > index 04775346369c..a8bb6ad7efb6 100644 > --- a/arch/x86/hyperv/hv_vtl.c > +++ b/arch/x86/hyperv/hv_vtl.c > @@ -10,6 +10,7 @@ > #include <asm/boot.h> > #include <asm/desc.h> > #include <asm/i8259.h> > +#define HYPERV_NONTLFS_HEADERS > #include <asm/mshyperv.h> > #include <asm/realmode.h> > #include <../kernel/smpboot.h> 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 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; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...
Hi Nuno, kernel test robot noticed the following build errors: [auto build test ERROR on tip/x86/core] [also build test ERROR on arm64/for-next/core kvm/queue linus/master v6.12-rc1 next-20241004] [cannot apply to kvm/linux-next] [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/Nuno-Das-Neves/hyperv-Move-hv_connection_id-to-hyperv-tlfs-h/20241004-035418 base: tip/x86/core patch link: https://lore.kernel.org/r/1727985064-18362-6-git-send-email-nunodasneves%40linux.microsoft.com patch subject: [PATCH 5/5] hyperv: Use hvhdk.h instead of hyperv-tlfs.h in Hyper-V code config: x86_64-allmodconfig (https://download.01.org/0day-ci/archive/20241005/202410050518.LFXqJEpd-lkp@intel.com/config) compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241005/202410050518.LFXqJEpd-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/202410050518.LFXqJEpd-lkp@intel.com/ All errors (new ones prefixed by >>): >> arch/x86/hyperv/hv_init.c:428:19: error: invalid application of 'sizeof' to an incomplete type 'struct hv_get_vp_registers_input' 428 | memset(input, 0, struct_size(input, element, 1)); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/overflow.h:372:9: note: expanded from macro 'struct_size' 372 | sizeof(*(p)) + flex_array_size(p, member, count), \ | ^ include/linux/fortify-string.h:512:52: note: expanded from macro 'memset' 512 | #define memset(p, c, s) __fortify_memset_chk(p, c, s, \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ 513 | __struct_size(p), __member_size(p)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/fortify-string.h:502:35: note: expanded from macro '__fortify_memset_chk' 502 | size_t __fortify_size = (size_t)(size); \ | ^~~~ arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input' 419 | struct hv_get_vp_registers_input *input; | ^ >> arch/x86/hyperv/hv_init.c:428:19: error: incomplete definition of type 'struct hv_get_vp_registers_input' 428 | memset(input, 0, struct_size(input, element, 1)); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/overflow.h:372:18: note: expanded from macro 'struct_size' 372 | sizeof(*(p)) + flex_array_size(p, member, count), \ | ^ include/linux/overflow.h:356:24: note: expanded from macro 'flex_array_size' 356 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \ | ^ include/linux/fortify-string.h:512:52: note: expanded from macro 'memset' 512 | #define memset(p, c, s) __fortify_memset_chk(p, c, s, \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ 513 | __struct_size(p), __member_size(p)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/fortify-string.h:502:35: note: expanded from macro '__fortify_memset_chk' 502 | size_t __fortify_size = (size_t)(size); \ | ^~~~ arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input' 419 | struct hv_get_vp_registers_input *input; | ^ >> arch/x86/hyperv/hv_init.c:428:19: error: incomplete definition of type 'struct hv_get_vp_registers_input' 428 | memset(input, 0, struct_size(input, element, 1)); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/overflow.h:372:18: note: expanded from macro 'struct_size' 372 | sizeof(*(p)) + flex_array_size(p, member, count), \ | ^ include/linux/overflow.h:356:55: note: expanded from macro 'flex_array_size' 356 | (count) * sizeof(*(p)->member) + __must_be_array((p)->member), \ | ^ include/linux/compiler.h:243:59: note: expanded from macro '__must_be_array' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/fortify-string.h:512:52: note: expanded from macro 'memset' 512 | #define memset(p, c, s) __fortify_memset_chk(p, c, s, \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ 513 | __struct_size(p), __member_size(p)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/fortify-string.h:502:35: note: expanded from macro '__fortify_memset_chk' 502 | size_t __fortify_size = (size_t)(size); \ | ^~~~ arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input' 419 | struct hv_get_vp_registers_input *input; | ^ >> arch/x86/hyperv/hv_init.c:428:19: error: incomplete definition of type 'struct hv_get_vp_registers_input' 428 | memset(input, 0, struct_size(input, element, 1)); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/overflow.h:372:18: note: expanded from macro 'struct_size' 372 | sizeof(*(p)) + flex_array_size(p, member, count), \ | ^ include/linux/overflow.h:357:30: note: expanded from macro 'flex_array_size' 357 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member))) | ^ include/linux/fortify-string.h:512:52: note: expanded from macro 'memset' 512 | #define memset(p, c, s) __fortify_memset_chk(p, c, s, \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ 513 | __struct_size(p), __member_size(p)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/fortify-string.h:502:35: note: expanded from macro '__fortify_memset_chk' 502 | size_t __fortify_size = (size_t)(size); \ | ^~~~ arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input' 419 | struct hv_get_vp_registers_input *input; | ^ >> arch/x86/hyperv/hv_init.c:428:19: error: incomplete definition of type 'struct hv_get_vp_registers_input' 428 | memset(input, 0, struct_size(input, element, 1)); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/overflow.h:372:18: note: expanded from macro 'struct_size' 372 | sizeof(*(p)) + flex_array_size(p, member, count), \ | ^ include/linux/overflow.h:357:61: note: expanded from macro 'flex_array_size' 357 | size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member))) | ^ include/linux/compiler.h:243:59: note: expanded from macro '__must_be_array' 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ^ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/fortify-string.h:512:52: note: expanded from macro 'memset' 512 | #define memset(p, c, s) __fortify_memset_chk(p, c, s, \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ 513 | __struct_size(p), __member_size(p)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/fortify-string.h:502:35: note: expanded from macro '__fortify_memset_chk' 502 | size_t __fortify_size = (size_t)(size); \ | ^~~~ arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input' 419 | struct hv_get_vp_registers_input *input; | ^ arch/x86/hyperv/hv_init.c:429:7: error: incomplete definition of type 'struct hv_get_vp_registers_input' 429 | input->header.partitionid = HV_PARTITION_ID_SELF; | ~~~~~^ arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input' 419 | struct hv_get_vp_registers_input *input; | ^ arch/x86/hyperv/hv_init.c:430:7: error: incomplete definition of type 'struct hv_get_vp_registers_input' 430 | input->header.vpindex = HV_VP_INDEX_SELF; | ~~~~~^ arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input' 419 | struct hv_get_vp_registers_input *input; | ^ arch/x86/hyperv/hv_init.c:431:7: error: incomplete definition of type 'struct hv_get_vp_registers_input' 431 | input->header.inputvtl = 0; | ~~~~~^ arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input' 419 | struct hv_get_vp_registers_input *input; | ^ arch/x86/hyperv/hv_init.c:432:7: error: incomplete definition of type 'struct hv_get_vp_registers_input' 432 | input->element[0].name0 = HV_X64_REGISTER_VSM_VP_STATUS; | ~~~~~^ arch/x86/hyperv/hv_init.c:419:9: note: forward declaration of 'struct hv_get_vp_registers_input' 419 | struct hv_get_vp_registers_input *input; | ^ >> arch/x86/hyperv/hv_init.c:436:15: error: incomplete definition of type 'struct hv_get_vp_registers_output' 436 | ret = output->as64.low & HV_X64_VTL_MASK; | ~~~~~~^ arch/x86/hyperv/hv_init.c:420:9: note: forward declaration of 'struct hv_get_vp_registers_output' 420 | struct hv_get_vp_registers_output *output; | ^ 10 errors generated. -- >> arch/x86/hyperv/hv_vtl.c:154:27: error: use of undeclared identifier 'HVCALL_ENABLE_VP_VTL' 154 | status = hv_do_hypercall(HVCALL_ENABLE_VP_VTL, input, NULL); | ^ >> arch/x86/hyperv/hv_vtl.c:189:25: error: invalid application of 'sizeof' to an incomplete type 'struct hv_get_vp_from_apic_id_in' 189 | memset(input, 0, sizeof(*input)); | ^~~~~~~~ include/linux/fortify-string.h:512:52: note: expanded from macro 'memset' 512 | #define memset(p, c, s) __fortify_memset_chk(p, c, s, \ | ^ include/linux/fortify-string.h:502:35: note: expanded from macro '__fortify_memset_chk' 502 | size_t __fortify_size = (size_t)(size); \ | ^~~~ arch/x86/hyperv/hv_vtl.c:183:9: note: forward declaration of 'struct hv_get_vp_from_apic_id_in' 183 | struct hv_get_vp_from_apic_id_in *input; | ^ >> arch/x86/hyperv/hv_vtl.c:190:7: error: incomplete definition of type 'struct hv_get_vp_from_apic_id_in' 190 | input->partition_id = HV_PARTITION_ID_SELF; | ~~~~~^ arch/x86/hyperv/hv_vtl.c:183:9: note: forward declaration of 'struct hv_get_vp_from_apic_id_in' 183 | struct hv_get_vp_from_apic_id_in *input; | ^ arch/x86/hyperv/hv_vtl.c:191:7: error: incomplete definition of type 'struct hv_get_vp_from_apic_id_in' 191 | input->apic_ids[0] = apic_id; | ~~~~~^ arch/x86/hyperv/hv_vtl.c:183:9: note: forward declaration of 'struct hv_get_vp_from_apic_id_in' 183 | struct hv_get_vp_from_apic_id_in *input; | ^ >> arch/x86/hyperv/hv_vtl.c:195:38: error: use of undeclared identifier 'HVCALL_GET_VP_ID_FROM_APIC_ID' 195 | control = HV_HYPERCALL_REP_COMP_1 | HVCALL_GET_VP_ID_FROM_APIC_ID; | ^ 5 errors generated. vim +428 arch/x86/hyperv/hv_init.c 99a0f46af6a771 Wei Liu 2021-02-03 414 f2a55d08d7e1a5 Saurabh Sengar 2023-09-19 415 #if IS_ENABLED(CONFIG_HYPERV_VTL_MODE) 8387ce06d70bbb Tianyu Lan 2023-08-18 416 static u8 __init get_vtl(void) 8387ce06d70bbb Tianyu Lan 2023-08-18 417 { 8387ce06d70bbb Tianyu Lan 2023-08-18 418 u64 control = HV_HYPERCALL_REP_COMP_1 | HVCALL_GET_VP_REGISTERS; 8387ce06d70bbb Tianyu Lan 2023-08-18 @419 struct hv_get_vp_registers_input *input; 8387ce06d70bbb Tianyu Lan 2023-08-18 420 struct hv_get_vp_registers_output *output; 8387ce06d70bbb Tianyu Lan 2023-08-18 421 unsigned long flags; 8387ce06d70bbb Tianyu Lan 2023-08-18 422 u64 ret; 8387ce06d70bbb Tianyu Lan 2023-08-18 423 8387ce06d70bbb Tianyu Lan 2023-08-18 424 local_irq_save(flags); 8387ce06d70bbb Tianyu Lan 2023-08-18 425 input = *this_cpu_ptr(hyperv_pcpu_input_arg); 8387ce06d70bbb Tianyu Lan 2023-08-18 426 output = (struct hv_get_vp_registers_output *)input; 8387ce06d70bbb Tianyu Lan 2023-08-18 427 8387ce06d70bbb Tianyu Lan 2023-08-18 @428 memset(input, 0, struct_size(input, element, 1)); 8387ce06d70bbb Tianyu Lan 2023-08-18 429 input->header.partitionid = HV_PARTITION_ID_SELF; 8387ce06d70bbb Tianyu Lan 2023-08-18 430 input->header.vpindex = HV_VP_INDEX_SELF; 8387ce06d70bbb Tianyu Lan 2023-08-18 431 input->header.inputvtl = 0; 8387ce06d70bbb Tianyu Lan 2023-08-18 432 input->element[0].name0 = HV_X64_REGISTER_VSM_VP_STATUS; 8387ce06d70bbb Tianyu Lan 2023-08-18 433 8387ce06d70bbb Tianyu Lan 2023-08-18 434 ret = hv_do_hypercall(control, input, output); 8387ce06d70bbb Tianyu Lan 2023-08-18 435 if (hv_result_success(ret)) { 8387ce06d70bbb Tianyu Lan 2023-08-18 @436 ret = output->as64.low & HV_X64_VTL_MASK; 8387ce06d70bbb Tianyu Lan 2023-08-18 437 } else { f2a55d08d7e1a5 Saurabh Sengar 2023-09-19 438 pr_err("Failed to get VTL(error: %lld) exiting...\n", ret); f2a55d08d7e1a5 Saurabh Sengar 2023-09-19 439 BUG(); 8387ce06d70bbb Tianyu Lan 2023-08-18 440 } 8387ce06d70bbb Tianyu Lan 2023-08-18 441 8387ce06d70bbb Tianyu Lan 2023-08-18 442 local_irq_restore(flags); 8387ce06d70bbb Tianyu Lan 2023-08-18 443 return ret; 8387ce06d70bbb Tianyu Lan 2023-08-18 444 } f2a55d08d7e1a5 Saurabh Sengar 2023-09-19 445 #else f2a55d08d7e1a5 Saurabh Sengar 2023-09-19 446 static inline u8 get_vtl(void) { return 0; } f2a55d08d7e1a5 Saurabh Sengar 2023-09-19 447 #endif 8387ce06d70bbb Tianyu Lan 2023-08-18 448
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
On 10/4/2024 8:58 AM, Stanislav Kinsburskii wrote: > Hi Nuno, > > On Thu, Oct 03, 2024 at 12:51:04PM -0700, Nuno Das Neves wrote: >> diff --git a/arch/arm64/hyperv/hv_core.c b/arch/arm64/hyperv/hv_core.c >> index 9d1969b875e9..bb7f28f74bf4 100644 >> --- a/arch/arm64/hyperv/hv_core.c >> +++ b/arch/arm64/hyperv/hv_core.c >> @@ -14,6 +14,7 @@ >> #include <linux/arm-smccc.h> >> #include <linux/module.h> >> #include <asm-generic/bug.h> >> +#define HYPERV_NONTLFS_HEADERS >> #include <asm/mshyperv.h> >> > > Perhaps it would be cleaner to introduce a new header file to be > included, containing the new define and including <asm/mshyperv.h> instead. > > Stas If I understand correctly, you're suggesting adding another stub named e.g. "hv_mshyperv.h", containing: #define HYPERV_NONTLFS_HEADERS #include<asm/mshyperv.h> Then in the roughly 24 places in this patch where we have: +#define HYPERV_NONTLFS_HEADERS Instead, we'd have: -#include <asm/mshyperv.h> +#include <hyperv/hv_mshyperv.h> I suppose the current version is a bit opaque - it's not immediately clear why HYPERV_NONTLFs_HEADERS is defined, and that it must be defined before including asm/mshyperv.h - someone reading the code would have to go find hv_defs.h to puzzle that out. This improves the situation slightly by associating the #define with asm/mshyperv.h. I'll consider it for v2, thanks! Nuno
Hi Nuno, kernel test robot noticed the following build errors: [auto build test ERROR on tip/x86/core] [also build test ERROR on arm64/for-next/core kvm/queue linus/master v6.12-rc1 next-20241004] [cannot apply to kvm/linux-next] [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/Nuno-Das-Neves/hyperv-Move-hv_connection_id-to-hyperv-tlfs-h/20241004-035418 base: tip/x86/core patch link: https://lore.kernel.org/r/1727985064-18362-6-git-send-email-nunodasneves%40linux.microsoft.com patch subject: [PATCH 5/5] hyperv: Use hvhdk.h instead of hyperv-tlfs.h in Hyper-V code config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20241005/202410050921.0o9FH5Ai-lkp@intel.com/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project fef3566a25ff0e34fb87339ba5e13eca17cec00f) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241005/202410050921.0o9FH5Ai-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/202410050921.0o9FH5Ai-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from arch/arm64/hyperv/mshyperv.c:13: In file included from include/linux/acpi.h:39: In file included from include/acpi/acpi_io.h:7: In file included from arch/arm64/include/asm/acpi.h:14: In file included from include/linux/memblock.h:12: In file included from include/linux/mm.h:2228: include/linux/vmstat.h:500:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 500 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 501 | item]; | ~~~~ include/linux/vmstat.h:507:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 507 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 508 | NR_VM_NUMA_EVENT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~~ include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 514 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ include/linux/vmstat.h:519:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 519 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 520 | NR_VM_NUMA_EVENT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~~ include/linux/vmstat.h:528:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 528 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 529 | NR_VM_NUMA_EVENT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~~ >> arch/arm64/hyperv/mshyperv.c:53:19: error: use of undeclared identifier 'HV_REGISTER_FEATURES'; did you mean 'HV_REGISTER_FEATURES_INFO'? 53 | hv_get_vpreg_128(HV_REGISTER_FEATURES, &result); | ^~~~~~~~~~~~~~~~~~~~ | HV_REGISTER_FEATURES_INFO include/hyperv/hvgdk_mini.h:807:2: note: 'HV_REGISTER_FEATURES_INFO' declared here 807 | HV_REGISTER_FEATURES_INFO = 0x00000201, | ^ >> arch/arm64/hyperv/mshyperv.c:58:19: error: use of undeclared identifier 'HV_REGISTER_ENLIGHTENMENTS' 58 | hv_get_vpreg_128(HV_REGISTER_ENLIGHTENMENTS, &result); | ^ 5 warnings and 2 errors generated. vim +53 arch/arm64/hyperv/mshyperv.c 410779d8d81fcf Nuno Das Neves 2024-03-07 30 9bbb888824e38c Michael Kelley 2021-08-04 31 static int __init hyperv_init(void) 9bbb888824e38c Michael Kelley 2021-08-04 32 { 9bbb888824e38c Michael Kelley 2021-08-04 33 struct hv_get_vp_registers_output result; 9bbb888824e38c Michael Kelley 2021-08-04 34 u64 guest_id; 9bbb888824e38c Michael Kelley 2021-08-04 35 int ret; 9bbb888824e38c Michael Kelley 2021-08-04 36 9bbb888824e38c Michael Kelley 2021-08-04 37 /* 9bbb888824e38c Michael Kelley 2021-08-04 38 * Allow for a kernel built with CONFIG_HYPERV to be running in 9bbb888824e38c Michael Kelley 2021-08-04 39 * a non-Hyper-V environment, including on DT instead of ACPI. 9bbb888824e38c Michael Kelley 2021-08-04 40 * In such cases, do nothing and return success. 9bbb888824e38c Michael Kelley 2021-08-04 41 */ 9bbb888824e38c Michael Kelley 2021-08-04 42 if (acpi_disabled) 9bbb888824e38c Michael Kelley 2021-08-04 43 return 0; 9bbb888824e38c Michael Kelley 2021-08-04 44 9bbb888824e38c Michael Kelley 2021-08-04 45 if (strncmp((char *)&acpi_gbl_FADT.hypervisor_id, "MsHyperV", 8)) 9bbb888824e38c Michael Kelley 2021-08-04 46 return 0; 9bbb888824e38c Michael Kelley 2021-08-04 47 9bbb888824e38c Michael Kelley 2021-08-04 48 /* Setup the guest ID */ d5ebde1e2b4615 Li kunyu 2022-09-28 49 guest_id = hv_generate_guest_id(LINUX_VERSION_CODE); b967df6293510b Nuno Das Neves 2024-03-12 50 hv_set_vpreg(HV_REGISTER_GUEST_OS_ID, guest_id); 9bbb888824e38c Michael Kelley 2021-08-04 51 9bbb888824e38c Michael Kelley 2021-08-04 52 /* Get the features and hints from Hyper-V */ 9bbb888824e38c Michael Kelley 2021-08-04 @53 hv_get_vpreg_128(HV_REGISTER_FEATURES, &result); 9bbb888824e38c Michael Kelley 2021-08-04 54 ms_hyperv.features = result.as32.a; 9bbb888824e38c Michael Kelley 2021-08-04 55 ms_hyperv.priv_high = result.as32.b; 9bbb888824e38c Michael Kelley 2021-08-04 56 ms_hyperv.misc_features = result.as32.c; 9bbb888824e38c Michael Kelley 2021-08-04 57 9bbb888824e38c Michael Kelley 2021-08-04 @58 hv_get_vpreg_128(HV_REGISTER_ENLIGHTENMENTS, &result); 9bbb888824e38c Michael Kelley 2021-08-04 59 ms_hyperv.hints = result.as32.a; 9bbb888824e38c Michael Kelley 2021-08-04 60 9bbb888824e38c Michael Kelley 2021-08-04 61 pr_info("Hyper-V: privilege flags low 0x%x, high 0x%x, hints 0x%x, misc 0x%x\n", 9bbb888824e38c Michael Kelley 2021-08-04 62 ms_hyperv.features, ms_hyperv.priv_high, ms_hyperv.hints, 9bbb888824e38c Michael Kelley 2021-08-04 63 ms_hyperv.misc_features); 9bbb888824e38c Michael Kelley 2021-08-04 64 9bbb888824e38c Michael Kelley 2021-08-04 65 ret = hv_common_init(); 9bbb888824e38c Michael Kelley 2021-08-04 66 if (ret) 9bbb888824e38c Michael Kelley 2021-08-04 67 return ret; 9bbb888824e38c Michael Kelley 2021-08-04 68 52ae076c3a9b36 Michael Kelley 2023-05-23 69 ret = cpuhp_setup_state(CPUHP_AP_HYPERV_ONLINE, "arm64/hyperv_init:online", 9bbb888824e38c Michael Kelley 2021-08-04 70 hv_common_cpu_init, hv_common_cpu_die); 9bbb888824e38c Michael Kelley 2021-08-04 71 if (ret < 0) { 9bbb888824e38c Michael Kelley 2021-08-04 72 hv_common_free(); 9bbb888824e38c Michael Kelley 2021-08-04 73 return ret; 9bbb888824e38c Michael Kelley 2021-08-04 74 } 9bbb888824e38c Michael Kelley 2021-08-04 75 f2580a907e5c0e Michael Kelley 2024-03-18 76 ms_hyperv_late_init(); f2580a907e5c0e Michael Kelley 2024-03-18 77 9bbb888824e38c Michael Kelley 2021-08-04 78 hyperv_initialized = true; 9bbb888824e38c Michael Kelley 2021-08-04 79 return 0; 9bbb888824e38c Michael Kelley 2021-08-04 80 } 9bbb888824e38c Michael Kelley 2021-08-04 81
diff --git a/arch/arm64/hyperv/hv_core.c b/arch/arm64/hyperv/hv_core.c index 9d1969b875e9..bb7f28f74bf4 100644 --- a/arch/arm64/hyperv/hv_core.c +++ b/arch/arm64/hyperv/hv_core.c @@ -14,6 +14,7 @@ #include <linux/arm-smccc.h> #include <linux/module.h> #include <asm-generic/bug.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> /* diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c index b1a4de4eee29..62b2a270ae65 100644 --- a/arch/arm64/hyperv/mshyperv.c +++ b/arch/arm64/hyperv/mshyperv.c @@ -15,6 +15,7 @@ #include <linux/errno.h> #include <linux/version.h> #include <linux/cpuhotplug.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> static bool hyperv_initialized; diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index 6d83ceb7f1ba..5f4053c49658 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -25,6 +25,7 @@ #include <asm/page.h> #include <asm/desc.h> #include <asm/cpufeature.h> +#define HYPERV_NONTLFS_HEADERS #include <clocksource/hyperv_timer.h> #undef _ASM_X86_VVAR_H diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c index f022d5f64fb6..4fe3b3b13256 100644 --- a/arch/x86/hyperv/hv_apic.c +++ b/arch/x86/hyperv/hv_apic.c @@ -26,6 +26,7 @@ #include <linux/slab.h> #include <linux/cpuhotplug.h> #include <asm/hypervisor.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include <asm/apic.h> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index fc3c3d76c181..680c4abc456e 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -19,6 +19,7 @@ #include <asm/sev.h> #include <asm/ibt.h> #include <asm/hypervisor.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include <asm/idtentry.h> #include <asm/set_memory.h> diff --git a/arch/x86/hyperv/hv_proc.c b/arch/x86/hyperv/hv_proc.c index b74c06c04ff1..428542134b84 100644 --- a/arch/x86/hyperv/hv_proc.c +++ b/arch/x86/hyperv/hv_proc.c @@ -7,6 +7,7 @@ #include <linux/cpuhotplug.h> #include <linux/minmax.h> #include <asm/hypervisor.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include <asm/apic.h> @@ -176,7 +177,7 @@ int hv_call_create_vp(int node, u64 partition_id, u32 vp_index, u32 flags) input->partition_id = partition_id; input->vp_index = vp_index; input->flags = flags; - input->subnode_type = HvSubnodeAny; + input->subnode_type = HV_SUBNODE_ANY; input->proximity_domain_info = hv_numa_node_to_pxm_info(node); status = hv_do_hypercall(HVCALL_CREATE_VP, input, NULL); local_irq_restore(irq_flags); diff --git a/arch/x86/hyperv/hv_spinlock.c b/arch/x86/hyperv/hv_spinlock.c index 151e851bef09..7e8e2c03f669 100644 --- a/arch/x86/hyperv/hv_spinlock.c +++ b/arch/x86/hyperv/hv_spinlock.c @@ -12,6 +12,7 @@ #include <linux/spinlock.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include <asm/paravirt.h> #include <asm/apic.h> diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c index 04775346369c..a8bb6ad7efb6 100644 --- a/arch/x86/hyperv/hv_vtl.c +++ b/arch/x86/hyperv/hv_vtl.c @@ -10,6 +10,7 @@ #include <asm/boot.h> #include <asm/desc.h> #include <asm/i8259.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include <asm/realmode.h> #include <../kernel/smpboot.h> diff --git a/arch/x86/hyperv/irqdomain.c b/arch/x86/hyperv/irqdomain.c index 3215a4a07408..977f90d08471 100644 --- a/arch/x86/hyperv/irqdomain.c +++ b/arch/x86/hyperv/irqdomain.c @@ -10,6 +10,7 @@ #include <linux/pci.h> #include <linux/irq.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> static int hv_map_interrupt(union hv_device_id device_id, bool level, diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c index b56d70612734..557a308e8e0a 100644 --- a/arch/x86/hyperv/ivm.c +++ b/arch/x86/hyperv/ivm.c @@ -9,6 +9,7 @@ #include <linux/bitfield.h> #include <linux/types.h> #include <linux/slab.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/svm.h> #include <asm/sev.h> #include <asm/io.h> diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c index cc8c3bd0e7c2..6bf9915611b8 100644 --- a/arch/x86/hyperv/mmu.c +++ b/arch/x86/hyperv/mmu.c @@ -5,6 +5,7 @@ #include <linux/types.h> #include <asm/fpu/api.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include <asm/msr.h> #include <asm/tlbflush.h> diff --git a/arch/x86/hyperv/nested.c b/arch/x86/hyperv/nested.c index ee06d0315c24..03775d72b7f9 100644 --- a/arch/x86/hyperv/nested.c +++ b/arch/x86/hyperv/nested.c @@ -11,6 +11,7 @@ #include <linux/types.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include <asm/tlbflush.h> diff --git a/arch/x86/include/asm/vdso/gettimeofday.h b/arch/x86/include/asm/vdso/gettimeofday.h index b2d2df026f6e..528ac66e366b 100644 --- a/arch/x86/include/asm/vdso/gettimeofday.h +++ b/arch/x86/include/asm/vdso/gettimeofday.h @@ -18,6 +18,7 @@ #include <asm/unistd.h> #include <asm/msr.h> #include <asm/pvclock.h> +#define HYPERV_NONTLFS_HEADERS #include <clocksource/hyperv_timer.h> #define __vdso_data (VVAR(_vdso_data)) diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index 8e8fd23b1439..59bb8ab93dc2 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -20,6 +20,7 @@ #include <linux/random.h> #include <asm/processor.h> #include <asm/hypervisor.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include <asm/desc.h> #include <asm/idtentry.h> diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index 7b29ebda024f..22228f2f550d 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c @@ -13,6 +13,7 @@ #include <asm/cacheinfo.h> #include <asm/cpufeature.h> #include <asm/hypervisor.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include <asm/tlbflush.h> #include <asm/mtrr.h> diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index 1b7de45a7185..ec37476c4e15 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -22,6 +22,7 @@ #include <linux/irq.h> #include <linux/acpi.h> #include <linux/hyperv.h> +#define HYPERV_NONTLFS_HEADERS #include <clocksource/hyperv_timer.h> #include <asm/mshyperv.h> diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index fb8cd8469328..76d3c27e961e 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -19,6 +19,7 @@ #include <linux/interrupt.h> #include <linux/set_memory.h> #include <asm/page.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include "hyperv_vmbus.h" diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 3c6011a48dab..e6d56c73175a 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -20,6 +20,7 @@ #include <linux/delay.h> #include <linux/cpu.h> #include <linux/hyperv.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include <linux/sched/isolation.h> diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index f001ae880e1d..88546b0c2242 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -21,6 +21,7 @@ #include <linux/export.h> #include <linux/io.h> #include <linux/set_memory.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include "hyperv_vmbus.h" diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index e0d676c74f14..42f3790656e2 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -18,6 +18,7 @@ #include <linux/clockchips.h> #include <linux/delay.h> #include <linux/interrupt.h> +#define HYPERV_NONTLFS_HEADERS #include <clocksource/hyperv_timer.h> #include <asm/mshyperv.h> #include <linux/set_memory.h> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index a120e9b80ded..6b270ee75747 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -28,6 +28,7 @@ #include <linux/sizes.h> #include <linux/hyperv.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #define CREATE_TRACE_POINTS @@ -1583,7 +1584,7 @@ static int hv_free_page_report(struct page_reporting_dev_info *pr_dev_info, return -ENOSPC; } - hint->type = HV_EXT_MEMORY_HEAT_HINT_TYPE_COLD_DISCARD; + hint->heat_type = HV_EXTMEM_HEAT_HINT_COLD_DISCARD; hint->reserved = 0; for_each_sg(sgl, sg, nents, i) { union hv_gpa_page_range *range; diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c index a5217f837237..2723711868bc 100644 --- a/drivers/hv/hv_common.c +++ b/drivers/hv/hv_common.c @@ -28,6 +28,7 @@ #include <linux/slab.h> #include <linux/dma-map-ops.h> #include <linux/set_memory.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> /* diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index c4f525325790..a17f6e6024a4 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c @@ -17,6 +17,7 @@ #include <linux/hyperv.h> #include <linux/clockchips.h> #include <linux/ptp_clock_kernel.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include "hyperv_vmbus.h" diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 3c9b02471760..6bfd064b4e65 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -18,6 +18,7 @@ #include <linux/slab.h> #include <linux/prefetch.h> #include <linux/io.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include "hyperv_vmbus.h" diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 7242c4920427..71745d62e064 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -36,6 +36,7 @@ #include <linux/syscore_ops.h> #include <linux/dma-map-ops.h> #include <linux/pci.h> +#define HYPERV_NONTLFS_HEADERS #include <clocksource/hyperv_timer.h> #include <asm/mshyperv.h> #include "hyperv_vmbus.h" diff --git a/drivers/iommu/hyperv-iommu.c b/drivers/iommu/hyperv-iommu.c index 8a5c17b97310..ade14cc9c071 100644 --- a/drivers/iommu/hyperv-iommu.c +++ b/drivers/iommu/hyperv-iommu.c @@ -20,6 +20,7 @@ #include <asm/io_apic.h> #include <asm/irq_remapping.h> #include <asm/hypervisor.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include "irq_remapping.h" diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 2b6ec979a62f..55095c02cc78 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -23,6 +23,7 @@ #include <linux/filter.h> #include <asm/sync_bitops.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> #include "hyperv_net.h" diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index cdd5be16021d..261ff8b80caa 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -50,6 +50,7 @@ #include <linux/irqdomain.h> #include <linux/acpi.h> #include <linux/sizes.h> +#define HYPERV_NONTLFS_HEADERS #include <asm/mshyperv.h> /* diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index d0893ec488ae..64fd385723fc 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -24,7 +24,8 @@ #include <linux/mod_devicetable.h> #include <linux/interrupt.h> #include <linux/reciprocal_div.h> -#include <asm/hyperv-tlfs.h> +#include <hyperv/hvhdk.h> +#define HYPERV_NONTLFS_HEADERS #define MAX_PAGE_BUFFER_COUNT 32 #define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
To move toward importing headers from Hyper-V directly, switch to using hvhdk.h in all Hyper-V code. KVM code that uses Hyper-V definitions from hyperv-tlfs.h remains untouched. Add HYPERV_NONTLFS_HEADERS everywhere mshyperv.h, asm/svm.h, clocksource/hyperv_timer.h is included in Hyper-V code. Replace hyperv-tlfs.h with hvhdk.h directly in linux/hyperv.h, and define HYPERV_NONTLFS_HEADERS there, since it is only used in Hyper-V device code. Update a couple of definitions to updated names found in the new headers: HV_EXT_MEM_HEAT_HINT, HV_SUBNODE_TYPE_ANY. Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com> --- arch/arm64/hyperv/hv_core.c | 1 + arch/arm64/hyperv/mshyperv.c | 1 + arch/x86/entry/vdso/vma.c | 1 + arch/x86/hyperv/hv_apic.c | 1 + arch/x86/hyperv/hv_init.c | 1 + arch/x86/hyperv/hv_proc.c | 3 ++- arch/x86/hyperv/hv_spinlock.c | 1 + arch/x86/hyperv/hv_vtl.c | 1 + arch/x86/hyperv/irqdomain.c | 1 + arch/x86/hyperv/ivm.c | 1 + arch/x86/hyperv/mmu.c | 1 + arch/x86/hyperv/nested.c | 1 + arch/x86/include/asm/vdso/gettimeofday.h | 1 + arch/x86/kernel/cpu/mshyperv.c | 1 + arch/x86/kernel/cpu/mtrr/generic.c | 1 + drivers/clocksource/hyperv_timer.c | 1 + drivers/hv/channel.c | 1 + drivers/hv/channel_mgmt.c | 1 + drivers/hv/connection.c | 1 + drivers/hv/hv.c | 1 + drivers/hv/hv_balloon.c | 3 ++- drivers/hv/hv_common.c | 1 + drivers/hv/hv_util.c | 1 + drivers/hv/ring_buffer.c | 1 + drivers/hv/vmbus_drv.c | 1 + drivers/iommu/hyperv-iommu.c | 1 + drivers/net/hyperv/netvsc.c | 1 + drivers/pci/controller/pci-hyperv.c | 1 + include/linux/hyperv.h | 3 ++- 29 files changed, 32 insertions(+), 3 deletions(-)