Skip to content

Commit 4bacd72

Browse files
author
Marc Zyngier
committed
KVM: arm64: Exclude mdcr_el2_host from kvm_vcpu_arch
As for the rest of the host debug state, the host copy of mdcr_el2 has little to do in the vcpu, and is better placed in the host_data structure. Reviewed-by : Suzuki K Poulose <[email protected]> Signed-off-by: Marc Zyngier <[email protected]>
1 parent 6db5573 commit 4bacd72

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,8 @@ struct kvm_host_data {
555555
u64 pmscr_el1;
556556
/* Self-hosted trace */
557557
u64 trfcr_el1;
558+
/* Values of trap registers for the host before guest entry. */
559+
u64 mdcr_el2;
558560
} host_debug_state;
559561
};
560562

@@ -616,9 +618,6 @@ struct kvm_vcpu_arch {
616618
u64 mdcr_el2;
617619
u64 cptr_el2;
618620

619-
/* Values of trap registers for the host before guest entry. */
620-
u64 mdcr_el2_host;
621-
622621
/* Exception Information */
623622
struct kvm_vcpu_fault_info fault;
624623

arch/arm64/kvm/hyp/include/hyp/switch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static inline void __activate_traps_common(struct kvm_vcpu *vcpu)
232232
vcpu_set_flag(vcpu, PMUSERENR_ON_CPU);
233233
}
234234

235-
vcpu->arch.mdcr_el2_host = read_sysreg(mdcr_el2);
235+
*host_data_ptr(host_debug_state.mdcr_el2) = read_sysreg(mdcr_el2);
236236
write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2);
237237

238238
if (cpus_have_final_cap(ARM64_HAS_HCX)) {
@@ -254,7 +254,7 @@ static inline void __activate_traps_common(struct kvm_vcpu *vcpu)
254254

255255
static inline void __deactivate_traps_common(struct kvm_vcpu *vcpu)
256256
{
257-
write_sysreg(vcpu->arch.mdcr_el2_host, mdcr_el2);
257+
write_sysreg(*host_data_ptr(host_debug_state.mdcr_el2), mdcr_el2);
258258

259259
write_sysreg(0, hstr_el2);
260260
if (kvm_arm_support_pmu_v3()) {

0 commit comments

Comments
 (0)