[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 45/48] target/ppc: Remove type argument from mmubooke_check_tlb
From: |
David Gibson |
Subject: |
[PULL 45/48] target/ppc: Remove type argument from mmubooke_check_tlb |
Date: |
Wed, 19 May 2021 22:51:45 +1000 |
From: Richard Henderson <richard.henderson@linaro.org>
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>
Message-Id: <20210518201146.794854-13-richard.henderson@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
target/ppc/mmu_helper.c | 44 ++++++++++++-----------------------------
1 file changed, 13 insertions(+), 31 deletions(-)
diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
index 1426973b4d..4e5cc11b44 100644
--- a/target/ppc/mmu_helper.c
+++ b/target/ppc/mmu_helper.c
@@ -738,9 +738,9 @@ void store_40x_sler(CPUPPCState *env, uint32_t val)
static int mmubooke_check_tlb(CPUPPCState *env, ppcemb_tlb_t *tlb,
hwaddr *raddr, int *prot, target_ulong address,
- MMUAccessType access_type, int type, int i)
+ MMUAccessType access_type, int i)
{
- int ret, prot2;
+ int prot2;
if (ppcemb_tlb_check(env, tlb, raddr, address,
env->spr[SPR_BOOKE_PID],
@@ -772,37 +772,19 @@ found_tlb:
}
/* Check the address space */
- if (type == ACCESS_CODE) {
- if (msr_ir != (tlb->attr & 1)) {
- 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 (msr_dr != (tlb->attr & 1)) {
- 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;
- }
+ if ((access_type == MMU_INST_FETCH ? msr_ir : msr_dr) != (tlb->attr & 1)) {
+ LOG_SWTLB("%s: AS doesn't match\n", __func__);
+ return -1;
+ }
- LOG_SWTLB("%s: PAGE_READ/WRITE doesn't match: %x\n", __func__, prot2);
- ret = -2;
+ *prot = prot2;
+ if (prot2 & prot_for_access_type(access_type)) {
+ LOG_SWTLB("%s: good TLB!\n", __func__);
+ return 0;
}
- return ret;
+ LOG_SWTLB("%s: no prot match: %x\n", __func__, prot2);
+ return access_type == MMU_INST_FETCH ? -3 : -2;
}
static int mmubooke_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
@@ -819,7 +801,7 @@ static int mmubooke_get_physical_address(CPUPPCState *env,
mmu_ctx_t *ctx,
for (i = 0; i < env->nb_tlb; i++) {
tlb = &env->tlb.tlbe[i];
ret = mmubooke_check_tlb(env, tlb, &raddr, &ctx->prot, address,
- access_type, type, i);
+ access_type, i);
if (ret != -1) {
break;
}
--
2.31.1
- [PULL 31/48] target/ppc: Mark helper_raise_exception* as noreturn, (continued)
- [PULL 31/48] target/ppc: Mark helper_raise_exception* as noreturn, David Gibson, 2021/05/19
- [PULL 41/48] target/ppc: Remove type argument from ppc6xx_tlb_pte_check, David Gibson, 2021/05/19
- [PULL 33/48] target/ppc: Fix load endianness for lxvwsx/lxvdsx, David Gibson, 2021/05/19
- [PULL 38/48] target/ppc: Rename access_type to type in mmu_helper.c, David Gibson, 2021/05/19
- [PULL 37/48] target/ppc: Use MMUAccessType in mmu-hash32.c, David Gibson, 2021/05/19
- [PULL 39/48] target/ppc: Use MMUAccessType in mmu_helper.c, David Gibson, 2021/05/19
- [PULL 35/48] target/ppc: Use MMUAccessType in mmu-radix64.c, David Gibson, 2021/05/19
- [PULL 36/48] target/ppc: Use MMUAccessType in mmu-hash64.c, David Gibson, 2021/05/19
- [PULL 40/48] target/ppc: Remove type argument from check_prot, David Gibson, 2021/05/19
- [PULL 44/48] target/ppc: Remove type argument from mmu40x_get_physical_address, David Gibson, 2021/05/19
- [PULL 45/48] target/ppc: Remove type argument from mmubooke_check_tlb,
David Gibson <=
- [PULL 42/48] target/ppc: Remove type argument from ppc6xx_tlb_check, David Gibson, 2021/05/19
- [PULL 43/48] target/ppc: Remove type argument from get_bat_6xx_tlb, David Gibson, 2021/05/19
- [PULL 46/48] target/ppc: Remove type argument from mmubooke_get_physical_address, David Gibson, 2021/05/19
- [PULL 47/48] target/ppc: Remove type argument from mmubooke206_check_tlb, David Gibson, 2021/05/19
- [PULL 48/48] target/ppc: Remove type argument for mmubooke206_get_physical_address, David Gibson, 2021/05/19
- Re: [PULL 00/48] ppc-for-6.1 queue 20210519, no-reply, 2021/05/19
- Re: [PULL 00/48] ppc-for-6.1 queue 20210519, Peter Maydell, 2021/05/20