Merge remote-tracking branch 'kvmarm/misc-5.5' into kvmarm/next
[platform/kernel/linux-starfive.git] / arch / arm64 / kvm / guest.c
index 260ea31..2fff061 100644 (file)
@@ -716,6 +716,12 @@ int __kvm_arm_vcpu_get_events(struct kvm_vcpu *vcpu,
        if (events->exception.serror_pending && events->exception.serror_has_esr)
                events->exception.serror_esr = vcpu_get_vsesr(vcpu);
 
+       /*
+        * We never return a pending ext_dabt here because we deliver it to
+        * the virtual CPU directly when setting the event and it's no longer
+        * 'pending' at this point.
+        */
+
        return 0;
 }
 
@@ -724,6 +730,7 @@ int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
 {
        bool serror_pending = events->exception.serror_pending;
        bool has_esr = events->exception.serror_has_esr;
+       bool ext_dabt_pending = events->exception.ext_dabt_pending;
 
        if (serror_pending && has_esr) {
                if (!cpus_have_const_cap(ARM64_HAS_RAS_EXTN))
@@ -737,6 +744,9 @@ int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
                kvm_inject_vabt(vcpu);
        }
 
+       if (ext_dabt_pending)
+               kvm_inject_dabt(vcpu, kvm_vcpu_get_hfar(vcpu));
+
        return 0;
 }
 
@@ -862,6 +872,9 @@ int kvm_arm_vcpu_arch_set_attr(struct kvm_vcpu *vcpu,
        case KVM_ARM_VCPU_TIMER_CTRL:
                ret = kvm_arm_timer_set_attr(vcpu, attr);
                break;
+       case KVM_ARM_VCPU_PVTIME_CTRL:
+               ret = kvm_arm_pvtime_set_attr(vcpu, attr);
+               break;
        default:
                ret = -ENXIO;
                break;
@@ -882,6 +895,9 @@ int kvm_arm_vcpu_arch_get_attr(struct kvm_vcpu *vcpu,
        case KVM_ARM_VCPU_TIMER_CTRL:
                ret = kvm_arm_timer_get_attr(vcpu, attr);
                break;
+       case KVM_ARM_VCPU_PVTIME_CTRL:
+               ret = kvm_arm_pvtime_get_attr(vcpu, attr);
+               break;
        default:
                ret = -ENXIO;
                break;
@@ -902,6 +918,9 @@ int kvm_arm_vcpu_arch_has_attr(struct kvm_vcpu *vcpu,
        case KVM_ARM_VCPU_TIMER_CTRL:
                ret = kvm_arm_timer_has_attr(vcpu, attr);
                break;
+       case KVM_ARM_VCPU_PVTIME_CTRL:
+               ret = kvm_arm_pvtime_has_attr(vcpu, attr);
+               break;
        default:
                ret = -ENXIO;
                break;