From nobody Fri Oct 18 08:40:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1721952741; cv=none; d=zohomail.com; s=zohoarc; b=ZbQ4Q55/IIQsqgyUDJnJfPRQZgecPFjsaw9XWBeT4ySjOzMNnrupT/rADVjwDeql9NYFUc4+tCv7i/3r0Fw8xlLFQ99VJeGj0TFAvvQRxiAHEplMy2UvQef+2g8K/mc/cD9vnYjEopCXTgCtUQOyEtFEcuE+TZaMuIbN579LcWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721952741; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nX6Lsm4o6dTs9bwPh6BsVax+d/K0njHWy4wuZsxBu9o=; b=j7qAAx8aK0F/U6MFouJPITuMK6hgEVOYzM0rLYQi/jTmmifYHzf1CCxHvM3zKq0os5B44DIIr65gzo5bru50sdxG/blmFQq6V76S5c/tLwgNHaNT5dJ7gvGAcppDhGhw3nlfrEv8j59X5PAwIRG3sDvp6gNvonNGmZPbtfGlx9Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721952741530573.2946887952526; Thu, 25 Jul 2024 17:12:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sX8MP-0001o1-K9; Thu, 25 Jul 2024 19:59:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sX8MH-0001MZ-V0; Thu, 25 Jul 2024 19:58:55 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sX8MF-0001eb-Dw; Thu, 25 Jul 2024 19:58:52 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2cb5b783c15so306298a91.2; Thu, 25 Jul 2024 16:58:50 -0700 (PDT) Received: from wheely.local0.net ([203.220.44.216]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cf28c7fef3sm2142060a91.16.2024.07.25.16.58.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jul 2024 16:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721951929; x=1722556729; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nX6Lsm4o6dTs9bwPh6BsVax+d/K0njHWy4wuZsxBu9o=; b=HpqsXZotx6D/YyQSTR4usU+kqGRwV65mVtJ6qrtNGOzS54M7LwINJY4TysQOLrsd0e Kd5wvR/0iT88k+vtByDhVImob+pgN0eW/jpJlUuOo9OwxqU17s/qM999SnXvK9vdsxYd BgvBX3hbuMr9yF3TeXJK81gVUB7b0zn+FJgYcnaVciFW/c66iOT6XwKSMzByHW1I/oGX nM2+2szrN1zH6d98AXrVVJjZF0k/GytBHeAEm9TlXimS5WHoXa154yfA39fUmozlh93q FqSUTIJlA2EV4948XHY8UExhj5RYKhjma65ECntK+wrx2YwAvZTmpfqtrq6NjBDcv259 LehA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721951929; x=1722556729; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nX6Lsm4o6dTs9bwPh6BsVax+d/K0njHWy4wuZsxBu9o=; b=FA/2mbw6Jt1Lxl30hHB90Y+wzn2hD6tdNFXBt3ZhqpqfbLF60INtGLI2SnzKDyj1jh 4fZzSwsWKAwxYp0NH3c5un9GhYuo/GkWne72dfRK+FSx2wdJWRBZaB8XzkK5sy4UrPtg tpYrr0++HnxNPBQX6nHbmtn4iPCYWx0oogpmXjzo4K+1tcZnGIJcGDE262hIA2uBa75E hFH0jaM4TAgtVdBD6noBRr06bENQVOHb9AUwVx11uNjPrF7K4ZgN/CEVe23w2BzFkAW/ YGviUXr/Jlr8Nc+XEJXxEyB+ZqkluO4Ri0P5/KBMv3SD/MEm3y9TGWkPhT+1ykIsEyYC DPBQ== X-Forwarded-Encrypted: i=1; AJvYcCWyxWhDSMPfbfDQiB97v5FVasScMJJVFgI0U4plHTL5Il5Ei5c4arbpqywXulfHDGM/rQrw3ztkHezL9aE4K4wVIB0N X-Gm-Message-State: AOJu0YwLBV7tsnI+UrrbmOT8WZO/pTLA9EzO7EbZTBpNk3JgujmFrAgV 3ZMT1PdKN1QRbFHr4ygQ//83B0h4BRGIfx6hQCN5M5xMcTwwBJ7NKygR4A== X-Google-Smtp-Source: AGHT+IGOhcIi8u9pkOADy4h4ZS+v2swJ2HprnKNRZ16yt7f3oV9wabSaI+q+TGj5fb8ZsjauSHNc/g== X-Received: by 2002:a17:90b:3810:b0:2c9:6d07:18f4 with SMTP id 98e67ed59e1d1-2cf239063c4mr5296152a91.35.1721951929549; Thu, 25 Jul 2024 16:58:49 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, BALATON Zoltan Subject: [PULL 75/96] target/ppc/mmu_common.c: Remove pte_update_flags() Date: Fri, 26 Jul 2024 09:53:48 +1000 Message-ID: <20240725235410.451624-76-npiggin@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240725235410.451624-1-npiggin@gmail.com> References: <20240725235410.451624-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::1034; envelope-from=npiggin@gmail.com; helo=mail-pj1-x1034.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1721952742874116600 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan This function is used only once, its return value is ignored and one of its parameter is a return value from a previous call. It is better to inline it in the caller and remove it. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin Signed-off-by: Nicholas Piggin --- target/ppc/mmu_common.c | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index e3537c63c0..c4902b7632 100644 --- a/target/ppc/mmu_common.c +++ b/target/ppc/mmu_common.c @@ -119,39 +119,14 @@ static int ppc6xx_tlb_pte_check(mmu_ctx_t *ctx, targe= t_ulong pte0, } } =20 -static int pte_update_flags(mmu_ctx_t *ctx, target_ulong *pte1p, - int ret, MMUAccessType access_type) -{ - int store =3D 0; - - /* Update page flags */ - if (!(*pte1p & 0x00000100)) { - /* Update accessed flag */ - *pte1p |=3D 0x00000100; - store =3D 1; - } - if (!(*pte1p & 0x00000080)) { - if (access_type =3D=3D MMU_DATA_STORE && ret =3D=3D 0) { - /* Update changed flag */ - *pte1p |=3D 0x00000080; - store =3D 1; - } else { - /* Force page fault for first write access */ - ctx->prot &=3D ~PAGE_WRITE; - } - } - - return store; -} - /* Software driven TLB helpers */ =20 static int ppc6xx_tlb_check(CPUPPCState *env, mmu_ctx_t *ctx, target_ulong eaddr, MMUAccessType access_type) { ppc6xx_tlb_t *tlb; - int nr, best, way; - int ret; + target_ulong *pte1p; + int nr, best, way, ret; =20 best =3D -1; ret =3D -1; /* No TLB found */ @@ -204,7 +179,17 @@ done: " prot=3D%01x ret=3D%d\n", ctx->raddr & TARGET_PAGE_MASK, ctx->prot, ret); /* Update page flags */ - pte_update_flags(ctx, &env->tlb.tlb6[best].pte1, ret, access_type); + pte1p =3D &env->tlb.tlb6[best].pte1; + *pte1p |=3D 0x00000100; /* Update accessed flag */ + if (!(*pte1p & 0x00000080)) { + if (access_type =3D=3D MMU_DATA_STORE && ret =3D=3D 0) { + /* Update changed flag */ + *pte1p |=3D 0x00000080; + } else { + /* Force page fault for first write access */ + ctx->prot &=3D ~PAGE_WRITE; + } + } } #if defined(DUMP_PAGE_TABLES) if (qemu_loglevel_mask(CPU_LOG_MMU)) { --=20 2.45.2