arm64: KVM: Switch vgic save/restore to alternative_insn
authorMarc Zyngier <marc.zyngier@arm.com>
Fri, 12 Jun 2015 11:06:37 +0000 (12:06 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 12 Jun 2015 14:12:08 +0000 (15:12 +0100)
So far, we configured the world-switch by having a small array
of pointers to the save and restore functions, depending on the
GIC used on the platform.

Loading these values each time is a bit silly (they never change),
and it makes sense to rely on the instruction patching instead.

This leads to a nice cleanup of the code.

Acked-by: Will Deacon <will.deacon@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm/include/asm/kvm_host.h
arch/arm64/include/asm/kvm_asm.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/kernel/asm-offsets.c
arch/arm64/kvm/hyp.S
virt/kvm/arm/vgic.c

index d71607c..e896d2c 100644 (file)
@@ -218,11 +218,6 @@ static inline int kvm_arch_dev_ioctl_check_extension(long ext)
        return 0;
 }
 
-static inline void vgic_arch_setup(const struct vgic_params *vgic)
-{
-       BUG_ON(vgic->type != VGIC_V2);
-}
-
 int kvm_perf_init(void);
 int kvm_perf_teardown(void);
 
index 4f7310f..d13bc5e 100644 (file)
@@ -132,11 +132,6 @@ extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
 
 extern u64 __vgic_v3_get_ich_vtr_el2(void);
 
-extern char __save_vgic_v2_state[];
-extern char __restore_vgic_v2_state[];
-extern char __save_vgic_v3_state[];
-extern char __restore_vgic_v3_state[];
-
 #endif
 
 #endif /* __ARM_KVM_ASM_H__ */
index f0f58c9..2709db2 100644 (file)
@@ -221,29 +221,6 @@ struct vgic_sr_vectors {
        void    *restore_vgic;
 };
 
-static inline void vgic_arch_setup(const struct vgic_params *vgic)
-{
-       extern struct vgic_sr_vectors __vgic_sr_vectors;
-
-       switch(vgic->type)
-       {
-       case VGIC_V2:
-               __vgic_sr_vectors.save_vgic     = __save_vgic_v2_state;
-               __vgic_sr_vectors.restore_vgic  = __restore_vgic_v2_state;
-               break;
-
-#ifdef CONFIG_ARM_GIC_V3
-       case VGIC_V3:
-               __vgic_sr_vectors.save_vgic     = __save_vgic_v3_state;
-               __vgic_sr_vectors.restore_vgic  = __restore_vgic_v3_state;
-               break;
-#endif
-
-       default:
-               BUG();
-       }
-}
-
 static inline void kvm_arch_hardware_disable(void) {}
 static inline void kvm_arch_hardware_unsetup(void) {}
 static inline void kvm_arch_sync_events(struct kvm *kvm) {}
Simple merge
Simple merge
Simple merge