aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorJames Morse <james.morse@arm.com>2018-07-19 11:24:24 -0400
committerMarc Zyngier <marc.zyngier@arm.com>2018-07-21 11:02:31 -0400
commit539aee0edb9fdc8f465e3843c261acc88c47d8ee (patch)
tree379427d3095a0421824b8434ae98d4800a773ddf /virt/kvm
parentbe26b3a73413c2ebf14d5e76a66ad964e6458080 (diff)
KVM: arm64: Share the parts of get/set events useful to 32bit
The get/set events helpers to do some work to check reserved and padding fields are zero. This is useful on 32bit too. Move this code into virt/kvm/arm/arm.c, and give the arch code some underscores. This is temporarily hidden behind __KVM_HAVE_VCPU_EVENTS until 32bit is wired up. Signed-off-by: James Morse <james.morse@arm.com> Reviewed-by: Dongjiu Geng <gengdongjiu@huawei.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/arm/arm.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
index 1c72247aeb1d..14f8fad1c7ae 100644
--- a/virt/kvm/arm/arm.c
+++ b/virt/kvm/arm/arm.c
@@ -1050,6 +1050,34 @@ static int kvm_arm_vcpu_has_attr(struct kvm_vcpu *vcpu,
1050 return ret; 1050 return ret;
1051} 1051}
1052 1052
1053#ifdef __KVM_HAVE_VCPU_EVENTS /* temporary: until 32bit is wired up */
1054static int kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu,
1055 struct kvm_vcpu_events *events)
1056{
1057 memset(events, 0, sizeof(*events));
1058
1059 return __kvm_arm_vcpu_get_events(vcpu, events);
1060}
1061
1062static int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
1063 struct kvm_vcpu_events *events)
1064{
1065 int i;
1066
1067 /* check whether the reserved field is zero */
1068 for (i = 0; i < ARRAY_SIZE(events->reserved); i++)
1069 if (events->reserved[i])
1070 return -EINVAL;
1071
1072 /* check whether the pad field is zero */
1073 for (i = 0; i < ARRAY_SIZE(events->exception.pad); i++)
1074 if (events->exception.pad[i])
1075 return -EINVAL;
1076
1077 return __kvm_arm_vcpu_set_events(vcpu, events);
1078}
1079#endif /* __KVM_HAVE_VCPU_EVENTS */
1080
1053long kvm_arch_vcpu_ioctl(struct file *filp, 1081long kvm_arch_vcpu_ioctl(struct file *filp,
1054 unsigned int ioctl, unsigned long arg) 1082 unsigned int ioctl, unsigned long arg)
1055{ 1083{