Enable build of the new files introduced in the earlier commits and add
call to do the setup during boot.
Signed-off-by: Mukesh Rathor <mrathor@linux.microsoft.com>
---
arch/x86/hyperv/Makefile | 6 ++++++
arch/x86/hyperv/hv_init.c | 1 +
arch/x86/include/asm/mshyperv.h | 13 +++++++++++++
3 files changed, 20 insertions(+)
diff --git a/arch/x86/hyperv/Makefile b/arch/x86/hyperv/Makefile
index d55f494f471d..6f5d97cddd80 100644
--- a/arch/x86/hyperv/Makefile
+++ b/arch/x86/hyperv/Makefile
@@ -5,4 +5,10 @@ obj-$(CONFIG_HYPERV_VTL_MODE) += hv_vtl.o
ifdef CONFIG_X86_64
obj-$(CONFIG_PARAVIRT_SPINLOCKS) += hv_spinlock.o
+
+ ifdef CONFIG_MSHV_ROOT
+ CFLAGS_REMOVE_hv_trampoline.o += -pg
+ CFLAGS_hv_trampoline.o += -fno-stack-protector
+ obj-$(CONFIG_CRASH_DUMP) += hv_crash.o hv_trampoline.o
+ endif
endif
diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index afdbda2dd7b7..577bbd143527 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -510,6 +510,7 @@ void __init hyperv_init(void)
memunmap(src);
hv_remap_tsc_clocksource();
+ hv_root_crash_init();
} else {
hypercall_msr.guest_physical_address = vmalloc_to_pfn(hv_hypercall_pg);
wrmsrq(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index abc4659f5809..207d953d7b90 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -292,6 +292,19 @@ static __always_inline u64 hv_raw_get_msr(unsigned int reg)
}
int hv_apicid_to_vp_index(u32 apic_id);
+#if IS_ENABLED(CONFIG_MSHV_ROOT)
+
+#ifdef CONFIG_CRASH_DUMP
+void hv_root_crash_init(void);
+void hv_crash_asm32(void);
+void hv_crash_asm64(void);
+void hv_crash_asm_end(void);
+#else /* CONFIG_CRASH_DUMP */
+static inline void hv_root_crash_init(void) {}
+#endif /* CONFIG_CRASH_DUMP */
+
+#endif /* CONFIG_MSHV_ROOT */
+
#else /* CONFIG_HYPERV */
static inline void hyperv_init(void) {}
static inline void hyperv_setup_mmu_ops(void) {}
--
2.36.1.vfs.0.0
Hi Mukesh, kernel test robot noticed the following build errors: [auto build test ERROR on next-20250923] [also build test ERROR on v6.17-rc7] [cannot apply to tip/x86/core linus/master v6.17-rc7 v6.17-rc6 v6.17-rc5] [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/Mukesh-Rathor/x86-hyperv-Rename-guest-crash-shutdown-function/20250924-054910 base: next-20250923 patch link: https://lore.kernel.org/r/20250923214609.4101554-7-mrathor%40linux.microsoft.com patch subject: [PATCH v2 6/6] x86/hyperv: Enable build of hypervisor crashdump collection files config: x86_64-randconfig-004-20250924 (https://download.01.org/0day-ci/archive/20250925/202509250034.2hNDVmj0-lkp@intel.com/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/20250925/202509250034.2hNDVmj0-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/202509250034.2hNDVmj0-lkp@intel.com/ All errors (new ones prefixed by >>): arch/x86/hyperv/hv_crash.c:282:6: warning: variable 'status' set but not used [-Wunused-but-set-variable] 282 | u64 status; | ^ >> arch/x86/hyperv/hv_crash.c:631:2: error: must use 'struct' tag to refer to type 'smp_ops' 631 | smp_ops.crash_stop_other_cpus = hv_crash_stop_other_cpus; | ^ | struct >> arch/x86/hyperv/hv_crash.c:631:9: error: expected identifier or '(' 631 | smp_ops.crash_stop_other_cpus = hv_crash_stop_other_cpus; | ^ 1 warning and 2 errors generated. vim +631 arch/x86/hyperv/hv_crash.c c619422e77519d Mukesh Rathor 2025-09-23 580 c619422e77519d Mukesh Rathor 2025-09-23 581 /* Setup for kdump kexec to collect hypervisor RAM when running as root/dom0 */ c619422e77519d Mukesh Rathor 2025-09-23 582 void hv_root_crash_init(void) c619422e77519d Mukesh Rathor 2025-09-23 583 { c619422e77519d Mukesh Rathor 2025-09-23 584 int rc; c619422e77519d Mukesh Rathor 2025-09-23 585 struct hv_input_get_system_property *input; c619422e77519d Mukesh Rathor 2025-09-23 586 struct hv_output_get_system_property *output; c619422e77519d Mukesh Rathor 2025-09-23 587 unsigned long flags; c619422e77519d Mukesh Rathor 2025-09-23 588 u64 status; c619422e77519d Mukesh Rathor 2025-09-23 589 union hv_pfn_range cda_info; c619422e77519d Mukesh Rathor 2025-09-23 590 c619422e77519d Mukesh Rathor 2025-09-23 591 if (pgtable_l5_enabled()) { c619422e77519d Mukesh Rathor 2025-09-23 592 pr_err("Hyper-V: crash dump not yet supported on 5level PTs\n"); c619422e77519d Mukesh Rathor 2025-09-23 593 return; c619422e77519d Mukesh Rathor 2025-09-23 594 } c619422e77519d Mukesh Rathor 2025-09-23 595 c619422e77519d Mukesh Rathor 2025-09-23 596 rc = register_nmi_handler(NMI_LOCAL, hv_crash_nmi_local, NMI_FLAG_FIRST, c619422e77519d Mukesh Rathor 2025-09-23 597 "hv_crash_nmi"); c619422e77519d Mukesh Rathor 2025-09-23 598 if (rc) { c619422e77519d Mukesh Rathor 2025-09-23 599 pr_err("Hyper-V: failed to register crash nmi handler\n"); c619422e77519d Mukesh Rathor 2025-09-23 600 return; c619422e77519d Mukesh Rathor 2025-09-23 601 } c619422e77519d Mukesh Rathor 2025-09-23 602 c619422e77519d Mukesh Rathor 2025-09-23 603 local_irq_save(flags); c619422e77519d Mukesh Rathor 2025-09-23 604 input = *this_cpu_ptr(hyperv_pcpu_input_arg); c619422e77519d Mukesh Rathor 2025-09-23 605 output = *this_cpu_ptr(hyperv_pcpu_output_arg); c619422e77519d Mukesh Rathor 2025-09-23 606 c619422e77519d Mukesh Rathor 2025-09-23 607 memset(input, 0, sizeof(*input)); c619422e77519d Mukesh Rathor 2025-09-23 608 input->property_id = HV_SYSTEM_PROPERTY_CRASHDUMPAREA; c619422e77519d Mukesh Rathor 2025-09-23 609 c619422e77519d Mukesh Rathor 2025-09-23 610 status = hv_do_hypercall(HVCALL_GET_SYSTEM_PROPERTY, input, output); c619422e77519d Mukesh Rathor 2025-09-23 611 cda_info.as_uint64 = output->hv_cda_info.as_uint64; c619422e77519d Mukesh Rathor 2025-09-23 612 local_irq_restore(flags); c619422e77519d Mukesh Rathor 2025-09-23 613 c619422e77519d Mukesh Rathor 2025-09-23 614 if (!hv_result_success(status)) { c619422e77519d Mukesh Rathor 2025-09-23 615 pr_err("Hyper-V: %s: property:%d %s\n", __func__, c619422e77519d Mukesh Rathor 2025-09-23 616 input->property_id, hv_result_to_string(status)); c619422e77519d Mukesh Rathor 2025-09-23 617 goto err_out; c619422e77519d Mukesh Rathor 2025-09-23 618 } c619422e77519d Mukesh Rathor 2025-09-23 619 c619422e77519d Mukesh Rathor 2025-09-23 620 if (cda_info.base_pfn == 0) { c619422e77519d Mukesh Rathor 2025-09-23 621 pr_err("Hyper-V: hypervisor crash dump area pfn is 0\n"); c619422e77519d Mukesh Rathor 2025-09-23 622 goto err_out; c619422e77519d Mukesh Rathor 2025-09-23 623 } c619422e77519d Mukesh Rathor 2025-09-23 624 c619422e77519d Mukesh Rathor 2025-09-23 625 hv_cda = phys_to_virt(cda_info.base_pfn << HV_HYP_PAGE_SHIFT); c619422e77519d Mukesh Rathor 2025-09-23 626 c619422e77519d Mukesh Rathor 2025-09-23 627 rc = hv_crash_trampoline_setup(); c619422e77519d Mukesh Rathor 2025-09-23 628 if (rc) c619422e77519d Mukesh Rathor 2025-09-23 629 goto err_out; c619422e77519d Mukesh Rathor 2025-09-23 630 c619422e77519d Mukesh Rathor 2025-09-23 @631 smp_ops.crash_stop_other_cpus = hv_crash_stop_other_cpus; -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
© 2016 - 2025 Red Hat, Inc.