Lines Matching refs:ptw

75 static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
81 static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *ptw,
535 static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, in S1_ptw_translate() argument
538 ARMMMUIdx mmu_idx = ptw->in_mmu_idx; in S1_ptw_translate()
539 ARMMMUIdx s2_mmu_idx = ptw->in_ptw_idx; in S1_ptw_translate()
542 ptw->out_virt = addr; in S1_ptw_translate()
544 if (unlikely(ptw->in_debug)) { in S1_ptw_translate()
549 ARMSecuritySpace s2_space = S2_security_space(ptw->in_space, s2_mmu_idx); in S1_ptw_translate()
562 ptw->out_phys = s2.f.phys_addr; in S1_ptw_translate()
564 ptw->out_host = NULL; in S1_ptw_translate()
565 ptw->out_rw = false; in S1_ptw_translate()
566 ptw->out_space = s2.f.attrs.space; in S1_ptw_translate()
575 &ptw->out_host, &full); in S1_ptw_translate()
581 ptw->out_phys = full->phys_addr | (addr & ~TARGET_PAGE_MASK); in S1_ptw_translate()
582 ptw->out_rw = full->prot & PAGE_WRITE; in S1_ptw_translate()
584 ptw->out_space = full->attrs.space; in S1_ptw_translate()
591 uint64_t hcr = arm_hcr_el2_eff_secstate(env, ptw->in_space); in S1_ptw_translate()
602 fi->s1ns = fault_s1ns(ptw->in_space, s2_mmu_idx); in S1_ptw_translate()
607 ptw->out_be = regime_translation_big_endian(env, mmu_idx); in S1_ptw_translate()
618 fi->s1ns = fault_s1ns(ptw->in_space, s2_mmu_idx); in S1_ptw_translate()
623 static uint32_t arm_ldl_ptw(CPUARMState *env, S1Translate *ptw, in arm_ldl_ptw() argument
627 void *host = ptw->out_host; in arm_ldl_ptw()
633 if (ptw->out_be) { in arm_ldl_ptw()
641 .space = ptw->out_space, in arm_ldl_ptw()
642 .secure = arm_space_is_secure(ptw->out_space), in arm_ldl_ptw()
647 if (ptw->out_be) { in arm_ldl_ptw()
648 data = address_space_ldl_be(as, ptw->out_phys, attrs, &result); in arm_ldl_ptw()
650 data = address_space_ldl_le(as, ptw->out_phys, attrs, &result); in arm_ldl_ptw()
661 static uint64_t arm_ldq_ptw(CPUARMState *env, S1Translate *ptw, in arm_ldq_ptw() argument
665 void *host = ptw->out_host; in arm_ldq_ptw()
672 if (ptw->out_be) { in arm_ldq_ptw()
678 if (ptw->out_be) { in arm_ldq_ptw()
687 .space = ptw->out_space, in arm_ldq_ptw()
688 .secure = arm_space_is_secure(ptw->out_space), in arm_ldq_ptw()
693 if (ptw->out_be) { in arm_ldq_ptw()
694 data = address_space_ldq_be(as, ptw->out_phys, attrs, &result); in arm_ldq_ptw()
696 data = address_space_ldq_le(as, ptw->out_phys, attrs, &result); in arm_ldq_ptw()
708 uint64_t new_val, S1Translate *ptw, in arm_casq_ptw() argument
713 void *host = ptw->out_host; in arm_casq_ptw()
724 if (unlikely(!ptw->out_rw)) { in arm_casq_ptw()
728 flags = probe_access_full_mmu(env, ptw->out_virt, 0, in arm_casq_ptw()
730 arm_to_core_mmu_idx(ptw->in_ptw_idx), in arm_casq_ptw()
742 fi->s2addr = ptw->out_virt; in arm_casq_ptw()
745 fi->s1ns = fault_s1ns(ptw->in_space, ptw->in_ptw_idx); in arm_casq_ptw()
750 ptw->out_rw = true; in arm_casq_ptw()
754 if (ptw->out_be) { in arm_casq_ptw()
779 if (ptw->out_be) { in arm_casq_ptw()
923 static bool get_phys_addr_v5(CPUARMState *env, S1Translate *ptw, in get_phys_addr_v5() argument
939 if (!get_level1_table_address(env, ptw->in_mmu_idx, &table, address)) { in get_phys_addr_v5()
944 if (!S1_ptw_translate(env, ptw, table, fi)) { in get_phys_addr_v5()
947 desc = arm_ldl_ptw(env, ptw, fi); in get_phys_addr_v5()
953 if (regime_el(env, ptw->in_mmu_idx) == 1) { in get_phys_addr_v5()
985 if (!S1_ptw_translate(env, ptw, table, fi)) { in get_phys_addr_v5()
988 desc = arm_ldl_ptw(env, ptw, fi); in get_phys_addr_v5()
1032 result->f.prot = ap_to_rw_prot(env, ptw->in_mmu_idx, ap, domain_prot); in get_phys_addr_v5()
1047 static bool get_phys_addr_v6(CPUARMState *env, S1Translate *ptw, in get_phys_addr_v6() argument
1052 ARMMMUIdx mmu_idx = ptw->in_mmu_idx; in get_phys_addr_v6()
1074 if (!S1_ptw_translate(env, ptw, table, fi)) { in get_phys_addr_v6()
1077 desc = arm_ldl_ptw(env, ptw, fi); in get_phys_addr_v6()
1130 if (!S1_ptw_translate(env, ptw, table, fi)) { in get_phys_addr_v6()
1133 desc = arm_ldl_ptw(env, ptw, fi); in get_phys_addr_v6()
1600 static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, in get_phys_addr_lpae() argument
1606 ARMMMUIdx mmu_idx = ptw->in_mmu_idx; in get_phys_addr_lpae()
1796 if (ptw->in_space == ARMSS_Secure in get_phys_addr_lpae()
1805 ptw->in_ptw_idx += 1; in get_phys_addr_lpae()
1806 ptw->in_space = ARMSS_NonSecure; in get_phys_addr_lpae()
1809 if (!S1_ptw_translate(env, ptw, descaddr, fi)) { in get_phys_addr_lpae()
1812 descriptor = arm_ldq_ptw(env, ptw, fi); in get_phys_addr_lpae()
1873 if (likely(!ptw->in_debug)) { in get_phys_addr_lpae()
1925 out_space = ptw->in_space; in get_phys_addr_lpae()
1938 result->f.prot = get_S2prot(env, ap, xn, ptw->in_s1_is_el0); in get_phys_addr_lpae()
2007 new_descriptor = arm_casq_ptw(env, descriptor, new_descriptor, ptw, fi); in get_phys_addr_lpae()
2069 fi->s1ns = fault_s1ns(ptw->in_space, mmu_idx); in get_phys_addr_lpae()
2074 S1Translate *ptw, in get_phys_addr_pmsav5() argument
2083 ARMMMUIdx mmu_idx = ptw->in_mmu_idx; in get_phys_addr_pmsav5()
2086 if (regime_translation_disabled(env, mmu_idx, ptw->in_space)) { in get_phys_addr_pmsav5()
2242 S1Translate *ptw, in get_phys_addr_pmsav7() argument
2250 ARMMMUIdx mmu_idx = ptw->in_mmu_idx; in get_phys_addr_pmsav7()
2252 bool secure = arm_space_is_secure(ptw->in_space); in get_phys_addr_pmsav7()
2258 if (regime_translation_disabled(env, mmu_idx, ptw->in_space) || in get_phys_addr_pmsav7()
2773 S1Translate *ptw, in get_phys_addr_pmsav8() argument
2780 ARMMMUIdx mmu_idx = ptw->in_mmu_idx; in get_phys_addr_pmsav8()
2781 bool secure = arm_space_is_secure(ptw->in_space); in get_phys_addr_pmsav8()
3085 S1Translate *ptw, in get_phys_addr_disabled() argument
3091 ARMMMUIdx mmu_idx = ptw->in_mmu_idx; in get_phys_addr_disabled()
3137 uint64_t hcr = arm_hcr_el2_eff_secstate(env, ptw->in_space); in get_phys_addr_disabled()
3168 static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, in get_phys_addr_twostage() argument
3176 ARMSecuritySpace in_space = ptw->in_space; in get_phys_addr_twostage()
3182 ret = get_phys_addr_nogpc(env, ptw, address, access_type, result, fi); in get_phys_addr_twostage()
3193 ptw->in_s1_is_el0 = ptw->in_mmu_idx == ARMMMUIdx_Stage1_E0; in get_phys_addr_twostage()
3194 ptw->in_mmu_idx = ipa_secure ? ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2; in get_phys_addr_twostage()
3195 ptw->in_space = ipa_space; in get_phys_addr_twostage()
3196 ptw->in_ptw_idx = ptw_idx_for_stage_2(env, ptw->in_mmu_idx); in get_phys_addr_twostage()
3208 ret = get_phys_addr_nogpc(env, ptw, ipa, access_type, result, fi); in get_phys_addr_twostage()
3273 static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, in get_phys_addr_nogpc() argument
3279 ARMMMUIdx mmu_idx = ptw->in_mmu_idx; in get_phys_addr_nogpc()
3287 result->f.attrs.space = ptw->in_space; in get_phys_addr_nogpc()
3288 result->f.attrs.secure = arm_space_is_secure(ptw->in_space); in get_phys_addr_nogpc()
3296 return get_phys_addr_disabled(env, ptw, address, access_type, in get_phys_addr_nogpc()
3306 ptw->in_ptw_idx = (ptw->in_space == ARMSS_Secure) ? in get_phys_addr_nogpc()
3317 ptw->in_ptw_idx = ptw_idx_for_stage_2(env, mmu_idx); in get_phys_addr_nogpc()
3334 ptw->in_mmu_idx = mmu_idx = s1_mmu_idx; in get_phys_addr_nogpc()
3336 !regime_translation_disabled(env, ARMMMUIdx_Stage2, ptw->in_space)) { in get_phys_addr_nogpc()
3337 return get_phys_addr_twostage(env, ptw, address, access_type, in get_phys_addr_nogpc()
3344 ptw->in_ptw_idx = arm_space_to_phys(ptw->in_space); in get_phys_addr_nogpc()
3369 ret = get_phys_addr_pmsav8(env, ptw, address, access_type, in get_phys_addr_nogpc()
3373 ret = get_phys_addr_pmsav7(env, ptw, address, access_type, in get_phys_addr_nogpc()
3377 ret = get_phys_addr_pmsav5(env, ptw, address, access_type, in get_phys_addr_nogpc()
3395 if (regime_translation_disabled(env, mmu_idx, ptw->in_space)) { in get_phys_addr_nogpc()
3396 return get_phys_addr_disabled(env, ptw, address, access_type, in get_phys_addr_nogpc()
3401 return get_phys_addr_lpae(env, ptw, address, access_type, result, fi); in get_phys_addr_nogpc()
3404 return get_phys_addr_v6(env, ptw, address, access_type, result, fi); in get_phys_addr_nogpc()
3406 return get_phys_addr_v5(env, ptw, address, access_type, result, fi); in get_phys_addr_nogpc()
3410 static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *ptw, in get_phys_addr_gpc() argument
3416 if (get_phys_addr_nogpc(env, ptw, address, access_type, result, fi)) { in get_phys_addr_gpc()
3433 S1Translate ptw = { in get_phys_addr_with_space_nogpc() local
3437 return get_phys_addr_nogpc(env, &ptw, address, access_type, result, fi); in get_phys_addr_with_space_nogpc()
3444 S1Translate ptw = { in get_phys_addr() local
3505 ptw.in_space = ss; in get_phys_addr()
3506 return get_phys_addr_gpc(env, &ptw, address, access_type, result, fi); in get_phys_addr()
3516 S1Translate ptw = { in arm_cpu_get_phys_page_attrs_debug() local
3525 ret = get_phys_addr_gpc(env, &ptw, addr, MMU_DATA_LOAD, &res, &fi); in arm_cpu_get_phys_page_attrs_debug()