From nobody Thu Nov 28 08:29:02 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=1692925482; cv=none; d=zohomail.com; s=zohoarc; b=J/onpfiG+nyCqXK8U/TqS3NkBFuV2uZDeBW1xRh5R0O0yaHnkrcb/fE9KjXxCma99ElUNEDM7cA+21MQW4GzIo/2NJmBHoUOukyGAdmG1C9M8Hm9Qg0Xty/nTRusFfoFWaJp/DmydfC38okXzgthwrwgDiYyD3tOK2cEWrY7b3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692925482; 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=Hbi5Jt80rkCpdf6dukY+SUwwoVPPp8e1o+6RLnr2hjA=; b=VoOjYH4/aiXCi/D5u67UytHipSoPsKUjSwO1s40cZ6/DRKRQaovKVLcL1VrCKajBcEWP3cJOuLFzz2sZ9r5RA5zB+Bx8OgLdmyxnWZkDQwhi1o68jJxpQRk8gTP6wn6CX2ULMYTT+8knK9OUpOWa7XcJEQdPxEyHxnS0rwtSiLk= 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 1692925482634161.02012877105835; Thu, 24 Aug 2023 18:04:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZLER-0007Vz-LH; Thu, 24 Aug 2023 21:03:23 -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 1qZHVZ-0002dv-S7 for qemu-devel@nongnu.org; Thu, 24 Aug 2023 17:04:49 -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 1qZHVX-0001fT-Dy for qemu-devel@nongnu.org; Thu, 24 Aug 2023 17:04: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 E1BE263CAE; Thu, 24 Aug 2023 21:04:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70E1BC433C8; Thu, 24 Aug 2023 21:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692911079; bh=W6BEb7EQIbRltudB7kn49iBM4xJcma5CKQeiyGLwgys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZVWUq6Wcg/477pPJrxzTy5xuUyvF4JpgnVMr92WLVUt/5J4LslfnrtvJ2qwhm6Q4G JT7WZ5LFDr5eBX6nuJ9hI0Sze8kW4I514lS0/8kpl8h4GkwNFXlW/W0UkkAKcHwhVB KvY9YH9n+wwF879VqJ5sFx0RQoLRI2pYKgMAocUMacNMczy4SET4cQFFaTCXNe9o9K xyPZTzRZHnr3aKurcCwb+YNw8MkCOI0emz/+n9wTDzwDsF/3lRD4eOpc7iOfbwrnJo +ejyfwg80VmG3Jt6SFjGymsYF6d1qYMrLS61aBRdFLv90mAs5sQqOAp4wrKSHjSb5r 9GuWbIXiLD9eQ== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH 1/5] target/hppa: Add missing PL1 and PL2 priviledge levels Date: Thu, 24 Aug 2023 23:04:30 +0200 Message-ID: <20230824210434.151971-2-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=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-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: 1692925484330100003 Content-Type: text/plain; charset="utf-8" From: Helge Deller The hppa CPU has 4 priviledge 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:29:02 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=1692925484; cv=none; d=zohomail.com; s=zohoarc; b=H3gP8E5T1JMCCzedLsGfV7gS0mLVqAi3a1HXGptYUP0F1aeQh8NarGFa0G2Z6bWwaDxhfiSfuJsiXtoRkRsPVUAUkkJGxDqqLvSPKZlzCDG2APBkCu9af0GEkwniHlu/qpr/Dhgmqhw/Rw5wmben/3D3pItiEku+H+XeHBQE8Tw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692925484; 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=zRpnmxIfpL9PNeV+xm4eEQcTq+P/j7QHaVD6wYv81Gw=; b=nCYHabi5XrnCSV5CUE5RQZdLntK8RtPOMY27t4ULgrxDhOvdFrU6kZw/yGSYfNSWahmQJ390g5ksqVY7wXEJ+ucY6GrMmSjWtkER/LjRcRCaRJZkCo0chfQn9znobxiE19kuXpbNkavDsBBBf3wxnkOdCgkM0DuSeMs0P0wCXk4= 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 169292548428220.9940800721281; Thu, 24 Aug 2023 18:04:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZLEQ-0007VJ-Mg; Thu, 24 Aug 2023 21:03:22 -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 1qZHVd-0002eH-5x for qemu-devel@nongnu.org; Thu, 24 Aug 2023 17:04:53 -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 1qZHVa-0001fZ-Qf for qemu-devel@nongnu.org; Thu, 24 Aug 2023 17:04: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 435CA66B82; Thu, 24 Aug 2023 21:04:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C82FEC433C7; Thu, 24 Aug 2023 21:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692911080; bh=MzlPVVU7AGvkBU9+aA0DV7WUB33hdpwWVOQyUBUD9pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WRKniMGgsQvSY1ZSsHcrZJ/8mtP0MkMOEtdkodB3hK7v+h6bHXpL4ORTMhzESdGhG JX0HxTTbNylkoE5Wyd6zf2iTrv6vst1tDOMVbsi1CzxU+oPs8MAF2m/gr8Jaz68jQY mcbXQbsb+80TiwdU91FsDCgFVg0tw3khIphrBW0Td7CA0GkjzZsoKjbbM5MWpda7FL +SG1rtGft94Dr7mqtfmYlMp1XkRv32ZJEaCIIhwSaMy8oii1TDuJT/B1ZDawqhCEqi qM3PlsAsIrIgNxNFc+NCiFQWeiqH1UBrBspdT8IJmb87MC98AG4cd1MEy8hoJ2wVmG TYUs8xC6Xp01A== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH 2/5] target/hppa: Add priviledge to MMU index conversion helpers Date: Thu, 24 Aug 2023 23:04:31 +0200 Message-ID: <20230824210434.151971-3-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=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-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: 1692925486261100007 Content-Type: text/plain; charset="utf-8" From: Helge Deller Add two macros which convert priviledge level to/from MMU index: - PRIV_TO_MMU_IDX(priv) returns the MMU index for the given priviledge level - MMU_IDX_TO_PRIV(mmu_idx) returns the corresponding priviledge 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:29:02 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=1692925490; cv=none; d=zohomail.com; s=zohoarc; b=T2HeFZCNxVyBWcVTiunARxJd2GusEKotehwL0wNw6zcxZMLNgfwUKMzEQQoYZ9MzDY0e6ReFixQXETSH4x5pXlF917mW8oCvUh6SHRc3KtVbBBxb8vuScP7b2/Npw3C4qddCyktlpbEhfB4qXpK2A4gC4VYYe6RDd2EY4GKP3m0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692925490; 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=elD/N4uqdM1zY390za6l3+xKSaq3N+2cQVmVFNHbz/mXg4pdZV+aWYqX0EDzZ62ouDwVRTVCfjF2CnRx87Xj8vHzYCu9Bgomn02ihr8e2JUxGeZ1Js/n3UrL/K3glw8ELfPtAS4B3B07r/eOd4vXW3Z1g/6zBbMs/FZsnCu3mIw= 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 1692925490088817.1339338116265; Thu, 24 Aug 2023 18:04:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZLER-0007Vr-B9; Thu, 24 Aug 2023 21:03:23 -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 1qZHVe-0002el-Vh for qemu-devel@nongnu.org; Thu, 24 Aug 2023 17:04:54 -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 1qZHVc-0001ff-Gh 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 AFAEA62D6D; Thu, 24 Aug 2023 21:04:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A5CFC433C9; Thu, 24 Aug 2023 21:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692911082; bh=1eh2iSakTkUtRqiOF8peZrpytrKx5a7LlJ5tR4ON69U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LY9sr8ZDR2pIDFlAYrxUk0RQcjKx4pzDHzZNyqfLkYzuzGUW8+J0banpE+upZNHOx JKM9APbKn9uqlk6lpYXw2jHnyGZAU0nrFYS3mH4xVV0SfMAQwG70Cw8vtZhlkIpq7u Mc5HdIEdFKSg0LzgBsII9lcdFKnIjGWum+vsnbkdLsYvmGff4N2LM9OTJAvago9foP PQSjx3U/n1rDXEMCQ+aGqnoS7sXjw7BAnAGzNBywAS68C9bM22raQ7PJxgfVK28+Pp fYZzzH+1U9fy6ziixKXkTUkk/66Abvns47Jd1C4odbVQvMK14pjukZKq/k41BZDOiT CS/Pb8JP3+U6w== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH 3/5] target/hppa: Do not use hardcoded value for tlb_flush_*() Date: Thu, 24 Aug 2023 23:04:32 +0200 Message-ID: <20230824210434.151971-4-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=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-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: 1692925490982100002 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 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:29:02 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 From nobody Thu Nov 28 08:29:02 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=XAL5IL2K8POA9pU/x7kaCQNtbDUxxIei96LzEITO2PalFGz1NQkDhjuYmVleh2e1PXGBXVbN+M8oPhHlWDr9+dwjJpEpEXDsAsafkbkLq9IyMafQRSYa+BFZj40zioTc2IL/RRF2t4G83Q3X3GA1UnQDYIQPsFEwdUmXif3CoU8= 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=0hYh647QH5iFJJb7e0GrAGT6HXTJad2wdia8Ckmn9oE=; b=TNGbj35e6xSP4vNWsGjj4ZqUuNYzgSvIc1qJllbqXTQu+8DrshzKTLAlBEoojH7QI06MmWRX9Uo4BExv94y3dkrSwCoFt8hsgv7+vrtnxQ4N+PuVKhbPsMDU4NKPpLXjz8gPTcm2Pmo637DqWlJIAhnDTBjLLACS7vD1/3nrP2I= 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 1692925460371893.0312928966242; 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 1qZLEQ-0007UD-4Q; Thu, 24 Aug 2023 21:03:22 -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 1qZHVd-0002eG-5x for qemu-devel@nongnu.org; Thu, 24 Aug 2023 17:04:53 -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 1qZHVa-0001gA-Qz for qemu-devel@nongnu.org; Thu, 24 Aug 2023 17:04: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 5960466A38; Thu, 24 Aug 2023 21:04:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7D84C433C7; Thu, 24 Aug 2023 21:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692911084; bh=jj6VCafdXtZ0ti0M1QbCs6Yx24ov6Jbm0/NprowIN2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UaM//5KwuH+Rh6kzr/hB7VqTkvRK3hvsfs4PWRH96BjtHl/bA0srlBNataBpt4PX3 AIyYpxNIcYOgJBsoPq5ZYfiuSKDoaMtkRolt0JUWs2oPhceoTsNqVIqrC4UQfJ6H3A QZalXoq1o5sQEZ0gCKqf5ASTrfNJxTyWxCQx4F76MVveFFmPYUVyrw3FjnW8LA7RwD nAsUmCsgt8crDKR6ggBGdei2uHrW8qvsBOLFeLLynYZfPfj5V4+Rn8kd1AHO8keQ9o WWQsYAas3s66uD9S9Q0nv8c9nVTMblcKflevJc+ggbBTgWYEaOMXM3x7c91Veqs74J 2B6qaPOSZ2f8g== From: deller@kernel.org To: qemu-devel@nongnu.org Cc: Richard Henderson , Helge Deller Subject: [PATCH 5/5] target/hppa: Switch to use MMU indices 11-15 Date: Thu, 24 Aug 2023 23:04:34 +0200 Message-ID: <20230824210434.151971-6-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=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-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: 1692925461408100002 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