From nobody Thu Nov 28 10:38:37 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=1692925460; cv=none; d=zohomail.com; s=zohoarc; b=cdKxfdXXPxDSNwxDjnayXOheRiJMZG7ok6CHDIJJCiZJfGpcsML+9NZBcgY9GjhXO8LuQiOPNOZEIlvXR77mmsz7nusZ3a5H21A6lepNGsP5+bGljauuzN5Vqw76o/m9vlEvbP8XO0wA92VcSFvP2t2ea0Rm7hOOLGaU1wGaQI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692925460; 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=BQcT3vgI2iNtoqWFlLdyj826PArxUynW2jMA+XspyVw=; b=AS5T2SVFdLVOVu5Yr3hYcie1gBJ8R9kyOTu5vJNL+uoYB9J2FtO7GhBAgbcNpnu2YGSrqXp7iwmYwiqzfi8i3k6/fzx4AMkQxPYGib8a0+lHd/l9T/jwK+yCfYDJIn9C+W/t3H9FXA/QoCSCYC+f6I5ecdjZQBO1B5Ci5eai77g= 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 1692925460827843.1145909540959; Thu, 24 Aug 2023 18:04:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZLES-0007WA-6h; Thu, 24 Aug 2023 21:03:24 -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 1qZHVf-0002eo-30 for qemu-devel@nongnu.org; Thu, 24 Aug 2023 17:04:55 -0400 Received: from dfw.source.kernel.org ([139.178.84.217]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZHVc-0001fj-UW for qemu-devel@nongnu.org; Thu, 24 Aug 2023 17:04:54 -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 F23B866BEF; Thu, 24 Aug 2023 21:04:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80FA0C433CA; Thu, 24 Aug 2023 21:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692911083; bh=j621srJL5S1qolYFP7yJm0kHV3+xYRZ7QQm0gbaERf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SLw/gKfTOhLdKLdqQbud2sBMsZPbGVsq4UzcOjMxFleHUhjuP+M15GRcqvtM8t/JV ifmhnJ5RftApDnC1VQ0xa3PQyYKGQhq5LMVTMYbNIe2cqFlu2h0w/rqsoV057MNXRe Pmc+wJTIbCQGpaibhoVBMrVOD/5VbenET/kgD1OJOYs7cCTeDH0pt8kuWozkK8nSai EPbAtsy8gZBFKa/CeZHBY9Bawgp8zLpavpqk4N3iH29Apy+dXJRNm+VE+kJ7faYmQ5 EZBmajUII/kVJXiFub7vy07YDJQ+Mzp59KHRCl/pNfWW1DhHCEL1z3qSKsEECquh1G OCfO4nzBI1xPw== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH 4/5] target/hppa: Use privilege helper in hppa_get_physical_address() Date: Thu, 24 Aug 2023 23:04:33 +0200 Message-ID: <20230824210434.151971-5-deller@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230824210434.151971-1-deller@kernel.org> References: <20230824210434.151971-1-deller@kernel.org> 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=139.178.84.217; envelope-from=deller@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -70 X-Spam_score: -7.1 X-Spam_bar: ------- X-Spam_report: (-7.1 / 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_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 24 Aug 2023 21:03:17 -0400 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: 1692925462872100007 Content-Type: text/plain; charset="utf-8" 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..66cf84a0d9 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, mmu_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; + mmu_priv =3D MMU_IDX_TO_PRIV(mmu_idx); + r_prot =3D (mmu_priv <=3D ent->ar_pl1) * PAGE_READ; + w_prot =3D (mmu_priv <=3D ent->ar_pl2) * PAGE_WRITE; + x_prot =3D (ent->ar_pl2 <=3D mmu_priv && mmu_priv <=3D ent->ar_pl1) * = PAGE_EXEC; switch (ent->ar_type) { case 0: /* read-only: data page */ prot =3D r_prot; --=20 2.41.0