Merge tag 'signed-for-3.13' of git://github.com/agraf/linux-2.6 into kvm-master
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 20 Dec 2013 18:13:58 +0000 (19:13 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 20 Dec 2013 18:13:58 +0000 (19:13 +0100)
Patch queue for 3.13 - 2013-12-18

This fixes some grave issues we've only found after 3.13-rc1:

  - Make the modularized HV/PR book3s kvm work well as modules
  - Fix some race conditions
  - Fix compilation with certain compilers (booke)
  - Fix THP for book3s_hv
  - Fix preemption for book3s_pr

Alexander Graf (4):
      KVM: PPC: Book3S: PR: Don't clobber our exit handler id
      KVM: PPC: Book3S: PR: Export kvmppc_copy_to|from_svcpu
      KVM: PPC: Book3S: PR: Make svcpu -> vcpu store preempt savvy
      KVM: PPC: Book3S: PR: Enable interrupts earlier

Aneesh Kumar K.V (1):
      powerpc: book3s: kvm: Don't abuse host r2 in exit path

Paul Mackerras (5):
      KVM: PPC: Book3S HV: Fix physical address calculations
      KVM: PPC: Book3S HV: Refine barriers in guest entry/exit
      KVM: PPC: Book3S HV: Make tbacct_lock irq-safe
      KVM: PPC: Book3S HV: Take SRCU read lock around kvm_read_guest() call
      KVM: PPC: Book3S HV: Don't drop low-order page address bits

Scott Wood (1):
      powerpc/kvm/booke: Fix build break due to stack frame size warning

pingfan liu (1):
      powerpc: kvm: fix rare but potential deadlock scene

1  2 
arch/powerpc/kernel/process.c

index 3386d8ab7eb0607b3c9d6f03e68824d4abe4bd88,83530af028b80abc428c9bbf7ec36fa83f31e1a1..4a96556fd2d49e484c143ed3643db6c8a24962df
@@@ -339,7 -339,7 +339,7 @@@ static void set_debug_reg_defaults(stru
  #endif
  }
  
- static void prime_debug_regs(struct thread_struct *thread)
+ static void prime_debug_regs(struct debug_reg *debug)
  {
        /*
         * We could have inherited MSR_DE from userspace, since
         */
        mtmsr(mfmsr() & ~MSR_DE);
  
-       mtspr(SPRN_IAC1, thread->debug.iac1);
-       mtspr(SPRN_IAC2, thread->debug.iac2);
+       mtspr(SPRN_IAC1, debug->iac1);
+       mtspr(SPRN_IAC2, debug->iac2);
  #if CONFIG_PPC_ADV_DEBUG_IACS > 2
-       mtspr(SPRN_IAC3, thread->debug.iac3);
-       mtspr(SPRN_IAC4, thread->debug.iac4);
+       mtspr(SPRN_IAC3, debug->iac3);
+       mtspr(SPRN_IAC4, debug->iac4);
  #endif
-       mtspr(SPRN_DAC1, thread->debug.dac1);
-       mtspr(SPRN_DAC2, thread->debug.dac2);
+       mtspr(SPRN_DAC1, debug->dac1);
+       mtspr(SPRN_DAC2, debug->dac2);
  #if CONFIG_PPC_ADV_DEBUG_DVCS > 0
-       mtspr(SPRN_DVC1, thread->debug.dvc1);
-       mtspr(SPRN_DVC2, thread->debug.dvc2);
+       mtspr(SPRN_DVC1, debug->dvc1);
+       mtspr(SPRN_DVC2, debug->dvc2);
  #endif
-       mtspr(SPRN_DBCR0, thread->debug.dbcr0);
-       mtspr(SPRN_DBCR1, thread->debug.dbcr1);
+       mtspr(SPRN_DBCR0, debug->dbcr0);
+       mtspr(SPRN_DBCR1, debug->dbcr1);
  #ifdef CONFIG_BOOKE
-       mtspr(SPRN_DBCR2, thread->debug.dbcr2);
+       mtspr(SPRN_DBCR2, debug->dbcr2);
  #endif
  }
  /*
   * debug registers, set the debug registers from the values
   * stored in the new thread.
   */
- void switch_booke_debug_regs(struct thread_struct *new_thread)
+ void switch_booke_debug_regs(struct debug_reg *new_debug)
  {
        if ((current->thread.debug.dbcr0 & DBCR0_IDM)
-               || (new_thread->debug.dbcr0 & DBCR0_IDM))
-                       prime_debug_regs(new_thread);
+               || (new_debug->dbcr0 & DBCR0_IDM))
+                       prime_debug_regs(new_debug);
  }
  EXPORT_SYMBOL_GPL(switch_booke_debug_regs);
  #else /* !CONFIG_PPC_ADV_DEBUG_REGS */
@@@ -683,7 -683,7 +683,7 @@@ struct task_struct *__switch_to(struct 
  #endif /* CONFIG_SMP */
  
  #ifdef CONFIG_PPC_ADV_DEBUG_REGS
-       switch_booke_debug_regs(&new->thread);
+       switch_booke_debug_regs(&new->thread.debug);
  #else
  /*
   * For PPC_BOOK3S_64, we use the hw-breakpoint interfaces that would
@@@ -858,21 -858,17 +858,21 @@@ void show_regs(struct pt_regs * regs
        printk("MSR: "REG" ", regs->msr);
        printbits(regs->msr, msr_bits);
        printk("  CR: %08lx  XER: %08lx\n", regs->ccr, regs->xer);
 -#ifdef CONFIG_PPC64
 -      printk("SOFTE: %ld\n", regs->softe);
 -#endif
        trap = TRAP(regs);
        if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR))
 -              printk("CFAR: "REG"\n", regs->orig_gpr3);
 -      if (trap == 0x300 || trap == 0x600)
 +              printk("CFAR: "REG" ", regs->orig_gpr3);
 +      if (trap == 0x200 || trap == 0x300 || trap == 0x600)
  #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
 -              printk("DEAR: "REG", ESR: "REG"\n", regs->dar, regs->dsisr);
 +              printk("DEAR: "REG" ESR: "REG" ", regs->dar, regs->dsisr);
  #else
 -              printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr);
 +              printk("DAR: "REG" DSISR: %08lx ", regs->dar, regs->dsisr);
 +#endif
 +#ifdef CONFIG_PPC64
 +      printk("SOFTE: %ld ", regs->softe);
 +#endif
 +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 +      if (MSR_TM_ACTIVE(regs->msr))
 +              printk("\nPACATMSCRATCH: %016llx ", get_paca()->tm_scratch);
  #endif
  
        for (i = 0;  i < 32;  i++) {
         */
        printk("NIP ["REG"] %pS\n", regs->nip, (void *)regs->nip);
        printk("LR ["REG"] %pS\n", regs->link, (void *)regs->link);
 -#endif
 -#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 -      printk("PACATMSCRATCH [%llx]\n", get_paca()->tm_scratch);
  #endif
        show_stack(current, (unsigned long *) regs->gpr[1]);
        if (!user_mode(regs))
@@@ -1087,45 -1086,25 +1087,45 @@@ void start_thread(struct pt_regs *regs
        regs->msr = MSR_USER;
  #else
        if (!is_32bit_task()) {
 -              unsigned long entry, toc;
 +              unsigned long entry;
  
 -              /* start is a relocated pointer to the function descriptor for
 -               * the elf _start routine.  The first entry in the function
 -               * descriptor is the entry address of _start and the second
 -               * entry is the TOC value we need to use.
 -               */
 -              __get_user(entry, (unsigned long __user *)start);
 -              __get_user(toc, (unsigned long __user *)start+1);
 +              if (is_elf2_task()) {
 +                      /* Look ma, no function descriptors! */
 +                      entry = start;
  
 -              /* Check whether the e_entry function descriptor entries
 -               * need to be relocated before we can use them.
 -               */
 -              if (load_addr != 0) {
 -                      entry += load_addr;
 -                      toc   += load_addr;
 +                      /*
 +                       * Ulrich says:
 +                       *   The latest iteration of the ABI requires that when
 +                       *   calling a function (at its global entry point),
 +                       *   the caller must ensure r12 holds the entry point
 +                       *   address (so that the function can quickly
 +                       *   establish addressability).
 +                       */
 +                      regs->gpr[12] = start;
 +                      /* Make sure that's restored on entry to userspace. */
 +                      set_thread_flag(TIF_RESTOREALL);
 +              } else {
 +                      unsigned long toc;
 +
 +                      /* start is a relocated pointer to the function
 +                       * descriptor for the elf _start routine.  The first
 +                       * entry in the function descriptor is the entry
 +                       * address of _start and the second entry is the TOC
 +                       * value we need to use.
 +                       */
 +                      __get_user(entry, (unsigned long __user *)start);
 +                      __get_user(toc, (unsigned long __user *)start+1);
 +
 +                      /* Check whether the e_entry function descriptor entries
 +                       * need to be relocated before we can use them.
 +                       */
 +                      if (load_addr != 0) {
 +                              entry += load_addr;
 +                              toc   += load_addr;
 +                      }
 +                      regs->gpr[2] = toc;
                }
                regs->nip = entry;
 -              regs->gpr[2] = toc;
                regs->msr = MSR_USER64;
        } else {
                regs->nip = start;