[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/24] target/ppc: Remove type argument from mmubooke206_check_tl
From: |
Richard Henderson |
Subject: |
[PATCH 14/24] target/ppc: Remove type argument from mmubooke206_check_tlb |
Date: |
Tue, 18 May 2021 15:11:36 -0500 |
We can now use MMU_INST_FETCH from access_type for this.
Unify the I/D code paths, making use of prot_for_access_type.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/ppc/mmu_helper.c | 50 ++++++++++++++---------------------------
1 file changed, 17 insertions(+), 33 deletions(-)
diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
index bf0fcca9be..90038e3e76 100644
--- a/target/ppc/mmu_helper.c
+++ b/target/ppc/mmu_helper.c
@@ -944,10 +944,8 @@ static bool mmubooke206_get_as(CPUPPCState *env,
static int mmubooke206_check_tlb(CPUPPCState *env, ppcmas_tlb_t *tlb,
hwaddr *raddr, int *prot,
target_ulong address,
- MMUAccessType access_type,
- int type, int mmu_idx)
+ MMUAccessType access_type, int mmu_idx)
{
- int ret;
int prot2 = 0;
uint32_t epid;
bool as, pr;
@@ -1004,39 +1002,25 @@ found_tlb:
}
/* Check the address space and permissions */
- if (type == ACCESS_CODE) {
+ if (access_type == MMU_INST_FETCH) {
/* There is no way to fetch code using epid load */
assert(!use_epid);
- if (msr_ir != ((tlb->mas1 & MAS1_TS) >> MAS1_TS_SHIFT)) {
- LOG_SWTLB("%s: AS doesn't match\n", __func__);
- return -1;
- }
-
- *prot = prot2;
- if (prot2 & PAGE_EXEC) {
- LOG_SWTLB("%s: good TLB!\n", __func__);
- return 0;
- }
-
- LOG_SWTLB("%s: no PAGE_EXEC: %x\n", __func__, prot2);
- ret = -3;
- } else {
- if (as != ((tlb->mas1 & MAS1_TS) >> MAS1_TS_SHIFT)) {
- LOG_SWTLB("%s: AS doesn't match\n", __func__);
- return -1;
- }
-
- *prot = prot2;
- if (prot2 & (access_type == MMU_DATA_LOAD ? PAGE_READ : PAGE_WRITE)) {
- LOG_SWTLB("%s: found TLB!\n", __func__);
- return 0;
- }
-
- LOG_SWTLB("%s: PAGE_READ/WRITE doesn't match: %x\n", __func__, prot2);
- ret = -2;
+ as = msr_ir;
}
- return ret;
+ if (as != ((tlb->mas1 & MAS1_TS) >> MAS1_TS_SHIFT)) {
+ LOG_SWTLB("%s: AS doesn't match\n", __func__);
+ return -1;
+ }
+
+ *prot = prot2;
+ if (prot2 & prot_for_access_type(access_type)) {
+ LOG_SWTLB("%s: good TLB!\n", __func__);
+ return 0;
+ }
+
+ LOG_SWTLB("%s: no prot match: %x\n", __func__, prot2);
+ return access_type == MMU_INST_FETCH ? -3 : -2;
}
static int mmubooke206_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
@@ -1060,7 +1044,7 @@ static int mmubooke206_get_physical_address(CPUPPCState
*env, mmu_ctx_t *ctx,
continue;
}
ret = mmubooke206_check_tlb(env, tlb, &raddr, &ctx->prot, address,
- access_type, type, mmu_idx);
+ access_type, mmu_idx);
if (ret != -1) {
goto found_tlb;
}
--
2.25.1
- [PATCH 05/24] target/ppc: Rename access_type to type in mmu_helper.c, (continued)
- [PATCH 05/24] target/ppc: Rename access_type to type in mmu_helper.c, Richard Henderson, 2021/05/18
- [PATCH 08/24] target/ppc: Remove type argument from ppc6xx_tlb_pte_check, Richard Henderson, 2021/05/18
- [PATCH 07/24] target/ppc: Remove type argument from check_prot, Richard Henderson, 2021/05/18
- [PATCH 06/24] target/ppc: Use MMUAccessType in mmu_helper.c, Richard Henderson, 2021/05/18
- [PATCH 09/24] target/ppc: Remove type argument from ppc6xx_tlb_check, Richard Henderson, 2021/05/18
- [PATCH 11/24] target/ppc: Remove type argument from mmu40x_get_physical_address, Richard Henderson, 2021/05/18
- [PATCH 12/24] target/ppc: Remove type argument from mmubooke_check_tlb, Richard Henderson, 2021/05/18
- [PATCH 13/24] target/ppc: Remove type argument from mmubooke_get_physical_address, Richard Henderson, 2021/05/18
- [PATCH 10/24] target/ppc: Remove type argument from get_bat_6xx_tlb, Richard Henderson, 2021/05/18
- [PATCH 15/24] target/ppc: Remove type argument for mmubooke206_get_physical_address, Richard Henderson, 2021/05/18
- [PATCH 14/24] target/ppc: Remove type argument from mmubooke206_check_tlb,
Richard Henderson <=
- [PATCH 16/24] target/ppc: Remove PowerPCCPUClass.handle_mmu_fault, Richard Henderson, 2021/05/18
- [PATCH 17/24] target/ppc: Use MMUAccessType with *_handle_mmu_fault, Richard Henderson, 2021/05/18
- [PATCH 20/24] target/ppc: Split out ppc_hash64_xlate, Richard Henderson, 2021/05/18
- [PATCH 18/24] target/ppc: Push real-mode handling into ppc_radix64_xlate, Richard Henderson, 2021/05/18