summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorDongjiu Geng <gengdongjiu@huawei.com>2018-07-19 16:24:22 +0100
committerMarc Zyngier <marc.zyngier@arm.com>2018-07-21 16:02:30 +0100
commitb7b27facc7b50a5fce0afaa3df56157136ce181a (patch)
tree16536d93e55ccbdc8561c78ffab9d69966859c61 /virt
parent327432c2469e0069679009886556d15eeddeb0cc (diff)
downloadlinux-b7b27facc7b50a5fce0afaa3df56157136ce181a.tar.bz2
arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS
For the migrating VMs, user space may need to know the exception state. For example, in the machine A, KVM make an SError pending, when migrate to B, KVM also needs to pend an SError. This new IOCTL exports user-invisible states related to SError. Together with appropriate user space changes, user space can get/set the SError exception state to do migrate/snapshot/suspend. Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com> Reviewed-by: James Morse <james.morse@arm.com> [expanded documentation wording] Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/arm.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
index 8e66b89a3db2..1c72247aeb1d 100644
--- a/virt/kvm/arm/arm.c
+++ b/virt/kvm/arm/arm.c
@@ -1130,6 +1130,27 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
r = kvm_arm_vcpu_has_attr(vcpu, &attr);
break;
}
+#ifdef __KVM_HAVE_VCPU_EVENTS
+ case KVM_GET_VCPU_EVENTS: {
+ struct kvm_vcpu_events events;
+
+ if (kvm_arm_vcpu_get_events(vcpu, &events))
+ return -EINVAL;
+
+ if (copy_to_user(argp, &events, sizeof(events)))
+ return -EFAULT;
+
+ return 0;
+ }
+ case KVM_SET_VCPU_EVENTS: {
+ struct kvm_vcpu_events events;
+
+ if (copy_from_user(&events, argp, sizeof(events)))
+ return -EFAULT;
+
+ return kvm_arm_vcpu_set_events(vcpu, &events);
+ }
+#endif
default:
r = -EINVAL;
}