From nobody Thu Nov 28 08:31:35 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=1692946713; cv=none; d=zohomail.com; s=zohoarc; b=fKe0v7oTo22elj3C6zDmxfApv2J1fB2pagCb6lXDq2rO/udrCCtPb6xD706duWqHN9CrSv4wL6bycXhv/mChJ3a/1KyDaPDIezSUM97a4zuP8WiB4OJrLyT5NJuq+sT6dr7BgacnGTHPQY07Snih6pDFQVlWgkuxzznYMwScBeU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692946713; 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=L9B3eJ6HNOyLJl/WscibwCkc7vtQlDKSmbJncC99yyM=; b=nl0xG1lux3KzYKZ3pcwuV11/UeWmcgTWUu3DitJcTk/Ti8G7Kxv+3De2ZSn2vcNTXkELAwwXeM7PpVi4bykhD1FN7i0GvKQpnxxaYioNRmrEq2MRKtzxr9c8rvC014woyJxVDRnR7YYRDIec1AM3YjidDvy1NBUFEPA4PvCY9a0= 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 1692946713471117.45462384126131; Thu, 24 Aug 2023 23:58:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZQkX-00068f-Nf; Fri, 25 Aug 2023 02:56:53 -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 1qZQkQ-000674-U2 for qemu-devel@nongnu.org; Fri, 25 Aug 2023 02:56:46 -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 1qZQkO-0007X5-Oi for qemu-devel@nongnu.org; Fri, 25 Aug 2023 02:56:46 -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 A971062D34; Fri, 25 Aug 2023 06:56:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AF56C433C8; Fri, 25 Aug 2023 06:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692946603; bh=NvQBxQAHTMb8qYx5lzwNVD4iX5uQmG5G6+mCxHboXQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B72XUwwpT4Ij9HaFoRdhv1mF0GgslSuXqUvKNbv/yo1Jyzah2lXt/NhBNmR0mqxf2 HWeaoT/7sotjnh0RvF6JcBtyPhd1+u51AgrgYpR0io8y+nIb7qEF1RKieuhcqPSzO8 3ykleqZGrZBk9InwXpCLzJmkcb1rNErTFBM/xPpNYCnHGtPkpWBY3x0eOIlFQm/+P9 qMLOrekdmsaDy7oPOtrW1b/e1kdoHsgwx+QhcQdx3dccE9URf7HxeWOVmpskTMaIKz wSfGjhCqclle7Io/Ksi1FUjsIJNiUqYFqzQpcs1r+bLJMAKRxfjqiLVl/dfGadlTw8 /fz0FB6JZXohg== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH v2 1/5] target/hppa: Add missing PL1 and PL2 privilege levels Date: Fri, 25 Aug 2023 08:56:34 +0200 Message-ID: <20230825065638.7262-2-deller@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230825065638.7262-1-deller@kernel.org> References: <20230825065638.7262-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-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: 1692946715364100001 Content-Type: text/plain; charset="utf-8" From: Helge Deller The hppa CPU has 4 privilege levels (0-3). Mention the missing PL1 and PL2 levels, although the Linux kernel uses only 0 (KERNEL) and 3 (USER). Not sure about HP-UX. Signed-off-by: Helge Deller --- target/hppa/cpu.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 75c5c0ccf7..6c5b0e67c8 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -31,8 +31,11 @@ #define TCG_GUEST_DEFAULT_MO TCG_MO_ALL =20 #define MMU_KERNEL_IDX 0 +#define MMU_PL1_IDX 1 +#define MMU_PL2_IDX 2 #define MMU_USER_IDX 3 #define MMU_PHYS_IDX 4 + #define TARGET_INSN_START_EXTRA_WORDS 1 =20 /* Hardware exceptions, interrupts, faults, and traps. */ --=20 2.41.0 From nobody Thu Nov 28 08:31:35 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=1692946716; cv=none; d=zohomail.com; s=zohoarc; b=QvFnpHyaENwc8BbPF4pqcIg3z3igvQrVZcv0cURrepc1XgTF5TxUHfQ9WPdTP+HF0vUqp9HOYjaIraou54cEcp7D+P3B/uehyQJ8Bv1USxVOatf7MrOyyk/vaVfNEAqpb0gHvndloyzMUSQXRxzVa6pUA2xVLT0t3MPs8V2YoTk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692946716; 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=07A8OMsQNsaz6+HT3vRMS+iXYgt9dhmkOUBxx7U2hZ4=; b=En7HXVzSyzQHj3wrWeyFfvlNSpwy2qhccK4ysZyw4t5+ml10L7a4QrpLHqBbzhzT7PJxZ4ORSSjwiLbynCKOpFhZ7UsiqhEc9d1Kq4hplCXtpmoa6gCDfHIuxAOjiu6HU97teo5niw1fSIqr5vIfrtvz0K4xPkPw7VcZYI8D8FE= 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 1692946716706171.29182685499165; Thu, 24 Aug 2023 23:58:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZQkX-00068N-Gh; Fri, 25 Aug 2023 02:56:53 -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 1qZQkU-00067V-Ss for qemu-devel@nongnu.org; Fri, 25 Aug 2023 02:56:50 -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 1qZQkQ-0007XA-N2 for qemu-devel@nongnu.org; Fri, 25 Aug 2023 02:56:49 -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 053F2635F2; Fri, 25 Aug 2023 06:56:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CC00C433C9; Fri, 25 Aug 2023 06:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692946604; bh=SppuJ9hCJ4goanG7YuDY8XhaY0a/IGkeutRb2EFBCLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bj5mg3BkBD5k/Z+sSNO0TmHJ8YruNpbD8Qo4tyDdJJgVls+XD4XoDF1RKokIOwgdb rZz7Z07Y9dDLjhvObzVS7etfBhQoMNMZgjs8gsVSzxpImXHROt6o20L/+EiP+hQoBj CViM5pUoAZRV/F+oqShmKgLYIu33A1b4bpjXRKQ/2YXztJyf4HuVUNXTAkNVGg7AP/ zu6Lnuk4z9w6t8TEXLdQWPUod61NgVhjc1CLrpd04gzelJtjQpvJW4+R2PgveqpKd3 yj9LujF0rmrMMh+8obPlhkPDMTgjAlTrAF/72Yp3GaDjoF4fO3emAqF/iPA4G6uEI2 3PiwIebtaxO1A== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH v2 2/5] target/hppa: Add privilege to MMU index conversion helpers Date: Fri, 25 Aug 2023 08:56:35 +0200 Message-ID: <20230825065638.7262-3-deller@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230825065638.7262-1-deller@kernel.org> References: <20230825065638.7262-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=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: 1692946717476100006 Content-Type: text/plain; charset="utf-8" From: Helge Deller Add two macros which convert privilege level to/from MMU index: - PRIV_TO_MMU_IDX(priv) returns the MMU index for the given privilege level - MMU_IDX_TO_PRIV(mmu_idx) returns the corresponding privilege level for this MMU index The introduction of those macros make the code easier to read and will help to improve performance in follow-up patch. Signed-off-by: Helge Deller --- target/hppa/cpu.h | 5 ++++- target/hppa/translate.c | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 6c5b0e67c8..50b513f0ea 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -36,6 +36,9 @@ #define MMU_USER_IDX 3 #define MMU_PHYS_IDX 4 =20 +#define PRIV_TO_MMU_IDX(priv) (priv) +#define MMU_IDX_TO_PRIV(mmu_idx) (mmu_idx) + #define TARGET_INSN_START_EXTRA_WORDS 1 =20 /* Hardware exceptions, interrupts, faults, and traps. */ @@ -236,7 +239,7 @@ static inline int cpu_mmu_index(CPUHPPAState *env, bool= ifetch) return MMU_USER_IDX; #else if (env->psw & (ifetch ? PSW_C : PSW_D)) { - return env->iaoq_f & 3; + return PRIV_TO_MMU_IDX(env->iaoq_f & 3); } return MMU_PHYS_IDX; /* mmu disabled */ #endif diff --git a/target/hppa/translate.c b/target/hppa/translate.c index d66fcb3e6a..e3af668252 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -4057,14 +4057,15 @@ static void hppa_tr_init_disas_context(DisasContext= Base *dcbase, CPUState *cs) ctx->tb_flags =3D ctx->base.tb->flags; =20 #ifdef CONFIG_USER_ONLY - ctx->privilege =3D MMU_USER_IDX; + ctx->privilege =3D MMU_IDX_TO_PRIV(MMU_USER_IDX); ctx->mmu_idx =3D MMU_USER_IDX; - ctx->iaoq_f =3D ctx->base.pc_first | MMU_USER_IDX; - ctx->iaoq_b =3D ctx->base.tb->cs_base | MMU_USER_IDX; + ctx->iaoq_f =3D ctx->base.pc_first | ctx->privilege; + ctx->iaoq_b =3D ctx->base.tb->cs_base | ctx->privilege; ctx->unalign =3D (ctx->tb_flags & TB_FLAG_UNALIGN ? MO_UNALN : MO_ALIG= N); #else ctx->privilege =3D (ctx->tb_flags >> TB_FLAG_PRIV_SHIFT) & 3; - ctx->mmu_idx =3D (ctx->tb_flags & PSW_D ? ctx->privilege : MMU_PHYS_ID= X); + ctx->mmu_idx =3D (ctx->tb_flags & PSW_D ? + PRIV_TO_MMU_IDX(ctx->privilege) : MMU_PHYS_IDX); =20 /* Recover the IAOQ values from the GVA + PRIV. */ uint64_t cs_base =3D ctx->base.tb->cs_base; --=20 2.41.0 From nobody Thu Nov 28 08:31:35 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=1692946659; cv=none; d=zohomail.com; s=zohoarc; b=lOQePLsBEjtbNUnwKIMkn9L4NRGSRxDiPT47BHjY0KUoMRZ89n7PJ5ZR2sAJ/1LLtesiwecpqCK7Zf3Yb5bKb9OngTKiiZN/IvklXvPeEVszuQcRte1ljUA0+zSfd0mgR11na/pndpkGYbuxDAES/boN0SqDdO4Yw4ttmxzCvyI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692946659; 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=LjuR5TXyu/6Q6+gzfRIS/8fuEZO6Wj5RJDXQFevC6B8=; b=ktqtaITCycuWbyn21JwSz/ze3+O27v5OG3W3gW+4DaUvQ//MVPbnWScRsdBri1t0/dv05cuvmigOt0EJLqE999oanIpiigY4b4CO3FHC/cU6TUjl0nQw51SQWfYmHi/lW5ixH3Eyif9pyU515o/ZyRc18RG6Rctt2lAs2BtWdtY= 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 1692946659419398.2338543865459; Thu, 24 Aug 2023 23:57:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZQkZ-00068z-76; Fri, 25 Aug 2023 02:56:55 -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 1qZQkU-00067W-TB for qemu-devel@nongnu.org; Fri, 25 Aug 2023 02:56:50 -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 1qZQkR-0007XS-9l for qemu-devel@nongnu.org; Fri, 25 Aug 2023 02:56:49 -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 5A40563934; Fri, 25 Aug 2023 06:56:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD756C433C7; Fri, 25 Aug 2023 06:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692946605; bh=1eh2iSakTkUtRqiOF8peZrpytrKx5a7LlJ5tR4ON69U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MY9q853C0oXirYdsxDw5RXg/7ypFl8Cn5tiBybR1Vb2k5nobgUcr6kvXfIBrh7RXM deq8HRtYqd0yOqYnOYvqQnlg1V1xkgPXTum0Nr9Azt8SzTu43o0584s38IqRJVSKCj +4YbtVVaU92aIZHa4vFyRcxObmOEnKPvwhdWGP4Pnw8coRNCCp6W/AA+Iua1+ZsvzJ 6XuZocy3GnoaaOSNEw9yANata8X27eFOs18F32ioTK0CLaGVzyyNs+9BHlqFO4YdrO /yc9Cu3+z9TWXOHdoilursR4SKBHntPAAu0Tp4TfPt0HDOwFET0qxwzvyypicEwzVb UyADc/+F0TJlQ== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH v2 3/5] target/hppa: Do not use hardcoded value for tlb_flush_*() Date: Fri, 25 Aug 2023 08:56:36 +0200 Message-ID: <20230825065638.7262-4-deller@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230825065638.7262-1-deller@kernel.org> References: <20230825065638.7262-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-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: 1692946661227100003 Content-Type: text/plain; charset="utf-8" From: Helge Deller Avoid using hardcoded values when calling the tlb_flush*() functions. Instead define the correct mask (HPPA_MMU_FLUSH_MASK) and use it. Skip flushing the MMU for physical addresses. Signed-off-by: Helge Deller --- target/hppa/cpu.h | 5 +++++ target/hppa/helper.c | 2 +- target/hppa/mem_helper.c | 7 +++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 50b513f0ea..6623712644 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -41,6 +41,11 @@ =20 #define TARGET_INSN_START_EXTRA_WORDS 1 =20 +/* No need to flush MMU_PHYS_IDX */ +#define HPPA_MMU_FLUSH_MASK \ + (1 << MMU_KERNEL_IDX | 1 << MMU_PL1_IDX | \ + 1 << MMU_PL2_IDX | 1 << MMU_USER_IDX) + /* Hardware exceptions, interrupts, faults, and traps. */ #define EXCP_HPMC 1 /* high priority machine check */ #define EXCP_POWER_FAIL 2 diff --git a/target/hppa/helper.c b/target/hppa/helper.c index 74b8747083..a8d3f456ee 100644 --- a/target/hppa/helper.c +++ b/target/hppa/helper.c @@ -71,7 +71,7 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ureg psw) /* If PSW_P changes, it affects how we translate addresses. */ if ((psw ^ old_psw) & PSW_P) { #ifndef CONFIG_USER_ONLY - tlb_flush_by_mmuidx(env_cpu(env), 0xf); + tlb_flush_by_mmuidx(env_cpu(env), HPPA_MMU_FLUSH_MASK); #endif } } diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 5046cc8f9d..6f04c101dd 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -50,8 +50,7 @@ static void hppa_flush_tlb_ent(CPUHPPAState *env, hppa_tl= b_entry *ent) trace_hppa_tlb_flush_ent(env, ent, ent->va_b, ent->va_e, ent->pa); =20 for (i =3D 0; i < n; ++i, addr +=3D TARGET_PAGE_SIZE) { - /* Do not flush MMU_PHYS_IDX. */ - tlb_flush_page_by_mmuidx(cs, addr, 0xf); + tlb_flush_page_by_mmuidx(cs, addr, HPPA_MMU_FLUSH_MASK); } =20 memset(ent, 0, sizeof(*ent)); @@ -335,13 +334,13 @@ void HELPER(ptlbe)(CPUHPPAState *env) { trace_hppa_tlb_ptlbe(env); memset(env->tlb, 0, sizeof(env->tlb)); - tlb_flush_by_mmuidx(env_cpu(env), 0xf); + tlb_flush_by_mmuidx(env_cpu(env), HPPA_MMU_FLUSH_MASK); } =20 void cpu_hppa_change_prot_id(CPUHPPAState *env) { if (env->psw & PSW_P) { - tlb_flush_by_mmuidx(env_cpu(env), 0xf); + tlb_flush_by_mmuidx(env_cpu(env), HPPA_MMU_FLUSH_MASK); } } =20 --=20 2.41.0 From nobody Thu Nov 28 08:31:35 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=1692946659; cv=none; d=zohomail.com; s=zohoarc; b=LBZynUg5LI2nS+2tFAa/Eeli3uU3hQVwhprypoBlod8zdEjHpMG3TrGS4BpxCviPsomwJVV9GJN43HEXN6Nc/HD91ki4M5r22qKml04XYPjJmSyt5v1abv0xGW71jfELC8rjrwllPDX+seGUlykK6e5tkaPQSICoY6mnUR16apU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692946659; 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=GJtQ6WfUxiDXUt3rVSKv8QLqf5geOmFsGNYgC4j8+7k=; b=EovBDlWVknhgjVmJPPPXZdOTOOJ+uQ8uGC1cby0I7GhLdwiOiRVEpi4jjEYlAhYdoPAo2m955XyCoXOLu8tjRUQeRjeeTja0EC7oHH5JbeE2WuIWTbR5Nm6hPgUFv/Yq8cZOhp87P9f0hcF93i6O2B7o0l8qFVFDyqw8ORhyqq4= 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 1692946659466288.7105709913003; Thu, 24 Aug 2023 23:57:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZQkb-00069p-TE; Fri, 25 Aug 2023 02:56:57 -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 1qZQkV-00067n-Bs for qemu-devel@nongnu.org; Fri, 25 Aug 2023 02:56:51 -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 1qZQkS-0007Xi-Eo for qemu-devel@nongnu.org; Fri, 25 Aug 2023 02:56:51 -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 AD31460B60; Fri, 25 Aug 2023 06:56:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AFA6C433C9; Fri, 25 Aug 2023 06:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692946607; bh=9CR1T6czPKxjHOKsQA8C1aZzTvs5rVZdGD/98ASPi0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rQ+cmR0aqhlNyQMjEGluH0htrErj6ao//yBsOmsoAm4JLIRUtL7oYlHSomo/L+PZx 6Qif+JgStYOlg/EyZjc0ZkAtka7AAvQRojTMM0YEcHpixRAxeKCPFo0JcdWqgKPlxn cC4bWIxcDD3PVXH+4YojqQB8Lg6zpGE9TCXwNFj6s1a5+OKvcDjj7Ls07cYqVtkDfL JkMMIa3dmBClp0Sxt0GwTckYu4LUIAhh+PioySMzfHab3xVRdc9VexGnmkJArJDnrA U6TmPxjolmYoR1NYEVrZHEEyIfFYcF90FJV3fjLDftVAx/Ls9pzoaLxQEsk4++vt8I HEtTvzoYq22JQ== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH v2 4/5] target/hppa: Use privilege helper in hppa_get_physical_address() Date: Fri, 25 Aug 2023 08:56:37 +0200 Message-ID: <20230825065638.7262-5-deller@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230825065638.7262-1-deller@kernel.org> References: <20230825065638.7262-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-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: 1692946660450100001 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 --- 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 From nobody Thu Nov 28 08:31:35 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=1692946664; cv=none; d=zohomail.com; s=zohoarc; b=HBxGpFGI69VVyS7CZhCM5wnJj0d66//nN0sS0nTXMwqhbn2L+vrEVX0SNY8SyBk7J93WOdAEHZ2rw/Egi3pVtcPWX24UGo51P87SsWjWESaX0XC+HSGqXe9R9GSDLJHB9ehzDvT0IHb9YkrRn2qiwWZxlfW6J20cxdnIh8ncL+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692946664; 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=0hYh647QH5iFJJb7e0GrAGT6HXTJad2wdia8Ckmn9oE=; b=U/kqCjDeLmN7vlMqoAZXMWS8uw3ikGhHRuUEhuOEz6kdOqZdYOQR/eHCXHvKQ5M+YLFajK+jA1Vz33kw6h9XVZbGmc5kP5o2OtZovjWhU959S86vYHBGfLilLi6OKyS3NNQpXNXwgoPhdBLzJfvOyYVyf0CC0XUqvnk94CI2Tqk= 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 1692946663998995.9754662277704; Thu, 24 Aug 2023 23:57:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZQka-00069K-SV; Fri, 25 Aug 2023 02:56:56 -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 1qZQkW-000688-P9 for qemu-devel@nongnu.org; Fri, 25 Aug 2023 02:56:52 -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 1qZQkU-0007Y0-M3 for qemu-devel@nongnu.org; Fri, 25 Aug 2023 02:56:52 -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 0762562D34; Fri, 25 Aug 2023 06:56:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EA8FC433C8; Fri, 25 Aug 2023 06:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692946608; bh=jj6VCafdXtZ0ti0M1QbCs6Yx24ov6Jbm0/NprowIN2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mGOve1omiZ3HtOKMYXTTl6mb0hsd5dhP1t4vm5VhCIto/6pZULS8jtLMjP0sdjaoM eCuFBObkPS55kBSbq3zpOFgFCipPkaadNIp2dEVheWd/ipma+vdsv6PS7xfhCzO7wj lGHQ7HDNQeLb3cghBjGLgsd8i/iEnm1jNvWFsOCGr93B3iLilQC/bvLTpqYdlh7muW Oq7WICLYgjJQtnDSH5aqUQtJ6HfGrV7XeHQ2K6yRhAZhdmPGPBmpmOy7C4fLZYa3++ EXE4rnXslTITIFEDsrhYM20RM8wNf6sB5PCSFlJHAL17pfY1zu9TaC3xhvvIqbjcgo 8eLR/kw9IdteQ== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH v2 5/5] target/hppa: Switch to use MMU indices 11-15 Date: Fri, 25 Aug 2023 08:56:38 +0200 Message-ID: <20230825065638.7262-6-deller@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230825065638.7262-1-deller@kernel.org> References: <20230825065638.7262-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-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: 1692946665104100001 Content-Type: text/plain; charset="utf-8" From: Helge Deller The MMU indices 9-15 will use shorter assembler instructions when run on a x86-64 host. So, switch over to those to get smaller code and maybe minimally faster emulation. Signed-off-by: Helge Deller --- target/hppa/cpu.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 6623712644..fa13694dab 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -30,14 +30,14 @@ basis. It's probably easier to fall back to a strong memory model. */ #define TCG_GUEST_DEFAULT_MO TCG_MO_ALL =20 -#define MMU_KERNEL_IDX 0 -#define MMU_PL1_IDX 1 -#define MMU_PL2_IDX 2 -#define MMU_USER_IDX 3 -#define MMU_PHYS_IDX 4 - -#define PRIV_TO_MMU_IDX(priv) (priv) -#define MMU_IDX_TO_PRIV(mmu_idx) (mmu_idx) +#define MMU_KERNEL_IDX 11 +#define MMU_PL1_IDX 12 +#define MMU_PL2_IDX 13 +#define MMU_USER_IDX 14 +#define MMU_PHYS_IDX 15 + +#define PRIV_TO_MMU_IDX(priv) (MMU_KERNEL_IDX + (priv)) +#define MMU_IDX_TO_PRIV(mmu_idx) ((mmu_idx) - MMU_KERNEL_IDX) =20 #define TARGET_INSN_START_EXTRA_WORDS 1 =20 --=20 2.41.0