arm64: KVM: Switch vgic save/restore to alternative_insn
[deliverable/linux.git] / arch / arm64 / kvm / hyp.S
index 5befd010e23255c151999334daf9336912b4b664..f1f6d902b772489e0907ecb26c62c01a2e1bacc1 100644 (file)
 
 #include <linux/linkage.h>
 
+#include <asm/alternative.h>
 #include <asm/asm-offsets.h>
 #include <asm/assembler.h>
+#include <asm/cpufeature.h>
 #include <asm/debug-monitors.h>
 #include <asm/esr.h>
 #include <asm/fpsimdmacros.h>
  * Call into the vgic backend for state saving
  */
 .macro save_vgic_state
-       adr     x24, __vgic_sr_vectors
-       ldr     x24, [x24, VGIC_SAVE_FN]
-       kern_hyp_va     x24
-       blr     x24
+       alternative_insn "bl __save_vgic_v2_state", "bl __save_vgic_v3_state", ARM64_HAS_SYSREG_GIC_CPUIF
        mrs     x24, hcr_el2
        mov     x25, #HCR_INT_OVERRIDE
        neg     x25, x25
        orr     x24, x24, #HCR_INT_OVERRIDE
        orr     x24, x24, x25
        msr     hcr_el2, x24
-       adr     x24, __vgic_sr_vectors
-       ldr     x24, [x24, #VGIC_RESTORE_FN]
-       kern_hyp_va     x24
-       blr     x24
+       alternative_insn "bl __restore_vgic_v2_state", "bl __restore_vgic_v3_state", ARM64_HAS_SYSREG_GIC_CPUIF
 .endm
 
 .macro save_timer_state
@@ -1062,12 +1058,6 @@ ENTRY(__kvm_flush_vm_context)
        ret
 ENDPROC(__kvm_flush_vm_context)
 
-       // struct vgic_sr_vectors __vgi_sr_vectors;
-       .align 3
-ENTRY(__vgic_sr_vectors)
-       .skip   VGIC_SR_VECTOR_SZ
-ENDPROC(__vgic_sr_vectors)
-
 __kvm_hyp_panic:
        // Guess the context by looking at VTTBR:
        // If zero, then we're already a host.
This page took 0.02643 seconds and 5 git commands to generate.