From 1849ffff313de07ca954541e273e49c6185dc4a6 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Fri, 16 Sep 2022 12:07:31 +0200 Subject: [PATCH] vmm: Remove "amx" feature gate Given the AMX x86 feature has been made available since kernel v5.17, and given we don't have any test validating this feature, there's no need to keep it behing a Rust feature gate. Fixes #3996 Signed-off-by: Sebastien Boeuf --- .github/workflows/build.yaml | 3 --- .github/workflows/quality.yaml | 3 --- Cargo.toml | 1 - vmm/Cargo.toml | 1 - vmm/src/config.rs | 4 ++-- vmm/src/cpu.rs | 4 ++-- 6 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 95f55794f..b679b8a04 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -42,9 +42,6 @@ jobs: - name: Build (default features + tdx) run: cargo rustc --locked --bin cloud-hypervisor --features "tdx" -- -D warnings - - name: Build (default features + amx) - run: cargo rustc --locked --bin cloud-hypervisor --features "amx" -- -D warnings - - name: Build (default features + gdb) run: cargo rustc --locked --bin cloud-hypervisor --features "gdb" -- -D warnings diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml index d4752ce24..dba274c6c 100644 --- a/.github/workflows/quality.yaml +++ b/.github/workflows/quality.yaml @@ -49,9 +49,6 @@ jobs: - name: Clippy (default features) run: cargo clippy --locked --all --all-targets --tests -- -D warnings - - name: Clippy (default features + amx) - run: cargo clippy --locked --all --all-targets --tests --features "amx" -- -D warnings - - name: Clippy (default features + gdb) run: cargo clippy --locked --all --all-targets --tests --features "gdb" -- -D warnings diff --git a/Cargo.toml b/Cargo.toml index a930a8cb5..50c597e94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,6 @@ wait-timeout = "0.2.0" default = ["common", "kvm"] # Common features for all hypervisors common = ["fwdebug"] -amx = ["vmm/amx"] cmos = ["vmm/cmos"] fwdebug = ["vmm/fwdebug"] gdb = ["vmm/gdb"] diff --git a/vmm/Cargo.toml b/vmm/Cargo.toml index ab33bb969..7af4ef0ad 100644 --- a/vmm/Cargo.toml +++ b/vmm/Cargo.toml @@ -6,7 +6,6 @@ edition = "2021" [features] default = [] -amx = [] cmos = ["devices/cmos"] fwdebug = ["devices/fwdebug"] gdb = ["kvm", "gdbstub", "gdbstub_arch"] diff --git a/vmm/src/config.rs b/vmm/src/config.rs index c2c3b2a85..2810c4ad4 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -472,7 +472,7 @@ pub struct CpuAffinity { #[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize)] pub struct CpuFeatures { - #[cfg(all(feature = "amx", target_arch = "x86_64"))] + #[cfg(target_arch = "x86_64")] #[serde(default)] pub amx: bool, } @@ -593,7 +593,7 @@ impl CpusConfig { let mut features = CpuFeatures::default(); for s in features_list.0 { match >::as_ref(&s) { - #[cfg(all(feature = "amx", target_arch = "x86_64"))] + #[cfg(target_arch = "x86_64")] "amx" => { features.amx = true; Ok(()) diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 36b9dcebf..5eadfc74e 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -161,7 +161,7 @@ pub enum Error { #[error("Error translating virtual address: {0}")] TranslateVirtualAddress(#[source] anyhow::Error), - #[cfg(all(feature = "amx", target_arch = "x86_64"))] + #[cfg(target_arch = "x86_64")] #[error("Error setting up AMX: {0}")] AmxEnable(#[source] anyhow::Error), } @@ -636,7 +636,7 @@ impl CpuManager { ) .map_err(Error::CommonCpuId)? }; - #[cfg(all(feature = "amx", target_arch = "x86_64"))] + #[cfg(target_arch = "x86_64")] if config.features.amx { const ARCH_GET_XCOMP_GUEST_PERM: usize = 0x1024; const ARCH_REQ_XCOMP_GUEST_PERM: usize = 0x1025;