diff options
author | James Morse <james.morse@arm.com> | 2018-07-19 18:24:25 +0300 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2018-07-21 18:02:32 +0300 |
commit | b0960b9569db6b2fe8a75967d47b9dcdeb44016b (patch) | |
tree | 465340bda85cfe34f1d816e7e746b1e638e41f90 /arch/arm/kvm/guest.c | |
parent | 539aee0edb9fdc8f465e3843c261acc88c47d8ee (diff) | |
download | linux-b0960b9569db6b2fe8a75967d47b9dcdeb44016b.tar.xz |
KVM: arm: Add 32bit get/set events support
arm64's new use of KVMs get_events/set_events API calls isn't just
or RAS, it allows an SError that has been made pending by KVM as
part of its device emulation to be migrated.
Wire this up for 32bit too.
We only need to read/write the HCR_VA bit, and check that no esr has
been provided, as we don't yet support VDFSR.
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 'arch/arm/kvm/guest.c')
-rw-r--r-- | arch/arm/kvm/guest.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c index a18f33edc471..2b8de885b2bf 100644 --- a/arch/arm/kvm/guest.c +++ b/arch/arm/kvm/guest.c @@ -261,6 +261,29 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, return -EINVAL; } + +int __kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu, + struct kvm_vcpu_events *events) +{ + events->exception.serror_pending = !!(*vcpu_hcr(vcpu) & HCR_VA); + + return 0; +} + +int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu, + struct kvm_vcpu_events *events) +{ + bool serror_pending = events->exception.serror_pending; + bool has_esr = events->exception.serror_has_esr; + + if (serror_pending && has_esr) + return -EINVAL; + else if (serror_pending) + kvm_inject_vabt(vcpu); + + return 0; +} + int __attribute_const__ kvm_target_cpu(void) { switch (read_cpuid_part()) { |