Commit 9c75f65f authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

KVM: PPC: Book3S HV P9: Test dawr_enabled() before saving host DAWR SPRs

Some of the DAWR SPR access is already predicated on dawr_enabled(),
apply this to the remainder of the accesses.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211123095231.1036501-41-npiggin@gmail.com
parent cf3b16cf
...@@ -666,13 +666,16 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc ...@@ -666,13 +666,16 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
host_hfscr = mfspr(SPRN_HFSCR); host_hfscr = mfspr(SPRN_HFSCR);
host_ciabr = mfspr(SPRN_CIABR); host_ciabr = mfspr(SPRN_CIABR);
host_dawr0 = mfspr(SPRN_DAWR0);
host_dawrx0 = mfspr(SPRN_DAWRX0);
host_psscr = mfspr(SPRN_PSSCR); host_psscr = mfspr(SPRN_PSSCR);
host_pidr = mfspr(SPRN_PID); host_pidr = mfspr(SPRN_PID);
if (cpu_has_feature(CPU_FTR_DAWR1)) {
host_dawr1 = mfspr(SPRN_DAWR1); if (dawr_enabled()) {
host_dawrx1 = mfspr(SPRN_DAWRX1); host_dawr0 = mfspr(SPRN_DAWR0);
host_dawrx0 = mfspr(SPRN_DAWRX0);
if (cpu_has_feature(CPU_FTR_DAWR1)) {
host_dawr1 = mfspr(SPRN_DAWR1);
host_dawrx1 = mfspr(SPRN_DAWRX1);
}
} }
local_paca->kvm_hstate.host_purr = mfspr(SPRN_PURR); local_paca->kvm_hstate.host_purr = mfspr(SPRN_PURR);
...@@ -1006,15 +1009,18 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc ...@@ -1006,15 +1009,18 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
mtspr(SPRN_HFSCR, host_hfscr); mtspr(SPRN_HFSCR, host_hfscr);
if (vcpu->arch.ciabr != host_ciabr) if (vcpu->arch.ciabr != host_ciabr)
mtspr(SPRN_CIABR, host_ciabr); mtspr(SPRN_CIABR, host_ciabr);
if (vcpu->arch.dawr0 != host_dawr0)
mtspr(SPRN_DAWR0, host_dawr0); if (dawr_enabled()) {
if (vcpu->arch.dawrx0 != host_dawrx0) if (vcpu->arch.dawr0 != host_dawr0)
mtspr(SPRN_DAWRX0, host_dawrx0); mtspr(SPRN_DAWR0, host_dawr0);
if (cpu_has_feature(CPU_FTR_DAWR1)) { if (vcpu->arch.dawrx0 != host_dawrx0)
if (vcpu->arch.dawr1 != host_dawr1) mtspr(SPRN_DAWRX0, host_dawrx0);
mtspr(SPRN_DAWR1, host_dawr1); if (cpu_has_feature(CPU_FTR_DAWR1)) {
if (vcpu->arch.dawrx1 != host_dawrx1) if (vcpu->arch.dawr1 != host_dawr1)
mtspr(SPRN_DAWRX1, host_dawrx1); mtspr(SPRN_DAWR1, host_dawr1);
if (vcpu->arch.dawrx1 != host_dawrx1)
mtspr(SPRN_DAWRX1, host_dawrx1);
}
} }
if (vc->dpdes) if (vc->dpdes)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment