Lines Matching refs:arch

83 	if (vcpu->arch.hflags & BOOK3S_HFLAG_SPLIT_HACK)  in kvmppc_fixup_split_real()
90 vcpu->arch.hflags |= BOOK3S_HFLAG_SPLIT_HACK; in kvmppc_fixup_split_real()
96 if (vcpu->arch.hflags & BOOK3S_HFLAG_SPLIT_HACK) { in kvmppc_unfixup_split_real()
103 vcpu->arch.hflags &= ~BOOK3S_HFLAG_SPLIT_HACK; in kvmppc_unfixup_split_real()
115 new_msr = vcpu->arch.intr_msr; in kvmppc_inject_interrupt_pr()
149 current->thread.kvm_shadow_vcpu = vcpu->arch.shadow_vcpu; in kvmppc_core_vcpu_load_pr()
190 svcpu->gpr[0] = vcpu->arch.regs.gpr[0]; in kvmppc_copy_to_svcpu()
191 svcpu->gpr[1] = vcpu->arch.regs.gpr[1]; in kvmppc_copy_to_svcpu()
192 svcpu->gpr[2] = vcpu->arch.regs.gpr[2]; in kvmppc_copy_to_svcpu()
193 svcpu->gpr[3] = vcpu->arch.regs.gpr[3]; in kvmppc_copy_to_svcpu()
194 svcpu->gpr[4] = vcpu->arch.regs.gpr[4]; in kvmppc_copy_to_svcpu()
195 svcpu->gpr[5] = vcpu->arch.regs.gpr[5]; in kvmppc_copy_to_svcpu()
196 svcpu->gpr[6] = vcpu->arch.regs.gpr[6]; in kvmppc_copy_to_svcpu()
197 svcpu->gpr[7] = vcpu->arch.regs.gpr[7]; in kvmppc_copy_to_svcpu()
198 svcpu->gpr[8] = vcpu->arch.regs.gpr[8]; in kvmppc_copy_to_svcpu()
199 svcpu->gpr[9] = vcpu->arch.regs.gpr[9]; in kvmppc_copy_to_svcpu()
200 svcpu->gpr[10] = vcpu->arch.regs.gpr[10]; in kvmppc_copy_to_svcpu()
201 svcpu->gpr[11] = vcpu->arch.regs.gpr[11]; in kvmppc_copy_to_svcpu()
202 svcpu->gpr[12] = vcpu->arch.regs.gpr[12]; in kvmppc_copy_to_svcpu()
203 svcpu->gpr[13] = vcpu->arch.regs.gpr[13]; in kvmppc_copy_to_svcpu()
204 svcpu->cr = vcpu->arch.regs.ccr; in kvmppc_copy_to_svcpu()
205 svcpu->xer = vcpu->arch.regs.xer; in kvmppc_copy_to_svcpu()
206 svcpu->ctr = vcpu->arch.regs.ctr; in kvmppc_copy_to_svcpu()
207 svcpu->lr = vcpu->arch.regs.link; in kvmppc_copy_to_svcpu()
208 svcpu->pc = vcpu->arch.regs.nip; in kvmppc_copy_to_svcpu()
210 svcpu->shadow_fscr = vcpu->arch.shadow_fscr; in kvmppc_copy_to_svcpu()
216 vcpu->arch.entry_tb = get_tb(); in kvmppc_copy_to_svcpu()
217 vcpu->arch.entry_vtb = get_vtb(); in kvmppc_copy_to_svcpu()
219 vcpu->arch.entry_ic = mfspr(SPRN_IC); in kvmppc_copy_to_svcpu()
240 smsr |= (guest_msr & vcpu->arch.guest_owned_ext); in kvmppc_recalc_shadow_msr()
254 vcpu->arch.shadow_msr = smsr; in kvmppc_recalc_shadow_msr()
272 vcpu->arch.regs.gpr[0] = svcpu->gpr[0]; in kvmppc_copy_from_svcpu()
273 vcpu->arch.regs.gpr[1] = svcpu->gpr[1]; in kvmppc_copy_from_svcpu()
274 vcpu->arch.regs.gpr[2] = svcpu->gpr[2]; in kvmppc_copy_from_svcpu()
275 vcpu->arch.regs.gpr[3] = svcpu->gpr[3]; in kvmppc_copy_from_svcpu()
276 vcpu->arch.regs.gpr[4] = svcpu->gpr[4]; in kvmppc_copy_from_svcpu()
277 vcpu->arch.regs.gpr[5] = svcpu->gpr[5]; in kvmppc_copy_from_svcpu()
278 vcpu->arch.regs.gpr[6] = svcpu->gpr[6]; in kvmppc_copy_from_svcpu()
279 vcpu->arch.regs.gpr[7] = svcpu->gpr[7]; in kvmppc_copy_from_svcpu()
280 vcpu->arch.regs.gpr[8] = svcpu->gpr[8]; in kvmppc_copy_from_svcpu()
281 vcpu->arch.regs.gpr[9] = svcpu->gpr[9]; in kvmppc_copy_from_svcpu()
282 vcpu->arch.regs.gpr[10] = svcpu->gpr[10]; in kvmppc_copy_from_svcpu()
283 vcpu->arch.regs.gpr[11] = svcpu->gpr[11]; in kvmppc_copy_from_svcpu()
284 vcpu->arch.regs.gpr[12] = svcpu->gpr[12]; in kvmppc_copy_from_svcpu()
285 vcpu->arch.regs.gpr[13] = svcpu->gpr[13]; in kvmppc_copy_from_svcpu()
286 vcpu->arch.regs.ccr = svcpu->cr; in kvmppc_copy_from_svcpu()
287 vcpu->arch.regs.xer = svcpu->xer; in kvmppc_copy_from_svcpu()
288 vcpu->arch.regs.ctr = svcpu->ctr; in kvmppc_copy_from_svcpu()
289 vcpu->arch.regs.link = svcpu->lr; in kvmppc_copy_from_svcpu()
290 vcpu->arch.regs.nip = svcpu->pc; in kvmppc_copy_from_svcpu()
291 vcpu->arch.shadow_srr1 = svcpu->shadow_srr1; in kvmppc_copy_from_svcpu()
292 vcpu->arch.fault_dar = svcpu->fault_dar; in kvmppc_copy_from_svcpu()
293 vcpu->arch.fault_dsisr = svcpu->fault_dsisr; in kvmppc_copy_from_svcpu()
294 vcpu->arch.last_inst = svcpu->last_inst; in kvmppc_copy_from_svcpu()
296 vcpu->arch.shadow_fscr = svcpu->shadow_fscr; in kvmppc_copy_from_svcpu()
301 vcpu->arch.purr += get_tb() - vcpu->arch.entry_tb; in kvmppc_copy_from_svcpu()
302 vcpu->arch.spurr += get_tb() - vcpu->arch.entry_tb; in kvmppc_copy_from_svcpu()
303 to_book3s(vcpu)->vtb += get_vtb() - vcpu->arch.entry_vtb; in kvmppc_copy_from_svcpu()
305 vcpu->arch.ic += mfspr(SPRN_IC) - vcpu->arch.entry_ic; in kvmppc_copy_from_svcpu()
321 (vcpu->arch.shadow_srr1 & (MSR_TS_MASK)) != in kvmppc_copy_from_svcpu()
324 old_msr |= (vcpu->arch.shadow_srr1 & (MSR_TS_MASK)); in kvmppc_copy_from_svcpu()
340 vcpu->arch.tfhar = mfspr(SPRN_TFHAR); in kvmppc_save_tm_sprs()
341 vcpu->arch.texasr = mfspr(SPRN_TEXASR); in kvmppc_save_tm_sprs()
342 vcpu->arch.tfiar = mfspr(SPRN_TFIAR); in kvmppc_save_tm_sprs()
349 mtspr(SPRN_TFHAR, vcpu->arch.tfhar); in kvmppc_restore_tm_sprs()
350 mtspr(SPRN_TEXASR, vcpu->arch.texasr); in kvmppc_restore_tm_sprs()
351 mtspr(SPRN_TFIAR, vcpu->arch.tfiar); in kvmppc_restore_tm_sprs()
361 ulong ext_diff = (kvmppc_get_msr(vcpu) & ~vcpu->arch.guest_owned_ext) & in kvmppc_handle_lost_math_exts()
398 if (vcpu->arch.fscr & FSCR_TAR) in kvmppc_restore_tm_pr()
410 if (vcpu->arch.fscr & FSCR_TAR) in kvmppc_restore_tm_pr()
471 if (vcpu->arch.papr_enabled) in kvmppc_set_msr_pr()
494 if (!vcpu->arch.pending_exceptions) { in kvmppc_set_msr_pr()
516 if (!(msr & MSR_PR) && vcpu->arch.magic_page_pa) { in kvmppc_set_msr_pr()
517 struct kvm_vcpu_arch *a = &vcpu->arch; in kvmppc_set_msr_pr()
534 if (vcpu->arch.magic_page_pa && in kvmppc_set_msr_pr()
537 kvmppc_mmu_pte_flush(vcpu, (uint32_t)vcpu->arch.magic_page_pa, in kvmppc_set_msr_pr()
555 vcpu->arch.hflags &= ~BOOK3S_HFLAG_SLB; in kvmppc_set_pvr_pr()
556 vcpu->arch.pvr = pvr; in kvmppc_set_pvr_pr()
563 vcpu->arch.cpu_type = KVM_CPU_3S_64; in kvmppc_set_pvr_pr()
571 vcpu->arch.cpu_type = KVM_CPU_3S_32; in kvmppc_set_pvr_pr()
578 vcpu->arch.hflags &= ~BOOK3S_HFLAG_DCBZ32; in kvmppc_set_pvr_pr()
579 if (vcpu->arch.mmu.is_dcbz32(vcpu) && (mfmsr() & MSR_HV) && in kvmppc_set_pvr_pr()
581 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32; in kvmppc_set_pvr_pr()
603 vcpu->arch.hflags |= BOOK3S_HFLAG_MULTI_PGSIZE | in kvmppc_set_pvr_pr()
610 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32; in kvmppc_set_pvr_pr()
625 vcpu->arch.hflags |= BOOK3S_HFLAG_NATIVE_PS; in kvmppc_set_pvr_pr()
669 ulong mp_pa = vcpu->arch.magic_page_pa; in kvmppc_visible_gpa()
696 if (data && (vcpu->arch.fault_dsisr & DSISR_ISSTORE)) in kvmppc_handle_pagefault()
701 page_found = vcpu->arch.mmu.xlate(vcpu, eaddr, &pte, data, iswrite); in kvmppc_handle_pagefault()
719 (vcpu->arch.hflags & BOOK3S_HFLAG_SPLIT_HACK) && in kvmppc_handle_pagefault()
724 vcpu->arch.mmu.esid_to_vsid(vcpu, eaddr >> SID_SHIFT, &vsid); in kvmppc_handle_pagefault()
737 if (vcpu->arch.mmu.is_dcbz32(vcpu) && in kvmppc_handle_pagefault()
738 (!(vcpu->arch.hflags & BOOK3S_HFLAG_DCBZ32))) { in kvmppc_handle_pagefault()
756 flags |= vcpu->arch.fault_dsisr & DSISR_ISSTORE; in kvmppc_handle_pagefault()
766 if (data && !(vcpu->arch.fault_dsisr & DSISR_NOHPTE)) { in kvmppc_handle_pagefault()
782 else if (vcpu->arch.mmu.is_dcbz32(vcpu) && in kvmppc_handle_pagefault()
783 (!(vcpu->arch.hflags & BOOK3S_HFLAG_DCBZ32))) in kvmppc_handle_pagefault()
788 vcpu->arch.paddr_accessed = pte.raddr; in kvmppc_handle_pagefault()
789 vcpu->arch.vaddr_accessed = pte.eaddr; in kvmppc_handle_pagefault()
810 msr &= vcpu->arch.guest_owned_ext; in kvmppc_giveup_ext()
837 vcpu->arch.guest_owned_ext &= ~(msr | MSR_VSX); in kvmppc_giveup_ext()
845 if (!(vcpu->arch.shadow_fscr & (1ULL << fac))) { in kvmppc_giveup_fac()
852 vcpu->arch.tar = mfspr(SPRN_TAR); in kvmppc_giveup_fac()
854 vcpu->arch.shadow_fscr &= ~FSCR_TAR; in kvmppc_giveup_fac()
867 if (vcpu->arch.hflags & BOOK3S_HFLAG_PAIRED_SINGLE) in kvmppc_handle_ext()
893 msr &= ~vcpu->arch.guest_owned_ext; in kvmppc_handle_ext()
904 load_fp_state(&vcpu->arch.fp); in kvmppc_handle_ext()
906 t->fp_save_area = &vcpu->arch.fp; in kvmppc_handle_ext()
914 load_vr_state(&vcpu->arch.vr); in kvmppc_handle_ext()
916 t->vr_save_area = &vcpu->arch.vr; in kvmppc_handle_ext()
922 vcpu->arch.guest_owned_ext |= msr; in kvmppc_handle_ext()
936 lost_ext = vcpu->arch.guest_owned_ext & ~current->thread.regs->msr; in kvmppc_handle_lost_ext()
943 load_fp_state(&vcpu->arch.fp); in kvmppc_handle_lost_ext()
951 load_vr_state(&vcpu->arch.vr); in kvmppc_handle_lost_ext()
964 vcpu->arch.fscr &= ~(0xffULL << 56); in kvmppc_trigger_fac_interrupt()
965 vcpu->arch.fscr |= (fac << 56); in kvmppc_trigger_fac_interrupt()
995 guest_fac_enabled = (vcpu->arch.fscr & (1ULL << fac)); in kvmppc_handle_fac()
1015 mtspr(SPRN_TAR, vcpu->arch.tar); in kvmppc_handle_fac()
1016 vcpu->arch.shadow_fscr |= FSCR_TAR; in kvmppc_handle_fac()
1040 if ((vcpu->arch.fscr & FSCR_TAR) && !(fscr & FSCR_TAR)) { in kvmppc_set_fscr()
1043 } else if (!(vcpu->arch.fscr & FSCR_TAR) && (fscr & FSCR_TAR)) { in kvmppc_set_fscr()
1044 vcpu->arch.fscr = fscr; in kvmppc_set_fscr()
1049 vcpu->arch.fscr = fscr; in kvmppc_set_fscr()
1085 flags = vcpu->arch.shadow_srr1 & 0x1f0000ull; in kvmppc_exit_pr_progint()
1152 ulong shadow_srr1 = vcpu->arch.shadow_srr1; in kvmppc_handle_exit_pr()
1182 } else if (vcpu->arch.mmu.is_dcbz32(vcpu) && in kvmppc_handle_exit_pr()
1183 (!(vcpu->arch.hflags & BOOK3S_HFLAG_DCBZ32))) { in kvmppc_handle_exit_pr()
1201 u32 fault_dsisr = vcpu->arch.fault_dsisr; in kvmppc_handle_exit_pr()
1281 if (vcpu->arch.papr_enabled) { in kvmppc_handle_exit_pr()
1291 if (vcpu->arch.papr_enabled && in kvmppc_handle_exit_pr()
1311 vcpu->arch.hcall_needed = 1; in kvmppc_handle_exit_pr()
1313 } else if (vcpu->arch.osi_enabled && in kvmppc_handle_exit_pr()
1323 vcpu->arch.osi_needed = 1; in kvmppc_handle_exit_pr()
1346 if (vcpu->arch.hflags & BOOK3S_HFLAG_PAIRED_SINGLE) { in kvmppc_handle_exit_pr()
1398 r = kvmppc_handle_fac(vcpu, vcpu->arch.shadow_fscr >> 56); in kvmppc_handle_exit_pr()
1416 ulong shadow_srr1 = vcpu->arch.shadow_srr1; in kvmppc_handle_exit_pr()
1459 sregs->pvr = vcpu->arch.pvr; in kvm_arch_vcpu_ioctl_get_sregs_pr()
1462 if (vcpu->arch.hflags & BOOK3S_HFLAG_SLB) { in kvm_arch_vcpu_ioctl_get_sregs_pr()
1464 sregs->u.s.ppc64.slb[i].slbe = vcpu->arch.slb[i].orige | i; in kvm_arch_vcpu_ioctl_get_sregs_pr()
1465 sregs->u.s.ppc64.slb[i].slbv = vcpu->arch.slb[i].origv; in kvm_arch_vcpu_ioctl_get_sregs_pr()
1490 if (vcpu->arch.hflags & BOOK3S_HFLAG_SLB) { in kvm_arch_vcpu_ioctl_set_sregs_pr()
1492 vcpu->arch.mmu.slbmte(vcpu, 0, 0); in kvm_arch_vcpu_ioctl_set_sregs_pr()
1493 vcpu->arch.mmu.slbia(vcpu); in kvm_arch_vcpu_ioctl_set_sregs_pr()
1500 vcpu->arch.mmu.slbmte(vcpu, rs, rb); in kvm_arch_vcpu_ioctl_set_sregs_pr()
1506 vcpu->arch.mmu.mtsrin(vcpu, i, sregs->u.s.ppc32.sr[i]); in kvm_arch_vcpu_ioctl_set_sregs_pr()
1546 if (vcpu->arch.intr_msr & MSR_LE) in kvmppc_get_one_reg_pr()
1553 *val = get_reg_val(id, vcpu->arch.tfhar); in kvmppc_get_one_reg_pr()
1556 *val = get_reg_val(id, vcpu->arch.tfiar); in kvmppc_get_one_reg_pr()
1559 *val = get_reg_val(id, vcpu->arch.texasr); in kvmppc_get_one_reg_pr()
1563 vcpu->arch.gpr_tm[id-KVM_REG_PPC_TM_GPR0]); in kvmppc_get_one_reg_pr()
1572 val->vsxval[j] = vcpu->arch.fp_tm.fpr[i][j]; in kvmppc_get_one_reg_pr()
1575 val->vval = vcpu->arch.vr_tm.vr[i-32]; in kvmppc_get_one_reg_pr()
1582 *val = get_reg_val(id, vcpu->arch.cr_tm); in kvmppc_get_one_reg_pr()
1585 *val = get_reg_val(id, vcpu->arch.xer_tm); in kvmppc_get_one_reg_pr()
1588 *val = get_reg_val(id, vcpu->arch.lr_tm); in kvmppc_get_one_reg_pr()
1591 *val = get_reg_val(id, vcpu->arch.ctr_tm); in kvmppc_get_one_reg_pr()
1594 *val = get_reg_val(id, vcpu->arch.fp_tm.fpscr); in kvmppc_get_one_reg_pr()
1597 *val = get_reg_val(id, vcpu->arch.amr_tm); in kvmppc_get_one_reg_pr()
1600 *val = get_reg_val(id, vcpu->arch.ppr_tm); in kvmppc_get_one_reg_pr()
1603 *val = get_reg_val(id, vcpu->arch.vrsave_tm); in kvmppc_get_one_reg_pr()
1607 *val = get_reg_val(id, vcpu->arch.vr_tm.vscr.u[3]); in kvmppc_get_one_reg_pr()
1612 *val = get_reg_val(id, vcpu->arch.dscr_tm); in kvmppc_get_one_reg_pr()
1615 *val = get_reg_val(id, vcpu->arch.tar_tm); in kvmppc_get_one_reg_pr()
1629 vcpu->arch.intr_msr |= MSR_LE; in kvmppc_set_lpcr_pr()
1631 vcpu->arch.intr_msr &= ~MSR_LE; in kvmppc_set_lpcr_pr()
1653 vcpu->arch.tfhar = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1656 vcpu->arch.tfiar = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1659 vcpu->arch.texasr = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1662 vcpu->arch.gpr_tm[id - KVM_REG_PPC_TM_GPR0] = in kvmppc_set_one_reg_pr()
1672 vcpu->arch.fp_tm.fpr[i][j] = val->vsxval[j]; in kvmppc_set_one_reg_pr()
1675 vcpu->arch.vr_tm.vr[i-32] = val->vval; in kvmppc_set_one_reg_pr()
1681 vcpu->arch.cr_tm = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1684 vcpu->arch.xer_tm = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1687 vcpu->arch.lr_tm = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1690 vcpu->arch.ctr_tm = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1693 vcpu->arch.fp_tm.fpscr = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1696 vcpu->arch.amr_tm = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1699 vcpu->arch.ppr_tm = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1702 vcpu->arch.vrsave_tm = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1706 vcpu->arch.vr.vscr.u[3] = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1711 vcpu->arch.dscr_tm = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1714 vcpu->arch.tar_tm = set_reg_val(id, *val); in kvmppc_set_one_reg_pr()
1736 vcpu->arch.book3s = vcpu_book3s; in kvmppc_core_vcpu_create_pr()
1739 vcpu->arch.shadow_vcpu = in kvmppc_core_vcpu_create_pr()
1740 kzalloc(sizeof(*vcpu->arch.shadow_vcpu), GFP_KERNEL); in kvmppc_core_vcpu_create_pr()
1741 if (!vcpu->arch.shadow_vcpu) in kvmppc_core_vcpu_create_pr()
1748 vcpu->arch.shared = (void *)p; in kvmppc_core_vcpu_create_pr()
1752 vcpu->arch.shared_big_endian = true; in kvmppc_core_vcpu_create_pr()
1754 vcpu->arch.shared_big_endian = false; in kvmppc_core_vcpu_create_pr()
1762 vcpu->arch.pvr = 0x3C0301; in kvmppc_core_vcpu_create_pr()
1764 vcpu->arch.pvr = mfspr(SPRN_PVR); in kvmppc_core_vcpu_create_pr()
1765 vcpu->arch.intr_msr = MSR_SF; in kvmppc_core_vcpu_create_pr()
1768 vcpu->arch.pvr = 0x84202; in kvmppc_core_vcpu_create_pr()
1769 vcpu->arch.intr_msr = 0; in kvmppc_core_vcpu_create_pr()
1771 kvmppc_set_pvr_pr(vcpu, vcpu->arch.pvr); in kvmppc_core_vcpu_create_pr()
1772 vcpu->arch.slb_nr = 64; in kvmppc_core_vcpu_create_pr()
1774 vcpu->arch.shadow_msr = MSR_USER64 & ~MSR_LE; in kvmppc_core_vcpu_create_pr()
1783 free_page((unsigned long)vcpu->arch.shared); in kvmppc_core_vcpu_create_pr()
1786 kfree(vcpu->arch.shadow_vcpu); in kvmppc_core_vcpu_create_pr()
1799 free_page((unsigned long)vcpu->arch.shared & PAGE_MASK); in kvmppc_core_vcpu_free_pr()
1801 kfree(vcpu->arch.shadow_vcpu); in kvmppc_core_vcpu_free_pr()
1811 if (!vcpu->arch.sane) { in kvmppc_vcpu_run_pr()
1952 if (vcpu && (vcpu->arch.hflags & BOOK3S_HFLAG_MULTI_PGSIZE)) { in kvm_vm_ioctl_get_smmu_info_pr()
1995 mutex_init(&kvm->arch.hpt_mutex); in kvmppc_core_init_vm_pr()
2014 WARN_ON(!list_empty(&kvm->arch.spapr_tce_tables)); in kvmppc_core_destroy_vm_pr()