aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-07-29 08:47:44 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:50:44 -0400
commitd562de48de68b60b3d2522e7d8273d7112034ee6 (patch)
treeec58ea23bea8aec64be3d169033cece19cd6d3e8 /arch/powerpc/kvm
parent666e7252a15b7fc4a116e65deaf6da5e4ce660e3 (diff)
KVM: PPC: Convert DSISR to shared page
The DSISR register contains information about a data page fault. It is fully read/write from inside the guest context and we don't need to worry about interacting based on writes of this register. This patch converts all users of the current field to the shared page. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r--arch/powerpc/kvm/book3s.c11
-rw-r--r--arch/powerpc/kvm/book3s_emulate.c6
-rw-r--r--arch/powerpc/kvm/book3s_paired_singles.c2
3 files changed, 10 insertions, 9 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 2efe69240e1b..eb401b6d4d8c 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -595,15 +595,16 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
595 if (page_found == -ENOENT) { 595 if (page_found == -ENOENT) {
596 /* Page not found in guest PTE entries */ 596 /* Page not found in guest PTE entries */
597 vcpu->arch.dear = kvmppc_get_fault_dar(vcpu); 597 vcpu->arch.dear = kvmppc_get_fault_dar(vcpu);
598 to_book3s(vcpu)->dsisr = to_svcpu(vcpu)->fault_dsisr; 598 vcpu->arch.shared->dsisr = to_svcpu(vcpu)->fault_dsisr;
599 vcpu->arch.shared->msr |= 599 vcpu->arch.shared->msr |=
600 (to_svcpu(vcpu)->shadow_srr1 & 0x00000000f8000000ULL); 600 (to_svcpu(vcpu)->shadow_srr1 & 0x00000000f8000000ULL);
601 kvmppc_book3s_queue_irqprio(vcpu, vec); 601 kvmppc_book3s_queue_irqprio(vcpu, vec);
602 } else if (page_found == -EPERM) { 602 } else if (page_found == -EPERM) {
603 /* Storage protection */ 603 /* Storage protection */
604 vcpu->arch.dear = kvmppc_get_fault_dar(vcpu); 604 vcpu->arch.dear = kvmppc_get_fault_dar(vcpu);
605 to_book3s(vcpu)->dsisr = to_svcpu(vcpu)->fault_dsisr & ~DSISR_NOHPTE; 605 vcpu->arch.shared->dsisr =
606 to_book3s(vcpu)->dsisr |= DSISR_PROTFAULT; 606 to_svcpu(vcpu)->fault_dsisr & ~DSISR_NOHPTE;
607 vcpu->arch.shared->dsisr |= DSISR_PROTFAULT;
607 vcpu->arch.shared->msr |= 608 vcpu->arch.shared->msr |=
608 (to_svcpu(vcpu)->shadow_srr1 & 0x00000000f8000000ULL); 609 (to_svcpu(vcpu)->shadow_srr1 & 0x00000000f8000000ULL);
609 kvmppc_book3s_queue_irqprio(vcpu, vec); 610 kvmppc_book3s_queue_irqprio(vcpu, vec);
@@ -867,7 +868,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
867 r = kvmppc_handle_pagefault(run, vcpu, dar, exit_nr); 868 r = kvmppc_handle_pagefault(run, vcpu, dar, exit_nr);
868 } else { 869 } else {
869 vcpu->arch.dear = dar; 870 vcpu->arch.dear = dar;
870 to_book3s(vcpu)->dsisr = to_svcpu(vcpu)->fault_dsisr; 871 vcpu->arch.shared->dsisr = to_svcpu(vcpu)->fault_dsisr;
871 kvmppc_book3s_queue_irqprio(vcpu, exit_nr); 872 kvmppc_book3s_queue_irqprio(vcpu, exit_nr);
872 kvmppc_mmu_pte_flush(vcpu, vcpu->arch.dear, ~0xFFFUL); 873 kvmppc_mmu_pte_flush(vcpu, vcpu->arch.dear, ~0xFFFUL);
873 r = RESUME_GUEST; 874 r = RESUME_GUEST;
@@ -994,7 +995,7 @@ program_interrupt:
994 } 995 }
995 case BOOK3S_INTERRUPT_ALIGNMENT: 996 case BOOK3S_INTERRUPT_ALIGNMENT:
996 if (kvmppc_read_inst(vcpu) == EMULATE_DONE) { 997 if (kvmppc_read_inst(vcpu) == EMULATE_DONE) {
997 to_book3s(vcpu)->dsisr = kvmppc_alignment_dsisr(vcpu, 998 vcpu->arch.shared->dsisr = kvmppc_alignment_dsisr(vcpu,
998 kvmppc_get_last_inst(vcpu)); 999 kvmppc_get_last_inst(vcpu));
999 vcpu->arch.dear = kvmppc_alignment_dar(vcpu, 1000 vcpu->arch.dear = kvmppc_alignment_dar(vcpu,
1000 kvmppc_get_last_inst(vcpu)); 1001 kvmppc_get_last_inst(vcpu));
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index 35d3c16b2938..9982ff163af0 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -221,7 +221,7 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
221 else if (r == -EPERM) 221 else if (r == -EPERM)
222 dsisr |= DSISR_PROTFAULT; 222 dsisr |= DSISR_PROTFAULT;
223 223
224 to_book3s(vcpu)->dsisr = dsisr; 224 vcpu->arch.shared->dsisr = dsisr;
225 to_svcpu(vcpu)->fault_dsisr = dsisr; 225 to_svcpu(vcpu)->fault_dsisr = dsisr;
226 226
227 kvmppc_book3s_queue_irqprio(vcpu, 227 kvmppc_book3s_queue_irqprio(vcpu,
@@ -327,7 +327,7 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)
327 to_book3s(vcpu)->sdr1 = spr_val; 327 to_book3s(vcpu)->sdr1 = spr_val;
328 break; 328 break;
329 case SPRN_DSISR: 329 case SPRN_DSISR:
330 to_book3s(vcpu)->dsisr = spr_val; 330 vcpu->arch.shared->dsisr = spr_val;
331 break; 331 break;
332 case SPRN_DAR: 332 case SPRN_DAR:
333 vcpu->arch.dear = spr_val; 333 vcpu->arch.dear = spr_val;
@@ -440,7 +440,7 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
440 kvmppc_set_gpr(vcpu, rt, to_book3s(vcpu)->sdr1); 440 kvmppc_set_gpr(vcpu, rt, to_book3s(vcpu)->sdr1);
441 break; 441 break;
442 case SPRN_DSISR: 442 case SPRN_DSISR:
443 kvmppc_set_gpr(vcpu, rt, to_book3s(vcpu)->dsisr); 443 kvmppc_set_gpr(vcpu, rt, vcpu->arch.shared->dsisr);
444 break; 444 break;
445 case SPRN_DAR: 445 case SPRN_DAR:
446 kvmppc_set_gpr(vcpu, rt, vcpu->arch.dear); 446 kvmppc_set_gpr(vcpu, rt, vcpu->arch.dear);
diff --git a/arch/powerpc/kvm/book3s_paired_singles.c b/arch/powerpc/kvm/book3s_paired_singles.c
index 626e6efaa79f..749dfbd04738 100644
--- a/arch/powerpc/kvm/book3s_paired_singles.c
+++ b/arch/powerpc/kvm/book3s_paired_singles.c
@@ -173,7 +173,7 @@ static void kvmppc_inject_pf(struct kvm_vcpu *vcpu, ulong eaddr, bool is_store)
173 /* Page Fault */ 173 /* Page Fault */
174 dsisr = kvmppc_set_field(0, 33, 33, 1); 174 dsisr = kvmppc_set_field(0, 33, 33, 1);
175 if (is_store) 175 if (is_store)
176 to_book3s(vcpu)->dsisr = kvmppc_set_field(dsisr, 38, 38, 1); 176 shared->dsisr = kvmppc_set_field(dsisr, 38, 38, 1);
177 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_DATA_STORAGE); 177 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_DATA_STORAGE);
178} 178}
179 179