From nobody Thu Nov 28 10:48:11 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1693149550; cv=none; d=zohomail.com; s=zohoarc; b=lxbqHSzkprOKD/1DDjE0eATq8egBpmLsDvFakPWseKdaPdtkQfhFYiV8ZFtHOI8co+4RToUBW9q0a7XY8TRPcuuv1QcFyAz67eVMIgVYchPFY7MYo+SLP7SoQwtjLJTob3GS+kU5b6MMtdBosyQ5c95UDUrKTKUg3/3NmpMt7/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693149550; h=Content-Type: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=Uh0FOlavj6R4bzNSW1hpVYDwR3IZPK1291ObDwR7hAI=; b=mI7x0P6hVxOQ36C9rTnpkQIlngNfTLz2BylzSEIsHgVIhkaf+RxAim9IRGApDbhrQ8i2ZCyUaZrY0Ez1mYlhNikXUjzHWODFaFvDQRfSn2fqwEJDFYv09KEdNfRWmG5nYNayyJM2VIJpY1Hx5GopB9MGi1tJGolM2sfekmLNig8= 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 1693149550571205.853101716036; Sun, 27 Aug 2023 08:19:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qaHWi-000878-6j; Sun, 27 Aug 2023 11:18:08 -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 1qaHWd-00085f-1U for qemu-devel@nongnu.org; Sun, 27 Aug 2023 11:18:05 -0400 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qaHWZ-0006MP-Aw for qemu-devel@nongnu.org; Sun, 27 Aug 2023 11:18:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A367B60B5B; Sun, 27 Aug 2023 15:17:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCE51C433C9; Sun, 27 Aug 2023 15:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693149477; bh=/QhnCG1n9XlObV83D3BWo3qXZwJLh8PEl4X2ZK1Xi7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LOcQIA9y60pUzHhZ4NXMyuSFSz1iOEMY9iae4E3ToAGfQCpHhJDV/PoUY8/ESPaM9 a45GtzWfHJ/+y5xPZI+0mDRaRgPcSYYyCq6WkGDwqxyOzFXUAHS/I8lf+If+99IDhV Y5ljMN5k7srvNorIUbb+w3FO2A4Kk/NEvFFoYFGjpGRmpS6vw7eFdcaQ7Jc3f57n74 gDKJKy1QJKM+wECvilqydqpKINqMjTsMdwpKtxl+E/YLYSxXp6KdhrKCyFj2A5mbYU DQs8N/OYEpkkMNHK5LtMb1aWpnQ+C5GfRl+sSqxj4K/NUdEQ54+5O8J7/phEIti23J B0+3ttPbWfprQ== From: deller@kernel.org To: Richard Henderson , Peter Maydell , qemu-devel@nongnu.org Cc: Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 4/5] target/hppa: Use privilege helper in hppa_get_physical_address() Date: Sun, 27 Aug 2023 17:17:45 +0200 Message-ID: <20230827151747.290653-5-deller@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230827151747.290653-1-deller@kernel.org> References: <20230827151747.290653-1-deller@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2604:1380:4641:c500::1; envelope-from=deller@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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 @kernel.org) X-ZM-MESSAGEID: 1693149550762100001 From: Helge Deller Convert hppa_get_physical_address() to use the privilege helper macro. Signed-off-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/hppa/mem_helper.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 6f04c101dd..46c3dcaf15 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -73,7 +73,7 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr ad= dr, int mmu_idx, int type, hwaddr *pphys, int *pprot) { hwaddr phys; - int prot, r_prot, w_prot, x_prot; + int prot, r_prot, w_prot, x_prot, priv; hppa_tlb_entry *ent; int ret =3D -1; =20 @@ -97,9 +97,10 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr a= ddr, int mmu_idx, phys =3D ent->pa + (addr & ~TARGET_PAGE_MASK); =20 /* Map TLB access_rights field to QEMU protection. */ - r_prot =3D (mmu_idx <=3D ent->ar_pl1) * PAGE_READ; - w_prot =3D (mmu_idx <=3D ent->ar_pl2) * PAGE_WRITE; - x_prot =3D (ent->ar_pl2 <=3D mmu_idx && mmu_idx <=3D ent->ar_pl1) * PA= GE_EXEC; + priv =3D MMU_IDX_TO_PRIV(mmu_idx); + r_prot =3D (priv <=3D ent->ar_pl1) * PAGE_READ; + w_prot =3D (priv <=3D ent->ar_pl2) * PAGE_WRITE; + x_prot =3D (ent->ar_pl2 <=3D priv && priv <=3D ent->ar_pl1) * PAGE_EXE= C; switch (ent->ar_type) { case 0: /* read-only: data page */ prot =3D r_prot; --=20 2.41.0