]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: PPC: Book3S 64: move bad_host_intr check to HV handler
authorNicholas Piggin <npiggin@gmail.com>
Fri, 28 May 2021 09:07:26 +0000 (19:07 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 10 Jun 2021 12:12:12 +0000 (22:12 +1000)
The bad_host_intr check will never be true with PR KVM, move
it to HV code.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210528090752.3542186-7-npiggin@gmail.com
arch/powerpc/kvm/book3s_64_entry.S
arch/powerpc/kvm/book3s_hv_rmhandlers.S
arch/powerpc/kvm/book3s_segment.S

index 2c9d106145e8e04aeb4cdd331917709d414c941c..66170ea85bc2a7ee157a94b2ee95bbd6a7a70aa2 100644 (file)
@@ -107,16 +107,12 @@ do_kvm_interrupt:
        beq-    .Lmaybe_skip
 .Lno_skip:
 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
-       cmpwi   r9,KVM_GUEST_MODE_HOST_HV
-       beq     kvmppc_bad_host_intr
 #ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
        cmpwi   r9,KVM_GUEST_MODE_GUEST
-       ld      r9,HSTATE_SCRATCH2(r13)
        beq     kvmppc_interrupt_pr
 #endif
        b       kvmppc_interrupt_hv
 #else
-       ld      r9,HSTATE_SCRATCH2(r13)
        b       kvmppc_interrupt_pr
 #endif
 
index a28b41b1bb38c8c4346833ffc0bd2ee86537ea71..a8abe79bcb995007824140ac461ac10ea2b62249 100644 (file)
@@ -1268,6 +1268,7 @@ hdec_soon:
 kvmppc_interrupt_hv:
        /*
         * Register contents:
+        * R9           = HSTATE_IN_GUEST
         * R12          = (guest CR << 32) | interrupt vector
         * R13          = PACA
         * guest R12 saved in shadow VCPU SCRATCH0
@@ -1275,6 +1276,8 @@ kvmppc_interrupt_hv:
         * guest R9 saved in HSTATE_SCRATCH2
         */
        /* We're now back in the host but in guest MMU context */
+       cmpwi   r9,KVM_GUEST_MODE_HOST_HV
+       beq     kvmppc_bad_host_intr
        li      r9, KVM_GUEST_MODE_HOST_HV
        stb     r9, HSTATE_IN_GUEST(r13)
 
@@ -3279,7 +3282,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_P9_TM_HV_ASSIST)
  * cfar is saved in HSTATE_CFAR(r13)
  * ppr is saved in HSTATE_PPR(r13)
  */
-.global kvmppc_bad_host_intr
 kvmppc_bad_host_intr:
        /*
         * Switch to the emergency stack, but start half-way down in
index 1f492aa4c8d6c561c6c508a1c6e6235dfcf053f8..202046a83fc1059f43039e000ef0a9630826d01a 100644 (file)
@@ -164,12 +164,15 @@ kvmppc_interrupt_pr:
        /* 64-bit entry. Register usage at this point:
         *
         * SPRG_SCRATCH0   = guest R13
+        * R9              = HSTATE_IN_GUEST
         * R12             = (guest CR << 32) | exit handler id
         * R13             = PACA
         * HSTATE.SCRATCH0 = guest R12
+        * HSTATE.SCRATCH2 = guest R9
         */
 #ifdef CONFIG_PPC64
        /* Match 32-bit entry */
+       ld      r9,HSTATE_SCRATCH2(r13)
        rotldi  r12, r12, 32              /* Flip R12 halves for stw */
        stw     r12, HSTATE_SCRATCH1(r13) /* CR is now in the low half */
        srdi    r12, r12, 32              /* shift trap into low half */