From patchwork Tue May 18 20:11:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 441236 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp583761jac; Tue, 18 May 2021 13:23:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7PkCnNNvM8u9aetsnZT0Y1IyRpSv2k7K8ttgBVJ/E6stHmi8cZeLFli/8rENUqqdZmIrM X-Received: by 2002:a92:cd85:: with SMTP id r5mr6206493ilb.294.1621369381532; Tue, 18 May 2021 13:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621369381; cv=none; d=google.com; s=arc-20160816; b=rU1Z2wAes/xpBrYD+Ye/ORMm0zIJ3QYakMyQw595o0F0iEopJMOZ1pslW7++FSQBel Num25+w6DCOCx+LeMZ+jeCZq5pz+zmtDFCxXpORhcbnCq1EXCJXifoQoEk1aKJ1ETpaC aHo2pS+Ic/qV3BWfI8+Ha6OSwJRH6TP+yAGUN+HhQlzs+D3aW4rYk0Od6mO+nA/iTjHc WsO3MZ6QKnvFisvk0xSvPH1GR77Bb3bkkC4Jl3XR/W4ACP2HldpIiH57jzjTAB0CUBzn v4/Xb1+1M2X4gEIGhqamg44rPFOWTMVtKp6dCF9/qf3ehOGrzZBYQON/sk/Uqk1mKQGP Jzjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=XCI8pCW9Sv6UEY79hKdFH08fK4Rjq+LJfm07d74fiMU=; b=iDKokcmSFjNpJTr+ZvamStouij1LeRpLWPcAt0hyaRAnpbL+kmYnMa2SObdghoCzwV XdXPN+4SU/RcnRBBXgzCq2BPf7WnU5htM2G0pcjihvUNe/wzi0PqVicaCjNPEhEQcJts /fBSKimSFTMw/MZ5o3ZxcrR/jtxH6FUTLvS+cS3lXSUkilSxjdQHLlFo9MxRkfhLlaV4 LYZI/55V+zRMOw25ojDMvPQfMThj41J/xVj7Pyfb+ZqG6rXWzddlXXplNeLQo2xlXp78 jB521eYI+/kWrKaLj1a8zdrqirTngqtoh2HSTS1PQMmrOk4fzwaO7SnxY6wwvGVoSv83 4GYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pj3d9+cP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j11si22875268jat.42.2021.05.18.13.23.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 May 2021 13:23:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pj3d9+cP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lj6F3-0007gr-0k for patch@linaro.org; Tue, 18 May 2021 16:23:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lj64b-0000gt-VT for qemu-devel@nongnu.org; Tue, 18 May 2021 16:12:13 -0400 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]:43646) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lj64P-0006Fb-IX for qemu-devel@nongnu.org; Tue, 18 May 2021 16:12:13 -0400 Received: by mail-oi1-x22c.google.com with SMTP id j75so10932921oih.10 for ; Tue, 18 May 2021 13:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XCI8pCW9Sv6UEY79hKdFH08fK4Rjq+LJfm07d74fiMU=; b=pj3d9+cPiCp8LEIjefJO11Mus94aMLb7/Vz9FS7ifNi6ApHYavKN12J9ZTm2uLGd54 SdyAdmhHPv1SsW06CsCfrB2rFlAzvDhG7/HvMXRE8CsK2aCvA9V2KkNgmIwgFGr7rrp8 gmkhv/nN3AZ4x+KdjQ3EbGw6Bi8Lo1+PQgM8JZ966H20UljaYXu9i7z5NL7HDlWffBJ4 eYqZdY6CtDPPgkQpGMidhHOr3ureKi/0gVGkdn1cv5P6FKg5ynVB5l9o/3LMeMtFGUDK cyPdMEVOIF8hJLn6DDN1gbDrL1oxpZJ50M3nLK3MV8a/ninUNs6f4LiitQH9mwpjF1iK Z7Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XCI8pCW9Sv6UEY79hKdFH08fK4Rjq+LJfm07d74fiMU=; b=fklGMn7373ES81w4sO8QYrMZxlS0iliIIqpQrRDRBMPwrjQxQhKfXy4+U/X2FxMdV8 MfLNuCt9v4RD4yhqHTKOcHuAx0hK2gJAmxzQmNOKb6n95iWP0wScOjQ9gicNXuSvoHK6 QBdH5Ob9qW6BeE/nkXEx6t3BfgxMoM2D6f5w41rTZpQTsll3HSgLF0zZEmo/FMp4xBo1 94v7hxTu3SL4Bg8DmfnKMoUn+TG2FQQ33yhCc6EsqdgXxkAC974su87CsXUpsg7ylNNK LLzv4Xp6imbS6M1qfIgPFhJQbwi2iNsesZFbOWNAuWGfG5jPNKlWMmkUvUguCsDVOu63 sqKA== X-Gm-Message-State: AOAM531ReR+C10zeR4oCmb7WR1r2kS93S6ZROO+UwJs0TXct0WcQdiGq mzwYSQZKA/JRaJ9haLrBkodYApQpoV2FwvA9 X-Received: by 2002:aca:2b13:: with SMTP id i19mr5324407oik.138.1621368720383; Tue, 18 May 2021 13:12:00 -0700 (PDT) Received: from localhost.localdomain ([45.235.253.15]) by smtp.gmail.com with ESMTPSA id u27sm3953204oof.38.2021.05.18.13.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 13:12:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 12/24] target/ppc: Remove type argument from mmubooke_check_tlb Date: Tue, 18 May 2021 15:11:34 -0500 Message-Id: <20210518201146.794854-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210518201146.794854-1-richard.henderson@linaro.org> References: <20210518201146.794854-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22c; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bruno.larsen@eldorado.org.br, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- target/ppc/mmu_helper.c | 46 +++++++++++++---------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) -- 2.25.1 diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index 6860a2aea0..83e7e0dd13 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; - } - - LOG_SWTLB("%s: PAGE_READ/WRITE doesn't match: %x\n", __func__, prot2); - ret = -2; + if ((access_type == MMU_INST_FETCH ? msr_ir : msr_dr) != (tlb->attr & 1)) { + LOG_SWTLB("%s: AS doesn't match\n", __func__); + return -1; } - return ret; + *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 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; }