]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
plat/common: Add firecracker shutdown signal
authorAndrei Tudor TOPALÄ‚ (101668) <topala.andrei@gmail.com>
Thu, 14 Apr 2022 21:36:51 +0000 (00:36 +0300)
committerUnikraft <monkey@unikraft.io>
Mon, 8 May 2023 19:49:16 +0000 (19:49 +0000)
Firecracker emulates a PS/2 controller and detects attempted writes to
the CPU reset line.

Co-authored-by: Marco Schlumpp <marco@unikraft.io>
Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #760

plat/common/x86/cpu_native.c

index b7298a5a515bc18ad5adf46b4d6a9878a6912731..8c503e25228c58ecc3745d40489eed3ce546cd89 100644 (file)
@@ -48,6 +48,13 @@ unsigned long read_cr2(void)
 
 void system_off(void)
 {
+#ifdef CONFIG_KVM_VMM_FIRECRACKER
+       /* Trigger the reset line via the PS/2 controller. On firecracker
+        * this will shutdown the VM.
+        */
+       outb(0x64, 0xFE);
+#endif /* CONFIG_KVM_VMM_FIRECRACKER */
+
        /*
         * Perform an ACPI shutdown by writing (SLP_TYPa | SLP_EN) to PM1a_CNT.
         * Generally speaking, we'd have to jump through a lot of hoops to