From nobody Sun May 5 01:06:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1621628703; cv=none; d=zohomail.com; s=zohoarc; b=jwqO3H5/4uFRcKT7x1eF4eDNoUH3Q3rJQvOq+HgCEGe/nxjRreOXPqGn606WogUTGEUym96aoirvvGYgNVEPunYzzcyl8qS5VX+iaS9dTTCjxGkzKnSf2HFNU1vuLD7AHPQLd6Umrpey/vJtoUwSfU21EUyvw0O6uqLiR+mtDYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621628703; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=JJvtne4MrhbCJnTxk3omXQhbOyic099regj/i4rMT6s=; b=PRjEiDkXwdHKsC0SmTkiWf+vLYVZxEP3kHZAlVl8uEnz1tbzxBpsz8xa7my4vPc0umUTgkJ+NSR5fBYmIcuTZpyNHDPv7U4kQKA3QUqB4FFgU8cxfbhWno8WvXkEQ8iNPEtzoSczmVPgumcVP8WzesHx41H9G591dc57ykEHn0c= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621628703006832.0966119764372; Fri, 21 May 2021 13:25:03 -0700 (PDT) Received: from localhost ([::1]:53198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBhd-0005cn-UZ for importer2@patchew.org; Fri, 21 May 2021 16:25:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkBbM-0005up-F5; Fri, 21 May 2021 16:18:32 -0400 Received: from [201.28.113.2] (port=1319 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBbL-0001Nf-51; Fri, 21 May 2021 16:18:32 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Fri, 21 May 2021 17:18:19 -0300 Received: from eldorado.org.br (unknown [10.10.71.235]) by power9a (Postfix) with ESMTP id 282EF8013E6; Fri, 21 May 2021 17:18:19 -0300 (-03) From: "Bruno Larsen (billionai)" To: qemu-devel@nongnu.org Subject: [PATCH v3 1/9] target/ppc: cleaned error_report from ppc_store_sdr1 Date: Fri, 21 May 2021 17:17:51 -0300 Message-Id: <20210521201759.85475-2-bruno.larsen@eldorado.org.br> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> References: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> X-OriginalArrivalTime: 21 May 2021 20:18:19.0307 (UTC) FILETIME=[709F8FB0:01D74E7E] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (failed) 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=201.28.113.2; envelope-from=bruno.larsen@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: farosas@linux.ibm.com, richard.henderson@linaro.org, luis.pires@eldorado.org.br, lucas.araujo@eldorado.org.br, fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Changed how the function ppc_store_sdr1, from error_report(...) to qemu_log_mask(LOG_GUEST_ERROR, ...). Signed-off-by: Bruno Larsen (billionai) Suggested-by: Richard Henderson --- target/ppc/cpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index d957d1a687..9cf3288b7a 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -77,13 +77,13 @@ void ppc_store_sdr1(CPUPPCState *env, target_ulong valu= e) target_ulong htabsize =3D value & SDR_64_HTABSIZE; =20 if (value & ~sdr_mask) { - error_report("Invalid bits 0x"TARGET_FMT_lx" set in SDR1", - value & ~sdr_mask); + qemu_log_mask(LOG_GUEST_ERROR, "Invalid bits 0x"TARGET_FMT_lx + " set in SDR1", value & ~sdr_mask); value &=3D sdr_mask; } if (htabsize > 28) { - error_report("Invalid HTABSIZE 0x" TARGET_FMT_lx" stored in SD= R1", - htabsize); + qemu_log_mask(LOG_GUEST_ERROR, "Invalid HTABSIZE 0x" TARGET_FM= T_lx + " stored in SDR1", htabsize); return; } } --=20 2.17.1 From nobody Sun May 5 01:06:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1621628489; cv=none; d=zohomail.com; s=zohoarc; b=EcldESkMpBtxyyqlm+94iC+dGcWqnP/dJA9SWCgl4pdo9bksFCavwld6C0h3enzH5w4avPOb/0zIKuHKnSojoSpbo/4EoQqc+Qxm6NyOZZGBOIbg5HBRqxc8ZcrmG+JYtQw92DcFyynNJhT5/TVruqnvE6WqTwTG8UmoUhgY3MQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621628489; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=v4dlb9cpJGaKurelxAjm4T01iRQOj8IfMTZ/ujAoPyA=; b=EJBuqujTJr6D2ubOAGJxckvmkCYMD0pmFPUc4cE5/50zSWCEM38Afov0ksPiQCGmZfxw9QNCyqPqAxx4nYD9I+cXAErk2nuajabvAa5O12k3uhXabAjb4ikRq8iSeE1XoOza1y0FV2eEWJMPVKd2/cFrRdgzU0c3VvDe2UBfpLw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621628489571699.2828084979129; Fri, 21 May 2021 13:21:29 -0700 (PDT) Received: from localhost ([::1]:44830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBeC-0008ME-G5 for importer2@patchew.org; Fri, 21 May 2021 16:21:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkBbO-0005yv-TP; Fri, 21 May 2021 16:18:34 -0400 Received: from [201.28.113.2] (port=1319 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBbN-0001Nf-Eb; Fri, 21 May 2021 16:18:34 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Fri, 21 May 2021 17:18:19 -0300 Received: from eldorado.org.br (unknown [10.10.71.235]) by power9a (Postfix) with ESMTP id 3FE148013E3; Fri, 21 May 2021 17:18:19 -0300 (-03) From: "Bruno Larsen (billionai)" To: qemu-devel@nongnu.org Subject: [PATCH v3 2/9] target/ppc: moved ppc_store_lpcr and ppc_store_msr to cpu.c Date: Fri, 21 May 2021 17:17:52 -0300 Message-Id: <20210521201759.85475-3-bruno.larsen@eldorado.org.br> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> References: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> X-OriginalArrivalTime: 21 May 2021 20:18:19.0385 (UTC) FILETIME=[70AB7690:01D74E7E] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (failed) 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=201.28.113.2; envelope-from=bruno.larsen@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: farosas@linux.ibm.com, richard.henderson@linaro.org, luis.pires@eldorado.org.br, lucas.araujo@eldorado.org.br, fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These functions are used in hw/ppc logic, during machine startup, which means it must be compiled when --disable-tcg is selected, and so it has been moved into a common code file Signed-off-by: Bruno Larsen (billionai) Reviewed-by: Richard Henderson Reviewed-by: David Gibson --- target/ppc/cpu.c | 17 +++++++++++++++++ target/ppc/misc_helper.c | 16 ---------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index 9cf3288b7a..c8e87e30f1 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -24,6 +24,7 @@ #include "exec/log.h" #include "fpu/softfloat-helpers.h" #include "mmu-hash64.h" +#include "helper_regs.h" =20 target_ulong cpu_read_xer(CPUPPCState *env) { @@ -92,3 +93,19 @@ void ppc_store_sdr1(CPUPPCState *env, target_ulong value) env->spr[SPR_SDR1] =3D value; } #endif /* CONFIG_SOFTMMU */ + +/* GDBstub can read and write MSR... */ +void ppc_store_msr(CPUPPCState *env, target_ulong value) +{ + hreg_store_msr(env, value, 0); +} + +void ppc_store_lpcr(PowerPCCPU *cpu, target_ulong val) +{ + PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu); + CPUPPCState *env =3D &cpu->env; + + env->spr[SPR_LPCR] =3D val & pcc->lpcr_mask; + /* The gtse bit affects hflags */ + hreg_compute_hflags(env); +} diff --git a/target/ppc/misc_helper.c b/target/ppc/misc_helper.c index 08a31da289..442b12652c 100644 --- a/target/ppc/misc_helper.c +++ b/target/ppc/misc_helper.c @@ -255,22 +255,6 @@ target_ulong helper_clcs(CPUPPCState *env, uint32_t ar= g) /*************************************************************************= ****/ /* Special registers manipulation */ =20 -/* GDBstub can read and write MSR... */ -void ppc_store_msr(CPUPPCState *env, target_ulong value) -{ - hreg_store_msr(env, value, 0); -} - -void ppc_store_lpcr(PowerPCCPU *cpu, target_ulong val) -{ - PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu); - CPUPPCState *env =3D &cpu->env; - - env->spr[SPR_LPCR] =3D val & pcc->lpcr_mask; - /* The gtse bit affects hflags */ - hreg_compute_hflags(env); -} - /* * This code is lifted from MacOnLinux. It is called whenever THRM1,2 * or 3 is read an fixes up the values in such a way that will make --=20 2.17.1 From nobody Sun May 5 01:06:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1621628710; cv=none; d=zohomail.com; s=zohoarc; b=Ru7kUIm7wRZ/GhGrMCQ/TIiSByjtNfme30zd2h3hW1jd7fUNicSTlgJh0taLmmsKlUS97KtApj4qhdNAMATJqsoTM9u6mkk7tj8MPEoj7eA6Ajx4dcXaMOUqE0nL5L/5eJe3zP6s0WWBcu0DaV9RQPCeEtoZSEZMdS70zrcb2AU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621628710; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=tI+Ni9bsLB9id+uCe3pLVygAsMZvJ7mCYb3+EZU55gg=; b=nlSfPcriP8JIB3vEQzehCVQeyDEsxeu+FIEbZroS1SSSAcM015NAcHtQ7BR7qvQZkbPutgu+/xKsz0gv9NaAW60v/4euh1KrVSfJjLdu0ud7gC0tSVKbbCCK62358MaNsSpOVsbwovu0af6YXfxzFVQjNGwqaQoL3bpiLsi1cgI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621628710143820.0785682550426; Fri, 21 May 2021 13:25:10 -0700 (PDT) Received: from localhost ([::1]:53396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBhl-0005kh-3m for importer2@patchew.org; Fri, 21 May 2021 16:25:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkBbR-00065W-Rv; Fri, 21 May 2021 16:18:37 -0400 Received: from [201.28.113.2] (port=1319 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBbP-0001Nf-UZ; Fri, 21 May 2021 16:18:37 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Fri, 21 May 2021 17:18:19 -0300 Received: from eldorado.org.br (unknown [10.10.71.235]) by power9a (Postfix) with ESMTP id 5663F8013E6; Fri, 21 May 2021 17:18:19 -0300 (-03) From: "Bruno Larsen (billionai)" To: qemu-devel@nongnu.org Subject: [PATCH v3 3/9] target/ppc: reduce usage of fpscr_set_rounding_mode Date: Fri, 21 May 2021 17:17:53 -0300 Message-Id: <20210521201759.85475-4-bruno.larsen@eldorado.org.br> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> References: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> X-OriginalArrivalTime: 21 May 2021 20:18:19.0479 (UTC) FILETIME=[70B9CE70:01D74E7E] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (failed) 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=201.28.113.2; envelope-from=bruno.larsen@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: farosas@linux.ibm.com, richard.henderson@linaro.org, luis.pires@eldorado.org.br, lucas.araujo@eldorado.org.br, fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It is preferable to store the current rounding mode and retore from that than recalculating from fpscr, so we changed the behavior of do_fri and VSX_ROUND to do it like that. Suggested-by: Richard Henderson Signed-off-by: Bruno Larsen (billionai) Reviewed-by: Richard Henderson --- target/ppc/fpu_helper.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 44315fca0b..a4a283df2b 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -822,6 +822,7 @@ static inline uint64_t do_fri(CPUPPCState *env, uint64_= t arg, int rounding_mode) { CPU_DoubleU farg; + FloatRoundMode old_rounding_mode =3D get_float_rounding_mode(&env->fp_= status); =20 farg.ll =3D arg; =20 @@ -834,8 +835,7 @@ static inline uint64_t do_fri(CPUPPCState *env, uint64_= t arg, float_flag_inexact; set_float_rounding_mode(rounding_mode, &env->fp_status); farg.ll =3D float64_round_to_int(farg.d, &env->fp_status); - /* Restore rounding mode from FPSCR */ - fpscr_set_rounding_mode(env); + set_float_rounding_mode(old_rounding_mode, &env->fp_status); =20 /* fri* does not set FPSCR[XX] */ if (!inexact) { @@ -3136,8 +3136,10 @@ void helper_##op(CPUPPCState *env, ppc_vsr_t *xt, pp= c_vsr_t *xb) \ { \ ppc_vsr_t t =3D *xt; \ int i; \ + FloatRoundMode curr_rounding_mode; \ \ if (rmode !=3D FLOAT_ROUND_CURRENT) { \ + curr_rounding_mode =3D get_float_rounding_mode(&env->fp_status); \ set_float_rounding_mode(rmode, &env->fp_status); \ } \ \ @@ -3160,7 +3162,7 @@ void helper_##op(CPUPPCState *env, ppc_vsr_t *xt, ppc= _vsr_t *xb) \ * mode from FPSCR \ */ \ if (rmode !=3D FLOAT_ROUND_CURRENT) { \ - fpscr_set_rounding_mode(env); \ + set_float_rounding_mode(curr_rounding_mode, &env->fp_status); \ env->fp_status.float_exception_flags &=3D ~float_flag_inexact; \ } \ \ --=20 2.17.1 From nobody Sun May 5 01:06:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1621628565; cv=none; d=zohomail.com; s=zohoarc; b=INWERBmXU+gtXdBfvwW3YtE3XiVaDNGvhZRagRy5NM8bXdenMTKZ6NbL3jbhBxvT2OGej+uhwnqLnm02svfViMpy0Rna30sqmO0i8xvR6SWcjLFO/dke83vjmMrOdEz1xtipyq+Gt9yRPa55/RiNNzk09H55dNezhQiMRhb5e4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621628565; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Wy7mkqzlICYKHjGCmECjntlT9IITmSJLS6EzeTPIptM=; b=d19S2WYwOHz99htGxi0sm88n3PuHvNpPTdjHTm35bhVjaRErE3XjJgv78ATG9Fv5y47biRDUJRc5D6bWZm1vJN6+ETzhJFyD50UYjBe1C3Q33vvZQmyqTbFVgFZQSIY+mbxwUkCEhGnw5+m9pzhU6kdwZuwb5IallpxSn4S9kHU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621628565367148.45474226486488; Fri, 21 May 2021 13:22:45 -0700 (PDT) Received: from localhost ([::1]:47424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBfQ-0001ei-8A for importer2@patchew.org; Fri, 21 May 2021 16:22:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkBbU-0006Cu-UX; Fri, 21 May 2021 16:18:40 -0400 Received: from [201.28.113.2] (port=1319 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBbS-0001Nf-VP; Fri, 21 May 2021 16:18:40 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Fri, 21 May 2021 17:18:19 -0300 Received: from eldorado.org.br (unknown [10.10.71.235]) by power9a (Postfix) with ESMTP id 6B3B88013E3; Fri, 21 May 2021 17:18:19 -0300 (-03) From: "Bruno Larsen (billionai)" To: qemu-devel@nongnu.org Subject: [PATCH v3 4/9] target/ppc: overhauled and moved logic of storing fpscr Date: Fri, 21 May 2021 17:17:54 -0300 Message-Id: <20210521201759.85475-5-bruno.larsen@eldorado.org.br> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> References: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> X-OriginalArrivalTime: 21 May 2021 20:18:19.0557 (UTC) FILETIME=[70C5B550:01D74E7E] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (failed) 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=201.28.113.2; envelope-from=bruno.larsen@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: farosas@linux.ibm.com, richard.henderson@linaro.org, luis.pires@eldorado.org.br, lucas.araujo@eldorado.org.br, fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Followed the suggested overhaul to store_fpscr logic, and moved it to cpu.c where it can be accessed in !TCG builds. The overhaul was suggesting because storing a value to fpscr should never raise an exception, so we could remove all the mess that happened with POWERPC_EXCP_FP. We also moved fpscr_set_rounding_mode into cpu.c as it could now be moved there, and it is needed when a value for the fpscr is being stored directly. Suggested-by: Richard Henderson Signed-off-by: Bruno Larsen (billionai) Reviewed-by: Richard Henderson --- target/ppc/cpu.c | 43 ++++++++ target/ppc/cpu.h | 12 +- target/ppc/fpu_helper.c | 238 +++------------------------------------- target/ppc/gdbstub.c | 6 +- 4 files changed, 65 insertions(+), 234 deletions(-) diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index c8e87e30f1..19d67b5b07 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -25,6 +25,7 @@ #include "fpu/softfloat-helpers.h" #include "mmu-hash64.h" #include "helper_regs.h" +#include "sysemu/tcg.h" =20 target_ulong cpu_read_xer(CPUPPCState *env) { @@ -109,3 +110,45 @@ void ppc_store_lpcr(PowerPCCPU *cpu, target_ulong val) /* The gtse bit affects hflags */ hreg_compute_hflags(env); } + +static inline void fpscr_set_rounding_mode(CPUPPCState *env) +{ + int rnd_type; + + /* Set rounding mode */ + switch (fpscr_rn) { + case 0: + /* Best approximation (round to nearest) */ + rnd_type =3D float_round_nearest_even; + break; + case 1: + /* Smaller magnitude (round toward zero) */ + rnd_type =3D float_round_to_zero; + break; + case 2: + /* Round toward +infinite */ + rnd_type =3D float_round_up; + break; + default: + case 3: + /* Round toward -infinite */ + rnd_type =3D float_round_down; + break; + } + set_float_rounding_mode(rnd_type, &env->fp_status); +} + +void ppc_store_fpscr(CPUPPCState *env, target_ulong val) +{ + val &=3D ~(FP_VX | FP_FEX); + if (val & FPSCR_IX) { + val |=3D FP_VX; + } + if ((val >> FPSCR_XX) & (val >> FPSCR_XE) & 0x1f) { + val |=3D FP_FEX; + } + env->fpscr =3D val; + if (tcg_enabled()) { + fpscr_set_rounding_mode(env); + } +} diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index cab33a3680..203f07e48e 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -675,11 +675,11 @@ enum { #define fpscr_ni (((env->fpscr) >> FPSCR_NI) & 0x1) #define fpscr_rn (((env->fpscr) >> FPSCR_RN0) & 0x3) /* Invalid operation exception summary */ -#define fpscr_ix ((env->fpscr) & ((1 << FPSCR_VXSNAN) | (1 << FPSCR_VXISI)= | \ - (1 << FPSCR_VXIDI) | (1 << FPSCR_VXZDZ)= | \ - (1 << FPSCR_VXIMZ) | (1 << FPSCR_VXVC) = | \ - (1 << FPSCR_VXSOFT) | (1 << FPSCR_VXSQRT= ) | \ - (1 << FPSCR_VXCVI))) +#define FPSCR_IX ((1 << FPSCR_VXSNAN) | (1 << FPSCR_VXISI) | \ + (1 << FPSCR_VXIDI) | (1 << FPSCR_VXZDZ) | \ + (1 << FPSCR_VXIMZ) | (1 << FPSCR_VXVC) | \ + (1 << FPSCR_VXSOFT) | (1 << FPSCR_VXSQRT) | \ + (1 << FPSCR_VXCVI)) /* exception summary */ #define fpscr_ex (((env->fpscr) >> FPSCR_XX) & 0x1F) /* enabled exception summary */ @@ -1334,7 +1334,7 @@ void cpu_ppc_set_vhyp(PowerPCCPU *cpu, PPCVirtualHype= rvisor *vhyp); #endif #endif =20 -void store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask); +void ppc_store_fpscr(CPUPPCState *env, target_ulong val); void helper_hfscr_facility_check(CPUPPCState *env, uint32_t bit, const char *caller, uint32_t cause); =20 diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index a4a283df2b..0f4074fc7e 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -383,247 +383,35 @@ static inline void float_inexact_excp(CPUPPCState *e= nv) } } =20 -static inline void fpscr_set_rounding_mode(CPUPPCState *env) -{ - int rnd_type; - - /* Set rounding mode */ - switch (fpscr_rn) { - case 0: - /* Best approximation (round to nearest) */ - rnd_type =3D float_round_nearest_even; - break; - case 1: - /* Smaller magnitude (round toward zero) */ - rnd_type =3D float_round_to_zero; - break; - case 2: - /* Round toward +infinite */ - rnd_type =3D float_round_up; - break; - default: - case 3: - /* Round toward -infinite */ - rnd_type =3D float_round_down; - break; - } - set_float_rounding_mode(rnd_type, &env->fp_status); -} - void helper_fpscr_clrbit(CPUPPCState *env, uint32_t bit) { - int prev; - - prev =3D (env->fpscr >> bit) & 1; - env->fpscr &=3D ~(1 << bit); - if (prev =3D=3D 1) { - switch (bit) { - case FPSCR_RN1: - case FPSCR_RN0: - fpscr_set_rounding_mode(env); - break; - case FPSCR_VXSNAN: - case FPSCR_VXISI: - case FPSCR_VXIDI: - case FPSCR_VXZDZ: - case FPSCR_VXIMZ: - case FPSCR_VXVC: - case FPSCR_VXSOFT: - case FPSCR_VXSQRT: - case FPSCR_VXCVI: - if (!fpscr_ix) { - /* Set VX bit to zero */ - env->fpscr &=3D ~FP_VX; - } - break; - case FPSCR_OX: - case FPSCR_UX: - case FPSCR_ZX: - case FPSCR_XX: - case FPSCR_VE: - case FPSCR_OE: - case FPSCR_UE: - case FPSCR_ZE: - case FPSCR_XE: - if (!fpscr_eex) { - /* Set the FEX bit */ - env->fpscr &=3D ~FP_FEX; - } - break; - default: - break; - } + uint32_t mask =3D 1u << bit; + if (env->fpscr & mask) { + ppc_store_fpscr(env, env->fpscr & ~mask); } } =20 void helper_fpscr_setbit(CPUPPCState *env, uint32_t bit) { - CPUState *cs =3D env_cpu(env); - int prev; - - prev =3D (env->fpscr >> bit) & 1; - env->fpscr |=3D 1 << bit; - if (prev =3D=3D 0) { - switch (bit) { - case FPSCR_VX: - env->fpscr |=3D FP_FX; - if (fpscr_ve) { - goto raise_ve; - } - break; - case FPSCR_OX: - env->fpscr |=3D FP_FX; - if (fpscr_oe) { - goto raise_oe; - } - break; - case FPSCR_UX: - env->fpscr |=3D FP_FX; - if (fpscr_ue) { - goto raise_ue; - } - break; - case FPSCR_ZX: - env->fpscr |=3D FP_FX; - if (fpscr_ze) { - goto raise_ze; - } - break; - case FPSCR_XX: - env->fpscr |=3D FP_FX; - if (fpscr_xe) { - goto raise_xe; - } - break; - case FPSCR_VXSNAN: - case FPSCR_VXISI: - case FPSCR_VXIDI: - case FPSCR_VXZDZ: - case FPSCR_VXIMZ: - case FPSCR_VXVC: - case FPSCR_VXSOFT: - case FPSCR_VXSQRT: - case FPSCR_VXCVI: - env->fpscr |=3D FP_VX; - env->fpscr |=3D FP_FX; - if (fpscr_ve !=3D 0) { - goto raise_ve; - } - break; - case FPSCR_VE: - if (fpscr_vx !=3D 0) { - raise_ve: - env->error_code =3D POWERPC_EXCP_FP; - if (fpscr_vxsnan) { - env->error_code |=3D POWERPC_EXCP_FP_VXSNAN; - } - if (fpscr_vxisi) { - env->error_code |=3D POWERPC_EXCP_FP_VXISI; - } - if (fpscr_vxidi) { - env->error_code |=3D POWERPC_EXCP_FP_VXIDI; - } - if (fpscr_vxzdz) { - env->error_code |=3D POWERPC_EXCP_FP_VXZDZ; - } - if (fpscr_vximz) { - env->error_code |=3D POWERPC_EXCP_FP_VXIMZ; - } - if (fpscr_vxvc) { - env->error_code |=3D POWERPC_EXCP_FP_VXVC; - } - if (fpscr_vxsoft) { - env->error_code |=3D POWERPC_EXCP_FP_VXSOFT; - } - if (fpscr_vxsqrt) { - env->error_code |=3D POWERPC_EXCP_FP_VXSQRT; - } - if (fpscr_vxcvi) { - env->error_code |=3D POWERPC_EXCP_FP_VXCVI; - } - goto raise_excp; - } - break; - case FPSCR_OE: - if (fpscr_ox !=3D 0) { - raise_oe: - env->error_code =3D POWERPC_EXCP_FP | POWERPC_EXCP_FP_OX; - goto raise_excp; - } - break; - case FPSCR_UE: - if (fpscr_ux !=3D 0) { - raise_ue: - env->error_code =3D POWERPC_EXCP_FP | POWERPC_EXCP_FP_UX; - goto raise_excp; - } - break; - case FPSCR_ZE: - if (fpscr_zx !=3D 0) { - raise_ze: - env->error_code =3D POWERPC_EXCP_FP | POWERPC_EXCP_FP_ZX; - goto raise_excp; - } - break; - case FPSCR_XE: - if (fpscr_xx !=3D 0) { - raise_xe: - env->error_code =3D POWERPC_EXCP_FP | POWERPC_EXCP_FP_XX; - goto raise_excp; - } - break; - case FPSCR_RN1: - case FPSCR_RN0: - fpscr_set_rounding_mode(env); - break; - default: - break; - raise_excp: - /* Update the floating-point enabled exception summary */ - env->fpscr |=3D FP_FEX; - /* We have to update Rc1 before raising the exception */ - cs->exception_index =3D POWERPC_EXCP_PROGRAM; - break; - } + uint32_t mask =3D 1u << bit; + if (!(env->fpscr & mask)) { + ppc_store_fpscr(env, env->fpscr | mask); } } =20 -void helper_store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask) +void helper_store_fpscr(CPUPPCState *env, uint64_t val, uint32_t nibbles) { - CPUState *cs =3D env_cpu(env); - target_ulong prev, new; + target_ulong mask =3D 0; int i; =20 - prev =3D env->fpscr; - new =3D (target_ulong)arg; - new &=3D ~(FP_FEX | FP_VX); - new |=3D prev & (FP_FEX | FP_VX); + /* TODO: push this extension back to translation time */ for (i =3D 0; i < sizeof(target_ulong) * 2; i++) { - if (mask & (1 << i)) { - env->fpscr &=3D ~(0xFLL << (4 * i)); - env->fpscr |=3D new & (0xFLL << (4 * i)); + if (nibbles & (1 << i)) { + mask |=3D (target_ulong) 0xf << (4 * i); } } - /* Update VX and FEX */ - if (fpscr_ix !=3D 0) { - env->fpscr |=3D FP_VX; - } else { - env->fpscr &=3D ~FP_VX; - } - if ((fpscr_ex & fpscr_eex) !=3D 0) { - env->fpscr |=3D FP_FEX; - cs->exception_index =3D POWERPC_EXCP_PROGRAM; - /* XXX: we should compute it properly */ - env->error_code =3D POWERPC_EXCP_FP; - } else { - env->fpscr &=3D ~FP_FEX; - } - fpscr_set_rounding_mode(env); -} - -void store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask) -{ - helper_store_fpscr(env, arg, mask); + val =3D (val & mask) | (env->fpscr & ~mask); + ppc_store_fpscr(env, val); } =20 static void do_float_check_status(CPUPPCState *env, uintptr_t raddr) diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 9339e7eafe..c7d866cfcc 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -272,7 +272,7 @@ int ppc_cpu_gdb_write_register(CPUState *cs, uint8_t *m= em_buf, int n) break; case 70: /* fpscr */ - store_fpscr(env, ldtul_p(mem_buf), 0xffffffff); + ppc_store_fpscr(env, ldtul_p(mem_buf)); break; } } @@ -322,7 +322,7 @@ int ppc_cpu_gdb_write_register_apple(CPUState *cs, uint= 8_t *mem_buf, int n) break; case 70 + 32: /* fpscr */ - store_fpscr(env, ldq_p(mem_buf), 0xffffffff); + ppc_store_fpscr(env, ldq_p(mem_buf)); break; } } @@ -475,7 +475,7 @@ static int gdb_set_float_reg(CPUPPCState *env, uint8_t = *mem_buf, int n) } if (n =3D=3D 32) { ppc_maybe_bswap_register(env, mem_buf, 4); - store_fpscr(env, ldl_p(mem_buf), 0xffffffff); + ppc_store_fpscr(env, ldl_p(mem_buf)); return 4; } return 0; --=20 2.17.1 From nobody Sun May 5 01:06:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1621628910; cv=none; d=zohomail.com; s=zohoarc; b=Mq0yfvEFrMw3DhqlYEMQcFkas5L1hSNlsG3azQ/Zw2FV+V1qCfTQgt4OLHGAwVVP1XiZmgPUMxCeKzlv+E54BTjg/H9oppSNBZQaDdSHytKUWfJsrYzigls9qMuhhpgInviws+wfA84hw2LM8JcoLz0XptSvFA/4kZpNXbVgves= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621628910; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=9nYFTH4EYbKjDpJhv5Cb8AsuFFLhhnW9HPC+N9z1KLY=; b=ClphR7g3PY+Xy9te3HTFY+QWrv9NmwtVaCl1IGaATfeq49mwr91Ry9J4Tfgt710YZspJSagHF9fhD3kdHcYK+WD7EmcrlxcfMpAXk24ljdof0tePfYFXZnlE20Vmf15i8MC2H8mWm0BA6buY8FaiMUlwVIpc8rJtfp1N3GbkVY8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621628910929902.7740170823428; Fri, 21 May 2021 13:28:30 -0700 (PDT) Received: from localhost ([::1]:34826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBkz-0003uC-Qy for importer2@patchew.org; Fri, 21 May 2021 16:28:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkBcX-0007DX-NE; Fri, 21 May 2021 16:19:45 -0400 Received: from [201.28.113.2] (port=30260 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBcW-0001dV-7d; Fri, 21 May 2021 16:19:45 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Fri, 21 May 2021 17:18:19 -0300 Received: from eldorado.org.br (unknown [10.10.71.235]) by power9a (Postfix) with ESMTP id 7F1D98013E6; Fri, 21 May 2021 17:18:19 -0300 (-03) From: "Bruno Larsen (billionai)" To: qemu-devel@nongnu.org Subject: [PATCH v3 5/9] target/ppc: removed unnecessary inclusion of helper-proto.h Date: Fri, 21 May 2021 17:17:55 -0300 Message-Id: <20210521201759.85475-6-bruno.larsen@eldorado.org.br> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> References: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> X-OriginalArrivalTime: 21 May 2021 20:18:19.0635 (UTC) FILETIME=[70D19C30:01D74E7E] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (failed) 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=201.28.113.2; envelope-from=bruno.larsen@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: farosas@linux.ibm.com, richard.henderson@linaro.org, luis.pires@eldorado.org.br, lucas.araujo@eldorado.org.br, fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These files included helper-proto.h, but didn't use or declare any helpers, so the #include has been removed Signed-off-by: Bruno Larsen (billionai) Reviewed-by: Richard Henderson --- target/ppc/cpu_init.c | 1 - target/ppc/gdbstub.c | 1 - target/ppc/mmu-hash32.c | 1 - target/ppc/mmu-radix64.c | 1 - 4 files changed, 4 deletions(-) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 3365135896..b696469d1a 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -43,7 +43,6 @@ #include "fpu/softfloat.h" #include "qapi/qapi-commands-machine-target.h" =20 -#include "exec/helper-proto.h" #include "helper_regs.h" #include "internal.h" #include "spr_tcg.h" diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index c7d866cfcc..09ff1328d4 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/gdbstub.h" -#include "exec/helper-proto.h" #include "internal.h" =20 static int ppc_gdb_register_len_apple(int n) diff --git a/target/ppc/mmu-hash32.c b/target/ppc/mmu-hash32.c index 32d1f4a954..6a07c345e4 100644 --- a/target/ppc/mmu-hash32.c +++ b/target/ppc/mmu-hash32.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" -#include "exec/helper-proto.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" #include "internal.h" diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index eabfe4e261..cbd404bfa4 100644 --- a/target/ppc/mmu-radix64.c +++ b/target/ppc/mmu-radix64.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" -#include "exec/helper-proto.h" #include "qemu/error-report.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" --=20 2.17.1 From nobody Sun May 5 01:06:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1621628562; cv=none; d=zohomail.com; s=zohoarc; b=V+nqOz0uhy78seduV4udYv7lDUMMGtqsnb08v1hvg1PEzHc8UOLoi11IJ307XsSvwu7gMonSnE7zpLa7guZ78J/rDw+WFBBWUg6SCu3eI9G3IVPMve3dxpg0mGBMctc+QUuTzhYq2whoWvlCbBJ4O2VyeGk08ootIxz6yEPeN+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621628562; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=JcW5rLMIPnpcnfVTAYe/ytJxBB33cz9ARuchVffE3wU=; b=S9qhu7HS3kSTWD+wIppR/83xDTuJh3dnwNlwwqbW0BKdDueusvJnMcvFTbq3awIgmlSG+lPq9uwES5+gPdOH+6W8dqVlI10Yk4xf8DMLLtPHY5sUYrH4gh63JCbiIa3z1VznDd07Uxkh4r5Dnck/iuoQxV+Wj0cvD9waO3nOsXE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621628562768437.31664122556685; Fri, 21 May 2021 13:22:42 -0700 (PDT) Received: from localhost ([::1]:47360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBfN-0001cB-NS for importer2@patchew.org; Fri, 21 May 2021 16:22:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkBca-0007KP-7H; Fri, 21 May 2021 16:19:48 -0400 Received: from [201.28.113.2] (port=30260 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBcY-0001dV-MZ; Fri, 21 May 2021 16:19:47 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Fri, 21 May 2021 17:18:19 -0300 Received: from eldorado.org.br (unknown [10.10.71.235]) by power9a (Postfix) with ESMTP id 939968013E3; Fri, 21 May 2021 17:18:19 -0300 (-03) From: "Bruno Larsen (billionai)" To: qemu-devel@nongnu.org Subject: [PATCH v3 6/9] target/ppc: moved ppc_cpu_do_interrupt to cpu.c Date: Fri, 21 May 2021 17:17:56 -0300 Message-Id: <20210521201759.85475-7-bruno.larsen@eldorado.org.br> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> References: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> X-OriginalArrivalTime: 21 May 2021 20:18:19.0714 (UTC) FILETIME=[70DDAA20:01D74E7E] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (failed) 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=201.28.113.2; envelope-from=bruno.larsen@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: farosas@linux.ibm.com, richard.henderson@linaro.org, luis.pires@eldorado.org.br, lucas.araujo@eldorado.org.br, fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Moved the ppc_cpu_do_interrupt function to cpu.c file, where it makes more sense, and turned powerpc_excp not static, as it now needs to be accessed from outside of excp_helper.c Signed-off-by: Bruno Larsen (billionai) --- target/ppc/cpu.c | 20 ++++++++++++++++++++ target/ppc/cpu.h | 1 + target/ppc/excp_helper.c | 19 +------------------ 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index 19d67b5b07..95898f348b 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -152,3 +152,23 @@ void ppc_store_fpscr(CPUPPCState *env, target_ulong va= l) fpscr_set_rounding_mode(env); } } + +/* Exception processing */ +#if defined(CONFIG_USER_ONLY) +void ppc_cpu_do_interrupt(CPUState *cs) +{ + PowerPCCPU *cpu =3D POWERPC_CPU(cs); + CPUPPCState *env =3D &cpu->env; + + cs->exception_index =3D POWERPC_EXCP_NONE; + env->error_code =3D 0; +} +#else +void ppc_cpu_do_interrupt(CPUState *cs) +{ + PowerPCCPU *cpu =3D POWERPC_CPU(cs); + CPUPPCState *env =3D &cpu->env; + + powerpc_excp(cpu, env->excp_model, cs->exception_index); +} +#endif diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 203f07e48e..65a08cc424 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1254,6 +1254,7 @@ DECLARE_OBJ_CHECKERS(PPCVirtualHypervisor, PPCVirtual= HypervisorClass, #endif /* CONFIG_USER_ONLY */ =20 void ppc_cpu_do_interrupt(CPUState *cpu); +void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp); bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req); void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int flags); void ppc_cpu_dump_statistics(CPUState *cpu, int flags); diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index f4f15279eb..80bb6e70e9 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -38,15 +38,6 @@ /*************************************************************************= ****/ /* Exception processing */ #if defined(CONFIG_USER_ONLY) -void ppc_cpu_do_interrupt(CPUState *cs) -{ - PowerPCCPU *cpu =3D POWERPC_CPU(cs); - CPUPPCState *env =3D &cpu->env; - - cs->exception_index =3D POWERPC_EXCP_NONE; - env->error_code =3D 0; -} - static void ppc_hw_interrupt(CPUPPCState *env) { CPUState *cs =3D env_cpu(env); @@ -324,7 +315,7 @@ static inline void powerpc_set_excp_state(PowerPCCPU *c= pu, * Note that this function should be greatly optimized when called * with a constant excp, from ppc_hw_interrupt */ -static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) +inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) { CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; @@ -968,14 +959,6 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int e= xcp_model, int excp) powerpc_set_excp_state(cpu, vector, new_msr); } =20 -void ppc_cpu_do_interrupt(CPUState *cs) -{ - PowerPCCPU *cpu =3D POWERPC_CPU(cs); - CPUPPCState *env =3D &cpu->env; - - powerpc_excp(cpu, env->excp_model, cs->exception_index); -} - static void ppc_hw_interrupt(CPUPPCState *env) { PowerPCCPU *cpu =3D env_archcpu(env); --=20 2.17.1 From nobody Sun May 5 01:06:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1621628804; cv=none; d=zohomail.com; s=zohoarc; b=O29N8T2rnVm5Ia9vKE6zbcui3AcM15yR4m2tOmHiPc7i3EPpYNdEnq8tRLes1kFbaM1NpS+cG7yavjyhBZZdLS5N+XQfRmzuNFk4xFYcfeO4t6zMq/0cgLE0S2uv+6Cwp6PWT4rLrlFI9Uhg7GDGtNdytMkX82VY3EaCg4fBlCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621628804; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=MSfonvuNQkHv/H7ZVzRTqhkHjppmIU626G9op/3R150=; b=cgkty3i7ETil3VYATMLn8TjztmlFB48ecnofOOuSfKytUxP6zl9PDx/3uWHBdejUjvPdqeeUaXzjbH5I/fH/Xpf6AmBCCC1f/0s61+faqHTsGvKarGVs4F8vORc0K4n4Uci22kJlY87uwU5XPwyC5H3bj7azisEpaZ2v1zya6MI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621628804038518.7776865824507; Fri, 21 May 2021 13:26:44 -0700 (PDT) Received: from localhost ([::1]:56824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBjG-00082G-S0 for importer2@patchew.org; Fri, 21 May 2021 16:26:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkBcd-0007Si-If; Fri, 21 May 2021 16:19:51 -0400 Received: from [201.28.113.2] (port=30260 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBcb-0001dV-87; Fri, 21 May 2021 16:19:51 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Fri, 21 May 2021 17:18:19 -0300 Received: from eldorado.org.br (unknown [10.10.71.235]) by power9a (Postfix) with ESMTP id A85BA8013E6; Fri, 21 May 2021 17:18:19 -0300 (-03) From: "Bruno Larsen (billionai)" To: qemu-devel@nongnu.org Subject: [PATCH v3 7/9] target/ppc: Added options to disable many TCG-only functions Date: Fri, 21 May 2021 17:17:57 -0300 Message-Id: <20210521201759.85475-8-bruno.larsen@eldorado.org.br> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> References: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> X-OriginalArrivalTime: 21 May 2021 20:18:19.0807 (UTC) FILETIME=[70EBDAF0:01D74E7E] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (failed) 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=201.28.113.2; envelope-from=bruno.larsen@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: farosas@linux.ibm.com, richard.henderson@linaro.org, luis.pires@eldorado.org.br, lucas.araujo@eldorado.org.br, fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Wrapped some function calls in cpu_init.c, gdbstub.c, mmu-hash64.c, mmu_helper.c and excp_helper.c that were TCG only with ifdef CONFIG_TCG, to support building without TCG. for excp_helper we also moved the function do_rfi higher in the file to reduce the ifdef count. For cpu_init.c, we will also create stubs for ppc_*_opcodes, to make the ifdef hell a little smaller, and have hid part of the spr_registration logic into the macro that can make the TCG part disappear. Signed-off-by: Bruno Larsen (billionai) --- target/ppc/cpu_init.c | 11 +++--- target/ppc/excp_helper.c | 85 +++++++++++++++++++++++----------------- target/ppc/mmu-hash64.c | 11 +++++- target/ppc/mmu_helper.c | 16 +++++++- 4 files changed, 78 insertions(+), 45 deletions(-) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index b696469d1a..f5ae2f150d 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -1205,15 +1205,12 @@ static void register_BookE206_sprs(CPUPPCState *env= , uint32_t mas_mask, /* TLB assist registers */ /* XXX : not implemented */ for (i =3D 0; i < 8; i++) { - void (*uea_write)(DisasContext *ctx, int sprn, int gprn) =3D - &spr_write_generic32; - if (i =3D=3D 2 && (mas_mask & (1 << i)) && (env->insns_flags & PPC= _64B)) { - uea_write =3D &spr_write_generic; - } if (mas_mask & (1 << i)) { spr_register(env, mas_sprn[i], mas_names[i], SPR_NOACCESS, SPR_NOACCESS, - &spr_read_generic, uea_write, + &spr_read_generic, + (i =3D=3D 2 && (env->insns_flags & PPC_64B)) + ? &spr_write_generic : &spr_write_generic32, 0x00000000); } } @@ -9253,7 +9250,9 @@ static void ppc_cpu_class_init(ObjectClass *oc, void = *data) cc->class_by_name =3D ppc_cpu_class_by_name; cc->has_work =3D ppc_cpu_has_work; cc->dump_state =3D ppc_cpu_dump_state; +#ifdef CONFIG_TCG cc->dump_statistics =3D ppc_cpu_dump_statistics; +#endif cc->set_pc =3D ppc_cpu_set_pc; cc->gdb_read_register =3D ppc_cpu_gdb_read_register; cc->gdb_write_register =3D ppc_cpu_gdb_write_register; diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 80bb6e70e9..e20f38ebe2 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -19,12 +19,15 @@ #include "qemu/osdep.h" #include "qemu/main-loop.h" #include "cpu.h" -#include "exec/helper-proto.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" #include "internal.h" #include "helper_regs.h" =20 +#ifdef CONFIG_TCG +#include "exec/helper-proto.h" +#include "exec/cpu_ldst.h" +#endif + /* #define DEBUG_OP */ /* #define DEBUG_SOFTWARE_TLB */ /* #define DEBUG_EXCEPTIONS */ @@ -1191,6 +1194,7 @@ void raise_exception_ra(CPUPPCState *env, uint32_t ex= ception, raise_exception_err_ra(env, exception, 0, raddr); } =20 +#ifdef CONFIG_TCG void helper_raise_exception_err(CPUPPCState *env, uint32_t exception, uint32_t error_code) { @@ -1201,8 +1205,43 @@ void helper_raise_exception(CPUPPCState *env, uint32= _t exception) { raise_exception_err_ra(env, exception, 0, 0); } +#endif =20 #if !defined(CONFIG_USER_ONLY) +static inline void do_rfi(CPUPPCState *env, target_ulong nip, target_ulong= msr) +{ + CPUState *cs =3D env_cpu(env); + + /* MSR:POW cannot be set by any form of rfi */ + msr &=3D ~(1ULL << MSR_POW); + +#if defined(TARGET_PPC64) + /* Switching to 32-bit ? Crop the nip */ + if (!msr_is_64bit(env, msr)) { + nip =3D (uint32_t)nip; + } +#else + nip =3D (uint32_t)nip; +#endif + /* XXX: beware: this is false if VLE is supported */ + env->nip =3D nip & ~((target_ulong)0x00000003); + hreg_store_msr(env, msr, 1); +#if defined(DEBUG_OP) + cpu_dump_rfi(env->nip, env->msr); +#endif + /* + * No need to raise an exception here, as rfi is always the last + * insn of a TB + */ + cpu_interrupt_exittb(cs); + /* Reset the reservation */ + env->reserve_addr =3D -1; + + /* Context synchronizing: check if TCG TLB needs flush */ + check_tlb_flush(env, false); +} + +#ifdef CONFIG_TCG void helper_store_msr(CPUPPCState *env, target_ulong val) { uint32_t excp =3D hreg_store_msr(env, val, 0); @@ -1243,39 +1282,6 @@ void helper_pminsn(CPUPPCState *env, powerpc_pm_insn= _t insn) } #endif /* defined(TARGET_PPC64) */ =20 -static inline void do_rfi(CPUPPCState *env, target_ulong nip, target_ulong= msr) -{ - CPUState *cs =3D env_cpu(env); - - /* MSR:POW cannot be set by any form of rfi */ - msr &=3D ~(1ULL << MSR_POW); - -#if defined(TARGET_PPC64) - /* Switching to 32-bit ? Crop the nip */ - if (!msr_is_64bit(env, msr)) { - nip =3D (uint32_t)nip; - } -#else - nip =3D (uint32_t)nip; -#endif - /* XXX: beware: this is false if VLE is supported */ - env->nip =3D nip & ~((target_ulong)0x00000003); - hreg_store_msr(env, msr, 1); -#if defined(DEBUG_OP) - cpu_dump_rfi(env->nip, env->msr); -#endif - /* - * No need to raise an exception here, as rfi is always the last - * insn of a TB - */ - cpu_interrupt_exittb(cs); - /* Reset the reservation */ - env->reserve_addr =3D -1; - - /* Context synchronizing: check if TCG TLB needs flush */ - check_tlb_flush(env, false); -} - void helper_rfi(CPUPPCState *env) { do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1] & 0xfffffffful); @@ -1328,8 +1334,10 @@ void helper_rfmci(CPUPPCState *env) /* FIXME: choose CSRR1 or MCSRR1 based on cpu type */ do_rfi(env, env->spr[SPR_BOOKE_MCSRR0], env->spr[SPR_BOOKE_MCSRR1]); } -#endif +#endif /* CONFIG_TCG */ +#endif /* !defined(CONFIG_USER_ONLY) */ =20 +#ifdef CONFIG_TCG void helper_tw(CPUPPCState *env, target_ulong arg1, target_ulong arg2, uint32_t flags) { @@ -1357,11 +1365,13 @@ void helper_td(CPUPPCState *env, target_ulong arg1,= target_ulong arg2, } } #endif +#endif =20 #if !defined(CONFIG_USER_ONLY) /*************************************************************************= ****/ /* PowerPC 601 specific instructions (POWER bridge) */ =20 +#ifdef CONFIG_TCG void helper_rfsvc(CPUPPCState *env) { do_rfi(env, env->lr, env->ctr & 0x0000FFFF); @@ -1506,8 +1516,10 @@ void helper_book3s_msgsndp(CPUPPCState *env, target_= ulong rb) book3s_msgsnd_common(pir, PPC_INTERRUPT_DOORBELL); } #endif +#endif /* CONFIG_TCG */ #endif =20 +#ifdef CONFIG_TCG void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) @@ -1523,3 +1535,4 @@ void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr = vaddr, env->error_code =3D insn & 0x03FF0000; cpu_loop_exit(cs); } +#endif diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index ce0068590f..c1b98a97e9 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -21,7 +21,6 @@ #include "qemu/units.h" #include "cpu.h" #include "exec/exec-all.h" -#include "exec/helper-proto.h" #include "qemu/error-report.h" #include "qemu/qemu-print.h" #include "sysemu/hw_accel.h" @@ -33,6 +32,10 @@ #include "mmu-book3s-v3.h" #include "helper_regs.h" =20 +#ifdef CONFIG_TCG +#include "exec/helper-proto.h" +#endif + /* #define DEBUG_SLB */ =20 #ifdef DEBUG_SLB @@ -97,6 +100,7 @@ void dump_slb(PowerPCCPU *cpu) } } =20 +#ifdef CONFIG_TCG void helper_slbia(CPUPPCState *env, uint32_t ih) { PowerPCCPU *cpu =3D env_archcpu(env); @@ -202,6 +206,7 @@ void helper_slbieg(CPUPPCState *env, target_ulong addr) { __helper_slbie(env, addr, true); } +#endif =20 int ppc_store_slb(PowerPCCPU *cpu, target_ulong slot, target_ulong esid, target_ulong vsid) @@ -255,6 +260,7 @@ int ppc_store_slb(PowerPCCPU *cpu, target_ulong slot, return 0; } =20 +#ifdef CONFIG_TCG static int ppc_load_slb_esid(PowerPCCPU *cpu, target_ulong rb, target_ulong *rt) { @@ -348,6 +354,7 @@ target_ulong helper_load_slb_vsid(CPUPPCState *env, tar= get_ulong rb) } return rt; } +#endif =20 /* Check No-Execute or Guarded Storage */ static inline int ppc_hash64_pte_noexec_guard(PowerPCCPU *cpu, @@ -1097,12 +1104,14 @@ void ppc_hash64_tlb_flush_hpte(PowerPCCPU *cpu, tar= get_ulong ptex, cpu->env.tlb_need_flush =3D TLB_NEED_GLOBAL_FLUSH | TLB_NEED_LOCAL_FLU= SH; } =20 +#ifdef CONFIG_TCG void helper_store_lpcr(CPUPPCState *env, target_ulong val) { PowerPCCPU *cpu =3D env_archcpu(env); =20 ppc_store_lpcr(cpu, val); } +#endif =20 void ppc_hash64_init(PowerPCCPU *cpu) { diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index 5395e5ee5a..9339b3aa59 100644 --- a/target/ppc/mmu_helper.c +++ b/target/ppc/mmu_helper.c @@ -20,13 +20,11 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "cpu.h" -#include "exec/helper-proto.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" #include "mmu-hash64.h" #include "mmu-hash32.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" #include "exec/log.h" #include "helper_regs.h" #include "qemu/error-report.h" @@ -36,6 +34,10 @@ #include "mmu-book3s-v3.h" #include "mmu-radix64.h" =20 +#ifdef CONFIG_TCG +#include "exec/helper-proto.h" +#include "exec/cpu_ldst.h" +#endif /* #define DEBUG_MMU */ /* #define DEBUG_BATS */ /* #define DEBUG_SOFTWARE_TLB */ @@ -268,6 +270,7 @@ static inline void ppc6xx_tlb_invalidate_virt(CPUPPCSta= te *env, ppc6xx_tlb_invalidate_virt2(env, eaddr, is_code, 0); } =20 +#ifdef CONFIG_TCG static void ppc6xx_tlb_store(CPUPPCState *env, target_ulong EPN, int way, int is_code, target_ulong pte0, target_ulong = pte1) { @@ -286,6 +289,7 @@ static void ppc6xx_tlb_store(CPUPPCState *env, target_u= long EPN, int way, /* Store last way for LRU mechanism */ env->last_way =3D way; } +#endif =20 static int ppc6xx_tlb_check(CPUPPCState *env, mmu_ctx_t *ctx, target_ulong eaddr, MMUAccessType access_type) @@ -626,6 +630,7 @@ static int ppcemb_tlb_check(CPUPPCState *env, ppcemb_tl= b_t *tlb, return 0; } =20 +#ifdef CONFIG_TCG /* Generic TLB search function for PowerPC embedded implementations */ static int ppcemb_tlb_search(CPUPPCState *env, target_ulong address, uint32_t pid) @@ -646,6 +651,7 @@ static int ppcemb_tlb_search(CPUPPCState *env, target_u= long address, =20 return ret; } +#endif =20 /* Helpers specific to PowerPC 40x implementations */ static inline void ppc4xx_tlb_invalidate_all(CPUPPCState *env) @@ -1420,12 +1426,14 @@ static int get_physical_address_wtlb(CPUPPCState *e= nv, mmu_ctx_t *ctx, return ret; } =20 +#ifdef CONFIG_TCG static int get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx, target_ulong eaddr, MMUAccessType access_t= ype, int type) { return get_physical_address_wtlb(env, ctx, eaddr, access_type, type, 0= ); } +#endif =20 static void booke206_update_mas_tlb_miss(CPUPPCState *env, target_ulong ad= dress, MMUAccessType access_type, int mm= u_idx) @@ -1709,6 +1717,7 @@ static bool ppc_jumbo_xlate(PowerPCCPU *cpu, vaddr ea= ddr, return false; } =20 +#ifdef CONFIG_TCG /*************************************************************************= ****/ /* BATs management */ #if !defined(FLUSH_ALL_TLBS) @@ -1898,6 +1907,7 @@ void helper_store_601_batl(CPUPPCState *env, uint32_t= nr, target_ulong value) #endif } } +#endif =20 /*************************************************************************= ****/ /* TLB management */ @@ -1943,6 +1953,7 @@ void ppc_tlb_invalidate_all(CPUPPCState *env) } } =20 +#ifdef CONFIG_TCG void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr) { #if !defined(FLUSH_ALL_TLBS) @@ -2912,6 +2923,7 @@ void helper_check_tlb_flush_global(CPUPPCState *env) { check_tlb_flush(env, true); } +#endif /* CONFIG_TCG */ =20 /*************************************************************************= ****/ =20 --=20 2.17.1 From nobody Sun May 5 01:06:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1621629037; cv=none; d=zohomail.com; s=zohoarc; b=mRo9+9lCwMoDaJ5CWXYP+nH5t2JK+P5DK0iBVLTyarsUlsYXVVjsDM97Vuyw6xKpUb8hsCy+Hc/SH+BcrMj1/xk50Wr/Bgr3gaXTNYRikDABZ84fzpJj7t5g/f/adgauqJ2ysbOLBOltK+mzPLRJbgUzZLLtSzlHq8kI+gQIvc4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621629037; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=qQtXwDWZ17ZJp1Bau8/OUePgrwh3ZCh8KOhNdvzUpW4=; b=B957IaA/APP5PzjyHDUtfpmfxYqzpMfMo6VeQBDZ2pEz23WIxX8m+WV4gY/Jr4pgTtmJRjJpE3jokpDfwuQNXxrPc5rKvlp81jBi+uVZ1sGh2Qc9jcB39fJvL1Koe9k5QXLYW+/UPKJomFpzyWOJPujPvvfc5wBaavE+H2bkBEA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621629037885465.9892156363711; Fri, 21 May 2021 13:30:37 -0700 (PDT) Received: from localhost ([::1]:37526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBn2-0005zx-Lo for importer2@patchew.org; Fri, 21 May 2021 16:30:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkBcg-0007ZE-0f; Fri, 21 May 2021 16:19:54 -0400 Received: from [201.28.113.2] (port=30260 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBce-0001dV-J9; Fri, 21 May 2021 16:19:53 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Fri, 21 May 2021 17:18:19 -0300 Received: from eldorado.org.br (unknown [10.10.71.235]) by power9a (Postfix) with ESMTP id BCD7A80141F; Fri, 21 May 2021 17:18:19 -0300 (-03) From: "Bruno Larsen (billionai)" To: qemu-devel@nongnu.org Subject: [PATCH v3 8/9] target/ppc: created tcg-stub.c file Date: Fri, 21 May 2021 17:17:58 -0300 Message-Id: <20210521201759.85475-9-bruno.larsen@eldorado.org.br> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> References: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> X-OriginalArrivalTime: 21 May 2021 20:18:19.0901 (UTC) FILETIME=[70FA32D0:01D74E7E] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (failed) 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=201.28.113.2; envelope-from=bruno.larsen@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: farosas@linux.ibm.com, richard.henderson@linaro.org, luis.pires@eldorado.org.br, lucas.araujo@eldorado.org.br, fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Created a file with stubs needed to compile disabling TCG. *_ppc_opcodes were created to make cpu_init.c have a few less ifdefs, since they are not needed. coftmmu_resize_hpt_* have to be created because the compiler can't automatically know they aren't used, but they should never be reached. Signed-off-by: Bruno Larsen (billionai) --- target/ppc/meson.build | 4 ++++ target/ppc/tcg-stub.c | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 target/ppc/tcg-stub.c diff --git a/target/ppc/meson.build b/target/ppc/meson.build index d1aa7d5d39..848e625302 100644 --- a/target/ppc/meson.build +++ b/target/ppc/meson.build @@ -28,6 +28,10 @@ ppc_softmmu_ss.add(files( 'mmu_helper.c', 'monitor.c', )) +ppc_softmmu_ss.add(when: 'CONFIG_TCG', if_false: files( + 'tcg-stub.c' +)) + ppc_softmmu_ss.add(when: 'TARGET_PPC64', if_true: files( 'compat.c', 'mmu-book3s-v3.c', diff --git a/target/ppc/tcg-stub.c b/target/ppc/tcg-stub.c new file mode 100644 index 0000000000..6d99834274 --- /dev/null +++ b/target/ppc/tcg-stub.c @@ -0,0 +1,25 @@ +#include "qemu/osdep.h" +#include "cpu.h" +#include "internal.h" +#include "hw/ppc/spapr.h" + +void create_ppc_opcodes(PowerPCCPU *cpu, Error **errp) +{} + +void destroy_ppc_opcodes(PowerPCCPU *cpu) +{} + +target_ulong softmmu_resize_hpt_prepare(PowerPCCPU *cpu, + SpaprMachineState *spapr, + target_ulong shift) +{ + g_assert_not_reached(); +} + +target_ulong softmmu_resize_hpt_commit(PowerPCCPU *cpu, + SpaprMachineState *spapr, + target_ulong flags, + target_ulong shift) +{ + g_assert_not_reached(); +} --=20 2.17.1 From nobody Sun May 5 01:06:46 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1621628808; cv=none; d=zohomail.com; s=zohoarc; b=mG6S0vsTYRHL8+ddpFA9Wmb1n04PK+/exBJcTVXdyf3NrTnuq79PmZFGRJBIf7S787z/V3SSL6ZmP3WVHr2k+fYCnlFrQibf9s9GmyseemYxqFcNRpIFcSB5nShVWxYyDLWM1vhNm9UY+IY/Y7t7AaqwaHs/HZbW7XEtsRjegA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621628808; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=b7DZ0IWx7idxhfVYki/iikkWuqOz1SX4rLS6R0DJPUw=; b=k4SdTNhk6oPICOfUEzgAz1wgTe36q93ZoPYymrpRm94iHhHcFSgpNUcy88Vi75yWTM4lhQlEhr+yzibxHQBJMn9EVvegdUJRvpbgSS1AuMlBaPaW91MeZOOYD7V6X3CYKyjSVEwk6ihRnsHiSjpmiVt2Bi2MunSeghiAPxQvm6A= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621628808747118.16842606434136; Fri, 21 May 2021 13:26:48 -0700 (PDT) Received: from localhost ([::1]:57186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBjL-0008K5-L2 for importer2@patchew.org; Fri, 21 May 2021 16:26:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkBci-0007g3-Cl; Fri, 21 May 2021 16:19:56 -0400 Received: from [201.28.113.2] (port=30260 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkBch-0001dV-1G; Fri, 21 May 2021 16:19:56 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Fri, 21 May 2021 17:18:19 -0300 Received: from eldorado.org.br (unknown [10.10.71.235]) by power9a (Postfix) with ESMTP id D2BA98013E3; Fri, 21 May 2021 17:18:19 -0300 (-03) From: "Bruno Larsen (billionai)" To: qemu-devel@nongnu.org Subject: [PATCH v3 9/9] target/ppc: updated meson.build to support disable-tcg Date: Fri, 21 May 2021 17:17:59 -0300 Message-Id: <20210521201759.85475-10-bruno.larsen@eldorado.org.br> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> References: <20210521201759.85475-1-bruno.larsen@eldorado.org.br> X-OriginalArrivalTime: 21 May 2021 20:18:19.0979 (UTC) FILETIME=[710619B0:01D74E7E] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (failed) 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=201.28.113.2; envelope-from=bruno.larsen@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: farosas@linux.ibm.com, richard.henderson@linaro.org, luis.pires@eldorado.org.br, lucas.araujo@eldorado.org.br, fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" updated build file to not compile some sources that are unnecessary if TCG is disabled on the system. Signed-off-by: Bruno Larsen (billionai) Reviewed-by: Richard Henderson --- target/ppc/meson.build | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/ppc/meson.build b/target/ppc/meson.build index 848e625302..a6a53a8d5c 100644 --- a/target/ppc/meson.build +++ b/target/ppc/meson.build @@ -3,11 +3,14 @@ ppc_ss.add(files( 'cpu-models.c', 'cpu.c', 'cpu_init.c', - 'dfp_helper.c', 'excp_helper.c', - 'fpu_helper.c', 'gdbstub.c', 'helper_regs.c', +)) + +ppc_ss.add(when: 'CONFIG_TCG', if_true: files( + 'dfp_helper.c', + 'fpu_helper.c', 'int_helper.c', 'mem_helper.c', 'misc_helper.c', --=20 2.17.1