Skip to content

Commit ab7892b

Browse files
RuoqingHerbradford
authored andcommitted
riscv64: Disable KVM_ENABLE_CAP & KVM_G/SET_REGS
Disable `KVM_ENABLE_CAP`, `KVM_GET_REGS` and `KVM_SET_REGS`, and related ioctls, tests, doc tests on RISC-V 64-bit platform. Signed-off-by: Ruoqing He <[email protected]>
1 parent c2df5f6 commit ab7892b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/ioctls/vcpu.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl VcpuFd {
222222
/// let vcpu = vm.create_vcpu(0).unwrap();
223223
/// let regs = vcpu.get_regs().unwrap();
224224
/// ```
225-
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
225+
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64")))]
226226
pub fn get_regs(&self) -> Result<kvm_regs> {
227227
let mut regs = kvm_regs::default();
228228
// SAFETY: Safe because we know that our file is a vCPU fd, we know the kernel will only
@@ -338,7 +338,7 @@ impl VcpuFd {
338338
/// regs.rip = 0x100;
339339
/// vcpu.set_regs(&regs).unwrap();
340340
/// ```
341-
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
341+
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64")))]
342342
pub fn set_regs(&self, regs: &kvm_regs) -> Result<()> {
343343
// SAFETY: Safe because we know that our file is a vCPU fd, we know the kernel will only
344344
// read the correct amount of memory from our pointer, and we verify the return result.

src/ioctls/vm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ impl VmFd {
13761376
/// vm.enable_cap(&cap).unwrap();
13771377
/// }
13781378
/// ```
1379-
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
1379+
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64")))]
13801380
pub fn enable_cap(&self, cap: &kvm_enable_cap) -> Result<()> {
13811381
// SAFETY: The ioctl is safe because we allocated the struct and we know the
13821382
// kernel will write exactly the size of the struct.
@@ -2441,7 +2441,7 @@ mod tests {
24412441
}
24422442

24432443
#[test]
2444-
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
2444+
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64")))]
24452445
fn test_enable_cap_failure() {
24462446
let kvm = Kvm::new().unwrap();
24472447
let vm = kvm.create_vm().unwrap();

src/kvm_ioctls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ ioctl_ior_nr!(KVM_MEMORY_ENCRYPT_UNREG_REGION, KVMIO, 0xbc, kvm_enc_region);
139139
// Ioctls for VCPU fds.
140140

141141
ioctl_io_nr!(KVM_RUN, KVMIO, 0x80);
142-
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
142+
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64")))]
143143
ioctl_ior_nr!(KVM_GET_REGS, KVMIO, 0x81, kvm_regs);
144-
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
144+
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64")))]
145145
ioctl_iow_nr!(KVM_SET_REGS, KVMIO, 0x82, kvm_regs);
146146
#[cfg(any(
147147
target_arch = "x86",
@@ -248,7 +248,7 @@ ioctl_io_nr!(KVM_SET_TSC_KHZ, KVMIO, 0xa2);
248248
ioctl_io_nr!(KVM_GET_TSC_KHZ, KVMIO, 0xa3);
249249

250250
/* Available with KVM_CAP_ENABLE_CAP */
251-
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
251+
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64", target_arch = "riscv64")))]
252252
ioctl_iow_nr!(KVM_ENABLE_CAP, KVMIO, 0xa3, kvm_enable_cap);
253253
/* Available with KVM_CAP_SIGNAL_MSI */
254254
#[cfg(any(

0 commit comments

Comments
 (0)