Merge branch 'kvm-ppc-next' of git://github.com/agraf/linux-2.6 into kvm-queue
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 29 Jan 2014 17:29:01 +0000 (18:29 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 29 Jan 2014 17:29:01 +0000 (18:29 +0100)
Conflicts:
arch/powerpc/kvm/book3s_hv_rmhandlers.S
arch/powerpc/kvm/booke.c

14 files changed:
1  2 
Documentation/virtual/kvm/api.txt
arch/powerpc/Kconfig
arch/powerpc/include/asm/kvm_book3s.h
arch/powerpc/include/asm/kvm_book3s_asm.h
arch/powerpc/include/asm/reg.h
arch/powerpc/include/asm/switch_to.h
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kvm/book3s_64_mmu_hv.c
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_hv_rm_mmu.c
arch/powerpc/kvm/book3s_hv_rmhandlers.S
arch/powerpc/kvm/book3s_pr.c
arch/powerpc/kvm/book3s_rmhandlers.S
arch/powerpc/kvm/booke.c

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index be4fa04a37c96d56d5f07d241395afe22e1627dd,dfa144cb199bb408d7df7b10d481383f924b3a44..e66d4ec04d953a78a314b43a3a07f47ca27f5ae7
@@@ -153,8 -160,71 +160,70 @@@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206
  
  13:   b       machine_check_fwnmi
  
 -
+ kvmppc_primary_no_guest:
+       /* We handle this much like a ceded vcpu */
+       /* set our bit in napping_threads */
+       ld      r5, HSTATE_KVM_VCORE(r13)
+       lbz     r7, HSTATE_PTID(r13)
+       li      r0, 1
+       sld     r0, r0, r7
+       addi    r6, r5, VCORE_NAPPING_THREADS
+ 1:    lwarx   r3, 0, r6
+       or      r3, r3, r0
+       stwcx.  r3, 0, r6
+       bne     1b
+       /* order napping_threads update vs testing entry_exit_count */
+       isync
+       li      r12, 0
+       lwz     r7, VCORE_ENTRY_EXIT(r5)
+       cmpwi   r7, 0x100
+       bge     kvm_novcpu_exit /* another thread already exiting */
+       li      r3, NAPPING_NOVCPU
+       stb     r3, HSTATE_NAPPING(r13)
+       li      r3, 1
+       stb     r3, HSTATE_HWTHREAD_REQ(r13)
+       b       kvm_do_nap
+ kvm_novcpu_wakeup:
+       ld      r1, HSTATE_HOST_R1(r13)
+       ld      r5, HSTATE_KVM_VCORE(r13)
+       li      r0, 0
+       stb     r0, HSTATE_NAPPING(r13)
+       stb     r0, HSTATE_HWTHREAD_REQ(r13)
+       /* check the wake reason */
+       bl      kvmppc_check_wake_reason
+       
+       /* see if any other thread is already exiting */
+       lwz     r0, VCORE_ENTRY_EXIT(r5)
+       cmpwi   r0, 0x100
+       bge     kvm_novcpu_exit
+       /* clear our bit in napping_threads */
+       lbz     r7, HSTATE_PTID(r13)
+       li      r0, 1
+       sld     r0, r0, r7
+       addi    r6, r5, VCORE_NAPPING_THREADS
+ 4:    lwarx   r7, 0, r6
+       andc    r7, r7, r0
+       stwcx.  r7, 0, r6
+       bne     4b
+       /* See if the wake reason means we need to exit */
+       cmpdi   r3, 0
+       bge     kvm_novcpu_exit
+       /* Got an IPI but other vcpus aren't yet exiting, must be a latecomer */
+       ld      r4, HSTATE_KVM_VCPU(r13)
+       cmpdi   r4, 0
+       bne     kvmppc_got_guest
+ kvm_novcpu_exit:
+       b       hdec_soon
  /*
-  * We come in here when wakened from nap mode on a secondary hw thread.
+  * We come in here when wakened from nap mode.
   * Relocation is off and most register values are lost.
   * r13 points to the PACA.
   */
@@@ -223,24 -278,7 +277,12 @@@ kvm_start_guest
        /* Clear our vcpu pointer so we don't come back in early */
        li      r0, 0
        std     r0, HSTATE_KVM_VCPU(r13)
 +      /*
 +       * Make sure we clear HSTATE_KVM_VCPU(r13) before incrementing
 +       * the nap_count, because once the increment to nap_count is
 +       * visible we could be given another vcpu.
 +       */
        lwsync
-       /* Clear any pending IPI - we're an offline thread */
-       ld      r5, HSTATE_XICS_PHYS(r13)
-       li      r7, XICS_XIRR
-       lwzcix  r3, r5, r7              /* ack any pending interrupt */
-       rlwinm. r0, r3, 0, 0xffffff     /* any pending? */
-       beq     37f
-       sync
-       li      r0, 0xff
-       li      r6, XICS_MFRR
-       stbcix  r0, r5, r6              /* clear the IPI */
-       stwcix  r3, r5, r7              /* EOI it */
- 37:   sync
  
        /* increment the nap count and then go to nap mode */
        ld      r4, HSTATE_KVM_VCORE(r13)
@@@ -1641,11 -1914,10 +1917,10 @@@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206
        bge     kvm_cede_exit
        stwcx.  r4,0,r6
        bne     31b
-       li      r0,1
 +      /* order napping_threads update vs testing entry_exit_count */
 +      isync
+       li      r0,NAPPING_CEDE
        stb     r0,HSTATE_NAPPING(r13)
-       mr      r4,r3
 -      /* order napping_threads update vs testing entry_exit_count */
 -      lwsync
        lwz     r7,VCORE_ENTRY_EXIT(r5)
        cmpwi   r7,0x100
        bge     33f             /* another thread already exiting */
Simple merge
Simple merge
index 0591e05db74b1a1a1f906af6a2a67cf9770320fa,07b89c711898974423d2e02a3a40fcb948d6e681..ab62109fdfa3f71a43701c7d08220db2cb826066
@@@ -681,11 -681,7 +681,7 @@@ int kvmppc_core_check_requests(struct k
  int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
  {
        int ret, s;
 -      struct thread_struct thread;
 +      struct debug_reg debug;
- #ifdef CONFIG_PPC_FPU
-       struct thread_fp_state fp;
-       int fpexc_mode;
- #endif
  
        if (!vcpu->arch.sane) {
                kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
  #endif
  
        /* Switch to guest debug context */
 -      thread.debug = vcpu->arch.shadow_dbg_reg;
 -      switch_booke_debug_regs(&thread);
 -      thread.debug = current->thread.debug;
 +      debug = vcpu->arch.shadow_dbg_reg;
 +      switch_booke_debug_regs(&debug);
 +      debug = current->thread.debug;
        current->thread.debug = vcpu->arch.shadow_dbg_reg;
  
+       vcpu->arch.pgdir = current->mm->pgd;
        kvmppc_fix_ee_before_entry();
  
        ret = __kvmppc_vcpu_run(kvm_run, vcpu);