]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 31 Jan 2014 16:37:32 +0000 (08:37 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 31 Jan 2014 16:37:32 +0000 (08:37 -0800)
Pull more KVM updates from Paolo Bonzini:
 "Second batch of KVM updates.  Some minor x86 fixes, two s390 guest
  features that need some handling in the host, and all the PPC changes.

  The PPC changes include support for little-endian guests and
  enablement for new POWER8 features"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (45 commits)
  x86, kvm: correctly access the KVM_CPUID_FEATURES leaf at 0x40000101
  x86, kvm: cache the base of the KVM cpuid leaves
  kvm: x86: move KVM_CAP_HYPERV_TIME outside #ifdef
  KVM: PPC: Book3S PR: Cope with doorbell interrupts
  KVM: PPC: Book3S HV: Add software abort codes for transactional memory
  KVM: PPC: Book3S HV: Add new state for transactional memory
  powerpc/Kconfig: Make TM select VSX and VMX
  KVM: PPC: Book3S HV: Basic little-endian guest support
  KVM: PPC: Book3S HV: Add support for DABRX register on POWER7
  KVM: PPC: Book3S HV: Prepare for host using hypervisor doorbells
  KVM: PPC: Book3S HV: Handle new LPCR bits on POWER8
  KVM: PPC: Book3S HV: Handle guest using doorbells for IPIs
  KVM: PPC: Book3S HV: Consolidate code that checks reason for wake from nap
  KVM: PPC: Book3S HV: Implement architecture compatibility modes for POWER8
  KVM: PPC: Book3S HV: Add handler for HV facility unavailable
  KVM: PPC: Book3S HV: Flush the correct number of TLB sets on POWER8
  KVM: PPC: Book3S HV: Context-switch new POWER8 SPRs
  KVM: PPC: Book3S HV: Align physical and virtual CPU thread numbers
  KVM: PPC: Book3S HV: Don't set DABR on POWER8
  kvm/ppc: IRQ disabling cleanup
  ...

1  2 
arch/powerpc/Kconfig
arch/powerpc/include/asm/kvm_asm.h
arch/powerpc/include/asm/pgtable.h
arch/powerpc/include/asm/reg.h
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kvm/bookehv_interrupts.S
arch/x86/kernel/kvm.c

diff --combined arch/powerpc/Kconfig
index a5e5d2ec380b3b2500a0743242caca1b4f0d14b7,805420853ac1eed2ed6880532c27cafaa53a26f0..957bf344c0f533e4ebf0c6248b3ba02caf3d8595
@@@ -86,7 -86,6 +86,7 @@@ config PP
        bool
        default y
        select ARCH_MIGHT_HAVE_PC_PARPORT
 +      select ARCH_MIGHT_HAVE_PC_SERIO
        select BINFMT_ELF
        select OF
        select OF_EARLY_FLATTREE
        select OLD_SIGACTION if PPC32
        select HAVE_DEBUG_STACKOVERFLOW
        select HAVE_IRQ_EXIT_ON_IRQ_STACK
 +      select ARCH_USE_CMPXCHG_LOCKREF if PPC64
  
  config GENERIC_CSUM
        def_bool CPU_LITTLE_ENDIAN
@@@ -215,6 -213,9 +215,6 @@@ config DEFAULT_UIMAG
          Used to allow a board to specify it wants a uImage built by default
        default n
  
 -config REDBOOT
 -      bool
 -
  config ARCH_HIBERNATION_POSSIBLE
        bool
        default y
@@@ -342,6 -343,8 +342,8 @@@ config PPC_TRANSACTIONAL_ME
         bool "Transactional Memory support for POWERPC"
         depends on PPC_BOOK3S_64
         depends on SMP
+        select ALTIVEC
+        select VSX
         default n
         ---help---
           Support user-mode Transactional Memory on POWERPC.
@@@ -382,12 -385,6 +384,12 @@@ config ARCH_HAS_WALK_MEMOR
  config ARCH_ENABLE_MEMORY_HOTREMOVE
        def_bool y
  
 +config PPC64_SUPPORTS_MEMORY_FAILURE
 +      bool "Add support for memory hwpoison"
 +      depends on PPC_BOOK3S_64
 +      default "y" if PPC_POWERNV
 +      select ARCH_SUPPORTS_MEMORY_FAILURE
 +
  config KEXEC
        bool "kexec system call"
        depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP))
  config CRASH_DUMP
        bool "Build a kdump crash kernel"
        depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP)
 -      select RELOCATABLE if PPC64 || 44x
 -      select DYNAMIC_MEMSTART if FSL_BOOKE
 +      select RELOCATABLE if PPC64 || 44x || FSL_BOOKE
        help
          Build a kernel suitable for use as a kdump capture kernel.
          The same kernel binary can be used as production kernel and dump
@@@ -532,7 -530,6 +534,7 @@@ config PPC_16K_PAGE
  
  config PPC_64K_PAGES
        bool "64k page size" if 44x || PPC_STD_MMU_64 || PPC_BOOK3E_64
 +      depends on !PPC_FSL_BOOK3E
        select PPC_HAS_HASH_64K if PPC_STD_MMU_64
  
  config PPC_256K_PAGES
@@@ -799,7 -796,7 +801,7 @@@ config HAS_RAPIDI
        default n
  
  config RAPIDIO
 -      bool "RapidIO support"
 +      tristate "RapidIO support"
        depends on HAS_RAPIDIO || PCI
        help
          If you say Y here, the kernel will include drivers and
  
  config FSL_RIO
        bool "Freescale Embedded SRIO Controller support"
 -      depends on RAPIDIO && HAS_RAPIDIO
 +      depends on RAPIDIO = y && HAS_RAPIDIO
        default "n"
        ---help---
          Include support for RapidIO controller on Freescale embedded
@@@ -890,7 -887,7 +892,7 @@@ config DYNAMIC_MEMSTAR
  
  config RELOCATABLE
        bool "Build a relocatable kernel"
 -      depends on ADVANCED_OPTIONS && FLATMEM && 44x
 +      depends on ADVANCED_OPTIONS && FLATMEM && (44x || FSL_BOOKE)
        select NONSTATIC_KERNEL
        help
          This builds a kernel image that is capable of running at the
@@@ -1046,6 -1043,11 +1048,6 @@@ config KEYS_COMPA
  
  source "crypto/Kconfig"
  
 -config PPC_CLOCK
 -      bool
 -      default n
 -      select HAVE_CLK
 -
  config PPC_LIB_RHEAP
        bool
  
index 1503d8c7c41b9f139e9d69d60d4006ee35f8c3ca,8337c33c2eb346ccecd765f4a6a7b7215b23dae2..19eb74a95b592f8c41b2562d32244906debe0468
@@@ -74,7 -74,6 +74,7 @@@
  #define BOOKE_INTERRUPT_GUEST_DBELL_CRIT 39
  #define BOOKE_INTERRUPT_HV_SYSCALL 40
  #define BOOKE_INTERRUPT_HV_PRIV 41
 +#define BOOKE_INTERRUPT_LRAT_ERROR 42
  
  /* book3s */
  
  #define BOOK3S_INTERRUPT_FP_UNAVAIL   0x800
  #define BOOK3S_INTERRUPT_DECREMENTER  0x900
  #define BOOK3S_INTERRUPT_HV_DECREMENTER       0x980
+ #define BOOK3S_INTERRUPT_DOORBELL     0xa00
  #define BOOK3S_INTERRUPT_SYSCALL      0xc00
  #define BOOK3S_INTERRUPT_TRACE                0xd00
  #define BOOK3S_INTERRUPT_H_DATA_STORAGE       0xe00
  #define BOOK3S_INTERRUPT_H_INST_STORAGE       0xe20
  #define BOOK3S_INTERRUPT_H_EMUL_ASSIST        0xe40
+ #define BOOK3S_INTERRUPT_H_DOORBELL   0xe80
  #define BOOK3S_INTERRUPT_PERFMON      0xf00
  #define BOOK3S_INTERRUPT_ALTIVEC      0xf20
  #define BOOK3S_INTERRUPT_VSX          0xf40
+ #define BOOK3S_INTERRUPT_H_FAC_UNAVAIL        0xf80
  
  #define BOOK3S_IRQPRIO_SYSTEM_RESET           0
  #define BOOK3S_IRQPRIO_DATA_SEGMENT           1
index b999ca3189858e05b75c855de000003f3cafcbe6,b60ceb8d86c8feac6043e0b39ea49c15b1eeadad..f83b6f3e1b39b68c5b25f8df6a107f59bf20ae1b
@@@ -3,7 -3,6 +3,7 @@@
  #ifdef __KERNEL__
  
  #ifndef __ASSEMBLY__
 +#include <linux/mmdebug.h>
  #include <asm/processor.h>            /* For TASK_SIZE */
  #include <asm/mmu.h>
  #include <asm/page.h>
@@@ -34,73 -33,10 +34,73 @@@ static inline int pte_dirty(pte_t pte
  static inline int pte_young(pte_t pte)                { return pte_val(pte) & _PAGE_ACCESSED; }
  static inline int pte_file(pte_t pte)         { return pte_val(pte) & _PAGE_FILE; }
  static inline int pte_special(pte_t pte)      { return pte_val(pte) & _PAGE_SPECIAL; }
 -static inline int pte_present(pte_t pte)      { return pte_val(pte) & _PAGE_PRESENT; }
  static inline int pte_none(pte_t pte)         { return (pte_val(pte) & ~_PTE_NONE_MASK) == 0; }
  static inline pgprot_t pte_pgprot(pte_t pte)  { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); }
  
 +#ifdef CONFIG_NUMA_BALANCING
 +
 +static inline int pte_present(pte_t pte)
 +{
 +      return pte_val(pte) & (_PAGE_PRESENT | _PAGE_NUMA);
 +}
 +
 +#define pte_numa pte_numa
 +static inline int pte_numa(pte_t pte)
 +{
 +      return (pte_val(pte) &
 +              (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA;
 +}
 +
 +#define pte_mknonnuma pte_mknonnuma
 +static inline pte_t pte_mknonnuma(pte_t pte)
 +{
 +      pte_val(pte) &= ~_PAGE_NUMA;
 +      pte_val(pte) |=  _PAGE_PRESENT | _PAGE_ACCESSED;
 +      return pte;
 +}
 +
 +#define pte_mknuma pte_mknuma
 +static inline pte_t pte_mknuma(pte_t pte)
 +{
 +      /*
 +       * We should not set _PAGE_NUMA on non present ptes. Also clear the
 +       * present bit so that hash_page will return 1 and we collect this
 +       * as numa fault.
 +       */
 +      if (pte_present(pte)) {
 +              pte_val(pte) |= _PAGE_NUMA;
 +              pte_val(pte) &= ~_PAGE_PRESENT;
 +      } else
 +              VM_BUG_ON(1);
 +      return pte;
 +}
 +
 +#define pmd_numa pmd_numa
 +static inline int pmd_numa(pmd_t pmd)
 +{
 +      return pte_numa(pmd_pte(pmd));
 +}
 +
 +#define pmd_mknonnuma pmd_mknonnuma
 +static inline pmd_t pmd_mknonnuma(pmd_t pmd)
 +{
 +      return pte_pmd(pte_mknonnuma(pmd_pte(pmd)));
 +}
 +
 +#define pmd_mknuma pmd_mknuma
 +static inline pmd_t pmd_mknuma(pmd_t pmd)
 +{
 +      return pte_pmd(pte_mknuma(pmd_pte(pmd)));
 +}
 +
 +# else
 +
 +static inline int pte_present(pte_t pte)
 +{
 +      return pte_val(pte) & _PAGE_PRESENT;
 +}
 +#endif /* CONFIG_NUMA_BALANCING */
 +
  /* Conversion functions: convert a page and protection to a page entry,
   * and a page entry and page directory to the page they refer to.
   *
@@@ -287,6 -223,27 +287,27 @@@ extern int gup_hugepte(pte_t *ptep, uns
  #endif
  pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
                                 unsigned *shift);
+ static inline pte_t *lookup_linux_ptep(pgd_t *pgdir, unsigned long hva,
+                                    unsigned long *pte_sizep)
+ {
+       pte_t *ptep;
+       unsigned long ps = *pte_sizep;
+       unsigned int shift;
+       ptep = find_linux_pte_or_hugepte(pgdir, hva, &shift);
+       if (!ptep)
+               return NULL;
+       if (shift)
+               *pte_sizep = 1ul << shift;
+       else
+               *pte_sizep = PAGE_SIZE;
+       if (ps > *pte_sizep)
+               return NULL;
+       return ptep;
+ }
  #endif /* __ASSEMBLY__ */
  
  #endif /* __KERNEL__ */
index 62b114e079cff69f5f9d48a8a5e6af99dc6b76a1,6ba8d4af3999b8b700659ad5949905bf4bfe405c..90c06ec6eff51d9863db7be38ea3c748f2c98e38
  #define   CTRL_TE     0x00c00000      /* thread enable */
  #define   CTRL_RUNLATCH       0x1
  #define SPRN_DAWR     0xB4
+ #define SPRN_CIABR    0xBB
+ #define   CIABR_PRIV          0x3
+ #define   CIABR_PRIV_USER     1
+ #define   CIABR_PRIV_SUPER    2
+ #define   CIABR_PRIV_HYPER    3
  #define SPRN_DAWRX    0xBC
- #define   DAWRX_USER  (1UL << 0)
- #define   DAWRX_KERNEL        (1UL << 1)
- #define   DAWRX_HYP   (1UL << 2)
+ #define   DAWRX_USER  __MASK(0)
+ #define   DAWRX_KERNEL        __MASK(1)
+ #define   DAWRX_HYP   __MASK(2)
+ #define   DAWRX_WTI   __MASK(3)
+ #define   DAWRX_WT    __MASK(4)
+ #define   DAWRX_DR    __MASK(5)
+ #define   DAWRX_DW    __MASK(6)
  #define SPRN_DABR     0x3F5   /* Data Address Breakpoint Register */
  #define SPRN_DABR2    0x13D   /* e300 */
  #define SPRN_DABRX    0x3F7   /* Data Address Breakpoint Register Extension */
- #define   DABRX_USER  (1UL << 0)
- #define   DABRX_KERNEL        (1UL << 1)
- #define   DABRX_HYP   (1UL << 2)
- #define   DABRX_BTI   (1UL << 3)
+ #define   DABRX_USER  __MASK(0)
+ #define   DABRX_KERNEL        __MASK(1)
+ #define   DABRX_HYP   __MASK(2)
+ #define   DABRX_BTI   __MASK(3)
  #define   DABRX_ALL     (DABRX_BTI | DABRX_HYP | DABRX_KERNEL | DABRX_USER)
  #define SPRN_DAR      0x013   /* Data Address Register */
  #define SPRN_DBCR     0x136   /* e300 Data Breakpoint Control Reg */
  #define SPRN_HRMOR    0x139   /* Real mode offset register */
  #define SPRN_HSRR0    0x13A   /* Hypervisor Save/Restore 0 */
  #define SPRN_HSRR1    0x13B   /* Hypervisor Save/Restore 1 */
+ #define SPRN_IC               0x350   /* Virtual Instruction Count */
+ #define SPRN_VTB      0x351   /* Virtual Time Base */
  /* HFSCR and FSCR bit numbers are the same */
  #define FSCR_TAR_LG   8       /* Enable Target Address Register */
  #define FSCR_EBB_LG   7       /* Enable Event Based Branching */
  #define   LPCR_RMLS    0x1C000000      /* impl dependent rmo limit sel */
  #define         LPCR_RMLS_SH  (63-37)
  #define   LPCR_ILE     0x02000000      /* !HV irqs set MSR:LE */
+ #define   LPCR_AIL    0x01800000      /* Alternate interrupt location */
  #define   LPCR_AIL_0  0x00000000      /* MMU off exception offset 0x0 */
  #define   LPCR_AIL_3  0x01800000      /* MMU on exception offset 0xc00...4xxx */
- #define   LPCR_PECE   0x00007000      /* powersave exit cause enable */
+ #define   LPCR_ONL    0x00040000      /* online - PURR/SPURR count */
+ #define   LPCR_PECE   0x0001f000      /* powersave exit cause enable */
+ #define     LPCR_PECEDP       0x00010000      /* directed priv dbells cause exit */
+ #define     LPCR_PECEDH       0x00008000      /* directed hyp dbells cause exit */
  #define     LPCR_PECE0        0x00004000      /* ext. exceptions can cause exit */
  #define     LPCR_PECE1        0x00002000      /* decrementer can cause exit */
  #define     LPCR_PECE2        0x00001000      /* machine check etc can cause exit */
  #define SPRN_PCR      0x152   /* Processor compatibility register */
  #define   PCR_VEC_DIS (1ul << (63-0)) /* Vec. disable (bit NA since POWER8) */
  #define   PCR_VSX_DIS (1ul << (63-1)) /* VSX disable (bit NA since POWER8) */
+ #define   PCR_TM_DIS  (1ul << (63-2)) /* Trans. memory disable (POWER8) */
+ #define   PCR_ARCH_206        0x4             /* Architecture 2.06 */
  #define   PCR_ARCH_205        0x2             /* Architecture 2.05 */
  #define       SPRN_HEIR       0x153   /* Hypervisor Emulated Instruction Register */
  #define SPRN_TLBINDEXR        0x154   /* P7 TLB control register */
  #define DER_EBRKE     0x00000002      /* External Breakpoint Interrupt */
  #define DER_DPIE      0x00000001      /* Dev. Port Nonmaskable Request */
  #define SPRN_DMISS    0x3D0           /* Data TLB Miss Register */
+ #define SPRN_DHDES    0x0B1           /* Directed Hyp. Doorbell Exc. State */
+ #define SPRN_DPDES    0x0B0           /* Directed Priv. Doorbell Exc. State */
  #define SPRN_EAR      0x11A           /* External Address Register */
  #define SPRN_HASH1    0x3D2           /* Primary Hash Address Register */
  #define SPRN_HASH2    0x3D3           /* Secondary Hash Address Resgister */
  #define SPRN_IABR     0x3F2   /* Instruction Address Breakpoint Register */
  #define SPRN_IABR2    0x3FA           /* 83xx */
  #define SPRN_IBCR     0x135           /* 83xx Insn Breakpoint Control Reg */
+ #define SPRN_IAMR     0x03D           /* Instr. Authority Mask Reg */
  #define SPRN_HID4     0x3F4           /* 970 HID4 */
  #define  HID4_LPES0    (1ul << (63-0)) /* LPAR env. sel. bit 0 */
  #define        HID4_RMLS2_SH   (63 - 2)       /* Real mode limit bottom 2 bits */
  #define SPRN_PIR      0x3FF   /* Processor Identification Register */
  #endif
  #define SPRN_TIR      0x1BE   /* Thread Identification Register */
+ #define SPRN_PSPB     0x09F   /* Problem State Priority Boost reg */
  #define SPRN_PTEHI    0x3D5   /* 981 7450 PTE HI word (S/W TLB load) */
  #define SPRN_PTELO    0x3D6   /* 982 7450 PTE LO word (S/W TLB load) */
  #define SPRN_PURR     0x135   /* Processor Utilization of Resources Reg */
  #define SPRN_EBBHR    804     /* Event based branch handler register */
  #define SPRN_EBBRR    805     /* Event based branch return register */
  #define SPRN_BESCR    806     /* Branch event status and control register */
+ #define SPRN_WORT     895     /* Workload optimization register - thread */
  
  #define SPRN_PMC1     787
  #define SPRN_PMC2     788
  #define   SIER_SIHV           0x1000000       /* Sampled MSR_HV */
  #define   SIER_SIAR_VALID     0x0400000       /* SIAR contents valid */
  #define   SIER_SDAR_VALID     0x0200000       /* SDAR contents valid */
+ #define SPRN_TACR     888
+ #define SPRN_TCSCR    889
+ #define SPRN_CSIGR    890
+ #define SPRN_SPMC1    892
+ #define SPRN_SPMC2    893
  
  /* When EBB is enabled, some of MMCR0/MMCR2/SIER are user accessible */
  #define MMCR0_USER_MASK       (MMCR0_FC | MMCR0_PMXE | MMCR0_PMAO)
  #define PVR_8560      0x80200000
  #define PVR_VER_E500V1        0x8020
  #define PVR_VER_E500V2        0x8021
 +#define PVR_VER_E6500 0x8040
 +
  /*
   * For the 8xx processors, all of them report the same PVR family for
   * the PowerPC core. The various versions of these processors must be
index 8d1d94d9c64927f97eb6d301c195a4d879c6aa5b,29eb7c19ee384f97a3933356752d37393559a60a..b5aacf72ae6f5db492a374c93ad2b505558e81c5
@@@ -203,15 -203,6 +203,15 @@@ int main(void
        DEFINE(PACA_MC_STACK, offsetof(struct paca_struct, mc_kstack));
        DEFINE(PACA_CRIT_STACK, offsetof(struct paca_struct, crit_kstack));
        DEFINE(PACA_DBG_STACK, offsetof(struct paca_struct, dbg_kstack));
 +      DEFINE(PACA_TCD_PTR, offsetof(struct paca_struct, tcd_ptr));
 +
 +      DEFINE(TCD_ESEL_NEXT,
 +              offsetof(struct tlb_core_data, esel_next));
 +      DEFINE(TCD_ESEL_MAX,
 +              offsetof(struct tlb_core_data, esel_max));
 +      DEFINE(TCD_ESEL_FIRST,
 +              offsetof(struct tlb_core_data, esel_first));
 +      DEFINE(TCD_LOCK, offsetof(struct tlb_core_data, lock));
  #endif /* CONFIG_PPC_BOOK3E */
  
  #ifdef CONFIG_PPC_STD_MMU_64
        DEFINE(PACA_DTL_RIDX, offsetof(struct paca_struct, dtl_ridx));
  #endif /* CONFIG_PPC_STD_MMU_64 */
        DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp));
 +#ifdef CONFIG_PPC_BOOK3S_64
 +      DEFINE(PACAMCEMERGSP, offsetof(struct paca_struct, mc_emergency_sp));
 +      DEFINE(PACA_IN_MCE, offsetof(struct paca_struct, in_mce));
 +#endif
        DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
        DEFINE(PACAKEXECSTATE, offsetof(struct paca_struct, kexec_state));
        DEFINE(PACA_STARTTIME, offsetof(struct paca_struct, starttime));
        DEFINE(VCPU_GUEST_PID, offsetof(struct kvm_vcpu, arch.pid));
        DEFINE(VCPU_GPRS, offsetof(struct kvm_vcpu, arch.gpr));
        DEFINE(VCPU_VRSAVE, offsetof(struct kvm_vcpu, arch.vrsave));
-       DEFINE(VCPU_FPRS, offsetof(struct kvm_vcpu, arch.fpr));
-       DEFINE(VCPU_FPSCR, offsetof(struct kvm_vcpu, arch.fpscr));
+       DEFINE(VCPU_FPRS, offsetof(struct kvm_vcpu, arch.fp.fpr));
  #ifdef CONFIG_ALTIVEC
-       DEFINE(VCPU_VRS, offsetof(struct kvm_vcpu, arch.vr));
-       DEFINE(VCPU_VSCR, offsetof(struct kvm_vcpu, arch.vscr));
- #endif
- #ifdef CONFIG_VSX
-       DEFINE(VCPU_VSRS, offsetof(struct kvm_vcpu, arch.vsr));
+       DEFINE(VCPU_VRS, offsetof(struct kvm_vcpu, arch.vr.vr));
  #endif
        DEFINE(VCPU_XER, offsetof(struct kvm_vcpu, arch.xer));
        DEFINE(VCPU_CTR, offsetof(struct kvm_vcpu, arch.ctr));
        DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr));
+       DEFINE(VCPU_TAR, offsetof(struct kvm_vcpu, arch.tar));
        DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, arch.cr));
        DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc));
  #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
        DEFINE(VCPU_DAR, offsetof(struct kvm_vcpu, arch.shregs.dar));
        DEFINE(VCPU_VPA, offsetof(struct kvm_vcpu, arch.vpa.pinned_addr));
        DEFINE(VCPU_VPA_DIRTY, offsetof(struct kvm_vcpu, arch.vpa.dirty));
+       DEFINE(VCPU_INTR_MSR, offsetof(struct kvm_vcpu, arch.intr_msr));
  #endif
  #ifdef CONFIG_PPC_BOOK3S
        DEFINE(VCPU_VCPUID, offsetof(struct kvm_vcpu, vcpu_id));
        DEFINE(VCPU_PURR, offsetof(struct kvm_vcpu, arch.purr));
        DEFINE(VCPU_SPURR, offsetof(struct kvm_vcpu, arch.spurr));
+       DEFINE(VCPU_IC, offsetof(struct kvm_vcpu, arch.ic));
+       DEFINE(VCPU_VTB, offsetof(struct kvm_vcpu, arch.vtb));
        DEFINE(VCPU_DSCR, offsetof(struct kvm_vcpu, arch.dscr));
        DEFINE(VCPU_AMR, offsetof(struct kvm_vcpu, arch.amr));
        DEFINE(VCPU_UAMOR, offsetof(struct kvm_vcpu, arch.uamor));
+       DEFINE(VCPU_IAMR, offsetof(struct kvm_vcpu, arch.iamr));
        DEFINE(VCPU_CTRL, offsetof(struct kvm_vcpu, arch.ctrl));
        DEFINE(VCPU_DABR, offsetof(struct kvm_vcpu, arch.dabr));
+       DEFINE(VCPU_DABRX, offsetof(struct kvm_vcpu, arch.dabrx));
+       DEFINE(VCPU_DAWR, offsetof(struct kvm_vcpu, arch.dawr));
+       DEFINE(VCPU_DAWRX, offsetof(struct kvm_vcpu, arch.dawrx));
+       DEFINE(VCPU_CIABR, offsetof(struct kvm_vcpu, arch.ciabr));
        DEFINE(VCPU_HFLAGS, offsetof(struct kvm_vcpu, arch.hflags));
        DEFINE(VCPU_DEC, offsetof(struct kvm_vcpu, arch.dec));
        DEFINE(VCPU_DEC_EXPIRES, offsetof(struct kvm_vcpu, arch.dec_expires));
        DEFINE(VCPU_PRODDED, offsetof(struct kvm_vcpu, arch.prodded));
        DEFINE(VCPU_MMCR, offsetof(struct kvm_vcpu, arch.mmcr));
        DEFINE(VCPU_PMC, offsetof(struct kvm_vcpu, arch.pmc));
+       DEFINE(VCPU_SPMC, offsetof(struct kvm_vcpu, arch.spmc));
        DEFINE(VCPU_SIAR, offsetof(struct kvm_vcpu, arch.siar));
        DEFINE(VCPU_SDAR, offsetof(struct kvm_vcpu, arch.sdar));
+       DEFINE(VCPU_SIER, offsetof(struct kvm_vcpu, arch.sier));
        DEFINE(VCPU_SLB, offsetof(struct kvm_vcpu, arch.slb));
        DEFINE(VCPU_SLB_MAX, offsetof(struct kvm_vcpu, arch.slb_max));
        DEFINE(VCPU_SLB_NR, offsetof(struct kvm_vcpu, arch.slb_nr));
        DEFINE(VCPU_FAULT_DAR, offsetof(struct kvm_vcpu, arch.fault_dar));
        DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
        DEFINE(VCPU_TRAP, offsetof(struct kvm_vcpu, arch.trap));
-       DEFINE(VCPU_PTID, offsetof(struct kvm_vcpu, arch.ptid));
        DEFINE(VCPU_CFAR, offsetof(struct kvm_vcpu, arch.cfar));
        DEFINE(VCPU_PPR, offsetof(struct kvm_vcpu, arch.ppr));
+       DEFINE(VCPU_FSCR, offsetof(struct kvm_vcpu, arch.fscr));
+       DEFINE(VCPU_PSPB, offsetof(struct kvm_vcpu, arch.pspb));
+       DEFINE(VCPU_EBBHR, offsetof(struct kvm_vcpu, arch.ebbhr));
+       DEFINE(VCPU_EBBRR, offsetof(struct kvm_vcpu, arch.ebbrr));
+       DEFINE(VCPU_BESCR, offsetof(struct kvm_vcpu, arch.bescr));
+       DEFINE(VCPU_CSIGR, offsetof(struct kvm_vcpu, arch.csigr));
+       DEFINE(VCPU_TACR, offsetof(struct kvm_vcpu, arch.tacr));
+       DEFINE(VCPU_TCSCR, offsetof(struct kvm_vcpu, arch.tcscr));
+       DEFINE(VCPU_ACOP, offsetof(struct kvm_vcpu, arch.acop));
+       DEFINE(VCPU_WORT, offsetof(struct kvm_vcpu, arch.wort));
        DEFINE(VCPU_SHADOW_SRR1, offsetof(struct kvm_vcpu, arch.shadow_srr1));
        DEFINE(VCORE_ENTRY_EXIT, offsetof(struct kvmppc_vcore, entry_exit_count));
        DEFINE(VCORE_NAP_COUNT, offsetof(struct kvmppc_vcore, nap_count));
        DEFINE(VCORE_IN_GUEST, offsetof(struct kvmppc_vcore, in_guest));
        DEFINE(VCORE_NAPPING_THREADS, offsetof(struct kvmppc_vcore, napping_threads));
+       DEFINE(VCORE_KVM, offsetof(struct kvmppc_vcore, kvm));
        DEFINE(VCORE_TB_OFFSET, offsetof(struct kvmppc_vcore, tb_offset));
        DEFINE(VCORE_LPCR, offsetof(struct kvmppc_vcore, lpcr));
        DEFINE(VCORE_PCR, offsetof(struct kvmppc_vcore, pcr));
+       DEFINE(VCORE_DPDES, offsetof(struct kvmppc_vcore, dpdes));
        DEFINE(VCPU_SLB_E, offsetof(struct kvmppc_slb, orige));
        DEFINE(VCPU_SLB_V, offsetof(struct kvmppc_slb, origv));
        DEFINE(VCPU_SLB_SIZE, sizeof(struct kvmppc_slb));
+ #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
+       DEFINE(VCPU_TFHAR, offsetof(struct kvm_vcpu, arch.tfhar));
+       DEFINE(VCPU_TFIAR, offsetof(struct kvm_vcpu, arch.tfiar));
+       DEFINE(VCPU_TEXASR, offsetof(struct kvm_vcpu, arch.texasr));
+       DEFINE(VCPU_GPR_TM, offsetof(struct kvm_vcpu, arch.gpr_tm));
+       DEFINE(VCPU_FPRS_TM, offsetof(struct kvm_vcpu, arch.fp_tm.fpr));
+       DEFINE(VCPU_VRS_TM, offsetof(struct kvm_vcpu, arch.vr_tm.vr));
+       DEFINE(VCPU_VRSAVE_TM, offsetof(struct kvm_vcpu, arch.vrsave_tm));
+       DEFINE(VCPU_CR_TM, offsetof(struct kvm_vcpu, arch.cr_tm));
+       DEFINE(VCPU_LR_TM, offsetof(struct kvm_vcpu, arch.lr_tm));
+       DEFINE(VCPU_CTR_TM, offsetof(struct kvm_vcpu, arch.ctr_tm));
+       DEFINE(VCPU_AMR_TM, offsetof(struct kvm_vcpu, arch.amr_tm));
+       DEFINE(VCPU_PPR_TM, offsetof(struct kvm_vcpu, arch.ppr_tm));
+       DEFINE(VCPU_DSCR_TM, offsetof(struct kvm_vcpu, arch.dscr_tm));
+       DEFINE(VCPU_TAR_TM, offsetof(struct kvm_vcpu, arch.tar_tm));
+ #endif
  
  #ifdef CONFIG_PPC_BOOK3S_64
  #ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
        HSTATE_FIELD(HSTATE_XICS_PHYS, xics_phys);
        HSTATE_FIELD(HSTATE_SAVED_XIRR, saved_xirr);
        HSTATE_FIELD(HSTATE_HOST_IPI, host_ipi);
+       HSTATE_FIELD(HSTATE_PTID, ptid);
        HSTATE_FIELD(HSTATE_MMCR, host_mmcr);
        HSTATE_FIELD(HSTATE_PMC, host_pmc);
        HSTATE_FIELD(HSTATE_PURR, host_purr);
index a0d6929d867844f36cc61a8138b24c6be4362579,be3de1dd7bb3853eda9bef76016f01bfd7b8e494..e4185f6b3309af4cf51d5990f766647c88e9a5a2
@@@ -33,6 -33,8 +33,8 @@@
  
  #ifdef CONFIG_64BIT
  #include <asm/exception-64e.h>
+ #include <asm/hw_irq.h>
+ #include <asm/irqflags.h>
  #else
  #include "../kernel/head_booke.h" /* for THREAD_NORMSAVE() */
  #endif
@@@ -319,8 -321,6 +321,8 @@@ kvm_handler BOOKE_INTERRUPT_DEBUG, EX_P
        SPRN_DSRR0, SPRN_DSRR1, 0
  kvm_handler BOOKE_INTERRUPT_DEBUG, EX_PARAMS(CRIT), \
        SPRN_CSRR0, SPRN_CSRR1, 0
 +kvm_handler BOOKE_INTERRUPT_LRAT_ERROR, EX_PARAMS(GEN), \
 +      SPRN_SRR0, SPRN_SRR1, (NEED_EMU | NEED_DEAR | NEED_ESR)
  #else
  /*
   * For input register values, see arch/powerpc/include/asm/kvm_booke_hv_asm.h
@@@ -467,6 -467,15 +469,15 @@@ _GLOBAL(kvmppc_resume_host
        mtspr   SPRN_EPCR, r3
        isync
  
+ #ifdef CONFIG_64BIT
+       /*
+        * We enter with interrupts disabled in hardware, but
+        * we need to call RECONCILE_IRQ_STATE to ensure
+        * that the software state is kept in sync.
+        */
+       RECONCILE_IRQ_STATE(r3,r5)
+ #endif
        /* Switch to kernel stack and jump to handler. */
        PPC_LL  r3, HOST_RUN(r1)
        mr      r5, r14 /* intno */
diff --combined arch/x86/kernel/kvm.c
index cd1b362e4a237284a171900d7ab7389c428e335f,f81cadebcc0e64402ee6610a5dc0c57e715db5bf..713f1b3bad52a6478d65a153e986b4b533dff801
@@@ -500,6 -500,38 +500,38 @@@ void __init kvm_guest_init(void
  #endif
  }
  
+ static noinline uint32_t __kvm_cpuid_base(void)
+ {
+       if (boot_cpu_data.cpuid_level < 0)
+               return 0;       /* So we don't blow up on old processors */
+       if (cpu_has_hypervisor)
+               return hypervisor_cpuid_base("KVMKVMKVM\0\0\0", 0);
+       return 0;
+ }
+ static inline uint32_t kvm_cpuid_base(void)
+ {
+       static int kvm_cpuid_base = -1;
+       if (kvm_cpuid_base == -1)
+               kvm_cpuid_base = __kvm_cpuid_base();
+       return kvm_cpuid_base;
+ }
+ bool kvm_para_available(void)
+ {
+       return kvm_cpuid_base() != 0;
+ }
+ EXPORT_SYMBOL_GPL(kvm_para_available);
+ unsigned int kvm_arch_para_features(void)
+ {
+       return cpuid_eax(kvm_cpuid_base() | KVM_CPUID_FEATURES);
+ }
  static uint32_t __init kvm_detect(void)
  {
        return kvm_cpuid_base();
@@@ -673,7 -705,7 +705,7 @@@ static cpumask_t waiting_cpus
  /* Track spinlock on which a cpu is waiting */
  static DEFINE_PER_CPU(struct kvm_lock_waiting, klock_waiting);
  
 -static void kvm_lock_spinning(struct arch_spinlock *lock, __ticket_t want)
 +__visible void kvm_lock_spinning(struct arch_spinlock *lock, __ticket_t want)
  {
        struct kvm_lock_waiting *w;
        int cpu;