From cd8c90fecf3848f5a916c720a365a96875b86a6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20L=C3=B3pez?= Date: Mon, 13 May 2024 10:14:55 +0200 Subject: [PATCH 1/2] gdbstub: fix a nightly clippy warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a leftover nightly clippy warning: error: this argument is a mutable reference, but not used mutably --> kernel/src/debug/gdbstub.rs:316:17 | 316 | fn read(&mut self) -> Result { | ^^^^^^^^^ help: consider changing to: `&self` | = note: this is cfg-gated and may require further changes = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut = note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_ref_mut)]` Signed-off-by: Carlos López --- kernel/src/debug/gdbstub.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/src/debug/gdbstub.rs b/kernel/src/debug/gdbstub.rs index 37d4ad79a..0459d4a47 100644 --- a/kernel/src/debug/gdbstub.rs +++ b/kernel/src/debug/gdbstub.rs @@ -313,7 +313,7 @@ pub mod svsm_gdbstub { Self {} } - fn read(&mut self) -> Result { + fn read(&self) -> Result { unsafe { Ok(GDB_SERIAL.get_byte()) } } } From 85e5a86d6d93bf95202b5349a8be233835db363a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20L=C3=B3pez?= Date: Mon, 13 May 2024 10:17:33 +0200 Subject: [PATCH 2/2] svsm: remove default-test feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This feature is not really needed, as we can detect if we're building tests via the "test" cfg. Signed-off-by: Carlos López --- Makefile | 6 ++++-- kernel/Cargo.toml | 1 - kernel/build.rs | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 47b67a012..2628f1395 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,10 @@ FEATURES ?= "default" SVSM_ARGS = --features ${FEATURES} -FEATURES_TEST ?= "default-test" -SVSM_ARGS_TEST = --no-default-features --features ${FEATURES_TEST} +SVSM_ARGS_TEST = --no-default-features +ifdef FEATURES_TEST + SVSM_ARGS_TEST += --features ${FEATURES_TEST} +endif ifdef RELEASE TARGET_PATH=release diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index 8e8c01267..b1f489ded 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -38,7 +38,6 @@ test.workspace = true [features] default = ["mstpm"] -default-test = [] enable-gdb = ["dep:gdbstub", "dep:gdbstub_arch"] mstpm = ["dep:libmstpm"] diff --git a/kernel/build.rs b/kernel/build.rs index 1f9ccb89b..2a43d34fb 100644 --- a/kernel/build.rs +++ b/kernel/build.rs @@ -21,9 +21,7 @@ fn main() { println!("cargo:rustc-link-arg-bin=svsm=--no-relax"); println!("cargo:rustc-link-arg-bin=svsm=-Tkernel/src/svsm.lds"); println!("cargo:rustc-link-arg-bin=svsm=-no-pie"); - if std::env::var("CARGO_FEATURE_MSTPM").is_ok() - && std::env::var("CARGO_FEATURE_DEFAULT_TEST").is_err() - { + if std::env::var("CARGO_FEATURE_MSTPM").is_ok() && std::env::var("CARGO_CFG_TEST").is_err() { println!("cargo:rustc-link-arg-bin=svsm=-Llibmstpm"); println!("cargo:rustc-link-arg-bin=svsm=-lmstpm"); }