summary refs log tree commit diff
path: root/src/linux.rs
diff options
context:
space:
mode:
authorSonny Rao <sonnyrao@chromium.org>2018-03-27 17:12:58 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-03-29 13:32:59 -0700
commit6ce158fb86b034c8a12bee4d65baba452ef42d6a (patch)
treed48c6a77d23078fd685bb42cb554a479e95a8c51 /src/linux.rs
parent62a4063aa6c28d1f73e93fd0e7da2135d4d46d02 (diff)
downloadcrosvm-6ce158fb86b034c8a12bee4d65baba452ef42d6a.tar
crosvm-6ce158fb86b034c8a12bee4d65baba452ef42d6a.tar.gz
crosvm-6ce158fb86b034c8a12bee4d65baba452ef42d6a.tar.bz2
crosvm-6ce158fb86b034c8a12bee4d65baba452ef42d6a.tar.lz
crosvm-6ce158fb86b034c8a12bee4d65baba452ef42d6a.tar.xz
crosvm-6ce158fb86b034c8a12bee4d65baba452ef42d6a.tar.zst
crosvm-6ce158fb86b034c8a12bee4d65baba452ef42d6a.zip
crosvm: support VM shutdown via SystemEvent
ARM systems don't have an exit event fd like x86, instead one of the Vcpus
will exit with the SystemEvent reason and put a code into the kvm run
union of either shutdown, reboot, or crash.  We currently don't handle
reboot or crash differently but can do so in the future.

BUG=chromium:797868
TEST=./build_test passes on all architectures
TEST=crosvm runs on kevin - manually test shutdown via maitred

Change-Id: I455cbe1ac653f61a1e9eae1ce22922d14cff4e3c
Reviewed-on: https://chromium-review.googlesource.com/982531
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'src/linux.rs')
-rw-r--r--src/linux.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/linux.rs b/src/linux.rs
index e599740..0ea188b 100644
--- a/src/linux.rs
+++ b/src/linux.rs
@@ -468,6 +468,9 @@ fn run_vcpu(vcpu: Vcpu,
                             }
                             VcpuExit::Hlt => break,
                             VcpuExit::Shutdown => break,
+                            VcpuExit::SystemEvent(_, _) =>
+                                //TODO handle reboot and crash events
+                                kill_signaled.store(true, Ordering::SeqCst),
                             r => warn!("unexpected vcpu exit: {:?}", r),
                         }
                     }