From f1f02e7144a5cb4b87b3b5bbd1fac5fc5a71fd11 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Wed, 3 Jun 2026 14:34:53 +0200 Subject: [PATCH] vmm: remove unneeded #[allow(dead_code)] On-behalf-of: SAP philipp.schuster@sap.com Signed-off-by: Philipp Schuster --- vmm/src/acpi.rs | 17 +++-------------- vmm/src/cpu.rs | 13 ++----------- vmm/src/igvm/mod.rs | 1 - vmm/src/interrupt.rs | 4 ---- 4 files changed, 5 insertions(+), 30 deletions(-) diff --git a/vmm/src/acpi.rs b/vmm/src/acpi.rs index 5809f5ead..ebbc14eca 100644 --- a/vmm/src/acpi.rs +++ b/vmm/src/acpi.rs @@ -49,7 +49,6 @@ pub const ACPI_RISC_V_IMSIC: u8 = 0x19; #[cfg(target_arch = "riscv64")] pub const ACPI_RISC_V_APLIC: u8 = 0x1A; -#[allow(dead_code)] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct PciRangeEntry { @@ -60,7 +59,6 @@ struct PciRangeEntry { _reserved: u32, } -#[allow(dead_code)] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct MemoryAffinity { @@ -77,7 +75,7 @@ struct MemoryAffinity { _reserved3: u64, } -#[allow(dead_code)] +#[cfg(target_arch = "x86_64")] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct ProcessorLocalX2ApicAffinity { @@ -91,7 +89,7 @@ struct ProcessorLocalX2ApicAffinity { _reserved2: u32, } -#[allow(dead_code)] +#[cfg(target_arch = "aarch64")] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct ProcessorGiccAffinity { @@ -112,7 +110,6 @@ struct ProcessorGiccAffinity { // // Note: Some older Linux kernel versions may incorrectly expect // device_handle_type=0 for PCI devices. -#[allow(dead_code)] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct GenericInitiatorAffinity { @@ -127,7 +124,7 @@ struct GenericInitiatorAffinity { } impl GenericInitiatorAffinity { - #[allow(dead_code)] + #[cfg(test)] fn from_acpi_device(hid: u64, uid: u32, proximity_domain: u32) -> Self { let mut device_handle = [0u8; 16]; // ACPI 6.6 Table 5-66: ACPI device handle @@ -228,7 +225,6 @@ impl MemoryAffinity { } } -#[allow(dead_code)] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct ViotVirtioPciNode { @@ -240,7 +236,6 @@ struct ViotVirtioPciNode { _reserved2: [u8; 8], } -#[allow(dead_code)] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct ViotPciRangeNode { @@ -608,7 +603,6 @@ fn create_dbg2_table(base_address: u64) -> Sdt { } #[cfg(target_arch = "aarch64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct IortBodyBase { @@ -618,7 +612,6 @@ struct IortBodyBase { } #[cfg(target_arch = "aarch64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct IortNodeCommon { @@ -631,7 +624,6 @@ struct IortNodeCommon { } #[cfg(target_arch = "aarch64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct IortIdMapping { @@ -643,7 +635,6 @@ struct IortIdMapping { } #[cfg(target_arch = "aarch64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct IortMemoryAccessProperties { @@ -654,7 +645,6 @@ struct IortMemoryAccessProperties { } #[cfg(target_arch = "aarch64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct IortItsGroupBase { @@ -664,7 +654,6 @@ struct IortItsGroupBase { } #[cfg(target_arch = "aarch64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct IortPciRootComplexBase { diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index e7a6056e8..74c798bef 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -317,7 +317,6 @@ fn core_scheduling_cookie() -> u64 { } #[cfg(target_arch = "x86_64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(IntoBytes, Immutable, FromBytes)] struct LocalX2Apic { @@ -329,7 +328,7 @@ struct LocalX2Apic { pub processor_id: u32, } -#[allow(dead_code)] +#[cfg(target_arch = "x86_64")] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct Ioapic { @@ -342,7 +341,6 @@ struct Ioapic { } #[cfg(target_arch = "aarch64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(IntoBytes, Immutable, FromBytes)] struct GicC { @@ -367,7 +365,6 @@ struct GicC { } #[cfg(target_arch = "aarch64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(IntoBytes, Immutable, FromBytes)] struct GicD { @@ -382,7 +379,6 @@ struct GicD { } #[cfg(target_arch = "aarch64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(IntoBytes, Immutable, FromBytes)] struct GicMsiFrame { @@ -397,7 +393,6 @@ struct GicMsiFrame { } #[cfg(target_arch = "aarch64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(IntoBytes, Immutable, FromBytes)] struct GicR { @@ -409,7 +404,6 @@ struct GicR { } #[cfg(target_arch = "aarch64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(IntoBytes, Immutable, FromBytes)] struct GicIts { @@ -422,7 +416,6 @@ struct GicIts { } #[cfg(target_arch = "aarch64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(IntoBytes, Immutable, FromBytes)] struct ProcessorHierarchyNode { @@ -436,7 +429,6 @@ struct ProcessorHierarchyNode { } #[cfg(target_arch = "riscv64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(IntoBytes, Immutable, FromBytes)] struct Imsic { @@ -456,7 +448,6 @@ struct Imsic { } #[cfg(target_arch = "riscv64")] -#[allow(dead_code)] #[repr(C, packed)] #[derive(IntoBytes, Immutable, FromBytes)] struct Aplic { @@ -476,7 +467,7 @@ struct Aplic { pub aplic_size: u32, } -#[allow(dead_code)] +#[cfg(target_arch = "x86_64")] #[repr(C, packed)] #[derive(Default, IntoBytes, Immutable, FromBytes)] struct InterruptSourceOverride { diff --git a/vmm/src/igvm/mod.rs b/vmm/src/igvm/mod.rs index 5065adf4e..698916637 100644 --- a/vmm/src/igvm/mod.rs +++ b/vmm/src/igvm/mod.rs @@ -84,7 +84,6 @@ pub enum BootPageAcceptance { /// The startup memory type used to notify a well behaved host that memory should be present before attempting to /// start the guest. -#[allow(dead_code)] #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum StartupMemoryType { /// The range is normal memory. diff --git a/vmm/src/interrupt.rs b/vmm/src/interrupt.rs index bf9957823..498ac96c0 100644 --- a/vmm/src/interrupt.rs +++ b/vmm/src/interrupt.rs @@ -124,10 +124,6 @@ impl InterruptRoute { ) } - // This is currently not used, but the upcoming vhost-guest feature - // will use it. Use #[allow(dead_code)] to suppress a compiler - // warning. - #[allow(dead_code)] fn set_notifier(&mut self, eventfd: Option, vm: &dyn hypervisor::Vm) -> Result<()> { let old_irqfd = core::mem::replace(&mut self.irq_fd, eventfd); if self.registered {