From ced4bfe1db6867dc491c7433e39209f64a25bec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Cl=C3=A9ment=20Tosi?= Date: Wed, 17 Aug 2022 14:41:18 +0100 Subject: [PATCH] cmdline: run: Rename cmd.pvm_fw to its flag name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the variable clearer by renaming it to represent the information it holds i.e. the firmware file AND the fact that the VM is unprotected. And to avoid confusing it with cfg.pvm_fw and components.pvm_fw, which both actually hold the protected VM firmware (resp. path and image). Note: no functional change intended. BUG=b:243646855 TEST=build Change-Id: Ieabc2f05798c3a0e969348d6dbd9a87ffb3a8ad0 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867612 Commit-Queue: Pierre-Clément Tosi Tested-by: Pierre-Clément Tosi Reviewed-by: Daniel Verkamp --- src/crosvm/cmdline.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/crosvm/cmdline.rs b/src/crosvm/cmdline.rs index e7f28306c5..9dca2e16de 100644 --- a/src/crosvm/cmdline.rs +++ b/src/crosvm/cmdline.rs @@ -883,10 +883,6 @@ pub struct RunCommand { #[argh(switch)] /// enable virtio-pvclock. pub pvclock: bool, - // Must be `Some` iff `protected_vm == ProtectionType::UnprotectedWithFirmware`. - #[argh(option, long = "unprotected-vm-with-firmware", arg_name = "PATH")] - /// (EXPERIMENTAL/FOR DEBUGGING) Use VM firmware, but allow host access to guest memory - pub pvm_fw: Option, #[argh( option, arg_name = "PATH[,key=value[,key=value[,...]]", @@ -1103,6 +1099,10 @@ pub struct RunCommand { #[argh(option, arg_name = "NAME[,...]")] /// comma-separated names of the task profiles to apply to all threads in crosvm including the vCPU threads pub task_profiles: Vec, + // Must be `Some` iff `protected_vm == ProtectionType::UnprotectedWithFirmware`. + #[argh(option, long = "unprotected-vm-with-firmware", arg_name = "PATH")] + /// (EXPERIMENTAL/FOR DEBUGGING) Use VM firmware, but allow host access to guest memory + pub unprotected_vm_with_firmware: Option, #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[argh( option, @@ -1705,7 +1705,7 @@ impl TryFrom for super::config::Config { let protection_flags = [ cmd.protected_vm, cmd.protected_vm_without_firmware, - cmd.pvm_fw.is_some(), + cmd.unprotected_vm_with_firmware.is_some(), ]; if protection_flags.into_iter().filter(|b| *b).count() > 1 { @@ -1726,7 +1726,7 @@ impl TryFrom for super::config::Config { cfg.usb = false; // Protected VMs can't trust the RNG device, so don't provide it. cfg.rng = false; - } else if let Some(p) = cmd.pvm_fw { + } else if let Some(p) = cmd.unprotected_vm_with_firmware { if !p.exists() || !p.is_file() { return Err( "unprotected-vm-with-firmware path should be an existing file".to_string(),