From nobody Tue Feb 10 03:39:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1621430871; cv=none; d=zohomail.com; s=zohoarc; b=R6gkWtog1vuSZgCa56JcICAiqGwjwweHQl4Z6T5a00xgaOaE0JYJd/jmaW7ry/V2S4YjGeJk0KMjA2n0h5PbHx2nluTjgy/5un+tPnkOajycVoTExwTi7FnpLQJw0F51Y/CLp5z7ezKrTqO6K9+Rc21uIa+wIghrcfY3LhPt5lI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621430871; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6+ug2BJNJCxIE3rcs+akdzEB16psrEApknLwfo40JP4=; b=lK45DYNSp/COFYpmUUba9ZkYmr0hlknUUpUyCJJFFaa0PSZ0wRD0YrJOyoP80lB+pQKMpsy3Ybuj4XYGc+gMJ1ofY1j4gXstatawbjQDw5uSvenYA+FdfVSSC/a6UBByd0TNtlzzfs6llmGpeb2ZMBAzrio6d1ZtJdIC7RuZwqc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621430871491748.5162746598362; Wed, 19 May 2021 06:27:51 -0700 (PDT) Received: from localhost ([::1]:46526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljMEn-00063w-JL for importer@patchew.org; Wed, 19 May 2021 09:27:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljLhl-0002Hv-Nf; Wed, 19 May 2021 08:53:43 -0400 Received: from ozlabs.org ([203.11.71.1]:50731) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljLhi-0001Xp-E2; Wed, 19 May 2021 08:53:40 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4FlXnp1JT1z9t9y; Wed, 19 May 2021 22:52:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1621428734; bh=YLQV41tCRO0Sn+ZD8X4LB0WgTPfP62gFsVq0Rcx24EI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n3KAM+HZOnlUAtSE3L4VD8o1tH3ngwXlVveTnBZe1HowlL/F0MW0DNJDefuFVNmuk Rr4C2hJvYm8gkTRne9PE3VRZotWJhSOHcjZe7LIh1n3IIljilvYZ3ufEJhl7b8GDMR PtoGKCXnUp83YbEi2G3J6oRyazJEspehcokACcsw= From: David Gibson To: peter.maydell@linaro.org, groug@kaod.org Subject: [PULL 40/48] target/ppc: Remove type argument from check_prot Date: Wed, 19 May 2021 22:51:40 +1000 Message-Id: <20210519125148.27720-41-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210519125148.27720-1-david@gibson.dropbear.id.au> References: <20210519125148.27720-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: richard.henderson@linaro.org, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Richard Henderson We can now use MMU_INST_FETCH from access_type for this. Use prot_for_access_type to simplify everything. Signed-off-by: Richard Henderson Message-Id: <20210518201146.794854-8-richard.henderson@linaro.org> [dwg: Remove a stray trailing whitespace] Signed-off-by: David Gibson --- target/ppc/mmu_helper.c | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index 2aa1b777de..2c813af924 100644 --- a/target/ppc/mmu_helper.c +++ b/target/ppc/mmu_helper.c @@ -32,6 +32,7 @@ #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/qemu-print.h" +#include "internal.h" #include "mmu-book3s-v3.h" #include "mmu-radix64.h" =20 @@ -126,31 +127,9 @@ static int pp_check(int key, int pp, int nx) return access; } =20 -static int check_prot(int prot, MMUAccessType access_type, int type) +static int check_prot(int prot, MMUAccessType access_type) { - int ret; - - if (type =3D=3D ACCESS_CODE) { - if (prot & PAGE_EXEC) { - ret =3D 0; - } else { - ret =3D -2; - } - } else if (access_type =3D=3D MMU_DATA_STORE) { - if (prot & PAGE_WRITE) { - ret =3D 0; - } else { - ret =3D -2; - } - } else { - if (prot & PAGE_READ) { - ret =3D 0; - } else { - ret =3D -2; - } - } - - return ret; + return prot & prot_for_access_type(access_type) ? 0 : -2; } =20 static int ppc6xx_tlb_pte_check(mmu_ctx_t *ctx, target_ulong pte0, @@ -182,7 +161,7 @@ static int ppc6xx_tlb_pte_check(mmu_ctx_t *ctx, target_= ulong pte0, /* Keep the matching PTE information */ ctx->raddr =3D pte1; ctx->prot =3D access; - ret =3D check_prot(ctx->prot, access_type, type); + ret =3D check_prot(ctx->prot, access_type); if (ret =3D=3D 0) { /* Access granted */ qemu_log_mask(CPU_LOG_MMU, "PTE access granted !\n"); @@ -441,7 +420,7 @@ static int get_bat_6xx_tlb(CPUPPCState *env, mmu_ctx_t = *ctx, (virtual & 0x0001F000); /* Compute access rights */ ctx->prot =3D prot; - ret =3D check_prot(ctx->prot, access_type, type); + ret =3D check_prot(ctx->prot, access_type); if (ret =3D=3D 0) { LOG_BATS("BAT %d match: r " TARGET_FMT_plx " prot=3D%c= %c\n", i, ctx->raddr, ctx->prot & PAGE_READ ? 'R' : = '-', @@ -733,7 +712,7 @@ static int mmu40x_get_physical_address(CPUPPCState *env= , mmu_ctx_t *ctx, check_perms: /* Check from TLB entry */ ctx->prot =3D tlb->prot; - ret =3D check_prot(ctx->prot, access_type, type); + ret =3D check_prot(ctx->prot, access_type); if (ret =3D=3D -2) { env->spr[SPR_40x_ESR] =3D 0; } --=20 2.31.1