[PATCH hyperv-next 2/2] x86/hyperv: VTL mode callback for restarting the system

Roman Kisel posted 2 patches 1 year ago
There is a newer version of this series
[PATCH hyperv-next 2/2] x86/hyperv: VTL mode callback for restarting the system
Posted by Roman Kisel 1 year ago
The kernel runs as a firmware in the VTL mode, and the only way
to restart on x86 is to triple fault. Thus, one has to always
supply "reboot=t" on the kernel command line, and missing that
renders rebooting not working.

Define the machine restart callback to always use the triple
fault to provide the robust configuration by default.

Cc: stable@vger.kernel.org
Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
---
 arch/x86/hyperv/hv_vtl.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c
index 8931fc186a5f..eb402362d738 100644
--- a/arch/x86/hyperv/hv_vtl.c
+++ b/arch/x86/hyperv/hv_vtl.c
@@ -44,6 +44,12 @@ static void  __noreturn hv_vtl_emergency_restart(void)
 	}
 }
 
+/* The only way to restart is triple fault */
+static void  __noreturn hv_vtl_restart(char *)
+{
+	hv_vtl_emergency_restart();
+}
+
 void __init hv_vtl_init_platform(void)
 {
 	pr_info("Linux runs in Hyper-V Virtual Trust Level\n");
@@ -269,6 +275,7 @@ int __init hv_vtl_early_init(void)
 	apic_update_callback(wakeup_secondary_cpu_64, hv_vtl_wakeup_secondary_cpu);
 
 	machine_ops.emergency_restart = hv_vtl_emergency_restart;
+	machine_ops.restart = hv_vtl_restart;
 
 	return 0;
 }
-- 
2.34.1
Re: [PATCH hyperv-next 2/2] x86/hyperv: VTL mode callback for restarting the system
Posted by kernel test robot 1 year ago
Hi Roman,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 2e03358be78b65d28b66e17aca9e0c8700b0df78]

url:    https://github.com/intel-lab-lkp/linux/commits/Roman-Kisel/x86-hyperv-VTL-mode-emergency-restart-callback/20250118-050923
base:   2e03358be78b65d28b66e17aca9e0c8700b0df78
patch link:    https://lore.kernel.org/r/20250117210702.1529580-3-romank%40linux.microsoft.com
patch subject: [PATCH hyperv-next 2/2] x86/hyperv: VTL mode callback for restarting the system
config: x86_64-buildonly-randconfig-003-20250118 (https://download.01.org/0day-ci/archive/20250118/202501182304.lZJpR7pL-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250118/202501182304.lZJpR7pL-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/202501182304.lZJpR7pL-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> arch/x86/hyperv/hv_vtl.c:48:46: warning: omitting the parameter name in a function definition is a C23 extension [-Wc23-extensions]
      48 | static void  __noreturn hv_vtl_restart(char *)
         |                                              ^
   1 warning generated.


vim +48 arch/x86/hyperv/hv_vtl.c

    46	
    47	/* The only way to restart is triple fault */
  > 48	static void  __noreturn hv_vtl_restart(char *)
    49	{
    50		hv_vtl_emergency_restart();
    51	}
    52	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki