mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-10-22 20:36:34 +00:00
kvm_sys: Move KVM_PVIOMMU_SET_CONFIG to lib.rs
Replace the ioctl definition using a magic number with the appropriate macro call. Note that this commit also limits the availability of the constant to AArch64 Android, the only builds using it as per the cfg attributes of KvmVfioPviommu::ioctl_kvm_pviommu_set_config(). TEST=m crosvm # in AOSP, then validated the constant using decompilation Change-Id: I6099a69419c5c562b0c5ce5b27ac3f24b73c9244 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5750141 Commit-Queue: Daniel Verkamp <dverkamp@chromium.org> Auto-Submit: Pierre-Clément Tosi <ptosi@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
3e44794a86
commit
20eee9bace
3 changed files with 6 additions and 3 deletions
|
@ -39,8 +39,7 @@ pub struct kvm_vfio_iommu_config {
|
|||
pub device_fd: i32,
|
||||
pub sid_idx: u32,
|
||||
pub vsid: u32,
|
||||
}
|
||||
pub const KVM_PVIOMMU_SET_CONFIG: i32 = 0xc00cae01u32 as i32;"
|
||||
}"
|
||||
|
||||
X86_64_EXTRAS="
|
||||
// This is how zerocopy's author deal with bindings for __BindgenBitfieldUnit<Storage>, see:
|
||||
|
|
|
@ -38,7 +38,6 @@ pub struct kvm_vfio_iommu_config {
|
|||
pub sid_idx: u32,
|
||||
pub vsid: u32,
|
||||
}
|
||||
pub const KVM_PVIOMMU_SET_CONFIG: i32 = 0xc00cae01u32 as i32;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -69,6 +69,8 @@ pub mod aarch64 {
|
|||
pub mod bindings;
|
||||
use base::ioctl_ior_nr;
|
||||
use base::ioctl_iow_nr;
|
||||
#[cfg(target_os = "android")]
|
||||
use base::ioctl_iowr_nr;
|
||||
pub use bindings::*;
|
||||
|
||||
ioctl_iow_nr!(KVM_ARM_SET_DEVICE_ADDR, KVMIO, 0xab, kvm_arm_device_addr);
|
||||
|
@ -80,6 +82,9 @@ pub mod aarch64 {
|
|||
0xb5,
|
||||
kvm_arm_counter_offset
|
||||
);
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
ioctl_iowr_nr!(KVM_PVIOMMU_SET_CONFIG, KVMIO, 0x1, kvm_vfio_iommu_config);
|
||||
}
|
||||
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
|
||||
pub use crate::aarch64::*;
|
||||
|
|
Loading…
Reference in a new issue