From nobody Thu Nov 28 08:50: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=1693149535; cv=none; d=zohomail.com; s=zohoarc; b=lpfWKdGGlnRwH/a26Svhk7VwjbHCqBaWyDP1KApIlol4KLZsx4iVpUVCqNP+PUlJ3jr6EgucU7eX8AqHlZGFJGZWHmCsbMsTDZEIt/0I+jCn5Xj4EmYSajNg+oZRTjRVGMwcATxgyOirfgKCgU1sKJhU3laLpkbkRwagmzgQ7iw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693149535; 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=tvF36gr4U2H1yn6VpZwLScEEx292O8bCsaNF3OOeDas=; b=SI7dSOq6SbxoHjZsV3ja9pFt9+AD8bk5WSKuSGOwAWYxAx9WuXq4pfPRBJWDZVtXOjCB5njAI1KbU6BZbKRO2D140ryZdb61GZ9HL3bPAX5aGfmuYIGKg6z8gHCcn4nWV+0k8OBptstnWGvHD/HiCf273u3v4FzkaWWHIx+A9hc= 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 1693149535161125.32789049949758; Sun, 27 Aug 2023 08:18:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qaHWf-00084b-Db; Sun, 27 Aug 2023 11:18:05 -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 1qaHWX-00084K-N9 for qemu-devel@nongnu.org; Sun, 27 Aug 2023 11:17:57 -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 1qaHWV-0006Lw-Gs for qemu-devel@nongnu.org; Sun, 27 Aug 2023 11:17:57 -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 8B8E260691; Sun, 27 Aug 2023 15:17:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B38EAC433C7; Sun, 27 Aug 2023 15:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693149472; bh=bf12EkYhs02Sea64Gguqzg5CpFkL3oXiSeHhMOzt/HM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ipV/1VS8VJvBa2DgvoM2ZK5RR5r1ML4D2PfwrJXP4Aw5lEX07KCAfDJ/seUIswk+N IfsVP2qzaQegVP9QKun4sGVzWwjnArrP/UKR4K6b8AbQ4W6e6XNKJ9yIqP3HVrCXVu IXWj6edv9lwd+0FFoKeLCL5sMc2ibFjCuNelCc9CM4wmGCQUcBxFhj4RGxvrG9yMi2 /rMgyQp8ut98bx6aToh5+U3gTbpZVpATXd6wziyW/Jr8H7pDdl1jfGgonn1n7+81z/ 7BoEae1h8HBRoNxGTYg0zJ6/4qdmOskaSAWubHbcAQRstyQl7g/yqib9MMNJA7cKeq Fs42Dgfjl9HCA== 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 1/5] target/hppa: Add missing PL1 and PL2 privilege levels Date: Sun, 27 Aug 2023 17:17:42 +0200 Message-ID: <20230827151747.290653-2-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=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: 1693149536429100001 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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:50: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=1693149576; cv=none; d=zohomail.com; s=zohoarc; b=P0NZXaVZahIKKvk98izM3czalnskFPYfZRupDOS6q0hECyi9Ivu7C6UcekQOnkSmAP0axHCO/o2maNsINALKO4U9ZAYqW48IxmIEphA9YQc6fm7R/1tk/LRylueyyHiO+QyZEo9PLF5UcDw9o6uxwxOjXYXTqoCxmbOZ8cGTwKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693149576; 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=U/5i0utGZPnwvqEdF/YrHAlqAUpL7peGxbJJPT2H2zo=; b=RpFoGLzGahMkM9apF/m/79ABWmzK5Wqwv38mZIUnKuldjPoAp4EpZXQU+5+RRStsVgN9Y/qoCOOnSHJpx5DXwa1g2j1VD0e0Gus0lL/HnBTDME9lOR9Dg1mTus/m8tadqd/cznvz7CALD0s+moPLvyoDjdlryZ/jioJ53cbu4Y0= 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 1693149576243882.7163045467044; Sun, 27 Aug 2023 08:19:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qaHWl-00088h-Q6; Sun, 27 Aug 2023 11:18:11 -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 1qaHWb-00084k-7w 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 1qaHWX-0006M4-9g for qemu-devel@nongnu.org; Sun, 27 Aug 2023 11:17:59 -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 41FB160C56; Sun, 27 Aug 2023 15:17:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6ACEBC433C9; Sun, 27 Aug 2023 15:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693149473; bh=Pe+RHqzVboWs8qMqUJxtpDZmcKA0/0rfz9CiqwOnb68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VHzuFNXAHkbCSCwpkv8yLP7f3lchaeQXzxKETbh7s6NJH1WKa71Hx1/QOiNkKJmxl RaIA35Y2XMwCnecNb8INxLFsyf0Ap1e52+Pr/bBM3pNYYqY/heD0xEFEWjoX7Ko2a/ rYId2j2q5zDuT/T9YIS7AVLaaUzLYtXtqBXHcLsbioB9NqvLAQT2dZ7g+hy7PRK6r5 1wrViXVbTua61kbZzcjFxwUKy0kOk2vMKHyFD6tEKivhDW9xeKf25jp28JFDbQWo4K HsCqzfePEmZ+Y3OLdaxvGO4fZt7Jr8pyyCBd4NJJcq8gc3Jr+EhilaQM2YfkitOOl9 H7uJ+oAKbj1PA== 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 2/5] target/hppa: Add privilege to MMU index conversion helpers Date: Sun, 27 Aug 2023 17:17:43 +0200 Message-ID: <20230827151747.290653-3-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: 1693149576758100001 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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:50: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=1693149534; cv=none; d=zohomail.com; s=zohoarc; b=lwKpRszyxmuTuT1174Z6hJVYWjFiAXbmczSYORO7hYtifl4OqSHsiPx/8fz7xax0OuxifS27+UkgN29H4PpXkBO5rFJnIfVp6xpYMorCAdLI7ie/ts0V4Y+c478ruoJVZLZGxoRHnlke6WdImNOIRWzaCT6G7uLqhabdxqQVcfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693149534; 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=GukwrCHl96t/JOo2jwzhtXWhZ7aoTPI2lq5YcsrBv6M=; b=SiT7O6VA39oyB/pJocNxJc+Y0hGtEiOoCyTZ0V0tXUIBWHSiOXHIwrO/2YGgkWfwZIlVw36G2PU4piDUF43k/uEJgyFfQ9TlJ+Jh5kyu8lFJCXHvC7ydFrhG7BTPeL1JDyFrNRvoIBL26SWFAxqyFQtI+aYw2bGXClTmfCZLSxI= 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 1693149534923557.4995816959945; Sun, 27 Aug 2023 08:18:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qaHWl-00088p-QR; Sun, 27 Aug 2023 11:18:11 -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 1qaHWb-00084j-7W for qemu-devel@nongnu.org; Sun, 27 Aug 2023 11:18:05 -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 1qaHWW-0006M8-QV for qemu-devel@nongnu.org; Sun, 27 Aug 2023 11:17:59 -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 E9B026167F; Sun, 27 Aug 2023 15:17:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21074C433C8; Sun, 27 Aug 2023 15:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693149475; bh=SFpm05c0QuC6N93kKeL3Drv8CTK1yL9MCl+8tnUZSfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DJm6c013PS/EDBdotCuVlgquaDfiRuDP2YX0IYoreCp2+s6EgLrwxlu3ZIfQJKjRc VLwGGkOk++U44JboQ5Yy1KXOUY5IHX98AvRXoJQnAgfnWJO8FoZaYDuMkyf20c4alQ hN0/8dyYm5ZPcw0/jemX6KI5d6eXETIJw2oB3b1e35kxAoPDRFOzGhBYnciAwUxKXi VAhAeX5J++aWxtiYDnHm+d5/pvzNgkqiEGM9LAtvsG61g5K6+0kZLtcSMfR4lUnNiX CYTTtjKC8rp79g750jNtArwT6sTENHv9bJzkH2SY5ujH0wLbSCG/0Tpk5KcyTD7zWY 5Bw2KGXajMzrg== 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 3/5] target/hppa: Do not use hardcoded value for tlb_flush_*() Date: Sun, 27 Aug 2023 17:17:44 +0200 Message-ID: <20230827151747.290653-4-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=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: 1693149536435100002 From: Helge Deller Avoid using hardcoded values when calling the tlb_flush*() functions. Instead, define and use HPPA_MMU_FLUSH_MASK (keeping the current behavior, which doesn't flush the physical address MMU). Signed-off-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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:50: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 From nobody Thu Nov 28 08:50: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=e0LnCZ1X+exFV3R0zoQv9o+31M2i+dxeIduZyQsbYsAuLtamgbJ7Kxfz71ht648SSd8R70B7q7LWsdx0qMPZ+Op8p+k2lNsoYTVzHiWwmKKdEMtNTX6QCVdvxau4ysxMPlwDDnz1rFJXrE4iBSNLu5DdcQTYzSjPqo6mFhfdvCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693149550; 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=FzxezK2W9Fq9E+VuWgMzdJvIDZCaVURrw9464+fG+R5OEeIXXZqMXxD3XLBjTx7Tap09lI/92joXPftyoG3sAYFDt7nS+/DhXcktChT7zZgRxITcR1APEpAWydSp2uqlREvY4ECgiUxgkC5tJJLZDeaEhb0/K3FY/NytmGSRFuQ= 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 1693149550709526.7656129005611; 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 1qaHWh-000872-5B; Sun, 27 Aug 2023 11:18:07 -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 1qaHWf-00086M-IS for qemu-devel@nongnu.org; Sun, 27 Aug 2023 11:18:05 -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 1qaHWb-0006Mb-04 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 28D2460B45; Sun, 27 Aug 2023 15:17:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82598C433C7; Sun, 27 Aug 2023 15:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693149478; bh=jj6VCafdXtZ0ti0M1QbCs6Yx24ov6Jbm0/NprowIN2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jIkxAScGMkauTxp+RKGJZF9kasAH3ilNkhPUCtLiTMAgEwE91s9DwGKaj8B64oU7t r4NxLVv+jvlOohhMPdAbV9GsOjUDKdTAk30YQFHtKH8ufLGk6C33jOudJoF6aQRTZm 2YBOobSu+X38bkFm9rAQlATW4KQ400vx9AT39+5gEbqdsNjL786jb3md/zZvjX1uaU U6JdYqOqON6ecTcOacg5H8pB6EcEK0l+LqbkiXyb6MaHRJOFFX45eFy/fp9eFWgjxF cnqMNl6/v4gdI3SyFMNSTobFB5RfAA8qN/JsMe5N23O4sH5e/XvQeg0N+qD+oBteBU 3nu5QdMUA1TRg== From: deller@kernel.org To: Richard Henderson , Peter Maydell , qemu-devel@nongnu.org Cc: Helge Deller Subject: [PULL 5/5] target/hppa: Switch to use MMU indices 11-15 Date: Sun, 27 Aug 2023 17:17:46 +0200 Message-ID: <20230827151747.290653-6-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-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: 1693149552736100007 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