Skip to content
This repository was archived by the owner on Nov 6, 2024. It is now read-only.

Commit 86231e3

Browse files
RuoqingHerbradford
authored andcommitted
arm: Drop arm architecture support
As @roypat pointed out: KVM on ARM32 hosts were dropped since v5.7 [1], dropping `target_arch = "arm"` predicates to stop supporting ARM 32-bit architecture. [1] https://www.phoronix.com/news/Linux-5.7-Kill-32-bit-ARM-KVM Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
1 parent e8932c5 commit 86231e3

File tree

5 files changed

+49
-77
lines changed

5 files changed

+49
-77
lines changed

src/cap.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,7 @@ pub enum Cap {
4141
Iommu = KVM_CAP_IOMMU,
4242
DestroyMemoryRegionWorks = KVM_CAP_DESTROY_MEMORY_REGION_WORKS,
4343
UserNmi = KVM_CAP_USER_NMI,
44-
#[cfg(any(
45-
target_arch = "x86_64",
46-
target_arch = "arm",
47-
target_arch = "aarch64",
48-
target_arch = "s390x"
49-
))]
44+
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "s390x"))]
5045
SetGuestDebug = KVM_CAP_SET_GUEST_DEBUG,
5146
#[cfg(target_arch = "x86_64")]
5247
ReinjectControl = KVM_CAP_REINJECT_CONTROL,
@@ -68,7 +63,7 @@ pub enum Cap {
6863
XenHvm = KVM_CAP_XEN_HVM,
6964
AdjustClock = KVM_CAP_ADJUST_CLOCK,
7065
InternalErrorData = KVM_CAP_INTERNAL_ERROR_DATA,
71-
#[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))]
66+
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
7267
VcpuEvents = KVM_CAP_VCPU_EVENTS,
7368
S390Psw = KVM_CAP_S390_PSW,
7469
PpcSegstate = KVM_CAP_PPC_SEGSTATE,
@@ -155,9 +150,9 @@ pub enum Cap {
155150
CoalescedPio = KVM_CAP_COALESCED_PIO,
156151
#[cfg(target_arch = "aarch64")]
157152
ArmSve = KVM_CAP_ARM_SVE,
158-
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
153+
#[cfg(target_arch = "aarch64")]
159154
ArmPtrAuthAddress = KVM_CAP_ARM_PTRAUTH_ADDRESS,
160-
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
155+
#[cfg(target_arch = "aarch64")]
161156
ArmPtrAuthGeneric = KVM_CAP_ARM_PTRAUTH_GENERIC,
162157
#[cfg(target_arch = "x86_64")]
163158
X86UserSpaceMsr = KVM_CAP_X86_USER_SPACE_MSR,

src/ioctls/vcpu.rs

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use vmm_sys_util::ioctl::{ioctl, ioctl_with_mut_ref, ioctl_with_ref};
2020
use vmm_sys_util::ioctl::{ioctl_with_mut_ptr, ioctl_with_ptr, ioctl_with_val};
2121

2222
/// Helper method to obtain the size of the register through its id
23-
#[cfg(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64"))]
23+
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
2424
pub fn reg_size(reg_id: u64) -> usize {
2525
2_usize.pow(((reg_id & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT) as u32)
2626
}
@@ -224,7 +224,7 @@ impl VcpuFd {
224224
/// let vcpu = vm.create_vcpu(0).unwrap();
225225
/// let regs = vcpu.get_regs().unwrap();
226226
/// ```
227-
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64")))]
227+
#[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))]
228228
pub fn get_regs(&self) -> Result<kvm_regs> {
229229
let mut regs = kvm_regs::default();
230230
// SAFETY: Safe because we know that our file is a vCPU fd, we know the kernel will only
@@ -340,7 +340,7 @@ impl VcpuFd {
340340
/// regs.rip = 0x100;
341341
/// vcpu.set_regs(&regs).unwrap();
342342
/// ```
343-
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64")))]
343+
#[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))]
344344
pub fn set_regs(&self, regs: &kvm_regs) -> Result<()> {
345345
// SAFETY: Safe because we know that our file is a vCPU fd, we know the kernel will only
346346
// read the correct amount of memory from our pointer, and we verify the return result.
@@ -788,7 +788,6 @@ impl VcpuFd {
788788
/// ```
789789
#[cfg(any(
790790
target_arch = "x86_64",
791-
target_arch = "arm",
792791
target_arch = "aarch64",
793792
target_arch = "riscv64",
794793
target_arch = "s390x"
@@ -826,7 +825,6 @@ impl VcpuFd {
826825
/// ```
827826
#[cfg(any(
828827
target_arch = "x86_64",
829-
target_arch = "arm",
830828
target_arch = "aarch64",
831829
target_arch = "riscv64",
832830
target_arch = "s390x"
@@ -1045,7 +1043,7 @@ impl VcpuFd {
10451043
/// let vcpu_events = vcpu.get_vcpu_events().unwrap();
10461044
/// }
10471045
/// ```
1048-
#[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))]
1046+
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
10491047
pub fn get_vcpu_events(&self) -> Result<kvm_vcpu_events> {
10501048
let mut vcpu_events = Default::default();
10511049
// SAFETY: Here we trust the kernel not to read past the end of the kvm_vcpu_events struct.
@@ -1079,7 +1077,7 @@ impl VcpuFd {
10791077
/// vcpu.set_vcpu_events(&vcpu_events).unwrap();
10801078
/// }
10811079
/// ```
1082-
#[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))]
1080+
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
10831081
pub fn set_vcpu_events(&self, vcpu_events: &kvm_vcpu_events) -> Result<()> {
10841082
// SAFETY: Here we trust the kernel not to read past the end of the kvm_vcpu_events struct.
10851083
let ret = unsafe { ioctl_with_ref(self, KVM_SET_VCPU_EVENTS(), vcpu_events) };
@@ -1115,7 +1113,7 @@ impl VcpuFd {
11151113
/// vm.get_preferred_target(&mut kvi).unwrap();
11161114
/// vcpu.vcpu_init(&kvi).unwrap();
11171115
/// ```
1118-
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
1116+
#[cfg(target_arch = "aarch64")]
11191117
pub fn vcpu_init(&self, kvi: &kvm_vcpu_init) -> Result<()> {
11201118
// SAFETY: This is safe because we allocated the struct and we know the kernel will read
11211119
// exactly the size of the struct.
@@ -1203,7 +1201,7 @@ impl VcpuFd {
12031201
/// let vcpu = vm.create_vcpu(0).unwrap();
12041202
///
12051203
/// // KVM_GET_REG_LIST on Aarch64 demands that the vcpus be initialized.
1206-
/// #[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
1204+
/// #[cfg(target_arch = "aarch64")]
12071205
/// {
12081206
/// let mut kvi: kvm_bindings::kvm_vcpu_init = kvm_bindings::kvm_vcpu_init::default();
12091207
/// vm.get_preferred_target(&mut kvi).unwrap();
@@ -1214,7 +1212,7 @@ impl VcpuFd {
12141212
/// assert!(reg_list.as_fam_struct_ref().n > 0);
12151213
/// }
12161214
/// ```
1217-
#[cfg(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64"))]
1215+
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
12181216
pub fn get_reg_list(&self, reg_list: &mut RegList) -> Result<()> {
12191217
let ret =
12201218
// SAFETY: This is safe because we allocated the struct and we trust the kernel will read
@@ -1291,7 +1289,7 @@ impl VcpuFd {
12911289
///
12921290
/// `data` should be equal or bigger then the register size
12931291
/// oterwise function will return EINVAL error
1294-
#[cfg(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64"))]
1292+
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
12951293
pub fn set_one_reg(&self, reg_id: u64, data: &[u8]) -> Result<usize> {
12961294
let reg_size = reg_size(reg_id);
12971295
if data.len() < reg_size {
@@ -1323,7 +1321,7 @@ impl VcpuFd {
13231321
///
13241322
/// `data` should be equal or bigger then the register size
13251323
/// oterwise function will return EINVAL error
1326-
#[cfg(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64"))]
1324+
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
13271325
pub fn get_one_reg(&self, reg_id: u64, data: &mut [u8]) -> Result<usize> {
13281326
let reg_size = reg_size(reg_id);
13291327
if data.len() < reg_size {
@@ -1965,7 +1963,7 @@ mod tests {
19651963
extern crate byteorder;
19661964

19671965
use super::*;
1968-
#[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))]
1966+
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
19691967
use crate::cap::Cap;
19701968
use crate::ioctls::system::Kvm;
19711969
use std::ptr::NonNull;
@@ -2212,7 +2210,6 @@ mod tests {
22122210

22132211
#[cfg(any(
22142212
target_arch = "x86_64",
2215-
target_arch = "arm",
22162213
target_arch = "aarch64",
22172214
target_arch = "riscv64",
22182215
target_arch = "s390x"
@@ -2264,7 +2261,7 @@ mod tests {
22642261
assert_eq!(debugregs, other_debugregs);
22652262
}
22662263

2267-
#[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))]
2264+
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
22682265
#[test]
22692266
fn vcpu_events_test() {
22702267
let kvm = Kvm::new().unwrap();
@@ -2606,7 +2603,6 @@ mod tests {
26062603
#[test]
26072604
#[cfg(any(
26082605
target_arch = "x86_64",
2609-
target_arch = "arm",
26102606
target_arch = "aarch64",
26112607
target_arch = "riscv64"
26122608
))]
@@ -2635,12 +2631,12 @@ mod tests {
26352631
.errno(),
26362632
badf_errno
26372633
);
2638-
#[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))]
2634+
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
26392635
assert_eq!(
26402636
faulty_vcpu_fd.get_vcpu_events().unwrap_err().errno(),
26412637
badf_errno
26422638
);
2643-
#[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))]
2639+
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
26442640
assert_eq!(
26452641
faulty_vcpu_fd
26462642
.set_vcpu_events(&kvm_vcpu_events::default())
@@ -2924,7 +2920,7 @@ mod tests {
29242920
}
29252921

29262922
#[test]
2927-
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
2923+
#[cfg(target_arch = "aarch64")]
29282924
fn test_get_preferred_target() {
29292925
let kvm = Kvm::new().unwrap();
29302926
let vm = kvm.create_vm().unwrap();
@@ -2938,7 +2934,7 @@ mod tests {
29382934
}
29392935

29402936
#[test]
2941-
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
2937+
#[cfg(target_arch = "aarch64")]
29422938
fn test_set_one_reg() {
29432939
let kvm = Kvm::new().unwrap();
29442940
let vm = kvm.create_vm().unwrap();
@@ -2964,7 +2960,7 @@ mod tests {
29642960
}
29652961

29662962
#[test]
2967-
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
2963+
#[cfg(target_arch = "aarch64")]
29682964
fn test_get_one_reg() {
29692965
let kvm = Kvm::new().unwrap();
29702966
let vm = kvm.create_vm().unwrap();
@@ -3000,7 +2996,7 @@ mod tests {
30002996
}
30012997

30022998
#[test]
3003-
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
2999+
#[cfg(target_arch = "aarch64")]
30043000
fn test_get_reg_list() {
30053001
let kvm = Kvm::new().unwrap();
30063002
let vm = kvm.create_vm().unwrap();

0 commit comments

Comments
 (0)