diff --git a/hypervisor/src/kvm/mod.rs b/hypervisor/src/kvm/mod.rs index 11540a50d..2d6507ce2 100644 --- a/hypervisor/src/kvm/mod.rs +++ b/hypervisor/src/kvm/mod.rs @@ -562,10 +562,12 @@ struct KvmDirtyLogSlot { guest_memfd: u32, } -#[allow(dead_code)] struct KvmMemorySlot { + #[cfg_attr(not(feature = "sev_snp"), expect(dead_code))] guest_memfd: OwnedFd, + #[cfg_attr(not(feature = "sev_snp"), expect(dead_code))] guest_phys_addr: u64, + #[cfg_attr(not(feature = "sev_snp"), expect(dead_code))] memory_size: u64, } diff --git a/hypervisor/src/mshv/mod.rs b/hypervisor/src/mshv/mod.rs index c7725b4c8..0e9258d9c 100644 --- a/hypervisor/src/mshv/mod.rs +++ b/hypervisor/src/mshv/mod.rs @@ -439,7 +439,6 @@ unsafe impl Send for Ghcb {} unsafe impl Sync for Ghcb {} /// Vcpu struct for Microsoft Hypervisor -#[allow(dead_code)] pub struct MshvVcpu { fd: VcpuFd, vp_index: u8, @@ -448,6 +447,10 @@ pub struct MshvVcpu { #[cfg(target_arch = "x86_64")] msrs: Vec, vm_ops: Option>, + #[cfg_attr( + all(not(target_arch = "x86_64"), not(feature = "sev_snp")), + expect(dead_code) + )] vm_fd: Arc, #[cfg(feature = "sev_snp")] ghcb: Option,