switch.c (4efc0ede4f31d7ec25c3dee0c8f07f93735cee6d) | switch.c (1460b4b25fde52cbee746c11a4b1d3185f2e2847) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) 2015 - ARM Ltd 4 * Author: Marc Zyngier <marc.zyngier@arm.com> 5 */ 6 7#include <hyp/switch.h> 8 --- 77 unchanged lines hidden (view full) --- 86} 87NOKPROBE_SYMBOL(__deactivate_traps); 88 89void activate_traps_vhe_load(struct kvm_vcpu *vcpu) 90{ 91 __activate_traps_common(vcpu); 92} 93 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) 2015 - ARM Ltd 4 * Author: Marc Zyngier <marc.zyngier@arm.com> 5 */ 6 7#include <hyp/switch.h> 8 --- 77 unchanged lines hidden (view full) --- 86} 87NOKPROBE_SYMBOL(__deactivate_traps); 88 89void activate_traps_vhe_load(struct kvm_vcpu *vcpu) 90{ 91 __activate_traps_common(vcpu); 92} 93 |
94void deactivate_traps_vhe_put(void) | 94void deactivate_traps_vhe_put(struct kvm_vcpu *vcpu) |
95{ | 95{ |
96 u64 mdcr_el2 = read_sysreg(mdcr_el2); | 96 vcpu->arch.mdcr_el2_host &= MDCR_EL2_HPMN_MASK | 97 MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT | 98 MDCR_EL2_TPMS; |
97 | 99 |
98 mdcr_el2 &= MDCR_EL2_HPMN_MASK | 99 MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT | 100 MDCR_EL2_TPMS; 101 102 write_sysreg(mdcr_el2, mdcr_el2); 103 104 __deactivate_traps_common(); | 100 __deactivate_traps_common(vcpu); |
105} 106 107/* Switch to the guest for VHE systems running in EL2 */ 108static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) 109{ 110 struct kvm_cpu_context *host_ctxt; 111 struct kvm_cpu_context *guest_ctxt; 112 u64 exit_code; --- 6 unchanged lines hidden (view full) --- 119 120 /* 121 * ARM erratum 1165522 requires us to configure both stage 1 and 122 * stage 2 translation for the guest context before we clear 123 * HCR_EL2.TGE. 124 * 125 * We have already configured the guest's stage 1 translation in 126 * kvm_vcpu_load_sysregs_vhe above. We must now call | 101} 102 103/* Switch to the guest for VHE systems running in EL2 */ 104static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) 105{ 106 struct kvm_cpu_context *host_ctxt; 107 struct kvm_cpu_context *guest_ctxt; 108 u64 exit_code; --- 6 unchanged lines hidden (view full) --- 115 116 /* 117 * ARM erratum 1165522 requires us to configure both stage 1 and 118 * stage 2 translation for the guest context before we clear 119 * HCR_EL2.TGE. 120 * 121 * We have already configured the guest's stage 1 translation in 122 * kvm_vcpu_load_sysregs_vhe above. We must now call |
127 * __load_stage2 before __activate_traps, because 128 * __load_stage2 configures stage 2 translation, and | 123 * __load_guest_stage2 before __activate_traps, because 124 * __load_guest_stage2 configures stage 2 translation, and |
129 * __activate_traps clear HCR_EL2.TGE (among other things). 130 */ | 125 * __activate_traps clear HCR_EL2.TGE (among other things). 126 */ |
131 __load_stage2(vcpu->arch.hw_mmu, vcpu->arch.hw_mmu->arch); | 127 __load_guest_stage2(vcpu->arch.hw_mmu); |
132 __activate_traps(vcpu); 133 134 __kvm_adjust_pc(vcpu); 135 136 sysreg_restore_guest_state_vhe(guest_ctxt); 137 __debug_switch_to_guest(vcpu); 138 139 do { --- 88 unchanged lines hidden --- | 128 __activate_traps(vcpu); 129 130 __kvm_adjust_pc(vcpu); 131 132 sysreg_restore_guest_state_vhe(guest_ctxt); 133 __debug_switch_to_guest(vcpu); 134 135 do { --- 88 unchanged lines hidden --- |