From nobody Tue Feb 10 02:54:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1621429388; cv=none; d=zohomail.com; s=zohoarc; b=I0MLTW1GSlwhrVwq/CoQFv0H6kNAfbKPOuWSn4QvwTBCdCDd7+xisbuUiVdtNBuJ0gB95hXt5j+b2hqE/9SPyEdoL8uHw6XP22wnQYBSLZ9szJNrKGsps/2PDVfgqms7ikQ3As9rNKjFGbKsaY4Tf5RNfppC5Z3/Ree+gR00Nsc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621429388; 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=0GUYMIULn5chHdVXM8udUprVEH79qk1mbxdyEDy4H9s=; b=gUGdJSm2AR1G48WPFS1LJqDv1jxNZD8jqlFevydm+Szebo2pCCOVz8WV4RIw3jQKsE+6hIGLEQwpZ6kzUAf+OVzhIW4qoNO81rHQW940l4i7wd7GpmOSrqJR/E/TcVEtU/TK2tYlSji3NdR4VBrNeAtX/yaJ2A/5/AjtQSQC5ms= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1621429388935563.2436602173432; Wed, 19 May 2021 06:03:08 -0700 (PDT) Received: from localhost ([::1]:54390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljLqu-0003Db-17 for importer@patchew.org; Wed, 19 May 2021 09:03:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljLgh-0000k7-NY; Wed, 19 May 2021 08:52:37 -0400 Received: from ozlabs.org ([203.11.71.1]:39991) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljLgZ-00018i-UN; Wed, 19 May 2021 08:52:31 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4FlXnZ2q8Cz9sjJ; Wed, 19 May 2021 22:52:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1621428722; bh=c5OHXujyEPuiaSsHbO8m/B7ytbStRyA+HYd42ee3VPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PFXqi51tu/Asg/sOcg+7UGANDGmJFd2qerlRf0Q9AOjNtJGq4+97VP88gUr4c/JZ8 +P7AiGohGIu5L5w9pc9RWQpMaJPLnMSfOT06jgHfjj+c+fFRX0rshN3x4yfMAhjVRz vdQu74RI9/+sD67tTcjaZ88lOYt9rIXQcNN2jo7U= From: David Gibson To: peter.maydell@linaro.org, groug@kaod.org Subject: [PULL 12/48] target/ppc: created ppc_{store, get}_vscr for generic vscr usage Date: Wed, 19 May 2021 22:51:12 +1000 Message-Id: <20210519125148.27720-13-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210519125148.27720-1-david@gibson.dropbear.id.au> References: <20210519125148.27720-1-david@gibson.dropbear.id.au> 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=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-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: richard.henderson@linaro.org, David Gibson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, "Bruno Larsen \(billionai\)" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: "Bruno Larsen (billionai)" Some functions unrelated to TCG use helper_m{t,f}vscr, so generic versions of those functions were added to cpu.c, in preparation for compilation without TCG Signed-off-by: Bruno Larsen (billionai) Message-Id: <20210512140813.112884-2-bruno.larsen@eldorado.org.br> Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/arch_dump.c | 3 +-- target/ppc/cpu.c | 16 ++++++++++++++++ target/ppc/cpu.h | 2 ++ target/ppc/cpu_init.c | 2 +- target/ppc/gdbstub.c | 4 ++-- target/ppc/int_helper.c | 9 ++------- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c index 9ab04b2c38..9210e61ef4 100644 --- a/target/ppc/arch_dump.c +++ b/target/ppc/arch_dump.c @@ -17,7 +17,6 @@ #include "elf.h" #include "sysemu/dump.h" #include "sysemu/kvm.h" -#include "exec/helper-proto.h" =20 #ifdef TARGET_PPC64 #define ELFCLASS ELFCLASS64 @@ -176,7 +175,7 @@ static void ppc_write_elf_vmxregset(NoteFuncArg *arg, P= owerPCCPU *cpu) vmxregset->avr[i].u64[1] =3D avr->u64[1]; } } - vmxregset->vscr.u32[3] =3D cpu_to_dump32(s, helper_mfvscr(&cpu->env)); + vmxregset->vscr.u32[3] =3D cpu_to_dump32(s, ppc_get_vscr(&cpu->env)); } =20 static void ppc_write_elf_vsxregset(NoteFuncArg *arg, PowerPCCPU *cpu) diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index e501a7ff6f..cb794e9f4f 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "cpu.h" #include "cpu-models.h" +#include "fpu/softfloat-helpers.h" =20 target_ulong cpu_read_xer(CPUPPCState *env) { @@ -45,3 +46,18 @@ void cpu_write_xer(CPUPPCState *env, target_ulong xer) (1ul << XER_OV) | (1ul << XER_CA) | (1ul << XER_OV32) | (1ul << XER_CA32)); } + +void ppc_store_vscr(CPUPPCState *env, uint32_t vscr) +{ + env->vscr =3D vscr & ~(1u << VSCR_SAT); + /* Which bit we set is completely arbitrary, but clear the rest. */ + env->vscr_sat.u64[0] =3D vscr & (1u << VSCR_SAT); + env->vscr_sat.u64[1] =3D 0; + set_flush_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status); +} + +uint32_t ppc_get_vscr(CPUPPCState *env) +{ + uint32_t sat =3D (env->vscr_sat.u64[0] | env->vscr_sat.u64[1]) !=3D 0; + return env->vscr | (sat << VSCR_SAT); +} diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 98fcf1c4d6..f43ceec5cb 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -2651,4 +2651,6 @@ static inline bool ppc_has_spr(PowerPCCPU *cpu, int s= pr) void dump_mmu(CPUPPCState *env); =20 void ppc_maybe_bswap_register(CPUPPCState *env, uint8_t *mem_buf, int len); +void ppc_store_vscr(CPUPPCState *env, uint32_t vscr); +uint32_t ppc_get_vscr(CPUPPCState *env); #endif /* PPC_CPU_H */ diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index e7903e5f2a..022fa69d2c 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -55,7 +55,7 @@ static inline void vscr_init(CPUPPCState *env, uint32_t v= al) { /* Altivec always uses round-to-nearest */ set_float_rounding_mode(float_round_nearest_even, &env->vec_status); - helper_mtvscr(env, val); + ppc_store_vscr(env, val); } =20 /** diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 94a7273ee0..9339e7eafe 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -498,7 +498,7 @@ static int gdb_get_avr_reg(CPUPPCState *env, GByteArray= *buf, int n) return 16; } if (n =3D=3D 32) { - gdb_get_reg32(buf, helper_mfvscr(env)); + gdb_get_reg32(buf, ppc_get_vscr(env)); mem_buf =3D gdb_get_reg_ptr(buf, 4); ppc_maybe_bswap_register(env, mem_buf, 4); return 4; @@ -529,7 +529,7 @@ static int gdb_set_avr_reg(CPUPPCState *env, uint8_t *m= em_buf, int n) } if (n =3D=3D 32) { ppc_maybe_bswap_register(env, mem_buf, 4); - helper_mtvscr(env, ldl_p(mem_buf)); + ppc_store_vscr(env, ldl_p(mem_buf)); return 4; } if (n =3D=3D 33) { diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index a44c2d90ea..41f8477d4b 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -462,17 +462,12 @@ SATCVT(sd, uw, int64_t, uint32_t, 0, UINT32_MAX) =20 void helper_mtvscr(CPUPPCState *env, uint32_t vscr) { - env->vscr =3D vscr & ~(1u << VSCR_SAT); - /* Which bit we set is completely arbitrary, but clear the rest. */ - env->vscr_sat.u64[0] =3D vscr & (1u << VSCR_SAT); - env->vscr_sat.u64[1] =3D 0; - set_flush_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status); + ppc_store_vscr(env, vscr); } =20 uint32_t helper_mfvscr(CPUPPCState *env) { - uint32_t sat =3D (env->vscr_sat.u64[0] | env->vscr_sat.u64[1]) !=3D 0; - return env->vscr | (sat << VSCR_SAT); + return ppc_get_vscr(env); } =20 static inline void set_vscr_sat(CPUPPCState *env) --=20 2.31.1