]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/kvm/booke_guest.c
SAM9 watchdog: update for moved headers
[linux-2.6-omap-h63xx.git] / arch / powerpc / kvm / booke_guest.c
index 6d9884a6884aa2379f68992738ec40baf141e0bc..7b2591e26bae3dc93dc7f002e833fd98de8288bb 100644 (file)
@@ -49,6 +49,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
        { "inst_emu",   VCPU_STAT(emulated_inst_exits) },
        { "dec",        VCPU_STAT(dec_exits) },
        { "ext_intr",   VCPU_STAT(ext_intr_exits) },
+       { "halt_wakeup", VCPU_STAT(halt_wakeup) },
        { NULL }
 };
 
@@ -226,39 +227,6 @@ void kvmppc_check_and_deliver_interrupts(struct kvm_vcpu *vcpu)
        }
 }
 
-static int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
-{
-       enum emulation_result er;
-       int r;
-
-       er = kvmppc_emulate_instruction(run, vcpu);
-       switch (er) {
-       case EMULATE_DONE:
-               /* Future optimization: only reload non-volatiles if they were
-                * actually modified. */
-               r = RESUME_GUEST_NV;
-               break;
-       case EMULATE_DO_MMIO:
-               run->exit_reason = KVM_EXIT_MMIO;
-               /* We must reload nonvolatiles because "update" load/store
-                * instructions modify register state. */
-               /* Future optimization: only reload non-volatiles if they were
-                * actually modified. */
-               r = RESUME_HOST_NV;
-               break;
-       case EMULATE_FAIL:
-               /* XXX Deliver Program interrupt to guest. */
-               printk(KERN_EMERG "%s: emulation failed (%08x)\n", __func__,
-                      vcpu->arch.last_inst);
-               r = RESUME_HOST;
-               break;
-       default:
-               BUG();
-       }
-
-       return r;
-}
-
 /**
  * kvmppc_handle_exit
  *
@@ -338,6 +306,11 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
                }
                break;
 
+       case BOOKE_INTERRUPT_FP_UNAVAIL:
+               kvmppc_queue_exception(vcpu, exit_nr);
+               r = RESUME_GUEST;
+               break;
+
        case BOOKE_INTERRUPT_DATA_STORAGE:
                vcpu->arch.dear = vcpu->arch.fault_dear;
                vcpu->arch.esr = vcpu->arch.fault_esr;
@@ -437,6 +410,21 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
                break;
        }
 
+       case BOOKE_INTERRUPT_DEBUG: {
+               u32 dbsr;
+
+               vcpu->arch.pc = mfspr(SPRN_CSRR0);
+
+               /* clear IAC events in DBSR register */
+               dbsr = mfspr(SPRN_DBSR);
+               dbsr &= DBSR_IAC1 | DBSR_IAC2 | DBSR_IAC3 | DBSR_IAC4;
+               mtspr(SPRN_DBSR, dbsr);
+
+               run->exit_reason = KVM_EXIT_DEBUG;
+               r = RESUME_HOST;
+               break;
+       }
+
        default:
                printk(KERN_EMERG "exit_nr %d\n", exit_nr);
                BUG();
@@ -498,6 +486,8 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
        vcpu->arch.msr = 0;
        vcpu->arch.gpr[1] = (16<<20) - 8; /* -8 for the callee-save LR slot */
 
+       vcpu->arch.shadow_pid = 1;
+
        /* Eye-catching number so we know if the guest takes an interrupt
         * before it's programmed its own IVPR. */
        vcpu->arch.ivpr = 0x55550000;