From 3d63706dee629d7595525340b6fefd355856603e Mon Sep 17 00:00:00 2001 From: Dylan Reid Date: Sun, 19 May 2019 15:06:26 -0700 Subject: [PATCH] linux: Wrap messages to vcpus in an enum This change will allow sending messages other than the run state to vcpus. Different messages will be used to interrigate and set the state of the vcpu from the debugger. BUG=chromium:1141812 TEST=run a VM Change-Id: Ied6c8b6ee5a037e5593087ca665a84fdb462c287 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2440220 Tested-by: Keiichi Watanabe Tested-by: kokoro Commit-Queue: Keiichi Watanabe Reviewed-by: Dylan Reid --- src/linux.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/linux.rs b/src/linux.rs index 84e2bf0af9..f6adce6cdf 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -300,6 +300,10 @@ enum TaggedControlSocket { VmMsync(VmMsyncResponseSocket), } +enum VcpuControl { + RunState(VmRunMode), +} + impl AsRef for TaggedControlSocket { fn as_ref(&self) -> &UnixSeqpacket { use self::TaggedControlSocket::*; @@ -1711,7 +1715,7 @@ fn run_vcpu( mmio_bus: devices::Bus, exit_evt: Event, requires_pvclock_ctrl: bool, - from_main_channel: mpsc::Receiver, + from_main_channel: mpsc::Receiver, use_hypervisor_signals: bool, ) -> Result> where @@ -1784,7 +1788,7 @@ where let mut messages = vec![msg]; messages.append(&mut from_main_channel.try_iter().collect()); - for new_mode in messages { + for VcpuControl::RunState(new_mode) in messages { run_mode = new_mode.clone(); match run_mode { VmRunMode::Running => break 'state_loop, @@ -2272,7 +2276,7 @@ fn run_control