diff --git a/crates/vfio-ioctls/src/vfio_device.rs b/crates/vfio-ioctls/src/vfio_device.rs index fb14f23..5bb18e0 100644 --- a/crates/vfio-ioctls/src/vfio_device.rs +++ b/crates/vfio-ioctls/src/vfio_device.rs @@ -29,14 +29,14 @@ use kvm_bindings::{ }; #[cfg(all(feature = "kvm", not(test)))] use kvm_ioctls::DeviceFd as KvmDeviceFd; -#[cfg(all(feature = "mshv", target_arch = "x86_64", not(test)))] +#[cfg(all(feature = "mshv", not(test)))] use mshv_bindings::{ mshv_device_attr, MSHV_DEV_VFIO_GROUP, MSHV_DEV_VFIO_GROUP_ADD, MSHV_DEV_VFIO_GROUP_DEL, }; -#[cfg(all(feature = "mshv", target_arch = "x86_64", not(test)))] +#[cfg(all(feature = "mshv", not(test)))] use mshv_ioctls::DeviceFd as MshvDeviceFd; #[cfg(all( - any(feature = "kvm", all(feature = "mshv", target_arch = "x86_64")), + any(feature = "kvm", feature = "mshv"), not(test) ))] use std::os::unix::io::FromRawFd; @@ -45,7 +45,7 @@ use std::os::unix::io::FromRawFd; enum DeviceFdInner { #[cfg(all(feature = "kvm", not(test)))] Kvm(KvmDeviceFd), - #[cfg(all(feature = "mshv", target_arch = "x86_64", not(test)))] + #[cfg(all(feature = "mshv", not(test)))] Mshv(MshvDeviceFd), } @@ -69,12 +69,12 @@ impl VfioDeviceFd { } } /// Create an VfioDeviceFd from an MSHV DeviceFd - #[cfg(all(feature = "mshv", target_arch = "x86_64", not(test)))] + #[cfg(all(feature = "mshv", not(test)))] pub fn new_from_mshv(fd: MshvDeviceFd) -> Self { VfioDeviceFd(DeviceFdInner::Mshv(fd)) } /// Extract the MSHV DeviceFd from an VfioDeviceFd - #[cfg(all(feature = "mshv", target_arch = "x86_64", not(test)))] + #[cfg(all(feature = "mshv", not(test)))] pub fn to_mshv(self) -> Result { match self { VfioDeviceFd(DeviceFdInner::Mshv(fd)) => Ok(fd), @@ -84,7 +84,7 @@ impl VfioDeviceFd { } /// Try to duplicate an VfioDeviceFd #[cfg(all( - any(feature = "kvm", all(feature = "mshv", target_arch = "x86_64")), + any(feature = "kvm", feature = "mshv"), not(test) ))] pub fn try_clone(&self) -> Result { @@ -101,7 +101,7 @@ impl VfioDeviceFd { Ok(VfioDeviceFd(DeviceFdInner::Kvm(kvm_fd))) } } - #[cfg(all(feature = "mshv", target_arch = "x86_64"))] + #[cfg(feature = "mshv")] DeviceFdInner::Mshv(fd) => { // SAFETY: FFI call to libc let dup_fd = unsafe { libc::dup(fd.as_raw_fd()) }; @@ -243,7 +243,7 @@ impl VfioContainer { } // Add the new group object to the hypervisor driver. - #[cfg(any(feature = "kvm", all(feature = "mshv", target_arch = "x86_64")))] + #[cfg(any(feature = "kvm", feature = "mshv"))] if let Err(e) = self.device_add_group(&group) { let _ = vfio_syscall::unset_group_container(&group, self); return Err(e); @@ -264,7 +264,7 @@ impl VfioContainer { // - one reference cloned in VfioDevice.drop() and passed into here // - one reference held by the groups hashmap if Arc::strong_count(&group) == 3 { - #[cfg(any(feature = "kvm", all(feature = "mshv", target_arch = "x86_64")))] + #[cfg(any(feature = "kvm", feature = "mshv"))] match self.device_del_group(&group) { Ok(_) => {} Err(e) => { @@ -350,7 +350,7 @@ impl VfioContainer { } #[cfg(all( - any(feature = "kvm", all(feature = "mshv", target_arch = "x86_64")), + any(feature = "kvm", feature = "mshv"), not(test) ))] fn device_set_group(&self, group: &VfioGroup, add: bool) -> Result<()> { @@ -374,7 +374,7 @@ impl VfioContainer { fd.set_device_attr(&dev_attr) .map_err(VfioError::SetDeviceAttr) } - #[cfg(all(feature = "mshv", target_arch = "x86_64"))] + #[cfg(feature = "mshv")] DeviceFdInner::Mshv(fd) => { let flag = if add { MSHV_DEV_VFIO_GROUP_ADD @@ -403,7 +403,7 @@ impl VfioContainer { /// # Parameters /// * group: target VFIO group #[cfg(all( - any(feature = "kvm", all(feature = "mshv", target_arch = "x86_64")), + any(feature = "kvm", feature = "mshv"), not(test) ))] fn device_add_group(&self, group: &VfioGroup) -> Result<()> { @@ -417,7 +417,7 @@ impl VfioContainer { /// # Parameters /// * group: target VFIO group #[cfg(all( - any(feature = "kvm", all(feature = "mshv", target_arch = "x86_64")), + any(feature = "kvm", feature = "mshv"), not(test) ))] fn device_del_group(&self, group: &VfioGroup) -> Result<()> {