]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/powerpc/kvm/book3s_xive_native.c
KVM: PPC: Book3S HV: Don't push XIVE context when not using XIVE device
[linux.git] / arch / powerpc / kvm / book3s_xive_native.c
index 5596c8ec221ac627a7e948feb8c9b422006b793d..11b91b46fc394efd3b23199a9aab2057111dc41f 100644 (file)
@@ -67,10 +67,7 @@ void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu)
        xc->valid = false;
        kvmppc_xive_disable_vcpu_interrupts(vcpu);
 
-       /* Disable the VP */
-       xive_native_disable_vp(xc->vp_id);
-
-       /* Free the queues & associated interrupts */
+       /* Free escalations */
        for (i = 0; i < KVMPPC_XIVE_Q_COUNT; i++) {
                /* Free the escalation irq */
                if (xc->esc_virq[i]) {
@@ -79,8 +76,16 @@ void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu)
                        kfree(xc->esc_virq_names[i]);
                        xc->esc_virq[i] = 0;
                }
+       }
+
+       /* Disable the VP */
+       xive_native_disable_vp(xc->vp_id);
+
+       /* Clear the cam word so guest entry won't try to push context */
+       vcpu->arch.xive_cam_word = 0;
 
-               /* Free the queue */
+       /* Free the queues */
+       for (i = 0; i < KVMPPC_XIVE_Q_COUNT; i++) {
                kvmppc_xive_native_cleanup_queue(vcpu, i);
        }
 
@@ -1090,9 +1095,9 @@ static int kvmppc_xive_native_create(struct kvm_device *dev, u32 type)
        xive->ops = &kvmppc_xive_native_ops;
 
        if (ret)
-               kfree(xive);
+               return ret;
 
-       return ret;
+       return 0;
 }
 
 /*