diff options
author | James Morse <james.morse@arm.com> | 2018-07-19 17:24:25 +0200 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2018-07-21 17:02:32 +0200 |
commit | b0960b9569db6b2fe8a75967d47b9dcdeb44016b (patch) | |
tree | 465340bda85cfe34f1d816e7e746b1e638e41f90 /arch/arm/kvm | |
parent | KVM: arm64: Share the parts of get/set events useful to 32bit (diff) | |
download | linux-b0960b9569db6b2fe8a75967d47b9dcdeb44016b.tar.xz linux-b0960b9569db6b2fe8a75967d47b9dcdeb44016b.zip |
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')
-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()) { |