aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/book3s_paired_singles.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kvm/book3s_paired_singles.c')
-rw-r--r--arch/powerpc/kvm/book3s_paired_singles.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/arch/powerpc/kvm/book3s_paired_singles.c b/arch/powerpc/kvm/book3s_paired_singles.c
index 474f2e24050a..35a701f3ece4 100644
--- a/arch/powerpc/kvm/book3s_paired_singles.c
+++ b/arch/powerpc/kvm/book3s_paired_singles.c
@@ -159,7 +159,7 @@
159 159
160static inline void kvmppc_sync_qpr(struct kvm_vcpu *vcpu, int rt) 160static inline void kvmppc_sync_qpr(struct kvm_vcpu *vcpu, int rt)
161{ 161{
162 kvm_cvt_df(&vcpu->arch.fpr[rt], &vcpu->arch.qpr[rt], &vcpu->arch.fpscr); 162 kvm_cvt_df(&vcpu->arch.fpr[rt], &vcpu->arch.qpr[rt]);
163} 163}
164 164
165static void kvmppc_inject_pf(struct kvm_vcpu *vcpu, ulong eaddr, bool is_store) 165static void kvmppc_inject_pf(struct kvm_vcpu *vcpu, ulong eaddr, bool is_store)
@@ -204,7 +204,7 @@ static int kvmppc_emulate_fpr_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
204 /* put in registers */ 204 /* put in registers */
205 switch (ls_type) { 205 switch (ls_type) {
206 case FPU_LS_SINGLE: 206 case FPU_LS_SINGLE:
207 kvm_cvt_fd((u32*)tmp, &vcpu->arch.fpr[rs], &vcpu->arch.fpscr); 207 kvm_cvt_fd((u32*)tmp, &vcpu->arch.fpr[rs]);
208 vcpu->arch.qpr[rs] = *((u32*)tmp); 208 vcpu->arch.qpr[rs] = *((u32*)tmp);
209 break; 209 break;
210 case FPU_LS_DOUBLE: 210 case FPU_LS_DOUBLE:
@@ -230,7 +230,7 @@ static int kvmppc_emulate_fpr_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
230 230
231 switch (ls_type) { 231 switch (ls_type) {
232 case FPU_LS_SINGLE: 232 case FPU_LS_SINGLE:
233 kvm_cvt_df(&vcpu->arch.fpr[rs], (u32*)tmp, &vcpu->arch.fpscr); 233 kvm_cvt_df(&vcpu->arch.fpr[rs], (u32*)tmp);
234 val = *((u32*)tmp); 234 val = *((u32*)tmp);
235 len = sizeof(u32); 235 len = sizeof(u32);
236 break; 236 break;
@@ -296,7 +296,7 @@ static int kvmppc_emulate_psq_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
296 emulated = EMULATE_DONE; 296 emulated = EMULATE_DONE;
297 297
298 /* put in registers */ 298 /* put in registers */
299 kvm_cvt_fd(&tmp[0], &vcpu->arch.fpr[rs], &vcpu->arch.fpscr); 299 kvm_cvt_fd(&tmp[0], &vcpu->arch.fpr[rs]);
300 vcpu->arch.qpr[rs] = tmp[1]; 300 vcpu->arch.qpr[rs] = tmp[1];
301 301
302 dprintk(KERN_INFO "KVM: PSQ_LD [0x%x, 0x%x] at 0x%lx (%d)\n", tmp[0], 302 dprintk(KERN_INFO "KVM: PSQ_LD [0x%x, 0x%x] at 0x%lx (%d)\n", tmp[0],
@@ -314,7 +314,7 @@ static int kvmppc_emulate_psq_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
314 u32 tmp[2]; 314 u32 tmp[2];
315 int len = w ? sizeof(u32) : sizeof(u64); 315 int len = w ? sizeof(u32) : sizeof(u64);
316 316
317 kvm_cvt_df(&vcpu->arch.fpr[rs], &tmp[0], &vcpu->arch.fpscr); 317 kvm_cvt_df(&vcpu->arch.fpr[rs], &tmp[0]);
318 tmp[1] = vcpu->arch.qpr[rs]; 318 tmp[1] = vcpu->arch.qpr[rs];
319 319
320 r = kvmppc_st(vcpu, &addr, len, tmp, true); 320 r = kvmppc_st(vcpu, &addr, len, tmp, true);
@@ -516,9 +516,9 @@ static int kvmppc_ps_three_in(struct kvm_vcpu *vcpu, bool rc,
516 WARN_ON(rc); 516 WARN_ON(rc);
517 517
518 /* PS0 */ 518 /* PS0 */
519 kvm_cvt_df(&fpr[reg_in1], &ps0_in1, &vcpu->arch.fpscr); 519 kvm_cvt_df(&fpr[reg_in1], &ps0_in1);
520 kvm_cvt_df(&fpr[reg_in2], &ps0_in2, &vcpu->arch.fpscr); 520 kvm_cvt_df(&fpr[reg_in2], &ps0_in2);
521 kvm_cvt_df(&fpr[reg_in3], &ps0_in3, &vcpu->arch.fpscr); 521 kvm_cvt_df(&fpr[reg_in3], &ps0_in3);
522 522
523 if (scalar & SCALAR_LOW) 523 if (scalar & SCALAR_LOW)
524 ps0_in2 = qpr[reg_in2]; 524 ps0_in2 = qpr[reg_in2];
@@ -529,7 +529,7 @@ static int kvmppc_ps_three_in(struct kvm_vcpu *vcpu, bool rc,
529 ps0_in1, ps0_in2, ps0_in3, ps0_out); 529 ps0_in1, ps0_in2, ps0_in3, ps0_out);
530 530
531 if (!(scalar & SCALAR_NO_PS0)) 531 if (!(scalar & SCALAR_NO_PS0))
532 kvm_cvt_fd(&ps0_out, &fpr[reg_out], &vcpu->arch.fpscr); 532 kvm_cvt_fd(&ps0_out, &fpr[reg_out]);
533 533
534 /* PS1 */ 534 /* PS1 */
535 ps1_in1 = qpr[reg_in1]; 535 ps1_in1 = qpr[reg_in1];
@@ -566,12 +566,12 @@ static int kvmppc_ps_two_in(struct kvm_vcpu *vcpu, bool rc,
566 WARN_ON(rc); 566 WARN_ON(rc);
567 567
568 /* PS0 */ 568 /* PS0 */
569 kvm_cvt_df(&fpr[reg_in1], &ps0_in1, &vcpu->arch.fpscr); 569 kvm_cvt_df(&fpr[reg_in1], &ps0_in1);
570 570
571 if (scalar & SCALAR_LOW) 571 if (scalar & SCALAR_LOW)
572 ps0_in2 = qpr[reg_in2]; 572 ps0_in2 = qpr[reg_in2];
573 else 573 else
574 kvm_cvt_df(&fpr[reg_in2], &ps0_in2, &vcpu->arch.fpscr); 574 kvm_cvt_df(&fpr[reg_in2], &ps0_in2);
575 575
576 func(&vcpu->arch.fpscr, &ps0_out, &ps0_in1, &ps0_in2); 576 func(&vcpu->arch.fpscr, &ps0_out, &ps0_in1, &ps0_in2);
577 577
@@ -579,7 +579,7 @@ static int kvmppc_ps_two_in(struct kvm_vcpu *vcpu, bool rc,
579 dprintk(KERN_INFO "PS2 ps0 -> f(0x%x, 0x%x) = 0x%x\n", 579 dprintk(KERN_INFO "PS2 ps0 -> f(0x%x, 0x%x) = 0x%x\n",
580 ps0_in1, ps0_in2, ps0_out); 580 ps0_in1, ps0_in2, ps0_out);
581 581
582 kvm_cvt_fd(&ps0_out, &fpr[reg_out], &vcpu->arch.fpscr); 582 kvm_cvt_fd(&ps0_out, &fpr[reg_out]);
583 } 583 }
584 584
585 /* PS1 */ 585 /* PS1 */
@@ -615,13 +615,13 @@ static int kvmppc_ps_one_in(struct kvm_vcpu *vcpu, bool rc,
615 WARN_ON(rc); 615 WARN_ON(rc);
616 616
617 /* PS0 */ 617 /* PS0 */
618 kvm_cvt_df(&fpr[reg_in], &ps0_in, &vcpu->arch.fpscr); 618 kvm_cvt_df(&fpr[reg_in], &ps0_in);
619 func(&vcpu->arch.fpscr, &ps0_out, &ps0_in); 619 func(&vcpu->arch.fpscr, &ps0_out, &ps0_in);
620 620
621 dprintk(KERN_INFO "PS1 ps0 -> f(0x%x) = 0x%x\n", 621 dprintk(KERN_INFO "PS1 ps0 -> f(0x%x) = 0x%x\n",
622 ps0_in, ps0_out); 622 ps0_in, ps0_out);
623 623
624 kvm_cvt_fd(&ps0_out, &fpr[reg_out], &vcpu->arch.fpscr); 624 kvm_cvt_fd(&ps0_out, &fpr[reg_out]);
625 625
626 /* PS1 */ 626 /* PS1 */
627 ps1_in = qpr[reg_in]; 627 ps1_in = qpr[reg_in];
@@ -671,7 +671,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
671#ifdef DEBUG 671#ifdef DEBUG
672 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) { 672 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) {
673 u32 f; 673 u32 f;
674 kvm_cvt_df(&vcpu->arch.fpr[i], &f, &vcpu->arch.fpscr); 674 kvm_cvt_df(&vcpu->arch.fpr[i], &f);
675 dprintk(KERN_INFO "FPR[%d] = 0x%x / 0x%llx QPR[%d] = 0x%x\n", 675 dprintk(KERN_INFO "FPR[%d] = 0x%x / 0x%llx QPR[%d] = 0x%x\n",
676 i, f, vcpu->arch.fpr[i], i, vcpu->arch.qpr[i]); 676 i, f, vcpu->arch.fpr[i], i, vcpu->arch.qpr[i]);
677 } 677 }
@@ -796,8 +796,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
796 vcpu->arch.fpr[ax_rd] = vcpu->arch.fpr[ax_ra]; 796 vcpu->arch.fpr[ax_rd] = vcpu->arch.fpr[ax_ra];
797 /* vcpu->arch.qpr[ax_rd] = vcpu->arch.fpr[ax_rb]; */ 797 /* vcpu->arch.qpr[ax_rd] = vcpu->arch.fpr[ax_rb]; */
798 kvm_cvt_df(&vcpu->arch.fpr[ax_rb], 798 kvm_cvt_df(&vcpu->arch.fpr[ax_rb],
799 &vcpu->arch.qpr[ax_rd], 799 &vcpu->arch.qpr[ax_rd]);
800 &vcpu->arch.fpscr);
801 break; 800 break;
802 case OP_4X_PS_MERGE01: 801 case OP_4X_PS_MERGE01:
803 WARN_ON(rcomp); 802 WARN_ON(rcomp);
@@ -808,19 +807,16 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
808 WARN_ON(rcomp); 807 WARN_ON(rcomp);
809 /* vcpu->arch.fpr[ax_rd] = vcpu->arch.qpr[ax_ra]; */ 808 /* vcpu->arch.fpr[ax_rd] = vcpu->arch.qpr[ax_ra]; */
810 kvm_cvt_fd(&vcpu->arch.qpr[ax_ra], 809 kvm_cvt_fd(&vcpu->arch.qpr[ax_ra],
811 &vcpu->arch.fpr[ax_rd], 810 &vcpu->arch.fpr[ax_rd]);
812 &vcpu->arch.fpscr);
813 /* vcpu->arch.qpr[ax_rd] = vcpu->arch.fpr[ax_rb]; */ 811 /* vcpu->arch.qpr[ax_rd] = vcpu->arch.fpr[ax_rb]; */
814 kvm_cvt_df(&vcpu->arch.fpr[ax_rb], 812 kvm_cvt_df(&vcpu->arch.fpr[ax_rb],
815 &vcpu->arch.qpr[ax_rd], 813 &vcpu->arch.qpr[ax_rd]);
816 &vcpu->arch.fpscr);
817 break; 814 break;
818 case OP_4X_PS_MERGE11: 815 case OP_4X_PS_MERGE11:
819 WARN_ON(rcomp); 816 WARN_ON(rcomp);
820 /* vcpu->arch.fpr[ax_rd] = vcpu->arch.qpr[ax_ra]; */ 817 /* vcpu->arch.fpr[ax_rd] = vcpu->arch.qpr[ax_ra]; */
821 kvm_cvt_fd(&vcpu->arch.qpr[ax_ra], 818 kvm_cvt_fd(&vcpu->arch.qpr[ax_ra],
822 &vcpu->arch.fpr[ax_rd], 819 &vcpu->arch.fpr[ax_rd]);
823 &vcpu->arch.fpscr);
824 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb]; 820 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb];
825 break; 821 break;
826 } 822 }
@@ -1255,7 +1251,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
1255#ifdef DEBUG 1251#ifdef DEBUG
1256 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) { 1252 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) {
1257 u32 f; 1253 u32 f;
1258 kvm_cvt_df(&vcpu->arch.fpr[i], &f, &vcpu->arch.fpscr); 1254 kvm_cvt_df(&vcpu->arch.fpr[i], &f);
1259 dprintk(KERN_INFO "FPR[%d] = 0x%x\n", i, f); 1255 dprintk(KERN_INFO "FPR[%d] = 0x%x\n", i, f);
1260 } 1256 }
1261#endif 1257#endif