OSDN Git Service

Merge tag 'kvm-arm-for-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm...
[uclinux-h8/linux.git] / arch / arm / kvm / interrupts_head.S
index 35e4a3a..702740d 100644 (file)
@@ -412,7 +412,6 @@ vcpu        .req    r0              @ vcpu pointer always in r0
        add     r11, vcpu, #VCPU_VGIC_CPU
 
        /* Save all interesting registers */
-       ldr     r3, [r2, #GICH_HCR]
        ldr     r4, [r2, #GICH_VMCR]
        ldr     r5, [r2, #GICH_MISR]
        ldr     r6, [r2, #GICH_EISR0]
@@ -420,7 +419,6 @@ vcpu        .req    r0              @ vcpu pointer always in r0
        ldr     r8, [r2, #GICH_ELRSR0]
        ldr     r9, [r2, #GICH_ELRSR1]
        ldr     r10, [r2, #GICH_APR]
-ARM_BE8(rev    r3, r3  )
 ARM_BE8(rev    r4, r4  )
 ARM_BE8(rev    r5, r5  )
 ARM_BE8(rev    r6, r6  )
@@ -429,7 +427,6 @@ ARM_BE8(rev r8, r8  )
 ARM_BE8(rev    r9, r9  )
 ARM_BE8(rev    r10, r10        )
 
-       str     r3, [r11, #VGIC_V2_CPU_HCR]
        str     r4, [r11, #VGIC_V2_CPU_VMCR]
        str     r5, [r11, #VGIC_V2_CPU_MISR]
 #ifdef CONFIG_CPU_ENDIAN_BE8
@@ -591,8 +588,13 @@ ARM_BE8(rev        r6, r6  )
 .endm
 
 /* Configures the HCPTR (Hyp Coprocessor Trap Register) on entry/return
- * (hardware reset value is 0). Keep previous value in r2. */
-.macro set_hcptr operation, mask
+ * (hardware reset value is 0). Keep previous value in r2.
+ * An ISB is emited on vmexit/vmtrap, but executed on vmexit only if
+ * VFP wasn't already enabled (always executed on vmtrap).
+ * If a label is specified with vmexit, it is branched to if VFP wasn't
+ * enabled.
+ */
+.macro set_hcptr operation, mask, label = none
        mrc     p15, 4, r2, c1, c1, 2
        ldr     r3, =\mask
        .if \operation == vmentry
@@ -601,6 +603,17 @@ ARM_BE8(rev        r6, r6  )
        bic     r3, r2, r3              @ Don't trap defined coproc-accesses
        .endif
        mcr     p15, 4, r3, c1, c1, 2
+       .if \operation != vmentry
+       .if \operation == vmexit
+       tst     r2, #(HCPTR_TCP(10) | HCPTR_TCP(11))
+       beq     1f
+       .endif
+       isb
+       .if \label != none
+       b       \label
+       .endif
+1:
+       .endif
 .endm
 
 /* Configures the HDCR (Hyp Debug Configuration Register) on entry/return