From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486012765853106.0138313918327; Wed, 1 Feb 2017 21:19:25 -0800 (PST) Received: from localhost ([::1]:54220 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9no-0002tZ-5H for importer@patchew.org; Thu, 02 Feb 2017 00:19:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9ja-00073h-TR for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jX-0003P5-OO for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:02 -0500 Received: from ozlabs.org ([103.22.144.67]:33191) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jW-0003MZ-T2; Thu, 02 Feb 2017 00:14:59 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqJ6z5Yz9s7K; Thu, 2 Feb 2017 16:14:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012492; bh=Ri+/mW866JJ1weQIsJL7SvxFSZYjlRPsNCKpmjCvz9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TqygIhF5HNQvFk867xXSO1kJ/zGFM7BSH5UKGYtR8WF2j3LibnkKU5VmxaBOLKNov Xyx7x0IvLUGb5p2lAv1z2sftnoFQBDOi8HVmsOXNS9KylYxgjwi8Xl0lWp8PTN/27J IYaQW+ELsczYclLmWprY4k/9mL2d6vxakFh14zTQ= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:12:59 +1100 Message-Id: <20170202051445.5735-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 001/107] disas/ppc: Fix indefinite articles in comments X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Stefan Weil , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stefan Weil Signed-off-by: Stefan Weil Signed-off-by: David Gibson --- disas/ppc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/disas/ppc.c b/disas/ppc.c index ed7e0d0..5ab9c35 100644 --- a/disas/ppc.c +++ b/disas/ppc.c @@ -1653,11 +1653,11 @@ extract_tbr (unsigned long insn, #define BBOYBI_MASK (BBOYCB_MASK | BI_MASK) #define BBOATBI_MASK (BBOAT2CB_MASK | BI_MASK) =20 -/* An Context form instruction. */ +/* A Context form instruction. */ #define CTX(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x7)) #define CTX_MASK CTX(0x3f, 0x7) =20 -/* An User Context form instruction. */ +/* A User Context form instruction. */ #define UCTX(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x1f)) #define UCTX_MASK UCTX(0x3f, 0x1f) =20 @@ -1710,19 +1710,19 @@ extract_tbr (unsigned long insn, #define SC(op, sa, lk) (OP (op) | ((((unsigned long)(sa)) & 1) << 1) | ((l= k) & 1)) #define SC_MASK (OP_MASK | (((unsigned long)0x3ff) << 16) | (((unsigned lo= ng)1) << 1) | 1) =20 -/* An VX form instruction. */ +/* A VX form instruction. */ #define VX(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x7ff)) =20 /* The mask for an VX form instruction. */ #define VX_MASK VX(0x3f, 0x7ff) =20 -/* An VA form instruction. */ +/* A VA form instruction. */ #define VXA(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x03f)) =20 -/* The mask for an VA form instruction. */ +/* The mask for a VA form instruction. */ #define VXA_MASK VXA(0x3f, 0x3f) =20 -/* An VXR form instruction. */ +/* A VXR form instruction. */ #define VXR(op, xop, rc) (OP (op) | (((rc) & 1) << 10) | (((unsigned long)= (xop)) & 0x3ff)) =20 /* The mask for a VXR form instruction. */ --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486013061845949.979090840627; Wed, 1 Feb 2017 21:24:21 -0800 (PST) Received: from localhost ([::1]:54246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9sa-0007N4-2u for importer@patchew.org; Thu, 02 Feb 2017 00:24:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9ja-00073j-V2 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jX-0003Oy-OF for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:02 -0500 Received: from ozlabs.org ([103.22.144.67]:48027) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jW-0003Ma-UG; Thu, 02 Feb 2017 00:14:59 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqH4fbYz9s7G; Thu, 2 Feb 2017 16:14:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012491; bh=pMvX/Jb3Ju74VSD5F6Vz70s84lxpfJAwxPiuKKKcpGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fFodJgwBNgkoHGrvlB8YHXZ2LnZw/NkATdczHJhp0zzbzgIIy5XeeVEq99EEtA4Ir h3Nj6KbHX6dkyH7fpq9KIa9uANi7JXrm9sZB7PsL0kRVji8ClhBTKSu8e6edAdLrV6 BUgiv+LAOD2mWzr9GO2u+AC4+0MasvioOL0JxbYk= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:00 +1100 Message-Id: <20170202051445.5735-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 002/107] target-ppc: Consolidate instruction decode helpers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao Move instruction decode helpers to target-ppc/internal.h so that some of these can be used from outside of translate.c. This movement also helps to get rid of some duplicate helpers from target-ppc/fpu_helper.c. Suggested-by: Nikunj A Dadhania Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Reviewed-by: David Gibson Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 11 +--- target/ppc/internal.h | 151 ++++++++++++++++++++++++++++++++++++++++++++= ++++ target/ppc/translate.c | 151 --------------------------------------------= ---- 3 files changed, 152 insertions(+), 161 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 8a389e1..d3741b4 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -20,6 +20,7 @@ #include "cpu.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" +#include "internal.h" =20 #define float64_snan_to_qnan(x) ((x) | 0x0008000000000000ULL) #define float32_snan_to_qnan(x) ((x) | 0x00400000) @@ -1776,16 +1777,6 @@ uint32_t helper_efdcmpeq(CPUPPCState *env, uint64_t = op1, uint64_t op2) return helper_efdtsteq(env, op1, op2); } =20 -#define DECODE_SPLIT(opcode, shift1, nb1, shift2, nb2) \ - (((((opcode) >> (shift1)) & ((1 << (nb1)) - 1)) << nb2) | \ - (((opcode) >> (shift2)) & ((1 << (nb2)) - 1))) - -#define xT(opcode) DECODE_SPLIT(opcode, 0, 1, 21, 5) -#define xA(opcode) DECODE_SPLIT(opcode, 2, 1, 16, 5) -#define xB(opcode) DECODE_SPLIT(opcode, 1, 1, 11, 5) -#define xC(opcode) DECODE_SPLIT(opcode, 3, 1, 6, 5) -#define BF(opcode) (((opcode) >> (31-8)) & 7) - typedef union _ppc_vsr_t { uint64_t u64[2]; uint32_t u32[4]; diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 1ff4896..9a4a74a 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -47,4 +47,155 @@ FUNC_MASK(MASK, target_ulong, 32, UINT32_MAX); FUNC_MASK(mask_u32, uint32_t, 32, UINT32_MAX); FUNC_MASK(mask_u64, uint64_t, 64, UINT64_MAX); =20 +/*************************************************************************= ****/ +/*** Instruction decoding = ***/ +#define EXTRACT_HELPER(name, shift, nb) = \ +static inline uint32_t name(uint32_t opcode) = \ +{ = \ + return (opcode >> (shift)) & ((1 << (nb)) - 1); = \ +} + +#define EXTRACT_SHELPER(name, shift, nb) = \ +static inline int32_t name(uint32_t opcode) = \ +{ = \ + return (int16_t)((opcode >> (shift)) & ((1 << (nb)) - 1)); = \ +} + +#define EXTRACT_HELPER_SPLIT(name, shift1, nb1, shift2, nb2) = \ +static inline uint32_t name(uint32_t opcode) = \ +{ = \ + return (((opcode >> (shift1)) & ((1 << (nb1)) - 1)) << nb2) | = \ + ((opcode >> (shift2)) & ((1 << (nb2)) - 1)); = \ +} + +#define EXTRACT_HELPER_DXFORM(name, = \ + d0_bits, shift_op_d0, shift_d0, = \ + d1_bits, shift_op_d1, shift_d1, = \ + d2_bits, shift_op_d2, shift_d2) = \ +static inline int16_t name(uint32_t opcode) = \ +{ = \ + return = \ + (((opcode >> (shift_op_d0)) & ((1 << (d0_bits)) - 1)) << (shift_d0= )) | \ + (((opcode >> (shift_op_d1)) & ((1 << (d1_bits)) - 1)) << (shift_d1= )) | \ + (((opcode >> (shift_op_d2)) & ((1 << (d2_bits)) - 1)) << (shift_d2= )); \ +} + + +/* Opcode part 1 */ +EXTRACT_HELPER(opc1, 26, 6); +/* Opcode part 2 */ +EXTRACT_HELPER(opc2, 1, 5); +/* Opcode part 3 */ +EXTRACT_HELPER(opc3, 6, 5); +/* Opcode part 4 */ +EXTRACT_HELPER(opc4, 16, 5); +/* Update Cr0 flags */ +EXTRACT_HELPER(Rc, 0, 1); +/* Update Cr6 flags (Altivec) */ +EXTRACT_HELPER(Rc21, 10, 1); +/* Destination */ +EXTRACT_HELPER(rD, 21, 5); +/* Source */ +EXTRACT_HELPER(rS, 21, 5); +/* First operand */ +EXTRACT_HELPER(rA, 16, 5); +/* Second operand */ +EXTRACT_HELPER(rB, 11, 5); +/* Third operand */ +EXTRACT_HELPER(rC, 6, 5); +/*** Get CRn = ***/ +EXTRACT_HELPER(crfD, 23, 3); +EXTRACT_HELPER(BF, 23, 3); +EXTRACT_HELPER(crfS, 18, 3); +EXTRACT_HELPER(crbD, 21, 5); +EXTRACT_HELPER(crbA, 16, 5); +EXTRACT_HELPER(crbB, 11, 5); +/* SPR / TBL */ +EXTRACT_HELPER(_SPR, 11, 10); +static inline uint32_t SPR(uint32_t opcode) +{ + uint32_t sprn =3D _SPR(opcode); + + return ((sprn >> 5) & 0x1F) | ((sprn & 0x1F) << 5); +} +/*** Get constants = ***/ +/* 16 bits signed immediate value */ +EXTRACT_SHELPER(SIMM, 0, 16); +/* 16 bits unsigned immediate value */ +EXTRACT_HELPER(UIMM, 0, 16); +/* 5 bits signed immediate value */ +EXTRACT_HELPER(SIMM5, 16, 5); +/* 5 bits signed immediate value */ +EXTRACT_HELPER(UIMM5, 16, 5); +/* 4 bits unsigned immediate value */ +EXTRACT_HELPER(UIMM4, 16, 4); +/* Bit count */ +EXTRACT_HELPER(NB, 11, 5); +/* Shift count */ +EXTRACT_HELPER(SH, 11, 5); +/* Vector shift count */ +EXTRACT_HELPER(VSH, 6, 4); +/* Mask start */ +EXTRACT_HELPER(MB, 6, 5); +/* Mask end */ +EXTRACT_HELPER(ME, 1, 5); +/* Trap operand */ +EXTRACT_HELPER(TO, 21, 5); + +EXTRACT_HELPER(CRM, 12, 8); + +#ifndef CONFIG_USER_ONLY +EXTRACT_HELPER(SR, 16, 4); +#endif + +/* mtfsf/mtfsfi */ +EXTRACT_HELPER(FPBF, 23, 3); +EXTRACT_HELPER(FPIMM, 12, 4); +EXTRACT_HELPER(FPL, 25, 1); +EXTRACT_HELPER(FPFLM, 17, 8); +EXTRACT_HELPER(FPW, 16, 1); + +/* addpcis */ +EXTRACT_HELPER_DXFORM(DX, 10, 6, 6, 5, 16, 1, 1, 0, 0) +#if defined(TARGET_PPC64) +/* darn */ +EXTRACT_HELPER(L, 16, 2); +#endif + +/*** Jump target decoding = ***/ +/* Immediate address */ +static inline target_ulong LI(uint32_t opcode) +{ + return (opcode >> 0) & 0x03FFFFFC; +} + +static inline uint32_t BD(uint32_t opcode) +{ + return (opcode >> 0) & 0xFFFC; +} + +EXTRACT_HELPER(BO, 21, 5); +EXTRACT_HELPER(BI, 16, 5); +/* Absolute/relative address */ +EXTRACT_HELPER(AA, 1, 1); +/* Link */ +EXTRACT_HELPER(LK, 0, 1); + +/* DFP Z22-form */ +EXTRACT_HELPER(DCM, 10, 6) + +/* DFP Z23-form */ +EXTRACT_HELPER(RMC, 9, 2) + +EXTRACT_HELPER_SPLIT(xT, 0, 1, 21, 5); +EXTRACT_HELPER_SPLIT(xS, 0, 1, 21, 5); +EXTRACT_HELPER_SPLIT(xA, 2, 1, 16, 5); +EXTRACT_HELPER_SPLIT(xB, 1, 1, 11, 5); +EXTRACT_HELPER_SPLIT(xC, 3, 1, 6, 5); +EXTRACT_HELPER(DM, 8, 2); +EXTRACT_HELPER(UIM, 16, 2); +EXTRACT_HELPER(SHW, 8, 2); +EXTRACT_HELPER(SP, 19, 2); +EXTRACT_HELPER(IMM8, 11, 8); + #endif /* PPC_INTERNAL_H */ diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 1212180..8c99ea3 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -422,157 +422,6 @@ typedef struct opcode_t { =20 #define CHK_NONE =20 - -/*************************************************************************= ****/ -/*** Instruction decoding = ***/ -#define EXTRACT_HELPER(name, shift, nb) = \ -static inline uint32_t name(uint32_t opcode) = \ -{ = \ - return (opcode >> (shift)) & ((1 << (nb)) - 1); = \ -} - -#define EXTRACT_SHELPER(name, shift, nb) = \ -static inline int32_t name(uint32_t opcode) = \ -{ = \ - return (int16_t)((opcode >> (shift)) & ((1 << (nb)) - 1)); = \ -} - -#define EXTRACT_HELPER_SPLIT(name, shift1, nb1, shift2, nb2) = \ -static inline uint32_t name(uint32_t opcode) = \ -{ = \ - return (((opcode >> (shift1)) & ((1 << (nb1)) - 1)) << nb2) | = \ - ((opcode >> (shift2)) & ((1 << (nb2)) - 1)); = \ -} - -#define EXTRACT_HELPER_DXFORM(name, = \ - d0_bits, shift_op_d0, shift_d0, = \ - d1_bits, shift_op_d1, shift_d1, = \ - d2_bits, shift_op_d2, shift_d2) = \ -static inline int16_t name(uint32_t opcode) = \ -{ = \ - return = \ - (((opcode >> (shift_op_d0)) & ((1 << (d0_bits)) - 1)) << (shift_d0= )) | \ - (((opcode >> (shift_op_d1)) & ((1 << (d1_bits)) - 1)) << (shift_d1= )) | \ - (((opcode >> (shift_op_d2)) & ((1 << (d2_bits)) - 1)) << (shift_d2= )); \ -} - - -/* Opcode part 1 */ -EXTRACT_HELPER(opc1, 26, 6); -/* Opcode part 2 */ -EXTRACT_HELPER(opc2, 1, 5); -/* Opcode part 3 */ -EXTRACT_HELPER(opc3, 6, 5); -/* Opcode part 4 */ -EXTRACT_HELPER(opc4, 16, 5); -/* Update Cr0 flags */ -EXTRACT_HELPER(Rc, 0, 1); -/* Update Cr6 flags (Altivec) */ -EXTRACT_HELPER(Rc21, 10, 1); -/* Destination */ -EXTRACT_HELPER(rD, 21, 5); -/* Source */ -EXTRACT_HELPER(rS, 21, 5); -/* First operand */ -EXTRACT_HELPER(rA, 16, 5); -/* Second operand */ -EXTRACT_HELPER(rB, 11, 5); -/* Third operand */ -EXTRACT_HELPER(rC, 6, 5); -/*** Get CRn = ***/ -EXTRACT_HELPER(crfD, 23, 3); -EXTRACT_HELPER(crfS, 18, 3); -EXTRACT_HELPER(crbD, 21, 5); -EXTRACT_HELPER(crbA, 16, 5); -EXTRACT_HELPER(crbB, 11, 5); -/* SPR / TBL */ -EXTRACT_HELPER(_SPR, 11, 10); -static inline uint32_t SPR(uint32_t opcode) -{ - uint32_t sprn =3D _SPR(opcode); - - return ((sprn >> 5) & 0x1F) | ((sprn & 0x1F) << 5); -} -/*** Get constants = ***/ -/* 16 bits signed immediate value */ -EXTRACT_SHELPER(SIMM, 0, 16); -/* 16 bits unsigned immediate value */ -EXTRACT_HELPER(UIMM, 0, 16); -/* 5 bits signed immediate value */ -EXTRACT_HELPER(SIMM5, 16, 5); -/* 5 bits signed immediate value */ -EXTRACT_HELPER(UIMM5, 16, 5); -/* 4 bits unsigned immediate value */ -EXTRACT_HELPER(UIMM4, 16, 4); -/* Bit count */ -EXTRACT_HELPER(NB, 11, 5); -/* Shift count */ -EXTRACT_HELPER(SH, 11, 5); -/* Vector shift count */ -EXTRACT_HELPER(VSH, 6, 4); -/* Mask start */ -EXTRACT_HELPER(MB, 6, 5); -/* Mask end */ -EXTRACT_HELPER(ME, 1, 5); -/* Trap operand */ -EXTRACT_HELPER(TO, 21, 5); - -EXTRACT_HELPER(CRM, 12, 8); - -#ifndef CONFIG_USER_ONLY -EXTRACT_HELPER(SR, 16, 4); -#endif - -/* mtfsf/mtfsfi */ -EXTRACT_HELPER(FPBF, 23, 3); -EXTRACT_HELPER(FPIMM, 12, 4); -EXTRACT_HELPER(FPL, 25, 1); -EXTRACT_HELPER(FPFLM, 17, 8); -EXTRACT_HELPER(FPW, 16, 1); - -/* addpcis */ -EXTRACT_HELPER_DXFORM(DX, 10, 6, 6, 5, 16, 1, 1, 0, 0) -#if defined(TARGET_PPC64) -/* darn */ -EXTRACT_HELPER(L, 16, 2); -#endif - -/*** Jump target decoding = ***/ -/* Immediate address */ -static inline target_ulong LI(uint32_t opcode) -{ - return (opcode >> 0) & 0x03FFFFFC; -} - -static inline uint32_t BD(uint32_t opcode) -{ - return (opcode >> 0) & 0xFFFC; -} - -EXTRACT_HELPER(BO, 21, 5); -EXTRACT_HELPER(BI, 16, 5); -/* Absolute/relative address */ -EXTRACT_HELPER(AA, 1, 1); -/* Link */ -EXTRACT_HELPER(LK, 0, 1); - -/* DFP Z22-form */ -EXTRACT_HELPER(DCM, 10, 6) - -/* DFP Z23-form */ -EXTRACT_HELPER(RMC, 9, 2) - -EXTRACT_HELPER_SPLIT(xT, 0, 1, 21, 5); -EXTRACT_HELPER_SPLIT(xS, 0, 1, 21, 5); -EXTRACT_HELPER_SPLIT(xA, 2, 1, 16, 5); -EXTRACT_HELPER_SPLIT(xB, 1, 1, 11, 5); -EXTRACT_HELPER_SPLIT(xC, 3, 1, 6, 5); -EXTRACT_HELPER(DM, 8, 2); -EXTRACT_HELPER(UIM, 16, 2); -EXTRACT_HELPER(SHW, 8, 2); -EXTRACT_HELPER(SP, 19, 2); -EXTRACT_HELPER(IMM8, 11, 8); - /*************************************************************************= ****/ /* PowerPC instructions table = */ =20 --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14860132286810.8488102160346216; Wed, 1 Feb 2017 21:27:08 -0800 (PST) Received: from localhost ([::1]:54261 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9vG-0001DE-Qu for importer@patchew.org; Thu, 02 Feb 2017 00:27:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9ja-00073i-Tl for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jX-0003Ox-OD for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:02 -0500 Received: from ozlabs.org ([103.22.144.67]:59755) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jW-0003Md-UC; Thu, 02 Feb 2017 00:14:59 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqK4Tbpz9s7M; Thu, 2 Feb 2017 16:14:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012493; bh=9qp/CSYARDCjuKBhRz70c5dqeNIxcuLWZ/4Z2iMpM6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p9ogwmOJHBfXv+1qJ2agAqHfABh+ofwNjUcZBN1IOBUJeNcSfCAYsP6f9/+ChJFQH rv/1FDsbruRwgzigG+/iXmM3oS8Nt1b3atyPJsHU7tH/KqhppwP95j2Qj4FosVyJtm AC6UfAYS7h8xshVQNjffXxEguIDf/4XzBdAWC8Gg= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:01 +1100 Message-Id: <20170202051445.5735-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 003/107] target-ppc: rename CRF_* defines as CRF_*_BIT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania Add _BIT to CRF_[GT,LT,EQ_SO] and introduce CRF_[GT,LT,EQ,SO] for usage without shifts in the code. This would simplify the code. Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/cpu.h | 21 +++++++++++++-------- target/ppc/int_helper.c | 30 +++++++++++++++--------------- target/ppc/translate.c | 14 +++++++------- 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 2a50c43..b6782ba 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1301,14 +1301,19 @@ static inline int cpu_mmu_index (CPUPPCState *env, = bool ifetch) =20 /*************************************************************************= ****/ /* CRF definitions */ -#define CRF_LT 3 -#define CRF_GT 2 -#define CRF_EQ 1 -#define CRF_SO 0 -#define CRF_CH (1 << CRF_LT) -#define CRF_CL (1 << CRF_GT) -#define CRF_CH_OR_CL (1 << CRF_EQ) -#define CRF_CH_AND_CL (1 << CRF_SO) +#define CRF_LT_BIT 3 +#define CRF_GT_BIT 2 +#define CRF_EQ_BIT 1 +#define CRF_SO_BIT 0 +#define CRF_LT (1 << CRF_LT_BIT) +#define CRF_GT (1 << CRF_GT_BIT) +#define CRF_EQ (1 << CRF_EQ_BIT) +#define CRF_SO (1 << CRF_SO_BIT) +/* For SPE extensions */ +#define CRF_CH (1 << CRF_LT_BIT) +#define CRF_CL (1 << CRF_GT_BIT) +#define CRF_CH_OR_CL (1 << CRF_EQ_BIT) +#define CRF_CH_AND_CL (1 << CRF_SO_BIT) =20 /* XER definitions */ #define XER_SO 31 diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 1871792..fbc84e2 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -157,7 +157,7 @@ uint64_t helper_divde(CPUPPCState *env, uint64_t rau, u= int64_t rbu, uint32_t oe) =20 uint32_t helper_cmpeqb(target_ulong ra, target_ulong rb) { - return hasvalue(rb, ra) ? 1 << CRF_GT : 0; + return hasvalue(rb, ra) ? CRF_GT : 0; } =20 #undef pattern @@ -2531,9 +2531,9 @@ static void bcd_put_digit(ppc_avr_t *bcd, uint8_t dig= it, int n) static int bcd_cmp_zero(ppc_avr_t *bcd) { if (bcd->u64[HI_IDX] =3D=3D 0 && (bcd->u64[LO_IDX] >> 4) =3D=3D 0) { - return 1 << CRF_EQ; + return CRF_EQ; } else { - return (bcd_get_sgn(bcd) =3D=3D 1) ? 1 << CRF_GT : 1 << CRF_LT; + return (bcd_get_sgn(bcd) =3D=3D 1) ? CRF_GT : CRF_LT; } } =20 @@ -2645,25 +2645,25 @@ uint32_t helper_bcdadd(ppc_avr_t *r, ppc_avr_t *a,= ppc_avr_t *b, uint32_t ps) if (sgna =3D=3D sgnb) { result.u8[BCD_DIG_BYTE(0)] =3D bcd_preferred_sgn(sgna, ps); zero =3D bcd_add_mag(&result, a, b, &invalid, &overflow); - cr =3D (sgna > 0) ? 1 << CRF_GT : 1 << CRF_LT; + cr =3D (sgna > 0) ? CRF_GT : CRF_LT; } else if (bcd_cmp_mag(a, b) > 0) { result.u8[BCD_DIG_BYTE(0)] =3D bcd_preferred_sgn(sgna, ps); zero =3D bcd_sub_mag(&result, a, b, &invalid, &overflow); - cr =3D (sgna > 0) ? 1 << CRF_GT : 1 << CRF_LT; + cr =3D (sgna > 0) ? CRF_GT : CRF_LT; } else { result.u8[BCD_DIG_BYTE(0)] =3D bcd_preferred_sgn(sgnb, ps); zero =3D bcd_sub_mag(&result, b, a, &invalid, &overflow); - cr =3D (sgnb > 0) ? 1 << CRF_GT : 1 << CRF_LT; + cr =3D (sgnb > 0) ? CRF_GT : CRF_LT; } } =20 if (unlikely(invalid)) { result.u64[HI_IDX] =3D result.u64[LO_IDX] =3D -1; - cr =3D 1 << CRF_SO; + cr =3D CRF_SO; } else if (overflow) { - cr |=3D 1 << CRF_SO; + cr |=3D CRF_SO; } else if (zero) { - cr =3D 1 << CRF_EQ; + cr =3D CRF_EQ; } =20 *r =3D result; @@ -2713,7 +2713,7 @@ uint32_t helper_bcdcfn(ppc_avr_t *r, ppc_avr_t *b, ui= nt32_t ps) cr =3D bcd_cmp_zero(&ret); =20 if (unlikely(invalid)) { - cr =3D 1 << CRF_SO; + cr =3D CRF_SO; } =20 *r =3D ret; @@ -2743,11 +2743,11 @@ uint32_t helper_bcdctn(ppc_avr_t *r, ppc_avr_t *b, = uint32_t ps) cr =3D bcd_cmp_zero(b); =20 if (ox_flag) { - cr |=3D 1 << CRF_SO; + cr |=3D CRF_SO; } =20 if (unlikely(invalid)) { - cr =3D 1 << CRF_SO; + cr =3D CRF_SO; } =20 *r =3D ret; @@ -2791,7 +2791,7 @@ uint32_t helper_bcdcfz(ppc_avr_t *r, ppc_avr_t *b, ui= nt32_t ps) cr =3D bcd_cmp_zero(&ret); =20 if (unlikely(invalid)) { - cr =3D 1 << CRF_SO; + cr =3D CRF_SO; } =20 *r =3D ret; @@ -2830,11 +2830,11 @@ uint32_t helper_bcdctz(ppc_avr_t *r, ppc_avr_t *b, = uint32_t ps) cr =3D bcd_cmp_zero(b); =20 if (ox_flag) { - cr |=3D 1 << CRF_SO; + cr |=3D CRF_SO; } =20 if (unlikely(invalid)) { - cr =3D 1 << CRF_SO; + cr =3D CRF_SO; } =20 *r =3D ret; diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 8c99ea3..e55a5dc 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -612,17 +612,17 @@ static inline void gen_op_cmp(TCGv arg0, TCGv arg1, i= nt s, int crf) =20 tcg_gen_setcond_tl((s ? TCG_COND_LT: TCG_COND_LTU), t0, arg0, arg1); tcg_gen_trunc_tl_i32(t1, t0); - tcg_gen_shli_i32(t1, t1, CRF_LT); + tcg_gen_shli_i32(t1, t1, CRF_LT_BIT); tcg_gen_or_i32(cpu_crf[crf], cpu_crf[crf], t1); =20 tcg_gen_setcond_tl((s ? TCG_COND_GT: TCG_COND_GTU), t0, arg0, arg1); tcg_gen_trunc_tl_i32(t1, t0); - tcg_gen_shli_i32(t1, t1, CRF_GT); + tcg_gen_shli_i32(t1, t1, CRF_GT_BIT); tcg_gen_or_i32(cpu_crf[crf], cpu_crf[crf], t1); =20 tcg_gen_setcond_tl(TCG_COND_EQ, t0, arg0, arg1); tcg_gen_trunc_tl_i32(t1, t0); - tcg_gen_shli_i32(t1, t1, CRF_EQ); + tcg_gen_shli_i32(t1, t1, CRF_EQ_BIT); tcg_gen_or_i32(cpu_crf[crf], cpu_crf[crf], t1); =20 tcg_temp_free(t0); @@ -748,7 +748,7 @@ static void gen_cmprb(DisasContext *ctx) tcg_gen_and_i32(src2lo, src2lo, src2hi); tcg_gen_or_i32(crf, crf, src2lo); } - tcg_gen_shli_i32(crf, crf, CRF_GT); + tcg_gen_shli_i32(crf, crf, CRF_GT_BIT); tcg_temp_free_i32(src1); tcg_temp_free_i32(src2); tcg_temp_free_i32(src2lo); @@ -2997,7 +2997,7 @@ static void gen_conditional_store(DisasContext *ctx, = TCGv EA, tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); l1 =3D gen_new_label(); tcg_gen_brcond_tl(TCG_COND_NE, EA, cpu_reserve, l1); - tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], 1 << CRF_EQ); + tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], CRF_EQ); tcg_gen_qemu_st_tl(cpu_gpr[reg], EA, ctx->mem_idx, memop); gen_set_label(l1); tcg_gen_movi_tl(cpu_reserve, -1); @@ -3091,7 +3091,7 @@ static void gen_stqcx_(DisasContext *ctx) tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); l1 =3D gen_new_label(); tcg_gen_brcond_tl(TCG_COND_NE, EA, cpu_reserve, l1); - tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], 1 << CRF_EQ); + tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], CRF_EQ); =20 if (unlikely(ctx->le_mode)) { gpr1 =3D cpu_gpr[reg + 1]; @@ -4272,7 +4272,7 @@ static void gen_slbfee_(DisasContext *ctx) l2 =3D gen_new_label(); tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[rS(ctx->opcode)], -1, l1); - tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], 1 << CRF_EQ); + tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], CRF_EQ); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_movi_tl(cpu_gpr[rS(ctx->opcode)], 0); --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486012952923378.72953194073943; Wed, 1 Feb 2017 21:22:32 -0800 (PST) Received: from localhost ([::1]:54239 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9qo-0005Sz-3R for importer@patchew.org; Thu, 02 Feb 2017 00:22:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9ja-00073d-S6 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jX-0003Op-Nv for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:02 -0500 Received: from ozlabs.org ([103.22.144.67]:51625) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jW-0003Mc-UG; Thu, 02 Feb 2017 00:14:59 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqK37x4z9s7J; Thu, 2 Feb 2017 16:14:52 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012493; bh=RerCAJam+ediiMJ6E18WEmQPE8O1y7adb7tZKNfcFOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/FAhl/54Z1tiDcj+chZefU7X+ENpAqnRTcR+xsHoB0Xe7aAgjK00gLlQrECDoTLU 0DQuXLhZPIWVugeEupDjk5BG6iNweQtyIYwd+zsS2+ecaIVKPVKkrH3Fwsu86zmNXZ tZNbxcZGVr+gl+E5LVjmff0qSaW3AazNXEWJu/SE= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:02 +1100 Message-Id: <20170202051445.5735-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 004/107] target-ppc: Fix xscmpodp and xscmpudp instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao - xscmpodp & xscmpudp are missing flags reset. - In xscmpodp, VXCC should be set only if VE is 0 for signalling NaN case and VXCC should be set by explicitly checking for quiet NaN case. - Comparison is being done only if the operands are not NaNs. However as per ISA, it should be done even when operands are NaNs. Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index d3741b4..fdd3216 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2410,29 +2410,39 @@ void helper_##op(CPUPPCState *env, uint32_t opcode)= \ { \ ppc_vsr_t xa, xb; \ uint32_t cc =3D 0; = \ + bool vxsnan_flag =3D false, vxvc_flag =3D false; = \ \ + helper_reset_fpstatus(env); \ getVSR(xA(opcode), &xa, env); \ getVSR(xB(opcode), &xb, env); \ \ - if (unlikely(float64_is_any_nan(xa.VsrD(0)) || \ - float64_is_any_nan(xb.VsrD(0)))) { \ - if (float64_is_signaling_nan(xa.VsrD(0), &env->fp_status) || \ - float64_is_signaling_nan(xb.VsrD(0), &env->fp_status)) { \ - float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); \ + if (float64_is_signaling_nan(xa.VsrD(0), &env->fp_status) || \ + float64_is_signaling_nan(xb.VsrD(0), &env->fp_status)) { \ + vxsnan_flag =3D true; = \ + cc =3D CRF_SO; = \ + if (fpscr_ve =3D=3D 0 && ordered) { = \ + vxvc_flag =3D true; = \ } \ + } else if (float64_is_quiet_nan(xa.VsrD(0), &env->fp_status) || \ + float64_is_quiet_nan(xb.VsrD(0), &env->fp_status)) { \ + cc =3D CRF_SO; = \ if (ordered) { \ - float_invalid_op_excp(env, POWERPC_EXCP_FP_VXVC, 0); \ + vxvc_flag =3D true; = \ } \ - cc =3D 1; = \ + } \ + if (vxsnan_flag) { \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); \ + } \ + if (vxvc_flag) { \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXVC, 0); \ + } \ + \ + if (float64_lt(xa.VsrD(0), xb.VsrD(0), &env->fp_status)) { \ + cc |=3D CRF_LT; = \ + } else if (!float64_le(xa.VsrD(0), xb.VsrD(0), &env->fp_status)) { \ + cc |=3D CRF_GT; = \ } else { \ - if (float64_lt(xa.VsrD(0), xb.VsrD(0), &env->fp_status)) { \ - cc =3D 8; = \ - } else if (!float64_le(xa.VsrD(0), xb.VsrD(0), \ - &env->fp_status)) { \ - cc =3D 4; = \ - } else { \ - cc =3D 2; = \ - } \ + cc |=3D CRF_EQ; = \ } \ \ env->fpscr &=3D ~(0x0F << FPSCR_FPRF); = \ --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486013610172596.2504899399006; Wed, 1 Feb 2017 21:33:30 -0800 (PST) Received: from localhost ([::1]:54293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZA1P-0007wI-MU for importer@patchew.org; Thu, 02 Feb 2017 00:33:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9je-000768-2E for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jb-0003UW-PJ for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:05 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:32935) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jb-0003Q5-An; Thu, 02 Feb 2017 00:15:03 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqL19hDz9s7Q; Thu, 2 Feb 2017 16:14:53 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012494; bh=MkBDgfY2oBrgqkuJoGeq+hFfbEPoU6k/706bKLJNndc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a9bAvh2wpdRm9PLCdEk0adN/2rTaA7A/53clgwZEWMFAcgHRHifA/rJzCvz89SEbT CaQoUTnBubCLIl2IVaYMta0RfeoSmW8DijQAoTLHMYV+AH9A+q7ggjmKdMMUbYNaTO ZdjRDcykuUaBbfsVwg6DLC5JymKu8WaBeujC3c08= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:03 +1100 Message-Id: <20170202051445.5735-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 005/107] target-ppc: Add xscmpexp[dp, qp] instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xscmpexpdp: VSX Scalar Compare Exponents Double-Precision xscmpexpqp: VSX Scalar Compare Exponents Quad-Precision Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 64 +++++++++++++++++++++++++++++++++= ++++ target/ppc/helper.h | 2 ++ target/ppc/translate/vsx-impl.inc.c | 2 ++ target/ppc/translate/vsx-ops.inc.c | 6 ++++ 4 files changed, 74 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index fdd3216..8bffafb 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2405,6 +2405,70 @@ VSX_SCALAR_CMP_DP(xscmpgedp, le, 1, 1) VSX_SCALAR_CMP_DP(xscmpgtdp, lt, 1, 1) VSX_SCALAR_CMP_DP(xscmpnedp, eq, 0, 0) =20 +void helper_xscmpexpdp(CPUPPCState *env, uint32_t opcode) +{ + ppc_vsr_t xa, xb; + int64_t exp_a, exp_b; + uint32_t cc; + + getVSR(xA(opcode), &xa, env); + getVSR(xB(opcode), &xb, env); + + exp_a =3D extract64(xa.VsrD(0), 52, 11); + exp_b =3D extract64(xb.VsrD(0), 52, 11); + + if (unlikely(float64_is_any_nan(xa.VsrD(0)) || + float64_is_any_nan(xb.VsrD(0)))) { + cc =3D CRF_SO; + } else { + if (exp_a < exp_b) { + cc =3D CRF_LT; + } else if (exp_a > exp_b) { + cc =3D CRF_GT; + } else { + cc =3D CRF_EQ; + } + } + + env->fpscr &=3D ~(0x0F << FPSCR_FPRF); + env->fpscr |=3D cc << FPSCR_FPRF; + env->crf[BF(opcode)] =3D cc; + + helper_float_check_status(env); +} + +void helper_xscmpexpqp(CPUPPCState *env, uint32_t opcode) +{ + ppc_vsr_t xa, xb; + int64_t exp_a, exp_b; + uint32_t cc; + + getVSR(rA(opcode) + 32, &xa, env); + getVSR(rB(opcode) + 32, &xb, env); + + exp_a =3D extract64(xa.VsrD(0), 48, 15); + exp_b =3D extract64(xb.VsrD(0), 48, 15); + + if (unlikely(float128_is_any_nan(make_float128(xa.VsrD(0), xa.VsrD(1))= ) || + float128_is_any_nan(make_float128(xb.VsrD(0), xb.VsrD(1))= ))) { + cc =3D CRF_SO; + } else { + if (exp_a < exp_b) { + cc =3D CRF_LT; + } else if (exp_a > exp_b) { + cc =3D CRF_GT; + } else { + cc =3D CRF_EQ; + } + } + + env->fpscr &=3D ~(0x0F << FPSCR_FPRF); + env->fpscr |=3D cc << FPSCR_FPRF; + env->crf[BF(opcode)] =3D cc; + + helper_float_check_status(env); +} + #define VSX_SCALAR_CMP(op, ordered) \ void helper_##op(CPUPPCState *env, uint32_t opcode) \ { \ diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 0a8fbba..042b8c1 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -399,6 +399,8 @@ DEF_HELPER_2(xscmpeqdp, void, env, i32) DEF_HELPER_2(xscmpgtdp, void, env, i32) DEF_HELPER_2(xscmpgedp, void, env, i32) DEF_HELPER_2(xscmpnedp, void, env, i32) +DEF_HELPER_2(xscmpexpdp, void, env, i32) +DEF_HELPER_2(xscmpexpqp, void, env, i32) DEF_HELPER_2(xscmpodp, void, env, i32) DEF_HELPER_2(xscmpudp, void, env, i32) DEF_HELPER_2(xsmaxdp, void, env, i32) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 5a27be4..5206258 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -624,6 +624,8 @@ GEN_VSX_HELPER_2(xscmpeqdp, 0x0C, 0x00, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xscmpgtdp, 0x0C, 0x01, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xscmpgedp, 0x0C, 0x02, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xscmpnedp, 0x0C, 0x03, 0, PPC2_ISA300) +GEN_VSX_HELPER_2(xscmpexpdp, 0x0C, 0x07, 0, PPC2_ISA300) +GEN_VSX_HELPER_2(xscmpexpqp, 0x04, 0x05, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xscmpodp, 0x0C, 0x05, 0, PPC2_VSX) GEN_VSX_HELPER_2(xscmpudp, 0x0C, 0x04, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsmaxdp, 0x00, 0x14, 0, PPC2_VSX) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 3d91041..2468ee9 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -83,6 +83,10 @@ GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x01, opc3|0x0C, = 0, PPC_NONE, PPC2_VSX),\ GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x02, opc3|0x0C, 0, PPC_NONE, PPC2_= VSX),\ GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x03, opc3|0x0C, 0, PPC_NONE, PPC2_= VSX) =20 +#define GEN_VSX_XFORM_300(name, opc2, opc3, inval) \ +GEN_HANDLER_E(name, 0x3F, opc2, opc3, inval, PPC_NONE, PPC2_ISA300) + + GEN_XX2FORM(xsabsdp, 0x12, 0x15, PPC2_VSX), GEN_XX2FORM(xsnabsdp, 0x12, 0x16, PPC2_VSX), GEN_XX2FORM(xsnegdp, 0x12, 0x17, PPC2_VSX), @@ -118,6 +122,8 @@ GEN_XX3FORM(xscmpeqdp, 0x0C, 0x00, PPC2_ISA300), GEN_XX3FORM(xscmpgtdp, 0x0C, 0x01, PPC2_ISA300), GEN_XX3FORM(xscmpgedp, 0x0C, 0x02, PPC2_ISA300), GEN_XX3FORM(xscmpnedp, 0x0C, 0x03, PPC2_ISA300), +GEN_XX3FORM(xscmpexpdp, 0x0C, 0x07, PPC2_ISA300), +GEN_VSX_XFORM_300(xscmpexpqp, 0x04, 0x05, 0x00600001), GEN_XX2IFORM(xscmpodp, 0x0C, 0x05, PPC2_VSX), GEN_XX2IFORM(xscmpudp, 0x0C, 0x04, PPC2_VSX), GEN_XX3FORM(xsmaxdp, 0x00, 0x14, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486012652913682.164967948877; Wed, 1 Feb 2017 21:17:32 -0800 (PST) Received: from localhost ([::1]:54211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9ly-00015x-Rd for importer@patchew.org; Thu, 02 Feb 2017 00:17:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jc-000756-MB for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9ja-0003T6-S5 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:04 -0500 Received: from ozlabs.org ([103.22.144.67]:51063) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9ja-0003Pt-GE; Thu, 02 Feb 2017 00:15:02 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqK53PMz9s7L; Thu, 2 Feb 2017 16:14:53 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012493; bh=CyMsJ/g4fVk+m6CT+JHV8Gkk346wViCUmM9FrNNoD50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=it1KUpkB3A9osUILCEw+Q1UOUdMkBLQzIE9yt1tKx7NUvh8S3lw9W1KpViLCPPRJL djtfv/FNSicF80Ecz1GD7u4cAeu1Ec3Ei317tMAtvBHxGBLe2FvG36POpqlBCPkQ2X 1SACqNbmd4xPuAnYRCrD9eKGpk3xAXduWT24sZDQ= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:04 +1100 Message-Id: <20170202051445.5735-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 006/107] target-ppc: Add xscmpoqp and xscmpuqp instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xscmpoqp - VSX Scalar Compare Ordered Quad-Precision xscmpuqp - VSX Scalar Compare Unordered Quad-Precision Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 54 +++++++++++++++++++++++++++++++++= ++++ target/ppc/helper.h | 2 ++ target/ppc/translate/vsx-impl.inc.c | 2 ++ target/ppc/translate/vsx-ops.inc.c | 2 ++ 4 files changed, 60 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 8bffafb..696f537 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2519,6 +2519,60 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ VSX_SCALAR_CMP(xscmpodp, 1) VSX_SCALAR_CMP(xscmpudp, 0) =20 +#define VSX_SCALAR_CMPQ(op, ordered) \ +void helper_##op(CPUPPCState *env, uint32_t opcode) \ +{ \ + ppc_vsr_t xa, xb; \ + uint32_t cc =3D 0; \ + bool vxsnan_flag =3D false, vxvc_flag =3D false; = \ + float128 a, b; \ + \ + helper_reset_fpstatus(env); \ + getVSR(rA(opcode) + 32, &xa, env); \ + getVSR(rB(opcode) + 32, &xb, env); \ + \ + a =3D make_float128(xa.VsrD(0), xa.VsrD(1)); \ + b =3D make_float128(xb.VsrD(0), xb.VsrD(1)); \ + \ + if (float128_is_signaling_nan(a, &env->fp_status) || \ + float128_is_signaling_nan(b, &env->fp_status)) { \ + vxsnan_flag =3D true; \ + cc =3D CRF_SO; \ + if (fpscr_ve =3D=3D 0 && ordered) { = \ + vxvc_flag =3D true; \ + } \ + } else if (float128_is_quiet_nan(a, &env->fp_status) || \ + float128_is_quiet_nan(b, &env->fp_status)) { \ + cc =3D CRF_SO; \ + if (ordered) { \ + vxvc_flag =3D true; \ + } \ + } \ + if (vxsnan_flag) { \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); \ + } \ + if (vxvc_flag) { \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXVC, 0); \ + } \ + \ + if (float128_lt(a, b, &env->fp_status)) { \ + cc |=3D CRF_LT; \ + } else if (!float128_le(a, b, &env->fp_status)) { \ + cc |=3D CRF_GT; \ + } else { \ + cc |=3D CRF_EQ; \ + } \ + \ + env->fpscr &=3D ~(0x0F << FPSCR_FPRF); \ + env->fpscr |=3D cc << FPSCR_FPRF; \ + env->crf[BF(opcode)] =3D cc; \ + \ + float_check_status(env); \ +} + +VSX_SCALAR_CMPQ(xscmpoqp, 1) +VSX_SCALAR_CMPQ(xscmpuqp, 0) + /* VSX_MAX_MIN - VSX floating point maximum/minimum * name - instruction mnemonic * op - operation (max or min) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 042b8c1..125d6c5 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -403,6 +403,8 @@ DEF_HELPER_2(xscmpexpdp, void, env, i32) DEF_HELPER_2(xscmpexpqp, void, env, i32) DEF_HELPER_2(xscmpodp, void, env, i32) DEF_HELPER_2(xscmpudp, void, env, i32) +DEF_HELPER_2(xscmpoqp, void, env, i32) +DEF_HELPER_2(xscmpuqp, void, env, i32) DEF_HELPER_2(xsmaxdp, void, env, i32) DEF_HELPER_2(xsmindp, void, env, i32) DEF_HELPER_2(xscvdpsp, void, env, i32) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 5206258..ed9588e 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -628,6 +628,8 @@ GEN_VSX_HELPER_2(xscmpexpdp, 0x0C, 0x07, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xscmpexpqp, 0x04, 0x05, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xscmpodp, 0x0C, 0x05, 0, PPC2_VSX) GEN_VSX_HELPER_2(xscmpudp, 0x0C, 0x04, 0, PPC2_VSX) +GEN_VSX_HELPER_2(xscmpoqp, 0x04, 0x04, 0, PPC2_VSX) +GEN_VSX_HELPER_2(xscmpuqp, 0x04, 0x14, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsmaxdp, 0x00, 0x14, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsmindp, 0x00, 0x15, 0, PPC2_VSX) GEN_VSX_HELPER_2(xscvdpsp, 0x12, 0x10, 0, PPC2_VSX) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 2468ee9..7f09527 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -126,6 +126,8 @@ GEN_XX3FORM(xscmpexpdp, 0x0C, 0x07, PPC2_ISA300), GEN_VSX_XFORM_300(xscmpexpqp, 0x04, 0x05, 0x00600001), GEN_XX2IFORM(xscmpodp, 0x0C, 0x05, PPC2_VSX), GEN_XX2IFORM(xscmpudp, 0x0C, 0x04, PPC2_VSX), +GEN_VSX_XFORM_300(xscmpoqp, 0x04, 0x04, 0x00600001), +GEN_VSX_XFORM_300(xscmpuqp, 0x04, 0x14, 0x00600001), GEN_XX3FORM(xsmaxdp, 0x00, 0x14, PPC2_VSX), GEN_XX3FORM(xsmindp, 0x00, 0x15, PPC2_VSX), GEN_XX2FORM(xscvdpsp, 0x12, 0x10, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486012653773554.6652958892338; Wed, 1 Feb 2017 21:17:33 -0800 (PST) Received: from localhost ([::1]:54212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9lz-00016T-Sz for importer@patchew.org; Thu, 02 Feb 2017 00:17:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jc-00075F-VJ for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jb-0003TX-0G for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:04 -0500 Received: from ozlabs.org ([103.22.144.67]:42425) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9ja-0003Pr-JJ; Thu, 02 Feb 2017 00:15:02 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqK6PpWz9s7P; Thu, 2 Feb 2017 16:14:53 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012493; bh=U8YeQS8xrJ8MIz4EeWJ5rDAvXGti5Tanx6RcJ97ohdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W5GjEYgjKtjO26QZy4KEwD2mvuFzx7wsMAuW/1UZt4/qeQig/jCXNj/QVSQsu2yEH V7lsb72DxHyOfkRTGd5ckukxAKC7CtGhGUAQLRSKsissMDXiCvt8dVkSKVUJj0OcZj pZhvATteP/kjsS93+32ZI+Zy92mql4HYncB6MMzg= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:05 +1100 Message-Id: <20170202051445.5735-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 007/107] target-ppc: implement lxsd and lxssp instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania lxsd: Load VSX Scalar Dword lxssp: Load VSX Scalar Single Moreover, DS-Form instructions shares the same primary opcode, bits 30:31 are used to decode the instruction. Use a common routine to decode primary opcode(0x39) - ds-form instructions and branch-out depending on bits 30:31. Signed-off-by: Nikunj A Dadhania Reviewed-by: David Gibson Signed-off-by: David Gibson --- target/ppc/translate.c | 25 +++++++++++++++++++++++++ target/ppc/translate/fp-ops.inc.c | 1 - target/ppc/translate/vsx-impl.inc.c | 21 +++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index e55a5dc..06ac0e9 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -6072,6 +6072,29 @@ GEN_TM_PRIV_NOOP(trechkpt); =20 #include "translate/spe-impl.inc.c" =20 +/* Handles lfdp, lxsd, lxssp */ +static void gen_dform39(DisasContext *ctx) +{ + switch (ctx->opcode & 0x3) { + case 0: /* lfdp */ + if (ctx->insns_flags2 & PPC2_ISA205) { + return gen_lfdp(ctx); + } + break; + case 2: /* lxsd */ + if (ctx->insns_flags2 & PPC2_ISA300) { + return gen_lxsd(ctx); + } + break; + case 3: /* lxssp */ + if (ctx->insns_flags2 & PPC2_ISA300) { + return gen_lxssp(ctx); + } + break; + } + return gen_invalid(ctx); +} + static opcode_t opcodes[] =3D { GEN_HANDLER(invalid, 0x00, 0x00, 0x00, 0xFFFFFFFF, PPC_NONE), GEN_HANDLER(cmp, 0x1F, 0x00, 0x00, 0x00400000, PPC_INTEGER), @@ -6144,6 +6167,8 @@ GEN_HANDLER(ld, 0x3A, 0xFF, 0xFF, 0x00000000, PPC_64B= ), GEN_HANDLER(lq, 0x38, 0xFF, 0xFF, 0x00000000, PPC_64BX), GEN_HANDLER(std, 0x3E, 0xFF, 0xFF, 0x00000000, PPC_64B), #endif +/* handles lfdp, lxsd, lxssp */ +GEN_HANDLER_E(dform39, 0x39, 0xFF, 0xFF, 0x00000000, PPC_NONE, PPC2_ISA205= ), GEN_HANDLER(lmw, 0x2E, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER(stmw, 0x2F, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER(lswi, 0x1F, 0x15, 0x12, 0x00000001, PPC_STRING), diff --git a/target/ppc/translate/fp-ops.inc.c b/target/ppc/translate/fp-op= s.inc.c index d36ab4e..3127fa0 100644 --- a/target/ppc/translate/fp-ops.inc.c +++ b/target/ppc/translate/fp-ops.inc.c @@ -68,7 +68,6 @@ GEN_LDFS(lfd, ld64, 0x12, PPC_FLOAT) GEN_LDFS(lfs, ld32fs, 0x10, PPC_FLOAT) GEN_HANDLER_E(lfiwax, 0x1f, 0x17, 0x1a, 0x00000001, PPC_NONE, PPC2_ISA205), GEN_HANDLER_E(lfiwzx, 0x1f, 0x17, 0x1b, 0x1, PPC_NONE, PPC2_FP_CVT_ISA206), -GEN_HANDLER_E(lfdp, 0x39, 0xFF, 0xFF, 0x00200003, PPC_NONE, PPC2_ISA205), GEN_HANDLER_E(lfdpx, 0x1F, 0x17, 0x18, 0x00200001, PPC_NONE, PPC2_ISA205), =20 #define GEN_STF(name, stop, opc, type) = \ diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index ed9588e..1d7cd23 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -190,6 +190,27 @@ static void gen_lxvb16x(DisasContext *ctx) tcg_temp_free(EA); } =20 +#define VSX_LOAD_SCALAR_DS(name, operation) \ +static void gen_##name(DisasContext *ctx) \ +{ \ + TCGv EA; \ + TCGv_i64 xth =3D cpu_vsrh(rD(ctx->opcode) + 32); \ + \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + gen_set_access_type(ctx, ACCESS_INT); \ + EA =3D tcg_temp_new(); \ + gen_addr_imm_index(ctx, EA, 0x03); \ + gen_qemu_##operation(ctx, xth, EA); \ + /* NOTE: cpu_vsrl is undefined */ \ + tcg_temp_free(EA); \ +} + +VSX_LOAD_SCALAR_DS(lxsd, ld64_i64) +VSX_LOAD_SCALAR_DS(lxssp, ld32fs) + #define VSX_STORE_SCALAR(name, operation) \ static void gen_##name(DisasContext *ctx) \ { \ --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486013773716688.3044797717059; Wed, 1 Feb 2017 21:36:13 -0800 (PST) Received: from localhost ([::1]:54311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZA43-0001l6-GQ for importer@patchew.org; Thu, 02 Feb 2017 00:36:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jc-00074a-A3 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9ja-0003Sz-Q4 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:04 -0500 Received: from ozlabs.org ([103.22.144.67]:38813) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9ja-0003Py-DV; Thu, 02 Feb 2017 00:15:02 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqL5vzDz9s7S; Thu, 2 Feb 2017 16:14:53 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012494; bh=+LVd17ga5lfhp8gxzurMWYb70XaG0zc5K2MersJfvH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=msaThqrMjXjwaLIv5SzGvNA5X0gUlu8cQ/+p+3R/jPUzpGlnhQAeK6H7RVJv4O5UV ftB5H0g3nVbRerOHSdlcxr6jDTp/TdhCew6uO7lRtyYjOdYfWChXdNKqu9GwcoKjbi 6eczL05t4Mbe8l3l8Ovbn6lfkSjUgpLWZK38lgRw= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:06 +1100 Message-Id: <20170202051445.5735-9-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 008/107] target-ppc: implement stxsd and stxssp X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania stxsd: Store VSX Scalar Dword stxssp: Store VSX Scalar SP Moreover, DQ-Form/DS-FORM instructions shares the same primary opcode(0x3D). For DQ-FORM bits 29:31 are used, for DS-FORM bits 30:31 are used. Common routine to decode primary opcode(0x3D) - ds-form/dq-form instructions is required. Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate.c | 34 ++++++++++++++++++++++++++++++++++ target/ppc/translate/fp-ops.inc.c | 1 - target/ppc/translate/vsx-impl.inc.c | 21 +++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 06ac0e9..8032dc9 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -6095,6 +6095,38 @@ static void gen_dform39(DisasContext *ctx) return gen_invalid(ctx); } =20 +/* handles stfdp, stxsd, stxssp */ +static void gen_dform3D(DisasContext *ctx) +{ + if ((ctx->opcode & 3) =3D=3D 1) { /* DQ-FORM */ + switch (ctx->opcode & 0x7) { + case 1: /* lxv */ + break; + case 5: /* stxv */ + break; + } + } else { /* DS-FORM */ + switch (ctx->opcode & 0x3) { + case 0: /* stfdp */ + if (ctx->insns_flags2 & PPC2_ISA205) { + return gen_stfdp(ctx); + } + break; + case 2: /* stxsd */ + if (ctx->insns_flags2 & PPC2_ISA300) { + return gen_stxsd(ctx); + } + break; + case 3: /* stxssp */ + if (ctx->insns_flags2 & PPC2_ISA300) { + return gen_stxssp(ctx); + } + break; + } + } + return gen_invalid(ctx); +} + static opcode_t opcodes[] =3D { GEN_HANDLER(invalid, 0x00, 0x00, 0x00, 0xFFFFFFFF, PPC_NONE), GEN_HANDLER(cmp, 0x1F, 0x00, 0x00, 0x00400000, PPC_INTEGER), @@ -6169,6 +6201,8 @@ GEN_HANDLER(std, 0x3E, 0xFF, 0xFF, 0x00000000, PPC_64= B), #endif /* handles lfdp, lxsd, lxssp */ GEN_HANDLER_E(dform39, 0x39, 0xFF, 0xFF, 0x00000000, PPC_NONE, PPC2_ISA205= ), +/* handles stfdp, stxsd, stxssp */ +GEN_HANDLER_E(dform3D, 0x3D, 0xFF, 0xFF, 0x00000000, PPC_NONE, PPC2_ISA205= ), GEN_HANDLER(lmw, 0x2E, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER(stmw, 0x2F, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER(lswi, 0x1F, 0x15, 0x12, 0x00000001, PPC_STRING), diff --git a/target/ppc/translate/fp-ops.inc.c b/target/ppc/translate/fp-op= s.inc.c index 3127fa0..3c6d05a 100644 --- a/target/ppc/translate/fp-ops.inc.c +++ b/target/ppc/translate/fp-ops.inc.c @@ -87,7 +87,6 @@ GEN_STXF(name, stop, 0x17, op | 0x00, type) GEN_STFS(stfd, st64_i64, 0x16, PPC_FLOAT) GEN_STFS(stfs, st32fs, 0x14, PPC_FLOAT) GEN_STXF(stfiw, st32fiw, 0x17, 0x1E, PPC_FLOAT_STFIWX) -GEN_HANDLER_E(stfdp, 0x3D, 0xFF, 0xFF, 0x00200003, PPC_NONE, PPC2_ISA205), GEN_HANDLER_E(stfdpx, 0x1F, 0x17, 0x1C, 0x00200001, PPC_NONE, PPC2_ISA205), =20 GEN_HANDLER(frsqrtes, 0x3B, 0x1A, 0xFF, 0x001F07C0, PPC_FLOAT_FRSQRTES), diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 1d7cd23..8ee44cf 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -332,6 +332,27 @@ static void gen_stxvb16x(DisasContext *ctx) tcg_temp_free(EA); } =20 +#define VSX_STORE_SCALAR_DS(name, operation) \ +static void gen_##name(DisasContext *ctx) \ +{ \ + TCGv EA; \ + TCGv_i64 xth =3D cpu_vsrh(rD(ctx->opcode) + 32); \ + \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + gen_set_access_type(ctx, ACCESS_INT); \ + EA =3D tcg_temp_new(); \ + gen_addr_imm_index(ctx, EA, 0x03); \ + gen_qemu_##operation(ctx, xth, EA); \ + /* NOTE: cpu_vsrl is undefined */ \ + tcg_temp_free(EA); \ +} + +VSX_LOAD_SCALAR_DS(stxsd, st64_i64) +VSX_LOAD_SCALAR_DS(stxssp, st32fs) + #define MV_VSRW(name, tcgop1, tcgop2, target, source) \ static void gen_##name(DisasContext *ctx) \ { \ --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014107814720.9108241198356; Wed, 1 Feb 2017 21:41:47 -0800 (PST) Received: from localhost ([::1]:54341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZA9R-0007HY-Mf for importer@patchew.org; Thu, 02 Feb 2017 00:41:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9je-00077Q-Vx for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jb-0003Uf-Te for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:06 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:37229) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jb-0003Q6-44; Thu, 02 Feb 2017 00:15:03 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqL4sJdz9s7F; Thu, 2 Feb 2017 16:14:53 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012494; bh=LqAwK9YWWvmho58WJxGJFgUIMCjQMSAWs7O5MdG7Uvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lCJb5uT8eYUOaWLjUNEin/5YNafBqSgA/8C1CnIZGTjfn70GzOZwu4ebzBqtaShJ4 etfHVn5qgXc2XaTAH39LdHpPnwR6XGpAD9fsbkrlZ73pWgpxlu+6TUCB5u7cETmfP3 y/TsNo7K69ic4NKGJuoPKtmlfeBW1uY9Bo/eCX+g= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:07 +1100 Message-Id: <20170202051445.5735-10-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 009/107] target-ppc: implement lxv/lxvx and stxv/stxvx X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania lxv: Load VSX Vector lxvx: Load VSX Vector Indexed Little/Big-endian Storage +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |F0|F1|F2|F3|F4|F5|F6|F7|E0|E1|E2|E3|E4|E5|E6|E7| +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ Vector load results: BE: +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |F0|F1|F2|F3|F4|F5|F6|F7|E0|E1|E2|E3|E4|E5|E6|E7| +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ LE: +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |E7|E6|E5|E4|E3|E2|E1|E0|F7|F6|F5|F4|F3|F2|F1|F0| +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ stxv: Store VSX Vector stxvx: Store VSX Vector Indexed Vector (8-bit elements) in BE: +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |F0|F1|F2|F3|F4|F5|F6|F7|E0|E1|E2|E3|E4|E5|E6|E7| +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ Vector (8-bit elements) in LE: +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |E7|E6|E5|E4|E3|E2|E1|E0|F7|F6|F5|F4|F3|F2|F1|F0| +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ Store results in following: +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |F0|F1|F2|F3|F4|F5|F6|F7|E0|E1|E2|E3|E4|E5|E6|E7| +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/internal.h | 1 + target/ppc/translate.c | 10 ++++++-- target/ppc/translate/vsx-impl.inc.c | 50 +++++++++++++++++++++++++++++++++= ++++ target/ppc/translate/vsx-ops.inc.c | 2 ++ 4 files changed, 61 insertions(+), 2 deletions(-) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 9a4a74a..e83ea45 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -187,6 +187,7 @@ EXTRACT_HELPER(DCM, 10, 6) /* DFP Z23-form */ EXTRACT_HELPER(RMC, 9, 2) =20 +EXTRACT_HELPER_SPLIT(DQxT, 3, 1, 21, 5); EXTRACT_HELPER_SPLIT(xT, 0, 1, 21, 5); EXTRACT_HELPER_SPLIT(xS, 0, 1, 21, 5); EXTRACT_HELPER_SPLIT(xA, 2, 1, 16, 5); diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 8032dc9..87fc153 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -6095,14 +6095,20 @@ static void gen_dform39(DisasContext *ctx) return gen_invalid(ctx); } =20 -/* handles stfdp, stxsd, stxssp */ +/* handles stfdp, lxv, stxsd, stxssp lxvx */ static void gen_dform3D(DisasContext *ctx) { if ((ctx->opcode & 3) =3D=3D 1) { /* DQ-FORM */ switch (ctx->opcode & 0x7) { case 1: /* lxv */ + if (ctx->insns_flags2 & PPC2_ISA300) { + return gen_lxv(ctx); + } break; case 5: /* stxv */ + if (ctx->insns_flags2 & PPC2_ISA300) { + return gen_stxv(ctx); + } break; } } else { /* DS-FORM */ @@ -6201,7 +6207,7 @@ GEN_HANDLER(std, 0x3E, 0xFF, 0xFF, 0x00000000, PPC_64= B), #endif /* handles lfdp, lxsd, lxssp */ GEN_HANDLER_E(dform39, 0x39, 0xFF, 0xFF, 0x00000000, PPC_NONE, PPC2_ISA205= ), -/* handles stfdp, stxsd, stxssp */ +/* handles stfdp, lxv, stxsd, stxssp, stxv */ GEN_HANDLER_E(dform3D, 0x3D, 0xFF, 0xFF, 0x00000000, PPC_NONE, PPC2_ISA205= ), GEN_HANDLER(lmw, 0x2E, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER(stmw, 0x2F, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 8ee44cf..2fbdbd2 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -190,6 +190,56 @@ static void gen_lxvb16x(DisasContext *ctx) tcg_temp_free(EA); } =20 +#define VSX_VECTOR_LOAD_STORE(name, op, indexed) \ +static void gen_##name(DisasContext *ctx) \ +{ \ + int xt; \ + TCGv EA; \ + TCGv_i64 xth, xtl; \ + \ + if (indexed) { \ + xt =3D xT(ctx->opcode); \ + } else { \ + xt =3D DQxT(ctx->opcode); \ + } \ + xth =3D cpu_vsrh(xt); \ + xtl =3D cpu_vsrl(xt); \ + \ + if (xt < 32) { \ + if (unlikely(!ctx->vsx_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VSXU); \ + return; \ + } \ + } else { \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + } \ + gen_set_access_type(ctx, ACCESS_INT); \ + EA =3D tcg_temp_new(); \ + if (indexed) { \ + gen_addr_reg_index(ctx, EA); \ + } else { \ + gen_addr_imm_index(ctx, EA, 0x0F); \ + } \ + if (ctx->le_mode) { \ + tcg_gen_qemu_##op(xtl, EA, ctx->mem_idx, MO_LEQ); \ + tcg_gen_addi_tl(EA, EA, 8); \ + tcg_gen_qemu_##op(xth, EA, ctx->mem_idx, MO_LEQ); \ + } else { \ + tcg_gen_qemu_##op(xth, EA, ctx->mem_idx, MO_BEQ); \ + tcg_gen_addi_tl(EA, EA, 8); \ + tcg_gen_qemu_##op(xtl, EA, ctx->mem_idx, MO_BEQ); \ + } \ + tcg_temp_free(EA); \ +} + +VSX_VECTOR_LOAD_STORE(lxv, ld_i64, 0) +VSX_VECTOR_LOAD_STORE(stxv, st_i64, 0) +VSX_VECTOR_LOAD_STORE(lxvx, ld_i64, 1) +VSX_VECTOR_LOAD_STORE(stxvx, st_i64, 1) + #define VSX_LOAD_SCALAR_DS(name, operation) \ static void gen_##name(DisasContext *ctx) \ { \ diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 7f09527..8a1cbe0 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -9,6 +9,7 @@ GEN_HANDLER_E(lxvdsx, 0x1F, 0x0C, 0x0A, 0, PPC_NONE, PPC2_V= SX), GEN_HANDLER_E(lxvw4x, 0x1F, 0x0C, 0x18, 0, PPC_NONE, PPC2_VSX), GEN_HANDLER_E(lxvh8x, 0x1F, 0x0C, 0x19, 0, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(lxvb16x, 0x1F, 0x0C, 0x1B, 0, PPC_NONE, PPC2_ISA300), +GEN_HANDLER_E(lxvx, 0x1F, 0x0C, 0x08, 0x00000040, PPC_NONE, PPC2_ISA300), =20 GEN_HANDLER_E(stxsdx, 0x1F, 0xC, 0x16, 0, PPC_NONE, PPC2_VSX), GEN_HANDLER_E(stxsibx, 0x1F, 0xD, 0x1C, 0, PPC_NONE, PPC2_ISA300), @@ -19,6 +20,7 @@ GEN_HANDLER_E(stxvd2x, 0x1F, 0xC, 0x1E, 0, PPC_NONE, PPC2= _VSX), GEN_HANDLER_E(stxvw4x, 0x1F, 0xC, 0x1C, 0, PPC_NONE, PPC2_VSX), GEN_HANDLER_E(stxvh8x, 0x1F, 0x0C, 0x1D, 0, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(stxvb16x, 0x1F, 0x0C, 0x1F, 0, PPC_NONE, PPC2_ISA300), +GEN_HANDLER_E(stxvx, 0x1F, 0x0C, 0x0C, 0, PPC_NONE, PPC2_ISA300), =20 GEN_HANDLER_E(mfvsrwz, 0x1F, 0x13, 0x03, 0x0000F800, PPC_NONE, PPC2_VSX207= ), GEN_HANDLER_E(mtvsrwa, 0x1F, 0x13, 0x06, 0x0000F800, PPC_NONE, PPC2_VSX207= ), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486013495327440.03722419417124; Wed, 1 Feb 2017 21:31:35 -0800 (PST) Received: from localhost ([::1]:54288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9zZ-0005gK-Ak for importer@patchew.org; Thu, 02 Feb 2017 00:31:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jc-00074S-5X for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9ja-0003St-Jn for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:04 -0500 Received: from ozlabs.org ([103.22.144.67]:44217) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9ja-0003Ps-8Y; Thu, 02 Feb 2017 00:15:02 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqL2Pbhz9s7N; Thu, 2 Feb 2017 16:14:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012494; bh=PnuLlZVecn1NFxn4/XzImZ9dIxQThxM/kS6MGdsZUvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hYJc3Sb+tCCiz4Nzwi+mY8oIcNWs8QaQDn1Ky6MKc4OhyQCT6cy/uhi26OBXhUWBC hc+8umPJGRztiPxxb3BeXRVbezxE+NhB7/ZMsvw2KL8JgtMfuUFcgNNZYAGLWakzB6 d07vA4YppFUleKTc/PV1xNplcg9MWm+rAE6afmYA= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:08 +1100 Message-Id: <20170202051445.5735-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 010/107] target-ppc: Implement bcdcfsq. instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani bcdcfsq.: Decimal convert from signed quadword. It is not possible to convert values less than -10^31-1 or greater than 10^31-1 to be represented in packed decimal format. Signed-off-by: Jose Ricardo Ziviani [dwg: Corrected constant which should be 10^16-1 but was 10^17-1] Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 38 +++++++++++++++++++++++++++++++++= ++++ target/ppc/translate/vmx-impl.inc.c | 7 +++++++ 3 files changed, 46 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 125d6c5..ec5ccbe 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -377,6 +377,7 @@ DEF_HELPER_3(bcdcfn, i32, avr, avr, i32) DEF_HELPER_3(bcdctn, i32, avr, avr, i32) DEF_HELPER_3(bcdcfz, i32, avr, avr, i32) DEF_HELPER_3(bcdctz, i32, avr, avr, i32) +DEF_HELPER_3(bcdcfsq, i32, avr, avr, i32) =20 DEF_HELPER_2(xsadddp, void, env, i32) DEF_HELPER_2(xssubdp, void, env, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index fbc84e2..a809482 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2842,6 +2842,44 @@ uint32_t helper_bcdctz(ppc_avr_t *r, ppc_avr_t *b, u= int32_t ps) return cr; } =20 +uint32_t helper_bcdcfsq(ppc_avr_t *r, ppc_avr_t *b, uint32_t ps) +{ + int i; + int cr =3D 0; + uint64_t lo_value; + uint64_t hi_value; + ppc_avr_t ret =3D { .u64 =3D { 0, 0 } }; + + if (b->s64[HI_IDX] < 0) { + lo_value =3D -b->s64[LO_IDX]; + hi_value =3D ~b->u64[HI_IDX] + !lo_value; + bcd_put_digit(&ret, 0xD, 0); + } else { + lo_value =3D b->u64[LO_IDX]; + hi_value =3D b->u64[HI_IDX]; + bcd_put_digit(&ret, bcd_preferred_sgn(0, ps), 0); + } + + if (divu128(&lo_value, &hi_value, 1000000000000000ULL) || + lo_value > 9999999999999999ULL) { + cr =3D CRF_SO; + } + + for (i =3D 1; i < 16; hi_value /=3D 10, i++) { + bcd_put_digit(&ret, hi_value % 10, i); + } + + for (; i < 32; lo_value /=3D 10, i++) { + bcd_put_digit(&ret, lo_value % 10, i); + } + + cr |=3D bcd_cmp_zero(&ret); + + *r =3D ret; + + return cr; +} + void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a) { int i; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index 7143eb3..36141e5 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -989,10 +989,14 @@ GEN_BCD2(bcdcfn) GEN_BCD2(bcdctn) GEN_BCD2(bcdcfz) GEN_BCD2(bcdctz) +GEN_BCD2(bcdcfsq) =20 static void gen_xpnd04_1(DisasContext *ctx) { switch (opc4(ctx->opcode)) { + case 2: + gen_bcdcfsq(ctx); + break; case 4: gen_bcdctz(ctx); break; @@ -1014,6 +1018,9 @@ static void gen_xpnd04_1(DisasContext *ctx) static void gen_xpnd04_2(DisasContext *ctx) { switch (opc4(ctx->opcode)) { + case 2: + gen_bcdcfsq(ctx); + break; case 4: gen_bcdctz(ctx); break; --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486013329751929.9005444141459; Wed, 1 Feb 2017 21:28:49 -0800 (PST) Received: from localhost ([::1]:54269 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9wt-0003Ro-PB for importer@patchew.org; Thu, 02 Feb 2017 00:28:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jc-00075A-Po for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9ja-0003TI-UX for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:04 -0500 Received: from ozlabs.org ([103.22.144.67]:46347) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9ja-0003Pw-He; Thu, 02 Feb 2017 00:15:02 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqL3qCmz9s7T; Thu, 2 Feb 2017 16:14:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012494; bh=wK6UQk0ffXzYoTM7ODweHECZxKJjmYs6XRrMH5jcI58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mvnN2lJfRhOTr8EoiL146sEzfNX3UgX+B51C5PGxkmtYabCP98KHXTSqTnOvty2gU OGyJHd8st0k3r2x477hqXSieLV4SdcoEBFTR0w/AkrI7wj9ne82xNW1vaaoJ64GheZ wvxlY68jub1jXcKGMUzJKyV3/To5DR0i+xC2mbSw= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:09 +1100 Message-Id: <20170202051445.5735-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 011/107] target-ppc: Implement bcdctsq. instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani bcdctsq.: Decimal convert to signed quadword. It is possible to convert packed decimal values to signed quadwords. Signed-off-by: Jose Ricardo Ziviani Reviewed-by: David Gibson Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 40 +++++++++++++++++++++++++++++++++= ++++ target/ppc/translate/vmx-impl.inc.c | 7 +++++++ 3 files changed, 48 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index ec5ccbe..daf5a6e 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -378,6 +378,7 @@ DEF_HELPER_3(bcdctn, i32, avr, avr, i32) DEF_HELPER_3(bcdcfz, i32, avr, avr, i32) DEF_HELPER_3(bcdctz, i32, avr, avr, i32) DEF_HELPER_3(bcdcfsq, i32, avr, avr, i32) +DEF_HELPER_3(bcdctsq, i32, avr, avr, i32) =20 DEF_HELPER_2(xsadddp, void, env, i32) DEF_HELPER_2(xssubdp, void, env, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index a809482..fa7cfdd 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2880,6 +2880,46 @@ uint32_t helper_bcdcfsq(ppc_avr_t *r, ppc_avr_t *b, = uint32_t ps) return cr; } =20 +uint32_t helper_bcdctsq(ppc_avr_t *r, ppc_avr_t *b, uint32_t ps) +{ + uint8_t i; + int cr; + uint64_t carry; + uint64_t unused; + uint64_t lo_value; + uint64_t hi_value =3D 0; + int sgnb =3D bcd_get_sgn(b); + int invalid =3D (sgnb =3D=3D 0); + + lo_value =3D bcd_get_digit(b, 31, &invalid); + for (i =3D 30; i > 0; i--) { + mulu64(&lo_value, &carry, lo_value, 10ULL); + mulu64(&hi_value, &unused, hi_value, 10ULL); + lo_value +=3D bcd_get_digit(b, i, &invalid); + hi_value +=3D carry; + + if (unlikely(invalid)) { + break; + } + } + + if (sgnb =3D=3D -1) { + r->s64[LO_IDX] =3D -lo_value; + r->s64[HI_IDX] =3D ~hi_value + !r->s64[LO_IDX]; + } else { + r->s64[LO_IDX] =3D lo_value; + r->s64[HI_IDX] =3D hi_value; + } + + cr =3D bcd_cmp_zero(b); + + if (unlikely(invalid)) { + cr =3D CRF_SO; + } + + return cr; +} + void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a) { int i; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index 36141e5..1579b58 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -990,10 +990,14 @@ GEN_BCD2(bcdctn) GEN_BCD2(bcdcfz) GEN_BCD2(bcdctz) GEN_BCD2(bcdcfsq) +GEN_BCD2(bcdctsq) =20 static void gen_xpnd04_1(DisasContext *ctx) { switch (opc4(ctx->opcode)) { + case 0: + gen_bcdctsq(ctx); + break; case 2: gen_bcdcfsq(ctx); break; @@ -1018,6 +1022,9 @@ static void gen_xpnd04_1(DisasContext *ctx) static void gen_xpnd04_2(DisasContext *ctx) { switch (opc4(ctx->opcode)) { + case 0: + gen_bcdctsq(ctx); + break; case 2: gen_bcdcfsq(ctx); break; --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486013268123561.7473955112326; Wed, 1 Feb 2017 21:27:48 -0800 (PST) Received: from localhost ([::1]:54265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9vs-0001xa-WF for importer@patchew.org; Thu, 02 Feb 2017 00:27:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jg-0007A4-Et for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9je-0003Wn-1w for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:08 -0500 Received: from ozlabs.org ([103.22.144.67]:41231) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jd-0003Tx-JU; Thu, 02 Feb 2017 00:15:05 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqM3Dttz9s7Y; Thu, 2 Feb 2017 16:14:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012495; bh=qTeD20U4dCEaDzKGfUJElQTHWRB4u3vnIshd79xXA0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZZ25K3pjGqLZkD3z//vTNNDpo0UwJOn4k1v+3BL5XwDby5wjH9vXO6xEKChwZvTgM iOrpsun4a7mYeHAFebdYBbUcBW8yZR/W3oOxWE7pqpb8Z6whNErirdTCMSoiu2/mEw qSVfmKY8bY5xTOzcr5Nn+uaYhowN0R0OObqPLDrg= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:10 +1100 Message-Id: <20170202051445.5735-13-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 012/107] target-ppc: Implement bcdcpsgn. instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani bcdcpsgn.: Decimal copy sign. Given two registers vra and vrb, it copies the vra value with vrb sign to the result register vrt. Signed-off-by: Jose Ricardo Ziviani Reviewed-by: David Gibson Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 23 +++++++++++++++++++++++ target/ppc/translate/vmx-impl.inc.c | 3 +++ target/ppc/translate/vmx-ops.inc.c | 2 +- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index daf5a6e..7957633 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -379,6 +379,7 @@ DEF_HELPER_3(bcdcfz, i32, avr, avr, i32) DEF_HELPER_3(bcdctz, i32, avr, avr, i32) DEF_HELPER_3(bcdcfsq, i32, avr, avr, i32) DEF_HELPER_3(bcdctsq, i32, avr, avr, i32) +DEF_HELPER_4(bcdcpsgn, i32, avr, avr, avr, i32) =20 DEF_HELPER_2(xsadddp, void, env, i32) DEF_HELPER_2(xssubdp, void, env, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index fa7cfdd..61762ee 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2920,6 +2920,29 @@ uint32_t helper_bcdctsq(ppc_avr_t *r, ppc_avr_t *b, = uint32_t ps) return cr; } =20 +uint32_t helper_bcdcpsgn(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, uint32_= t ps) +{ + int i; + int invalid =3D 0; + + if (bcd_get_sgn(a) =3D=3D 0 || bcd_get_sgn(b) =3D=3D 0) { + return CRF_SO; + } + + *r =3D *a; + bcd_put_digit(r, b->u8[BCD_DIG_BYTE(0)] & 0xF, 0); + + for (i =3D 1; i < 32; i++) { + bcd_get_digit(a, i, &invalid); + bcd_get_digit(b, i, &invalid); + if (unlikely(invalid)) { + return CRF_SO; + } + } + + return bcd_cmp_zero(r); +} + void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a) { int i; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index 1579b58..c14b666 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -991,6 +991,7 @@ GEN_BCD2(bcdcfz) GEN_BCD2(bcdctz) GEN_BCD2(bcdcfsq) GEN_BCD2(bcdctsq) +GEN_BCD(bcdcpsgn); =20 static void gen_xpnd04_1(DisasContext *ctx) { @@ -1056,6 +1057,8 @@ GEN_VXFORM_DUAL(vsubuhm, PPC_ALTIVEC, PPC_NONE, \ bcdsub, PPC_NONE, PPC2_ALTIVEC_207) GEN_VXFORM_DUAL(vsubuhs, PPC_ALTIVEC, PPC_NONE, \ bcdsub, PPC_NONE, PPC2_ALTIVEC_207) +GEN_VXFORM_DUAL(vaddshs, PPC_ALTIVEC, PPC_NONE, \ + bcdcpsgn, PPC_NONE, PPC2_ISA300) =20 static void gen_vsbox(DisasContext *ctx) { diff --git a/target/ppc/translate/vmx-ops.inc.c b/target/ppc/translate/vmx-= ops.inc.c index f02b3be..70d7d2b 100644 --- a/target/ppc/translate/vmx-ops.inc.c +++ b/target/ppc/translate/vmx-ops.inc.c @@ -131,7 +131,7 @@ GEN_VXFORM_DUAL(vaddubs, vmul10uq, 0, 8, PPC_ALTIVEC, P= PC_NONE), GEN_VXFORM_DUAL(vadduhs, vmul10euq, 0, 9, PPC_ALTIVEC, PPC_NONE), GEN_VXFORM(vadduws, 0, 10), GEN_VXFORM(vaddsbs, 0, 12), -GEN_VXFORM(vaddshs, 0, 13), +GEN_VXFORM_DUAL(vaddshs, bcdcpsgn, 0, 13, PPC_ALTIVEC, PPC_NONE), GEN_VXFORM(vaddsws, 0, 14), GEN_VXFORM_DUAL(vsububs, bcdadd, 0, 24, PPC_ALTIVEC, PPC_NONE), GEN_VXFORM_DUAL(vsubuhs, bcdsub, 0, 25, PPC_ALTIVEC, PPC_NONE), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486012994892400.1761932272789; Wed, 1 Feb 2017 21:23:14 -0800 (PST) Received: from localhost ([::1]:54242 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9rU-0006Wm-Vc for importer@patchew.org; Thu, 02 Feb 2017 00:23:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jg-0007AH-Kf for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9je-0003X7-7T for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:08 -0500 Received: from ozlabs.org ([103.22.144.67]:56647) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jd-0003UA-NL; Thu, 02 Feb 2017 00:15:06 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqM440Dz9s7V; Thu, 2 Feb 2017 16:14:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012495; bh=fi2C1q68bXclw7CwTUG4CwNZXwc3jVQGKXSkpzAtJ4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=neHcJzFGhnt6naGN+abxhWHMlJFdD0EldDSPJUsTs69FVOqvaifXF1PaXIp9iyMqn cwf4DXVQfvO5YrbkkNrlYCo4v18kIklvyUiRlMtzScHt7mDyrCGcUXSmXHW5BzeVLz QkyIyxJHoy2JM0kA2kVCdb2jVYY7zaBwpFBZBjTk= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:11 +1100 Message-Id: <20170202051445.5735-14-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 013/107] target-ppc: Implement bcdsetsgn. instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani bcdsetsgn.: Decimal set sign. This instruction copies the register value to the result register but adjust the signal according to the preferred sign value. Signed-off-by: Jose Ricardo Ziviani Reviewed-by: David Gibson Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 19 +++++++++++++++++++ target/ppc/translate/vmx-impl.inc.c | 8 ++++++++ 3 files changed, 28 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 7957633..de515ea 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -380,6 +380,7 @@ DEF_HELPER_3(bcdctz, i32, avr, avr, i32) DEF_HELPER_3(bcdcfsq, i32, avr, avr, i32) DEF_HELPER_3(bcdctsq, i32, avr, avr, i32) DEF_HELPER_4(bcdcpsgn, i32, avr, avr, avr, i32) +DEF_HELPER_3(bcdsetsgn, i32, avr, avr, i32) =20 DEF_HELPER_2(xsadddp, void, env, i32) DEF_HELPER_2(xssubdp, void, env, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 61762ee..00d04c1 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2943,6 +2943,25 @@ uint32_t helper_bcdcpsgn(ppc_avr_t *r, ppc_avr_t *a,= ppc_avr_t *b, uint32_t ps) return bcd_cmp_zero(r); } =20 +uint32_t helper_bcdsetsgn(ppc_avr_t *r, ppc_avr_t *b, uint32_t ps) +{ + int i; + int invalid =3D 0; + int sgnb =3D bcd_get_sgn(b); + + *r =3D *b; + bcd_put_digit(r, bcd_preferred_sgn(sgnb, ps), 0); + + for (i =3D 1; i < 32; i++) { + bcd_get_digit(b, i, &invalid); + if (unlikely(invalid)) { + return CRF_SO; + } + } + + return bcd_cmp_zero(r); +} + void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a) { int i; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index c14b666..b188e60 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -991,6 +991,7 @@ GEN_BCD2(bcdcfz) GEN_BCD2(bcdctz) GEN_BCD2(bcdcfsq) GEN_BCD2(bcdctsq) +GEN_BCD2(bcdsetsgn) GEN_BCD(bcdcpsgn); =20 static void gen_xpnd04_1(DisasContext *ctx) @@ -1014,6 +1015,9 @@ static void gen_xpnd04_1(DisasContext *ctx) case 7: gen_bcdcfn(ctx); break; + case 31: + gen_bcdsetsgn(ctx); + break; default: gen_invalid(ctx); break; @@ -1038,12 +1042,16 @@ static void gen_xpnd04_2(DisasContext *ctx) case 7: gen_bcdcfn(ctx); break; + case 31: + gen_bcdsetsgn(ctx); + break; default: gen_invalid(ctx); break; } } =20 + GEN_VXFORM_DUAL(vsubcuw, PPC_ALTIVEC, PPC_NONE, \ xpnd04_1, PPC_NONE, PPC2_ISA300) GEN_VXFORM_DUAL(vsubsws, PPC_ALTIVEC, PPC_NONE, \ --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486012959228430.88958534659446; Wed, 1 Feb 2017 21:22:39 -0800 (PST) Received: from localhost ([::1]:54240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9qv-0005eW-5O for importer@patchew.org; Thu, 02 Feb 2017 00:22:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jd-00075q-O8 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jb-0003U2-BB for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:05 -0500 Received: from ozlabs.org ([103.22.144.67]:48979) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9ja-0003Pz-LC; Thu, 02 Feb 2017 00:15:03 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqL6pCJz9s7R; Thu, 2 Feb 2017 16:14:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012494; bh=92r4jHpDEkIq83R6VXqYKmF09Flf0HcvN/7LnvYBmfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O/e3KU+NqoM/tHc2SPQKMd45ruuxM+ODIHgY4mIWuTcJ/zaCKxdvVwHbL19MymhDT ByadkVd35im2iQpTIZmMFA8RXO1Vpfi30TnLdppagyWglplgj3JNdxIOju8e6+aKaJ XtRW02bVazPqI/yQyo5Fsh3b+G153tkCrqeY6LP4= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:12 +1100 Message-Id: <20170202051445.5735-15-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 014/107] target-ppc: add vextu[bhw][lr]x instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, "Hariharan T . S ." , Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Avinesh Kumar , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Avinesh Kumar vextublx: Vector Extract Unsigned Byte Left vextuhlx: Vector Extract Unsigned Halfword Left vextuwlx: Vector Extract Unsigned Word Left vextubrx: Vector Extract Unsigned Byte Right-Indexed VX-form vextuhrx: Vector Extract Unsigned Halfword Right-Indexed VX-form vextuwrx: Vector Extract Unsigned Word Right-Indexed VX-form Signed-off-by: Avinesh Kumar Signed-off-by: Hariharan T.S. [ implement using int128_rshift ] Signed-off-by: Nikunj A Dadhania Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/cpu.h | 2 ++ target/ppc/helper.h | 6 ++++++ target/ppc/int_helper.c | 36 +++++++++++++++++++++++++++++++++= +++ target/ppc/translate/vmx-impl.inc.c | 23 +++++++++++++++++++++++ target/ppc/translate/vmx-ops.inc.c | 8 ++++++-- 5 files changed, 73 insertions(+), 2 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index b6782ba..7a6ee3f 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -21,6 +21,7 @@ #define PPC_CPU_H =20 #include "qemu-common.h" +#include "qemu/int128.h" =20 //#define PPC_EMULATE_32BITS_HYPV =20 @@ -262,6 +263,7 @@ union ppc_avr_t { #ifdef CONFIG_INT128 __uint128_t u128; #endif + Int128 s128; }; =20 #if !defined(CONFIG_USER_ONLY) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index de515ea..6369165 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -361,6 +361,12 @@ DEF_HELPER_3(vpmsumb, void, avr, avr, avr) DEF_HELPER_3(vpmsumh, void, avr, avr, avr) DEF_HELPER_3(vpmsumw, void, avr, avr, avr) DEF_HELPER_3(vpmsumd, void, avr, avr, avr) +DEF_HELPER_2(vextublx, tl, tl, avr) +DEF_HELPER_2(vextuhlx, tl, tl, avr) +DEF_HELPER_2(vextuwlx, tl, tl, avr) +DEF_HELPER_2(vextubrx, tl, tl, avr) +DEF_HELPER_2(vextuhrx, tl, tl, avr) +DEF_HELPER_2(vextuwrx, tl, tl, avr) =20 DEF_HELPER_2(vsbox, void, avr, avr) DEF_HELPER_3(vcipher, void, avr, avr, avr) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 00d04c1..a33b18b 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1773,6 +1773,42 @@ void helper_vlogefp(CPUPPCState *env, ppc_avr_t *r, = ppc_avr_t *b) } } =20 +#if defined(HOST_WORDS_BIGENDIAN) +#define VEXTU_X_DO(name, size, left) \ + target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b) \ + { \ + int index; \ + if (left) { \ + index =3D (a & 0xf) * 8; \ + } else { \ + index =3D ((15 - (a & 0xf) + 1) * 8) - size; \ + } \ + return int128_getlo(int128_rshift(b->s128, index)) & \ + MAKE_64BIT_MASK(0, size); \ + } +#else +#define VEXTU_X_DO(name, size, left) \ + target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b) \ + { \ + int index; \ + if (left) { \ + index =3D ((15 - (a & 0xf) + 1) * 8) - size; \ + } else { \ + index =3D (a & 0xf) * 8; \ + } \ + return int128_getlo(int128_rshift(b->s128, index)) & \ + MAKE_64BIT_MASK(0, size); \ + } +#endif + +VEXTU_X_DO(vextublx, 8, 1) +VEXTU_X_DO(vextuhlx, 16, 1) +VEXTU_X_DO(vextuwlx, 32, 1) +VEXTU_X_DO(vextubrx, 8, 0) +VEXTU_X_DO(vextuhrx, 16, 0) +VEXTU_X_DO(vextuwrx, 32, 0) +#undef VEXTU_X_DO + /* The specification says that the results are undefined if all of the * shift counts are not identical. We check to make sure that they are * to conform to what real hardware appears to do. */ diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index b188e60..e8e527f 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -340,6 +340,19 @@ static void glue(gen_, name0##_##name1)(DisasContext *= ctx) \ } \ } =20 +#define GEN_VXFORM_HETRO(name, opc2, opc3) \ +static void glue(gen_, name)(DisasContext *ctx) \ +{ \ + TCGv_ptr rb; \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + rb =3D gen_avr_ptr(rB(ctx->opcode)); \ + gen_helper_##name(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], = rb); \ + tcg_temp_free_ptr(rb); \ +} + GEN_VXFORM(vaddubm, 0, 0); GEN_VXFORM_DUAL_EXT(vaddubm, PPC_ALTIVEC, PPC_NONE, 0, \ vmul10cuq, PPC_NONE, PPC2_ISA300, 0x0000F800) @@ -525,6 +538,16 @@ GEN_VXFORM_ENV(vaddfp, 5, 0); GEN_VXFORM_ENV(vsubfp, 5, 1); GEN_VXFORM_ENV(vmaxfp, 5, 16); GEN_VXFORM_ENV(vminfp, 5, 17); +GEN_VXFORM_HETRO(vextublx, 6, 24) +GEN_VXFORM_HETRO(vextuhlx, 6, 25) +GEN_VXFORM_HETRO(vextuwlx, 6, 26) +GEN_VXFORM_DUAL(vmrgow, PPC_NONE, PPC2_ALTIVEC_207, + vextuwlx, PPC_NONE, PPC2_ISA300) +GEN_VXFORM_HETRO(vextubrx, 6, 28) +GEN_VXFORM_HETRO(vextuhrx, 6, 29) +GEN_VXFORM_HETRO(vextuwrx, 6, 30) +GEN_VXFORM_DUAL(vmrgew, PPC_NONE, PPC2_ALTIVEC_207, \ + vextuwrx, PPC_NONE, PPC2_ISA300) =20 #define GEN_VXRFORM1(opname, name, str, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) \ diff --git a/target/ppc/translate/vmx-ops.inc.c b/target/ppc/translate/vmx-= ops.inc.c index 70d7d2b..57dce6e 100644 --- a/target/ppc/translate/vmx-ops.inc.c +++ b/target/ppc/translate/vmx-ops.inc.c @@ -91,8 +91,12 @@ GEN_VXFORM(vmrghw, 6, 2), GEN_VXFORM(vmrglb, 6, 4), GEN_VXFORM(vmrglh, 6, 5), GEN_VXFORM(vmrglw, 6, 6), -GEN_VXFORM_207(vmrgew, 6, 30), -GEN_VXFORM_207(vmrgow, 6, 26), +GEN_VXFORM_300(vextublx, 6, 24), +GEN_VXFORM_300(vextuhlx, 6, 25), +GEN_VXFORM_DUAL(vmrgow, vextuwlx, 6, 26, PPC_NONE, PPC2_ALTIVEC_207), +GEN_VXFORM_300(vextubrx, 6, 28), +GEN_VXFORM_300(vextuhrx, 6, 29), +GEN_VXFORM_DUAL(vmrgew, vextuwrx, 6, 30, PPC_NONE, PPC2_ALTIVEC_207), GEN_VXFORM(vmuloub, 4, 0), GEN_VXFORM(vmulouh, 4, 1), GEN_VXFORM_DUAL(vmulouw, vmuluwm, 4, 2, PPC_ALTIVEC, PPC_NONE), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014150834341.6550666693454; Wed, 1 Feb 2017 21:42:30 -0800 (PST) Received: from localhost ([::1]:54344 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAA8-0008D8-LR for importer@patchew.org; Thu, 02 Feb 2017 00:42:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jh-0007BZ-Vk for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9je-0003Wb-03 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:09 -0500 Received: from ozlabs.org ([103.22.144.67]:57319) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jd-0003Tq-7i; Thu, 02 Feb 2017 00:15:05 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqM1qphz9s7X; Thu, 2 Feb 2017 16:14:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012495; bh=sSuKYlrevGw+1df5yGXq1bJBvYUpFtfE4kHXCM9lRAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LJSsa96k/BeZMBN8PVp7RmDNepN7sLwToaWEsv8V9/B9LVOQ6SuhE9P2FJ4y7AIPs Xk+HQF7OFygvw6tGfrHCoK34Qfr0HwqcVGjXmnD+LrOf6dvCNbdTfSaLeQloL7lVQ7 N//b1AxVPSbpj+p3NS05d46CIOSl8a91ALfigSSI= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:13 +1100 Message-Id: <20170202051445.5735-16-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 015/107] pseries: Always use core objects for CPU construction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently the pseries machine has two paths for constructing CPUs. On newer machine type versions, which support cpu hotplug, it constructs cpu core objects, which in turn construct CPU threads. For older machine versions it individually constructs the CPU threads. This division is going to make some future changes to the cpu construction harder, so this patch unifies them. Now cpu core objects are always created. This requires some updates to allow core objects to be created without a full complement of threads (since older versions allowed a number of cpus not a multiple of the threads-per-core). Likewise it needs some changes to the cpu core hot/cold plug path so as not to choke on the old machine types without hotplug support. For good measure, we move the cpu construction to its own subfunction, spapr_init_cpus(). Signed-off-by: David Gibson Reviewed-by: Greg Kurz --- hw/ppc/spapr.c | 125 +++++++++++++++++++++++++++-----------------= ---- hw/ppc/spapr_cpu_core.c | 37 +++++++------- include/hw/ppc/spapr.h | 1 - 3 files changed, 90 insertions(+), 73 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a642e66..cef696c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1753,11 +1753,80 @@ static void spapr_validate_node_memory(MachineState= *machine, Error **errp) } } =20 +static void spapr_init_cpus(sPAPRMachineState *spapr) +{ + MachineState *machine =3D MACHINE(spapr); + MachineClass *mc =3D MACHINE_GET_CLASS(machine); + char *type =3D spapr_get_cpu_core_type(machine->cpu_model); + int smt =3D kvmppc_smt_threads(); + int spapr_max_cores, spapr_cores; + int i; + + if (!type) { + error_report("Unable to find sPAPR CPU Core definition"); + exit(1); + } + + if (mc->query_hotpluggable_cpus) { + if (smp_cpus % smp_threads) { + error_report("smp_cpus (%u) must be multiple of threads (%u)", + smp_cpus, smp_threads); + exit(1); + } + if (max_cpus % smp_threads) { + error_report("max_cpus (%u) must be multiple of threads (%u)", + max_cpus, smp_threads); + exit(1); + } + + spapr_max_cores =3D max_cpus / smp_threads; + spapr_cores =3D smp_cpus / smp_threads; + } else { + if (max_cpus !=3D smp_cpus) { + error_report("This machine version does not support CPU hotplu= g"); + exit(1); + } + + spapr_max_cores =3D QEMU_ALIGN_UP(smp_cpus, smp_threads) / smp_thr= eads; + spapr_cores =3D spapr_max_cores; + } + + spapr->cores =3D g_new0(Object *, spapr_max_cores); + for (i =3D 0; i < spapr_max_cores; i++) { + int core_id =3D i * smp_threads; + + if (mc->query_hotpluggable_cpus) { + sPAPRDRConnector *drc =3D + spapr_dr_connector_new(OBJECT(spapr), + SPAPR_DR_CONNECTOR_TYPE_CPU, + (core_id / smp_threads) * smt); + + qemu_register_reset(spapr_drc_reset, drc); + } + + if (i < spapr_cores) { + Object *core =3D object_new(type); + int nr_threads =3D smp_threads; + + /* Handle the partially filled core for older machine types */ + if ((i + 1) * smp_threads >=3D smp_cpus) { + nr_threads =3D smp_cpus - i * smp_threads; + } + + object_property_set_int(core, nr_threads, "nr-threads", + &error_fatal); + object_property_set_int(core, core_id, CPU_CORE_PROP_CORE_ID, + &error_fatal); + object_property_set_bool(core, true, "realized", &error_fatal); + } + } + g_free(type); +} + /* pSeries LPAR / sPAPR hardware init */ static void ppc_spapr_init(MachineState *machine) { sPAPRMachineState *spapr =3D SPAPR_MACHINE(machine); - MachineClass *mc =3D MACHINE_GET_CLASS(machine); sPAPRMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(machine); const char *kernel_filename =3D machine->kernel_filename; const char *initrd_filename =3D machine->initrd_filename; @@ -1772,21 +1841,6 @@ static void ppc_spapr_init(MachineState *machine) long load_limit, fw_size; char *filename; int smt =3D kvmppc_smt_threads(); - int spapr_cores =3D smp_cpus / smp_threads; - int spapr_max_cores =3D max_cpus / smp_threads; - - if (mc->query_hotpluggable_cpus) { - if (smp_cpus % smp_threads) { - error_report("smp_cpus (%u) must be multiple of threads (%u)", - smp_cpus, smp_threads); - exit(1); - } - if (max_cpus % smp_threads) { - error_report("max_cpus (%u) must be multiple of threads (%u)", - max_cpus, smp_threads); - exit(1); - } - } =20 msi_nonbroken =3D true; =20 @@ -1866,44 +1920,7 @@ static void ppc_spapr_init(MachineState *machine) =20 ppc_cpu_parse_features(machine->cpu_model); =20 - if (mc->query_hotpluggable_cpus) { - char *type =3D spapr_get_cpu_core_type(machine->cpu_model); - - if (type =3D=3D NULL) { - error_report("Unable to find sPAPR CPU Core definition"); - exit(1); - } - - spapr->cores =3D g_new0(Object *, spapr_max_cores); - for (i =3D 0; i < spapr_max_cores; i++) { - int core_id =3D i * smp_threads; - sPAPRDRConnector *drc =3D - spapr_dr_connector_new(OBJECT(spapr), - SPAPR_DR_CONNECTOR_TYPE_CPU, - (core_id / smp_threads) * smt); - - qemu_register_reset(spapr_drc_reset, drc); - - if (i < spapr_cores) { - Object *core =3D object_new(type); - object_property_set_int(core, smp_threads, "nr-threads", - &error_fatal); - object_property_set_int(core, core_id, CPU_CORE_PROP_CORE_= ID, - &error_fatal); - object_property_set_bool(core, true, "realized", &error_fa= tal); - } - } - g_free(type); - } else { - for (i =3D 0; i < smp_cpus; i++) { - PowerPCCPU *cpu =3D cpu_ppc_init(machine->cpu_model); - if (cpu =3D=3D NULL) { - error_report("Unable to find PowerPC CPU definition"); - exit(1); - } - spapr_cpu_init(spapr, cpu, &error_fatal); - } - } + spapr_init_cpus(spapr); =20 if (kvm_enabled()) { /* Enable H_LOGICAL_CI_* so SLOF can talk to in-kernel devices */ diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index c18632b..f532689 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -46,7 +46,8 @@ static void spapr_cpu_destroy(PowerPCCPU *cpu) qemu_unregister_reset(spapr_cpu_reset, cpu); } =20 -void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, Error **err= p) +static void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, + Error **errp) { CPUPPCState *env =3D &cpu->env; CPUState *cs =3D CPU(cpu); @@ -166,11 +167,11 @@ void spapr_core_plug(HotplugHandler *hotplug_dev, Dev= iceState *dev, Error **errp) { sPAPRMachineState *spapr =3D SPAPR_MACHINE(OBJECT(hotplug_dev)); + MachineClass *mc =3D MACHINE_GET_CLASS(spapr); sPAPRCPUCore *core =3D SPAPR_CPU_CORE(OBJECT(dev)); CPUCore *cc =3D CPU_CORE(dev); CPUState *cs =3D CPU(core->threads); sPAPRDRConnector *drc; - sPAPRDRConnectorClass *drck; Error *local_err =3D NULL; void *fdt =3D NULL; int fdt_offset =3D 0; @@ -180,7 +181,7 @@ void spapr_core_plug(HotplugHandler *hotplug_dev, Devic= eState *dev, drc =3D spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, index * = smt); spapr->cores[index] =3D OBJECT(dev); =20 - g_assert(drc); + g_assert(drc || !mc->query_hotpluggable_cpus); =20 /* * Setup CPU DT entries only for hotplugged CPUs. For boot time or @@ -190,13 +191,15 @@ void spapr_core_plug(HotplugHandler *hotplug_dev, Dev= iceState *dev, fdt =3D spapr_populate_hotplug_cpu_dt(cs, &fdt_offset, spapr); } =20 - drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(drc); - drck->attach(drc, dev, fdt, fdt_offset, !dev->hotplugged, &local_err); - if (local_err) { - g_free(fdt); - spapr->cores[index] =3D NULL; - error_propagate(errp, local_err); - return; + if (drc) { + sPAPRDRConnectorClass *drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(drc); + drck->attach(drc, dev, fdt, fdt_offset, !dev->hotplugged, &local_e= rr); + if (local_err) { + g_free(fdt); + spapr->cores[index] =3D NULL; + error_propagate(errp, local_err); + return; + } } =20 if (dev->hotplugged) { @@ -209,8 +212,11 @@ void spapr_core_plug(HotplugHandler *hotplug_dev, Devi= ceState *dev, /* * Set the right DRC states for cold plugged CPU. */ - drck->set_allocation_state(drc, SPAPR_DR_ALLOCATION_STATE_USABLE); - drck->set_isolation_state(drc, SPAPR_DR_ISOLATION_STATE_UNISOLATED= ); + if (drc) { + sPAPRDRConnectorClass *drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(d= rc); + drck->set_allocation_state(drc, SPAPR_DR_ALLOCATION_STATE_USAB= LE); + drck->set_isolation_state(drc, SPAPR_DR_ISOLATION_STATE_UNISOL= ATED); + } } } =20 @@ -227,7 +233,7 @@ void spapr_core_pre_plug(HotplugHandler *hotplug_dev, D= eviceState *dev, char *base_core_type =3D spapr_get_cpu_core_type(machine->cpu_model); const char *type =3D object_get_typename(OBJECT(dev)); =20 - if (!mc->query_hotpluggable_cpus) { + if (dev->hotplugged && !mc->query_hotpluggable_cpus) { error_setg(&local_err, "CPU hotplug not supported for this machine= "); goto out; } @@ -237,11 +243,6 @@ void spapr_core_pre_plug(HotplugHandler *hotplug_dev, = DeviceState *dev, goto out; } =20 - if (cc->nr_threads !=3D smp_threads) { - error_setg(&local_err, "threads must be %d", smp_threads); - goto out; - } - if (cc->core_id % smp_threads) { error_setg(&local_err, "invalid core id %d", cc->core_id); goto out; diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index bd5bcf7..f8d444d 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -614,7 +614,6 @@ void spapr_hotplug_req_add_by_count_indexed(sPAPRDRConn= ectorType drc_type, uint32_t count, uint32_t index= ); void spapr_hotplug_req_remove_by_count_indexed(sPAPRDRConnectorType drc_ty= pe, uint32_t count, uint32_t in= dex); -void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, Error **err= p); void *spapr_populate_hotplug_cpu_dt(CPUState *cs, int *fdt_offset, sPAPRMachineState *spapr); =20 --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486013875870973.3577021520007; Wed, 1 Feb 2017 21:37:55 -0800 (PST) Received: from localhost ([::1]:54317 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZA5i-0003ya-4I for importer@patchew.org; Thu, 02 Feb 2017 00:37:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jh-0007Aj-6p for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9je-0003Wu-4S for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:09 -0500 Received: from ozlabs.org ([103.22.144.67]:55729) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jd-0003UB-Ku; Thu, 02 Feb 2017 00:15:05 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqM5N6kz9s7W; Thu, 2 Feb 2017 16:14:55 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012495; bh=eRP5ASp5RSgnbwlgrKtGPPq2SNy8gz7EMH1TaZBOFmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CazYBnBEjbHJZ7B3IZgHzk+8cCx0LW8crc97hk+Tz5pKZ8T3fRmcGbSxdXrztGpGr gSpU6r1GzD4iE1yoX78/itfmMfQyQwv67KkUUId9Aly1yD3jARe6h0iqOS1iKMrb7P XsKdWKCQS1omqRmS+USq6uCFGjkCZCSA0x7wBAEo= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:14 +1100 Message-Id: <20170202051445.5735-17-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 016/107] pseries: Make cpu_update during CAS unconditional X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" spapr_h_cas_compose_response() includes a cpu_update parameter which controls whether it includes updated information on the CPUs in the device tree fragment returned from the ibm,client-architecture-support (CAS) call. Providing the updated information is essential when CAS has negotiated compatibility options which require different cpu information to be presented to the guest. However, it should be safe to provide in other cases (it will just override the existing data in the device tree with identical data). This simplifies the code by removing the parameter and always providing the cpu update information. Signed-off-by: David Gibson Reviewed-by: Alexey Kardashevskiy --- hw/ppc/spapr.c | 5 +---- hw/ppc/spapr_hcall.c | 8 ++------ include/hw/ppc/spapr.h | 1 - 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index cef696c..ca78e31 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -685,7 +685,6 @@ out: =20 int spapr_h_cas_compose_response(sPAPRMachineState *spapr, target_ulong addr, target_ulong size, - bool cpu_update, sPAPROptionVector *ov5_updates) { void *fdt, *fdt_skel; @@ -704,9 +703,7 @@ int spapr_h_cas_compose_response(sPAPRMachineState *spa= pr, g_free(fdt_skel); =20 /* Fixup cpu nodes */ - if (cpu_update) { - _FDT((spapr_fixup_cpu_dt(fdt, spapr))); - } + _FDT((spapr_fixup_cpu_dt(fdt, spapr))); =20 if (spapr_dt_cas_updates(spapr, fdt, ov5_updates)) { return -1; diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index b2a8e48..1333110 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -945,7 +945,7 @@ static target_ulong h_client_architecture_support(Power= PCCPU *cpu_, target_ulong ov_table; PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu_); CPUState *cs; - bool cpu_match =3D false, cpu_update =3D true; + bool cpu_match =3D false; unsigned old_cpu_version =3D cpu_->cpu_version; unsigned compat_lvl =3D 0, cpu_version =3D 0; unsigned max_lvl =3D get_compat_level(cpu_->max_compat); @@ -999,10 +999,6 @@ static target_ulong h_client_architecture_support(Powe= rPCCPU *cpu_, } } =20 - if (!cpu_version) { - cpu_update =3D false; - } - /* For the future use: here @ov_table points to the first option vecto= r */ ov_table =3D list; =20 @@ -1028,7 +1024,7 @@ static target_ulong h_client_architecture_support(Pow= erPCCPU *cpu_, =20 if (!spapr->cas_reboot) { spapr->cas_reboot =3D - (spapr_h_cas_compose_response(spapr, args[1], args[2], cpu_upd= ate, + (spapr_h_cas_compose_response(spapr, args[1], args[2], ov5_updates) !=3D 0); } spapr_ovec_cleanup(ov5_updates); diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index f8d444d..04d2821 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -589,7 +589,6 @@ void spapr_events_init(sPAPRMachineState *sm); void spapr_dt_events(sPAPRMachineState *sm, void *fdt); int spapr_h_cas_compose_response(sPAPRMachineState *sm, target_ulong addr, target_ulong size, - bool cpu_update, sPAPROptionVector *ov5_updates); sPAPRTCETable *spapr_tce_new_table(DeviceState *owner, uint32_t liobn); void spapr_tce_table_enable(sPAPRTCETable *tcet, --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014112259398.1904128039023; Wed, 1 Feb 2017 21:41:52 -0800 (PST) Received: from localhost ([::1]:54342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZA9W-0007Kn-6F for importer@patchew.org; Thu, 02 Feb 2017 00:41:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jj-0007Fa-KX for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jg-0003aD-3E for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:11 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:37117) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jf-0003VN-7I; Thu, 02 Feb 2017 00:15:07 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqN2X3Rz9s7d; Thu, 2 Feb 2017 16:14:55 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012496; bh=uoCwJ+WVAqOEBqpTHDZYdXHN1UKOBbf0ldsnVKanNjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J5BR2/PjzJOddPnon5kgl5hZSLOQmQcRru+mrxYi29CO69+5n0tuj2cBmogGHKSeP 3d4/D7+/wzhejcLthvu9nBOzIO9v50FiqS7TMHZJij6Hq8xk/E8KcVFl8bjNYBMILZ AQe2U0vaqX8VF0kW35iGhmnwPV2KF4FRmuC4MFe8= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:15 +1100 Message-Id: <20170202051445.5735-18-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 017/107] ppc: Clean up and QOMify hypercall emulation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The pseries machine type is a bit unusual in that it runs a paravirtualized guest. The guest expects to interact with a hypervisor, and qemu emulates the functions of that hypervisor directly, rather than executing hypervisor code within the emulated system. To implement this in TCG, we need to intercept hypercall instructions and direct them to the machine's hypercall handlers, rather than attempting to perform a privilege change within TCG. This is controlled by a global hook - cpu_ppc_hypercall. This cleanup makes the handling a little cleaner and more extensible than a single global variable. Instead, each CPU to have hypercalls intercepted has a pointer set to a QOM object implementing a new virtual hypervisor interface. A method in that interface is called by TCG when it sees a hypercall instruction. It's possible we may want to add other methods in future. Signed-off-by: David Gibson Reviewed-by: Alexey Kardashevskiy --- hw/ppc/spapr.c | 8 +++++--- hw/ppc/spapr_cpu_core.c | 1 + target/ppc/cpu.h | 26 ++++++++++++++++++++++++-- target/ppc/excp_helper.c | 11 ++++------- target/ppc/translate_init.c | 12 ++++++++++++ 5 files changed, 46 insertions(+), 12 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index ca78e31..a4774fb 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1005,7 +1005,8 @@ static uint64_t translate_kernel_address(void *opaque= , uint64_t addr) return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR; } =20 -static void emulate_spapr_hypercall(PowerPCCPU *cpu) +static void emulate_spapr_hypercall(PPCVirtualHypervisor *vhyp, + PowerPCCPU *cpu) { CPUPPCState *env =3D &cpu->env; =20 @@ -1843,8 +1844,6 @@ static void ppc_spapr_init(MachineState *machine) =20 QLIST_INIT(&spapr->phbs); =20 - cpu_ppc_hypercall =3D emulate_spapr_hypercall; - /* Allocate RMA if necessary */ rma_alloc_size =3D kvmppc_alloc_rma(&rma); =20 @@ -2680,6 +2679,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) FWPathProviderClass *fwc =3D FW_PATH_PROVIDER_CLASS(oc); NMIClass *nc =3D NMI_CLASS(oc); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); + PPCVirtualHypervisorClass *vhc =3D PPC_VIRTUAL_HYPERVISOR_CLASS(oc); =20 mc->desc =3D "pSeries Logical Partition (PAPR compliant)"; =20 @@ -2711,6 +2711,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) fwc->get_dev_path =3D spapr_get_fw_dev_path; nc->nmi_monitor_handler =3D spapr_nmi; smc->phb_placement =3D spapr_phb_placement; + vhc->hypercall =3D emulate_spapr_hypercall; } =20 static const TypeInfo spapr_machine_info =3D { @@ -2726,6 +2727,7 @@ static const TypeInfo spapr_machine_info =3D { { TYPE_FW_PATH_PROVIDER }, { TYPE_NMI }, { TYPE_HOTPLUG_HANDLER }, + { TYPE_PPC_VIRTUAL_HYPERVISOR }, { } }, }; diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index f532689..9dddaeb 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -57,6 +57,7 @@ static void spapr_cpu_init(sPAPRMachineState *spapr, Powe= rPCCPU *cpu, cpu_ppc_tb_init(env, SPAPR_TIMEBASE_FREQ); =20 /* Enable PAPR mode in TCG or KVM */ + cpu_ppc_set_vhyp(cpu, PPC_VIRTUAL_HYPERVISOR(spapr)); cpu_ppc_set_papr(cpu); =20 if (cpu->max_compat) { diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 7a6ee3f..4fb4c20 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1150,6 +1150,9 @@ do { \ env->wdt_period[3] =3D (d_); \ } while (0) =20 +typedef struct PPCVirtualHypervisor PPCVirtualHypervisor; +typedef struct PPCVirtualHypervisorClass PPCVirtualHypervisorClass; + /** * PowerPCCPU: * @env: #CPUPPCState @@ -1168,6 +1171,7 @@ struct PowerPCCPU { int cpu_dt_id; uint32_t max_compat; uint32_t cpu_version; + PPCVirtualHypervisor *vhyp; =20 /* Fields related to migration compatibility hacks */ bool pre_2_8_migration; @@ -1189,6 +1193,25 @@ static inline PowerPCCPU *ppc_env_get_cpu(CPUPPCStat= e *env) PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr); PowerPCCPUClass *ppc_cpu_class_by_pvr_mask(uint32_t pvr); =20 +struct PPCVirtualHypervisor { + Object parent; +}; + +struct PPCVirtualHypervisorClass { + InterfaceClass parent; + void (*hypercall)(PPCVirtualHypervisor *vhyp, PowerPCCPU *cpu); +}; + +#define TYPE_PPC_VIRTUAL_HYPERVISOR "ppc-virtual-hypervisor" +#define PPC_VIRTUAL_HYPERVISOR(obj) \ + OBJECT_CHECK(PPCVirtualHypervisor, (obj), TYPE_PPC_VIRTUAL_HYPERVISOR) +#define PPC_VIRTUAL_HYPERVISOR_CLASS(klass) \ + OBJECT_CLASS_CHECK(PPCVirtualHypervisorClass, (klass), \ + TYPE_PPC_VIRTUAL_HYPERVISOR) +#define PPC_VIRTUAL_HYPERVISOR_GET_CLASS(obj) \ + OBJECT_GET_CLASS(PPCVirtualHypervisorClass, (obj), \ + TYPE_PPC_VIRTUAL_HYPERVISOR) + void ppc_cpu_do_interrupt(CPUState *cpu); bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req); void ppc_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprin= tf, @@ -1261,6 +1284,7 @@ void store_booke_tcr (CPUPPCState *env, target_ulong = val); void store_booke_tsr (CPUPPCState *env, target_ulong val); void ppc_tlb_invalidate_all (CPUPPCState *env); void ppc_tlb_invalidate_one (CPUPPCState *env, target_ulong addr); +void cpu_ppc_set_vhyp(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp); void cpu_ppc_set_papr(PowerPCCPU *cpu); #endif #endif @@ -2435,8 +2459,6 @@ static inline bool lsw_reg_in_range(int start, int nr= egs, int rx) (start + nregs > 32 && (rx >=3D start || rx < start + nregs - 3= 2)); } =20 -extern void (*cpu_ppc_hypercall)(PowerPCCPU *); - void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env); =20 /** diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 93369d4..f4ee7aa 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -35,11 +35,6 @@ #endif =20 /*************************************************************************= ****/ -/* PowerPC Hypercall emulation */ - -void (*cpu_ppc_hypercall)(PowerPCCPU *); - -/*************************************************************************= ****/ /* Exception processing */ #if defined(CONFIG_USER_ONLY) void ppc_cpu_do_interrupt(CPUState *cs) @@ -318,8 +313,10 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int e= xcp_model, int excp) env->nip +=3D 4; =20 /* "PAPR mode" built-in hypercall emulation */ - if ((lev =3D=3D 1) && cpu_ppc_hypercall) { - cpu_ppc_hypercall(cpu); + if ((lev =3D=3D 1) && cpu->vhyp) { + PPCVirtualHypervisorClass *vhc =3D + PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp); + vhc->hypercall(cpu->vhyp, cpu); return; } if (lev =3D=3D 1) { diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 94dfcd7..2e921ca 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -8857,6 +8857,11 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) =20 #if !defined(CONFIG_USER_ONLY) =20 +void cpu_ppc_set_vhyp(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp) +{ + cpu->vhyp =3D vhyp; +} + void cpu_ppc_set_papr(PowerPCCPU *cpu) { CPUPPCState *env =3D &cpu->env; @@ -10591,9 +10596,16 @@ static const TypeInfo ppc_cpu_type_info =3D { .class_init =3D ppc_cpu_class_init, }; =20 +static const TypeInfo ppc_vhyp_type_info =3D { + .name =3D TYPE_PPC_VIRTUAL_HYPERVISOR, + .parent =3D TYPE_INTERFACE, + .class_size =3D sizeof(PPCVirtualHypervisorClass), +}; + static void ppc_cpu_register_types(void) { type_register_static(&ppc_cpu_type_info); + type_register_static(&ppc_vhyp_type_info); } =20 type_init(ppc_cpu_register_types) --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014065660236.62629073100584; Wed, 1 Feb 2017 21:41:05 -0800 (PST) Received: from localhost ([::1]:54339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZA8l-0006h0-FG for importer@patchew.org; Thu, 02 Feb 2017 00:41:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jk-0007GB-3C for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jf-0003Zs-Mt for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:11 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:46133) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9je-0003Um-S8; Thu, 02 Feb 2017 00:15:07 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqM6l1dz9s7f; Thu, 2 Feb 2017 16:14:55 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012495; bh=Z5jAY7YdAbwQ0Uu5EqiJYEY+cJdj+m9U/ftiCXP7M5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hy/o/Xt+JCx+NgRYHiQmiTkZhfy7bstDpJHFunzfm1BF+x1nKcZR7AIZnzFXMpyqM j97xLrFiby/hPKSkA6fISmGlYrHbpwdvW07jQqB4ZADuTNuNO7Nd86yDFLAQQzo4EL b6IC+xHxDrL7Sf0YlXOvLNhFbge4EPjPiUWsRTUU= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:16 +1100 Message-Id: <20170202051445.5735-19-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 018/107] ppc: Rename cpu_version to compat_pvr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The 'cpu_version' field in PowerPCCPU is badly named. It's named after the 'cpu-version' device tree property where it is advertised, but that meaning may not be obvious in most places it appears. Worse, it doesn't even really correspond to that device tree property. The property contains either the processor's PVR, or, if the CPU is running in a compatibility mode, a special "logical PVR" representing which mode. Rename the cpu_version field, and a number of related variables to compat_pvr to make this clearer. Signed-off-by: David Gibson Reviewed-by: Alexey Kardashevskiy Reviewed-by: Thomas Huth --- hw/ppc/spapr.c | 4 ++-- hw/ppc/spapr_hcall.c | 30 +++++++++++++++--------------- target/ppc/cpu.h | 6 +++--- target/ppc/kvm.c | 4 ++-- target/ppc/kvm_ppc.h | 4 ++-- target/ppc/translate_init.c | 10 +++++----- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a4774fb..cd95435 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -148,8 +148,8 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset= , PowerPCCPU *cpu, uint32_t gservers_prop[smt_threads * 2]; int index =3D ppc_get_vcpu_dt_id(cpu); =20 - if (cpu->cpu_version) { - ret =3D fdt_setprop_cell(fdt, offset, "cpu-version", cpu->cpu_vers= ion); + if (cpu->compat_pvr) { + ret =3D fdt_setprop_cell(fdt, offset, "cpu-version", cpu->compat_p= vr); if (ret < 0) { return ret; } diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 1333110..4fbcb03 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -882,7 +882,7 @@ static target_ulong h_set_mode(PowerPCCPU *cpu, sPAPRMa= chineState *spapr, } =20 typedef struct { - uint32_t cpu_version; + uint32_t compat_pvr; Error *err; } SetCompatState; =20 @@ -892,7 +892,7 @@ static void do_set_compat(CPUState *cs, run_on_cpu_data= arg) SetCompatState *s =3D arg.host_ptr; =20 cpu_synchronize_state(cs); - ppc_set_compat(cpu, s->cpu_version, &s->err); + ppc_set_compat(cpu, s->compat_pvr, &s->err); } =20 #define get_compat_level(cpuver) ( \ @@ -903,7 +903,7 @@ static void do_set_compat(CPUState *cs, run_on_cpu_data= arg) =20 static void cas_handle_compat_cpu(PowerPCCPUClass *pcc, uint32_t pvr, unsigned max_lvl, unsigned *compat_lvl, - unsigned *cpu_version) + unsigned *compat_pvr) { unsigned lvl =3D get_compat_level(pvr); bool is205, is206, is207; @@ -926,12 +926,12 @@ static void cas_handle_compat_cpu(PowerPCCPUClass *pc= c, uint32_t pvr, /* User did not set the level, choose the highest */ if (*compat_lvl <=3D lvl) { *compat_lvl =3D lvl; - *cpu_version =3D pvr; + *compat_pvr =3D pvr; } } else if (max_lvl >=3D lvl) { /* User chose the level, don't set higher than this */ *compat_lvl =3D lvl; - *cpu_version =3D pvr; + *compat_pvr =3D pvr; } } } @@ -946,8 +946,8 @@ static target_ulong h_client_architecture_support(Power= PCCPU *cpu_, PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu_); CPUState *cs; bool cpu_match =3D false; - unsigned old_cpu_version =3D cpu_->cpu_version; - unsigned compat_lvl =3D 0, cpu_version =3D 0; + unsigned old_compat_pvr =3D cpu_->compat_pvr; + unsigned compat_lvl =3D 0, compat_pvr =3D 0; unsigned max_lvl =3D get_compat_level(cpu_->max_compat); int counter; sPAPROptionVector *ov5_guest, *ov5_cas_old, *ov5_updates; @@ -965,12 +965,12 @@ static target_ulong h_client_architecture_support(Pow= erPCCPU *cpu_, if (!max_lvl && ((cpu_->env.spr[SPR_PVR] & pvr_mask) =3D=3D (pvr & pvr_mask)))= { cpu_match =3D true; - cpu_version =3D 0; - } else if (pvr =3D=3D cpu_->cpu_version) { + compat_pvr =3D 0; + } else if (pvr =3D=3D cpu_->compat_pvr) { cpu_match =3D true; - cpu_version =3D cpu_->cpu_version; + compat_pvr =3D cpu_->compat_pvr; } else if (!cpu_match) { - cas_handle_compat_cpu(pcc, pvr, max_lvl, &compat_lvl, &cpu_ver= sion); + cas_handle_compat_cpu(pcc, pvr, max_lvl, &compat_lvl, &compat_= pvr); } /* Terminator record */ if (~pvr_mask & pvr) { @@ -979,14 +979,14 @@ static target_ulong h_client_architecture_support(Pow= erPCCPU *cpu_, } =20 /* Parsing finished */ - trace_spapr_cas_pvr(cpu_->cpu_version, cpu_match, - cpu_version, pcc->pcr_mask); + trace_spapr_cas_pvr(cpu_->compat_pvr, cpu_match, + compat_pvr, pcc->pcr_mask); =20 /* Update CPUs */ - if (old_cpu_version !=3D cpu_version) { + if (old_compat_pvr !=3D compat_pvr) { CPU_FOREACH(cs) { SetCompatState s =3D { - .cpu_version =3D cpu_version, + .compat_pvr =3D compat_pvr, .err =3D NULL, }; =20 diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 4fb4c20..b62f775 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1158,7 +1158,7 @@ typedef struct PPCVirtualHypervisorClass PPCVirtualHy= pervisorClass; * @env: #CPUPPCState * @cpu_dt_id: CPU index used in the device tree. KVM uses this index too * @max_compat: Maximal supported logical PVR from the command line - * @cpu_version: Current logical PVR, zero if in "raw" mode + * @compat_pvr: Current logical PVR, zero if in "raw" mode * * A PowerPC CPU. */ @@ -1170,7 +1170,7 @@ struct PowerPCCPU { CPUPPCState env; int cpu_dt_id; uint32_t max_compat; - uint32_t cpu_version; + uint32_t compat_pvr; PPCVirtualHypervisor *vhyp; =20 /* Fields related to migration compatibility hacks */ @@ -1252,7 +1252,7 @@ void ppc_store_msr (CPUPPCState *env, target_ulong va= lue); void ppc_cpu_list (FILE *f, fprintf_function cpu_fprintf); int ppc_get_compat_smt_threads(PowerPCCPU *cpu); #if defined(TARGET_PPC64) -void ppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_version, Error **errp); +void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp); #endif =20 /* Time-base and decrementer management */ diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index ec92c64..e69fca8 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2108,9 +2108,9 @@ void kvmppc_set_papr(PowerPCCPU *cpu) cap_papr =3D 1; } =20 -int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_version) +int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr) { - return kvm_set_one_reg(CPU(cpu), KVM_REG_PPC_ARCH_COMPAT, &cpu_version= ); + return kvm_set_one_reg(CPU(cpu), KVM_REG_PPC_ARCH_COMPAT, &compat_pvr); } =20 void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy) diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h index 4b43283..151c00b 100644 --- a/target/ppc/kvm_ppc.h +++ b/target/ppc/kvm_ppc.h @@ -26,7 +26,7 @@ void kvmppc_enable_logical_ci_hcalls(void); void kvmppc_enable_set_mode_hcall(void); void kvmppc_enable_clear_ref_mod_hcalls(void); void kvmppc_set_papr(PowerPCCPU *cpu); -int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_version); +int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr); void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy); int kvmppc_smt_threads(void); int kvmppc_clear_tsr_bits(PowerPCCPU *cpu, uint32_t tsr_bits); @@ -123,7 +123,7 @@ static inline void kvmppc_set_papr(PowerPCCPU *cpu) { } =20 -static inline int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_version) +static inline int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr) { return 0; } diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 2e921ca..f6b08e7 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -9957,7 +9957,7 @@ int ppc_get_compat_smt_threads(PowerPCCPU *cpu) CPUState *cs =3D CPU(cpu); int ret =3D MIN(cs->nr_threads, kvmppc_smt_threads()); =20 - switch (cpu->cpu_version) { + switch (cpu->compat_pvr) { case CPU_POWERPC_LOGICAL_2_05: ret =3D MIN(ret, 2); break; @@ -9973,15 +9973,15 @@ int ppc_get_compat_smt_threads(PowerPCCPU *cpu) } =20 #ifdef TARGET_PPC64 -void ppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_version, Error **errp) +void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp) { int ret =3D 0; CPUPPCState *env =3D &cpu->env; PowerPCCPUClass *host_pcc; =20 - cpu->cpu_version =3D cpu_version; + cpu->compat_pvr =3D compat_pvr; =20 - switch (cpu_version) { + switch (compat_pvr) { case CPU_POWERPC_LOGICAL_2_05: env->spr[SPR_PCR] =3D PCR_TM_DIS | PCR_VSX_DIS | PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_COMPAT_2_05; @@ -10004,7 +10004,7 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_v= ersion, Error **errp) } =20 if (kvm_enabled()) { - ret =3D kvmppc_set_compat(cpu, cpu->cpu_version); + ret =3D kvmppc_set_compat(cpu, cpu->compat_pvr); if (ret < 0) { error_setg_errno(errp, -ret, "Unable to set CPU compatibility mode in KVM"= ); --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486013565871625.265312447564; Wed, 1 Feb 2017 21:32:45 -0800 (PST) Received: from localhost ([::1]:54291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZA0h-00077r-VH for importer@patchew.org; Thu, 02 Feb 2017 00:32:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9ji-0007Bq-40 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jf-0003Zh-KE for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:10 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:54809) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jf-0003V4-2D; Thu, 02 Feb 2017 00:15:07 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqN14bDz9s7c; Thu, 2 Feb 2017 16:14:55 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012496; bh=4VHy6PfgR2p1d9vjtcm2W/LcPoCejSuakTea4qTVGhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N8IoOEf+GHSKsmmeZ7msABiBtjrounWXUI0qhW3K0lQFtH+t09KtqkOkJfYNXhROP kQYcS4FW6rqprmh4GwgDyVr58mQOYIyI54l7uB+cHQw4HY/VFnWSZo7Cr2mLvqgnEs igTmwBer0/Eux+W5rd4wCyZTS7yJDli3X73MO8o4= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:17 +1100 Message-Id: <20170202051445.5735-20-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 019/107] ppc/spapr: implement H_SIGNAL_SYS_RESET X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, Nicholas Piggin , agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nicholas Piggin The H_SIGNAL_SYS_RESET hcall allows a guest CPU to raise a system reset exception on CPUs within the same guest -- all CPUs, all-but-self, or a specific CPU (including self). This has not made its way to a PAPR release yet, but we have an hcall number assigned. H_SIGNAL_SYS_RESET =3D 0x380 Syntax: hcall(uint64 H_SIGNAL_SYS_RESET, int64 target); Generate a system reset NMI on the threads indicated by target. Values for target: -1 =3D target all online threads including the caller -2 =3D target all online threads except for the caller All other negative values: reserved Positive values: The thread to be targeted, obtained from the value of the "ibm,ppc-interrupt-server#s" property of the CPU in the OF device tree. Semantics: - Invalid target: return H_Parameter. - Otherwise: Generate a system reset NMI on target thread(s), return H_Success. Signed-off-by: Nicholas Piggin Signed-off-by: David Gibson --- hw/ppc/spapr.c | 4 ++-- hw/ppc/spapr_hcall.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 5 ++++- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index cd95435..74419f8 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2265,7 +2265,7 @@ static void spapr_machine_finalizefn(Object *obj) g_free(spapr->kvm_type); } =20 -static void ppc_cpu_do_nmi_on_cpu(CPUState *cs, run_on_cpu_data arg) +void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg) { cpu_synchronize_state(cs); ppc_cpu_do_system_reset(cs); @@ -2276,7 +2276,7 @@ static void spapr_nmi(NMIState *n, int cpu_index, Err= or **errp) CPUState *cs; =20 CPU_FOREACH(cs) { - async_run_on_cpu(cs, ppc_cpu_do_nmi_on_cpu, RUN_ON_CPU_NULL); + async_run_on_cpu(cs, spapr_do_system_reset_on_cpu, RUN_ON_CPU_NULL= ); } } =20 diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 4fbcb03..51681f3 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -881,6 +881,46 @@ static target_ulong h_set_mode(PowerPCCPU *cpu, sPAPRM= achineState *spapr, return ret; } =20 +#define H_SIGNAL_SYS_RESET_ALL -1 +#define H_SIGNAL_SYS_RESET_ALLBUTSELF -2 + +static target_ulong h_signal_sys_reset(PowerPCCPU *cpu, + sPAPRMachineState *spapr, + target_ulong opcode, target_ulong *= args) +{ + target_long target =3D args[0]; + CPUState *cs; + + if (target < 0) { + /* Broadcast */ + if (target < H_SIGNAL_SYS_RESET_ALLBUTSELF) { + return H_PARAMETER; + } + + CPU_FOREACH(cs) { + PowerPCCPU *c =3D POWERPC_CPU(cs); + + if (target =3D=3D H_SIGNAL_SYS_RESET_ALLBUTSELF) { + if (c =3D=3D cpu) { + continue; + } + } + run_on_cpu(cs, spapr_do_system_reset_on_cpu, RUN_ON_CPU_NULL); + } + return H_SUCCESS; + + } else { + /* Unicast */ + CPU_FOREACH(cs) { + if (cpu->cpu_dt_id =3D=3D target) { + run_on_cpu(cs, spapr_do_system_reset_on_cpu, RUN_ON_CPU_NU= LL); + return H_SUCCESS; + } + } + return H_PARAMETER; + } +} + typedef struct { uint32_t compat_pvr; Error *err; @@ -1097,6 +1137,7 @@ static void hypercall_register_types(void) /* hcall-splpar */ spapr_register_hypercall(H_REGISTER_VPA, h_register_vpa); spapr_register_hypercall(H_CEDE, h_cede); + spapr_register_hypercall(H_SIGNAL_SYS_RESET, h_signal_sys_reset); =20 /* processor register resource access h-calls */ spapr_register_hypercall(H_SET_SPRG0, h_set_sprg0); diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 04d2821..a2d8964 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -347,7 +347,8 @@ struct sPAPRMachineState { #define H_XIRR_X 0x2FC #define H_RANDOM 0x300 #define H_SET_MODE 0x31C -#define MAX_HCALL_OPCODE H_SET_MODE +#define H_SIGNAL_SYS_RESET 0x380 +#define MAX_HCALL_OPCODE H_SIGNAL_SYS_RESET =20 /* The hcalls above are standardized in PAPR and implemented by pHyp * as well. @@ -660,4 +661,6 @@ int spapr_rng_populate_dt(void *fdt); #define SPAPR_LMB_FLAGS_DRC_INVALID 0x00000020 #define SPAPR_LMB_FLAGS_RESERVED 0x00000080 =20 +void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg); + #endif /* HW_SPAPR_H */ --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486013235304201.62222540204414; Wed, 1 Feb 2017 21:27:15 -0800 (PST) Received: from localhost ([::1]:54262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9vN-0001Ii-AJ for importer@patchew.org; Thu, 02 Feb 2017 00:27:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jg-0007A5-Fi for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9je-0003Xi-Kd for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:08 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:48311) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9je-0003UN-49; Thu, 02 Feb 2017 00:15:06 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqM65rFz9s7Z; Thu, 2 Feb 2017 16:14:55 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012495; bh=XDoUscmk4lYBRjWEFX/cVZ5Wqdj13C7aPrhotdyMWe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ons7yOY7y2/yjuNc6PhoqrkfSHsPFyrNyI43ZWTVCgB6VudlUAcBoZS+/1zKvXrwA DzCHLORTsaetExrK9U+VXf64KvkvFbbOLKoH8Z+Rm0OLkW4OOqHe+VusQDy8rPR6uN L9yfRCHxw6t/ugjUtWaaNHT+ZqLPd41tIoIsgxcw= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:18 +1100 Message-Id: <20170202051445.5735-21-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 020/107] target-ppc: move ppc_vsr_t to common header X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania The structure and corresponding defines and functions need to be used outside of fpu_helper.c as well. Add u8, u16, u32 and Int128 to the structure. Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 37 ------------------------------------- target/ppc/internal.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 37 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 696f537..3b867cf 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -1777,43 +1777,6 @@ uint32_t helper_efdcmpeq(CPUPPCState *env, uint64_t = op1, uint64_t op2) return helper_efdtsteq(env, op1, op2); } =20 -typedef union _ppc_vsr_t { - uint64_t u64[2]; - uint32_t u32[4]; - float32 f32[4]; - float64 f64[2]; -} ppc_vsr_t; - -#if defined(HOST_WORDS_BIGENDIAN) -#define VsrW(i) u32[i] -#define VsrD(i) u64[i] -#else -#define VsrW(i) u32[3-(i)] -#define VsrD(i) u64[1-(i)] -#endif - -static void getVSR(int n, ppc_vsr_t *vsr, CPUPPCState *env) -{ - if (n < 32) { - vsr->VsrD(0) =3D env->fpr[n]; - vsr->VsrD(1) =3D env->vsr[n]; - } else { - vsr->u64[0] =3D env->avr[n-32].u64[0]; - vsr->u64[1] =3D env->avr[n-32].u64[1]; - } -} - -static void putVSR(int n, ppc_vsr_t *vsr, CPUPPCState *env) -{ - if (n < 32) { - env->fpr[n] =3D vsr->VsrD(0); - env->vsr[n] =3D vsr->VsrD(1); - } else { - env->avr[n-32].u64[0] =3D vsr->u64[0]; - env->avr[n-32].u64[1] =3D vsr->u64[1]; - } -} - #define float64_to_float64(x, env) x =20 =20 diff --git a/target/ppc/internal.h b/target/ppc/internal.h index e83ea45..66cde46 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -199,4 +199,46 @@ EXTRACT_HELPER(SHW, 8, 2); EXTRACT_HELPER(SP, 19, 2); EXTRACT_HELPER(IMM8, 11, 8); =20 +typedef union _ppc_vsr_t { + uint8_t u8[16]; + uint16_t u16[8]; + uint32_t u32[4]; + uint64_t u64[2]; + float32 f32[4]; + float64 f64[2]; + Int128 s128; +} ppc_vsr_t; + +#if defined(HOST_WORDS_BIGENDIAN) +#define VsrB(i) u8[i] +#define VsrW(i) u32[i] +#define VsrD(i) u64[i] +#else +#define VsrB(i) u8[15 - (i)] +#define VsrW(i) u32[3 - (i)] +#define VsrD(i) u64[1 - (i)] +#endif + +static inline void getVSR(int n, ppc_vsr_t *vsr, CPUPPCState *env) +{ + if (n < 32) { + vsr->VsrD(0) =3D env->fpr[n]; + vsr->VsrD(1) =3D env->vsr[n]; + } else { + vsr->u64[0] =3D env->avr[n - 32].u64[0]; + vsr->u64[1] =3D env->avr[n - 32].u64[1]; + } +} + +static inline void putVSR(int n, ppc_vsr_t *vsr, CPUPPCState *env) +{ + if (n < 32) { + env->fpr[n] =3D vsr->VsrD(0); + env->vsr[n] =3D vsr->VsrD(1); + } else { + env->avr[n - 32].u64[0] =3D vsr->u64[0]; + env->avr[n - 32].u64[1] =3D vsr->u64[1]; + } +} + #endif /* PPC_INTERNAL_H */ --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486013534621617.9228966748225; Wed, 1 Feb 2017 21:32:14 -0800 (PST) Received: from localhost ([::1]:54290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZA0C-0006CC-O7 for importer@patchew.org; Thu, 02 Feb 2017 00:32:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jk-0007GA-28 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9ji-0003dr-8C for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:12 -0500 Received: from ozlabs.org ([103.22.144.67]:53641) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jh-0003a3-Ph; Thu, 02 Feb 2017 00:15:10 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqP1RTrz9s7m; Thu, 2 Feb 2017 16:14:55 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012497; bh=JftVfOBYayvv58TZG6RF5LnD07UZXL9PXRk99mR4WXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PpIJ6k0VRjr2LG3V0iZtbKWbDaWSbBkPUjmzDodODsooG2bfBqN2ZSFpBmWFWbvBr LPz2SBAi69LXpbaWY9B33H/2Yo9AF8XLNxoWi2g/ojFKA/BywoTAtwSfU+OKzSDNsc FhStMTaE9ljNz5UeizCtNjuuLilFV5ffvl4YjqWQ= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:19 +1100 Message-Id: <20170202051445.5735-22-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 021/107] target-ppc: implement stop instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania Use the nap code. Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 87fc153..772929e 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -3172,6 +3172,11 @@ static void gen_nap(DisasContext *ctx) #endif /* defined(CONFIG_USER_ONLY) */ } =20 +static void gen_stop(DisasContext *ctx) +{ + gen_nap(ctx); +} + static void gen_sleep(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) @@ -6240,6 +6245,7 @@ GEN_HANDLER(mcrf, 0x13, 0x00, 0xFF, 0x00000001, PPC_I= NTEGER), GEN_HANDLER(rfi, 0x13, 0x12, 0x01, 0x03FF8001, PPC_FLOW), #if defined(TARGET_PPC64) GEN_HANDLER(rfid, 0x13, 0x12, 0x00, 0x03FF8001, PPC_64B), +GEN_HANDLER_E(stop, 0x13, 0x12, 0x0b, 0x03FFF801, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(doze, 0x13, 0x12, 0x0c, 0x03FFF801, PPC_NONE, PPC2_PM_ISA206= ), GEN_HANDLER_E(nap, 0x13, 0x12, 0x0d, 0x03FFF801, PPC_NONE, PPC2_PM_ISA206), GEN_HANDLER_E(sleep, 0x13, 0x12, 0x0e, 0x03FFF801, PPC_NONE, PPC2_PM_ISA20= 6), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486013839891415.223264153198; Wed, 1 Feb 2017 21:37:19 -0800 (PST) Received: from localhost ([::1]:54315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZA56-0002rk-RX for importer@patchew.org; Thu, 02 Feb 2017 00:37:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51279) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jj-0007G1-UO for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jh-0003cI-Bc for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:11 -0500 Received: from ozlabs.org ([103.22.144.67]:60999) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jg-0003XU-To; Thu, 02 Feb 2017 00:15:09 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqN5hvWz9s7n; Thu, 2 Feb 2017 16:14:55 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012496; bh=kqZe4VMzx/B5XC8Bh4aXsDmdOtz7uHJnR0YRVcbmM+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J5f6Fu5D1k4KxGGCc6il3IYCY7kslnUEYRhG4+4/S9pvv8rkb5jVBMHlOafT66EhF rX3ZotGeLsog3YYPc8iIIuTGMZU16zKtQqhSZyV1EFp69xWCXvO1RaBvWRqQTFid9c CYe91PH13Y4xDkOSXEtJkxbE3BLlQ0Zx4K+CCGAw= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:20 +1100 Message-Id: <20170202051445.5735-23-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 022/107] target-ppc: implement xsabsqp/xsnabsqp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" xsabsqp: VSX Scalar Absolute Quad-Precision xsnabsqp: VSX Scalar Negative Absolute Quad-Precision Signed-off-by: Nikunj A Dadhania Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 35 +++++++++++++++++++++++++++++++++= ++ target/ppc/translate/vsx-ops.inc.c | 5 +++++ 2 files changed, 40 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 2fbdbd2..808ee48 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -609,6 +609,41 @@ VSX_SCALAR_MOVE(xsnabsdp, OP_NABS, SGN_MASK_DP) VSX_SCALAR_MOVE(xsnegdp, OP_NEG, SGN_MASK_DP) VSX_SCALAR_MOVE(xscpsgndp, OP_CPSGN, SGN_MASK_DP) =20 +#define VSX_SCALAR_MOVE_QP(name, op, sgn_mask) \ +static void glue(gen_, name)(DisasContext *ctx) \ +{ \ + int xt =3D rD(ctx->opcode) + 32; \ + int xb =3D rB(ctx->opcode) + 32; \ + TCGv_i64 xbh, xbl, sgm; \ + \ + if (unlikely(!ctx->vsx_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VSXU); \ + return; \ + } \ + xbh =3D tcg_temp_new_i64(); \ + xbl =3D tcg_temp_new_i64(); \ + sgm =3D tcg_temp_new_i64(); \ + tcg_gen_mov_i64(xbh, cpu_vsrh(xb)); \ + tcg_gen_mov_i64(xbl, cpu_vsrl(xb)); \ + tcg_gen_movi_i64(sgm, sgn_mask); \ + switch (op) { \ + case OP_ABS: \ + tcg_gen_andc_i64(xbh, xbh, sgm); \ + break; \ + case OP_NABS: \ + tcg_gen_or_i64(xbh, xbh, sgm); \ + break; \ + } \ + tcg_gen_mov_i64(cpu_vsrh(xt), xbh); \ + tcg_gen_mov_i64(cpu_vsrl(xt), xbl); \ + tcg_temp_free_i64(xbl); \ + tcg_temp_free_i64(xbh); \ + tcg_temp_free_i64(sgm); \ +} + +VSX_SCALAR_MOVE_QP(xsabsqp, OP_ABS, SGN_MASK_DP) +VSX_SCALAR_MOVE_QP(xsnabsqp, OP_NABS, SGN_MASK_DP) + #define VSX_VECTOR_MOVE(name, op, sgn_mask) \ static void glue(gen_, name)(DisasContext * ctx) \ { \ diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 8a1cbe0..daf6a56 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -88,12 +88,17 @@ GEN_HANDLER2_E(name, #name, 0x3C, opc2|0x03, opc3|0x0C,= 0, PPC_NONE, PPC2_VSX) #define GEN_VSX_XFORM_300(name, opc2, opc3, inval) \ GEN_HANDLER_E(name, 0x3F, opc2, opc3, inval, PPC_NONE, PPC2_ISA300) =20 +#define GEN_VSX_XFORM_300_EO(name, opc2, opc3, opc4, inval) \ +GEN_HANDLER_E_2(name, 0x3F, opc2, opc3, opc4, inval, PPC_NONE, PPC2_ISA300) =20 GEN_XX2FORM(xsabsdp, 0x12, 0x15, PPC2_VSX), GEN_XX2FORM(xsnabsdp, 0x12, 0x16, PPC2_VSX), GEN_XX2FORM(xsnegdp, 0x12, 0x17, PPC2_VSX), GEN_XX3FORM(xscpsgndp, 0x00, 0x16, PPC2_VSX), =20 +GEN_VSX_XFORM_300_EO(xsabsqp, 0x04, 0x19, 0x00, 0x00000001), +GEN_VSX_XFORM_300_EO(xsnabsqp, 0x04, 0x19, 0x08, 0x00000001), + GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), GEN_XX2FORM(xvnabsdp, 0x12, 0x1E, PPC2_VSX), GEN_XX2FORM(xvnegdp, 0x12, 0x1F, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014394047596.2733155675928; Wed, 1 Feb 2017 21:46:34 -0800 (PST) Received: from localhost ([::1]:54370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAE3-0003fF-KE for importer@patchew.org; Thu, 02 Feb 2017 00:46:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jm-0007Iv-5z for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9ji-0003ef-Rk for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:14 -0500 Received: from ozlabs.org ([103.22.144.67]:43709) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9ji-0003ao-Cc; Thu, 02 Feb 2017 00:15:10 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqP2nX4z9s7g; Thu, 2 Feb 2017 16:14:55 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012497; bh=amEd7Mf9K+0Kcjao219sc1FMgRUWgFP0k46/14D53kk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U0qDAsDwOdThV3yHvE4TJKPAxOdp8jQzVMwEK+Sl4HvJk9vXlLuZf1XnsBMmdvaPE LhUthd4QKAnmstMsSgzgcjC/czKynMReHGj3WZ/ylP0AMniqMpcigtJuSb5SLDMsHM Fus6z2scEW1Njci9KltOIKU/q88xJ4qz+GbLMOg0= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:21 +1100 Message-Id: <20170202051445.5735-24-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 023/107] target-ppc: Implement bcd_is_valid function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani A function to check if all digits of a given BCD number is valid is here presented because more instructions will need to reuse the same code. Signed-off-by: Jose Ricardo Ziviani Signed-off-by: David Gibson --- target/ppc/int_helper.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index a33b18b..14eb4e4 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2564,6 +2564,24 @@ static void bcd_put_digit(ppc_avr_t *bcd, uint8_t di= git, int n) } } =20 +static bool bcd_is_valid(ppc_avr_t *bcd) +{ + int i; + int invalid =3D 0; + + if (bcd_get_sgn(bcd) =3D=3D 0) { + return false; + } + + for (i =3D 1; i < 32; i++) { + bcd_get_digit(bcd, i, &invalid); + if (unlikely(invalid)) { + return false; + } + } + return true; +} + static int bcd_cmp_zero(ppc_avr_t *bcd) { if (bcd->u64[HI_IDX] =3D=3D 0 && (bcd->u64[LO_IDX] >> 4) =3D=3D 0) { @@ -2981,18 +2999,13 @@ uint32_t helper_bcdcpsgn(ppc_avr_t *r, ppc_avr_t *a= , ppc_avr_t *b, uint32_t ps) =20 uint32_t helper_bcdsetsgn(ppc_avr_t *r, ppc_avr_t *b, uint32_t ps) { - int i; - int invalid =3D 0; int sgnb =3D bcd_get_sgn(b); =20 *r =3D *b; bcd_put_digit(r, bcd_preferred_sgn(sgnb, ps), 0); =20 - for (i =3D 1; i < 32; i++) { - bcd_get_digit(b, i, &invalid); - if (unlikely(invalid)) { - return CRF_SO; - } + if (bcd_is_valid(b) =3D=3D false) { + return CRF_SO; } =20 return bcd_cmp_zero(r); --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486013808623839.0167319729977; Wed, 1 Feb 2017 21:36:48 -0800 (PST) Received: from localhost ([::1]:54314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZA4c-0002FJ-Oy for importer@patchew.org; Thu, 02 Feb 2017 00:36:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jj-0007G8-W8 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jg-0003bS-VR for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:11 -0500 Received: from ozlabs.org ([103.22.144.67]:60465) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jg-0003XH-Hr; Thu, 02 Feb 2017 00:15:08 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqN3wl1z9s7b; Thu, 2 Feb 2017 16:14:55 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012496; bh=93mQA0+s50txxvwxq/3mSe6fhzg19SQmWZlPlHRgkos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iy508jZk26O+o3BuuWoAx4IXS992XhvoimGd5MWCH/lIM/YH25hiQrtUx2XW98Otg cUwDxOBeBoJ7Ls3EGE+EXzvpw123FDdZ3sClxAUS/iN595tI9ZjMxthHl8OxGiJ0a1 QqA/1IB8It1/8DmPpsBg+7CcH1hjNsOoS3IIe71Y= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:22 +1100 Message-Id: <20170202051445.5735-25-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 024/107] target-ppc: implement xsnegqp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xsnegqp: VSX Scalar Negate Quad-Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 4 ++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 5 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 808ee48..e74e16e 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -633,6 +633,9 @@ static void glue(gen_, name)(DisasContext *ctx) = \ case OP_NABS: \ tcg_gen_or_i64(xbh, xbh, sgm); \ break; \ + case OP_NEG: \ + tcg_gen_xor_i64(xbh, xbh, sgm); \ + break; \ } \ tcg_gen_mov_i64(cpu_vsrh(xt), xbh); \ tcg_gen_mov_i64(cpu_vsrl(xt), xbl); \ @@ -643,6 +646,7 @@ static void glue(gen_, name)(DisasContext *ctx) = \ =20 VSX_SCALAR_MOVE_QP(xsabsqp, OP_ABS, SGN_MASK_DP) VSX_SCALAR_MOVE_QP(xsnabsqp, OP_NABS, SGN_MASK_DP) +VSX_SCALAR_MOVE_QP(xsnegqp, OP_NEG, SGN_MASK_DP) =20 #define VSX_VECTOR_MOVE(name, op, sgn_mask) \ static void glue(gen_, name)(DisasContext * ctx) \ diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index daf6a56..f7132b4 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -98,6 +98,7 @@ GEN_XX3FORM(xscpsgndp, 0x00, 0x16, PPC2_VSX), =20 GEN_VSX_XFORM_300_EO(xsabsqp, 0x04, 0x19, 0x00, 0x00000001), GEN_VSX_XFORM_300_EO(xsnabsqp, 0x04, 0x19, 0x08, 0x00000001), +GEN_VSX_XFORM_300_EO(xsnegqp, 0x04, 0x19, 0x10, 0x00000001), =20 GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), GEN_XX2FORM(xvnabsdp, 0x12, 0x1E, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014408764830.0913391844989; Wed, 1 Feb 2017 21:46:48 -0800 (PST) Received: from localhost ([::1]:54372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAEI-0003tC-Qk for importer@patchew.org; Thu, 02 Feb 2017 00:46:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jk-0007GH-63 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jh-0003cs-Kp for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:12 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:46733) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jh-0003Xx-5L; Thu, 02 Feb 2017 00:15:09 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqN6NDYz9s7h; Thu, 2 Feb 2017 16:14:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012496; bh=La7I9Yu733XZDvN+eTKTKx90j1fkVZMod6Bp1zvcZzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q9tmI3tDmOHQx+jtDNSuNSogMIVpvrg3UUcE+Og+KOm5A+68tSPMZmtE77pSqA2ob +jTpcgtY1GE7XUrv9IjKekldQRt+7yNQz19guVytfZTwx3GN5aQUxLr5NQX6Jf/c36 GwRVV832GTv3FnfTlMOQP4K6FYxmow8cCqdu2jMg= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:23 +1100 Message-Id: <20170202051445.5735-26-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 025/107] target-ppc: implement xscpsgnqp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xscpsgnqp: VSX Scalar Copy Sign Quad-Precision Signed-off-by: Nikunj A Dadhania Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 12 +++++++++++- target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index e74e16e..90d26a2 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -612,9 +612,10 @@ VSX_SCALAR_MOVE(xscpsgndp, OP_CPSGN, SGN_MASK_DP) #define VSX_SCALAR_MOVE_QP(name, op, sgn_mask) \ static void glue(gen_, name)(DisasContext *ctx) \ { \ + int xa; \ int xt =3D rD(ctx->opcode) + 32; \ int xb =3D rB(ctx->opcode) + 32; \ - TCGv_i64 xbh, xbl, sgm; \ + TCGv_i64 xah, xbh, xbl, sgm; \ \ if (unlikely(!ctx->vsx_enabled)) { \ gen_exception(ctx, POWERPC_EXCP_VSXU); \ @@ -636,6 +637,14 @@ static void glue(gen_, name)(DisasContext *ctx) = \ case OP_NEG: \ tcg_gen_xor_i64(xbh, xbh, sgm); \ break; \ + case OP_CPSGN: \ + xah =3D tcg_temp_new_i64(); \ + xa =3D rA(ctx->opcode) + 32; \ + tcg_gen_and_i64(xah, cpu_vsrh(xa), sgm); \ + tcg_gen_andc_i64(xbh, xbh, sgm); \ + tcg_gen_or_i64(xbh, xbh, xah); \ + tcg_temp_free_i64(xah); \ + break; \ } \ tcg_gen_mov_i64(cpu_vsrh(xt), xbh); \ tcg_gen_mov_i64(cpu_vsrl(xt), xbl); \ @@ -647,6 +656,7 @@ static void glue(gen_, name)(DisasContext *ctx) = \ VSX_SCALAR_MOVE_QP(xsabsqp, OP_ABS, SGN_MASK_DP) VSX_SCALAR_MOVE_QP(xsnabsqp, OP_NABS, SGN_MASK_DP) VSX_SCALAR_MOVE_QP(xsnegqp, OP_NEG, SGN_MASK_DP) +VSX_SCALAR_MOVE_QP(xscpsgnqp, OP_CPSGN, SGN_MASK_DP) =20 #define VSX_VECTOR_MOVE(name, op, sgn_mask) \ static void glue(gen_, name)(DisasContext * ctx) \ diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index f7132b4..68fa171 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -99,6 +99,7 @@ GEN_XX3FORM(xscpsgndp, 0x00, 0x16, PPC2_VSX), GEN_VSX_XFORM_300_EO(xsabsqp, 0x04, 0x19, 0x00, 0x00000001), GEN_VSX_XFORM_300_EO(xsnabsqp, 0x04, 0x19, 0x08, 0x00000001), GEN_VSX_XFORM_300_EO(xsnegqp, 0x04, 0x19, 0x10, 0x00000001), +GEN_VSX_XFORM_300(xscpsgnqp, 0x04, 0x03, 0x00000001), =20 GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), GEN_XX2FORM(xvnabsdp, 0x12, 0x1E, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014663421242.99916265891454; Wed, 1 Feb 2017 21:51:03 -0800 (PST) Received: from localhost ([::1]:54397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAIO-0008Ny-NA for importer@patchew.org; Thu, 02 Feb 2017 00:51:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jm-0007JV-PW for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9ji-0003ej-Se for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:14 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:43089) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9ji-0003Yq-BW; Thu, 02 Feb 2017 00:15:10 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqP0P4Vz9s7l; Thu, 2 Feb 2017 16:14:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012497; bh=o4vhxUwVOxCplMP55/nDp1NbzZ/49al+9p+7QLah+Do=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I5ASRfpGgcGGOTZDcMtRGltpbu3ASq4vP58SDXA3oIlLA2SqCjNEFxjI+75jLyjFa BKdcCmdHlJndmeKtf0SxPEbE1OWuA/bIarkoS6sKLzyy7Fcl5QvuO4pTvGrayBuRH1 l7vPHJjTNnVrv8wU5ss36tfEvPt71Q7S1NUsRzCU= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:24 +1100 Message-Id: <20170202051445.5735-27-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 026/107] target-ppc: Add xxperm and xxpermr instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xxperm: VSX Vector Permute xxpermr: VSX Vector Permute Right-indexed Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 23 +++++++++++++++++++++++ target/ppc/helper.h | 2 ++ target/ppc/translate/vsx-impl.inc.c | 2 ++ target/ppc/translate/vsx-ops.inc.c | 2 ++ 4 files changed, 29 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 3b867cf..1ccd5e6 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2869,3 +2869,26 @@ uint64_t helper_xsrsp(CPUPPCState *env, uint64_t xb) float_check_status(env); return xt; } + +#define VSX_XXPERM(op, indexed) \ +void helper_##op(CPUPPCState *env, uint32_t opcode) \ +{ \ + ppc_vsr_t xt, xa, pcv, xto; \ + int i, idx; \ + \ + getVSR(xA(opcode), &xa, env); \ + getVSR(xT(opcode), &xt, env); \ + getVSR(xB(opcode), &pcv, env); \ + \ + for (i =3D 0; i < 16; i++) { \ + idx =3D pcv.VsrB(i) & 0x1F; \ + if (indexed) { \ + idx =3D 31 - idx; \ + } \ + xto.VsrB(i) =3D (idx <=3D 15) ? xa.VsrB(idx) : xt.VsrB(idx - 16); \ + } \ + putVSR(xT(opcode), &xto, env); \ +} + +VSX_XXPERM(xxperm, 0) +VSX_XXPERM(xxpermr, 1) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 6369165..3257820 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -527,6 +527,8 @@ DEF_HELPER_2(xvrspic, void, env, i32) DEF_HELPER_2(xvrspim, void, env, i32) DEF_HELPER_2(xvrspip, void, env, i32) DEF_HELPER_2(xvrspiz, void, env, i32) +DEF_HELPER_2(xxperm, void, env, i32) +DEF_HELPER_2(xxpermr, void, env, i32) =20 DEF_HELPER_2(efscfsi, i32, env, i32) DEF_HELPER_2(efscfui, i32, env, i32) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 90d26a2..7000035 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -883,6 +883,8 @@ GEN_VSX_HELPER_2(xvrspic, 0x16, 0x0A, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvrspim, 0x12, 0x0B, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvrspip, 0x12, 0x0A, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvrspiz, 0x12, 0x09, 0, PPC2_VSX) +GEN_VSX_HELPER_2(xxperm, 0x08, 0x03, 0, PPC2_ISA300) +GEN_VSX_HELPER_2(xxpermr, 0x08, 0x07, 0, PPC2_ISA300) =20 static void gen_xxbrd(DisasContext *ctx) { diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 68fa171..f684066 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -267,6 +267,8 @@ VSX_LOGICAL(xxlnand, 0x8, 0x16, PPC2_VSX207), VSX_LOGICAL(xxlorc, 0x8, 0x15, PPC2_VSX207), GEN_XX3FORM(xxmrghw, 0x08, 0x02, PPC2_VSX), GEN_XX3FORM(xxmrglw, 0x08, 0x06, PPC2_VSX), +GEN_XX3FORM(xxperm, 0x08, 0x03, PPC2_ISA300), +GEN_XX3FORM(xxpermr, 0x08, 0x07, PPC2_ISA300), GEN_XX2FORM(xxspltw, 0x08, 0x0A, PPC2_VSX), GEN_XX1FORM(xxspltib, 0x08, 0x0B, PPC2_ISA300), GEN_XX3FORM_DM(xxsldwi, 0x08, 0x00), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014422799112.18635216922542; Wed, 1 Feb 2017 21:47:02 -0800 (PST) Received: from localhost ([::1]:54373 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAEW-000452-Sm for importer@patchew.org; Thu, 02 Feb 2017 00:47:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jk-0007H9-P6 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jh-0003cV-Dx for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:12 -0500 Received: from ozlabs.org ([103.22.144.67]:55807) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jg-0003XN-MS; Thu, 02 Feb 2017 00:15:09 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqN4w36z9s7k; Thu, 2 Feb 2017 16:14:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012496; bh=0axuBCCoSnDN7NvkyM6mGakNqkiJNJvbsuHoW6egF5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UcGNPHHKQNfcYg+d5Nt62qi3vjMefYrvFKaQADr+ivzTMMQ4cTm5zqFEifHTuXFib +JjTMS2gzPCuc7MqyTLGZfXTNjPMKCaYpkzJDiubQkh2Ni33m1FPwLJdMNsiRNtoRJ cdA0gHkuoGNSXsJ9VWvIhQ2C7fcji4Zu+rB65+Rw= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:25 +1100 Message-Id: <20170202051445.5735-28-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 027/107] target-ppc: implement lxvl instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania lxvl: Load VSX Vector with Length Little/Big-endian Storage: +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ |=E2=80=9CT=E2=80=9D|=E2=80=9Ch=E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2= =80=9D|=E2=80=9C =E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2=80=9D|=E2=80= =9C =E2=80=9D|=E2=80=9Ca=E2=80=9D|=E2=80=9C =E2=80=9D|=E2=80=9CT=E2=80=9D|= =E2=80=9CE=E2=80=9D|=E2=80=9CS=E2=80=9D|=E2=80=9CT=E2=80=9D|FF|FF| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ Loading 14 bytes results in: Vector (8-bit elements) in BE: +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ |=E2=80=9CT=E2=80=9D|=E2=80=9Ch=E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2= =80=9D|=E2=80=9C =E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2=80=9D|=E2=80= =9C =E2=80=9D|=E2=80=9Ca=E2=80=9D|=E2=80=9C =E2=80=9D|=E2=80=9CT=E2=80=9D|= =E2=80=9CE=E2=80=9D|=E2=80=9CS=E2=80=9D|=E2=80=9CT=E2=80=9D|00|00| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ Vector (8-bit elements) in LE: +--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |00|00|=E2=80=9CT=E2=80=9D|=E2=80=9CS=E2=80=9D|=E2=80=9CE=E2=80=9D|=E2=80= =9CT=E2=80=9D|=E2=80=9C =E2=80=9D|=E2=80=9Ca=E2=80=9D|=E2=80=9C =E2=80=9D|= =E2=80=9Cs=E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9C =E2=80=9D|=E2=80=9Cs=E2= =80=9D|=E2=80=9Ci=E2=80=9D|"h"|"T"| +--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/helper.h | 3 +++ target/ppc/mem_helper.c | 35 +++++++++++++++++++++++++++++++++= ++ target/ppc/translate/vsx-impl.inc.c | 29 +++++++++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 3 +++ 4 files changed, 70 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 3257820..1c70815 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -312,6 +312,9 @@ DEF_HELPER_3(lvewx, void, env, avr, tl) DEF_HELPER_3(stvebx, void, env, avr, tl) DEF_HELPER_3(stvehx, void, env, avr, tl) DEF_HELPER_3(stvewx, void, env, avr, tl) +#if defined(TARGET_PPC64) +DEF_HELPER_4(lxvl, void, env, tl, tl, tl) +#endif DEF_HELPER_4(vsumsws, void, env, avr, avr, avr) DEF_HELPER_4(vsum2sws, void, env, avr, avr, avr) DEF_HELPER_4(vsum4sbs, void, env, avr, avr, avr) diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index 1ab8a6e..c4ddc5b 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -24,6 +24,7 @@ =20 #include "helper_regs.h" #include "exec/cpu_ldst.h" +#include "internal.h" =20 //#define DEBUG_OP =20 @@ -284,6 +285,40 @@ STVE(stvewx, cpu_stl_data_ra, bswap32, u32) #undef I #undef LVE =20 +#ifdef TARGET_PPC64 +#define GET_NB(rb) ((rb >> 56) & 0xFF) + +#define VSX_LXVL(name, lj) \ +void helper_##name(CPUPPCState *env, target_ulong addr, \ + target_ulong xt_num, target_ulong rb) \ +{ \ + int i; \ + ppc_vsr_t xt; \ + uint64_t nb =3D GET_NB(rb); \ + \ + xt.s128 =3D int128_zero(); \ + if (nb) { \ + nb =3D (nb >=3D 16) ? 16 : nb; = \ + if (msr_le && !lj) { \ + for (i =3D 16; i > 16 - nb; i--) { \ + xt.VsrB(i - 1) =3D cpu_ldub_data_ra(env, addr, GETPC()); \ + addr =3D addr_add(env, addr, 1); \ + } \ + } else { \ + for (i =3D 0; i < nb; i++) { \ + xt.VsrB(i) =3D cpu_ldub_data_ra(env, addr, GETPC()); \ + addr =3D addr_add(env, addr, 1); \ + } \ + } \ + } \ + putVSR(xt_num, &xt, env); \ +} + +VSX_LXVL(lxvl, 0) +#undef VSX_LXVL +#undef GET_NB +#endif /* TARGET_PPC64 */ + #undef HI_IDX #undef LO_IDX =20 diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 7000035..1f64fb7 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -240,6 +240,35 @@ VSX_VECTOR_LOAD_STORE(stxv, st_i64, 0) VSX_VECTOR_LOAD_STORE(lxvx, ld_i64, 1) VSX_VECTOR_LOAD_STORE(stxvx, st_i64, 1) =20 +#ifdef TARGET_PPC64 +#define VSX_VECTOR_LOAD_STORE_LENGTH(name) \ +static void gen_##name(DisasContext *ctx) \ +{ \ + TCGv EA, xt; \ + \ + if (xT(ctx->opcode) < 32) { \ + if (unlikely(!ctx->vsx_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VSXU); \ + return; \ + } \ + } else { \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + } \ + EA =3D tcg_temp_new(); \ + xt =3D tcg_const_tl(xT(ctx->opcode)); \ + gen_set_access_type(ctx, ACCESS_INT); \ + gen_addr_register(ctx, EA); \ + gen_helper_##name(cpu_env, EA, xt, cpu_gpr[rB(ctx->opcode)]); \ + tcg_temp_free(EA); \ + tcg_temp_free(xt); \ +} + +VSX_VECTOR_LOAD_STORE_LENGTH(lxvl) +#endif + #define VSX_LOAD_SCALAR_DS(name, operation) \ static void gen_##name(DisasContext *ctx) \ { \ diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index f684066..62a0afc 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -10,6 +10,9 @@ GEN_HANDLER_E(lxvw4x, 0x1F, 0x0C, 0x18, 0, PPC_NONE, PPC2= _VSX), GEN_HANDLER_E(lxvh8x, 0x1F, 0x0C, 0x19, 0, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(lxvb16x, 0x1F, 0x0C, 0x1B, 0, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(lxvx, 0x1F, 0x0C, 0x08, 0x00000040, PPC_NONE, PPC2_ISA300), +#if defined(TARGET_PPC64) +GEN_HANDLER_E(lxvl, 0x1F, 0x0D, 0x08, 0, PPC_NONE, PPC2_ISA300), +#endif =20 GEN_HANDLER_E(stxsdx, 0x1F, 0xC, 0x16, 0, PPC_NONE, PPC2_VSX), GEN_HANDLER_E(stxsibx, 0x1F, 0xD, 0x1C, 0, PPC_NONE, PPC2_ISA300), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014579561513.9910004278008; Wed, 1 Feb 2017 21:49:39 -0800 (PST) Received: from localhost ([::1]:54383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAH3-0007A2-NN for importer@patchew.org; Thu, 02 Feb 2017 00:49:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jm-0007Jk-Ug for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9ji-0003eW-Q9 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:14 -0500 Received: from ozlabs.org ([103.22.144.67]:46233) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9ji-0003ap-Bf; Thu, 02 Feb 2017 00:15:10 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqP3nYcz9s7j; Thu, 2 Feb 2017 16:14:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012497; bh=wIJn+RrNw6bWf4ia/ror4FQaP+EivRXQz48SGpcxzc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iztwqw3Ru3UR+iKXLsrsZ8H8TKt0lfSg3uTDUzO6FeJq+xaTU6d07/Y+R6Lbischh PHTyq9g6dNf8LmrVnbLjzpCZg6QApuzbZJXABcviu4gOSX/qA1YuzCbgEo5q1AkUsh ZE/cqwhtAMus4b0KXtTfwaMsJZ+4O5L+8dYxJOOs= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:26 +1100 Message-Id: <20170202051445.5735-29-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 028/107] target-ppc: implement lxvll instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania lxvll: Load VSX Vector Left-justified with Length Little/Big-endian Storage: +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ |=E2=80=9CT=E2=80=9D|=E2=80=9Ch=E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2= =80=9D|=E2=80=9C =E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2=80=9D|=E2=80= =9C =E2=80=9D|=E2=80=9Ca=E2=80=9D|=E2=80=9C =E2=80=9D|=E2=80=9CT=E2=80=9D|= =E2=80=9CE=E2=80=9D|=E2=80=9CS=E2=80=9D|=E2=80=9CT=E2=80=9D|FF|FF| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ Loading 14 bytes to vector (8-bit elements) in BE/LE: +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ |=E2=80=9CT=E2=80=9D|=E2=80=9Ch=E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2= =80=9D|=E2=80=9C =E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2=80=9D|=E2=80= =9C =E2=80=9D|=E2=80=9Ca=E2=80=9D|=E2=80=9C =E2=80=9D|=E2=80=9CT=E2=80=9D|= =E2=80=9CE=E2=80=9D|=E2=80=9CS=E2=80=9D|=E2=80=9CT=E2=80=9D|00|00| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/mem_helper.c | 1 + target/ppc/translate/vsx-impl.inc.c | 1 + target/ppc/translate/vsx-ops.inc.c | 1 + 4 files changed, 4 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 1c70815..6a9344e 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -314,6 +314,7 @@ DEF_HELPER_3(stvehx, void, env, avr, tl) DEF_HELPER_3(stvewx, void, env, avr, tl) #if defined(TARGET_PPC64) DEF_HELPER_4(lxvl, void, env, tl, tl, tl) +DEF_HELPER_4(lxvll, void, env, tl, tl, tl) #endif DEF_HELPER_4(vsumsws, void, env, avr, avr, avr) DEF_HELPER_4(vsum2sws, void, env, avr, avr, avr) diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index c4ddc5b..da51465 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -315,6 +315,7 @@ void helper_##name(CPUPPCState *env, target_ulong addr,= \ } =20 VSX_LXVL(lxvl, 0) +VSX_LXVL(lxvll, 1) #undef VSX_LXVL #undef GET_NB #endif /* TARGET_PPC64 */ diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 1f64fb7..ce20579 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -267,6 +267,7 @@ static void gen_##name(DisasContext *ctx) = \ } =20 VSX_VECTOR_LOAD_STORE_LENGTH(lxvl) +VSX_VECTOR_LOAD_STORE_LENGTH(lxvll) #endif =20 #define VSX_LOAD_SCALAR_DS(name, operation) \ diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 62a0afc..c207804 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -12,6 +12,7 @@ GEN_HANDLER_E(lxvb16x, 0x1F, 0x0C, 0x1B, 0, PPC_NONE, PPC= 2_ISA300), GEN_HANDLER_E(lxvx, 0x1F, 0x0C, 0x08, 0x00000040, PPC_NONE, PPC2_ISA300), #if defined(TARGET_PPC64) GEN_HANDLER_E(lxvl, 0x1F, 0x0D, 0x08, 0, PPC_NONE, PPC2_ISA300), +GEN_HANDLER_E(lxvll, 0x1F, 0x0D, 0x09, 0, PPC_NONE, PPC2_ISA300), #endif =20 GEN_HANDLER_E(stxsdx, 0x1F, 0xC, 0x16, 0, PPC_NONE, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148601518690550.96045838523514; Wed, 1 Feb 2017 21:59:46 -0800 (PST) Received: from localhost ([::1]:54443 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAQq-0000g9-MR for importer@patchew.org; Thu, 02 Feb 2017 00:59:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jq-0007O2-3R for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jm-0003kX-Di for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:18 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:50847) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jl-0003fG-Tr; Thu, 02 Feb 2017 00:15:14 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqQ41rhz9s7y; Thu, 2 Feb 2017 16:14:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012498; bh=OLDZ/OJHHQ5Ex4sxIh1BUO6nROuWw/iQjKfrcSj/+4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BWGg6uFG7a9khzMWiYo1PrmwyI2LHuAwX5MxMlonfim7u+hskf325LYr94bL0lK1o /GhwFebZwBohGoh+AT52kIfoYWN5uUMaHiaYEayDzAzhy3lROE32PhtUOlkSTZ9cmF VxthiJX4yCQbQcqOhVsD5CmGgnl4FFFWLTX+8eWs= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:27 +1100 Message-Id: <20170202051445.5735-30-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 029/107] target-ppc: implement stxvl instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania stxvl: Store VSX Vector with Length Vector (8-bit elements) in BE: +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ |=E2=80=9CT=E2=80=9D|=E2=80=9Ch=E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2= =80=9D|=E2=80=9C =E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2=80=9D|=E2=80= =9C =E2=80=9D|=E2=80=9Ca=E2=80=9D|=E2=80=9C =E2=80=9D|=E2=80=9CT=E2=80=9D|= =E2=80=9CE=E2=80=9D|=E2=80=9CS=E2=80=9D|=E2=80=9CT=E2=80=9D|00|00| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ Vector (8-bit elements) in LE: +--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |00|00|=E2=80=9CT=E2=80=9D|=E2=80=9CS=E2=80=9D|=E2=80=9CE=E2=80=9D|=E2=80= =9CT=E2=80=9D|=E2=80=9C =E2=80=9D|=E2=80=9Ca=E2=80=9D|=E2=80=9C =E2=80=9D|= =E2=80=9Cs=E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9C =E2=80=9D|=E2=80=9Cs=E2= =80=9D|=E2=80=9Ci=E2=80=9D|"h"|"T"| +--+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ Storing 14 bytes would result in following Little/Big-endian Storage: +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ |=E2=80=9CT=E2=80=9D|=E2=80=9Ch=E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2= =80=9D|=E2=80=9C =E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2=80=9D|=E2=80= =9C =E2=80=9D|=E2=80=9Ca=E2=80=9D|=E2=80=9C =E2=80=9D|=E2=80=9CT=E2=80=9D|= =E2=80=9CE=E2=80=9D|=E2=80=9CS=E2=80=9D|=E2=80=9CT=E2=80=9D|FF|FF| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/mem_helper.c | 29 +++++++++++++++++++++++++++++ target/ppc/translate/vsx-impl.inc.c | 1 + target/ppc/translate/vsx-ops.inc.c | 3 +++ 4 files changed, 34 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 6a9344e..218a022 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -315,6 +315,7 @@ DEF_HELPER_3(stvewx, void, env, avr, tl) #if defined(TARGET_PPC64) DEF_HELPER_4(lxvl, void, env, tl, tl, tl) DEF_HELPER_4(lxvll, void, env, tl, tl, tl) +DEF_HELPER_4(stxvl, void, env, tl, tl, tl) #endif DEF_HELPER_4(vsumsws, void, env, avr, avr, avr) DEF_HELPER_4(vsum2sws, void, env, avr, avr, avr) diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index da51465..2427b49 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -317,6 +317,35 @@ void helper_##name(CPUPPCState *env, target_ulong addr= , \ VSX_LXVL(lxvl, 0) VSX_LXVL(lxvll, 1) #undef VSX_LXVL + +#define VSX_STXVL(name, lj) \ +void helper_##name(CPUPPCState *env, target_ulong addr, \ + target_ulong xt_num, target_ulong rb) \ +{ \ + int i; \ + ppc_vsr_t xt; \ + target_ulong nb =3D GET_NB(rb); \ + \ + if (!nb) { \ + return; \ + } \ + getVSR(xt_num, &xt, env); \ + nb =3D (nb >=3D 16) ? 16 : nb; \ + if (msr_le && !lj) { \ + for (i =3D 16; i > 16 - nb; i--) { \ + cpu_stb_data_ra(env, addr, xt.VsrB(i - 1), GETPC()); \ + addr =3D addr_add(env, addr, 1); \ + } \ + } else { \ + for (i =3D 0; i < nb; i++) { \ + cpu_stb_data_ra(env, addr, xt.VsrB(i), GETPC()); \ + addr =3D addr_add(env, addr, 1); \ + } \ + } \ +} + +VSX_STXVL(stxvl, 0) +#undef VSX_STXVL #undef GET_NB #endif /* TARGET_PPC64 */ =20 diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index ce20579..5099d44 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -268,6 +268,7 @@ static void gen_##name(DisasContext *ctx) = \ =20 VSX_VECTOR_LOAD_STORE_LENGTH(lxvl) VSX_VECTOR_LOAD_STORE_LENGTH(lxvll) +VSX_VECTOR_LOAD_STORE_LENGTH(stxvl) #endif =20 #define VSX_LOAD_SCALAR_DS(name, operation) \ diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index c207804..3afded2 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -25,6 +25,9 @@ GEN_HANDLER_E(stxvw4x, 0x1F, 0xC, 0x1C, 0, PPC_NONE, PPC2= _VSX), GEN_HANDLER_E(stxvh8x, 0x1F, 0x0C, 0x1D, 0, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(stxvb16x, 0x1F, 0x0C, 0x1F, 0, PPC_NONE, PPC2_ISA300), GEN_HANDLER_E(stxvx, 0x1F, 0x0C, 0x0C, 0, PPC_NONE, PPC2_ISA300), +#if defined(TARGET_PPC64) +GEN_HANDLER_E(stxvl, 0x1F, 0x0D, 0x0C, 0, PPC_NONE, PPC2_ISA300), +#endif =20 GEN_HANDLER_E(mfvsrwz, 0x1F, 0x13, 0x03, 0x0000F800, PPC_NONE, PPC2_VSX207= ), GEN_HANDLER_E(mtvsrwa, 0x1F, 0x13, 0x06, 0x0000F800, PPC_NONE, PPC2_VSX207= ), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016012921103.83752322940506; Wed, 1 Feb 2017 22:13:32 -0800 (PST) Received: from localhost ([::1]:54525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAeA-0005Ih-GX for importer@patchew.org; Thu, 02 Feb 2017 01:13:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9js-0007R1-Pt for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jn-0003nB-V5 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:20 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:59515) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jn-0003hy-Bz; Thu, 02 Feb 2017 00:15:15 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqQ5W3Fz9s7s; Thu, 2 Feb 2017 16:14:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012498; bh=1Q1Jw4bCFmSU80MG6OsiSKZ87uX8TC2odxLE7OGGSNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UZbuW9UClCCBQiexgm3q6QUZZgHwbfUDj+HPhsgYaUzUpbOnuy7WCZdVllsI/kCAS QvTP7nuQHs5tOTl78YvHbbxzWbP6lQhScE94NO0cfMnxdgtWaTcZ6vU2WAz33AAbUJ NOX2HB6TGxNOD17CwCFDdmsbOcNFWxyKOf4cjh/E= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:28 +1100 Message-Id: <20170202051445.5735-31-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 030/107] target-ppc: implement stxvll instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania stxvll: Store VSX Vector Left-justified with Length Vector (8-bit elements) in BE/LE: +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ |=E2=80=9CT=E2=80=9D|=E2=80=9Ch=E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2= =80=9D|=E2=80=9C =E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2=80=9D|=E2=80= =9C =E2=80=9D|=E2=80=9Ca=E2=80=9D|=E2=80=9C =E2=80=9D|=E2=80=9CT=E2=80=9D|= =E2=80=9CE=E2=80=9D|=E2=80=9CS=E2=80=9D|=E2=80=9CT=E2=80=9D|00|00| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ Storing 14 bytes would result in following Little/Big-endian Storage: +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ |=E2=80=9CT=E2=80=9D|=E2=80=9Ch=E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2= =80=9D|=E2=80=9C =E2=80=9D|=E2=80=9Ci=E2=80=9D|=E2=80=9Cs=E2=80=9D|=E2=80= =9C =E2=80=9D|=E2=80=9Ca=E2=80=9D|=E2=80=9C =E2=80=9D|=E2=80=9CT=E2=80=9D|= =E2=80=9CE=E2=80=9D|=E2=80=9CS=E2=80=9D|=E2=80=9CT=E2=80=9D|FF|FF| +---+---+---+---+---+---+---+---+---+---+---+---+---+---+--+--+ Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/mem_helper.c | 1 + target/ppc/translate/vsx-impl.inc.c | 1 + target/ppc/translate/vsx-ops.inc.c | 1 + 4 files changed, 4 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 218a022..1fe56bf 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -316,6 +316,7 @@ DEF_HELPER_3(stvewx, void, env, avr, tl) DEF_HELPER_4(lxvl, void, env, tl, tl, tl) DEF_HELPER_4(lxvll, void, env, tl, tl, tl) DEF_HELPER_4(stxvl, void, env, tl, tl, tl) +DEF_HELPER_4(stxvll, void, env, tl, tl, tl) #endif DEF_HELPER_4(vsumsws, void, env, avr, avr, avr) DEF_HELPER_4(vsum2sws, void, env, avr, avr, avr) diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index 2427b49..e6383c6 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -345,6 +345,7 @@ void helper_##name(CPUPPCState *env, target_ulong addr,= \ } =20 VSX_STXVL(stxvl, 0) +VSX_STXVL(stxvll, 1) #undef VSX_STXVL #undef GET_NB #endif /* TARGET_PPC64 */ diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 5099d44..2a17c35 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -269,6 +269,7 @@ static void gen_##name(DisasContext *ctx) = \ VSX_VECTOR_LOAD_STORE_LENGTH(lxvl) VSX_VECTOR_LOAD_STORE_LENGTH(lxvll) VSX_VECTOR_LOAD_STORE_LENGTH(stxvl) +VSX_VECTOR_LOAD_STORE_LENGTH(stxvll) #endif =20 #define VSX_LOAD_SCALAR_DS(name, operation) \ diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 3afded2..46b95e3 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -27,6 +27,7 @@ GEN_HANDLER_E(stxvb16x, 0x1F, 0x0C, 0x1F, 0, PPC_NONE, PP= C2_ISA300), GEN_HANDLER_E(stxvx, 0x1F, 0x0C, 0x0C, 0, PPC_NONE, PPC2_ISA300), #if defined(TARGET_PPC64) GEN_HANDLER_E(stxvl, 0x1F, 0x0D, 0x0C, 0, PPC_NONE, PPC2_ISA300), +GEN_HANDLER_E(stxvll, 0x1F, 0x0D, 0x0D, 0, PPC_NONE, PPC2_ISA300), #endif =20 GEN_HANDLER_E(mfvsrwz, 0x1F, 0x13, 0x03, 0x0000F800, PPC_NONE, PPC2_VSX207= ), --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014730756536.9941707689385; Wed, 1 Feb 2017 21:52:10 -0800 (PST) Received: from localhost ([::1]:54399 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAJU-0000v1-JG for importer@patchew.org; Thu, 02 Feb 2017 00:52:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jp-0007NN-LC for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jl-0003jZ-V5 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:17 -0500 Received: from ozlabs.org ([103.22.144.67]:55489) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jl-0003fE-GI; Thu, 02 Feb 2017 00:15:13 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqQ4wBqz9s7q; Thu, 2 Feb 2017 16:14:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012498; bh=YYdOMvWeh4WBX4m7NFqFSFcN1XT2DXLqAuOp9Xh5ngQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ein6RCXdus302kut7kCHGZlWYiSrjnVw1lBEQgvipSseKZqZdpiln/1hHJtuKVnE+ mLoWzggKyQTEvyzhTznnJ2wXkle5aAhR+4lI4THQgS0YW15kKl0kuW59+2m4lGnDLU AfQENpu34ny5sICSXAStO0ciXpin1c+ELHRu8WHA= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:29 +1100 Message-Id: <20170202051445.5735-32-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 031/107] hw/ppc/spapr: Fix boot path of usb-host storage devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth When passing through an USB storage device to a pseries guest, it is currently not possible to automatically boot from the device if the "bootindex" property has been specified, too (e.g. when using "-device nec-usb-xhci -device usb-host,hostbus=3D1,hostaddr=3D2,bootindex= =3D0" at the command line). The problem is that QEMU builds a device tree path like "/pci@800000020000000/usb@0/usb-host@1" and passes it to SLOF in the /chosen/qemu,boot-list property. SLOF, however, probes the USB device, recognizes that it is a storage device and thus changes its name to "storage", and additionally adds a child node for the SCSI LUN, so the correct boot path in SLOF is something like "/pci@800000020000000/usb@0/storage@1/disk@101000000000000" instead. So when we detect an USB mass storage device with SCSI interface, we've got to adjust the firmware boot-device path properly that SLOF can automatically boot from the device. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1354177 Signed-off-by: Thomas Huth Signed-off-by: David Gibson --- hw/ppc/spapr.c | 13 +++++++++++++ hw/usb/host-libusb.c | 29 +++++++++++++++++++++++++++++ hw/usb/host-stub.c | 5 +++++ include/hw/usb.h | 1 + 4 files changed, 48 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 74419f8..f2edbd0 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2198,6 +2198,19 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p= , BusState *bus, } } =20 + /* + * SLOF probes the USB devices, and if it recognizes that the device i= s a + * storage device, it changes its name to "storage" instead of "usb-ho= st", + * and additionally adds a child node for the SCSI LUN, so the correct + * boot path in SLOF is something like .../storage@1/disk@xxx" instead. + */ + if (strcmp("usb-host", qdev_fw_name(dev)) =3D=3D 0) { + USBDevice *usbdev =3D CAST(USBDevice, dev, TYPE_USB_DEVICE); + if (usb_host_dev_is_scsi_storage(usbdev)) { + return g_strdup_printf("storage@%s/disk", usbdev->port->path); + } + } + if (phb) { /* Replace "pci" with "pci@800000020000000" */ return g_strdup_printf("pci@%"PRIX64, phb->buid); diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index bd81d71..7791c6d 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -1707,6 +1707,35 @@ static void usb_host_auto_check(void *unused) timer_mod(usb_auto_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 200= 0); } =20 +/** + * Check whether USB host device has a USB mass storage SCSI interface + */ +bool usb_host_dev_is_scsi_storage(USBDevice *ud) +{ + USBHostDevice *uhd =3D USB_HOST_DEVICE(ud); + struct libusb_config_descriptor *conf; + const struct libusb_interface_descriptor *intf; + bool is_scsi_storage =3D false; + int i; + + if (!uhd || libusb_get_active_config_descriptor(uhd->dev, &conf) !=3D = 0) { + return false; + } + + for (i =3D 0; i < conf->bNumInterfaces; i++) { + intf =3D &conf->interface[i].altsetting[ud->altsetting[i]]; + if (intf->bInterfaceClass =3D=3D LIBUSB_CLASS_MASS_STORAGE && + intf->bInterfaceSubClass =3D=3D 6) { /* 6 mean= s SCSI */ + is_scsi_storage =3D true; + break; + } + } + + libusb_free_config_descriptor(conf); + + return is_scsi_storage; +} + void hmp_info_usbhost(Monitor *mon, const QDict *qdict) { libusb_device **devs =3D NULL; diff --git a/hw/usb/host-stub.c b/hw/usb/host-stub.c index 6ba65a1..d0268ba 100644 --- a/hw/usb/host-stub.c +++ b/hw/usb/host-stub.c @@ -46,3 +46,8 @@ USBDevice *usb_host_device_open(USBBus *bus, const char *= devname) { return NULL; } + +bool usb_host_dev_is_scsi_storage(USBDevice *ud) +{ + return false; +} diff --git a/include/hw/usb.h b/include/hw/usb.h index 847c9de..43838c9 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -471,6 +471,7 @@ void usb_generic_async_ctrl_complete(USBDevice *s, USBP= acket *p); /* usb-linux.c */ USBDevice *usb_host_device_open(USBBus *bus, const char *devname); void hmp_info_usbhost(Monitor *mon, const QDict *qdict); +bool usb_host_dev_is_scsi_storage(USBDevice *usbdev); =20 /* usb ports of the VM */ =20 --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014979449118.15153302731972; Wed, 1 Feb 2017 21:56:19 -0800 (PST) Received: from localhost ([::1]:54427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZANV-0005NN-Ao for importer@patchew.org; Thu, 02 Feb 2017 00:56:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9js-0007Qd-GI for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jn-0003ma-Br for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:20 -0500 Received: from ozlabs.org ([103.22.144.67]:49319) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jm-0003hv-Ra; Thu, 02 Feb 2017 00:15:15 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqQ64Mjz9s7r; Thu, 2 Feb 2017 16:14:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012498; bh=EyHKrtIVMH8fQ+D0sc3JROt/jjH85ZO41TZ33PdnM/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=krR6EnFT+2d+8nfF8KiWBS5efSH6YHvU9su9fHwGFz1Cs1z27SzapaZajxGbYtjc3 YExNCia0jlMwo4gWk09Iu9xBnoD671l/SIIz8y758Iv5ugygUF7fw1Xeb8n00SoWTT unqcGDOgkYE1uKh3ngJyE5xjZjBVTFcbwZ0zybP0= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:30 +1100 Message-Id: <20170202051445.5735-33-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 032/107] prep: do not use global variable to access nvram X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Herv=C3=A9 Poussineau Signed-off-by: Herv=C3=A9 Poussineau Signed-off-by: David Gibson --- hw/ppc/prep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 054af1e..9fb89d3 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -339,13 +339,13 @@ static PortioList prep_port_list; /* NVRAM helpers */ static inline uint32_t nvram_read(Nvram *nvram, uint32_t addr) { - NvramClass *k =3D NVRAM_GET_CLASS(sysctrl->nvram); + NvramClass *k =3D NVRAM_GET_CLASS(nvram); return (k->read)(nvram, addr); } =20 static inline void nvram_write(Nvram *nvram, uint32_t addr, uint32_t val) { - NvramClass *k =3D NVRAM_GET_CLASS(sysctrl->nvram); + NvramClass *k =3D NVRAM_GET_CLASS(nvram); (k->write)(nvram, addr, val); } =20 --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014913532409.0015542210748; Wed, 1 Feb 2017 21:55:13 -0800 (PST) Received: from localhost ([::1]:54418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAMR-0004N3-PF for importer@patchew.org; Thu, 02 Feb 2017 00:55:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jo-0007M6-I9 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jk-0003h0-GG for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:16 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:59653) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jj-0003cj-Tt; Thu, 02 Feb 2017 00:15:12 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqP4fsWz9s7p; Thu, 2 Feb 2017 16:14:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012497; bh=KsVXB2dy45+3lMmC5gIyN/EHnbxKH3DXtUAHp8bpGTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GrxN1WqsD1R91LBj9pNKoBEOSByyprTnuBSJlqVrdUlAsUVPdRQ8kntuN/oIVUXL6 CvEWCF/anjUxR9QxheRUfG4LEzML+0LRGba6OC/Iat3DYH+3Ak0/bmXGHNqO607/Hn DZRpc7MNDfEbPujFNmQiQkLsBBDhsOB58bA6OuZE= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:31 +1100 Message-Id: <20170202051445.5735-34-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 033/107] pseries: Add pseries-2.9 machine type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: David Gibson Reviewed-by: Thomas Huth Reviewed-by: Laurent Vivier --- hw/ppc/spapr.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index f2edbd0..a175609 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2774,18 +2774,37 @@ static const TypeInfo spapr_machine_info =3D { type_init(spapr_machine_register_##suffix) =20 /* + * pseries-2.9 + */ +static void spapr_machine_2_9_instance_options(MachineState *machine) +{ +} + +static void spapr_machine_2_9_class_options(MachineClass *mc) +{ + /* Defaults for the latest behaviour inherited from the base class */ +} + +DEFINE_SPAPR_MACHINE(2_9, "2.9", true); + +/* * pseries-2.8 */ +#define SPAPR_COMPAT_2_8 \ + HW_COMPAT_2_8 + static void spapr_machine_2_8_instance_options(MachineState *machine) { + spapr_machine_2_9_instance_options(machine); } =20 static void spapr_machine_2_8_class_options(MachineClass *mc) { - /* Defaults for the latest behaviour inherited from the base class */ + spapr_machine_2_9_class_options(mc); + SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_8); } =20 -DEFINE_SPAPR_MACHINE(2_8, "2.8", true); +DEFINE_SPAPR_MACHINE(2_8, "2.8", false); =20 /* * pseries-2.7 --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14860154778810.6237996827177312; Wed, 1 Feb 2017 22:04:37 -0800 (PST) Received: from localhost ([::1]:54472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAVX-0005IM-OL for importer@patchew.org; Thu, 02 Feb 2017 01:04:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jq-0007O7-5u for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jk-0003gu-Cd for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:18 -0500 Received: from ozlabs.org ([103.22.144.67]:51595) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jj-0003d0-JD; Thu, 02 Feb 2017 00:15:12 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqP5Qb9z9s7v; Thu, 2 Feb 2017 16:14:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012497; bh=WwigBHhny+sN0DCw/KphJF80kdA0xducVzN+uBfVePM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DOgBjuWb+cCmPkZFo+dBjESxmoM9F9QBEWAT6/kT9kDM6zbRZm2F/nPpN9x92FVaa RtlBEqBj5lYtIqti8T7tmV4zgJa09Bw8zp7z3EbtqO0NLfpDBgkPtrL3dRui8d04BO bW+SQYDF+Uqpi13iHN2AF7qehG1Xv/QCCLtE8+aM= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:32 +1100 Message-Id: <20170202051445.5735-35-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 034/107] ppc: Rewrite ppc_set_compat() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This rewrites the ppc_set_compat() function so that instead of open coding the various compatibility modes, it reads the relevant data from a table. This is a first step in consolidating the information on compatibility modes scattered across the code into a single place. It also makes one change to the logic. The old code masked the bits to be set in the PCR (Processor Compatibility Register) by which bits are valid on the host CPU. This made no sense, since it was done regardless of whether our guest CPU was the same as the host CPU or not. Furthermore, the actual PCR bits are only relevant for TCG[1] - KVM instead uses the compatibility mode we tell it in kvmppc_set_compat(). When using TCG host cpu information usually isn't even present. While we're at it, we put the new implementation in a new file to make the enormous translate_init.c a little smaller. [1] Actually it doesn't even do anything in TCG, but it will if / when we get to implementing compatibility mode logic at that level. Signed-off-by: David Gibson Reviewed-by: Alexey Kardashevskiy --- target/ppc/Makefile.objs | 2 +- target/ppc/compat.c | 91 +++++++++++++++++++++++++++++++++++++++++= ++++ target/ppc/cpu.h | 6 ++- target/ppc/translate_init.c | 41 -------------------- 4 files changed, 97 insertions(+), 43 deletions(-) create mode 100644 target/ppc/compat.c diff --git a/target/ppc/Makefile.objs b/target/ppc/Makefile.objs index e667e69..a8c7a30 100644 --- a/target/ppc/Makefile.objs +++ b/target/ppc/Makefile.objs @@ -2,7 +2,7 @@ obj-y +=3D cpu-models.o obj-y +=3D translate.o ifeq ($(CONFIG_SOFTMMU),y) obj-y +=3D machine.o mmu_helper.o mmu-hash32.o monitor.o -obj-$(TARGET_PPC64) +=3D mmu-hash64.o arch_dump.o +obj-$(TARGET_PPC64) +=3D mmu-hash64.o arch_dump.o compat.o endif obj-$(CONFIG_KVM) +=3D kvm.o obj-$(call lnot,$(CONFIG_KVM)) +=3D kvm-stub.o diff --git a/target/ppc/compat.c b/target/ppc/compat.c new file mode 100644 index 0000000..f3fd9c6 --- /dev/null +++ b/target/ppc/compat.c @@ -0,0 +1,91 @@ +/* + * PowerPC CPU initialization for qemu. + * + * Copyright 2016, David Gibson, Red Hat Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" +#include "sysemu/kvm.h" +#include "kvm_ppc.h" +#include "sysemu/cpus.h" +#include "qemu/error-report.h" +#include "qapi/error.h" +#include "cpu-models.h" + +typedef struct { + uint32_t pvr; + uint64_t pcr; +} CompatInfo; + +static const CompatInfo compat_table[] =3D { + { /* POWER6, ISA2.05 */ + .pvr =3D CPU_POWERPC_LOGICAL_2_05, + .pcr =3D PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_COMPAT_2_05 + | PCR_TM_DIS | PCR_VSX_DIS, + }, + { /* POWER7, ISA2.06 */ + .pvr =3D CPU_POWERPC_LOGICAL_2_06, + .pcr =3D PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_TM_DIS, + }, + { + .pvr =3D CPU_POWERPC_LOGICAL_2_06_PLUS, + .pcr =3D PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_TM_DIS, + }, + { /* POWER8, ISA2.07 */ + .pvr =3D CPU_POWERPC_LOGICAL_2_07, + .pcr =3D PCR_COMPAT_2_07, + }, +}; + +static const CompatInfo *compat_by_pvr(uint32_t pvr) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(compat_table); i++) { + if (compat_table[i].pvr =3D=3D pvr) { + return &compat_table[i]; + } + } + return NULL; +} + +void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp) +{ + const CompatInfo *compat =3D compat_by_pvr(compat_pvr); + CPUPPCState *env =3D &cpu->env; + PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu); + uint64_t pcr; + + if (!compat_pvr) { + pcr =3D 0; + } else if (!compat) { + error_setg(errp, "Unknown compatibility PVR 0x%08"PRIx32, compat_p= vr); + return; + } else { + pcr =3D compat->pcr; + } + + cpu->compat_pvr =3D compat_pvr; + env->spr[SPR_PCR] =3D pcr & pcc->pcr_mask; + + if (kvm_enabled()) { + int ret =3D kvmppc_set_compat(cpu, cpu->compat_pvr); + if (ret < 0) { + error_setg_errno(errp, -ret, + "Unable to set CPU compatibility mode in KVM"= ); + } + } +} diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index b62f775..c859547 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1252,7 +1252,6 @@ void ppc_store_msr (CPUPPCState *env, target_ulong va= lue); void ppc_cpu_list (FILE *f, fprintf_function cpu_fprintf); int ppc_get_compat_smt_threads(PowerPCCPU *cpu); #if defined(TARGET_PPC64) -void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp); #endif =20 /* Time-base and decrementer management */ @@ -1323,6 +1322,11 @@ static inline int cpu_mmu_index (CPUPPCState *env, b= ool ifetch) return ifetch ? env->immu_idx : env->dmmu_idx; } =20 +/* Compatibility modes */ +#if defined(TARGET_PPC64) +void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp); +#endif /* defined(TARGET_PPC64) */ + #include "exec/cpu-all.h" =20 /*************************************************************************= ****/ diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index f6b08e7..a34a0eb 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -9972,47 +9972,6 @@ int ppc_get_compat_smt_threads(PowerPCCPU *cpu) return ret; } =20 -#ifdef TARGET_PPC64 -void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp) -{ - int ret =3D 0; - CPUPPCState *env =3D &cpu->env; - PowerPCCPUClass *host_pcc; - - cpu->compat_pvr =3D compat_pvr; - - switch (compat_pvr) { - case CPU_POWERPC_LOGICAL_2_05: - env->spr[SPR_PCR] =3D PCR_TM_DIS | PCR_VSX_DIS | PCR_COMPAT_2_07 | - PCR_COMPAT_2_06 | PCR_COMPAT_2_05; - break; - case CPU_POWERPC_LOGICAL_2_06: - case CPU_POWERPC_LOGICAL_2_06_PLUS: - env->spr[SPR_PCR] =3D PCR_TM_DIS | PCR_COMPAT_2_07 | PCR_COMPAT_2_= 06; - break; - case CPU_POWERPC_LOGICAL_2_07: - env->spr[SPR_PCR] =3D PCR_COMPAT_2_07; - break; - default: - env->spr[SPR_PCR] =3D 0; - break; - } - - host_pcc =3D kvm_ppc_get_host_cpu_class(); - if (host_pcc) { - env->spr[SPR_PCR] &=3D host_pcc->pcr_mask; - } - - if (kvm_enabled()) { - ret =3D kvmppc_set_compat(cpu, cpu->compat_pvr); - if (ret < 0) { - error_setg_errno(errp, -ret, - "Unable to set CPU compatibility mode in KVM"= ); - } - } -} -#endif - static gint ppc_cpu_compare_class_pvr(gconstpointer a, gconstpointer b) { ObjectClass *oc =3D (ObjectClass *)a; --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486015204989146.7174227881868; Wed, 1 Feb 2017 22:00:04 -0800 (PST) Received: from localhost ([::1]:54447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAR8-0000vQ-PR for importer@patchew.org; Thu, 02 Feb 2017 01:00:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jp-0007Ne-Sx for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jk-0003hj-RG for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:17 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:44447) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jk-0003d7-A3; Thu, 02 Feb 2017 00:15:12 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqP6hg1z9s7w; Thu, 2 Feb 2017 16:14:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012497; bh=CL/imQpi33d81zzwifu6gGqJ72iyYNnTF6zglDz07lA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OEpoMrWXPFW+5u3ZvNcFJXgC3vIm7FnpRuYTAGln5L30h5Sh3QdqI2cd54jtxDTkA gOotoirkc4CEd1KDf6fFDcQYmYH/GXWccmlYR+QUWjUIx8f4/31p+hoLb1ZbnYS5/c S5JC4ds7cL62QoVjfEN6S/W9GKvQJaepXcNhim1g= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:33 +1100 Message-Id: <20170202051445.5735-36-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 035/107] ppc: Rewrite ppc_get_compat_smt_threads() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" To continue consolidation of compatibility mode information, this rewrites the ppc_get_compat_smt_threads() function using the table of compatiblity modes in target-ppc/compat.c. It's not a direct replacement, the new ppc_compat_max_threads() function has simpler semantics - it just returns the number of threads the cpu model has, taking into account any compatiblity mode it is in. This no longer takes into account kvmppc_smt_threads() as the previous version did. That check wasn't useful because we check in ppc_cpu_realizefn() that CPUs aren't instantiated with more threads than kvm allows (or if we didn't things will already be broken and this won't make it any worse). Signed-off-by: David Gibson Reviewed-by: Alexey Kardashevskiy --- hw/ppc/spapr.c | 8 ++++---- target/ppc/compat.c | 18 ++++++++++++++++++ target/ppc/cpu.h | 2 +- target/ppc/translate_init.c | 20 -------------------- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a175609..b71cd7a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -206,6 +206,7 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPRMachineSt= ate *spapr) PowerPCCPU *cpu =3D POWERPC_CPU(cs); DeviceClass *dc =3D DEVICE_GET_CLASS(cs); int index =3D ppc_get_vcpu_dt_id(cpu); + int compat_smt =3D MIN(smp_threads, ppc_compat_max_threads(cpu)); =20 if ((index % smt) !=3D 0) { continue; @@ -240,8 +241,7 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPRMachineSt= ate *spapr) return ret; } =20 - ret =3D spapr_fixup_cpu_smt_dt(fdt, offset, cpu, - ppc_get_compat_smt_threads(cpu)); + ret =3D spapr_fixup_cpu_smt_dt(fdt, offset, cpu, compat_smt); if (ret < 0) { return ret; } @@ -407,6 +407,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *f= dt, int offset, size_t page_sizes_prop_size; uint32_t vcpus_per_socket =3D smp_threads * smp_cores; uint32_t pft_size_prop[] =3D {0, cpu_to_be32(spapr->htab_shift)}; + int compat_smt =3D MIN(smp_threads, ppc_compat_max_threads(cpu)); sPAPRDRConnector *drc; sPAPRDRConnectorClass *drck; int drc_index; @@ -494,8 +495,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *f= dt, int offset, =20 _FDT(spapr_fixup_cpu_numa_dt(fdt, offset, cs)); =20 - _FDT(spapr_fixup_cpu_smt_dt(fdt, offset, cpu, - ppc_get_compat_smt_threads(cpu))); + _FDT(spapr_fixup_cpu_smt_dt(fdt, offset, cpu, compat_smt)); } =20 static void spapr_populate_cpus_dt_node(void *fdt, sPAPRMachineState *spap= r) diff --git a/target/ppc/compat.c b/target/ppc/compat.c index f3fd9c6..66529a6 100644 --- a/target/ppc/compat.c +++ b/target/ppc/compat.c @@ -28,6 +28,7 @@ typedef struct { uint32_t pvr; uint64_t pcr; + int max_threads; } CompatInfo; =20 static const CompatInfo compat_table[] =3D { @@ -35,18 +36,22 @@ static const CompatInfo compat_table[] =3D { .pvr =3D CPU_POWERPC_LOGICAL_2_05, .pcr =3D PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_COMPAT_2_05 | PCR_TM_DIS | PCR_VSX_DIS, + .max_threads =3D 2, }, { /* POWER7, ISA2.06 */ .pvr =3D CPU_POWERPC_LOGICAL_2_06, .pcr =3D PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_TM_DIS, + .max_threads =3D 4, }, { .pvr =3D CPU_POWERPC_LOGICAL_2_06_PLUS, .pcr =3D PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_TM_DIS, + .max_threads =3D 4, }, { /* POWER8, ISA2.07 */ .pvr =3D CPU_POWERPC_LOGICAL_2_07, .pcr =3D PCR_COMPAT_2_07, + .max_threads =3D 8, }, }; =20 @@ -89,3 +94,16 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr= , Error **errp) } } } + +int ppc_compat_max_threads(PowerPCCPU *cpu) +{ + const CompatInfo *compat =3D compat_by_pvr(cpu->compat_pvr); + int n_threads =3D CPU(cpu)->nr_threads; + + if (cpu->compat_pvr) { + g_assert(compat); + n_threads =3D MIN(n_threads, compat->max_threads); + } + + return n_threads; +} diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index c859547..cd76053 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1250,7 +1250,6 @@ void ppc_store_sdr1 (CPUPPCState *env, target_ulong v= alue); void ppc_store_msr (CPUPPCState *env, target_ulong value); =20 void ppc_cpu_list (FILE *f, fprintf_function cpu_fprintf); -int ppc_get_compat_smt_threads(PowerPCCPU *cpu); #if defined(TARGET_PPC64) #endif =20 @@ -1325,6 +1324,7 @@ static inline int cpu_mmu_index (CPUPPCState *env, bo= ol ifetch) /* Compatibility modes */ #if defined(TARGET_PPC64) void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp); +int ppc_compat_max_threads(PowerPCCPU *cpu); #endif /* defined(TARGET_PPC64) */ =20 #include "exec/cpu-all.h" diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index a34a0eb..388a3e8 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -9952,26 +9952,6 @@ static void ppc_cpu_unrealizefn(DeviceState *dev, Er= ror **errp) } } =20 -int ppc_get_compat_smt_threads(PowerPCCPU *cpu) -{ - CPUState *cs =3D CPU(cpu); - int ret =3D MIN(cs->nr_threads, kvmppc_smt_threads()); - - switch (cpu->compat_pvr) { - case CPU_POWERPC_LOGICAL_2_05: - ret =3D MIN(ret, 2); - break; - case CPU_POWERPC_LOGICAL_2_06: - ret =3D MIN(ret, 4); - break; - case CPU_POWERPC_LOGICAL_2_07: - ret =3D MIN(ret, 8); - break; - } - - return ret; -} - static gint ppc_cpu_compare_class_pvr(gconstpointer a, gconstpointer b) { ObjectClass *oc =3D (ObjectClass *)a; --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014929939380.37187826544584; Wed, 1 Feb 2017 21:55:29 -0800 (PST) Received: from localhost ([::1]:54419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAMh-0004af-OU for importer@patchew.org; Thu, 02 Feb 2017 00:55:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jp-0007Nc-SA for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jl-0003iq-LZ for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:17 -0500 Received: from ozlabs.org ([103.22.144.67]:42203) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jl-0003f3-4O; Thu, 02 Feb 2017 00:15:13 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqQ3KWNz9s81; Thu, 2 Feb 2017 16:14:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012498; bh=y1Oyn/u8P2Rh0y5zWUFny9WQG/6Xc5uQt6mIAsCvA80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BxI9UUT4UJZfw4CGQ1SQIjQq9Vv/w0WE+g1m76I4Qw4KgFQHhhLpsGxOBHqiVBlcY f9SP7o86lu6UQdtZshGd+zzH2zJEyXiiC5NVXkrCCMrCM4pKxzQofEdgkeck++CUEo pslkIJ2g0/qSQbkTHMmNyTByiZnQ4VFwUnW5jw48= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:34 +1100 Message-Id: <20170202051445.5735-37-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 036/107] ppc: Validate compatibility modes when setting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Current ppc_set_compat() will attempt to set any compatiblity mode specified, regardless of whether it's available on the CPU. The caller is expected to make sure it is setting a possible mode, which is awkwward because most of the information to make that decision is at the CPU level. This begins to clean this up by introducing a ppc_check_compat() function which will determine if a given compatiblity mode is supported on a CPU (and also whether it lies within specified minimum and maximum compat levels, which will be useful later). It also contains an assertion that the CPU has a "virtual hypervisor"[1], that is, that the guest isn't permitted to execute hypervisor privilege code. Without that, the guest would own the PCR and so could override any mode set here. Only machine types which use a virtual hypervisor (i.e. 'pseries') should use ppc_check_compat(). ppc_set_compat() is modified to validate the compatibility mode it is given and fail if it's not available on this CPU. [1] Or user-only mode, which also obviously doesn't allow access to the hypervisor privileged PCR. We don't use that now, but could in future. Signed-off-by: David Gibson Reviewed-by: Alexey Kardashevskiy --- target/ppc/compat.c | 41 +++++++++++++++++++++++++++++++++++++++++ target/ppc/cpu.h | 2 ++ 2 files changed, 43 insertions(+) diff --git a/target/ppc/compat.c b/target/ppc/compat.c index 66529a6..1059555 100644 --- a/target/ppc/compat.c +++ b/target/ppc/compat.c @@ -28,29 +28,37 @@ typedef struct { uint32_t pvr; uint64_t pcr; + uint64_t pcr_level; int max_threads; } CompatInfo; =20 static const CompatInfo compat_table[] =3D { + /* + * Ordered from oldest to newest - the code relies on this + */ { /* POWER6, ISA2.05 */ .pvr =3D CPU_POWERPC_LOGICAL_2_05, .pcr =3D PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_COMPAT_2_05 | PCR_TM_DIS | PCR_VSX_DIS, + .pcr_level =3D PCR_COMPAT_2_05, .max_threads =3D 2, }, { /* POWER7, ISA2.06 */ .pvr =3D CPU_POWERPC_LOGICAL_2_06, .pcr =3D PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_TM_DIS, + .pcr_level =3D PCR_COMPAT_2_06, .max_threads =3D 4, }, { .pvr =3D CPU_POWERPC_LOGICAL_2_06_PLUS, .pcr =3D PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_TM_DIS, + .pcr_level =3D PCR_COMPAT_2_06, .max_threads =3D 4, }, { /* POWER8, ISA2.07 */ .pvr =3D CPU_POWERPC_LOGICAL_2_07, .pcr =3D PCR_COMPAT_2_07, + .pcr_level =3D PCR_COMPAT_2_07, .max_threads =3D 8, }, }; @@ -67,6 +75,35 @@ static const CompatInfo *compat_by_pvr(uint32_t pvr) return NULL; } =20 +bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr, + uint32_t min_compat_pvr, uint32_t max_compat_pvr) +{ + PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu); + const CompatInfo *compat =3D compat_by_pvr(compat_pvr); + const CompatInfo *min =3D compat_by_pvr(min_compat_pvr); + const CompatInfo *max =3D compat_by_pvr(max_compat_pvr); + +#if !defined(CONFIG_USER_ONLY) + g_assert(cpu->vhyp); +#endif + g_assert(!min_compat_pvr || min); + g_assert(!max_compat_pvr || max); + + if (!compat) { + /* Not a recognized logical PVR */ + return false; + } + if ((min && (compat < min)) || (max && (compat > max))) { + /* Outside specified range */ + return false; + } + if (!(pcc->pcr_supported & compat->pcr_level)) { + /* Not supported by this CPU */ + return false; + } + return true; +} + void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp) { const CompatInfo *compat =3D compat_by_pvr(compat_pvr); @@ -79,6 +116,10 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pv= r, Error **errp) } else if (!compat) { error_setg(errp, "Unknown compatibility PVR 0x%08"PRIx32, compat_p= vr); return; + } else if (!ppc_check_compat(cpu, compat_pvr, 0, 0)) { + error_setg(errp, "Compatibility PVR 0x%08"PRIx32" not valid for CP= U", + compat_pvr); + return; } else { pcr =3D compat->pcr; } diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index cd76053..22842dd 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1323,6 +1323,8 @@ static inline int cpu_mmu_index (CPUPPCState *env, bo= ol ifetch) =20 /* Compatibility modes */ #if defined(TARGET_PPC64) +bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr, + uint32_t min_compat_pvr, uint32_t max_compat_pvr); void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp); int ppc_compat_max_threads(PowerPCCPU *cpu); #endif /* defined(TARGET_PPC64) */ --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014329023655.4109682311243; Wed, 1 Feb 2017 21:45:29 -0800 (PST) Received: from localhost ([::1]:54362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAD0-0002fw-94 for importer@patchew.org; Thu, 02 Feb 2017 00:45:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jo-0007M5-I7 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jk-0003hB-GW for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:16 -0500 Received: from ozlabs.org ([103.22.144.67]:58099) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jj-0003dI-Ux; Thu, 02 Feb 2017 00:15:12 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqQ10Hzz9s7x; Thu, 2 Feb 2017 16:14:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012498; bh=y/GJXB/s8WNbT2lQXzikofmZwG7/pNwFxmN4YsHaYOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mypv/LNUfnOWWsjEl54dbGGgh5HQtje8FkQuUrxOc2nhmdFdHOSRUzWAG/Hf+/63t cwRAS4Btkocdu+m36YwrYzL3Lf5mk3nLBo3OEhKR950tK141dz1J1XGTDqq36+ZK9q volO7sRPWI24U/VFPySel6Q2rUv4EjmhwUKYbmG0= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:35 +1100 Message-Id: <20170202051445.5735-38-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 037/107] qtest: add netfilter tests for ppc64 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier Signed-off-by: Laurent Vivier Reviewed-by: Thomas Huth Reviewed-by: Greg Kurz Tested-by: Greg Kurz Signed-off-by: David Gibson --- tests/Makefile.include | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Makefile.include b/tests/Makefile.include index 33b4f88..92f89b0 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -285,6 +285,9 @@ gcov-files-ppc64-y +=3D hw/usb/hcd-uhci.c check-qtest-ppc64-y +=3D tests/usb-hcd-xhci-test$(EXESUF) gcov-files-ppc64-y +=3D hw/usb/hcd-xhci.c check-qtest-ppc64-y +=3D $(check-qtest-virtio-y) +check-qtest-ppc64-y +=3D tests/test-netfilter$(EXESUF) +check-qtest-ppc64-y +=3D tests/test-filter-mirror$(EXESUF) +check-qtest-ppc64-y +=3D tests/test-filter-redirector$(EXESUF) =20 check-qtest-sh4-y =3D tests/endianness-test$(EXESUF) =20 --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014661688504.07940855652873; Wed, 1 Feb 2017 21:51:01 -0800 (PST) Received: from localhost ([::1]:54398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAIN-0008O9-PO for importer@patchew.org; Thu, 02 Feb 2017 00:50:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jp-0007N2-AM for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jl-0003iv-N3 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:17 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:43325) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jl-0003eK-4e; Thu, 02 Feb 2017 00:15:13 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqQ24m5z9s80; Thu, 2 Feb 2017 16:14:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012498; bh=lsgtErVjQE7Y7o/bZIYVtgKEn9NqNN/ZkTge17uNHzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fh2X7o5HxT/Qc1+Fbwt179KayMkyH+9A3b6z4IfZe0lXYfth/SLhYDIfrzspATi88 Nvzg9FADocLeYm5FQ2xbWxX++gF2l8UAtRslExHQjSzWwYE3Tn8QHGxnFkfgOw2HBQ fs5yf8/8fsXS3yICBJah3FwmK3N0clTJOIuGQiks= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:36 +1100 Message-Id: <20170202051445.5735-39-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 038/107] qtest: add display-vga-test to ppc64 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier Only enable for ppc64 in the Makefile, but added code in the file to check cirrus card only on architectures supporting it (alpha, mips, i386, x86_64). Signed-off-by: Laurent Vivier Reviewed-by: Thomas Huth Reviewed-by: Greg Kurz Tested-by: Greg Kurz Signed-off-by: David Gibson --- tests/Makefile.include | 1 + tests/display-vga-test.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 92f89b0..3f9b1d6 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -288,6 +288,7 @@ check-qtest-ppc64-y +=3D $(check-qtest-virtio-y) check-qtest-ppc64-y +=3D tests/test-netfilter$(EXESUF) check-qtest-ppc64-y +=3D tests/test-filter-mirror$(EXESUF) check-qtest-ppc64-y +=3D tests/test-filter-redirector$(EXESUF) +check-qtest-ppc64-y +=3D tests/display-vga-test$(EXESUF) =20 check-qtest-sh4-y =3D tests/endianness-test$(EXESUF) =20 diff --git a/tests/display-vga-test.c b/tests/display-vga-test.c index 9146021..2d7d24e 100644 --- a/tests/display-vga-test.c +++ b/tests/display-vga-test.c @@ -50,9 +50,14 @@ static void pci_virtio_vga(void) =20 int main(int argc, char **argv) { + const char *arch =3D qtest_get_arch(); + g_test_init(&argc, &argv, NULL); =20 - qtest_add_func("/display/pci/cirrus", pci_cirrus); + if (strcmp(arch, "alpha") =3D=3D 0 || strcmp(arch, "i386") =3D=3D 0 || + strcmp(arch, "mips") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + qtest_add_func("/display/pci/cirrus", pci_cirrus); + } qtest_add_func("/display/pci/stdvga", pci_stdvga); qtest_add_func("/display/pci/secondary", pci_secondary); qtest_add_func("/display/pci/multihead", pci_multihead); --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486015491599694.037088179473; Wed, 1 Feb 2017 22:04:51 -0800 (PST) Received: from localhost ([::1]:54475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAVk-0005Uz-Ra for importer@patchew.org; Thu, 02 Feb 2017 01:04:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9js-0007Qg-H7 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jo-0003o5-KY for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:20 -0500 Received: from ozlabs.org ([103.22.144.67]:53983) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jo-0003jz-3f; Thu, 02 Feb 2017 00:15:16 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqR4FJpz9s84; Thu, 2 Feb 2017 16:14:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012499; bh=aah3iUx1oL+YrqrHdIcyCO6Z0YOt3lGDKnUS8z08u/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VDeZ4lTisz7ph3u0xvpOjxxXJ4hzP1lk7NPmaU/5Pdmv318NxCyaEBcVLF6fkrClp r+kDdA1G2JzsnW2ONcmjO3dfAnDvVqgSPrkYGjtMZ1mAp9s7frW56qMK1Om1jQHijD xWDNUGGOXrU+hC3PO656XZpAokoF3i1HM1xW7xW8= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:37 +1100 Message-Id: <20170202051445.5735-40-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 039/107] libqos: fix spapr qpci_map() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier Signed-off-by: Laurent Vivier Signed-off-by: David Gibson --- tests/libqos/pci-spapr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/libqos/pci-spapr.c b/tests/libqos/pci-spapr.c index 1e5d015..2043f1e 100644 --- a/tests/libqos/pci-spapr.c +++ b/tests/libqos/pci-spapr.c @@ -193,8 +193,8 @@ QPCIBus *qpci_init_spapr(QGuestAllocator *alloc) ret->pio.size =3D SPAPR_PCI_IO_WIN_SIZE; =20 /* 32-bit portion of the MMIO window is at PCI address 2..4 GiB */ - ret->mmio32_cpu_base =3D SPAPR_PCI_BASE + SPAPR_PCI_MMIO32_WIN_SIZE; - ret->mmio32.pci_base =3D 0x80000000; /* 2 GiB */ + ret->mmio32_cpu_base =3D SPAPR_PCI_BASE; + ret->mmio32.pci_base =3D SPAPR_PCI_MMIO32_WIN_SIZE; ret->mmio32.size =3D SPAPR_PCI_MMIO32_WIN_SIZE; =20 ret->bus.pio_alloc_ptr =3D 0xc000; --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486015772481175.01446845038413; Wed, 1 Feb 2017 22:09:32 -0800 (PST) Received: from localhost ([::1]:54503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAaH-0001ne-Ev for importer@patchew.org; Thu, 02 Feb 2017 01:09:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jw-0007Vk-Dd for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9js-0003ts-0I for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:24 -0500 Received: from ozlabs.org ([103.22.144.67]:43135) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jr-0003pU-GA; Thu, 02 Feb 2017 00:15:19 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqS2xRvz9s8C; Thu, 2 Feb 2017 16:14:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012500; bh=M0GLrKnuYjfm2FPQqA9eS91yVOsSlelpaWEkXGGsAI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E2d7I2TuvX1iWp/N1DTmkxMxuMmdBm3+BolGAKjMaQn9+kxaP9HPDoTqNmXJkaVSO Nsw0My/S0DkOEl3i1xx+c/y9R36qwDUrK1a2HyT9uBPN4THTsXoGK56BoElHmSk69y 5dYDYPb372gqgWwwE4ywvYMV6v2DLPbiTyqlfyic= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:38 +1100 Message-Id: <20170202051445.5735-41-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 040/107] qtest: convert ivshmem-test to use libqos X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier This will allow to use it with ppc64. Signed-off-by: Laurent Vivier Signed-off-by: David Gibson --- tests/ivshmem-test.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c index 04a5c5d..8095d72 100644 --- a/tests/ivshmem-test.c +++ b/tests/ivshmem-test.c @@ -11,7 +11,7 @@ #include "qemu/osdep.h" #include #include "contrib/ivshmem-server/ivshmem-server.h" -#include "libqos/pci-pc.h" +#include "libqos/libqos-pc.h" #include "libqtest.h" #include "qemu-common.h" =20 @@ -40,9 +40,8 @@ static QPCIDevice *get_device(QPCIBus *pcibus) } =20 typedef struct _IVState { - QTestState *qtest; + QOSState *qs; QPCIBar reg_bar, mem_bar; - QPCIBus *pcibus; QPCIDevice *dev; } IVState; =20 @@ -74,7 +73,7 @@ static inline unsigned in_reg(IVState *s, enum Reg reg) QTestState *qtest =3D global_qtest; unsigned res; =20 - global_qtest =3D s->qtest; + global_qtest =3D s->qs->qts; res =3D qpci_io_readl(s->dev, s->reg_bar, reg); g_test_message("*%s -> %x\n", name, res); global_qtest =3D qtest; @@ -87,7 +86,7 @@ static inline void out_reg(IVState *s, enum Reg reg, unsi= gned v) const char *name =3D reg2str(reg); QTestState *qtest =3D global_qtest; =20 - global_qtest =3D s->qtest; + global_qtest =3D s->qs->qts; g_test_message("%x -> *%s\n", v, name); qpci_io_writel(s->dev, s->reg_bar, reg, v); global_qtest =3D qtest; @@ -97,7 +96,7 @@ static inline void read_mem(IVState *s, uint64_t off, voi= d *buf, size_t len) { QTestState *qtest =3D global_qtest; =20 - global_qtest =3D s->qtest; + global_qtest =3D s->qs->qts; qpci_memread(s->dev, s->mem_bar, off, buf, len); global_qtest =3D qtest; } @@ -107,7 +106,7 @@ static inline void write_mem(IVState *s, uint64_t off, { QTestState *qtest =3D global_qtest; =20 - global_qtest =3D s->qtest; + global_qtest =3D s->qs->qts; qpci_memwrite(s->dev, s->mem_bar, off, buf, len); global_qtest =3D qtest; } @@ -115,17 +114,21 @@ static inline void write_mem(IVState *s, uint64_t off, static void cleanup_vm(IVState *s) { g_free(s->dev); - qpci_free_pc(s->pcibus); - qtest_quit(s->qtest); + qtest_shutdown(s->qs); } =20 static void setup_vm_cmd(IVState *s, const char *cmd, bool msix) { uint64_t barsize; + const char *arch =3D qtest_get_arch(); =20 - s->qtest =3D qtest_start(cmd); - s->pcibus =3D qpci_init_pc(NULL); - s->dev =3D get_device(s->pcibus); + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + s->qs =3D qtest_pc_boot(cmd); + } else { + g_printerr("ivshmem-test tests are only available on x86\n"); + exit(EXIT_FAILURE); + } + s->dev =3D get_device(s->qs->pcibus); =20 s->reg_bar =3D qpci_iomap(s->dev, 0, &barsize); g_assert_cmpuint(barsize, =3D=3D, 256); @@ -347,7 +350,7 @@ static void test_ivshmem_server(bool msi) g_assert_cmpint(vm1, !=3D, vm2); =20 /* check number of MSI-X vectors */ - global_qtest =3D s1->qtest; + global_qtest =3D s1->qs->qts; if (msi) { ret =3D qpci_msix_table_size(s1->dev); g_assert_cmpuint(ret, =3D=3D, nvectors); @@ -370,7 +373,7 @@ static void test_ivshmem_server(bool msi) g_assert_cmpuint(ret, !=3D, 0); =20 /* ping vm1 -> vm2 on vector 1 */ - global_qtest =3D s2->qtest; + global_qtest =3D s2->qs->qts; if (msi) { ret =3D qpci_msix_pending(s2->dev, 1); g_assert_cmpuint(ret, =3D=3D, 0); --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016317335922.4395729513843; Wed, 1 Feb 2017 22:18:37 -0800 (PST) Received: from localhost ([::1]:54558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAj5-0002ej-6A for importer@patchew.org; Thu, 02 Feb 2017 01:18:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jw-0007W1-Jc for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jr-0003sc-DW for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:24 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:59531) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jq-0003no-Qd; Thu, 02 Feb 2017 00:15:19 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqS0q10z9s89; Thu, 2 Feb 2017 16:14:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012500; bh=dOyJ9LVWcKS55zjO++miK4nM4121tCP+neAin4nA5do=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=keQOWYgw4a+iUcSl3nsu//bxLQI21vde3I+Ly8MKph2EMwnN6x3/OyYEnoYkR4+91 mEkPk8kv0M35BePxC0hasnCHdIQHJUz84hQOYRFP1fN7H9KR6NubOTellRAHYWj5x7 aoOg2e6O3JvK5sWmx1C7RmK2+4Wnjl/DS0yvCgF0= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:39 +1100 Message-Id: <20170202051445.5735-42-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 041/107] qtest: add ivshmem-test for ppc64 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier The test has been converted to use libqos, we can now use it on ppc64. We also make the test fail on all other architectures. As libqos on ppc64 is not able to manage hotplug and IRQ/MSI, we disable this part in the test on ppc64. Signed-off-by: Laurent Vivier [dwg: Make test conditional on CONFIG_EVENTFD] Signed-off-by: David Gibson --- tests/Makefile.include | 3 ++- tests/ivshmem-test.c | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 3f9b1d6..c35fa75 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -289,6 +289,7 @@ check-qtest-ppc64-y +=3D tests/test-netfilter$(EXESUF) check-qtest-ppc64-y +=3D tests/test-filter-mirror$(EXESUF) check-qtest-ppc64-y +=3D tests/test-filter-redirector$(EXESUF) check-qtest-ppc64-y +=3D tests/display-vga-test$(EXESUF) +check-qtest-ppc64-$(CONFIG_EVENTFD) +=3D tests/ivshmem-test$(EXESUF) =20 check-qtest-sh4-y =3D tests/endianness-test$(EXESUF) =20 @@ -715,7 +716,7 @@ tests/test-netfilter$(EXESUF): tests/test-netfilter.o $= (qtest-obj-y) tests/test-filter-mirror$(EXESUF): tests/test-filter-mirror.o $(qtest-obj-= y) tests/test-filter-redirector$(EXESUF): tests/test-filter-redirector.o $(qt= est-obj-y) tests/test-x86-cpuid-compat$(EXESUF): tests/test-x86-cpuid-compat.o $(qtes= t-obj-y) -tests/ivshmem-test$(EXESUF): tests/ivshmem-test.o contrib/ivshmem-server/i= vshmem-server.o $(libqos-pc-obj-y) +tests/ivshmem-test$(EXESUF): tests/ivshmem-test.o contrib/ivshmem-server/i= vshmem-server.o $(libqos-pc-obj-y) $(libqos-spapr-obj-y) tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o contrib/libvho= st-user/libvhost-user.o $(test-util-obj-y) tests/test-uuid$(EXESUF): tests/test-uuid.o $(test-util-obj-y) tests/test-arm-mptimer$(EXESUF): tests/test-arm-mptimer.o diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c index 8095d72..3776342 100644 --- a/tests/ivshmem-test.c +++ b/tests/ivshmem-test.c @@ -12,6 +12,7 @@ #include #include "contrib/ivshmem-server/ivshmem-server.h" #include "libqos/libqos-pc.h" +#include "libqos/libqos-spapr.h" #include "libqtest.h" #include "qemu-common.h" =20 @@ -124,8 +125,10 @@ static void setup_vm_cmd(IVState *s, const char *cmd, = bool msix) =20 if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { s->qs =3D qtest_pc_boot(cmd); + } else if (strcmp(arch, "ppc64") =3D=3D 0) { + s->qs =3D qtest_spapr_boot(cmd); } else { - g_printerr("ivshmem-test tests are only available on x86\n"); + g_printerr("ivshmem-test tests are only available on x86 or ppc64\= n"); exit(EXIT_FAILURE); } s->dev =3D get_device(s->qs->pcibus); @@ -415,6 +418,7 @@ static void test_ivshmem_server_irq(void) =20 static void test_ivshmem_hotplug(void) { + const char *arch =3D qtest_get_arch(); gchar *opts; =20 qtest_start(""); @@ -422,7 +426,9 @@ static void test_ivshmem_hotplug(void) opts =3D g_strdup_printf("'shm': '%s', 'size': '1M'", tmpshm); =20 qpci_plug_device_test("ivshmem", "iv1", PCI_SLOT_HP, opts); - qpci_unplug_acpi_device_test("iv1", PCI_SLOT_HP); + if (strcmp(arch, "ppc64") !=3D 0) { + qpci_unplug_acpi_device_test("iv1", PCI_SLOT_HP); + } =20 qtest_end(); g_free(opts); @@ -494,6 +500,7 @@ static gchar *mktempshm(int size, int *fd) int main(int argc, char **argv) { int ret, fd; + const char *arch =3D qtest_get_arch(); gchar dir[] =3D "/tmp/ivshmem-test.XXXXXX"; =20 #if !GLIB_CHECK_VERSION(2, 31, 0) @@ -524,8 +531,10 @@ int main(int argc, char **argv) qtest_add_func("/ivshmem/memdev", test_ivshmem_memdev); if (g_test_slow()) { qtest_add_func("/ivshmem/pair", test_ivshmem_pair); - qtest_add_func("/ivshmem/server-msi", test_ivshmem_server_msi); - qtest_add_func("/ivshmem/server-irq", test_ivshmem_server_irq); + if (strcmp(arch, "ppc64") !=3D 0) { + qtest_add_func("/ivshmem/server-msi", test_ivshmem_server_msi); + qtest_add_func("/ivshmem/server-irq", test_ivshmem_server_irq); + } } =20 ret =3D g_test_run(); --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486015275633149.9489247090894; Wed, 1 Feb 2017 22:01:15 -0800 (PST) Received: from localhost ([::1]:54454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZASH-0001vs-Mr for importer@patchew.org; Thu, 02 Feb 2017 01:01:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jv-0007UR-H1 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jq-0003ro-VG for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:23 -0500 Received: from ozlabs.org ([103.22.144.67]:37659) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jq-0003oC-Fg; Thu, 02 Feb 2017 00:15:18 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqS1MC2z9s85; Thu, 2 Feb 2017 16:14:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012500; bh=Q9022MLYmGRQE4HPqrV8I/vymYLmCnwPArOIZY3Vkx8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JPzSDThcf+D6QmTfbBwQ71AJhDg3SHtVZAR1l+0ank4YJQY6OPbXO2EzZffg1UnF3 g9KFaCl2ToEtXyRjIHyxaG+BCzVgiGFL/YB/eRI1LSQH1j8GdCsEh3EBBzg1vBMnLH WgVMY4MlFxqYrtL6ELlKUnao07XH3dp8vv+5pUFw= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:40 +1100 Message-Id: <20170202051445.5735-43-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 042/107] hw/gpio: QOM'ify mpc8xxx.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, xiaoqiang zhao , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: xiaoqiang zhao * Drop the old SysBus init function and use instance_init * Change mpc8xxx_gpio_reset to a DeviceClass::reset function Signed-off-by: xiaoqiang zhao Signed-off-by: David Gibson --- hw/gpio/mpc8xxx.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/hw/gpio/mpc8xxx.c b/hw/gpio/mpc8xxx.c index d149719..e12edb4 100644 --- a/hw/gpio/mpc8xxx.c +++ b/hw/gpio/mpc8xxx.c @@ -143,8 +143,10 @@ static void mpc8xxx_gpio_write(void *opaque, hwaddr of= fset, mpc8xxx_gpio_update(s); } =20 -static void mpc8xxx_gpio_reset(MPC8XXXGPIOState *s) +static void mpc8xxx_gpio_reset(DeviceState *dev) { + MPC8XXXGPIOState *s =3D MPC8XXX_GPIO(dev); + s->dir =3D 0; s->odr =3D 0; s->dat =3D 0; @@ -180,33 +182,33 @@ static const MemoryRegionOps mpc8xxx_gpio_ops =3D { .endianness =3D DEVICE_BIG_ENDIAN, }; =20 -static int mpc8xxx_gpio_initfn(SysBusDevice *sbd) +static void mpc8xxx_gpio_initfn(Object *obj) { - DeviceState *dev =3D DEVICE(sbd); - MPC8XXXGPIOState *s =3D MPC8XXX_GPIO(dev); + DeviceState *dev =3D DEVICE(obj); + MPC8XXXGPIOState *s =3D MPC8XXX_GPIO(obj); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); =20 - memory_region_init_io(&s->iomem, OBJECT(s), &mpc8xxx_gpio_ops, s, "mpc= 8xxx_gpio", 0x1000); + memory_region_init_io(&s->iomem, obj, &mpc8xxx_gpio_ops, + s, "mpc8xxx_gpio", 0x1000); sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); qdev_init_gpio_in(dev, mpc8xxx_gpio_set_irq, 32); qdev_init_gpio_out(dev, s->out, 32); - mpc8xxx_gpio_reset(s); - return 0; } =20 static void mpc8xxx_gpio_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); - SysBusDeviceClass *k =3D SYS_BUS_DEVICE_CLASS(klass); =20 - k->init =3D mpc8xxx_gpio_initfn; dc->vmsd =3D &vmstate_mpc8xxx_gpio; + dc->reset =3D mpc8xxx_gpio_reset; } =20 static const TypeInfo mpc8xxx_gpio_info =3D { .name =3D TYPE_MPC8XXX_GPIO, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(MPC8XXXGPIOState), + .instance_init =3D mpc8xxx_gpio_initfn, .class_init =3D mpc8xxx_gpio_class_init, }; =20 --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486015754187376.9279981394725; Wed, 1 Feb 2017 22:09:14 -0800 (PST) Received: from localhost ([::1]:54501 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAa0-0001aY-9F for importer@patchew.org; Thu, 02 Feb 2017 01:09:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9js-0007Qj-HM for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jn-0003mk-FC for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:20 -0500 Received: from ozlabs.org ([103.22.144.67]:54647) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jm-0003hx-T6; Thu, 02 Feb 2017 00:15:15 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqR01XYz9s7t; Thu, 2 Feb 2017 16:14:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012499; bh=Z5swEkY8jjHX3lnHfJa8m9x6E7q8Y/35yjYRpn/KgBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FxQbItINT4ochz5uLb4w3eEUP+N9/oj/8G97Cprs0jzKTP4KkwgyVOkIRZ+x4JS3v esC3ghqapTfUiqqWaPZy9nc3/WF5i4o8KbeSWRDf8KnCkIG2dDPRJ3V0r4i215ZPnd qS0MXwPiP3+7W6hnJpCBuLApPtgpFRKVgArON+V0= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:41 +1100 Message-Id: <20170202051445.5735-44-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 043/107] hw/ppc: QOM'ify e500.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, xiaoqiang zhao , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: xiaoqiang zhao Drop the old SysBus init function and use instance_init Signed-off-by: xiaoqiang zhao Signed-off-by: David Gibson --- hw/ppc/e500.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index cf8b122..792bd79 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -1049,27 +1049,18 @@ void ppce500_init(MachineState *machine, PPCE500Par= ams *params) boot_info->dt_size =3D dt_size; } =20 -static int e500_ccsr_initfn(SysBusDevice *dev) +static void e500_ccsr_initfn(Object *obj) { - PPCE500CCSRState *ccsr; - - ccsr =3D CCSR(dev); - memory_region_init(&ccsr->ccsr_space, OBJECT(ccsr), "e500-ccsr", + PPCE500CCSRState *ccsr =3D CCSR(obj); + memory_region_init(&ccsr->ccsr_space, obj, "e500-ccsr", MPC8544_CCSRBAR_SIZE); - return 0; -} - -static void e500_ccsr_class_init(ObjectClass *klass, void *data) -{ - SysBusDeviceClass *k =3D SYS_BUS_DEVICE_CLASS(klass); - k->init =3D e500_ccsr_initfn; } =20 static const TypeInfo e500_ccsr_info =3D { .name =3D TYPE_CCSR, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(PPCE500CCSRState), - .class_init =3D e500_ccsr_class_init, + .instance_init =3D e500_ccsr_initfn, }; =20 static void e500_register_types(void) --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486015740295265.8881743458461; Wed, 1 Feb 2017 22:09:00 -0800 (PST) Received: from localhost ([::1]:54498 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAZm-0001PL-70 for importer@patchew.org; Thu, 02 Feb 2017 01:08:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9js-0007Qt-Kn for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jp-0003ou-5h for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:20 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:56481) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jo-0003k6-Mj; Thu, 02 Feb 2017 00:15:17 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqR2t3tz9s8B; Thu, 2 Feb 2017 16:14:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012499; bh=A96EDmyBQkdmBMRqedlRyR6RLL9bN2DgEIKQoLRIjXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nhspwnuQEA+2pFBjamaT/ZS4jFBv4QN40mT0vq8fEx9FtLJ6/2Q4DdnwhPjYpSwZY RQYLJTDTgCTEK00vMV6Uz+9sGsg0/tDfwEl9r+sMCpZu3riYZdXNCGcFyNEtGTBxoL xDxisACi2pnhN5zxSTwFLzQQETDTGV/GvV2Qbd2k= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:42 +1100 Message-Id: <20170202051445.5735-45-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 044/107] hw/ppc: QOM'ify ppce500_spin.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, xiaoqiang zhao , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: xiaoqiang zhao Drop the old SysBus init function and use instance_init Signed-off-by: xiaoqiang zhao Signed-off-by: David Gibson --- hw/ppc/ppce500_spin.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c index eb219ab..69ca2d0 100644 --- a/hw/ppc/ppce500_spin.c +++ b/hw/ppc/ppce500_spin.c @@ -54,9 +54,9 @@ typedef struct SpinState { SpinInfo spin[MAX_CPUS]; } SpinState; =20 -static void spin_reset(void *opaque) +static void spin_reset(DeviceState *dev) { - SpinState *s =3D opaque; + SpinState *s =3D E500_SPIN(dev); int i; =20 for (i =3D 0; i < MAX_CPUS; i++) { @@ -174,30 +174,28 @@ static const MemoryRegionOps spin_rw_ops =3D { .endianness =3D DEVICE_BIG_ENDIAN, }; =20 -static int ppce500_spin_initfn(SysBusDevice *dev) +static void ppce500_spin_initfn(Object *obj) { + SysBusDevice *dev =3D SYS_BUS_DEVICE(obj); SpinState *s =3D E500_SPIN(dev); =20 - memory_region_init_io(&s->iomem, OBJECT(s), &spin_rw_ops, s, + memory_region_init_io(&s->iomem, obj, &spin_rw_ops, s, "e500 spin pv device", sizeof(SpinInfo) * MAX_CP= US); sysbus_init_mmio(dev, &s->iomem); - - qemu_register_reset(spin_reset, s); - - return 0; } =20 static void ppce500_spin_class_init(ObjectClass *klass, void *data) { - SysBusDeviceClass *k =3D SYS_BUS_DEVICE_CLASS(klass); + DeviceClass *dc =3D DEVICE_CLASS(klass); =20 - k->init =3D ppce500_spin_initfn; + dc->reset =3D spin_reset; } =20 static const TypeInfo ppce500_spin_info =3D { .name =3D TYPE_E500_SPIN, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(SpinState), + .instance_init =3D ppce500_spin_initfn, .class_init =3D ppce500_spin_class_init, }; =20 --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148601601764485.24433777298543; Wed, 1 Feb 2017 22:13:37 -0800 (PST) Received: from localhost ([::1]:54526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAeF-0005OI-Nc for importer@patchew.org; Thu, 02 Feb 2017 01:13:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9ju-0007TV-Lu for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jq-0003rS-T6 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:22 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:53963) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jq-0003n9-8T; Thu, 02 Feb 2017 00:15:18 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqR6s7Fz9s8F; Thu, 2 Feb 2017 16:14:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012499; bh=k2oFl5BU2ISih2uGGCWOxXRu86tmGG/tAuhEkxU02Sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gj2lPwrQo/jl3wXqX4wksE6BfFu9C9viOCE5GKHlkc1SWKAV/WnkuejD2jy3Be14a 57PZexgwEMdfdXG7NL6li8Voa9MsqH4Kt2xBhXVWDTWSSE1yzSHdSJA54WlYxfrWK3 HrGwKzxO0/iDs9ENERPWVGmZVkUF7nO7JbdPdAU8= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:43 +1100 Message-Id: <20170202051445.5735-46-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 045/107] hw/ppc: QOM'ify spapr_vio.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, xiaoqiang zhao , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: xiaoqiang zhao Drop the old and empty SysBus init Signed-off-by: xiaoqiang zhao Signed-off-by: David Gibson --- hw/ppc/spapr_vio.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c index cc1e09c..8bfc5f9 100644 --- a/hw/ppc/spapr_vio.c +++ b/hw/ppc/spapr_vio.c @@ -538,21 +538,11 @@ VIOsPAPRBus *spapr_vio_bus_init(void) return bus; } =20 -/* Represents sPAPR hcall VIO devices */ - -static int spapr_vio_bridge_init(SysBusDevice *dev) -{ - /* nothing */ - return 0; -} - static void spapr_vio_bridge_class_init(ObjectClass *klass, void *data) { - SysBusDeviceClass *k =3D SYS_BUS_DEVICE_CLASS(klass); DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->fw_name =3D "vdevice"; - k->init =3D spapr_vio_bridge_init; } =20 static const TypeInfo spapr_vio_bridge_info =3D { --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486015200788561.7701495314077; Wed, 1 Feb 2017 22:00:00 -0800 (PST) Received: from localhost ([::1]:54446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAR5-0000sB-0a for importer@patchew.org; Thu, 02 Feb 2017 00:59:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jt-0007RN-2w for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jo-0003nS-68 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:21 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:40517) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jn-0003iU-NP; Thu, 02 Feb 2017 00:15:16 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqR1kS0z9s87; Thu, 2 Feb 2017 16:14:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012499; bh=SPGp+lyvOuKQ56XBIUDaCgMRiKTZFNPQ/251tGbR01c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DptTLT46A1gWCFu1/phe34PhPXAHTJR+9twC0XgQmCbfhKDFMKLDK4GAyVJ4LoFyy JdoLO2+cOIH6oDDJ8JGMF6U3Nu5PsinR74hSutngXvcMNPx1s1ZlSXIWf7+BVIt7wm vVNTGGnJzjGIgD5vaeqrY+pEvOTBTFjLMqKChMAs= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:44 +1100 Message-Id: <20170202051445.5735-47-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 046/107] target-ppc: Add xxextractuw instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xxextractuw: VSX Vector Extract Unsigned Word Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 26 ++++++++++++++++++++++++++ target/ppc/translate/vsx-impl.inc.c | 30 ++++++++++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 5 +++++ 4 files changed, 62 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 1fe56bf..ead799c 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -535,6 +535,7 @@ DEF_HELPER_2(xvrspip, void, env, i32) DEF_HELPER_2(xvrspiz, void, env, i32) DEF_HELPER_2(xxperm, void, env, i32) DEF_HELPER_2(xxpermr, void, env, i32) +DEF_HELPER_4(xxextractuw, void, env, tl, tl, i32) =20 DEF_HELPER_2(efscfsi, i32, env, i32) DEF_HELPER_2(efscfui, i32, env, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 14eb4e4..07832ba 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2001,6 +2001,32 @@ VEXTRACT(uw, u32) VEXTRACT(d, u64) #undef VEXTRACT =20 +void helper_xxextractuw(CPUPPCState *env, target_ulong xtn, + target_ulong xbn, uint32_t index) +{ + ppc_vsr_t xt, xb; + size_t es =3D sizeof(uint32_t); + uint32_t ext_index; + int i; + + getVSR(xbn, &xb, env); + memset(&xt, 0, sizeof(xt)); + +#if defined(HOST_WORDS_BIGENDIAN) + ext_index =3D index; + for (i =3D 0; i < es; i++, ext_index++) { + xt.u8[8 - es + i] =3D xb.u8[ext_index % 16]; + } +#else + ext_index =3D 15 - index; + for (i =3D es - 1; i >=3D 0; i--, ext_index--) { + xt.u8[8 + i] =3D xb.u8[ext_index % 16]; + } +#endif + + putVSR(xtn, &xt, env); +} + #define VEXT_SIGNED(name, element, mask, cast, recast) \ void helper_##name(ppc_avr_t *r, ppc_avr_t *b) \ { \ diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 2a17c35..7977f24 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1180,6 +1180,36 @@ static void gen_xxsldwi(DisasContext *ctx) tcg_temp_free_i64(xtl); } =20 +#define VSX_EXTRACT(name) \ +static void gen_##name(DisasContext *ctx) \ +{ \ + TCGv xt, xb; \ + TCGv_i32 t0 =3D tcg_temp_new_i32(); \ + uint8_t uimm =3D UIMM4(ctx->opcode); \ + \ + if (unlikely(!ctx->vsx_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VSXU); \ + return; \ + } \ + xt =3D tcg_const_tl(xT(ctx->opcode)); \ + xb =3D tcg_const_tl(xB(ctx->opcode)); \ + /* uimm > 15 out of bound and for \ + * uimm > 12 handle as per hardware in helper \ + */ \ + if (uimm > 15) { \ + tcg_gen_movi_i64(cpu_vsrh(xT(ctx->opcode)), 0); \ + tcg_gen_movi_i64(cpu_vsrl(xT(ctx->opcode)), 0); \ + return; \ + } \ + tcg_gen_movi_i32(t0, uimm); \ + gen_helper_##name(cpu_env, xt, xb, t0); \ + tcg_temp_free(xb); \ + tcg_temp_free(xt); \ + tcg_temp_free_i32(t0); \ +} + +VSX_EXTRACT(xxextractuw) + #undef GEN_XX2FORM #undef GEN_XX3FORM #undef GEN_XX2IFORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 46b95e3..473d925 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -49,6 +49,10 @@ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC= _NONE, fl2) GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0, opc3, 0, PPC_NONE, fl2), \ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2) =20 +#define GEN_XX2FORM_EXT(name, opc2, opc3, fl2) \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0, opc3, 0x00100000, PPC_NONE, fl= 2), \ +GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0x00100000, PPC_NONE, fl= 2) + #define GEN_XX2FORM_EO(name, opc2, opc3, opc4, fl2) = \ GEN_HANDLER2_E_2(name, #name, 0x3C, opc2 | 0, opc3, opc4, 0, PPC_NONE, fl2= ), \ GEN_HANDLER2_E_2(name, #name, 0x3C, opc2 | 1, opc3, opc4, 0, PPC_NONE, fl2) @@ -280,6 +284,7 @@ GEN_XX3FORM(xxpermr, 0x08, 0x07, PPC2_ISA300), GEN_XX2FORM(xxspltw, 0x08, 0x0A, PPC2_VSX), GEN_XX1FORM(xxspltib, 0x08, 0x0B, PPC2_ISA300), GEN_XX3FORM_DM(xxsldwi, 0x08, 0x00), +GEN_XX2FORM_EXT(xxextractuw, 0x0A, 0x0A, PPC2_ISA300), =20 #define GEN_XXSEL_ROW(opc3) \ GEN_HANDLER2_E(xxsel, "xxsel", 0x3C, 0x18, opc3, 0, PPC_NONE, PPC2_VSX), \ --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486015508182116.50531248145285; Wed, 1 Feb 2017 22:05:08 -0800 (PST) Received: from localhost ([::1]:54476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAW2-0005hV-1L for importer@patchew.org; Thu, 02 Feb 2017 01:05:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jw-0007VB-24 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jr-0003sU-BM for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:24 -0500 Received: from ozlabs.org ([103.22.144.67]:39965) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jq-0003oe-S4; Thu, 02 Feb 2017 00:15:19 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqS28Hzz9s86; Thu, 2 Feb 2017 16:14:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012500; bh=0b1hM6O7nm2YzJX6OKmOuyo9+QVJydMg1nK1+evzzAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UI52rtPLm16cfavsR+FAxwrRdoF2u4f1Ok8J414QIsmeFu9KDYc31zg21yKejchX6 1CtW7OzROw3oO1l1EsZMZS6/1sBI4mLGp8ANa0fbM4XEGHEZYW62cLNE8B4M9m2YRl eEkfW9OAqnJB9Xteujtq2EoW7Z3N/fdeXrxzGQTQ= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:45 +1100 Message-Id: <20170202051445.5735-48-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 047/107] target-ppc: Add xxinsertw instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xxinsertw: VSX Vector Insert Word Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 25 +++++++++++++++++++++++++ target/ppc/translate/vsx-impl.inc.c | 5 +++-- target/ppc/translate/vsx-ops.inc.c | 1 + 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index ead799c..a4504eb 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -536,6 +536,7 @@ DEF_HELPER_2(xvrspiz, void, env, i32) DEF_HELPER_2(xxperm, void, env, i32) DEF_HELPER_2(xxpermr, void, env, i32) DEF_HELPER_4(xxextractuw, void, env, tl, tl, i32) +DEF_HELPER_4(xxinsertw, void, env, tl, tl, i32) =20 DEF_HELPER_2(efscfsi, i32, env, i32) DEF_HELPER_2(efscfui, i32, env, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 07832ba..81f134b 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2027,6 +2027,31 @@ void helper_xxextractuw(CPUPPCState *env, target_ulo= ng xtn, putVSR(xtn, &xt, env); } =20 +void helper_xxinsertw(CPUPPCState *env, target_ulong xtn, + target_ulong xbn, uint32_t index) +{ + ppc_vsr_t xt, xb; + size_t es =3D sizeof(uint32_t); + int ins_index, i =3D 0; + + getVSR(xbn, &xb, env); + getVSR(xtn, &xt, env); + +#if defined(HOST_WORDS_BIGENDIAN) + ins_index =3D index; + for (i =3D 0; i < es && ins_index < 16; i++, ins_index++) { + xt.u8[ins_index] =3D xb.u8[8 - es + i]; + } +#else + ins_index =3D 15 - index; + for (i =3D es - 1; i >=3D 0 && ins_index >=3D 0; i--, ins_index--) { + xt.u8[ins_index] =3D xb.u8[8 + i]; + } +#endif + + putVSR(xtn, &xt, env); +} + #define VEXT_SIGNED(name, element, mask, cast, recast) \ void helper_##name(ppc_avr_t *r, ppc_avr_t *b) \ { \ diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 7977f24..c9ba0f5 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1180,7 +1180,7 @@ static void gen_xxsldwi(DisasContext *ctx) tcg_temp_free_i64(xtl); } =20 -#define VSX_EXTRACT(name) \ +#define VSX_EXTRACT_INSERT(name) \ static void gen_##name(DisasContext *ctx) \ { \ TCGv xt, xb; \ @@ -1208,7 +1208,8 @@ static void gen_##name(DisasContext *ctx) = \ tcg_temp_free_i32(t0); \ } =20 -VSX_EXTRACT(xxextractuw) +VSX_EXTRACT_INSERT(xxextractuw) +VSX_EXTRACT_INSERT(xxinsertw) =20 #undef GEN_XX2FORM #undef GEN_XX3FORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 473d925..096d358 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -285,6 +285,7 @@ GEN_XX2FORM(xxspltw, 0x08, 0x0A, PPC2_VSX), GEN_XX1FORM(xxspltib, 0x08, 0x0B, PPC2_ISA300), GEN_XX3FORM_DM(xxsldwi, 0x08, 0x00), GEN_XX2FORM_EXT(xxextractuw, 0x0A, 0x0A, PPC2_ISA300), +GEN_XX2FORM_EXT(xxinsertw, 0x0A, 0x0B, PPC2_ISA300), =20 #define GEN_XXSEL_ROW(opc3) \ GEN_HANDLER2_E(xxsel, "xxsel", 0x3C, 0x18, opc3, 0, PPC_NONE, PPC2_VSX), \ --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016325131724.0190034402117; Wed, 1 Feb 2017 22:18:45 -0800 (PST) Received: from localhost ([::1]:54559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAjD-0002kw-5m for importer@patchew.org; Thu, 02 Feb 2017 01:18:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jw-0007WL-PC for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jq-0003qG-64 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:24 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:54527) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jp-0003li-Ba; Thu, 02 Feb 2017 00:15:18 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqR5QgMz9s8N; Thu, 2 Feb 2017 16:14:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012499; bh=AC1TlmsD12/o5Nk+Qq5oNt5kAKdoK8JzkOgsPc1XPHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=plQgXFTehT76+VE2I9iLq+XN+b0vb7qh5IjfaUtDg+k1GrLxcULt87IwrNy5a9wP9 IWzKeklMblorvv2GgiWnZh5gX6Ewwr4HA+OAG5/bvKvlvFX8Z7K7NtY/jeFojPYf9N TEjz/1gXE4RVMRnb6Po4sAn9QlWMqoyBohk2mV7c= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:46 +1100 Message-Id: <20170202051445.5735-49-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 048/107] prep: add PReP System I/O X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Herv=C3=A9 Poussineau This device is a partial duplicate of System I/O device available in hw/ppc= /prep.c This new one doesn't have all the Motorola-specific registers. The old one should be deprecated and removed with the 'prep' machine. Partial documentation available at ftp://ftp.software.ibm.com/rs6000/technology/spec/srp1_1.exe section 6.1.5 (I/O Device Mapping) Signed-off-by: Herv=C3=A9 Poussineau Reviewed-by: David Gibson Signed-off-by: David Gibson --- hw/ppc/Makefile.objs | 1 + hw/ppc/prep_systemio.c | 303 +++++++++++++++++++++++++++++++++++++++++++++= ++++ hw/ppc/trace-events | 4 + 3 files changed, 308 insertions(+) create mode 100644 hw/ppc/prep_systemio.c diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs index 8025129..db72297 100644 --- a/hw/ppc/Makefile.objs +++ b/hw/ppc/Makefile.objs @@ -16,6 +16,7 @@ obj-y +=3D ppc405_boards.o ppc4xx_devs.o ppc405_uc.o ppc4= 40_bamboo.o obj-y +=3D ppc4xx_pci.o # PReP obj-$(CONFIG_PREP) +=3D prep.o +obj-$(CONFIG_PREP) +=3D prep_systemio.o # OldWorld PowerMac obj-$(CONFIG_MAC) +=3D mac_oldworld.o # NewWorld PowerMac diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c new file mode 100644 index 0000000..50893ec --- /dev/null +++ b/hw/ppc/prep_systemio.c @@ -0,0 +1,303 @@ +/* + * QEMU PReP System I/O emulation + * + * Copyright (c) 2017 Herv=C3=A9 Poussineau + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "hw/isa/isa.h" +#include "exec/address-spaces.h" +#include "qemu/error-report.h" /* for error_report() */ +#include "sysemu/sysemu.h" /* for vm_stop() */ +#include "cpu.h" +#include "trace.h" + +#define TYPE_PREP_SYSTEMIO "prep-systemio" +#define PREP_SYSTEMIO(obj) \ + OBJECT_CHECK(PrepSystemIoState, (obj), TYPE_PREP_SYSTEMIO) + +/* Bit as defined in PowerPC Reference Plaform v1.1, sect. 6.1.5, p. 132 */ +#define PREP_BIT(n) (1 << (7 - (n))) + +typedef struct PrepSystemIoState { + ISADevice parent_obj; + MemoryRegion ppc_parity_mem; + + qemu_irq non_contiguous_io_map_irq; + uint8_t sreset; /* 0x0092 */ + uint8_t equipment; /* 0x080c */ + uint8_t system_control; /* 0x081c */ + uint8_t iomap_type; /* 0x0850 */ + uint8_t ibm_planar_id; /* 0x0852 */ + qemu_irq softreset_irq; + PortioList portio; +} PrepSystemIoState; + +/* PORT 0092 -- Special Port 92 (Read/Write) */ + +enum { + PORT0092_SOFTRESET =3D PREP_BIT(7), + PORT0092_LE_MODE =3D PREP_BIT(6), +}; + +static void prep_port0092_write(void *opaque, uint32_t addr, uint32_t val) +{ + PrepSystemIoState *s =3D opaque; + + trace_prep_systemio_write(addr, val); + + s->sreset =3D val & PORT0092_SOFTRESET; + qemu_set_irq(s->softreset_irq, s->sreset); + + if ((val & PORT0092_LE_MODE) !=3D 0) { + /* XXX Not supported yet */ + error_report("little-endian mode not supported"); + vm_stop(RUN_STATE_PAUSED); + } else { + /* Nothing to do */ + } +} + +static uint32_t prep_port0092_read(void *opaque, uint32_t addr) +{ + PrepSystemIoState *s =3D opaque; + trace_prep_systemio_read(addr, s->sreset); + return s->sreset; +} + +/* PORT 0808 -- Hardfile Light Register (Write Only) */ + +enum { + PORT0808_HARDFILE_LIGHT_ON =3D PREP_BIT(7), +}; + +static void prep_port0808_write(void *opaque, uint32_t addr, uint32_t val) +{ + trace_prep_systemio_write(addr, val); +} + +/* PORT 0810 -- Password Protect 1 Register (Write Only) */ + +/* reset by port 0x4D in the SIO */ +static void prep_port0810_write(void *opaque, uint32_t addr, uint32_t val) +{ + trace_prep_systemio_write(addr, val); +} + +/* PORT 0812 -- Password Protect 2 Register (Write Only) */ + +/* reset by port 0x4D in the SIO */ +static void prep_port0812_write(void *opaque, uint32_t addr, uint32_t val) +{ + trace_prep_systemio_write(addr, val); +} + +/* PORT 0814 -- L2 Invalidate Register (Write Only) */ + +static void prep_port0814_write(void *opaque, uint32_t addr, uint32_t val) +{ + trace_prep_systemio_write(addr, val); +} + +/* PORT 0818 -- Reserved for Keylock (Read Only) */ + +enum { + PORT0818_KEYLOCK_SIGNAL_HIGH =3D PREP_BIT(7), +}; + +static uint32_t prep_port0818_read(void *opaque, uint32_t addr) +{ + uint32_t val =3D 0; + trace_prep_systemio_read(addr, val); + return val; +} + +/* PORT 080C -- Equipment */ + +enum { + PORT080C_SCSIFUSE =3D PREP_BIT(1), + PORT080C_L2_COPYBACK =3D PREP_BIT(4), + PORT080C_L2_256 =3D PREP_BIT(5), + PORT080C_UPGRADE_CPU =3D PREP_BIT(6), + PORT080C_L2 =3D PREP_BIT(7), +}; + +static uint32_t prep_port080c_read(void *opaque, uint32_t addr) +{ + PrepSystemIoState *s =3D opaque; + trace_prep_systemio_read(addr, s->equipment); + return s->equipment; +} + +/* PORT 081C -- System Control Register (Read/Write) */ + +enum { + PORT081C_FLOPPY_MOTOR_INHIBIT =3D PREP_BIT(3), + PORT081C_MASK_TEA =3D PREP_BIT(2), + PORT081C_L2_UPDATE_INHIBIT =3D PREP_BIT(1), + PORT081C_L2_CACHEMISS_INHIBIT =3D PREP_BIT(0), +}; + +static void prep_port081c_write(void *opaque, uint32_t addr, uint32_t val) +{ + static const uint8_t mask =3D PORT081C_FLOPPY_MOTOR_INHIBIT | + PORT081C_MASK_TEA | + PORT081C_L2_UPDATE_INHIBIT | + PORT081C_L2_CACHEMISS_INHIBIT; + PrepSystemIoState *s =3D opaque; + trace_prep_systemio_write(addr, val); + s->system_control =3D val & mask; +} + +static uint32_t prep_port081c_read(void *opaque, uint32_t addr) +{ + PrepSystemIoState *s =3D opaque; + trace_prep_systemio_read(addr, s->system_control); + return s->system_control; +} + +/* System Board Identification */ + +static uint32_t prep_port0852_read(void *opaque, uint32_t addr) +{ + PrepSystemIoState *s =3D opaque; + trace_prep_systemio_read(addr, s->ibm_planar_id); + return s->ibm_planar_id; +} + +/* PORT 0850 -- I/O Map Type Register (Read/Write) */ + +enum { + PORT0850_IOMAP_NONCONTIGUOUS =3D PREP_BIT(7), +}; + +static uint32_t prep_port0850_read(void *opaque, uint32_t addr) +{ + PrepSystemIoState *s =3D opaque; + trace_prep_systemio_read(addr, s->iomap_type); + return s->iomap_type; +} + +static void prep_port0850_write(void *opaque, uint32_t addr, uint32_t val) +{ + PrepSystemIoState *s =3D opaque; + + trace_prep_systemio_write(addr, val); + qemu_set_irq(s->non_contiguous_io_map_irq, + val & PORT0850_IOMAP_NONCONTIGUOUS); + s->iomap_type =3D val & PORT0850_IOMAP_NONCONTIGUOUS; +} + +static const MemoryRegionPortio ppc_io800_port_list[] =3D { + { 0x092, 1, 1, .read =3D prep_port0092_read, + .write =3D prep_port0092_write, }, + { 0x808, 1, 1, .write =3D prep_port0808_write, }, + { 0x80c, 1, 1, .read =3D prep_port080c_read, }, + { 0x810, 1, 1, .write =3D prep_port0810_write, }, + { 0x812, 1, 1, .write =3D prep_port0812_write, }, + { 0x814, 1, 1, .write =3D prep_port0814_write, }, + { 0x818, 1, 1, .read =3D prep_port0818_read }, + { 0x81c, 1, 1, .read =3D prep_port081c_read, + .write =3D prep_port081c_write, }, + { 0x850, 1, 1, .read =3D prep_port0850_read, + .write =3D prep_port0850_write, }, + { 0x852, 1, 1, .read =3D prep_port0852_read, }, + PORTIO_END_OF_LIST() +}; + +static uint64_t ppc_parity_error_readl(void *opaque, hwaddr addr, + unsigned int size) +{ + uint32_t val =3D 0; + trace_prep_systemio_read((unsigned int)addr, val); + return val; +} + +static const MemoryRegionOps ppc_parity_error_ops =3D { + .read =3D ppc_parity_error_readl, + .valid =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + }, +}; + +static void prep_systemio_realize(DeviceState *dev, Error **errp) +{ + ISADevice *isa =3D ISA_DEVICE(dev); + PrepSystemIoState *s =3D PREP_SYSTEMIO(dev); + PowerPCCPU *cpu; + + qdev_init_gpio_out(dev, &s->non_contiguous_io_map_irq, 1); + s->iomap_type =3D PORT0850_IOMAP_NONCONTIGUOUS; + qemu_set_irq(s->non_contiguous_io_map_irq, + s->iomap_type & PORT0850_IOMAP_NONCONTIGUOUS); + cpu =3D POWERPC_CPU(first_cpu); + s->softreset_irq =3D cpu->env.irq_inputs[PPC6xx_INPUT_HRESET]; + + isa_register_portio_list(isa, &s->portio, 0x0, ppc_io800_port_list, s, + "systemio800"); + + memory_region_init_io(&s->ppc_parity_mem, OBJECT(dev), + &ppc_parity_error_ops, s, "ppc-parity", 0x4); + memory_region_add_subregion(get_system_memory(), 0xbfffeff0, + &s->ppc_parity_mem); +} + +static const VMStateDescription vmstate_prep_systemio =3D { + .name =3D "prep_systemio", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(sreset, PrepSystemIoState), + VMSTATE_UINT8(system_control, PrepSystemIoState), + VMSTATE_UINT8(iomap_type, PrepSystemIoState), + VMSTATE_END_OF_LIST() + }, +}; + +static Property prep_systemio_properties[] =3D { + DEFINE_PROP_UINT8("ibm-planar-id", PrepSystemIoState, ibm_planar_id, 0= ), + DEFINE_PROP_UINT8("equipment", PrepSystemIoState, equipment, 0), + DEFINE_PROP_END_OF_LIST() +}; + +static void prep_systemio_class_initfn(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->realize =3D prep_systemio_realize; + dc->vmsd =3D &vmstate_prep_systemio; + dc->props =3D prep_systemio_properties; +} + +static TypeInfo prep_systemio800_info =3D { + .name =3D TYPE_PREP_SYSTEMIO, + .parent =3D TYPE_ISA_DEVICE, + .instance_size =3D sizeof(PrepSystemIoState), + .class_init =3D prep_systemio_class_initfn, +}; + +static void prep_systemio_register_types(void) +{ + type_register_static(&prep_systemio800_info); +} + +type_init(prep_systemio_register_types) diff --git a/hw/ppc/trace-events b/hw/ppc/trace-events index 2297ead..2ba6166 100644 --- a/hw/ppc/trace-events +++ b/hw/ppc/trace-events @@ -74,3 +74,7 @@ ppc_tb_adjust(uint64_t offs1, uint64_t offs2, int64_t dif= f, int64_t seconds) "ad # hw/ppc/prep.c prep_io_800_writeb(uint32_t addr, uint32_t val) "0x%08" PRIx32 " =3D> 0x%0= 2" PRIx32 prep_io_800_readb(uint32_t addr, uint32_t retval) "0x%08" PRIx32 " <=3D 0x= %02" PRIx32 + +# hw/ppc/prep_systemio.c +prep_systemio_read(uint32_t addr, uint32_t val) "read addr=3D%x val=3D%x" +prep_systemio_write(uint32_t addr, uint32_t val) "write addr=3D%x val=3D%x" --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016584870193.34251027007326; Wed, 1 Feb 2017 22:23:04 -0800 (PST) Received: from localhost ([::1]:54586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAnO-0007BQ-La for importer@patchew.org; Thu, 02 Feb 2017 01:23:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jx-0007Xa-LU for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jq-0003qr-FW for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:25 -0500 Received: from ozlabs.org ([103.22.144.67]:44885) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jp-0003n3-Kl; Thu, 02 Feb 2017 00:15:18 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqR6C7cz9s7H; Thu, 2 Feb 2017 16:14:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012499; bh=Z+rcy5Vwbbqzr8px4pdV47xqWWDHXC9Xo1yjLZS8m9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aDQ8Mdq0GW3hQdUI2BbD+kr7BniMYK1l5/dOFjdwiMRJrgRPNGj2IyUEEsjhBkwGf V52kX8PtySW00ZzlGjNdHUd8tk0hIBb0CQdWIhIW4RnJj8cSX5AezZh5q5/xE8/hpl tsNNNNSJeXlC7k0xE/GVsGKl65mBmVz06qJs/dzc= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:47 +1100 Message-Id: <20170202051445.5735-50-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 049/107] prep: add IBM RS/6000 7020 (40p) memory controller X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Herv=C3=A9 Poussineau Signed-off-by: Herv=C3=A9 Poussineau Reviewed-by: David Gibson [dwg: Added CONFIG_RS6000_MC to ppc64 or it breaks testcases] Signed-off-by: David Gibson --- default-configs/ppc-softmmu.mak | 1 + default-configs/ppc64-softmmu.mak | 1 + hw/ppc/Makefile.objs | 1 + hw/ppc/rs6000_mc.c | 232 ++++++++++++++++++++++++++++++++++= ++++ hw/ppc/trace-events | 7 ++ 5 files changed, 242 insertions(+) create mode 100644 hw/ppc/rs6000_mc.c diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.= mak index d4d0f9b..e567658 100644 --- a/default-configs/ppc-softmmu.mak +++ b/default-configs/ppc-softmmu.mak @@ -47,3 +47,4 @@ CONFIG_LIBDECNUMBER=3Dy # For PReP CONFIG_MC146818RTC=3Dy CONFIG_ISA_TESTDEV=3Dy +CONFIG_RS6000_MC=3Dy diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-soft= mmu.mak index 67a9bca..9ae6563 100644 --- a/default-configs/ppc64-softmmu.mak +++ b/default-configs/ppc64-softmmu.mak @@ -55,3 +55,4 @@ CONFIG_XICS_KVM=3D$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) CONFIG_MC146818RTC=3Dy CONFIG_ISA_TESTDEV=3Dy CONFIG_MEM_HOTPLUG=3Dy +CONFIG_RS6000_MC=3Dy diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs index db72297..0012934 100644 --- a/hw/ppc/Makefile.objs +++ b/hw/ppc/Makefile.objs @@ -17,6 +17,7 @@ obj-y +=3D ppc4xx_pci.o # PReP obj-$(CONFIG_PREP) +=3D prep.o obj-$(CONFIG_PREP) +=3D prep_systemio.o +obj-${CONFIG_RS6000_MC} +=3D rs6000_mc.o # OldWorld PowerMac obj-$(CONFIG_MAC) +=3D mac_oldworld.o # NewWorld PowerMac diff --git a/hw/ppc/rs6000_mc.c b/hw/ppc/rs6000_mc.c new file mode 100644 index 0000000..b613565 --- /dev/null +++ b/hw/ppc/rs6000_mc.c @@ -0,0 +1,232 @@ +/* + * QEMU RS/6000 memory controller + * + * Copyright (c) 2017 Herv=C3=A9 Poussineau + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) version 3 or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "qemu/osdep.h" +#include "hw/isa/isa.h" +#include "exec/address-spaces.h" +#include "hw/boards.h" +#include "qapi/error.h" +#include "trace.h" + +#define TYPE_RS6000MC "rs6000-mc" +#define RS6000MC_DEVICE(obj) \ + OBJECT_CHECK(RS6000MCState, (obj), TYPE_RS6000MC) + +typedef struct RS6000MCState { + ISADevice parent_obj; + /* see US patent 5,684,979 for details (expired 2001-11-04) */ + uint32_t ram_size; + bool autoconfigure; + MemoryRegion simm[6]; + unsigned int simm_size[6]; + uint32_t end_address[8]; + uint8_t port0820_index; + PortioList portio; +} RS6000MCState; + +/* P0RT 0803 -- SIMM ID Register (32/8 MB) (Read Only) */ + +static uint32_t rs6000mc_port0803_read(void *opaque, uint32_t addr) +{ + RS6000MCState *s =3D opaque; + uint32_t val =3D 0; + int socket; + + /* (1 << socket) indicates 32 MB SIMM at given socket */ + for (socket =3D 0; socket < 6; socket++) { + if (s->simm_size[socket] =3D=3D 32) { + val |=3D (1 << socket); + } + } + + trace_rs6000mc_id_read(addr, val); + return val; +} + +/* PORT 0804 -- SIMM Presence Register (Read Only) */ + +static uint32_t rs6000mc_port0804_read(void *opaque, uint32_t addr) +{ + RS6000MCState *s =3D opaque; + uint32_t val =3D 0xff; + int socket; + + /* (1 << socket) indicates SIMM absence at given socket */ + for (socket =3D 0; socket < 6; socket++) { + if (s->simm_size[socket]) { + val &=3D ~(1 << socket); + } + } + s->port0820_index =3D 0; + + trace_rs6000mc_presence_read(addr, val); + return val; +} + +/* Memory Controller Size Programming Register */ + +static uint32_t rs6000mc_port0820_read(void *opaque, uint32_t addr) +{ + RS6000MCState *s =3D opaque; + uint32_t val =3D s->end_address[s->port0820_index] & 0x1f; + s->port0820_index =3D (s->port0820_index + 1) & 7; + trace_rs6000mc_size_read(addr, val); + return val; +} + +static void rs6000mc_port0820_write(void *opaque, uint32_t addr, uint32_t = val) +{ + RS6000MCState *s =3D opaque; + uint8_t socket =3D val >> 5; + uint32_t end_address =3D val & 0x1f; + + trace_rs6000mc_size_write(addr, val); + s->end_address[socket] =3D end_address; + if (socket > 0 && socket < 7) { + if (s->simm_size[socket - 1]) { + uint32_t size; + uint32_t start_address =3D 0; + if (socket > 1) { + start_address =3D s->end_address[socket - 1]; + } + + size =3D end_address - start_address; + memory_region_set_enabled(&s->simm[socket - 1], size !=3D 0); + memory_region_set_address(&s->simm[socket - 1], + start_address * 8 * 1024 * 1024); + } + } +} + +/* Read Memory Parity Error */ + +enum { + PORT0841_NO_ERROR_DETECTED =3D 0x01, +}; + +static uint32_t rs6000mc_port0841_read(void *opaque, uint32_t addr) +{ + uint32_t val =3D PORT0841_NO_ERROR_DETECTED; + trace_rs6000mc_parity_read(addr, val); + return val; +} + +static const MemoryRegionPortio rs6000mc_port_list[] =3D { + { 0x803, 1, 1, .read =3D rs6000mc_port0803_read }, + { 0x804, 1, 1, .read =3D rs6000mc_port0804_read }, + { 0x820, 1, 1, .read =3D rs6000mc_port0820_read, + .write =3D rs6000mc_port0820_write, }, + { 0x841, 1, 1, .read =3D rs6000mc_port0841_read }, + PORTIO_END_OF_LIST() +}; + +static void rs6000mc_realize(DeviceState *dev, Error **errp) +{ + RS6000MCState *s =3D RS6000MC_DEVICE(dev); + int socket =3D 0; + unsigned int ram_size =3D s->ram_size / (1024 * 1024); + + while (socket < 6) { + if (ram_size >=3D 64) { + s->simm_size[socket] =3D 32; + s->simm_size[socket + 1] =3D 32; + ram_size -=3D 64; + } else if (ram_size >=3D 16) { + s->simm_size[socket] =3D 8; + s->simm_size[socket + 1] =3D 8; + ram_size -=3D 16; + } else { + /* Not enough memory */ + break; + } + socket +=3D 2; + } + + for (socket =3D 0; socket < 6; socket++) { + if (s->simm_size[socket]) { + char name[] =3D "simm.?"; + name[5] =3D socket + '0'; + memory_region_allocate_system_memory(&s->simm[socket], OBJECT(= dev), + name, s->simm_size[socket] + * 1024 * 1024); + memory_region_add_subregion_overlap(get_system_memory(), 0, + &s->simm[socket], socket); + } + } + if (ram_size) { + /* unable to push all requested RAM in SIMMs */ + error_setg(errp, "RAM size incompatible with this board. " + "Try again with something else, like %d MB", + s->ram_size / 1024 / 1024 - ram_size); + return; + } + + if (s->autoconfigure) { + uint32_t start_address =3D 0; + for (socket =3D 0; socket < 6; socket++) { + if (s->simm_size[socket]) { + memory_region_set_enabled(&s->simm[socket], true); + memory_region_set_address(&s->simm[socket], start_address); + start_address +=3D memory_region_size(&s->simm[socket]); + } + } + } + + isa_register_portio_list(ISA_DEVICE(dev), &s->portio, 0x0, + rs6000mc_port_list, s, "rs6000mc"); +} + +static const VMStateDescription vmstate_rs6000mc =3D { + .name =3D "rs6000-mc", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(port0820_index, RS6000MCState), + VMSTATE_END_OF_LIST() + }, +}; + +static Property rs6000mc_properties[] =3D { + DEFINE_PROP_UINT32("ram-size", RS6000MCState, ram_size, 0), + DEFINE_PROP_BOOL("auto-configure", RS6000MCState, autoconfigure, true), + DEFINE_PROP_END_OF_LIST() +}; + +static void rs6000mc_class_initfn(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->realize =3D rs6000mc_realize; + dc->vmsd =3D &vmstate_rs6000mc; + dc->props =3D rs6000mc_properties; +} + +static const TypeInfo rs6000mc_info =3D { + .name =3D TYPE_RS6000MC, + .parent =3D TYPE_ISA_DEVICE, + .instance_size =3D sizeof(RS6000MCState), + .class_init =3D rs6000mc_class_initfn, +}; + +static void rs6000mc_types(void) +{ + type_register_static(&rs6000mc_info); +} + +type_init(rs6000mc_types) diff --git a/hw/ppc/trace-events b/hw/ppc/trace-events index 2ba6166..42b8ec0 100644 --- a/hw/ppc/trace-events +++ b/hw/ppc/trace-events @@ -78,3 +78,10 @@ prep_io_800_readb(uint32_t addr, uint32_t retval) "0x%08= " PRIx32 " <=3D 0x%02" PRI # hw/ppc/prep_systemio.c prep_systemio_read(uint32_t addr, uint32_t val) "read addr=3D%x val=3D%x" prep_systemio_write(uint32_t addr, uint32_t val) "write addr=3D%x val=3D%x" + +# hw/ppc/rs6000_mc.c +rs6000mc_id_read(uint32_t addr, uint32_t val) "read addr=3D%x val=3D%x" +rs6000mc_presence_read(uint32_t addr, uint32_t val) "read addr=3D%x val=3D= %x" +rs6000mc_size_read(uint32_t addr, uint32_t val) "read addr=3D%x val=3D%x" +rs6000mc_size_write(uint32_t addr, uint32_t val) "write addr=3D%x val=3D%x" +rs6000mc_parity_read(uint32_t addr, uint32_t val) "read addr=3D%x val=3D%x" --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016844006787.2320466485448; Wed, 1 Feb 2017 22:27:24 -0800 (PST) Received: from localhost ([::1]:54612 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZArZ-0002YL-PB for importer@patchew.org; Thu, 02 Feb 2017 01:27:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jy-0007Z9-LE for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9js-0003ui-CQ for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:26 -0500 Received: from ozlabs.org ([103.22.144.67]:51157) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jr-0003pe-IB; Thu, 02 Feb 2017 00:15:20 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqS3XNmz9s83; Thu, 2 Feb 2017 16:14:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012500; bh=Vy5tLSTndIk4tl12YdKGKCYUzEwczr166jSxrVw6QNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HJ/V16HEqSa8BFiBkud3k9oiAhcXYuEp7usooLYba1nkqLrfJUX2vcepV+nkv9YXS MP91nT4AjtcXSBdU9e40DEmeMx2y0T4llZh5CD5YFRT35pPjOey/ak7sa2phgogJol qxJwGP+8gBxLlaQJzGP4hFRz547BW4T7H1D7hEJ4= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:48 +1100 Message-Id: <20170202051445.5735-51-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 050/107] prep: add IBM RS/6000 7020 (40p) machine emulation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Herv=C3=A9 Poussineau Machine supports both Open Hack'Ware and OpenBIOS. Open Hack'Ware is the default because OpenBIOS is currently unable to boot PReP boot partitions or PReP kernels. Signed-off-by: Herv=C3=A9 Poussineau [dwg: Correct compile failure with KVM located by Thomas Huth] Signed-off-by: David Gibson --- default-configs/ppc-softmmu.mak | 1 + hw/ppc/prep.c | 230 ++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 231 insertions(+) diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.= mak index e567658..7dd004e 100644 --- a/default-configs/ppc-softmmu.mak +++ b/default-configs/ppc-softmmu.mak @@ -18,6 +18,7 @@ CONFIG_I82378=3Dy CONFIG_PC87312=3Dy CONFIG_MACIO=3Dy CONFIG_PCSPK=3Dy +CONFIG_CS4231A=3Dy CONFIG_CUDA=3Dy CONFIG_ADB=3Dy CONFIG_MAC_NVRAM=3Dy diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 9fb89d3..ca7959c 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -2,6 +2,7 @@ * QEMU PPC PREP hardware System Emulator * * Copyright (c) 2003-2007 Jocelyn Mayer + * Copyright (c) 2017 Herv=C3=A9 Poussineau * * Permission is hereby granted, free of charge, to any person obtaining a= copy * of this software and associated documentation files (the "Software"), t= o deal @@ -43,17 +44,21 @@ #include "hw/isa/pc87312.h" #include "sysemu/block-backend.h" #include "sysemu/arch_init.h" +#include "sysemu/kvm.h" #include "sysemu/qtest.h" #include "exec/address-spaces.h" #include "trace.h" #include "elf.h" #include "qemu/cutils.h" +#include "kvm_ppc.h" =20 /* SMP is not enabled, for now */ #define MAX_CPUS 1 =20 #define MAX_IDE_BUS 2 =20 +#define CFG_ADDR 0xf0000510 + #define BIOS_SIZE (1024 * 1024) #define BIOS_FILENAME "ppc_rom.bin" #define KERNEL_LOAD_ADDR 0x01000000 @@ -316,6 +321,12 @@ static uint32_t PREP_io_800_readb (void *opaque, uint3= 2_t addr) =20 #define NVRAM_SIZE 0x2000 =20 +static void fw_cfg_boot_set(void *opaque, const char *boot_device, + Error **errp) +{ + fw_cfg_modify_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); +} + static void ppc_prep_reset(void *opaque) { PowerPCCPU *cpu =3D opaque; @@ -677,4 +688,223 @@ static void prep_machine_init(MachineClass *mc) mc->default_boot_order =3D "cad"; } =20 +static int prep_set_cmos_checksum(DeviceState *dev, void *opaque) +{ + uint16_t checksum =3D *(uint16_t *)opaque; + ISADevice *rtc; + + if (object_dynamic_cast(OBJECT(dev), "mc146818rtc")) { + rtc =3D ISA_DEVICE(dev); + rtc_set_memory(rtc, 0x2e, checksum & 0xff); + rtc_set_memory(rtc, 0x3e, checksum & 0xff); + rtc_set_memory(rtc, 0x2f, checksum >> 8); + rtc_set_memory(rtc, 0x3f, checksum >> 8); + } + return 0; +} + +static void ibm_40p_init(MachineState *machine) +{ + CPUPPCState *env =3D NULL; + uint16_t cmos_checksum; + PowerPCCPU *cpu; + DeviceState *dev; + SysBusDevice *pcihost; + Nvram *m48t59 =3D NULL; + PCIBus *pci_bus; + ISABus *isa_bus; + void *fw_cfg; + int i; + uint32_t kernel_base =3D 0, initrd_base =3D 0; + long kernel_size =3D 0, initrd_size =3D 0; + char boot_device; + + /* init CPU */ + if (!machine->cpu_model) { + machine->cpu_model =3D "604"; + } + cpu =3D cpu_ppc_init(machine->cpu_model); + if (!cpu) { + error_report("could not initialize CPU '%s'", + machine->cpu_model); + exit(1); + } + env =3D &cpu->env; + if (PPC_INPUT(env) !=3D PPC_FLAGS_INPUT_6xx) { + error_report("only 6xx bus is supported on this machine"); + exit(1); + } + + if (env->flags & POWERPC_FLAG_RTC_CLK) { + /* POWER / PowerPC 601 RTC clock frequency is 7.8125 MHz */ + cpu_ppc_tb_init(env, 7812500UL); + } else { + /* Set time-base frequency to 100 Mhz */ + cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); + } + qemu_register_reset(ppc_prep_reset, cpu); + + /* PCI host */ + dev =3D qdev_create(NULL, "raven-pcihost"); + if (!bios_name) { + bios_name =3D BIOS_FILENAME; + } + qdev_prop_set_string(dev, "bios-name", bios_name); + qdev_prop_set_uint32(dev, "elf-machine", PPC_ELF_MACHINE); + pcihost =3D SYS_BUS_DEVICE(dev); + object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev), NU= LL); + qdev_init_nofail(dev); + pci_bus =3D PCI_BUS(qdev_get_child_bus(dev, "pci.0")); + if (!pci_bus) { + error_report("could not create PCI host controller"); + exit(1); + } + + /* PCI -> ISA bridge */ + dev =3D DEVICE(pci_create_simple(pci_bus, PCI_DEVFN(11, 0), "i82378")); + qdev_connect_gpio_out(dev, 0, + cpu->env.irq_inputs[PPC6xx_INPUT_INT]); + sysbus_connect_irq(pcihost, 0, qdev_get_gpio_in(dev, 15)); + sysbus_connect_irq(pcihost, 1, qdev_get_gpio_in(dev, 13)); + sysbus_connect_irq(pcihost, 2, qdev_get_gpio_in(dev, 15)); + sysbus_connect_irq(pcihost, 3, qdev_get_gpio_in(dev, 13)); + isa_bus =3D ISA_BUS(qdev_get_child_bus(dev, "isa.0")); + + /* Memory controller */ + dev =3D DEVICE(isa_create(isa_bus, "rs6000-mc")); + qdev_prop_set_uint32(dev, "ram-size", machine->ram_size); + qdev_init_nofail(dev); + + /* initialize CMOS checksums */ + cmos_checksum =3D 0x6aa9; + qbus_walk_children(BUS(isa_bus), prep_set_cmos_checksum, NULL, NULL, N= ULL, + &cmos_checksum); + + /* initialize audio subsystem */ + audio_init(); + + /* add some more devices */ + if (defaults_enabled()) { + isa_create_simple(isa_bus, "i8042"); + m48t59 =3D NVRAM(isa_create_simple(isa_bus, "isa-m48t59")); + + dev =3D DEVICE(isa_create(isa_bus, "cs4231a")); + qdev_prop_set_uint32(dev, "iobase", 0x830); + qdev_prop_set_uint32(dev, "irq", 10); + qdev_init_nofail(dev); + + dev =3D DEVICE(isa_create(isa_bus, "pc87312")); + qdev_prop_set_uint32(dev, "config", 12); + qdev_init_nofail(dev); + + dev =3D DEVICE(isa_create(isa_bus, "prep-systemio")); + qdev_prop_set_uint32(dev, "ibm-planar-id", 0xfc); + qdev_prop_set_uint32(dev, "equipment", 0xc0); + qdev_init_nofail(dev); + + pci_create_simple(pci_bus, PCI_DEVFN(1, 0), "lsi53c810"); + + /* XXX: s3-trio at PCI_DEVFN(2, 0) */ + pci_vga_init(pci_bus); + + for (i =3D 0; i < nb_nics; i++) { + pci_nic_init_nofail(&nd_table[i], pci_bus, "pcnet", + i =3D=3D 0 ? "3" : NULL); + } + } + + /* Prepare firmware configuration for OpenBIOS */ + fw_cfg =3D fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2); + + if (machine->kernel_filename) { + /* load kernel */ + kernel_base =3D KERNEL_LOAD_ADDR; + kernel_size =3D load_image_targphys(machine->kernel_filename, + kernel_base, + machine->ram_size - kernel_base); + if (kernel_size < 0) { + error_report("could not load kernel '%s'", + machine->kernel_filename); + exit(1); + } + fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base); + fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); + /* load initrd */ + if (machine->initrd_filename) { + initrd_base =3D INITRD_LOAD_ADDR; + initrd_size =3D load_image_targphys(machine->initrd_filename, + initrd_base, + machine->ram_size - initrd_b= ase); + if (initrd_size < 0) { + error_report("could not load initial ram disk '%s'", + machine->initrd_filename); + exit(1); + } + fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_base); + fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size); + } + if (machine->kernel_cmdline && *machine->kernel_cmdline) { + fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR); + pstrcpy_targphys("cmdline", CMDLINE_ADDR, TARGET_PAGE_SIZE, + machine->kernel_cmdline); + fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, + machine->kernel_cmdline); + fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, + strlen(machine->kernel_cmdline) + 1); + } + boot_device =3D 'm'; + } else { + boot_device =3D machine->boot_order[0]; + } + + fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); + fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size); + fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_PREP); + + fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width); + fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height); + fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth); + + fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled()); + if (kvm_enabled()) { +#ifdef CONFIG_KVM + uint8_t *hypercall; + + fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, kvmppc_get_tbfreq()); + hypercall =3D g_malloc(16); + kvmppc_get_hypercall(env, hypercall, 16); + fw_cfg_add_bytes(fw_cfg, FW_CFG_PPC_KVM_HC, hypercall, 16); + fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_KVM_PID, getpid()); +#endif + } else { + fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, NANOSECONDS_PER_SECOND); + } + fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, boot_device); + qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); + + /* Prepare firmware configuration for Open Hack'Ware */ + if (m48t59) { + PPC_NVRAM_set_params(m48t59, NVRAM_SIZE, "PREP", ram_size, + boot_device, + kernel_base, kernel_size, + machine->kernel_cmdline, + initrd_base, initrd_size, + /* XXX: need an option to load a NVRAM image = */ + 0, + graphic_width, graphic_height, graphic_depth); + } +} + +static void ibm_40p_machine_init(MachineClass *mc) +{ + mc->desc =3D "IBM RS/6000 7020 (40p)", + mc->init =3D ibm_40p_init; + mc->max_cpus =3D 1; + mc->pci_allow_0_address =3D true; + mc->default_ram_size =3D 128 * M_BYTE; + mc->block_default_type =3D IF_SCSI; + mc->default_boot_order =3D "c"; +} + +DEFINE_MACHINE("40p", ibm_40p_machine_init) DEFINE_MACHINE("prep", prep_machine_init) --=20 2.9.3 From nobody Wed May 1 06:27:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486014943065636.3016371535566; Wed, 1 Feb 2017 21:55:43 -0800 (PST) Received: from localhost ([::1]:54425 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAMv-0004nh-AA for importer@patchew.org; Thu, 02 Feb 2017 00:55:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jt-0007RL-1u for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jp-0003pJ-Ax for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:20 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:58909) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jo-0003kk-Pj; Thu, 02 Feb 2017 00:15:17 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqR4qkSz9s82; Thu, 2 Feb 2017 16:14:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012499; bh=GNtuLVUkn0RvVtevANhxM6dWUFlDs3ca65Xdhzd3ZsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PRnFvSj5IpI5O6naISzMLL9YzvCz26+niJqNf90Mk2h/59xgvOKc68BkZHpLomfEl fEvkoSbqjFlWrTTWzaPcgxRquCwGUrn3ju9Ba0txj+W9TZq5zruJgzX5m6R2xR7Sdf Dwv3+UHvW2WZ0FRBjE443dkeYVJOR8OnQHdGfsq0= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:49 +1100 Message-Id: <20170202051445.5735-52-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 051/107] target-ppc: Use float64 arg in helper_compute_fprf() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao Use float64 argument instead of unit64_t in helper_compute_fprf() This allows code in helper_compute_fprf() to be reused later to work with float128 argument too. Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 1ccd5e6..4da991a 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -66,23 +66,21 @@ static inline int ppc_float64_get_unbiased_exp(float64 = f) return ((f >> 52) & 0x7FF) - 1023; } =20 -void helper_compute_fprf(CPUPPCState *env, uint64_t arg) +void helper_compute_fprf(CPUPPCState *env, float64 arg) { - CPU_DoubleU farg; int isneg; int fprf; =20 - farg.ll =3D arg; - isneg =3D float64_is_neg(farg.d); - if (unlikely(float64_is_any_nan(farg.d))) { - if (float64_is_signaling_nan(farg.d, &env->fp_status)) { + isneg =3D float64_is_neg(arg); + if (unlikely(float64_is_any_nan(arg))) { + if (float64_is_signaling_nan(arg, &env->fp_status)) { /* Signaling NaN: flags are undefined */ fprf =3D 0x00; } else { /* Quiet NaN */ fprf =3D 0x11; } - } else if (unlikely(float64_is_infinity(farg.d))) { + } else if (unlikely(float64_is_infinity(arg))) { /* +/- infinity */ if (isneg) { fprf =3D 0x09; @@ -90,7 +88,7 @@ void helper_compute_fprf(CPUPPCState *env, uint64_t arg) fprf =3D 0x05; } } else { - if (float64_is_zero(farg.d)) { + if (float64_is_zero(arg)) { /* +/- zero */ if (isneg) { fprf =3D 0x12; @@ -98,7 +96,7 @@ void helper_compute_fprf(CPUPPCState *env, uint64_t arg) fprf =3D 0x02; } } else { - if (isden(farg.d)) { + if (isden(arg)) { /* Denormalized numbers */ fprf =3D 0x10; } else { --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148601556340885.82536531043945; Wed, 1 Feb 2017 22:06:03 -0800 (PST) Received: from localhost ([::1]:54483 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAWv-0006X3-7w for importer@patchew.org; Thu, 02 Feb 2017 01:06:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jy-0007ZL-QB for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9ju-0003z7-Tb for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:26 -0500 Received: from ozlabs.org ([103.22.144.67]:46643) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9ju-0003vc-F9; Thu, 02 Feb 2017 00:15:22 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqT47TRz9s7J; Thu, 2 Feb 2017 16:14:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012501; bh=sVsFOgMmDpGZh1fqTKMYqBNRkTYIMWUzRuQD3cx05pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PM9oxC51LLOsp6v1OkiTUByHaq3xBwoPIcDowI8UD2TQ4+5x5ms3AJSCGYD1Sz0Qo 4LbzcFlrQEF/YH/qzURQSiXsU/j+RtUjZZ9FL7jJanLG/BqvwunlN3Xgf46ExEvlo5 8b7fQwt9JlmFD77w/2ikgrYMmtQtrOiCPdwYYPkc= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:50 +1100 Message-Id: <20170202051445.5735-53-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 052/107] target-ppc: Replace isden by float64_is_zero_or_denormal X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao Replace isden() by float64_is_zero_or_denormal() so that code in helper_compute_fprf() can be reused to work with float128 argument. Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Reviewed-by: David Gibson Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 4da991a..5a7aa75 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -47,15 +47,6 @@ uint32_t helper_float64_to_float32(CPUPPCState *env, uin= t64_t arg) return f.l; } =20 -static inline int isden(float64 d) -{ - CPU_DoubleU u; - - u.d =3D d; - - return ((u.ll >> 52) & 0x7FF) =3D=3D 0; -} - static inline int ppc_float32_get_unbiased_exp(float32 f) { return ((f >> 23) & 0xFF) - 127; @@ -96,7 +87,7 @@ void helper_compute_fprf(CPUPPCState *env, float64 arg) fprf =3D 0x02; } } else { - if (isden(arg)) { + if (float64_is_zero_or_denormal(arg)) { /* Denormalized numbers */ fprf =3D 0x10; } else { --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016725966273.3595226727135; Wed, 1 Feb 2017 22:25:25 -0800 (PST) Received: from localhost ([::1]:54596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZApf-0000hO-TV for importer@patchew.org; Thu, 02 Feb 2017 01:25:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k6-0007kB-P0 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k0-00045Y-5L for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:34 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:53575) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jz-0003yl-6F; Thu, 02 Feb 2017 00:15:28 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqV14wVz9s9Y; Thu, 2 Feb 2017 16:14:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012502; bh=Smt6iLBNkMeB5uUJtBVgG5NTG/vtvQySaN9cwUGtv+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=itf8/uaLjIu7TTPkmUYP1XjEKdyjBQQPaHYYc2Zi68gJe7sTqhDLOTAUXvr8XQr2l CmY81s8H0hUXdYlBSNdtPUOYmSaSCp5U8/LbBZ1bheznJbNc7zd7n/D2DyULocqFev Kl8px30qD5w5mgRul/D0/yLTppum8YT+yWAc8mGk= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:51 +1100 Message-Id: <20170202051445.5735-54-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 053/107] target-ppc: Rename helper_compute_fprf to helper_compute_fprf_float64 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao Since helper_compute_fprf() works on float64 argument, rename it to helper_compute_fprf_float64(). Also use a macro to generate helper_compute_fprf_float64() so that float128 version of the same helper can be introduced easily later. Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 121 +++++++++++++++++++--------------= ---- target/ppc/helper.h | 2 +- target/ppc/translate/fp-impl.inc.c | 20 +++--- 3 files changed, 73 insertions(+), 70 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 5a7aa75..913d54e 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -57,54 +57,57 @@ static inline int ppc_float64_get_unbiased_exp(float64 = f) return ((f >> 52) & 0x7FF) - 1023; } =20 -void helper_compute_fprf(CPUPPCState *env, float64 arg) -{ - int isneg; - int fprf; - - isneg =3D float64_is_neg(arg); - if (unlikely(float64_is_any_nan(arg))) { - if (float64_is_signaling_nan(arg, &env->fp_status)) { - /* Signaling NaN: flags are undefined */ - fprf =3D 0x00; - } else { - /* Quiet NaN */ - fprf =3D 0x11; - } - } else if (unlikely(float64_is_infinity(arg))) { - /* +/- infinity */ - if (isneg) { - fprf =3D 0x09; - } else { - fprf =3D 0x05; - } - } else { - if (float64_is_zero(arg)) { - /* +/- zero */ - if (isneg) { - fprf =3D 0x12; - } else { - fprf =3D 0x02; - } - } else { - if (float64_is_zero_or_denormal(arg)) { - /* Denormalized numbers */ - fprf =3D 0x10; - } else { - /* Normalized numbers */ - fprf =3D 0x00; - } - if (isneg) { - fprf |=3D 0x08; - } else { - fprf |=3D 0x04; - } - } - } - /* We update FPSCR_FPRF */ - env->fpscr &=3D ~(0x1F << FPSCR_FPRF); - env->fpscr |=3D fprf << FPSCR_FPRF; -} +#define COMPUTE_FPRF(tp) \ +void helper_compute_fprf_##tp(CPUPPCState *env, tp arg) \ +{ \ + int isneg; \ + int fprf; \ + \ + isneg =3D tp##_is_neg(arg); \ + if (unlikely(tp##_is_any_nan(arg))) { \ + if (tp##_is_signaling_nan(arg, &env->fp_status)) { \ + /* Signaling NaN: flags are undefined */ \ + fprf =3D 0x00; \ + } else { \ + /* Quiet NaN */ \ + fprf =3D 0x11; \ + } \ + } else if (unlikely(tp##_is_infinity(arg))) { \ + /* +/- infinity */ \ + if (isneg) { \ + fprf =3D 0x09; \ + } else { \ + fprf =3D 0x05; \ + } \ + } else { \ + if (tp##_is_zero(arg)) { \ + /* +/- zero */ \ + if (isneg) { \ + fprf =3D 0x12; \ + } else { \ + fprf =3D 0x02; \ + } \ + } else { \ + if (tp##_is_zero_or_denormal(arg)) { \ + /* Denormalized numbers */ \ + fprf =3D 0x10; \ + } else { \ + /* Normalized numbers */ \ + fprf =3D 0x00; \ + } \ + if (isneg) { \ + fprf |=3D 0x08; \ + } else { \ + fprf |=3D 0x04; \ + } \ + } \ + } \ + /* We update FPSCR_FPRF */ \ + env->fpscr &=3D ~(0x1F << FPSCR_FPRF); \ + env->fpscr |=3D fprf << FPSCR_FPRF; \ +} + +COMPUTE_FPRF(float64) =20 /* Floating-point invalid operations exception */ static inline __attribute__((__always_inline__)) @@ -1808,7 +1811,7 @@ void helper_##name(CPUPPCState *env, uint32_t opcode)= \ } = \ = \ if (sfprf) { = \ - helper_compute_fprf(env, xt.fld); = \ + helper_compute_fprf_float64(env, xt.fld); = \ } = \ } = \ putVSR(xT(opcode), &xt, env); = \ @@ -1863,7 +1866,7 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ } = \ = \ if (sfprf) { = \ - helper_compute_fprf(env, xt.fld); = \ + helper_compute_fprf_float64(env, xt.fld); = \ } = \ } = \ = \ @@ -1917,7 +1920,7 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ } = \ = \ if (sfprf) { = \ - helper_compute_fprf(env, xt.fld); = \ + helper_compute_fprf_float64(env, xt.fld); = \ } = \ } = \ = \ @@ -1958,7 +1961,7 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ } = \ = \ if (sfprf) { = \ - helper_compute_fprf(env, xt.fld); = \ + helper_compute_fprf_float64(env, xt.fld); = \ } = \ } = \ = \ @@ -2007,7 +2010,7 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ } = \ = \ if (sfprf) { = \ - helper_compute_fprf(env, xt.fld); = \ + helper_compute_fprf_float64(env, xt.fld); = \ } = \ } = \ = \ @@ -2057,7 +2060,7 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ } = \ = \ if (sfprf) { = \ - helper_compute_fprf(env, xt.fld); = \ + helper_compute_fprf_float64(env, xt.fld); = \ } = \ } = \ = \ @@ -2257,7 +2260,7 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ } = \ = \ if (sfprf) { = \ - helper_compute_fprf(env, xt_out.fld); = \ + helper_compute_fprf_float64(env, xt_out.fld); = \ } = \ } = \ putVSR(xT(opcode), &xt_out, env); = \ @@ -2647,7 +2650,7 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ xt.tfld =3D ttp##_snan_to_qnan(xt.tfld); \ } \ if (sfprf) { \ - helper_compute_fprf(env, ttp##_to_float64(xt.tfld, \ + helper_compute_fprf_float64(env, ttp##_to_float64(xt.tfld, \ &env->fp_status)); \ } \ } \ @@ -2758,7 +2761,7 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ xt.tfld =3D helper_frsp(env, xt.tfld); \ } \ if (sfprf) { \ - helper_compute_fprf(env, xt.tfld); \ + helper_compute_fprf_float64(env, xt.tfld); \ } \ } \ \ @@ -2814,7 +2817,7 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ xt.fld =3D tp##_round_to_int(xb.fld, &env->fp_status); \ } \ if (sfprf) { \ - helper_compute_fprf(env, xt.fld); \ + helper_compute_fprf_float64(env, xt.fld); \ } \ } \ \ @@ -2854,7 +2857,7 @@ uint64_t helper_xsrsp(CPUPPCState *env, uint64_t xb) =20 uint64_t xt =3D helper_frsp(env, xb); =20 - helper_compute_fprf(env, xt); + helper_compute_fprf_float64(env, xt); float_check_status(env); return xt; } diff --git a/target/ppc/helper.h b/target/ppc/helper.h index a4504eb..27e0b85 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -56,7 +56,7 @@ DEF_HELPER_FLAGS_2(brinc, TCG_CALL_NO_RWG_SE, tl, tl, tl) =20 DEF_HELPER_1(float_check_status, void, env) DEF_HELPER_1(reset_fpstatus, void, env) -DEF_HELPER_2(compute_fprf, void, env, i64) +DEF_HELPER_2(compute_fprf_float64, void, env, i64) DEF_HELPER_3(store_fpscr, void, env, i64, i32) DEF_HELPER_2(fpscr_clrbit, void, env, i32) DEF_HELPER_2(fpscr_setbit, void, env, i32) diff --git a/target/ppc/translate/fp-impl.inc.c b/target/ppc/translate/fp-i= mpl.inc.c index 872af7b..2fbd4d4 100644 --- a/target/ppc/translate/fp-impl.inc.c +++ b/target/ppc/translate/fp-impl.inc.c @@ -9,9 +9,9 @@ static inline void gen_reset_fpstatus(void) gen_helper_reset_fpstatus(cpu_env); } =20 -static inline void gen_compute_fprf(TCGv_i64 arg) +static inline void gen_compute_fprf_float64(TCGv_i64 arg) { - gen_helper_compute_fprf(cpu_env, arg); + gen_helper_compute_fprf_float64(cpu_env, arg); gen_helper_float_check_status(cpu_env); } =20 @@ -47,7 +47,7 @@ static void gen_f##name(DisasContext *ctx) = \ cpu_fpr[rD(ctx->opcode)]); = \ } = \ if (set_fprf) { = \ - gen_compute_fprf(cpu_fpr[rD(ctx->opcode)]); = \ + gen_compute_fprf_float64(cpu_fpr[rD(ctx->opcode)]); = \ } = \ if (unlikely(Rc(ctx->opcode) !=3D 0)) { = \ gen_set_cr1_from_fpscr(ctx); = \ @@ -74,7 +74,7 @@ static void gen_f##name(DisasContext *ctx) = \ cpu_fpr[rD(ctx->opcode)]); = \ } = \ if (set_fprf) { = \ - gen_compute_fprf(cpu_fpr[rD(ctx->opcode)]); = \ + gen_compute_fprf_float64(cpu_fpr[rD(ctx->opcode)]); = \ } = \ if (unlikely(Rc(ctx->opcode) !=3D 0)) { = \ gen_set_cr1_from_fpscr(ctx); = \ @@ -100,7 +100,7 @@ static void gen_f##name(DisasContext *ctx) = \ cpu_fpr[rD(ctx->opcode)]); = \ } = \ if (set_fprf) { = \ - gen_compute_fprf(cpu_fpr[rD(ctx->opcode)]); = \ + gen_compute_fprf_float64(cpu_fpr[rD(ctx->opcode)]); = \ } = \ if (unlikely(Rc(ctx->opcode) !=3D 0)) { = \ gen_set_cr1_from_fpscr(ctx); = \ @@ -121,7 +121,7 @@ static void gen_f##name(DisasContext *ctx) = \ gen_helper_f##name(cpu_fpr[rD(ctx->opcode)], cpu_env, = \ cpu_fpr[rB(ctx->opcode)]); = \ if (set_fprf) { = \ - gen_compute_fprf(cpu_fpr[rD(ctx->opcode)]); = \ + gen_compute_fprf_float64(cpu_fpr[rD(ctx->opcode)]); = \ } = \ if (unlikely(Rc(ctx->opcode) !=3D 0)) { = \ gen_set_cr1_from_fpscr(ctx); = \ @@ -139,7 +139,7 @@ static void gen_f##name(DisasContext *ctx) = \ gen_helper_f##name(cpu_fpr[rD(ctx->opcode)], cpu_env, = \ cpu_fpr[rB(ctx->opcode)]); = \ if (set_fprf) { = \ - gen_compute_fprf(cpu_fpr[rD(ctx->opcode)]); = \ + gen_compute_fprf_float64(cpu_fpr[rD(ctx->opcode)]); = \ } = \ if (unlikely(Rc(ctx->opcode) !=3D 0)) { = \ gen_set_cr1_from_fpscr(ctx); = \ @@ -174,7 +174,7 @@ static void gen_frsqrtes(DisasContext *ctx) cpu_fpr[rB(ctx->opcode)]); gen_helper_frsp(cpu_fpr[rD(ctx->opcode)], cpu_env, cpu_fpr[rD(ctx->opcode)]); - gen_compute_fprf(cpu_fpr[rD(ctx->opcode)]); + gen_compute_fprf_float64(cpu_fpr[rD(ctx->opcode)]); if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_cr1_from_fpscr(ctx); } @@ -196,7 +196,7 @@ static void gen_fsqrt(DisasContext *ctx) gen_reset_fpstatus(); gen_helper_fsqrt(cpu_fpr[rD(ctx->opcode)], cpu_env, cpu_fpr[rB(ctx->opcode)]); - gen_compute_fprf(cpu_fpr[rD(ctx->opcode)]); + gen_compute_fprf_float64(cpu_fpr[rD(ctx->opcode)]); if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_cr1_from_fpscr(ctx); } @@ -213,7 +213,7 @@ static void gen_fsqrts(DisasContext *ctx) cpu_fpr[rB(ctx->opcode)]); gen_helper_frsp(cpu_fpr[rD(ctx->opcode)], cpu_env, cpu_fpr[rD(ctx->opcode)]); - gen_compute_fprf(cpu_fpr[rD(ctx->opcode)]); + gen_compute_fprf_float64(cpu_fpr[rD(ctx->opcode)]); if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_cr1_from_fpscr(ctx); } --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017140719328.5340356041095; Wed, 1 Feb 2017 22:32:20 -0800 (PST) Received: from localhost ([::1]:54645 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAwM-0007S6-Qf for importer@patchew.org; Thu, 02 Feb 2017 01:32:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jz-0007Zl-2C for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jt-0003wr-IW for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:27 -0500 Received: from ozlabs.org ([103.22.144.67]:34529) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9js-0003rd-RH; Thu, 02 Feb 2017 00:15:21 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqS517qz9s88; Thu, 2 Feb 2017 16:14:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012500; bh=5b7qln5kvzmVeucuuKwG4SDBgyuGr/2WujOgiOCrKrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yx/0r7NxEqy2clAivPtBt+BeTNLvjS7z2vVunt2IZ66vzTXLuUycmcjQtIlBajsBf PmtK+VmkmGyeXXn8BBukXVqmpWIXaLaKs31DEIAA7NpC8p9yBSzwUhJY2nZnQ/jyG/ N4+fedr6AoHwHR4RnUwzLrxwDotpY+EYAzY4WwW4= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:52 +1100 Message-Id: <20170202051445.5735-55-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 054/107] target-ppc: Add xscvdphp, xscvhpdp X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xscvdphp: VSX Scalar round & Convert Double-Precision format to Half-Precision format xscvhpdp: VSX Scalar Convert Half-Precision format to Double-Precision format Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- include/fpu/softfloat.h | 20 ++++++++++++++++++++ target/ppc/fpu_helper.c | 33 +++++++++++++++++++++++++++++++++ target/ppc/helper.h | 2 ++ target/ppc/internal.h | 3 +++ target/ppc/translate/vsx-impl.inc.c | 2 ++ target/ppc/translate/vsx-ops.inc.c | 2 ++ 6 files changed, 62 insertions(+) diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 14f8383..842ec6b 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -356,6 +356,26 @@ static inline int float16_is_any_nan(float16 a) return ((float16_val(a) & ~0x8000) > 0x7c00); } =20 +static inline int float16_is_neg(float16 a) +{ + return float16_val(a) >> 15; +} + +static inline int float16_is_infinity(float16 a) +{ + return (float16_val(a) & 0x7fff) =3D=3D 0x7c00; +} + +static inline int float16_is_zero(float16 a) +{ + return (float16_val(a) & 0x7fff) =3D=3D 0; +} + +static inline int float16_is_zero_or_denormal(float16 a) +{ + return (float16_val(a) & 0x7c00) =3D=3D 0; +} + /*------------------------------------------------------------------------= ---- | The pattern for a default generated half-precision NaN. *-------------------------------------------------------------------------= ---*/ diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 913d54e..f4103f5 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -24,6 +24,7 @@ =20 #define float64_snan_to_qnan(x) ((x) | 0x0008000000000000ULL) #define float32_snan_to_qnan(x) ((x) | 0x00400000) +#define float16_snan_to_qnan(x) ((x) | 0x0200) =20 /*************************************************************************= ****/ /* Floating point operations helpers */ @@ -107,6 +108,7 @@ void helper_compute_fprf_##tp(CPUPPCState *env, tp arg)= \ env->fpscr |=3D fprf << FPSCR_FPRF; \ } =20 +COMPUTE_FPRF(float16) COMPUTE_FPRF(float64) =20 /* Floating-point invalid operations exception */ @@ -2664,6 +2666,37 @@ VSX_CVT_FP_TO_FP(xscvspdp, 1, float32, float64, VsrW= (0), VsrD(0), 1) VSX_CVT_FP_TO_FP(xvcvdpsp, 2, float64, float32, VsrD(i), VsrW(2*i), 0) VSX_CVT_FP_TO_FP(xvcvspdp, 2, float32, float64, VsrW(2*i), VsrD(i), 0) =20 +/* VSX_CVT_FP_TO_FP_HP - VSX floating point/floating point conversion + * involving one half precision value + * op - instruction mnemonic + * stp - source type + * ttp - target type + * sfld - source vsr_t field + * tfld - target vsr_t field + */ +#define VSX_CVT_FP_TO_FP_HP(op, stp, ttp, sfld, tfld) \ +void helper_##op(CPUPPCState *env, uint32_t opcode) \ +{ \ + ppc_vsr_t xt, xb; \ + \ + getVSR(xB(opcode), &xb, env); \ + memset(&xt, 0, sizeof(xt)); \ + \ + xt.tfld =3D stp##_to_##ttp(xb.sfld, 1, &env->fp_status); \ + if (unlikely(stp##_is_signaling_nan(xb.sfld, \ + &env->fp_status))) { \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); \ + xt.tfld =3D ttp##_snan_to_qnan(xt.tfld); \ + } \ + helper_compute_fprf_##ttp(env, xt.tfld); \ + \ + putVSR(xT(opcode), &xt, env); \ + float_check_status(env); \ +} + +VSX_CVT_FP_TO_FP_HP(xscvdphp, float64, float16, VsrD(0), VsrH(3)) +VSX_CVT_FP_TO_FP_HP(xscvhpdp, float16, float64, VsrH(3), VsrD(0)) + uint64_t helper_xscvdpspn(CPUPPCState *env, uint64_t xb) { float_status tstat =3D env->fp_status; diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 27e0b85..29dce9d 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -423,8 +423,10 @@ DEF_HELPER_2(xscmpoqp, void, env, i32) DEF_HELPER_2(xscmpuqp, void, env, i32) DEF_HELPER_2(xsmaxdp, void, env, i32) DEF_HELPER_2(xsmindp, void, env, i32) +DEF_HELPER_2(xscvdphp, void, env, i32) DEF_HELPER_2(xscvdpsp, void, env, i32) DEF_HELPER_2(xscvdpspn, i64, env, i64) +DEF_HELPER_2(xscvhpdp, void, env, i32) DEF_HELPER_2(xscvspdp, void, env, i32) DEF_HELPER_2(xscvspdpn, i64, env, i64) DEF_HELPER_2(xscvdpsxds, void, env, i32) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 66cde46..1e27209 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -211,10 +211,12 @@ typedef union _ppc_vsr_t { =20 #if defined(HOST_WORDS_BIGENDIAN) #define VsrB(i) u8[i] +#define VsrH(i) u16[i] #define VsrW(i) u32[i] #define VsrD(i) u64[i] #else #define VsrB(i) u8[15 - (i)] +#define VsrH(i) u16[7 - (i)] #define VsrW(i) u32[3 - (i)] #define VsrD(i) u64[1 - (i)] #endif @@ -241,4 +243,5 @@ static inline void putVSR(int n, ppc_vsr_t *vsr, CPUPPC= State *env) } } =20 +void helper_compute_fprf_float16(CPUPPCState *env, float16 arg); #endif /* PPC_INTERNAL_H */ diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index c9ba0f5..2a409a3 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -805,8 +805,10 @@ GEN_VSX_HELPER_2(xscmpoqp, 0x04, 0x04, 0, PPC2_VSX) GEN_VSX_HELPER_2(xscmpuqp, 0x04, 0x14, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsmaxdp, 0x00, 0x14, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsmindp, 0x00, 0x15, 0, PPC2_VSX) +GEN_VSX_HELPER_2(xscvdphp, 0x16, 0x15, 0x11, PPC2_ISA300) GEN_VSX_HELPER_2(xscvdpsp, 0x12, 0x10, 0, PPC2_VSX) GEN_VSX_HELPER_XT_XB_ENV(xscvdpspn, 0x16, 0x10, 0, PPC2_VSX207) +GEN_VSX_HELPER_2(xscvhpdp, 0x16, 0x15, 0x10, PPC2_ISA300) GEN_VSX_HELPER_2(xscvspdp, 0x12, 0x14, 0, PPC2_VSX) GEN_VSX_HELPER_XT_XB_ENV(xscvspdpn, 0x16, 0x14, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xscvdpsxds, 0x10, 0x15, 0, PPC2_VSX) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 096d358..5c01aed 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -151,8 +151,10 @@ GEN_VSX_XFORM_300(xscmpoqp, 0x04, 0x04, 0x00600001), GEN_VSX_XFORM_300(xscmpuqp, 0x04, 0x14, 0x00600001), GEN_XX3FORM(xsmaxdp, 0x00, 0x14, PPC2_VSX), GEN_XX3FORM(xsmindp, 0x00, 0x15, PPC2_VSX), +GEN_XX2FORM_EO(xscvdphp, 0x16, 0x15, 0x11, PPC2_ISA300), GEN_XX2FORM(xscvdpsp, 0x12, 0x10, PPC2_VSX), GEN_XX2FORM(xscvdpspn, 0x16, 0x10, PPC2_VSX207), +GEN_XX2FORM_EO(xscvhpdp, 0x16, 0x15, 0x10, PPC2_ISA300), GEN_XX2FORM(xscvspdp, 0x12, 0x14, PPC2_VSX), GEN_XX2FORM(xscvspdpn, 0x16, 0x14, PPC2_VSX207), GEN_XX2FORM(xscvdpsxds, 0x10, 0x15, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486015899441370.82960581553334; Wed, 1 Feb 2017 22:11:39 -0800 (PST) Received: from localhost ([::1]:54516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAcJ-0003bw-7V for importer@patchew.org; Thu, 02 Feb 2017 01:11:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52170) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k5-0007iL-Ak for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jz-00044m-Ct for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:33 -0500 Received: from ozlabs.org ([103.22.144.67]:57599) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jy-0003zc-TD; Thu, 02 Feb 2017 00:15:27 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqV2sqJz9s8S; Thu, 2 Feb 2017 16:14:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012502; bh=vslhaqlhfs9Fx9H6djumL+8vcrkNLco7fOT9vT3S3UA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n0xqLXNTOIEw9z2foyKt8n/Pfk69XStxoT4eLLOLtnIaEhYQt0YD3Dy2VTcRqyG0c GYMFy+GI8HEPJr/QaHdnms+1AAeLWZHf2hzOwT3N2poRXYENg19yU7j1ROCoukG/YI ssmbP/8jdtPHAgXusdzTV/JOCaOlF1xGen1+yWoY= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:53 +1100 Message-Id: <20170202051445.5735-56-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 055/107] target-ppc: Use correct precision for FPRF setting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao Use correct FP precision when setting FPRF in FP conversion helpers instead of always assuming float64 precision. Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 4 ++-- target/ppc/internal.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index f4103f5..01b335f 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -109,6 +109,7 @@ void helper_compute_fprf_##tp(CPUPPCState *env, tp arg)= \ } =20 COMPUTE_FPRF(float16) +COMPUTE_FPRF(float32) COMPUTE_FPRF(float64) =20 /* Floating-point invalid operations exception */ @@ -2652,8 +2653,7 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ xt.tfld =3D ttp##_snan_to_qnan(xt.tfld); \ } \ if (sfprf) { \ - helper_compute_fprf_float64(env, ttp##_to_float64(xt.tfld, \ - &env->fp_status)); \ + helper_compute_fprf_##ttp(env, xt.tfld); \ } \ } \ \ diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 1e27209..187f024 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -244,4 +244,5 @@ static inline void putVSR(int n, ppc_vsr_t *vsr, CPUPPC= State *env) } =20 void helper_compute_fprf_float16(CPUPPCState *env, float16 arg); +void helper_compute_fprf_float32(CPUPPCState *env, float32 arg); #endif /* PPC_INTERNAL_H */ --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016299267670.8100218788429; Wed, 1 Feb 2017 22:18:19 -0800 (PST) Received: from localhost ([::1]:54556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAin-0002Ea-0K for importer@patchew.org; Thu, 02 Feb 2017 01:18:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jy-0007YV-6B for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jt-0003x8-JS for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:26 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:39697) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jt-0003rH-3f; Thu, 02 Feb 2017 00:15:21 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqS4Crcz9s8M; Thu, 2 Feb 2017 16:14:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012500; bh=1PppS6Au1AGLuyres27vaGrmEenLmwM4cGx6vl+yv2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OAYTSpGE3N0G5JeBPAhb10x842dDOuTAnnot2v/Nv6KPlud7AJllAiPnxnrLLRqhB wxeyIOfGw4fz5bP5Nr/yj2vygmTIes5oa+Uq/+JM8v2Yu+2oLPGkTEy0l9esULUzA2 XWjecZyjbHJt1pm5ie2yLvHyNlOCAqJ61kCT4b40= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:54 +1100 Message-Id: <20170202051445.5735-57-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 056/107] target-ppc: Add xsxexpdp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xsxexpdp: VSX Scalar Extract Exponent Dual Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 13 +++++++++++++ target/ppc/translate/vsx-ops.inc.c | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 2a409a3..33ca177 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1213,6 +1213,19 @@ static void gen_##name(DisasContext *ctx) = \ VSX_EXTRACT_INSERT(xxextractuw) VSX_EXTRACT_INSERT(xxinsertw) =20 +#ifdef TARGET_PPC64 +static void gen_xsxexpdp(DisasContext *ctx) +{ + TCGv rt =3D cpu_gpr[rD(ctx->opcode)]; + if (unlikely(!ctx->vsx_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VSXU); + return; + } + tcg_gen_shri_i64(rt, cpu_vsrh(xB(ctx->opcode)), 52); + tcg_gen_andi_i64(rt, rt, 0x7FF); +} +#endif + #undef GEN_XX2FORM #undef GEN_XX3FORM #undef GEN_XX2IFORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 5c01aed..85d3b7d 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -113,6 +113,10 @@ GEN_VSX_XFORM_300_EO(xsnabsqp, 0x04, 0x19, 0x08, 0x000= 00001), GEN_VSX_XFORM_300_EO(xsnegqp, 0x04, 0x19, 0x10, 0x00000001), GEN_VSX_XFORM_300(xscpsgnqp, 0x04, 0x03, 0x00000001), =20 +#ifdef TARGET_PPC64 +GEN_XX2FORM_EO(xsxexpdp, 0x16, 0x15, 0x00, PPC2_ISA300), +#endif + GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), GEN_XX2FORM(xvnabsdp, 0x12, 0x1E, PPC2_VSX), GEN_XX2FORM(xvnegdp, 0x12, 0x1F, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148601818179993.78680067586004; Wed, 1 Feb 2017 22:49:41 -0800 (PST) Received: from localhost ([::1]:54748 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBD8-0000EU-TW for importer@patchew.org; Thu, 02 Feb 2017 01:49:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k8-0007mZ-Jw for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k0-000469-WC for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:36 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:46941) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k0-00043J-GH; Thu, 02 Feb 2017 00:15:28 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqV73g3z9s8T; Thu, 2 Feb 2017 16:14:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012502; bh=AZFxc2xrl2CiJFqfhhGEyQpUJx6Jv21bXwUL7wiwB5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GZ75PvgJXzpuEsu+bat6JKBByB+S80Rw0gLjz9sdAmiFRTPjy35yTvZOZ0vaBMxJg Xds1C7Sh5sLC9ulqnDF/FXaZHrc6zbmoq5qSWffRNp4iz6XsnLBgOrEoK31cwzCtIN hDdSO+U/nBAfiRuqvUnxzSNoETwcBLxNGsenmjMo= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:55 +1100 Message-Id: <20170202051445.5735-58-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 057/107] target-ppc: Add xsxexpqp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xsxexpqp: VSX Scalar Extract Exponent Quad Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 15 +++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 16 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 33ca177..228e2a5 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1224,6 +1224,21 @@ static void gen_xsxexpdp(DisasContext *ctx) tcg_gen_shri_i64(rt, cpu_vsrh(xB(ctx->opcode)), 52); tcg_gen_andi_i64(rt, rt, 0x7FF); } + +static void gen_xsxexpqp(DisasContext *ctx) +{ + TCGv_i64 xth =3D cpu_vsrh(rD(ctx->opcode) + 32); + TCGv_i64 xtl =3D cpu_vsrl(rD(ctx->opcode) + 32); + TCGv_i64 xbh =3D cpu_vsrh(rB(ctx->opcode) + 32); + + if (unlikely(!ctx->vsx_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VSXU); + return; + } + tcg_gen_shri_i64(xth, xbh, 48); + tcg_gen_andi_i64(xth, xth, 0x7FFF); + tcg_gen_movi_i64(xtl, 0); +} #endif =20 #undef GEN_XX2FORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 85d3b7d..87f1852 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -115,6 +115,7 @@ GEN_VSX_XFORM_300(xscpsgnqp, 0x04, 0x03, 0x00000001), =20 #ifdef TARGET_PPC64 GEN_XX2FORM_EO(xsxexpdp, 0x16, 0x15, 0x00, PPC2_ISA300), +GEN_VSX_XFORM_300_EO(xsxexpqp, 0x04, 0x19, 0x02, 0x00000001), #endif =20 GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016449639120.9074765733593; Wed, 1 Feb 2017 22:20:49 -0800 (PST) Received: from localhost ([::1]:54570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAlD-0004R1-Fz for importer@patchew.org; Thu, 02 Feb 2017 01:20:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k8-0007mT-H6 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k3-00048Z-7b for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:36 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:55615) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k2-00045U-MQ; Thu, 02 Feb 2017 00:15:31 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqW4c35z9sDB; Thu, 2 Feb 2017 16:14:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012503; bh=BlFn8WMiLutz1VEnBiJLAshk7DBMzEObWluwSJ3f54A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oaZIr4+tu55ToB242C+e3GIbqhaZKYtwuRFaEbNnmF8EL0XqSkJYnKA4YkDFVnfkx xZ3G/DW5qs6TlvjbOZpm6cleMCqTcbsUX71H2o8CWvXIZl8cs4n0ekFFTuG4ufhSUm t31udJ8vz7Nlf4BNZ2Wu1EkFZ46aXwQO9BTWSt8o= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:56 +1100 Message-Id: <20170202051445.5735-59-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 058/107] target-ppc: Add xsxsigdp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xsxsigdp: VSX Scalar Extract Significand Dual Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 29 +++++++++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 30 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 228e2a5..c6f2208 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1239,6 +1239,35 @@ static void gen_xsxexpqp(DisasContext *ctx) tcg_gen_andi_i64(xth, xth, 0x7FFF); tcg_gen_movi_i64(xtl, 0); } + +static void gen_xsxsigdp(DisasContext *ctx) +{ + TCGv rt =3D cpu_gpr[rD(ctx->opcode)]; + TCGv_i64 t0, zr, nan, exp; + + if (unlikely(!ctx->vsx_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VSXU); + return; + } + exp =3D tcg_temp_new_i64(); + t0 =3D tcg_temp_new_i64(); + zr =3D tcg_const_i64(0); + nan =3D tcg_const_i64(2047); + + tcg_gen_shri_i64(exp, cpu_vsrh(xB(ctx->opcode)), 52); + tcg_gen_andi_i64(exp, exp, 0x7FF); + tcg_gen_movi_i64(t0, 0x0010000000000000); + tcg_gen_movcond_i64(TCG_COND_EQ, t0, exp, zr, zr, t0); + tcg_gen_movcond_i64(TCG_COND_EQ, t0, exp, nan, zr, t0); + tcg_gen_andi_i64(rt, cpu_vsrh(xB(ctx->opcode)), 0x000FFFFFFFFFFFFF); + tcg_gen_or_i64(rt, rt, t0); + + tcg_temp_free_i64(t0); + tcg_temp_free_i64(exp); + tcg_temp_free_i64(zr); + tcg_temp_free_i64(nan); +} + #endif =20 #undef GEN_XX2FORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 87f1852..1fd5285 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -116,6 +116,7 @@ GEN_VSX_XFORM_300(xscpsgnqp, 0x04, 0x03, 0x00000001), #ifdef TARGET_PPC64 GEN_XX2FORM_EO(xsxexpdp, 0x16, 0x15, 0x00, PPC2_ISA300), GEN_VSX_XFORM_300_EO(xsxexpqp, 0x04, 0x19, 0x02, 0x00000001), +GEN_XX2FORM_EO(xsxsigdp, 0x16, 0x15, 0x01, PPC2_ISA300), #endif =20 GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016881412773.4928879419379; Wed, 1 Feb 2017 22:28:01 -0800 (PST) Received: from localhost ([::1]:54615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAsB-0003Q9-IK for importer@patchew.org; Thu, 02 Feb 2017 01:27:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jz-0007aK-Af for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9ju-0003yD-6h for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:27 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:47985) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jt-0003se-Mz; Thu, 02 Feb 2017 00:15:22 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqS5bQ1z9s8G; Thu, 2 Feb 2017 16:14:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012500; bh=93Oul32CU5pWAMC96KylUo5cC0hLDbndCec0qtfKMN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KywmjTSpbMfA4BxPmTvnvcnYufeqxpqfKJfR8ayrFSLnrGbCdVGkHYlNrlLvyiziY gN3CSJQUGs3jEwi3sd9488LXCV1S5mFXiEbZAQhSzdg2IIshCcEswiYIR4DSYBFsGG DcudV/goDWvKiL7VXIEIuRSvmTC1zpXZvVv5ZwA4= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:57 +1100 Message-Id: <20170202051445.5735-60-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 059/107] target-ppc: Add xsxsigqp instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xsxsigqp: VSX Scalar Extract Significand Quad Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 29 +++++++++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 30 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index c6f2208..33e934f 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1268,6 +1268,35 @@ static void gen_xsxsigdp(DisasContext *ctx) tcg_temp_free_i64(nan); } =20 +static void gen_xsxsigqp(DisasContext *ctx) +{ + TCGv_i64 t0, zr, nan, exp; + TCGv_i64 xth =3D cpu_vsrh(rD(ctx->opcode) + 32); + TCGv_i64 xtl =3D cpu_vsrl(rD(ctx->opcode) + 32); + + if (unlikely(!ctx->vsx_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VSXU); + return; + } + exp =3D tcg_temp_new_i64(); + t0 =3D tcg_temp_new_i64(); + zr =3D tcg_const_i64(0); + nan =3D tcg_const_i64(32767); + + tcg_gen_shri_i64(exp, cpu_vsrh(rB(ctx->opcode) + 32), 48); + tcg_gen_andi_i64(exp, exp, 0x7FFF); + tcg_gen_movi_i64(t0, 0x0001000000000000); + tcg_gen_movcond_i64(TCG_COND_EQ, t0, exp, zr, zr, t0); + tcg_gen_movcond_i64(TCG_COND_EQ, t0, exp, nan, zr, t0); + tcg_gen_andi_i64(xth, cpu_vsrh(rB(ctx->opcode) + 32), 0x0000FFFFFFFFFF= FF); + tcg_gen_or_i64(xth, xth, t0); + tcg_gen_mov_i64(xtl, cpu_vsrl(rB(ctx->opcode) + 32)); + + tcg_temp_free_i64(t0); + tcg_temp_free_i64(exp); + tcg_temp_free_i64(zr); + tcg_temp_free_i64(nan); +} #endif =20 #undef GEN_XX2FORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 1fd5285..bfcd09e 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -117,6 +117,7 @@ GEN_VSX_XFORM_300(xscpsgnqp, 0x04, 0x03, 0x00000001), GEN_XX2FORM_EO(xsxexpdp, 0x16, 0x15, 0x00, PPC2_ISA300), GEN_VSX_XFORM_300_EO(xsxexpqp, 0x04, 0x19, 0x02, 0x00000001), GEN_XX2FORM_EO(xsxsigdp, 0x16, 0x15, 0x01, PPC2_ISA300), +GEN_VSX_XFORM_300_EO(xsxsigqp, 0x04, 0x19, 0x12, 0x00000001), #endif =20 GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486018439570206.6671415753592; Wed, 1 Feb 2017 22:53:59 -0800 (PST) Received: from localhost ([::1]:54772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBHI-0004BM-Lj for importer@patchew.org; Thu, 02 Feb 2017 01:53:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k8-0007mx-U1 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k3-00048T-6J for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:36 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:56107) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k2-00045f-NH; Thu, 02 Feb 2017 00:15:31 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqW5l10z9s8Q; Thu, 2 Feb 2017 16:14:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012503; bh=QAPPxUku+EqyQKaASXsKr3I1JXN0TUGrlZ+s6Aj6iP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pT4BzlILYu6MLXZw0VSY/uy6RnD5nypTPaNigUr8RW0yWVtKyAgV1AxWYew6XT1v+ aEcCMHM4XOQRqYg3ZO4rDUGc9vYKWIN3dDwK9rNxZ82pkE4Ab6jmr31R8bvKjgcDbq E9yZ4BHYj2TpB1nY9wZTv9Em1f0iRWLB9s4HQI18= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:58 +1100 Message-Id: <20170202051445.5735-61-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 060/107] pxb: Restrict to x86 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The PCI Expander Bridge (PXB) device is essentially a hack to allow different PCIe devices to be assigned to different NUMA nodes on x86. Each PXB is sort-of a separate PCI host bridge, except that its config space is shared with the config space of the main PCI host bridge, rather than being independent. This is only necessary if the platform doesn't (easily) allow truly independent PCI host bridges. AFAIK that's just x86. This patch makes it possible to configure PXB out of the build, and adjusts the default configs so it's only included on x86 targets. Signed-off-by: David Gibson Acked-by: Michael S. Tsirkin --- default-configs/i386-softmmu.mak | 1 + default-configs/x86_64-softmmu.mak | 1 + hw/pci-bridge/Makefile.objs | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmm= u.mak index 0b51360..6c52d26 100644 --- a/default-configs/i386-softmmu.mak +++ b/default-configs/i386-softmmu.mak @@ -56,3 +56,4 @@ CONFIG_IOH3420=3Dy CONFIG_I82801B11=3Dy CONFIG_SMBIOS=3Dy CONFIG_HYPERV_TESTDEV=3D$(CONFIG_KVM) +CONFIG_PXB=3Dy diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-so= ftmmu.mak index 7f89503..2d0341c 100644 --- a/default-configs/x86_64-softmmu.mak +++ b/default-configs/x86_64-softmmu.mak @@ -56,3 +56,4 @@ CONFIG_IOH3420=3Dy CONFIG_I82801B11=3Dy CONFIG_SMBIOS=3Dy CONFIG_HYPERV_TESTDEV=3D$(CONFIG_KVM) +CONFIG_PXB=3Dy diff --git a/hw/pci-bridge/Makefile.objs b/hw/pci-bridge/Makefile.objs index f2adfe3..5612bd7 100644 --- a/hw/pci-bridge/Makefile.objs +++ b/hw/pci-bridge/Makefile.objs @@ -1,5 +1,5 @@ common-obj-y +=3D pci_bridge_dev.o -common-obj-y +=3D pci_expander_bridge.o +common-obj-$(CONFIG_PXB) +=3D pci_expander_bridge.o common-obj-$(CONFIG_XIO3130) +=3D xio3130_upstream.o xio3130_downstream.o common-obj-$(CONFIG_IOH3420) +=3D ioh3420.o common-obj-$(CONFIG_I82801B11) +=3D i82801b11.o --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148601740276031.859552489805992; Wed, 1 Feb 2017 22:36:42 -0800 (PST) Received: from localhost ([::1]:54671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZB0a-00032D-Iu for importer@patchew.org; Thu, 02 Feb 2017 01:36:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k1-0007d1-Az for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jv-0003zP-1O for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:29 -0500 Received: from ozlabs.org ([103.22.144.67]:36603) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9ju-0003uv-8Y; Thu, 02 Feb 2017 00:15:22 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqT3XSPz9s8W; Thu, 2 Feb 2017 16:14:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012501; bh=8c1XQvFZP8xGCM+kXh2uKy6sDynic6CH9ihysESksas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPBA7IDI06V6v3keLy/aPJKJtHAbECrQ2YsLQaBBC4l4IHYurzczoSsZfOvtjlNb2 UtIGj3rgGgZDbbHwjXUKFqng8xPHzSlR9DiydT5RsBL0qEIeE2uI4RHMAokFxtU3cs ZQBV/QbZ1P7U0TU3aJNM+7GDPaiZyaY7dGUdtAAM= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:13:59 +1100 Message-Id: <20170202051445.5735-62-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 061/107] pseries: Rewrite CAS PVR compatibility logic X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" During boot, PAPR guests negotiate CPU model support with the ibm,client-architecture-support mechanism. The logic to implement this in qemu is very convoluted. This cleans it up to be cleaner, using the new ppc_check_compat() call. The new logic for choosing a compatibility mode is: 1. Usually, use the most recent compatibility mode that is a) supported by the guest b) supported by the CPU and c) no later than the maximum allowed (if specified) 2. If no suitable compatibility mode was found, the guest *does* support this CPU explicitly, and no maximum compatibility mode is specified, then use "raw" mode for the current CPU 3. Otherwise, fail the boot. This differs from the results of the old code: the old code preferred using "raw" mode to a compatibility mode, whereas the new code prefers a compatibility mode if available. Using compatibility mode preferentially means that we're more likely to be able to migrate the guest to a similar but not identical host. Signed-off-by: David Gibson --- hw/ppc/spapr_hcall.c | 104 ++++++++++++++++-------------------------------= ---- hw/ppc/trace-events | 2 +- 2 files changed, 34 insertions(+), 72 deletions(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 51681f3..f4531c5 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -935,98 +935,60 @@ static void do_set_compat(CPUState *cs, run_on_cpu_da= ta arg) ppc_set_compat(cpu, s->compat_pvr, &s->err); } =20 -#define get_compat_level(cpuver) ( \ - ((cpuver) =3D=3D CPU_POWERPC_LOGICAL_2_05) ? 2050 : \ - ((cpuver) =3D=3D CPU_POWERPC_LOGICAL_2_06) ? 2060 : \ - ((cpuver) =3D=3D CPU_POWERPC_LOGICAL_2_06_PLUS) ? 2061 : \ - ((cpuver) =3D=3D CPU_POWERPC_LOGICAL_2_07) ? 2070 : 0) - -static void cas_handle_compat_cpu(PowerPCCPUClass *pcc, uint32_t pvr, - unsigned max_lvl, unsigned *compat_lvl, - unsigned *compat_pvr) -{ - unsigned lvl =3D get_compat_level(pvr); - bool is205, is206, is207; - - if (!lvl) { - return; - } - - /* If it is a logical PVR, try to determine the highest level */ - is205 =3D (pcc->pcr_supported & PCR_COMPAT_2_05) && - (lvl =3D=3D get_compat_level(CPU_POWERPC_LOGICAL_2_05)); - is206 =3D (pcc->pcr_supported & PCR_COMPAT_2_06) && - ((lvl =3D=3D get_compat_level(CPU_POWERPC_LOGICAL_2_06)) || - (lvl =3D=3D get_compat_level(CPU_POWERPC_LOGICAL_2_06_PLUS))); - is207 =3D (pcc->pcr_supported & PCR_COMPAT_2_07) && - (lvl =3D=3D get_compat_level(CPU_POWERPC_LOGICAL_2_07)); - - if (is205 || is206 || is207) { - if (!max_lvl) { - /* User did not set the level, choose the highest */ - if (*compat_lvl <=3D lvl) { - *compat_lvl =3D lvl; - *compat_pvr =3D pvr; - } - } else if (max_lvl >=3D lvl) { - /* User chose the level, don't set higher than this */ - *compat_lvl =3D lvl; - *compat_pvr =3D pvr; - } - } -} - -static target_ulong h_client_architecture_support(PowerPCCPU *cpu_, +static target_ulong h_client_architecture_support(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { target_ulong list =3D ppc64_phys_to_real(args[0]); target_ulong ov_table; - PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu_); CPUState *cs; - bool cpu_match =3D false; - unsigned old_compat_pvr =3D cpu_->compat_pvr; - unsigned compat_lvl =3D 0, compat_pvr =3D 0; - unsigned max_lvl =3D get_compat_level(cpu_->max_compat); - int counter; + bool explicit_match =3D false; /* Matched the CPU's real PVR */ + uint32_t max_compat =3D cpu->max_compat; + uint32_t best_compat =3D 0; + int i; sPAPROptionVector *ov5_guest, *ov5_cas_old, *ov5_updates; =20 - /* Parse PVR list */ - for (counter =3D 0; counter < 512; ++counter) { + /* + * We scan the supplied table of PVRs looking for two things + * 1. Is our real CPU PVR in the list? + * 2. What's the "best" listed logical PVR + */ + for (i =3D 0; i < 512; ++i) { uint32_t pvr, pvr_mask; =20 pvr_mask =3D ldl_be_phys(&address_space_memory, list); - list +=3D 4; - pvr =3D ldl_be_phys(&address_space_memory, list); - list +=3D 4; - - trace_spapr_cas_pvr_try(pvr); - if (!max_lvl && - ((cpu_->env.spr[SPR_PVR] & pvr_mask) =3D=3D (pvr & pvr_mask)))= { - cpu_match =3D true; - compat_pvr =3D 0; - } else if (pvr =3D=3D cpu_->compat_pvr) { - cpu_match =3D true; - compat_pvr =3D cpu_->compat_pvr; - } else if (!cpu_match) { - cas_handle_compat_cpu(pcc, pvr, max_lvl, &compat_lvl, &compat_= pvr); - } - /* Terminator record */ + pvr =3D ldl_be_phys(&address_space_memory, list + 4); + list +=3D 8; + if (~pvr_mask & pvr) { - break; + break; /* Terminator record */ } + + if ((cpu->env.spr[SPR_PVR] & pvr_mask) =3D=3D (pvr & pvr_mask)) { + explicit_match =3D true; + } else { + if (ppc_check_compat(cpu, pvr, best_compat, max_compat)) { + best_compat =3D pvr; + } + } + } + + if ((best_compat =3D=3D 0) && (!explicit_match || max_compat)) { + /* We couldn't find a suitable compatibility mode, and either + * the guest doesn't support "raw" mode for this CPU, or raw + * mode is disabled because a maximum compat mode is set */ + return H_HARDWARE; } =20 /* Parsing finished */ - trace_spapr_cas_pvr(cpu_->compat_pvr, cpu_match, - compat_pvr, pcc->pcr_mask); + trace_spapr_cas_pvr(cpu->compat_pvr, explicit_match, best_compat); =20 /* Update CPUs */ - if (old_compat_pvr !=3D compat_pvr) { + if (cpu->compat_pvr !=3D best_compat) { CPU_FOREACH(cs) { SetCompatState s =3D { - .compat_pvr =3D compat_pvr, + .compat_pvr =3D best_compat, .err =3D NULL, }; =20 diff --git a/hw/ppc/trace-events b/hw/ppc/trace-events index 42b8ec0..f46995c 100644 --- a/hw/ppc/trace-events +++ b/hw/ppc/trace-events @@ -15,7 +15,7 @@ spapr_cas_continue(unsigned long n) "Copy changes to the = guest: %ld bytes" =20 # hw/ppc/spapr_hcall.c spapr_cas_pvr_try(uint32_t pvr) "%x" -spapr_cas_pvr(uint32_t cur_pvr, bool cpu_match, uint32_t new_pvr, uint64_t= pcr) "current=3D%x, cpu_match=3D%u, new=3D%x, compat flags=3D%"PRIx64 +spapr_cas_pvr(uint32_t cur_pvr, bool explicit_match, uint32_t new_pvr) "cu= rrent=3D%x, explicit_match=3D%u, new=3D%x" =20 # hw/ppc/spapr_iommu.c spapr_iommu_put(uint64_t liobn, uint64_t ioba, uint64_t tce, uint64_t ret)= "liobn=3D%"PRIx64" ioba=3D0x%"PRIx64" tce=3D0x%"PRIx64" ret=3D%"PRId64 --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017795277425.76212254570953; Wed, 1 Feb 2017 22:43:15 -0800 (PST) Received: from localhost ([::1]:54707 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZB6v-0002J7-1q for importer@patchew.org; Thu, 02 Feb 2017 01:43:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k8-0007mY-JO for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k1-00046V-7t for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:36 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:40329) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k0-00043h-PU; Thu, 02 Feb 2017 00:15:29 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqW12N4z9s7P; Thu, 2 Feb 2017 16:14:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012503; bh=KQJG/B8QAUkfgF8kBFLAxCYIe3wk376WWMm0yzHRlVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YgObG9AUSTtK7HIADYhKktUfgvJ9RF/c7lBuJqcasSgAAPGOSR8xBX6nntNhNxzqj wS6+ELwKXRpbejV3GZoLFjvrHPFxm3m5l2TSVWymeHoGhYtcBAakTmYtACcDnhh3CU 71kF8dbMBDv2iSmQgsLJiWZ0dI86y4Ama4FopV+8= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:00 +1100 Message-Id: <20170202051445.5735-63-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 062/107] ppc: Add ppc_set_compat_all() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Once a compatiblity mode is negotiated with the guest, h_client_architecture_support() uses run_on_cpu() to update each CPU to the new mode. We're going to want this logic somewhere else shortly, so make a helper function to do this global update. We put it in target-ppc/compat.c - it makes as much sense at the CPU level as it does at the machine level. We also move the cpu_synchronize_state() into ppc_set_compat(), since it doesn't really make any sense to call that without synchronizing state. Signed-off-by: David Gibson --- hw/ppc/spapr_hcall.c | 31 +++++-------------------------- target/ppc/compat.c | 35 +++++++++++++++++++++++++++++++++++ target/ppc/cpu.h | 3 +++ 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index f4531c5..42d20e0 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -921,20 +921,6 @@ static target_ulong h_signal_sys_reset(PowerPCCPU *cpu, } } =20 -typedef struct { - uint32_t compat_pvr; - Error *err; -} SetCompatState; - -static void do_set_compat(CPUState *cs, run_on_cpu_data arg) -{ - PowerPCCPU *cpu =3D POWERPC_CPU(cs); - SetCompatState *s =3D arg.host_ptr; - - cpu_synchronize_state(cs); - ppc_set_compat(cpu, s->compat_pvr, &s->err); -} - static target_ulong h_client_architecture_support(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, @@ -942,7 +928,6 @@ static target_ulong h_client_architecture_support(Power= PCCPU *cpu, { target_ulong list =3D ppc64_phys_to_real(args[0]); target_ulong ov_table; - CPUState *cs; bool explicit_match =3D false; /* Matched the CPU's real PVR */ uint32_t max_compat =3D cpu->max_compat; uint32_t best_compat =3D 0; @@ -986,18 +971,12 @@ static target_ulong h_client_architecture_support(Pow= erPCCPU *cpu, =20 /* Update CPUs */ if (cpu->compat_pvr !=3D best_compat) { - CPU_FOREACH(cs) { - SetCompatState s =3D { - .compat_pvr =3D best_compat, - .err =3D NULL, - }; + Error *local_err =3D NULL; =20 - run_on_cpu(cs, do_set_compat, RUN_ON_CPU_HOST_PTR(&s)); - - if (s.err) { - error_report_err(s.err); - return H_HARDWARE; - } + ppc_set_compat_all(best_compat, &local_err); + if (local_err) { + error_report_err(local_err); + return H_HARDWARE; } } =20 diff --git a/target/ppc/compat.c b/target/ppc/compat.c index 1059555..458da26 100644 --- a/target/ppc/compat.c +++ b/target/ppc/compat.c @@ -18,6 +18,7 @@ */ =20 #include "qemu/osdep.h" +#include "sysemu/hw_accel.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" #include "sysemu/cpus.h" @@ -124,6 +125,8 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pv= r, Error **errp) pcr =3D compat->pcr; } =20 + cpu_synchronize_state(CPU(cpu)); + cpu->compat_pvr =3D compat_pvr; env->spr[SPR_PCR] =3D pcr & pcc->pcr_mask; =20 @@ -136,6 +139,38 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_p= vr, Error **errp) } } =20 +typedef struct { + uint32_t compat_pvr; + Error *err; +} SetCompatState; + +static void do_set_compat(CPUState *cs, run_on_cpu_data arg) +{ + PowerPCCPU *cpu =3D POWERPC_CPU(cs); + SetCompatState *s =3D arg.host_ptr; + + ppc_set_compat(cpu, s->compat_pvr, &s->err); +} + +void ppc_set_compat_all(uint32_t compat_pvr, Error **errp) +{ + CPUState *cs; + + CPU_FOREACH(cs) { + SetCompatState s =3D { + .compat_pvr =3D compat_pvr, + .err =3D NULL, + }; + + run_on_cpu(cs, do_set_compat, RUN_ON_CPU_HOST_PTR(&s)); + + if (s.err) { + error_propagate(errp, s.err); + return; + } + } +} + int ppc_compat_max_threads(PowerPCCPU *cpu) { const CompatInfo *compat =3D compat_by_pvr(cpu->compat_pvr); diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 22842dd..4d72d75 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1326,6 +1326,9 @@ static inline int cpu_mmu_index (CPUPPCState *env, bo= ol ifetch) bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr, uint32_t min_compat_pvr, uint32_t max_compat_pvr); void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp); +#if !defined(CONFIG_USER_ONLY) +void ppc_set_compat_all(uint32_t compat_pvr, Error **errp); +#endif int ppc_compat_max_threads(PowerPCCPU *cpu); #endif /* defined(TARGET_PPC64) */ =20 --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016563634632.2683761800552; Wed, 1 Feb 2017 22:22:43 -0800 (PST) Received: from localhost ([::1]:54584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAn2-0006fv-3T for importer@patchew.org; Thu, 02 Feb 2017 01:22:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k0-0007bU-B2 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9ju-0003zD-U1 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:28 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:36645) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9ju-0003tg-DP; Thu, 02 Feb 2017 00:15:22 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqT1MTYz9s8V; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012501; bh=QN4zuB32+tDNirUQZ2kzGUMq+Sux2S02JFpYvSSgXME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lFf95bIeeyioDurMmMdDXYF7pW1Bujs8O+IKyBJQBJx/iM7fovDgm6jP47NuSytda oD79bKUPrqKRqo3mEby5xfHXAzwyxX2UEbeUh6AmxQS/mVDkRT/MxlDeoZaCgHUs+F bqwps0nxanRe6Tglpt55xEdNpzyWs7kzcIDBAvt8= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:01 +1100 Message-Id: <20170202051445.5735-64-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 063/107] target-ppc: Add xsaddqp instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xsaddqp: VSX Scalar Add Quad-Precision Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 36 +++++++++++++++++++++++++++++++++= +++ target/ppc/helper.h | 1 + target/ppc/internal.h | 2 ++ target/ppc/translate/vsx-impl.inc.c | 1 + target/ppc/translate/vsx-ops.inc.c | 1 + 5 files changed, 41 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 01b335f..6e7279c 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -111,6 +111,7 @@ void helper_compute_fprf_##tp(CPUPPCState *env, tp arg)= \ COMPUTE_FPRF(float16) COMPUTE_FPRF(float32) COMPUTE_FPRF(float64) +COMPUTE_FPRF(float128) =20 /* Floating-point invalid operations exception */ static inline __attribute__((__always_inline__)) @@ -1830,6 +1831,41 @@ VSX_ADD_SUB(xssubsp, sub, 1, float64, VsrD(0), 1, 1) VSX_ADD_SUB(xvsubdp, sub, 2, float64, VsrD(i), 0, 0) VSX_ADD_SUB(xvsubsp, sub, 4, float32, VsrW(i), 0, 0) =20 +void helper_xsaddqp(CPUPPCState *env, uint32_t opcode) +{ + ppc_vsr_t xt, xa, xb; + float_status tstat; + + getVSR(rA(opcode) + 32, &xa, env); + getVSR(rB(opcode) + 32, &xb, env); + getVSR(rD(opcode) + 32, &xt, env); + helper_reset_fpstatus(env); + + if (unlikely(Rc(opcode) !=3D 0)) { + /* TODO: Support xsadddpo after round-to-odd is implemented */ + abort(); + } + + tstat =3D env->fp_status; + set_float_exception_flags(0, &tstat); + xt.f128 =3D float128_add(xa.f128, xb.f128, &tstat); + env->fp_status.float_exception_flags |=3D tstat.float_exception_flags; + + if (unlikely(tstat.float_exception_flags & float_flag_invalid)) { + if (float128_is_infinity(xa.f128) && float128_is_infinity(xb.f128)= ) { + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXISI, 1); + } else if (float128_is_signaling_nan(xa.f128, &tstat) || + float128_is_signaling_nan(xb.f128, &tstat)) { + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 1); + } + } + + helper_compute_fprf_float128(env, xt.f128); + + putVSR(rD(opcode) + 32, &xt, env); + float_check_status(env); +} + /* VSX_MUL - VSX floating point multiply * op - instruction mnemonic * nels - number of elements (1, 2 or 4) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 29dce9d..3795975 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -395,6 +395,7 @@ DEF_HELPER_4(bcdcpsgn, i32, avr, avr, avr, i32) DEF_HELPER_3(bcdsetsgn, i32, avr, avr, i32) =20 DEF_HELPER_2(xsadddp, void, env, i32) +DEF_HELPER_2(xsaddqp, void, env, i32) DEF_HELPER_2(xssubdp, void, env, i32) DEF_HELPER_2(xsmuldp, void, env, i32) DEF_HELPER_2(xsdivdp, void, env, i32) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 187f024..c22d74e 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -206,6 +206,7 @@ typedef union _ppc_vsr_t { uint64_t u64[2]; float32 f32[4]; float64 f64[2]; + float128 f128; Int128 s128; } ppc_vsr_t; =20 @@ -245,4 +246,5 @@ static inline void putVSR(int n, ppc_vsr_t *vsr, CPUPPC= State *env) =20 void helper_compute_fprf_float16(CPUPPCState *env, float16 arg); void helper_compute_fprf_float32(CPUPPCState *env, float32 arg); +void helper_compute_fprf_float128(CPUPPCState *env, float128 arg); #endif /* PPC_INTERNAL_H */ diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 33e934f..113ccf3 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -777,6 +777,7 @@ static void gen_##name(DisasContext * ctx) = \ } =20 GEN_VSX_HELPER_2(xsadddp, 0x00, 0x04, 0, PPC2_VSX) +GEN_VSX_HELPER_2(xsaddqp, 0x04, 0x00, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xssubdp, 0x00, 0x05, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsmuldp, 0x00, 0x06, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsdivdp, 0x00, 0x07, 0, PPC2_VSX) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index bfcd09e..882e11b 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -130,6 +130,7 @@ GEN_XX2FORM(xvnegsp, 0x12, 0x1B, PPC2_VSX), GEN_XX3FORM(xvcpsgnsp, 0x00, 0x1A, PPC2_VSX), =20 GEN_XX3FORM(xsadddp, 0x00, 0x04, PPC2_VSX), +GEN_VSX_XFORM_300(xsaddqp, 0x04, 0x00, 0x0), GEN_XX3FORM(xssubdp, 0x00, 0x05, PPC2_VSX), GEN_XX3FORM(xsmuldp, 0x00, 0x06, PPC2_VSX), GEN_XX3FORM(xsdivdp, 0x00, 0x07, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017664060294.28388830308506; Wed, 1 Feb 2017 22:41:04 -0800 (PST) Received: from localhost ([::1]:54697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZB4n-00084f-56 for importer@patchew.org; Thu, 02 Feb 2017 01:41:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k5-0007j6-Si for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jz-000457-Pc for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:33 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:41277) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jz-0003yq-7l; Thu, 02 Feb 2017 00:15:27 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqV1wxBz9s8D; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012502; bh=7cbXzC4yX6iRLoOkiBTcLjxet8H3/zYr7VxZLDVLJyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R/o1iggX983EZDNrWR5bldwb1qcomZCQPAZRdAA59gvUuhDv1eBub6jnD/Mein5z0 EDavUxj2bqQiiHmqC09PDfS+mhRke95chkye8a1YanGxKYjJJqmNC1wCLspep6RyvA XR+Mt3v7Vo/4Plb5m49bXk4uMnypbb12ejtMw428= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:02 +1100 Message-Id: <20170202051445.5735-65-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 064/107] target-ppc: Add xscvdpqp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xscvdpqp: VSX Scalar Convert Double-Precision format to Quad-Precision format Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 45 +++++++++++++++++++++++++++++++++= ++++ target/ppc/helper.h | 1 + target/ppc/translate/vsx-impl.inc.c | 1 + target/ppc/translate/vsx-ops.inc.c | 1 + 4 files changed, 48 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 6e7279c..16397ef 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -22,6 +22,15 @@ #include "exec/exec-all.h" #include "internal.h" =20 +static inline float128 float128_snan_to_qnan(float128 x) +{ + float128 r; + + r.high =3D x.high | 0x0000800000000000; + r.low =3D x.low; + return r; +} + #define float64_snan_to_qnan(x) ((x) | 0x0008000000000000ULL) #define float32_snan_to_qnan(x) ((x) | 0x00400000) #define float16_snan_to_qnan(x) ((x) | 0x0200) @@ -2702,6 +2711,42 @@ VSX_CVT_FP_TO_FP(xscvspdp, 1, float32, float64, VsrW= (0), VsrD(0), 1) VSX_CVT_FP_TO_FP(xvcvdpsp, 2, float64, float32, VsrD(i), VsrW(2*i), 0) VSX_CVT_FP_TO_FP(xvcvspdp, 2, float32, float64, VsrW(2*i), VsrD(i), 0) =20 +/* VSX_CVT_FP_TO_FP_VECTOR - VSX floating point/floating point conversion + * op - instruction mnemonic + * nels - number of elements (1, 2 or 4) + * stp - source type (float32 or float64) + * ttp - target type (float32 or float64) + * sfld - source vsr_t field + * tfld - target vsr_t field (f32 or f64) + * sfprf - set FPRF + */ +#define VSX_CVT_FP_TO_FP_VECTOR(op, nels, stp, ttp, sfld, tfld, sfprf) \ +void helper_##op(CPUPPCState *env, uint32_t opcode) \ +{ \ + ppc_vsr_t xt, xb; \ + int i; \ + \ + getVSR(rB(opcode) + 32, &xb, env); \ + getVSR(rD(opcode) + 32, &xt, env); \ + \ + for (i =3D 0; i < nels; i++) { \ + xt.tfld =3D stp##_to_##ttp(xb.sfld, &env->fp_status); \ + if (unlikely(stp##_is_signaling_nan(xb.sfld, \ + &env->fp_status))) { \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); \ + xt.tfld =3D ttp##_snan_to_qnan(xt.tfld); \ + } \ + if (sfprf) { \ + helper_compute_fprf_##ttp(env, xt.tfld); \ + } \ + } \ + \ + putVSR(rD(opcode) + 32, &xt, env); \ + float_check_status(env); \ +} + +VSX_CVT_FP_TO_FP_VECTOR(xscvdpqp, 1, float64, float128, VsrD(0), f128, 1) + /* VSX_CVT_FP_TO_FP_HP - VSX floating point/floating point conversion * involving one half precision value * op - instruction mnemonic diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 3795975..d185eb0 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -425,6 +425,7 @@ DEF_HELPER_2(xscmpuqp, void, env, i32) DEF_HELPER_2(xsmaxdp, void, env, i32) DEF_HELPER_2(xsmindp, void, env, i32) DEF_HELPER_2(xscvdphp, void, env, i32) +DEF_HELPER_2(xscvdpqp, void, env, i32) DEF_HELPER_2(xscvdpsp, void, env, i32) DEF_HELPER_2(xscvdpspn, i64, env, i64) DEF_HELPER_2(xscvhpdp, void, env, i32) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 113ccf3..01b5621 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -808,6 +808,7 @@ GEN_VSX_HELPER_2(xsmaxdp, 0x00, 0x14, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsmindp, 0x00, 0x15, 0, PPC2_VSX) GEN_VSX_HELPER_2(xscvdphp, 0x16, 0x15, 0x11, PPC2_ISA300) GEN_VSX_HELPER_2(xscvdpsp, 0x12, 0x10, 0, PPC2_VSX) +GEN_VSX_HELPER_2(xscvdpqp, 0x04, 0x1A, 0x16, PPC2_ISA300) GEN_VSX_HELPER_XT_XB_ENV(xscvdpspn, 0x16, 0x10, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xscvhpdp, 0x16, 0x15, 0x10, PPC2_ISA300) GEN_VSX_HELPER_2(xscvspdp, 0x12, 0x14, 0, PPC2_VSX) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 882e11b..e75ecd1 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -112,6 +112,7 @@ GEN_VSX_XFORM_300_EO(xsabsqp, 0x04, 0x19, 0x00, 0x00000= 001), GEN_VSX_XFORM_300_EO(xsnabsqp, 0x04, 0x19, 0x08, 0x00000001), GEN_VSX_XFORM_300_EO(xsnegqp, 0x04, 0x19, 0x10, 0x00000001), GEN_VSX_XFORM_300(xscpsgnqp, 0x04, 0x03, 0x00000001), +GEN_VSX_XFORM_300_EO(xscvdpqp, 0x04, 0x1A, 0x16, 0x00000001), =20 #ifdef TARGET_PPC64 GEN_XX2FORM_EO(xsxexpdp, 0x16, 0x15, 0x00, PPC2_ISA300), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016157032478.62163327144776; Wed, 1 Feb 2017 22:15:57 -0800 (PST) Received: from localhost ([::1]:54541 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAgV-00089h-0v for importer@patchew.org; Thu, 02 Feb 2017 01:15:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k5-0007ig-Hb for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jz-00045C-QA for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:33 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:44495) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jz-0003zv-8t; Thu, 02 Feb 2017 00:15:27 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqV5h5tz9sDC; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012502; bh=+Bdc7qQhriOWi9CCBKrItlBpYyoi79tpjHVhuwUZZ20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=anKjocQwS6TY3eu27tX/AcMuFS0PFWTHSLBcamDRlsK7+PizlzkWMoUW9oUSwyhO2 1d7+1UcPgtLMTdyMp4emPLoDo99d6Jb/WFpQRnnC+baLPSv+g6bMWiSopgv75JCh1l ezuEPG9z/VFuuytYe9HqwrzC1kYzZdK3vdH8PikQ= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:03 +1100 Message-Id: <20170202051445.5735-66-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 065/107] target-ppc: Add xscvqpdp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xscvqpdp: VSX Scalar round & Convert Quad-Precision format to Double-Precision format Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 28 ++++++++++++++++++++++++++++ target/ppc/helper.h | 1 + target/ppc/translate/vsx-impl.inc.c | 1 + target/ppc/translate/vsx-ops.inc.c | 1 + 4 files changed, 31 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 16397ef..8c8e3c5 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2778,6 +2778,34 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ VSX_CVT_FP_TO_FP_HP(xscvdphp, float64, float16, VsrD(0), VsrH(3)) VSX_CVT_FP_TO_FP_HP(xscvhpdp, float16, float64, VsrH(3), VsrD(0)) =20 +/* + * xscvqpdp isn't using VSX_CVT_FP_TO_FP() because xscvqpdpo will be + * added to this later. + */ +void helper_xscvqpdp(CPUPPCState *env, uint32_t opcode) +{ + ppc_vsr_t xt, xb; + + getVSR(rB(opcode) + 32, &xb, env); + getVSR(rD(opcode) + 32, &xt, env); + + if (unlikely(Rc(opcode) !=3D 0)) { + /* TODO: Support xscvqpdpo after round-to-odd is implemented */ + abort(); + } + + xt.VsrD(0) =3D float128_to_float64(xb.f128, &env->fp_status); + if (unlikely(float128_is_signaling_nan(xb.f128, + &env->fp_status))) { + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); + xt.VsrD(0) =3D float64_snan_to_qnan(xt.VsrD(0)); + } + helper_compute_fprf_float64(env, xt.VsrD(0)); + + putVSR(rD(opcode) + 32, &xt, env); + float_check_status(env); +} + uint64_t helper_xscvdpspn(CPUPPCState *env, uint64_t xb) { float_status tstat =3D env->fp_status; diff --git a/target/ppc/helper.h b/target/ppc/helper.h index d185eb0..ec0ae8a 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -428,6 +428,7 @@ DEF_HELPER_2(xscvdphp, void, env, i32) DEF_HELPER_2(xscvdpqp, void, env, i32) DEF_HELPER_2(xscvdpsp, void, env, i32) DEF_HELPER_2(xscvdpspn, i64, env, i64) +DEF_HELPER_2(xscvqpdp, void, env, i32) DEF_HELPER_2(xscvhpdp, void, env, i32) DEF_HELPER_2(xscvspdp, void, env, i32) DEF_HELPER_2(xscvspdpn, i64, env, i64) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 01b5621..2d9fe50 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -810,6 +810,7 @@ GEN_VSX_HELPER_2(xscvdphp, 0x16, 0x15, 0x11, PPC2_ISA30= 0) GEN_VSX_HELPER_2(xscvdpsp, 0x12, 0x10, 0, PPC2_VSX) GEN_VSX_HELPER_2(xscvdpqp, 0x04, 0x1A, 0x16, PPC2_ISA300) GEN_VSX_HELPER_XT_XB_ENV(xscvdpspn, 0x16, 0x10, 0, PPC2_VSX207) +GEN_VSX_HELPER_2(xscvqpdp, 0x04, 0x1A, 0x14, PPC2_ISA300) GEN_VSX_HELPER_2(xscvhpdp, 0x16, 0x15, 0x10, PPC2_ISA300) GEN_VSX_HELPER_2(xscvspdp, 0x12, 0x14, 0, PPC2_VSX) GEN_VSX_HELPER_XT_XB_ENV(xscvspdpn, 0x16, 0x14, 0, PPC2_VSX207) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index e75ecd1..aeeaff2 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -113,6 +113,7 @@ GEN_VSX_XFORM_300_EO(xsnabsqp, 0x04, 0x19, 0x08, 0x0000= 0001), GEN_VSX_XFORM_300_EO(xsnegqp, 0x04, 0x19, 0x10, 0x00000001), GEN_VSX_XFORM_300(xscpsgnqp, 0x04, 0x03, 0x00000001), GEN_VSX_XFORM_300_EO(xscvdpqp, 0x04, 0x1A, 0x16, 0x00000001), +GEN_VSX_XFORM_300_EO(xscvqpdp, 0x04, 0x1A, 0x14, 0x0), =20 #ifdef TARGET_PPC64 GEN_XX2FORM_EO(xsxexpdp, 0x16, 0x15, 0x00, PPC2_ISA300), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016028924348.35209816147085; Wed, 1 Feb 2017 22:13:48 -0800 (PST) Received: from localhost ([::1]:54527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAeQ-0005aO-7v for importer@patchew.org; Thu, 02 Feb 2017 01:13:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jy-0007Yt-Fc for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jt-0003xK-Me for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:26 -0500 Received: from ozlabs.org ([103.22.144.67]:51163) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jt-0003si-7Z; Thu, 02 Feb 2017 00:15:21 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqS6gK2z9s8R; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012500; bh=Mta/QDiEQeVeUY/vxXgts7JUywNNmAgRS95rOoq/M08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bl2azmQFL4H2fWsrM/ISSsl3HZwP7HzFTFTtQ5wWpaibdLh68lQChDv5IzgFePrzY jpdAXjOcfqd5IxZOK3g/0inCxshkgFfIzKsMBfAgOtfz5bVf0vHHMq7QfpNIYlyoXI xnmTtlQnrz/lAReOKMn3qzA64U7ZtitgyIHs5BQ8= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:04 +1100 Message-Id: <20170202051445.5735-67-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 066/107] ppc: Prevent inifnite loop in decrementer auto-reload. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Roman Kapl , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Roman Kapl If the DECAR register is set to 0, QEMU tries to reload the decrementer with zero in an inifinite loop. According to PPC documentation, the decrementer = is triggered on 1->0 transition, so avoid reloading the decrementer if if is already zero. The problem does not manifest under Linux, but it is valid to set DECAR to = zero (and may make sense as part of decrementer initialization when interrupts a= re disabled). Signed-off-by: Roman Kapl [dwg: Fixed style nit] Signed-off-by: David Gibson --- hw/ppc/ppc_booke.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c index ab8d026..60baffa 100644 --- a/hw/ppc/ppc_booke.c +++ b/hw/ppc/ppc_booke.c @@ -198,8 +198,12 @@ static void booke_decr_cb(void *opaque) booke_update_irq(cpu); =20 if (env->spr[SPR_BOOKE_TCR] & TCR_ARE) { - /* Auto Reload */ - cpu_ppc_store_decr(env, env->spr[SPR_BOOKE_DECAR]); + /* Do not reload 0, it is already there. It would just trigger + * the timer again and lead to infinite loop */ + if (env->spr[SPR_BOOKE_DECAR] !=3D 0) { + /* Auto Reload */ + cpu_ppc_store_decr(env, env->spr[SPR_BOOKE_DECAR]); + } } } =20 --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016872258358.6498194105782; Wed, 1 Feb 2017 22:27:52 -0800 (PST) Received: from localhost ([::1]:54614 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAs2-0003Gb-B9 for importer@patchew.org; Thu, 02 Feb 2017 01:27:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k2-0007f8-WB for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jx-00042K-Ef for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:30 -0500 Received: from ozlabs.org ([103.22.144.67]:36607) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jw-0003y2-VO; Thu, 02 Feb 2017 00:15:25 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqT523Wz9s8P; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012501; bh=Q61WqJnlpB+Ho8P/8eB6I8pYlh/g50ABFEfwuTuYCEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=djqlJdaf7Dxtj5b7orYx6Ug4DHkB6aHfwc7Gsgjo6nTQy89iUJZLJSKU5OvUU9/oI 1lLRd++BwKGXOdy4p9F2vo01imYy3Q4UXpNuHyez/IB8F4NRU6Z0LxsfrQsD9f+GqK V1towkrF3detIqMHGAR5wzO0bN5yrIjxnpIw4dTg= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:05 +1100 Message-Id: <20170202051445.5735-68-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 067/107] ppc: Fix a warning in bcdcfz code and improve BCD_DIG_BYTE macro X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani This commit fixes a warning in the code "(i * 2) ? .. : ..", which should be better as "i ? .. : ..", and improves the BCD_DIG_BYTE macro by placing parentheses around its argument to avoid possible expansion issues like: BCD_DIG_BYTE(i + j). Signed-off-by: Jose Ricardo Ziviani Reviewed-by: Eric Blake Signed-off-by: David Gibson --- target/ppc/int_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 81f134b..8cf4ee3 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2551,9 +2551,9 @@ void helper_vsubecuq(ppc_avr_t *r, ppc_avr_t *a, ppc_= avr_t *b, ppc_avr_t *c) #define NATIONAL_NEG 0x2D =20 #if defined(HOST_WORDS_BIGENDIAN) -#define BCD_DIG_BYTE(n) (15 - (n/2)) +#define BCD_DIG_BYTE(n) (15 - ((n) / 2)) #else -#define BCD_DIG_BYTE(n) (n/2) +#define BCD_DIG_BYTE(n) ((n) / 2) #endif =20 static int bcd_get_sgn(ppc_avr_t *bcd) @@ -2876,7 +2876,7 @@ uint32_t helper_bcdcfz(ppc_avr_t *r, ppc_avr_t *b, ui= nt32_t ps) } =20 for (i =3D 0; i < 16; i++) { - zone_digit =3D (i * 2) ? b->u8[BCD_DIG_BYTE(i * 2)] >> 4 : zone_le= ad; + zone_digit =3D i ? b->u8[BCD_DIG_BYTE(i * 2)] >> 4 : zone_lead; digit =3D b->u8[BCD_DIG_BYTE(i * 2)] & 0xF; if (unlikely(zone_digit !=3D zone_lead || digit > 0x9)) { invalid =3D 1; --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017128268989.8860565002473; Wed, 1 Feb 2017 22:32:08 -0800 (PST) Received: from localhost ([::1]:54644 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAwA-0007I4-9o for importer@patchew.org; Thu, 02 Feb 2017 01:32:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k3-0007fQ-8X for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jy-00043I-0n for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:31 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:52735) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jx-0003yR-Dd; Thu, 02 Feb 2017 00:15:25 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqT5d1Mz9s8X; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012501; bh=Ss0f6LQ/Nn3D8PRqKd9Kl6M1H7jeSDx0UDGsqSNc7vI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eM4jdz2RTgw6IEhF3BbFVS3S6jwEklkKYIUFLXgGBVS91NfwF/QkD7u7Um8WtVjsD 5x3ANS2nwX08nzstiqSmWHzbZK/ZEPQZ4UFnP3I1XPB5SSwKWPTHdAcxYMnn6EV6II UYnfMldw2CipRj5qLPxbfIErmAt0sYBI8C94RuPU= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:06 +1100 Message-Id: <20170202051445.5735-69-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 068/107] target-ppc: xscvqpdp zero VSR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 8c8e3c5..77f68e9 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2787,7 +2787,7 @@ void helper_xscvqpdp(CPUPPCState *env, uint32_t opcod= e) ppc_vsr_t xt, xb; =20 getVSR(rB(opcode) + 32, &xb, env); - getVSR(rD(opcode) + 32, &xt, env); + memset(&xt, 0, sizeof(xt)); =20 if (unlikely(Rc(opcode) !=3D 0)) { /* TODO: Support xscvqpdpo after round-to-odd is implemented */ --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016628461201.77493069593527; Wed, 1 Feb 2017 22:23:48 -0800 (PST) Received: from localhost ([::1]:54589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAo5-0007mj-Rh for importer@patchew.org; Thu, 02 Feb 2017 01:23:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9jy-0007Yj-B6 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9ju-0003y5-67 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:26 -0500 Received: from ozlabs.org ([103.22.144.67]:33811) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jt-0003tR-Mw; Thu, 02 Feb 2017 00:15:22 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqT2n9Mz9s8L; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012501; bh=jSTGbAoVHToUhjcjQtOFE+WMbfTZHZ28yI34wsq7hh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GGhA/iXrJE6xwx/gl0Rk3gfG+MlEgUdKcISJCpNvmjeNOG6afuR5gps5m2tf3FdAR Ln+UM3lEusxLjwztTAEdMTYsiOQcIhclHGDl+9NNhp2twl83mjwtufzWMztCE3sudV ISeUtTmyKmxaPkXkSzVnx0vVPFLuTPjIS42uKxBI= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:07 +1100 Message-Id: <20170202051445.5735-70-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 069/107] softfloat: Fix the default qNAN for target-ppc X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao Currently float128_default_nan() returns 0xFFFF800000000000 in the higher double word, but it should return 0x7FFF800000000000 which is the correct higher double word for default qNAN on PowerPC. Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- fpu/softfloat-specialize.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index f05c865..100c8a9 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -185,7 +185,7 @@ float128 float128_default_nan(float_status *status) r.high =3D LIT64(0x7FFF7FFFFFFFFFFF); } else { r.low =3D LIT64(0x0000000000000000); -#if defined(TARGET_S390X) +#if defined(TARGET_S390X) || defined(TARGET_PPC) r.high =3D LIT64(0x7FFF800000000000); #else r.high =3D LIT64(0xFFFF800000000000); --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017388872760.2924371442431; Wed, 1 Feb 2017 22:36:28 -0800 (PST) Received: from localhost ([::1]:54669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZB0K-0002ng-U8 for importer@patchew.org; Thu, 02 Feb 2017 01:36:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k3-0007fF-3W for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jx-00042r-Pt for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:31 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:57663) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jx-0003yP-A9; Thu, 02 Feb 2017 00:15:25 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqV09J8z9s8Y; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012502; bh=tBBzx6xmZXi6uaxWG++Nc1RecOi3rOCvazra968aXFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m9AGQvqgWrqP3Y+IpO+2l+BsChaf8Phb4CtR/ZTRm4Z0HkfksJ9dNTDxw+OlzKOgK tqCjIRZ0XiQo/ocTLSnbyYWejXHSc2MPu0VzQQ9imGOkC/mTP6B/nTZ/zjWwa/HAI/ c+uPJHoVsmCM4u1ygudwKpa2O/362qInlVkK5Z3U= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:08 +1100 Message-Id: <20170202051445.5735-71-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 070/107] host-utils: Move 128-bit guard macro to .c file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani It is not possible to implement functions in host-utils.c for architectures with quadwords because the guard is implemented in the Makefile. This patch move the guard out of the Makefile to the implementation file. Signed-off-by: Jose Ricardo Ziviani Reviewed-by: Eric Blake Signed-off-by: David Gibson --- util/Makefile.objs | 2 +- util/host-utils.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/util/Makefile.objs b/util/Makefile.objs index c1f247d..56c8c23 100644 --- a/util/Makefile.objs +++ b/util/Makefile.objs @@ -12,7 +12,7 @@ util-obj-$(CONFIG_POSIX) +=3D memfd.o util-obj-$(CONFIG_WIN32) +=3D oslib-win32.o util-obj-$(CONFIG_WIN32) +=3D qemu-thread-win32.o util-obj-y +=3D envlist.o path.o module.o -util-obj-$(call lnot,$(CONFIG_INT128)) +=3D host-utils.o +util-obj-y +=3D host-utils.o util-obj-y +=3D bitmap.o bitops.o hbitmap.o util-obj-y +=3D fifo8.o util-obj-y +=3D acl.o diff --git a/util/host-utils.c b/util/host-utils.c index b166e57..3495262 100644 --- a/util/host-utils.c +++ b/util/host-utils.c @@ -26,6 +26,7 @@ #include "qemu/osdep.h" #include "qemu/host-utils.h" =20 +#ifndef CONFIG_INT128 /* Long integer helpers */ static inline void mul64(uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b) @@ -158,4 +159,5 @@ int divs128(int64_t *plow, int64_t *phigh, int64_t divi= sor) =20 return overflow; } +#endif =20 --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486019007230391.16632315125753; Wed, 1 Feb 2017 23:03:27 -0800 (PST) Received: from localhost ([::1]:54833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBQS-000640-Te for importer@patchew.org; Thu, 02 Feb 2017 02:03:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kA-0007pY-Uh for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k1-00046P-6t for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:38 -0500 Received: from ozlabs.org ([103.22.144.67]:41303) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k0-00043v-G1; Thu, 02 Feb 2017 00:15:29 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqW1n9Nz9s7M; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012503; bh=BBN0cM50emJ+hDg8iKU772gV4X9hidHM3bV7psThGbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qK5SAzFC8QFIx/lhmf7Q7jIbPW3vdl1bSRNjykxG8r71hkJ27hSeaHZWIvzQzGVJu zB/8UmWH8PuxiqI/JuTVFPpRnY3SyGp6Whzr61RXF/QhuSmUFgPUHxyFR7o/V+6BsO F2Nb37CcL9jHP9hWSD8ZLdRmxMyQ2iCbvoz3Fcqc= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:09 +1100 Message-Id: <20170202051445.5735-72-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 071/107] host-utils: Implement unsigned quadword left/right shift and unit tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani Implements 128-bit left shift and right shift as well as their testcases. By design, shift silently mods by 128, so the caller is responsible to assert the shift range if necessary. Left shift sets the overflow flag if any non-zero digit is shifted out. Examples: ulshift(&low, &high, 250, &overflow); equivalent: n << 122 urshift(&low, &high, -2); equivalent: n << 126 Signed-off-by: Jose Ricardo Ziviani Reviewed-by: Eric Blake [dwg: Added test-shift128 to .gitignore] Signed-off-by: David Gibson --- include/qemu/host-utils.h | 27 +++++++++ tests/.gitignore | 1 + tests/Makefile.include | 5 +- tests/test-shift128.c | 139 ++++++++++++++++++++++++++++++++++++++++++= ++++ util/host-utils.c | 64 +++++++++++++++++++++ 5 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 tests/test-shift128.c diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index 96288d0..a38be42 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -513,4 +513,31 @@ static inline uint64_t pow2ceil(uint64_t value) return 1ULL << (64 - nlz); } =20 +/** + * urshift - 128-bit Unsigned Right Shift. + * @plow: in/out - lower 64-bit integer. + * @phigh: in/out - higher 64-bit integer. + * @shift: in - bytes to shift, between 0 and 127. + * + * Result is zero-extended and stored in plow/phigh, which are + * input/output variables. Shift values outside the range will + * be mod to 128. In other words, the caller is responsible to + * verify/assert both the shift range and plow/phigh pointers. + */ +void urshift(uint64_t *plow, uint64_t *phigh, int32_t shift); + +/** + * ulshift - 128-bit Unsigned Left Shift. + * @plow: in/out - lower 64-bit integer. + * @phigh: in/out - higher 64-bit integer. + * @shift: in - bytes to shift, between 0 and 127. + * @overflow: out - true if any 1-bit is shifted out. + * + * Result is zero-extended and stored in plow/phigh, which are + * input/output variables. Shift values outside the range will + * be mod to 128. In other words, the caller is responsible to + * verify/assert both the shift range and plow/phigh pointers. + */ +void ulshift(uint64_t *plow, uint64_t *phigh, int32_t shift, bool *overflo= w); + #endif diff --git a/tests/.gitignore b/tests/.gitignore index 7357d0a..dc37519 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -69,6 +69,7 @@ test-qmp-marshal.c test-qobject-output-visitor test-rcu-list test-replication +test-shift128 test-string-input-visitor test-string-output-visitor test-thread-pool diff --git a/tests/Makefile.include b/tests/Makefile.include index c35fa75..1f6b732 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -65,6 +65,8 @@ check-unit-$(CONFIG_POSIX) +=3D tests/test-vmstate$(EXESU= F) endif check-unit-y +=3D tests/test-cutils$(EXESUF) gcov-files-test-cutils-y +=3D util/cutils.c +check-unit-y +=3D tests/test-shift128$(EXESUF) +gcov-files-test-shift128-y =3D util/host-utils.c check-unit-y +=3D tests/test-mul64$(EXESUF) gcov-files-test-mul64-y =3D util/host-utils.c check-unit-y +=3D tests/test-int128$(EXESUF) @@ -487,7 +489,7 @@ test-obj-y =3D tests/check-qint.o tests/check-qstring.o= tests/check-qdict.o \ tests/test-x86-cpuid.o tests/test-mul64.o tests/test-int128.o \ tests/test-opts-visitor.o tests/test-qmp-event.o \ tests/rcutorture.o tests/test-rcu-list.o \ - tests/test-qdist.o \ + tests/test-qdist.o tests/test-shift128.o \ tests/test-qht.o tests/qht-bench.o tests/test-qht-par.o \ tests/atomic_add-bench.o =20 @@ -596,6 +598,7 @@ tests/test-qmp-commands$(EXESUF): tests/test-qmp-comman= ds.o tests/test-qmp-marsh tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serializatio= n.o $(test-qapi-obj-y) tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-ob= j-y) =20 +tests/test-shift128$(EXESUF): tests/test-shift128.o $(test-util-obj-y) tests/test-mul64$(EXESUF): tests/test-mul64.o $(test-util-obj-y) tests/test-bitops$(EXESUF): tests/test-bitops.o $(test-util-obj-y) tests/test-bitcnt$(EXESUF): tests/test-bitcnt.o $(test-util-obj-y) diff --git a/tests/test-shift128.c b/tests/test-shift128.c new file mode 100644 index 0000000..f3ff736 --- /dev/null +++ b/tests/test-shift128.c @@ -0,0 +1,139 @@ +/* + * Test unsigned left and right shift + * + * This work is licensed under the terms of the GNU LGPL, version 2 or lat= er. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qemu/host-utils.h" + +typedef struct { + uint64_t low; + uint64_t high; + uint64_t rlow; + uint64_t rhigh; + int32_t shift; + bool overflow; +} test_data; + +static const test_data test_ltable[] =3D { + { 0x4C7ULL, 0x0ULL, 0x00000000000004C7ULL, + 0x0000000000000000ULL, 0, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000002ULL, + 0x0000000000000000ULL, 1, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000004ULL, + 0x0000000000000000ULL, 2, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000010ULL, + 0x0000000000000000ULL, 4, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000100ULL, + 0x0000000000000000ULL, 8, false }, + { 0x001ULL, 0x0ULL, 0x0000000000010000ULL, + 0x0000000000000000ULL, 16, false }, + { 0x001ULL, 0x0ULL, 0x0000000080000000ULL, + 0x0000000000000000ULL, 31, false }, + { 0x001ULL, 0x0ULL, 0x0000200000000000ULL, + 0x0000000000000000ULL, 45, false }, + { 0x001ULL, 0x0ULL, 0x1000000000000000ULL, + 0x0000000000000000ULL, 60, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000000ULL, + 0x0000000000000001ULL, 64, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000000ULL, + 0x0000000000010000ULL, 80, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000000ULL, + 0x8000000000000000ULL, 127, false }, + { 0x000ULL, 0x1ULL, 0x0000000000000000ULL, + 0x0000000000000000ULL, 64, true }, + { 0x008ULL, 0x0ULL, 0x0000000000000000ULL, + 0x0000000000000008ULL, 64, false }, + { 0x008ULL, 0x0ULL, 0x0000000000000000ULL, + 0x8000000000000000ULL, 124, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000000ULL, + 0x4000000000000000ULL, 126, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000000ULL, + 0x8000000000000000ULL, 127, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000001ULL, + 0x0000000000000000ULL, 128, false }, + { 0x000ULL, 0x0ULL, 0x0000000000000000ULL, + 0x0000000000000000ULL, 200, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000000ULL, + 0x0000000000000100ULL, 200, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000000ULL, + 0x8000000000000000ULL, -1, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000000ULL, + 0x8000000000000000ULL, INT32_MAX, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000000ULL, + 0x4000000000000000ULL, -2, false }, + { 0x001ULL, 0x0ULL, 0x0000000000000000ULL, + 0x4000000000000000ULL, INT32_MAX - 1, false }, + { 0x8888888888888888ULL, 0x9999999999999999ULL, + 0x8000000000000000ULL, 0x9888888888888888ULL, 60, true }, + { 0x8888888888888888ULL, 0x9999999999999999ULL, + 0x0000000000000000ULL, 0x8888888888888888ULL, 64, true }, +}; + +static const test_data test_rtable[] =3D { + { 0x00000000000004C7ULL, 0x0ULL, 0x00000000000004C7ULL, 0x0ULL, 0, fa= lse }, + { 0x0800000000000000ULL, 0x0ULL, 0x0400000000000000ULL, 0x0ULL, 1, fa= lse }, + { 0x0800000000000000ULL, 0x0ULL, 0x0200000000000000ULL, 0x0ULL, 2, fa= lse }, + { 0x0800000000000000ULL, 0x0ULL, 0x0008000000000000ULL, 0x0ULL, 8, fa= lse }, + { 0x0800000000000000ULL, 0x0ULL, 0x0000080000000000ULL, 0x0ULL, 16, fa= lse }, + { 0x0800000000000000ULL, 0x0ULL, 0x0000000008000000ULL, 0x0ULL, 32, fa= lse }, + { 0x8000000000000000ULL, 0x0ULL, 0x0000000000000001ULL, 0x0ULL, 63, fa= lse }, + { 0x8000000000000000ULL, 0x0ULL, 0x0000000000000000ULL, 0x0ULL, 64, fa= lse }, + { 0x0000000000000000ULL, 0x8000000000000000ULL, + 0x0000000000000000ULL, 0x8000000000000000ULL, 128, false }, + { 0x0000000000000000ULL, 0x8000000000000000ULL, + 0x0080000000000000ULL, 0x0000000000000000ULL, 200, false }, + { 0x0000000000000000ULL, 0x0000000000000000ULL, + 0x0000000000000000ULL, 0x0000000000000000ULL, 200, false }, + { 0x0000000000000000ULL, 0x8000000000000000ULL, + 0x0000000000000000ULL, 0x0000000000000080ULL, -200, false }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, + 0x0000000080000000ULL, 0x0000000080000000ULL, 32, false }, + { 0x0800000000000000ULL, 0x0800000000000000ULL, + 0x0800000000000000ULL, 0x0000000000000000ULL, 64, false }, + { 0x0800000000000000ULL, 0x0800000000000000ULL, + 0x0008000000000000ULL, 0x0000000000000000ULL, 72, false }, + { 0x8000000000000000ULL, 0x8000000000000000ULL, + 0x0000000000000001ULL, 0x0000000000000000ULL, 127, false }, + { 0x0000000000000000ULL, 0x8000000000000000ULL, + 0x0000000000000001ULL, 0x0000000000000000ULL, -1, false }, + { 0x0000000000000000ULL, 0x8000000000000000ULL, + 0x0000000000000002ULL, 0x0000000000000000ULL, -2, false }, +}; + +static void test_lshift(void) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(test_ltable); ++i) { + bool overflow =3D false; + test_data tmp =3D test_ltable[i]; + ulshift(&tmp.low, &tmp.high, tmp.shift, &overflow); + g_assert_cmpuint(tmp.low, =3D=3D, tmp.rlow); + g_assert_cmpuint(tmp.high, =3D=3D, tmp.rhigh); + g_assert_cmpuint(tmp.overflow, =3D=3D, overflow); + } +} + +static void test_rshift(void) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(test_rtable); ++i) { + test_data tmp =3D test_rtable[i]; + urshift(&tmp.low, &tmp.high, tmp.shift); + g_assert_cmpuint(tmp.low, =3D=3D, tmp.rlow); + g_assert_cmpuint(tmp.high, =3D=3D, tmp.rhigh); + } +} + +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + g_test_add_func("/host-utils/test_lshift", test_lshift); + g_test_add_func("/host-utils/test_rshift", test_rshift); + return g_test_run(); +} diff --git a/util/host-utils.c b/util/host-utils.c index 3495262..7b93220 100644 --- a/util/host-utils.c +++ b/util/host-utils.c @@ -161,3 +161,67 @@ int divs128(int64_t *plow, int64_t *phigh, int64_t div= isor) } #endif =20 +/** + * urshift - 128-bit Unsigned Right Shift. + * @plow: in/out - lower 64-bit integer. + * @phigh: in/out - higher 64-bit integer. + * @shift: in - bytes to shift, between 0 and 127. + * + * Result is zero-extended and stored in plow/phigh, which are + * input/output variables. Shift values outside the range will + * be mod to 128. In other words, the caller is responsible to + * verify/assert both the shift range and plow/phigh pointers. + */ +void urshift(uint64_t *plow, uint64_t *phigh, int32_t shift) +{ + shift &=3D 127; + if (shift =3D=3D 0) { + return; + } + + uint64_t h =3D *phigh >> (shift & 63); + if (shift >=3D 64) { + *plow =3D h; + *phigh =3D 0; + } else { + *plow =3D (*plow >> (shift & 63)) | (*phigh << (64 - (shift & 63))= ); + *phigh =3D h; + } +} + +/** + * ulshift - 128-bit Unsigned Left Shift. + * @plow: in/out - lower 64-bit integer. + * @phigh: in/out - higher 64-bit integer. + * @shift: in - bytes to shift, between 0 and 127. + * @overflow: out - true if any 1-bit is shifted out. + * + * Result is zero-extended and stored in plow/phigh, which are + * input/output variables. Shift values outside the range will + * be mod to 128. In other words, the caller is responsible to + * verify/assert both the shift range and plow/phigh pointers. + */ +void ulshift(uint64_t *plow, uint64_t *phigh, int32_t shift, bool *overflo= w) +{ + uint64_t low =3D *plow; + uint64_t high =3D *phigh; + + shift &=3D 127; + if (shift =3D=3D 0) { + return; + } + + /* check if any bit will be shifted out */ + urshift(&low, &high, 128 - shift); + if (low | high) { + *overflow =3D true; + } + + if (shift >=3D 64) { + *phigh =3D *plow << (shift & 63); + *plow =3D 0; + } else { + *phigh =3D (*plow >> (64 - (shift & 63))) | (*phigh << (shift & 63= )); + *plow =3D *plow << shift; + } +} --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017428285939.2878812633104; Wed, 1 Feb 2017 22:37:08 -0800 (PST) Received: from localhost ([::1]:54674 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZB0x-0003NQ-DI for importer@patchew.org; Thu, 02 Feb 2017 01:37:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k8-0007mq-Pa for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k2-000482-OF for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:36 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:55537) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k2-00045H-7z; Thu, 02 Feb 2017 00:15:30 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqW2hlkz9sD9; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012503; bh=cJw+h3qT1nhLrIVi9Vtj+rWABZb3GJdy0CCJ4uNaD5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L9GQS1Cyop2L+xW64XYdW9sOcJpCPjPDJ8mO3AyKAGz3rBjWD9dSLDtC2rmT4s5yG +JKDvrS0ezqHN09PpRAkH0TI6lBFqK2xqO0hL2Nh7idI1z872rTPZYSS1WMvN85Rl2 zs0MSQNxI95D4zAGl7xah5rQtSIWHQhBs+GlU4qA= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:10 +1100 Message-Id: <20170202051445.5735-73-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 072/107] ppc: Implement bcds. instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani bcds.: Decimal shift. Given two registers vra and vrb, this instruction shift the vrb value by vra bits into the result register. Signed-off-by: Jose Ricardo Ziviani Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 40 +++++++++++++++++++++++++++++++++= ++++ target/ppc/translate/vmx-impl.inc.c | 3 +++ target/ppc/translate/vmx-ops.inc.c | 3 ++- 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index ec0ae8a..26edbf9 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -393,6 +393,7 @@ DEF_HELPER_3(bcdcfsq, i32, avr, avr, i32) DEF_HELPER_3(bcdctsq, i32, avr, avr, i32) DEF_HELPER_4(bcdcpsgn, i32, avr, avr, avr, i32) DEF_HELPER_3(bcdsetsgn, i32, avr, avr, i32) +DEF_HELPER_4(bcds, i32, avr, avr, avr, i32) =20 DEF_HELPER_2(xsadddp, void, env, i32) DEF_HELPER_2(xsaddqp, void, env, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 8cf4ee3..5f53710 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -3062,6 +3062,46 @@ uint32_t helper_bcdsetsgn(ppc_avr_t *r, ppc_avr_t *b= , uint32_t ps) return bcd_cmp_zero(r); } =20 +uint32_t helper_bcds(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, uint32_t ps) +{ + int cr; +#if defined(HOST_WORDS_BIGENDIAN) + int i =3D a->s8[7]; +#else + int i =3D a->s8[8]; +#endif + bool ox_flag =3D false; + int sgnb =3D bcd_get_sgn(b); + ppc_avr_t ret =3D *b; + ret.u64[LO_IDX] &=3D ~0xf; + + if (bcd_is_valid(b) =3D=3D false) { + return CRF_SO; + } + + if (unlikely(i > 31)) { + i =3D 31; + } else if (unlikely(i < -31)) { + i =3D -31; + } + + if (i > 0) { + ulshift(&ret.u64[LO_IDX], &ret.u64[HI_IDX], i * 4, &ox_flag); + } else { + urshift(&ret.u64[LO_IDX], &ret.u64[HI_IDX], -i * 4); + } + bcd_put_digit(&ret, bcd_preferred_sgn(sgnb, ps), 0); + + *r =3D ret; + + cr =3D bcd_cmp_zero(r); + if (ox_flag) { + cr |=3D CRF_SO; + } + + return cr; +} + void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a) { int i; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index e8e527f..84ebb7e 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -1016,6 +1016,7 @@ GEN_BCD2(bcdcfsq) GEN_BCD2(bcdctsq) GEN_BCD2(bcdsetsgn) GEN_BCD(bcdcpsgn); +GEN_BCD(bcds); =20 static void gen_xpnd04_1(DisasContext *ctx) { @@ -1090,6 +1091,8 @@ GEN_VXFORM_DUAL(vsubuhs, PPC_ALTIVEC, PPC_NONE, \ bcdsub, PPC_NONE, PPC2_ALTIVEC_207) GEN_VXFORM_DUAL(vaddshs, PPC_ALTIVEC, PPC_NONE, \ bcdcpsgn, PPC_NONE, PPC2_ISA300) +GEN_VXFORM_DUAL(vsubudm, PPC2_ALTIVEC_207, PPC_NONE, \ + bcds, PPC_NONE, PPC2_ISA300) =20 static void gen_vsbox(DisasContext *ctx) { diff --git a/target/ppc/translate/vmx-ops.inc.c b/target/ppc/translate/vmx-= ops.inc.c index 57dce6e..7b4b009 100644 --- a/target/ppc/translate/vmx-ops.inc.c +++ b/target/ppc/translate/vmx-ops.inc.c @@ -62,7 +62,8 @@ GEN_VXFORM_207(vaddudm, 0, 3), GEN_VXFORM_DUAL(vsububm, bcdadd, 0, 16, PPC_ALTIVEC, PPC_NONE), GEN_VXFORM_DUAL(vsubuhm, bcdsub, 0, 17, PPC_ALTIVEC, PPC_NONE), GEN_VXFORM(vsubuwm, 0, 18), -GEN_VXFORM_207(vsubudm, 0, 19), +GEN_VXFORM_DUAL(vsubudm, bcds, 0, 19, PPC2_ALTIVEC_207, PPC2_ISA300), +GEN_VXFORM_300(bcds, 0, 27), GEN_VXFORM(vmaxub, 1, 0), GEN_VXFORM(vmaxuh, 1, 1), GEN_VXFORM(vmaxuw, 1, 2), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017145704110.16406371868777; Wed, 1 Feb 2017 22:32:25 -0800 (PST) Received: from localhost ([::1]:54647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAwR-0007WX-Sx for importer@patchew.org; Thu, 02 Feb 2017 01:32:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k6-0007jI-1c for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9jz-00044y-Ks for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:33 -0500 Received: from ozlabs.org ([103.22.144.67]:53329) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9jz-0003zf-5z; Thu, 02 Feb 2017 00:15:27 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqV4B5Sz9s8J; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012502; bh=nzPjEXq7+DLm+jLWo/uLWTQ70eAGQMxP2j0k7weBJCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JX9pSRuG2gZUJkQ4jQ0jVhM9ywB0qkx9I8KW7cjSzAKJOTelBrik8yzKaMCRdPSrQ yI1HBHGQmU+f6TMip3ZOfYjfcbPo7C3qaQt93ZO/zZ9GlsAn6dcFPItC2ZMJxfqgxv AP393BS2RjpXRJaq8PrPREmC1D7aqrATAfbCKGOk= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:11 +1100 Message-Id: <20170202051445.5735-74-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 073/107] ppc: Implement bcdus. instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani bcdus.: Decimal unsigned shift. This instruction works like bcds. but considers only unsigned BCDs (no sign in least meaning 4 bits). Signed-off-by: Jose Ricardo Ziviani Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 41 +++++++++++++++++++++++++++++++++= ++++ target/ppc/translate/vmx-impl.inc.c | 3 +++ target/ppc/translate/vmx-ops.inc.c | 2 +- 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 26edbf9..161d537 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -394,6 +394,7 @@ DEF_HELPER_3(bcdctsq, i32, avr, avr, i32) DEF_HELPER_4(bcdcpsgn, i32, avr, avr, avr, i32) DEF_HELPER_3(bcdsetsgn, i32, avr, avr, i32) DEF_HELPER_4(bcds, i32, avr, avr, avr, i32) +DEF_HELPER_4(bcdus, i32, avr, avr, avr, i32) =20 DEF_HELPER_2(xsadddp, void, env, i32) DEF_HELPER_2(xsaddqp, void, env, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 5f53710..9d88352 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -3102,6 +3102,47 @@ uint32_t helper_bcds(ppc_avr_t *r, ppc_avr_t *a, ppc= _avr_t *b, uint32_t ps) return cr; } =20 +uint32_t helper_bcdus(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, uint32_t p= s) +{ + int cr; + int i; + int invalid =3D 0; + bool ox_flag =3D false; + ppc_avr_t ret =3D *b; + + for (i =3D 0; i < 32; i++) { + bcd_get_digit(b, i, &invalid); + + if (unlikely(invalid)) { + return CRF_SO; + } + } + +#if defined(HOST_WORDS_BIGENDIAN) + i =3D a->s8[7]; +#else + i =3D a->s8[8]; +#endif + if (i >=3D 32) { + ox_flag =3D true; + ret.u64[LO_IDX] =3D ret.u64[HI_IDX] =3D 0; + } else if (i <=3D -32) { + ret.u64[LO_IDX] =3D ret.u64[HI_IDX] =3D 0; + } else if (i > 0) { + ulshift(&ret.u64[LO_IDX], &ret.u64[HI_IDX], i * 4, &ox_flag); + } else { + urshift(&ret.u64[LO_IDX], &ret.u64[HI_IDX], -i * 4); + } + *r =3D ret; + + cr =3D bcd_cmp_zero(r); + if (ox_flag) { + cr |=3D CRF_SO; + } + + return cr; +} + void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a) { int i; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index 84ebb7e..fc54881 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -1017,6 +1017,7 @@ GEN_BCD2(bcdctsq) GEN_BCD2(bcdsetsgn) GEN_BCD(bcdcpsgn); GEN_BCD(bcds); +GEN_BCD(bcdus); =20 static void gen_xpnd04_1(DisasContext *ctx) { @@ -1093,6 +1094,8 @@ GEN_VXFORM_DUAL(vaddshs, PPC_ALTIVEC, PPC_NONE, \ bcdcpsgn, PPC_NONE, PPC2_ISA300) GEN_VXFORM_DUAL(vsubudm, PPC2_ALTIVEC_207, PPC_NONE, \ bcds, PPC_NONE, PPC2_ISA300) +GEN_VXFORM_DUAL(vsubuwm, PPC_ALTIVEC, PPC_NONE, \ + bcdus, PPC_NONE, PPC2_ISA300) =20 static void gen_vsbox(DisasContext *ctx) { diff --git a/target/ppc/translate/vmx-ops.inc.c b/target/ppc/translate/vmx-= ops.inc.c index 7b4b009..cdd3abe 100644 --- a/target/ppc/translate/vmx-ops.inc.c +++ b/target/ppc/translate/vmx-ops.inc.c @@ -61,7 +61,7 @@ GEN_VXFORM(vadduwm, 0, 2), GEN_VXFORM_207(vaddudm, 0, 3), GEN_VXFORM_DUAL(vsububm, bcdadd, 0, 16, PPC_ALTIVEC, PPC_NONE), GEN_VXFORM_DUAL(vsubuhm, bcdsub, 0, 17, PPC_ALTIVEC, PPC_NONE), -GEN_VXFORM(vsubuwm, 0, 18), +GEN_VXFORM_DUAL(vsubuwm, bcdus, 0, 18, PPC_ALTIVEC, PPC2_ISA300), GEN_VXFORM_DUAL(vsubudm, bcds, 0, 19, PPC2_ALTIVEC_207, PPC2_ISA300), GEN_VXFORM_300(bcds, 0, 27), GEN_VXFORM(vmaxub, 1, 0), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017244172161.0857640105819; Wed, 1 Feb 2017 22:34:04 -0800 (PST) Received: from localhost ([::1]:54653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAy1-0000XN-5a for importer@patchew.org; Thu, 02 Feb 2017 01:34:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kD-0007tw-RV for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k7-0004EX-Lh for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:41 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:56943) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k6-0004Ao-VF; Thu, 02 Feb 2017 00:15:35 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqZ0vCKz9s7X; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012506; bh=4/dVPoGukz0+fLUyakqkGtEl4WRIjLyJAuryG5yu9f8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I5JeaD45xy2dK+U7U5WpdLSHGOHgfJVtiXHLWWRyoatoif3tL5qiP0OqTLn4ZU6cF xnzwrGnw8HwI9xp6gNuuSqLXrVBt8U3P5dOx1DGEoA8FHp1qHluTVe5q9SCugJIdQe qxUrDbpCj48ytRx3b/q6Bb3lDyYJVR4w3zTvG/AY= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:12 +1100 Message-Id: <20170202051445.5735-75-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 074/107] ppc: Implement bcdsr. instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani bcdsr.: Decimal shift and round. This instruction works like bcds. however, when performing right shift, 1 will be added to the result if the last digit was >=3D 5. Signed-off-by: Jose Ricardo Ziviani Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 48 +++++++++++++++++++++++++++++++++= ++++ target/ppc/translate/vmx-impl.inc.c | 1 + target/ppc/translate/vmx-ops.inc.c | 2 ++ 4 files changed, 52 insertions(+) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 161d537..3cac050 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -395,6 +395,7 @@ DEF_HELPER_4(bcdcpsgn, i32, avr, avr, avr, i32) DEF_HELPER_3(bcdsetsgn, i32, avr, avr, i32) DEF_HELPER_4(bcds, i32, avr, avr, avr, i32) DEF_HELPER_4(bcdus, i32, avr, avr, avr, i32) +DEF_HELPER_4(bcdsr, i32, avr, avr, avr, i32) =20 DEF_HELPER_2(xsadddp, void, env, i32) DEF_HELPER_2(xsaddqp, void, env, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 9d88352..d309059 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -3143,6 +3143,54 @@ uint32_t helper_bcdus(ppc_avr_t *r, ppc_avr_t *a, pp= c_avr_t *b, uint32_t ps) return cr; } =20 +uint32_t helper_bcdsr(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, uint32_t p= s) +{ + int cr; + int unused =3D 0; + int invalid =3D 0; + bool ox_flag =3D false; + int sgnb =3D bcd_get_sgn(b); + ppc_avr_t ret =3D *b; + ret.u64[LO_IDX] &=3D ~0xf; + +#if defined(HOST_WORDS_BIGENDIAN) + int i =3D a->s8[7]; + ppc_avr_t bcd_one =3D { .u64 =3D { 0, 0x10 } }; +#else + int i =3D a->s8[8]; + ppc_avr_t bcd_one =3D { .u64 =3D { 0x10, 0 } }; +#endif + + if (bcd_is_valid(b) =3D=3D false) { + return CRF_SO; + } + + if (unlikely(i > 31)) { + i =3D 31; + } else if (unlikely(i < -31)) { + i =3D -31; + } + + if (i > 0) { + ulshift(&ret.u64[LO_IDX], &ret.u64[HI_IDX], i * 4, &ox_flag); + } else { + urshift(&ret.u64[LO_IDX], &ret.u64[HI_IDX], -i * 4); + + if (bcd_get_digit(&ret, 0, &invalid) >=3D 5) { + bcd_add_mag(&ret, &ret, &bcd_one, &invalid, &unused); + } + } + bcd_put_digit(&ret, bcd_preferred_sgn(sgnb, ps), 0); + + cr =3D bcd_cmp_zero(&ret); + if (ox_flag) { + cr |=3D CRF_SO; + } + *r =3D ret; + + return cr; +} + void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a) { int i; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index fc54881..451abb5 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -1018,6 +1018,7 @@ GEN_BCD2(bcdsetsgn) GEN_BCD(bcdcpsgn); GEN_BCD(bcds); GEN_BCD(bcdus); +GEN_BCD(bcdsr); =20 static void gen_xpnd04_1(DisasContext *ctx) { diff --git a/target/ppc/translate/vmx-ops.inc.c b/target/ppc/translate/vmx-= ops.inc.c index cdd3abe..fa9c996 100644 --- a/target/ppc/translate/vmx-ops.inc.c +++ b/target/ppc/translate/vmx-ops.inc.c @@ -132,6 +132,8 @@ GEN_HANDLER_E_2(vprtybd, 0x4, 0x1, 0x18, 9, 0, PPC_NONE= , PPC2_ISA300), GEN_HANDLER_E_2(vprtybq, 0x4, 0x1, 0x18, 10, 0, PPC_NONE, PPC2_ISA300), =20 GEN_VXFORM_DUAL(vsubcuw, xpnd04_1, 0, 22, PPC_ALTIVEC, PPC_NONE), +GEN_VXFORM_300(bcdsr, 0, 23), +GEN_VXFORM_300(bcdsr, 0, 31), GEN_VXFORM_DUAL(vaddubs, vmul10uq, 0, 8, PPC_ALTIVEC, PPC_NONE), GEN_VXFORM_DUAL(vadduhs, vmul10euq, 0, 9, PPC_ALTIVEC, PPC_NONE), GEN_VXFORM(vadduws, 0, 10), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017705564607.1031777235411; Wed, 1 Feb 2017 22:41:45 -0800 (PST) Received: from localhost ([::1]:54701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZB5R-0000B9-Tm for importer@patchew.org; Thu, 02 Feb 2017 01:41:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kA-0007pQ-T5 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k5-0004BQ-EX for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:38 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:48879) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k4-00047O-HY; Thu, 02 Feb 2017 00:15:33 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqX6xl7z9sN1; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012504; bh=1gFGBnl8mDUd26Wr+/Z8QCarlfNIIcsD3a9CzfnpQ4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GQpZm7T0kPyWibavAVVGjLaOBD/UU/vYGgNmZgzwYOHZGQtOZFiyiA5xa2tWKMV2v ck/3WxSkdGf5KxheQ/2H8oP2hFZ8MleLBX4DMZMR8AWi2gMBkHjEkf8hQYf2VAwlYB QYNdiA6xwCy+85mqwymS5yez0e5vsZmyF2Uol4nA= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:13 +1100 Message-Id: <20170202051445.5735-76-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 075/107] target-ppc: Add xsiexpdp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xsiexpdp: VSX Scalar Insert Exponent Double Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 20 ++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 21 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 2d9fe50..2d09225 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1243,6 +1243,26 @@ static void gen_xsxexpqp(DisasContext *ctx) tcg_gen_movi_i64(xtl, 0); } =20 +static void gen_xsiexpdp(DisasContext *ctx) +{ + TCGv_i64 xth =3D cpu_vsrh(xT(ctx->opcode)); + TCGv ra =3D cpu_gpr[rA(ctx->opcode)]; + TCGv rb =3D cpu_gpr[rB(ctx->opcode)]; + TCGv_i64 t0; + + if (unlikely(!ctx->vsx_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VSXU); + return; + } + t0 =3D tcg_temp_new_i64(); + tcg_gen_andi_i64(xth, ra, 0x800FFFFFFFFFFFFF); + tcg_gen_andi_i64(t0, rb, 0x7FF); + tcg_gen_shli_i64(t0, t0, 52); + tcg_gen_or_i64(xth, xth, t0); + /* dword[1] is undefined */ + tcg_temp_free_i64(t0); +} + static void gen_xsxsigdp(DisasContext *ctx) { TCGv rt =3D cpu_gpr[rD(ctx->opcode)]; diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index aeeaff2..5980ac6 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -120,6 +120,7 @@ GEN_XX2FORM_EO(xsxexpdp, 0x16, 0x15, 0x00, PPC2_ISA300), GEN_VSX_XFORM_300_EO(xsxexpqp, 0x04, 0x19, 0x02, 0x00000001), GEN_XX2FORM_EO(xsxsigdp, 0x16, 0x15, 0x01, PPC2_ISA300), GEN_VSX_XFORM_300_EO(xsxsigqp, 0x04, 0x19, 0x12, 0x00000001), +GEN_HANDLER_E(xsiexpdp, 0x3C, 0x16, 0x1C, 0, PPC_NONE, PPC2_ISA300), #endif =20 GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486018911026687.4524594088134; Wed, 1 Feb 2017 23:01:51 -0800 (PST) Received: from localhost ([::1]:54826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBOv-0003rh-36 for importer@patchew.org; Thu, 02 Feb 2017 02:01:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kI-0007zy-Vy for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kC-0004LC-GQ for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:46 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:45071) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kB-0004H5-Uw; Thu, 02 Feb 2017 00:15:40 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqZ6z6Wz9s8K; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012506; bh=tGGYZp2NQvbScpj5geyF89qzR68bAaNy3qpMb/a/uDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rab6eJOKgrxtcbXqcAibtt67CPEjKiqEqRbTFIbRGrt0Xxq4znFQAgU1psoKlvDUJ A9rx0PSxBCz/1EG7crHh2j4vQ/wDUMosEt/ucwgQjh3MQZe3pg+v8XLjmykMdQ/7WF L1XtPVi1gShaZJ86rDQhvkptq3YGRGbpk4VazL/w= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:14 +1100 Message-Id: <20170202051445.5735-77-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 076/107] target-ppc: Add xsiexpqp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xsiexpqp: VSX Scalar Insert Exponent Quad Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 22 ++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 23 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 2d09225..ed392aa 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1263,6 +1263,28 @@ static void gen_xsiexpdp(DisasContext *ctx) tcg_temp_free_i64(t0); } =20 +static void gen_xsiexpqp(DisasContext *ctx) +{ + TCGv_i64 xth =3D cpu_vsrh(rD(ctx->opcode) + 32); + TCGv_i64 xtl =3D cpu_vsrl(rD(ctx->opcode) + 32); + TCGv_i64 xah =3D cpu_vsrh(rA(ctx->opcode) + 32); + TCGv_i64 xal =3D cpu_vsrl(rA(ctx->opcode) + 32); + TCGv_i64 xbh =3D cpu_vsrh(rB(ctx->opcode) + 32); + TCGv_i64 t0; + + if (unlikely(!ctx->vsx_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VSXU); + return; + } + t0 =3D tcg_temp_new_i64(); + tcg_gen_andi_i64(xth, xah, 0x8000FFFFFFFFFFFF); + tcg_gen_andi_i64(t0, xbh, 0x7FFF); + tcg_gen_shli_i64(t0, t0, 48); + tcg_gen_or_i64(xth, xth, t0); + tcg_gen_mov_i64(xtl, xal); + tcg_temp_free_i64(t0); +} + static void gen_xsxsigdp(DisasContext *ctx) { TCGv rt =3D cpu_gpr[rD(ctx->opcode)]; diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 5980ac6..09b91c3 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -121,6 +121,7 @@ GEN_VSX_XFORM_300_EO(xsxexpqp, 0x04, 0x19, 0x02, 0x0000= 0001), GEN_XX2FORM_EO(xsxsigdp, 0x16, 0x15, 0x01, PPC2_ISA300), GEN_VSX_XFORM_300_EO(xsxsigqp, 0x04, 0x19, 0x12, 0x00000001), GEN_HANDLER_E(xsiexpdp, 0x3C, 0x16, 0x1C, 0, PPC_NONE, PPC2_ISA300), +GEN_VSX_XFORM_300(xsiexpqp, 0x4, 0x1B, 0x00000001), #endif =20 GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486018328043634.4126565412588; Wed, 1 Feb 2017 22:52:08 -0800 (PST) Received: from localhost ([::1]:54764 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBFT-0002J2-7v for importer@patchew.org; Thu, 02 Feb 2017 01:52:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kJ-00080u-Fw for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kC-0004Le-VP for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:47 -0500 Received: from ozlabs.org ([103.22.144.67]:46807) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kC-0004IU-GP; Thu, 02 Feb 2017 00:15:40 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqb37Bbz9sND; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012507; bh=MWYMHPZQBnXJpHyW9gYJDODW4XY+KBKeP+e7Cf3sVpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IlBF4ta87jVLbH0CqQJvOezkluMghBBLooRHtc7G4LUkQSUYuLykf0DBI+1P7z4qe iEqMd+5Q1gFGAfU+sLL17E6pOa8JNH7WcKy99d4mypO43/HVPPYvspPg/8C+3h7Cq4 vTDHzTNfxKxcjjhozT9llQ3Bwgr9qjPGFOATrlIM= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:15 +1100 Message-Id: <20170202051445.5735-78-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 077/107] target-ppc: Add xviexpsp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xviexpsp: VSX Vector Insert Exponent Single Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 26 ++++++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 2 ++ 2 files changed, 28 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index ed392aa..c86f1b5 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1344,6 +1344,32 @@ static void gen_xsxsigqp(DisasContext *ctx) } #endif =20 +static void gen_xviexpsp(DisasContext *ctx) +{ + TCGv_i64 xth =3D cpu_vsrh(xT(ctx->opcode)); + TCGv_i64 xtl =3D cpu_vsrl(xT(ctx->opcode)); + TCGv_i64 xah =3D cpu_vsrh(xA(ctx->opcode)); + TCGv_i64 xal =3D cpu_vsrl(xA(ctx->opcode)); + TCGv_i64 xbh =3D cpu_vsrh(xB(ctx->opcode)); + TCGv_i64 xbl =3D cpu_vsrl(xB(ctx->opcode)); + TCGv_i64 t0; + + if (unlikely(!ctx->vsx_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VSXU); + return; + } + t0 =3D tcg_temp_new_i64(); + tcg_gen_andi_i64(xth, xah, 0x807FFFFF807FFFFF); + tcg_gen_andi_i64(t0, xbh, 0xFF000000FF); + tcg_gen_shli_i64(t0, t0, 23); + tcg_gen_or_i64(xth, xth, t0); + tcg_gen_andi_i64(xtl, xal, 0x807FFFFF807FFFFF); + tcg_gen_andi_i64(t0, xbl, 0xFF000000FF); + tcg_gen_shli_i64(t0, t0, 23); + tcg_gen_or_i64(xtl, xtl, t0); + tcg_temp_free_i64(t0); +} + #undef GEN_XX2FORM #undef GEN_XX3FORM #undef GEN_XX2IFORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 09b91c3..93752f0 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -124,6 +124,8 @@ GEN_HANDLER_E(xsiexpdp, 0x3C, 0x16, 0x1C, 0, PPC_NONE, = PPC2_ISA300), GEN_VSX_XFORM_300(xsiexpqp, 0x4, 0x1B, 0x00000001), #endif =20 +GEN_XX3FORM(xviexpsp, 0x00, 0x1B, PPC2_ISA300), + GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), GEN_XX2FORM(xvnabsdp, 0x12, 0x1E, PPC2_VSX), GEN_XX2FORM(xvnegdp, 0x12, 0x1F, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486018050479885.3984496300803; Wed, 1 Feb 2017 22:47:30 -0800 (PST) Received: from localhost ([::1]:54732 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBB0-0005x3-Tw for importer@patchew.org; Thu, 02 Feb 2017 01:47:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kA-0007pE-Qt for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k5-0004BX-FC for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:38 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:36259) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k4-00047L-Jc; Thu, 02 Feb 2017 00:15:33 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqX3tXHz9sNC; Thu, 2 Feb 2017 16:15:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012504; bh=EvTsM2ebNG+nYAAvSHKZSP4ZXPY7vd0vN6o/MFe9Tec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dTsO756kfBV8BqeIgBjoTl4x+fKP4QYodq2UGGhuMYuJcfS50nOjhaqFGwlPm5Y7c w53eo+MfVNxM6YOSVDcBEv13AWOPYilRrjpwTecBTj8M6oz64d2SxJUCofnXY0j7Sx rUx/3V/QCvfcATK+M/GiL1dwCHkZDoUs83bBB5MI= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:16 +1100 Message-Id: <20170202051445.5735-79-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 078/107] target-ppc: Add xviexpdp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xviexpdp: VSX Vector Insert Exponent Dual Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 26 ++++++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 27 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index c86f1b5..b66272e 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1370,6 +1370,32 @@ static void gen_xviexpsp(DisasContext *ctx) tcg_temp_free_i64(t0); } =20 +static void gen_xviexpdp(DisasContext *ctx) +{ + TCGv_i64 xth =3D cpu_vsrh(xT(ctx->opcode)); + TCGv_i64 xtl =3D cpu_vsrl(xT(ctx->opcode)); + TCGv_i64 xah =3D cpu_vsrh(xA(ctx->opcode)); + TCGv_i64 xal =3D cpu_vsrl(xA(ctx->opcode)); + TCGv_i64 xbh =3D cpu_vsrh(xB(ctx->opcode)); + TCGv_i64 xbl =3D cpu_vsrl(xB(ctx->opcode)); + TCGv_i64 t0; + + if (unlikely(!ctx->vsx_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VSXU); + return; + } + t0 =3D tcg_temp_new_i64(); + tcg_gen_andi_i64(xth, xah, 0x800FFFFFFFFFFFFF); + tcg_gen_andi_i64(t0, xbh, 0x7FF); + tcg_gen_shli_i64(t0, t0, 52); + tcg_gen_or_i64(xth, xth, t0); + tcg_gen_andi_i64(xtl, xal, 0x800FFFFFFFFFFFFF); + tcg_gen_andi_i64(t0, xbl, 0x7FF); + tcg_gen_shli_i64(t0, t0, 52); + tcg_gen_or_i64(xtl, xtl, t0); + tcg_temp_free_i64(t0); +} + #undef GEN_XX2FORM #undef GEN_XX3FORM #undef GEN_XX2IFORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 93752f0..253a5c4 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -125,6 +125,7 @@ GEN_VSX_XFORM_300(xsiexpqp, 0x4, 0x1B, 0x00000001), #endif =20 GEN_XX3FORM(xviexpsp, 0x00, 0x1B, PPC2_ISA300), +GEN_XX3FORM(xviexpdp, 0x00, 0x1F, PPC2_ISA300), =20 GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), GEN_XX2FORM(xvnabsdp, 0x12, 0x1E, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14860192850851014.8971831227193; Wed, 1 Feb 2017 23:08:05 -0800 (PST) Received: from localhost ([::1]:54859 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBUw-0002JX-RQ for importer@patchew.org; Thu, 02 Feb 2017 02:08:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kD-0007ss-B0 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k6-0004Df-MB for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:41 -0500 Received: from ozlabs.org ([103.22.144.67]:33247) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k6-0004AY-5w; Thu, 02 Feb 2017 00:15:34 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqY6lJpz9s7T; Thu, 2 Feb 2017 16:15:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012505; bh=dIPF/5BfKWIuRVyGvhGH8ApE5EgG/qc5g7sjhG4dP6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lQ2XUDKbonTK/pLvojtZbv7/ba2lU6WYweiG0bBK78JWsTxSWbh/LTOM7YCZclqMk YgouDtDOiqCX1S95YZKzRrDKH5beKOYwqQap8hOhRJL04z4PbTExTyo0JOjjxGwLYm mk0OknBzZOYi5dH919G08KgGvP6o3jFKoxUYwZCY= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:17 +1100 Message-Id: <20170202051445.5735-80-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 079/107] target-ppc: Add xvxexpsp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xvxexpsp: VSX Vector Extract Exponent Single Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 17 +++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 18 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index b66272e..160a80c 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1396,6 +1396,23 @@ static void gen_xviexpdp(DisasContext *ctx) tcg_temp_free_i64(t0); } =20 +static void gen_xvxexpsp(DisasContext *ctx) +{ + TCGv_i64 xth =3D cpu_vsrh(xT(ctx->opcode)); + TCGv_i64 xtl =3D cpu_vsrl(xT(ctx->opcode)); + TCGv_i64 xbh =3D cpu_vsrh(xB(ctx->opcode)); + TCGv_i64 xbl =3D cpu_vsrl(xB(ctx->opcode)); + + if (unlikely(!ctx->vsx_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VSXU); + return; + } + tcg_gen_shri_i64(xth, xbh, 23); + tcg_gen_andi_i64(xth, xth, 0xFF000000FF); + tcg_gen_shri_i64(xtl, xbl, 23); + tcg_gen_andi_i64(xtl, xtl, 0xFF000000FF); +} + #undef GEN_XX2FORM #undef GEN_XX3FORM #undef GEN_XX2IFORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 253a5c4..eb7334a 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -126,6 +126,7 @@ GEN_VSX_XFORM_300(xsiexpqp, 0x4, 0x1B, 0x00000001), =20 GEN_XX3FORM(xviexpsp, 0x00, 0x1B, PPC2_ISA300), GEN_XX3FORM(xviexpdp, 0x00, 0x1F, PPC2_ISA300), +GEN_XX2FORM_EO(xvxexpsp, 0x16, 0x1D, 0x08, PPC2_ISA300), =20 GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), GEN_XX2FORM(xvnabsdp, 0x12, 0x1E, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486018545694800.7256439193961; Wed, 1 Feb 2017 22:55:45 -0800 (PST) Received: from localhost ([::1]:54786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBJ1-0006Cf-Nx for importer@patchew.org; Thu, 02 Feb 2017 01:55:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kG-0007ws-JR for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k9-0004HL-LC for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:44 -0500 Received: from ozlabs.org ([103.22.144.67]:43593) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k9-0004E4-71; Thu, 02 Feb 2017 00:15:37 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqZ61GKz9sNF; Thu, 2 Feb 2017 16:15:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012506; bh=rjnaygwy6wjcZ8/HWE4RNwbOGx35iVExvO9II2WmV/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LJUfTp7bl8eacZ9879hGX7mWNRylgif75gLmY44VzWZohnXabuczQR+BhNtdsrmo8 O5vcr/SPu404sq9pbhYbWIomesozyOpU1tcH3CLk82wDzKdkqUWUVteFQxyZdQVQmA Sdq0Z7SCus3vlJJtPB7YJ1VCazWoul+1Cp3WhGjc= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:18 +1100 Message-Id: <20170202051445.5735-81-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 080/107] target-ppc: Add xvxexpdp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xvxexpdp: VSX Vector Extract Exponent Dual Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 17 +++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 18 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 160a80c..7b26f75 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1413,6 +1413,23 @@ static void gen_xvxexpsp(DisasContext *ctx) tcg_gen_andi_i64(xtl, xtl, 0xFF000000FF); } =20 +static void gen_xvxexpdp(DisasContext *ctx) +{ + TCGv_i64 xth =3D cpu_vsrh(xT(ctx->opcode)); + TCGv_i64 xtl =3D cpu_vsrl(xT(ctx->opcode)); + TCGv_i64 xbh =3D cpu_vsrh(xB(ctx->opcode)); + TCGv_i64 xbl =3D cpu_vsrl(xB(ctx->opcode)); + + if (unlikely(!ctx->vsx_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VSXU); + return; + } + tcg_gen_shri_i64(xth, xbh, 52); + tcg_gen_andi_i64(xth, xth, 0x7FF); + tcg_gen_shri_i64(xtl, xbl, 52); + tcg_gen_andi_i64(xtl, xtl, 0x7FF); +} + #undef GEN_XX2FORM #undef GEN_XX3FORM #undef GEN_XX2IFORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index eb7334a..a3061ce 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -126,6 +126,7 @@ GEN_VSX_XFORM_300(xsiexpqp, 0x4, 0x1B, 0x00000001), =20 GEN_XX3FORM(xviexpsp, 0x00, 0x1B, PPC2_ISA300), GEN_XX3FORM(xviexpdp, 0x00, 0x1F, PPC2_ISA300), +GEN_XX2FORM_EO(xvxexpdp, 0x16, 0x1D, 0x00, PPC2_ISA300), GEN_XX2FORM_EO(xvxexpsp, 0x16, 0x1D, 0x08, PPC2_ISA300), =20 GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486018268378117.53277046903747; Wed, 1 Feb 2017 22:51:08 -0800 (PST) Received: from localhost ([::1]:54762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBEX-0001WA-Ce for importer@patchew.org; Thu, 02 Feb 2017 01:51:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kC-0007sN-V6 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k6-0004CP-18 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:40 -0500 Received: from ozlabs.org ([103.22.144.67]:43197) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k5-00049P-GC; Thu, 02 Feb 2017 00:15:33 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqY3k33z9s7N; Thu, 2 Feb 2017 16:15:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012505; bh=IYE1FrXWwPLBUKBkVqmrwxhDeB4jt02WRdflbzYcCj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hlmFPMc7i7NnnjOvzY2lb+narSvOSwZLqkUz7nXKkdxVeqoGlwz32ienKwBOkguYj EYE87qex0PMz3s/HnQw4w25ZoSlY/IZFTM5E5dJF9Hk4GrjUcQ/gfsXGlSpvyT8k6W tl89Qk5bjZVaWhqla6COhThLc7aLXzUI1sqN224I= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:19 +1100 Message-Id: <20170202051445.5735-82-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 081/107] target-ppc: Add xvxsigsp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xvxsigsp: VSX Vector Extract Significand Single Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 20 ++++++++++++++++++++ target/ppc/helper.h | 1 + target/ppc/translate/vsx-impl.inc.c | 2 ++ target/ppc/translate/vsx-ops.inc.c | 1 + 4 files changed, 24 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 77f68e9..4da83d9 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -3026,3 +3026,23 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ =20 VSX_XXPERM(xxperm, 0) VSX_XXPERM(xxpermr, 1) + +void helper_xvxsigsp(CPUPPCState *env, uint32_t opcode) +{ + ppc_vsr_t xt, xb; + uint32_t exp, i, fraction; + + getVSR(xB(opcode), &xb, env); + memset(&xt, 0, sizeof(xt)); + + for (i =3D 0; i < 4; i++) { + exp =3D (xb.VsrW(i) >> 23) & 0xFF; + fraction =3D xb.VsrW(i) & 0x7FFFFF; + if (exp !=3D 0 && exp !=3D 255) { + xt.VsrW(i) =3D fraction | 0x00800000; + } else { + xt.VsrW(i) =3D fraction; + } + } + putVSR(xT(opcode), &xt, env); +} diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 3cac050..ae14da4 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -545,6 +545,7 @@ DEF_HELPER_2(xxperm, void, env, i32) DEF_HELPER_2(xxpermr, void, env, i32) DEF_HELPER_4(xxextractuw, void, env, tl, tl, i32) DEF_HELPER_4(xxinsertw, void, env, tl, tl, i32) +DEF_HELPER_2(xvxsigsp, void, env, i32) =20 DEF_HELPER_2(efscfsi, i32, env, i32) DEF_HELPER_2(efscfui, i32, env, i32) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 7b26f75..4e57af7 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1430,6 +1430,8 @@ static void gen_xvxexpdp(DisasContext *ctx) tcg_gen_andi_i64(xtl, xtl, 0x7FF); } =20 +GEN_VSX_HELPER_2(xvxsigsp, 0x00, 0x04, 0, PPC2_ISA300) + #undef GEN_XX2FORM #undef GEN_XX3FORM #undef GEN_XX2IFORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index a3061ce..2c4f641 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -128,6 +128,7 @@ GEN_XX3FORM(xviexpsp, 0x00, 0x1B, PPC2_ISA300), GEN_XX3FORM(xviexpdp, 0x00, 0x1F, PPC2_ISA300), GEN_XX2FORM_EO(xvxexpdp, 0x16, 0x1D, 0x00, PPC2_ISA300), GEN_XX2FORM_EO(xvxexpsp, 0x16, 0x1D, 0x08, PPC2_ISA300), +GEN_XX2FORM_EO(xvxsigsp, 0x16, 0x1D, 0x09, PPC2_ISA300), =20 GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), GEN_XX2FORM(xvnabsdp, 0x12, 0x1E, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148601865614391.32869490893734; Wed, 1 Feb 2017 22:57:36 -0800 (PST) Received: from localhost ([::1]:54798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBKo-0000Bu-9j for importer@patchew.org; Thu, 02 Feb 2017 01:57:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kG-0007wq-JC for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k9-0004GU-4k for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:44 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:42193) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k8-0004CK-EW; Thu, 02 Feb 2017 00:15:36 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqZ1ycNz9s7V; Thu, 2 Feb 2017 16:15:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012506; bh=VyIuE0Ufx3qqswssc6y7xhf71F4RDrwkYtrt0QsvlO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lc57ZJMqOzuO/dUs1x9kkk5kqmrLtX15I6ihQo8UlarUZbYb0aCDsT3kx8Eje35RC R5lM/F8+byg/TgyqL/CADNWDqj3OEEsen3OZHmyTWxLcoqz8VnQ+uihw6M4Y365CKG X5A7lpoBS+/vyMdzDob+/9Dv6oY6g8fA16GDrswg= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:20 +1100 Message-Id: <20170202051445.5735-83-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 082/107] target-ppc: Add xvxsigdp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xvxsigdp: VSX Vector Extract Significand Dual Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 40 +++++++++++++++++++++++++++++++++= ++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 41 insertions(+) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 4e57af7..7e068a4 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1432,6 +1432,46 @@ static void gen_xvxexpdp(DisasContext *ctx) =20 GEN_VSX_HELPER_2(xvxsigsp, 0x00, 0x04, 0, PPC2_ISA300) =20 +static void gen_xvxsigdp(DisasContext *ctx) +{ + TCGv_i64 xth =3D cpu_vsrh(xT(ctx->opcode)); + TCGv_i64 xtl =3D cpu_vsrl(xT(ctx->opcode)); + TCGv_i64 xbh =3D cpu_vsrh(xB(ctx->opcode)); + TCGv_i64 xbl =3D cpu_vsrl(xB(ctx->opcode)); + + TCGv_i64 t0, zr, nan, exp; + + if (unlikely(!ctx->vsx_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VSXU); + return; + } + exp =3D tcg_temp_new_i64(); + t0 =3D tcg_temp_new_i64(); + zr =3D tcg_const_i64(0); + nan =3D tcg_const_i64(2047); + + tcg_gen_shri_i64(exp, xbh, 52); + tcg_gen_andi_i64(exp, exp, 0x7FF); + tcg_gen_movi_i64(t0, 0x0010000000000000); + tcg_gen_movcond_i64(TCG_COND_EQ, t0, exp, zr, zr, t0); + tcg_gen_movcond_i64(TCG_COND_EQ, t0, exp, nan, zr, t0); + tcg_gen_andi_i64(xth, xbh, 0x000FFFFFFFFFFFFF); + tcg_gen_or_i64(xth, xth, t0); + + tcg_gen_shri_i64(exp, xbl, 52); + tcg_gen_andi_i64(exp, exp, 0x7FF); + tcg_gen_movi_i64(t0, 0x0010000000000000); + tcg_gen_movcond_i64(TCG_COND_EQ, t0, exp, zr, zr, t0); + tcg_gen_movcond_i64(TCG_COND_EQ, t0, exp, nan, zr, t0); + tcg_gen_andi_i64(xtl, xbl, 0x000FFFFFFFFFFFFF); + tcg_gen_or_i64(xtl, xtl, t0); + + tcg_temp_free_i64(t0); + tcg_temp_free_i64(exp); + tcg_temp_free_i64(zr); + tcg_temp_free_i64(nan); +} + #undef GEN_XX2FORM #undef GEN_XX3FORM #undef GEN_XX2IFORM diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 2c4f641..367fd38 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -127,6 +127,7 @@ GEN_VSX_XFORM_300(xsiexpqp, 0x4, 0x1B, 0x00000001), GEN_XX3FORM(xviexpsp, 0x00, 0x1B, PPC2_ISA300), GEN_XX3FORM(xviexpdp, 0x00, 0x1F, PPC2_ISA300), GEN_XX2FORM_EO(xvxexpdp, 0x16, 0x1D, 0x00, PPC2_ISA300), +GEN_XX2FORM_EO(xvxsigdp, 0x16, 0x1D, 0x01, PPC2_ISA300), GEN_XX2FORM_EO(xvxexpsp, 0x16, 0x1D, 0x08, PPC2_ISA300), GEN_XX2FORM_EO(xvxsigsp, 0x16, 0x1D, 0x09, PPC2_ISA300), =20 --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486019448244215.42210718693218; Wed, 1 Feb 2017 23:10:48 -0800 (PST) Received: from localhost ([::1]:54875 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBXa-0004hf-4l for importer@patchew.org; Thu, 02 Feb 2017 02:10:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kL-00083L-Jf for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kD-0004Lw-2Q for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:49 -0500 Received: from ozlabs.org ([103.22.144.67]:46611) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kC-0004Ik-JJ; Thu, 02 Feb 2017 00:15:40 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqb3ndNz9sMh; Thu, 2 Feb 2017 16:15:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012507; bh=GfIHt2B1Hvo79Fx5+4AqE3o9zB2nxmyPiErk6ZCbVv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZNOD1mc11cCZkGFpsgWb8YG3ifKjR4YG+8vEA6EIPLXOv4CsHjzqv3wWC8vc1NEmF DwY6+Is46sPW7xUjsTUZ0EYnIq2LtF9Fq3uOx3X3P36W6Ex9VsVrtUO8ZTOczHScVH NYf70r1zPrh04hASm3O2JLbfcB47iTqa5AW2xdpo= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:21 +1100 Message-Id: <20170202051445.5735-84-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 083/107] target-ppc: Add xscvqps[d, w]z instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xscvqpsdz: VSX Scalar truncate & Convert Quad-Precision format to Signed Doubleword format xscvqpswz: VSX Scalar truncate & Convert Quad-Precision format to Signed Word format Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 40 +++++++++++++++++++++++++++++++++= ++++ target/ppc/helper.h | 2 ++ target/ppc/translate/vsx-impl.inc.c | 2 ++ target/ppc/translate/vsx-ops.inc.c | 2 ++ 4 files changed, 46 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 4da83d9..ae57272 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2878,6 +2878,46 @@ VSX_CVT_FP_TO_INT(xvcvspsxws, 4, float32, int32, Vsr= W(i), VsrW(i), 0x80000000U) VSX_CVT_FP_TO_INT(xvcvspuxds, 2, float32, uint64, VsrW(2*i), VsrD(i), 0ULL) VSX_CVT_FP_TO_INT(xvcvspuxws, 4, float32, uint32, VsrW(i), VsrW(i), 0U) =20 +/* VSX_CVT_FP_TO_INT_VECTOR - VSX floating point to integer conversion + * op - instruction mnemonic + * stp - source type (float32 or float64) + * ttp - target type (int32, uint32, int64 or uint64) + * sfld - source vsr_t field + * tfld - target vsr_t field + * rnan - resulting NaN + */ +#define VSX_CVT_FP_TO_INT_VECTOR(op, stp, ttp, sfld, tfld, rnan) = \ +void helper_##op(CPUPPCState *env, uint32_t opcode) = \ +{ = \ + ppc_vsr_t xt, xb; = \ + = \ + getVSR(rB(opcode) + 32, &xb, env); = \ + memset(&xt, 0, sizeof(xt)); = \ + = \ + if (unlikely(stp##_is_any_nan(xb.sfld))) { = \ + if (stp##_is_signaling_nan(xb.sfld, &env->fp_status)) { = \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); = \ + } = \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI, 0); = \ + xt.tfld =3D rnan; = \ + } else { = \ + xt.tfld =3D stp##_to_##ttp##_round_to_zero(xb.sfld, = \ + &env->fp_status); = \ + if (env->fp_status.float_exception_flags & float_flag_invalid) { = \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI, 0); = \ + } = \ + } = \ + = \ + putVSR(rD(opcode) + 32, &xt, env); = \ + float_check_status(env); = \ +} + +VSX_CVT_FP_TO_INT_VECTOR(xscvqpsdz, float128, int64, f128, VsrD(0), = \ + 0x8000000000000000ULL) + +VSX_CVT_FP_TO_INT_VECTOR(xscvqpswz, float128, int32, f128, VsrD(0), = \ + 0xffffffff80000000ULL) + /* VSX_CVT_INT_TO_FP - VSX integer to floating point conversion * op - instruction mnemonic * nels - number of elements (1, 2 or 4) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index ae14da4..96d8cae 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -432,6 +432,8 @@ DEF_HELPER_2(xscvdpqp, void, env, i32) DEF_HELPER_2(xscvdpsp, void, env, i32) DEF_HELPER_2(xscvdpspn, i64, env, i64) DEF_HELPER_2(xscvqpdp, void, env, i32) +DEF_HELPER_2(xscvqpsdz, void, env, i32) +DEF_HELPER_2(xscvqpswz, void, env, i32) DEF_HELPER_2(xscvhpdp, void, env, i32) DEF_HELPER_2(xscvspdp, void, env, i32) DEF_HELPER_2(xscvspdpn, i64, env, i64) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 7e068a4..3c924ba 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -811,6 +811,8 @@ GEN_VSX_HELPER_2(xscvdpsp, 0x12, 0x10, 0, PPC2_VSX) GEN_VSX_HELPER_2(xscvdpqp, 0x04, 0x1A, 0x16, PPC2_ISA300) GEN_VSX_HELPER_XT_XB_ENV(xscvdpspn, 0x16, 0x10, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xscvqpdp, 0x04, 0x1A, 0x14, PPC2_ISA300) +GEN_VSX_HELPER_2(xscvqpsdz, 0x04, 0x1A, 0x19, PPC2_ISA300) +GEN_VSX_HELPER_2(xscvqpswz, 0x04, 0x1A, 0x09, PPC2_ISA300) GEN_VSX_HELPER_2(xscvhpdp, 0x16, 0x15, 0x10, PPC2_ISA300) GEN_VSX_HELPER_2(xscvspdp, 0x12, 0x14, 0, PPC2_VSX) GEN_VSX_HELPER_XT_XB_ENV(xscvspdpn, 0x16, 0x14, 0, PPC2_VSX207) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 367fd38..297c317 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -114,6 +114,8 @@ GEN_VSX_XFORM_300_EO(xsnegqp, 0x04, 0x19, 0x10, 0x00000= 001), GEN_VSX_XFORM_300(xscpsgnqp, 0x04, 0x03, 0x00000001), GEN_VSX_XFORM_300_EO(xscvdpqp, 0x04, 0x1A, 0x16, 0x00000001), GEN_VSX_XFORM_300_EO(xscvqpdp, 0x04, 0x1A, 0x14, 0x0), +GEN_VSX_XFORM_300_EO(xscvqpsdz, 0x04, 0x1A, 0x19, 0x00000001), +GEN_VSX_XFORM_300_EO(xscvqpswz, 0x04, 0x1A, 0x09, 0x00000001), =20 #ifdef TARGET_PPC64 GEN_XX2FORM_EO(xsxexpdp, 0x16, 0x15, 0x00, PPC2_ISA300), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486018067784454.7171286795906; Wed, 1 Feb 2017 22:47:47 -0800 (PST) Received: from localhost ([::1]:54733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBBJ-0006T4-TT for importer@patchew.org; Thu, 02 Feb 2017 01:47:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kJ-00080t-Es for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kC-0004Kd-8v for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:47 -0500 Received: from ozlabs.org ([103.22.144.67]:53075) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kB-0004HF-HY; Thu, 02 Feb 2017 00:15:39 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqb1Hbpz9s7F; Thu, 2 Feb 2017 16:15:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012507; bh=7BvGGOcpnSdX7Uf0YfuHxzL86WAecPnGXyzhU3tBjIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V+F38wzHz+KXrcGdDT91KYo8QUpeXlKVClEImXd1GhltXzrerDRE4RPKoFoZDeLH4 WfjXzSZ8vvsiiqIbEvqyXxsTJn4HDgxdEwMmOq3AvWwdUMNri07Fe3aoVMaDdIytlv 5kjH2edKzSQCmNctC1IoKEBWK+R42tbcjb6/H9CM= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:22 +1100 Message-Id: <20170202051445.5735-85-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 084/107] ppc/prep: update MAINTAINERS file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Herv=C3=A9 Poussineau Signed-off-by: Herv=C3=A9 Poussineau Signed-off-by: David Gibson --- MAINTAINERS | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index e0be7bc..b1f4d9d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -671,10 +671,13 @@ F: hw/misc/macio/ F: hw/intc/heathrow_pic.c =20 PReP +M: Herv=C3=A9 Poussineau L: qemu-devel@nongnu.org L: qemu-ppc@nongnu.org -S: Odd Fixes +S: Maintained F: hw/ppc/prep.c +F: hw/ppc/prep_systemio.c +F: hw/ppc/rs6000_mc.c F: hw/pci-host/prep.[hc] F: hw/isa/pc87312.[hc] F: pc-bios/ppc_rom.bin --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486018803101646.3530707742299; Wed, 1 Feb 2017 23:00:03 -0800 (PST) Received: from localhost ([::1]:54810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBNB-0002Gy-50 for importer@patchew.org; Thu, 02 Feb 2017 02:00:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kH-0007xl-78 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k9-0004H7-Ip for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:45 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:56409) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k8-0004DY-VG; Thu, 02 Feb 2017 00:15:37 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqZ3Z0zz9sDF; Thu, 2 Feb 2017 16:15:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012506; bh=GEiAiKU+2wiSL1pG/aFXj9ycELTeQAANllqM/8JH5BI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nEN+LJDE5rv1S1u5vg1usLEwUiD9Aq9SGX9hsQyFilCdZ9A1XHysM3rDCrK2BeTYG L69gSNgv2USBscnxjwa7eXOgKVNqPZvpkyEYjNIVkekdWQMewVfWWT0W3bvgOV2/B+ AkA1shsYPrsDmriKNpySDdSfw2eIS7RJddLBi58s= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:23 +1100 Message-Id: <20170202051445.5735-86-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 085/107] ppc: Implement bcdtrunc. instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani bcdtrunc.: Decimal integer truncate. Given a BCD number in vrb and the number of bytes to truncate in vra, the return register will have vrb with such bits truncated. Signed-off-by: Jose Ricardo Ziviani Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 37 +++++++++++++++++++++++++++++++++= ++++ target/ppc/translate/vmx-impl.inc.c | 5 +++++ target/ppc/translate/vmx-ops.inc.c | 4 ++-- 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 96d8cae..ddc6a9b 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -396,6 +396,7 @@ DEF_HELPER_3(bcdsetsgn, i32, avr, avr, i32) DEF_HELPER_4(bcds, i32, avr, avr, avr, i32) DEF_HELPER_4(bcdus, i32, avr, avr, avr, i32) DEF_HELPER_4(bcdsr, i32, avr, avr, avr, i32) +DEF_HELPER_4(bcdtrunc, i32, avr, avr, avr, i32) =20 DEF_HELPER_2(xsadddp, void, env, i32) DEF_HELPER_2(xsaddqp, void, env, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index d309059..9f56cff 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -3191,6 +3191,43 @@ uint32_t helper_bcdsr(ppc_avr_t *r, ppc_avr_t *a, pp= c_avr_t *b, uint32_t ps) return cr; } =20 +uint32_t helper_bcdtrunc(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, uint32_= t ps) +{ + uint64_t mask; + uint32_t ox_flag =3D 0; +#if defined(HOST_WORDS_BIGENDIAN) + int i =3D a->s16[3] + 1; +#else + int i =3D a->s16[4] + 1; +#endif + ppc_avr_t ret =3D *b; + + if (bcd_is_valid(b) =3D=3D false) { + return CRF_SO; + } + + if (i > 16 && i < 32) { + mask =3D (uint64_t)-1 >> (128 - i * 4); + if (ret.u64[HI_IDX] & ~mask) { + ox_flag =3D CRF_SO; + } + + ret.u64[HI_IDX] &=3D mask; + } else if (i >=3D 0 && i <=3D 16) { + mask =3D (uint64_t)-1 >> (64 - i * 4); + if (ret.u64[HI_IDX] || (ret.u64[LO_IDX] & ~mask)) { + ox_flag =3D CRF_SO; + } + + ret.u64[LO_IDX] &=3D mask; + ret.u64[HI_IDX] =3D 0; + } + bcd_put_digit(&ret, bcd_preferred_sgn(bcd_get_sgn(b), ps), 0); + *r =3D ret; + + return bcd_cmp_zero(&ret) | ox_flag; +} + void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a) { int i; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index 451abb5..1683f42 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -1019,6 +1019,7 @@ GEN_BCD(bcdcpsgn); GEN_BCD(bcds); GEN_BCD(bcdus); GEN_BCD(bcdsr); +GEN_BCD(bcdtrunc); =20 static void gen_xpnd04_1(DisasContext *ctx) { @@ -1097,6 +1098,10 @@ GEN_VXFORM_DUAL(vsubudm, PPC2_ALTIVEC_207, PPC_NONE,= \ bcds, PPC_NONE, PPC2_ISA300) GEN_VXFORM_DUAL(vsubuwm, PPC_ALTIVEC, PPC_NONE, \ bcdus, PPC_NONE, PPC2_ISA300) +GEN_VXFORM_DUAL(vsubsbs, PPC_ALTIVEC, PPC_NONE, \ + bcdtrunc, PPC_NONE, PPC2_ISA300) +GEN_VXFORM_DUAL(vsubuqm, PPC2_ALTIVEC_207, PPC_NONE, \ + bcdtrunc, PPC_NONE, PPC2_ISA300) =20 static void gen_vsbox(DisasContext *ctx) { diff --git a/target/ppc/translate/vmx-ops.inc.c b/target/ppc/translate/vmx-= ops.inc.c index fa9c996..e6167a4 100644 --- a/target/ppc/translate/vmx-ops.inc.c +++ b/target/ppc/translate/vmx-ops.inc.c @@ -143,14 +143,14 @@ GEN_VXFORM(vaddsws, 0, 14), GEN_VXFORM_DUAL(vsububs, bcdadd, 0, 24, PPC_ALTIVEC, PPC_NONE), GEN_VXFORM_DUAL(vsubuhs, bcdsub, 0, 25, PPC_ALTIVEC, PPC_NONE), GEN_VXFORM(vsubuws, 0, 26), -GEN_VXFORM(vsubsbs, 0, 28), +GEN_VXFORM_DUAL(vsubsbs, bcdtrunc, 0, 28, PPC_NONE, PPC2_ISA300), GEN_VXFORM(vsubshs, 0, 29), GEN_VXFORM_DUAL(vsubsws, xpnd04_2, 0, 30, PPC_ALTIVEC, PPC_NONE), GEN_VXFORM_207(vadduqm, 0, 4), GEN_VXFORM_207(vaddcuq, 0, 5), GEN_VXFORM_DUAL(vaddeuqm, vaddecuq, 30, 0xFF, PPC_NONE, PPC2_ALTIVEC_207), -GEN_VXFORM_207(vsubuqm, 0, 20), GEN_VXFORM_207(vsubcuq, 0, 21), +GEN_VXFORM_DUAL(vsubuqm, bcdtrunc, 0, 20, PPC2_ALTIVEC_207, PPC2_ISA300), GEN_VXFORM_DUAL(vsubeuqm, vsubecuq, 31, 0xFF, PPC_NONE, PPC2_ALTIVEC_207), GEN_VXFORM(vrlb, 2, 0), GEN_VXFORM(vrlh, 2, 1), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486019186808814.3524634761696; Wed, 1 Feb 2017 23:06:26 -0800 (PST) Received: from localhost ([::1]:54851 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBTM-0000BQ-Oo for importer@patchew.org; Thu, 02 Feb 2017 02:06:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kJ-00080r-En for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kC-0004Km-AU for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:47 -0500 Received: from ozlabs.org ([103.22.144.67]:54693) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kB-0004HY-S2; Thu, 02 Feb 2017 00:15:40 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqb1mRyz9sN8; Thu, 2 Feb 2017 16:15:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012507; bh=Bk4H7hr5G197qy7PJggH4dTtFU1r7oT5Ogso5F66Fgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ncLOxh/tIaM66rSpz/zP0aK7uGSrpSZL0Tp3px8qCYaPdW4zLjTATMsyW/CVHQJWV kVum0uPSGdHdPFatqiGikVU/s8Jb338P9K+GKMFuitfWKB07qSnyDyCu4edrLVbOzj nEMiPj8SsN9LFd8YEG/XDpPT0t08fQFYtoBkK/wU= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:24 +1100 Message-Id: <20170202051445.5735-87-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 086/107] ppc: Implement bcdutrunc. instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, Jose Ricardo Ziviani , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani bcdutrunc. Decimal unsigned truncate. Works like bcdtrunc. with unsigned BCD numbers. Signed-off-by: Jose Ricardo Ziviani Signed-off-by: David Gibson --- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 51 +++++++++++++++++++++++++++++++++= ++++ target/ppc/translate/vmx-impl.inc.c | 4 +++ target/ppc/translate/vmx-ops.inc.c | 2 +- 4 files changed, 57 insertions(+), 1 deletion(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index ddc6a9b..51a1a5f 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -397,6 +397,7 @@ DEF_HELPER_4(bcds, i32, avr, avr, avr, i32) DEF_HELPER_4(bcdus, i32, avr, avr, avr, i32) DEF_HELPER_4(bcdsr, i32, avr, avr, avr, i32) DEF_HELPER_4(bcdtrunc, i32, avr, avr, avr, i32) +DEF_HELPER_4(bcdutrunc, i32, avr, avr, avr, i32) =20 DEF_HELPER_2(xsadddp, void, env, i32) DEF_HELPER_2(xsaddqp, void, env, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 9f56cff..dd0a892 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -3228,6 +3228,57 @@ uint32_t helper_bcdtrunc(ppc_avr_t *r, ppc_avr_t *a,= ppc_avr_t *b, uint32_t ps) return bcd_cmp_zero(&ret) | ox_flag; } =20 +uint32_t helper_bcdutrunc(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, uint32= _t ps) +{ + int i; + uint64_t mask; + uint32_t ox_flag =3D 0; + int invalid =3D 0; + ppc_avr_t ret =3D *b; + + for (i =3D 0; i < 32; i++) { + bcd_get_digit(b, i, &invalid); + + if (unlikely(invalid)) { + return CRF_SO; + } + } + +#if defined(HOST_WORDS_BIGENDIAN) + i =3D a->s16[3]; +#else + i =3D a->s16[4]; +#endif + if (i > 16 && i < 33) { + mask =3D (uint64_t)-1 >> (128 - i * 4); + if (ret.u64[HI_IDX] & ~mask) { + ox_flag =3D CRF_SO; + } + + ret.u64[HI_IDX] &=3D mask; + } else if (i > 0 && i <=3D 16) { + mask =3D (uint64_t)-1 >> (64 - i * 4); + if (ret.u64[HI_IDX] || (ret.u64[LO_IDX] & ~mask)) { + ox_flag =3D CRF_SO; + } + + ret.u64[LO_IDX] &=3D mask; + ret.u64[HI_IDX] =3D 0; + } else if (i =3D=3D 0) { + if (ret.u64[HI_IDX] || ret.u64[LO_IDX]) { + ox_flag =3D CRF_SO; + } + ret.u64[HI_IDX] =3D ret.u64[LO_IDX] =3D 0; + } + + *r =3D ret; + if (r->u64[HI_IDX] =3D=3D 0 && r->u64[LO_IDX] =3D=3D 0) { + return ox_flag | CRF_EQ; + } + + return ox_flag | CRF_GT; +} + void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a) { int i; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index 1683f42..3cb6fc2 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -1020,6 +1020,7 @@ GEN_BCD(bcds); GEN_BCD(bcdus); GEN_BCD(bcdsr); GEN_BCD(bcdtrunc); +GEN_BCD(bcdutrunc); =20 static void gen_xpnd04_1(DisasContext *ctx) { @@ -1102,6 +1103,9 @@ GEN_VXFORM_DUAL(vsubsbs, PPC_ALTIVEC, PPC_NONE, \ bcdtrunc, PPC_NONE, PPC2_ISA300) GEN_VXFORM_DUAL(vsubuqm, PPC2_ALTIVEC_207, PPC_NONE, \ bcdtrunc, PPC_NONE, PPC2_ISA300) +GEN_VXFORM_DUAL(vsubcuq, PPC2_ALTIVEC_207, PPC_NONE, \ + bcdutrunc, PPC_NONE, PPC2_ISA300) + =20 static void gen_vsbox(DisasContext *ctx) { diff --git a/target/ppc/translate/vmx-ops.inc.c b/target/ppc/translate/vmx-= ops.inc.c index e6167a4..139f80c 100644 --- a/target/ppc/translate/vmx-ops.inc.c +++ b/target/ppc/translate/vmx-ops.inc.c @@ -149,8 +149,8 @@ GEN_VXFORM_DUAL(vsubsws, xpnd04_2, 0, 30, PPC_ALTIVEC, = PPC_NONE), GEN_VXFORM_207(vadduqm, 0, 4), GEN_VXFORM_207(vaddcuq, 0, 5), GEN_VXFORM_DUAL(vaddeuqm, vaddecuq, 30, 0xFF, PPC_NONE, PPC2_ALTIVEC_207), -GEN_VXFORM_207(vsubcuq, 0, 21), GEN_VXFORM_DUAL(vsubuqm, bcdtrunc, 0, 20, PPC2_ALTIVEC_207, PPC2_ISA300), +GEN_VXFORM_DUAL(vsubcuq, bcdutrunc, 0, 21, PPC2_ALTIVEC_207, PPC2_ISA300), GEN_VXFORM_DUAL(vsubeuqm, vsubecuq, 31, 0xFF, PPC_NONE, PPC2_ALTIVEC_207), GEN_VXFORM(vrlb, 2, 0), GEN_VXFORM(vrlh, 2, 1), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017960112903.7906558283036; Wed, 1 Feb 2017 22:46:00 -0800 (PST) Received: from localhost ([::1]:54726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZB9a-0004gP-71 for importer@patchew.org; Thu, 02 Feb 2017 01:45:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kB-0007pm-5F for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k4-0004AL-3b for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:38 -0500 Received: from ozlabs.org ([103.22.144.67]:48833) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k3-00046p-Eh; Thu, 02 Feb 2017 00:15:31 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqX2HT1z9sNG; Thu, 2 Feb 2017 16:15:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012504; bh=eBhIOugX/AvxD0ubytgiRNpKyyJ4ky26To2ildkn8B8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IEGDCqIZDLaK6B5uKtPRN3y+IvsYzmo/2MRk0NtgCTrBjdkuEMHdDjMSFYZcp05hQ 8a/kysEzhYMmCqm1C/8IDDFv8H1gn6QaFR6XbKhyMyEmtaIvNMKCqLdZpDUUlBmS8N 1cF3ndgUAAKguSYA7fUzJm2UHaDz8x2i2TSLdP20= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:25 +1100 Message-Id: <20170202051445.5735-88-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 087/107] target-ppc: Use ppc_vsr_t.f128 in xscmp[o, u, exp]qp X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xscmpoqp, xscmpuqp & xscmpexpqp were added before f128 field was introduced in ppc_vsr_t. Now that we have it, use it instead of generating the 128 bit float using two 64bit fields. Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index ae57272..d648234 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2452,8 +2452,8 @@ void helper_xscmpexpqp(CPUPPCState *env, uint32_t opc= ode) exp_a =3D extract64(xa.VsrD(0), 48, 15); exp_b =3D extract64(xb.VsrD(0), 48, 15); =20 - if (unlikely(float128_is_any_nan(make_float128(xa.VsrD(0), xa.VsrD(1))= ) || - float128_is_any_nan(make_float128(xb.VsrD(0), xb.VsrD(1))= ))) { + if (unlikely(float128_is_any_nan(xa.f128) || + float128_is_any_nan(xb.f128))) { cc =3D CRF_SO; } else { if (exp_a < exp_b) { @@ -2528,24 +2528,20 @@ void helper_##op(CPUPPCState *env, uint32_t opcode)= \ ppc_vsr_t xa, xb; \ uint32_t cc =3D 0; \ bool vxsnan_flag =3D false, vxvc_flag =3D false; = \ - float128 a, b; \ \ helper_reset_fpstatus(env); \ getVSR(rA(opcode) + 32, &xa, env); \ getVSR(rB(opcode) + 32, &xb, env); \ \ - a =3D make_float128(xa.VsrD(0), xa.VsrD(1)); \ - b =3D make_float128(xb.VsrD(0), xb.VsrD(1)); \ - \ - if (float128_is_signaling_nan(a, &env->fp_status) || \ - float128_is_signaling_nan(b, &env->fp_status)) { \ + if (float128_is_signaling_nan(xa.f128, &env->fp_status) || \ + float128_is_signaling_nan(xb.f128, &env->fp_status)) { \ vxsnan_flag =3D true; \ cc =3D CRF_SO; \ if (fpscr_ve =3D=3D 0 && ordered) { = \ vxvc_flag =3D true; \ } \ - } else if (float128_is_quiet_nan(a, &env->fp_status) || \ - float128_is_quiet_nan(b, &env->fp_status)) { \ + } else if (float128_is_quiet_nan(xa.f128, &env->fp_status) || \ + float128_is_quiet_nan(xb.f128, &env->fp_status)) { \ cc =3D CRF_SO; \ if (ordered) { \ vxvc_flag =3D true; \ @@ -2558,9 +2554,9 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ float_invalid_op_excp(env, POWERPC_EXCP_FP_VXVC, 0); \ } \ \ - if (float128_lt(a, b, &env->fp_status)) { \ + if (float128_lt(xa.f128, xb.f128, &env->fp_status)) { \ cc |=3D CRF_LT; \ - } else if (!float128_le(a, b, &env->fp_status)) { \ + } else if (!float128_le(xa.f128, xb.f128, &env->fp_status)) { \ cc |=3D CRF_GT; \ } else { \ cc |=3D CRF_EQ; \ --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486019062406293.044616012461; Wed, 1 Feb 2017 23:04:22 -0800 (PST) Received: from localhost ([::1]:54836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBRM-0006pr-8o for importer@patchew.org; Thu, 02 Feb 2017 02:04:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kJ-00080s-Ex for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kC-0004L3-EA for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:47 -0500 Received: from ozlabs.org ([103.22.144.67]:45879) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kB-0004Hh-Tw; Thu, 02 Feb 2017 00:15:40 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqb2YWNz9sNB; Thu, 2 Feb 2017 16:15:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012507; bh=MjNKjKdxfamxEBNsGC/TeazY3eyH9MvCITbpMs+GX7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C9fZ3plxLmKEoDB7lIvvtP8gTV+l9FjVtqrw04xwbDYXiUaXwurKivL8VW5S5I4ak 0zK6xZBFWdDJewer4ePkbSVgW+AXWUgekbt3yfoyhPyE5pbfRXQkafof3Vr6EFxxaf QQecXsBLzRTbhS/UcuF22H8yHGyJXd0sSXDxlDUc= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:26 +1100 Message-Id: <20170202051445.5735-89-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 088/107] target-ppc: Add xscvsdqp and xscvudqp instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xscvsdqp: VSX Scalar Convert Signed Doubleword format to Quad-Precision format xscvudqp: VSX Scalar Convert Unsigned Doubleword format to Quad-Precision format Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 25 +++++++++++++++++++++++++ target/ppc/helper.h | 2 ++ target/ppc/translate/vsx-impl.inc.c | 2 ++ target/ppc/translate/vsx-ops.inc.c | 2 ++ 4 files changed, 31 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index d648234..b9689b7 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2960,6 +2960,31 @@ VSX_CVT_INT_TO_FP(xvcvuxdsp, 2, uint64, float32, Vsr= D(i), VsrW(2*i), 0, 0) VSX_CVT_INT_TO_FP(xvcvsxwsp, 4, int32, float32, VsrW(i), VsrW(i), 0, 0) VSX_CVT_INT_TO_FP(xvcvuxwsp, 4, uint32, float32, VsrW(i), VsrW(i), 0, 0) =20 +/* VSX_CVT_INT_TO_FP_VECTOR - VSX integer to floating point conversion + * op - instruction mnemonic + * stp - source type (int32, uint32, int64 or uint64) + * ttp - target type (float32 or float64) + * sfld - source vsr_t field + * tfld - target vsr_t field + */ +#define VSX_CVT_INT_TO_FP_VECTOR(op, stp, ttp, sfld, tfld) \ +void helper_##op(CPUPPCState *env, uint32_t opcode) \ +{ \ + ppc_vsr_t xt, xb; \ + \ + getVSR(rB(opcode) + 32, &xb, env); \ + getVSR(rD(opcode) + 32, &xt, env); \ + \ + xt.tfld =3D stp##_to_##ttp(xb.sfld, &env->fp_status); \ + helper_compute_fprf_##ttp(env, xt.tfld); \ + \ + putVSR(xT(opcode) + 32, &xt, env); \ + float_check_status(env); \ +} + +VSX_CVT_INT_TO_FP_VECTOR(xscvsdqp, int64, float128, VsrD(0), f128) +VSX_CVT_INT_TO_FP_VECTOR(xscvudqp, uint64, float128, VsrD(0), f128) + /* For "use current rounding mode", define a value that will not be one of * the existing rounding model enums. */ diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 51a1a5f..13142e0 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -437,6 +437,7 @@ DEF_HELPER_2(xscvqpdp, void, env, i32) DEF_HELPER_2(xscvqpsdz, void, env, i32) DEF_HELPER_2(xscvqpswz, void, env, i32) DEF_HELPER_2(xscvhpdp, void, env, i32) +DEF_HELPER_2(xscvsdqp, void, env, i32) DEF_HELPER_2(xscvspdp, void, env, i32) DEF_HELPER_2(xscvspdpn, i64, env, i64) DEF_HELPER_2(xscvdpsxds, void, env, i32) @@ -446,6 +447,7 @@ DEF_HELPER_2(xscvdpuxws, void, env, i32) DEF_HELPER_2(xscvsxddp, void, env, i32) DEF_HELPER_2(xscvuxdsp, void, env, i32) DEF_HELPER_2(xscvsxdsp, void, env, i32) +DEF_HELPER_2(xscvudqp, void, env, i32) DEF_HELPER_2(xscvuxddp, void, env, i32) DEF_HELPER_2(xsrdpi, void, env, i32) DEF_HELPER_2(xsrdpic, void, env, i32) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 3c924ba..37004a4 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -814,6 +814,7 @@ GEN_VSX_HELPER_2(xscvqpdp, 0x04, 0x1A, 0x14, PPC2_ISA30= 0) GEN_VSX_HELPER_2(xscvqpsdz, 0x04, 0x1A, 0x19, PPC2_ISA300) GEN_VSX_HELPER_2(xscvqpswz, 0x04, 0x1A, 0x09, PPC2_ISA300) GEN_VSX_HELPER_2(xscvhpdp, 0x16, 0x15, 0x10, PPC2_ISA300) +GEN_VSX_HELPER_2(xscvsdqp, 0x04, 0x1A, 0x0A, PPC2_ISA300) GEN_VSX_HELPER_2(xscvspdp, 0x12, 0x14, 0, PPC2_VSX) GEN_VSX_HELPER_XT_XB_ENV(xscvspdpn, 0x16, 0x14, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xscvdpsxds, 0x10, 0x15, 0, PPC2_VSX) @@ -821,6 +822,7 @@ GEN_VSX_HELPER_2(xscvdpsxws, 0x10, 0x05, 0, PPC2_VSX) GEN_VSX_HELPER_2(xscvdpuxds, 0x10, 0x14, 0, PPC2_VSX) GEN_VSX_HELPER_2(xscvdpuxws, 0x10, 0x04, 0, PPC2_VSX) GEN_VSX_HELPER_2(xscvsxddp, 0x10, 0x17, 0, PPC2_VSX) +GEN_VSX_HELPER_2(xscvudqp, 0x04, 0x1A, 0x02, PPC2_ISA300) GEN_VSX_HELPER_2(xscvuxddp, 0x10, 0x16, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsrdpi, 0x12, 0x04, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsrdpic, 0x16, 0x06, 0, PPC2_VSX) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 297c317..6b6b828 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -176,6 +176,7 @@ GEN_XX2FORM_EO(xscvdphp, 0x16, 0x15, 0x11, PPC2_ISA300), GEN_XX2FORM(xscvdpsp, 0x12, 0x10, PPC2_VSX), GEN_XX2FORM(xscvdpspn, 0x16, 0x10, PPC2_VSX207), GEN_XX2FORM_EO(xscvhpdp, 0x16, 0x15, 0x10, PPC2_ISA300), +GEN_VSX_XFORM_300_EO(xscvsdqp, 0x04, 0x1A, 0x0A, 0x00000001), GEN_XX2FORM(xscvspdp, 0x12, 0x14, PPC2_VSX), GEN_XX2FORM(xscvspdpn, 0x16, 0x14, PPC2_VSX207), GEN_XX2FORM(xscvdpsxds, 0x10, 0x15, PPC2_VSX), @@ -183,6 +184,7 @@ GEN_XX2FORM(xscvdpsxws, 0x10, 0x05, PPC2_VSX), GEN_XX2FORM(xscvdpuxds, 0x10, 0x14, PPC2_VSX), GEN_XX2FORM(xscvdpuxws, 0x10, 0x04, PPC2_VSX), GEN_XX2FORM(xscvsxddp, 0x10, 0x17, PPC2_VSX), +GEN_VSX_XFORM_300_EO(xscvudqp, 0x04, 0x1A, 0x02, 0x00000001), GEN_XX2FORM(xscvuxddp, 0x10, 0x16, PPC2_VSX), GEN_XX2FORM(xsrdpi, 0x12, 0x04, PPC2_VSX), GEN_XX2FORM(xsrdpic, 0x16, 0x06, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017812626803.753035220825; Wed, 1 Feb 2017 22:43:32 -0800 (PST) Received: from localhost ([::1]:54708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZB7C-0002Xs-Md for importer@patchew.org; Thu, 02 Feb 2017 01:43:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kH-0007xg-6M for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k9-0004Gl-4V for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:45 -0500 Received: from ozlabs.org ([103.22.144.67]:58123) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k8-0004DH-IX; Thu, 02 Feb 2017 00:15:36 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqZ4QhKz9sN4; Thu, 2 Feb 2017 16:15:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012506; bh=1JkYWzHKi5KoF/GwaxdMynkSv/bC4znMpMDMdBsc4CA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fDMlaQSg7XV2KEJ7DcRwMST8ot92Fje0lL5FcycWwtViCv+rBUbxRdrx4tntFu1hT Ci+M78hGbiVtsa+ONCnBNoepxIP0lx3JGJ58/fL+gIU4uC0FNb48PBnNWwQDdeK2Kh SbrG4mfUfNTjDXC0+3twuRDvtwzYlxqkaRGHcWc4= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:27 +1100 Message-Id: <20170202051445.5735-90-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 089/107] target-ppc: Add xsdivqp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xsdivqp: VSX Scalar Divide Quad-Precision Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 36 +++++++++++++++++++++++++++++++++= +++ target/ppc/helper.h | 1 + target/ppc/translate/vsx-impl.inc.c | 1 + target/ppc/translate/vsx-ops.inc.c | 1 + 4 files changed, 39 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index b9689b7..545bbbc 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -1981,6 +1981,42 @@ VSX_DIV(xsdivsp, 1, float64, VsrD(0), 1, 1) VSX_DIV(xvdivdp, 2, float64, VsrD(i), 0, 0) VSX_DIV(xvdivsp, 4, float32, VsrW(i), 0, 0) =20 +void helper_xsdivqp(CPUPPCState *env, uint32_t opcode) +{ + ppc_vsr_t xt, xa, xb; + + getVSR(rA(opcode) + 32, &xa, env); + getVSR(rB(opcode) + 32, &xb, env); + getVSR(rD(opcode) + 32, &xt, env); + + if (unlikely(Rc(opcode) !=3D 0)) { + /* TODO: Support xsdivqpo after round-to-odd is implemented */ + abort(); + } + + helper_reset_fpstatus(env); + float_status tstat =3D env->fp_status; + set_float_exception_flags(0, &tstat); + xt.f128 =3D float128_div(xa.f128, xb.f128, &tstat); + env->fp_status.float_exception_flags |=3D tstat.float_exception_flags; + + if (unlikely(tstat.float_exception_flags & float_flag_invalid)) { + if (float128_is_infinity(xa.f128) && float128_is_infinity(xb.f128)= ) { + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXIDI, 1); + } else if (float128_is_zero(xa.f128) && + float128_is_zero(xb.f128)) { + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXZDZ, 1); + } else if (float128_is_signaling_nan(xa.f128, &tstat) || + float128_is_signaling_nan(xb.f128, &tstat)) { + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 1); + } + } + + helper_compute_fprf_float128(env, xt.f128); + putVSR(rD(opcode) + 32, &xt, env); + float_check_status(env); +} + /* VSX_RE - VSX floating point reciprocal estimate * op - instruction mnemonic * nels - number of elements (1, 2 or 4) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 13142e0..71bf182 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -404,6 +404,7 @@ DEF_HELPER_2(xsaddqp, void, env, i32) DEF_HELPER_2(xssubdp, void, env, i32) DEF_HELPER_2(xsmuldp, void, env, i32) DEF_HELPER_2(xsdivdp, void, env, i32) +DEF_HELPER_2(xsdivqp, void, env, i32) DEF_HELPER_2(xsredp, void, env, i32) DEF_HELPER_2(xssqrtdp, void, env, i32) DEF_HELPER_2(xsrsqrtedp, void, env, i32) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 37004a4..38fab01 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -781,6 +781,7 @@ GEN_VSX_HELPER_2(xsaddqp, 0x04, 0x00, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xssubdp, 0x00, 0x05, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsmuldp, 0x00, 0x06, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsdivdp, 0x00, 0x07, 0, PPC2_VSX) +GEN_VSX_HELPER_2(xsdivqp, 0x04, 0x11, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xsredp, 0x14, 0x05, 0, PPC2_VSX) GEN_VSX_HELPER_2(xssqrtdp, 0x16, 0x04, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsrsqrtedp, 0x14, 0x04, 0, PPC2_VSX) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 6b6b828..c1164c3 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -196,6 +196,7 @@ GEN_XX3FORM(xsaddsp, 0x00, 0x00, PPC2_VSX207), GEN_XX3FORM(xssubsp, 0x00, 0x01, PPC2_VSX207), GEN_XX3FORM(xsmulsp, 0x00, 0x02, PPC2_VSX207), GEN_XX3FORM(xsdivsp, 0x00, 0x03, PPC2_VSX207), +GEN_VSX_XFORM_300(xsdivqp, 0x04, 0x11, 0x0), GEN_XX2FORM(xsresp, 0x14, 0x01, PPC2_VSX207), GEN_XX2FORM(xsrsp, 0x12, 0x11, PPC2_VSX207), GEN_XX2FORM(xssqrtsp, 0x16, 0x00, PPC2_VSX207), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486018711588506.4076765893685; Wed, 1 Feb 2017 22:58:31 -0800 (PST) Received: from localhost ([::1]:54801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBLh-0000za-BF for importer@patchew.org; Thu, 02 Feb 2017 01:58:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kA-0007oA-16 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k3-00049q-UZ for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:38 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:48997) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k3-00045z-6e; Thu, 02 Feb 2017 00:15:31 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqX1QzXz9s7L; Thu, 2 Feb 2017 16:15:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012504; bh=6chncOL+es9PuxstiyLb8LyViy1rpMpxwKc5kZkj064=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hp1R9MZ9FPJDyNILwn/tPClYCFTr7m/vSUUuuEm63bXlkRVie5I5KIYXp/A1ZDNr4 U634isgg4QAy1J9Q+vmao0Gewj0ev3E+iRZXJ8Kgi+S5md071iYs2M9iHw831OBpDB +ZdDfMewjhJICJSkcOCzjSQv8RLVd/2qNsn0Kqac= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:28 +1100 Message-Id: <20170202051445.5735-91-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 090/107] target-ppc: Add xsmulqp instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bharata B Rao xsmulqp: VSX Scalar Multiply Quad-Precision Signed-off-by: Bharata B Rao Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 35 +++++++++++++++++++++++++++++++++= ++ target/ppc/helper.h | 1 + target/ppc/translate/vsx-impl.inc.c | 1 + target/ppc/translate/vsx-ops.inc.c | 1 + 4 files changed, 38 insertions(+) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 545bbbc..e7e1024 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -1927,6 +1927,41 @@ VSX_MUL(xsmulsp, 1, float64, VsrD(0), 1, 1) VSX_MUL(xvmuldp, 2, float64, VsrD(i), 0, 0) VSX_MUL(xvmulsp, 4, float32, VsrW(i), 0, 0) =20 +void helper_xsmulqp(CPUPPCState *env, uint32_t opcode) +{ + ppc_vsr_t xt, xa, xb; + + getVSR(rA(opcode) + 32, &xa, env); + getVSR(rB(opcode) + 32, &xb, env); + getVSR(rD(opcode) + 32, &xt, env); + + if (unlikely(Rc(opcode) !=3D 0)) { + /* TODO: Support xsmulpo after round-to-odd is implemented */ + abort(); + } + + helper_reset_fpstatus(env); + + float_status tstat =3D env->fp_status; + set_float_exception_flags(0, &tstat); + xt.f128 =3D float128_mul(xa.f128, xb.f128, &tstat); + env->fp_status.float_exception_flags |=3D tstat.float_exception_flags; + + if (unlikely(tstat.float_exception_flags & float_flag_invalid)) { + if ((float128_is_infinity(xa.f128) && float128_is_zero(xb.f128)) || + (float128_is_infinity(xb.f128) && float128_is_zero(xa.f128))) { + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXIMZ, 1); + } else if (float128_is_signaling_nan(xa.f128, &tstat) || + float128_is_signaling_nan(xb.f128, &tstat)) { + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 1); + } + } + helper_compute_fprf_float128(env, xt.f128); + + putVSR(rD(opcode) + 32, &xt, env); + float_check_status(env); +} + /* VSX_DIV - VSX floating point divide * op - instruction mnemonic * nels - number of elements (1, 2 or 4) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 71bf182..9f8f0ed 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -403,6 +403,7 @@ DEF_HELPER_2(xsadddp, void, env, i32) DEF_HELPER_2(xsaddqp, void, env, i32) DEF_HELPER_2(xssubdp, void, env, i32) DEF_HELPER_2(xsmuldp, void, env, i32) +DEF_HELPER_2(xsmulqp, void, env, i32) DEF_HELPER_2(xsdivdp, void, env, i32) DEF_HELPER_2(xsdivqp, void, env, i32) DEF_HELPER_2(xsredp, void, env, i32) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 38fab01..d75474e 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -780,6 +780,7 @@ GEN_VSX_HELPER_2(xsadddp, 0x00, 0x04, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsaddqp, 0x04, 0x00, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xssubdp, 0x00, 0x05, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsmuldp, 0x00, 0x06, 0, PPC2_VSX) +GEN_VSX_HELPER_2(xsmulqp, 0x04, 0x01, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xsdivdp, 0x00, 0x07, 0, PPC2_VSX) GEN_VSX_HELPER_2(xsdivqp, 0x04, 0x11, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xsredp, 0x14, 0x05, 0, PPC2_VSX) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index c1164c3..589b505 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -146,6 +146,7 @@ GEN_XX3FORM(xsadddp, 0x00, 0x04, PPC2_VSX), GEN_VSX_XFORM_300(xsaddqp, 0x04, 0x00, 0x0), GEN_XX3FORM(xssubdp, 0x00, 0x05, PPC2_VSX), GEN_XX3FORM(xsmuldp, 0x00, 0x06, PPC2_VSX), +GEN_VSX_XFORM_300(xsmulqp, 0x04, 0x01, 0x0), GEN_XX3FORM(xsdivdp, 0x00, 0x07, PPC2_VSX), GEN_XX2FORM(xsredp, 0x14, 0x05, PPC2_VSX), GEN_XX2FORM(xssqrtdp, 0x16, 0x04, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486019341311312.9775839699946; Wed, 1 Feb 2017 23:09:01 -0800 (PST) Received: from localhost ([::1]:54863 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBVq-0003Ck-Tn for importer@patchew.org; Thu, 02 Feb 2017 02:08:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kJ-00080w-Gi for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kC-0004KM-4o for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:47 -0500 Received: from ozlabs.org ([103.22.144.67]:48987) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kB-0004H9-Cx; Thu, 02 Feb 2017 00:15:39 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqb0L2hz9sDb; Thu, 2 Feb 2017 16:15:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012507; bh=sbqIWqL2s5axLCjk7Pztj6CB6YXLvM8b2DJT+/ddwv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vs8XnQjDvPiT7hNlnZM2j4PUyiMOvwk9Pf9882p6BKwZizHCHBRf8pwhzdAzU53a5 ry4fEWfQtCHYVoxvRsHmOfkK+WozX/VxcjWq/kO6fj3n+VSDVnceYjrCuzo92N9mHR Gw3tt2kf5gV11/MInfEFv8q3GgpBajbyuhK4sznM= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:29 +1100 Message-Id: <20170202051445.5735-92-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 091/107] target-ppc: Add xvcv[hpsp, sphp] instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xvcvhpsp: VSX Vector Convert Half Precision to Single Precision xvcvsphp: VSX Vector Convert Single Precision to Half Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 27 ++++++++++++++++++--------- target/ppc/helper.h | 2 ++ target/ppc/translate/vsx-impl.inc.c | 2 ++ target/ppc/translate/vsx-ops.inc.c | 2 ++ 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index e7e1024..ffcf9ca 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -2817,33 +2817,42 @@ VSX_CVT_FP_TO_FP_VECTOR(xscvdpqp, 1, float64, float= 128, VsrD(0), f128, 1) /* VSX_CVT_FP_TO_FP_HP - VSX floating point/floating point conversion * involving one half precision value * op - instruction mnemonic + * nels - number of elements (1, 2 or 4) * stp - source type * ttp - target type * sfld - source vsr_t field * tfld - target vsr_t field + * sfprf - set FPRF */ -#define VSX_CVT_FP_TO_FP_HP(op, stp, ttp, sfld, tfld) \ +#define VSX_CVT_FP_TO_FP_HP(op, nels, stp, ttp, sfld, tfld, sfprf) \ void helper_##op(CPUPPCState *env, uint32_t opcode) \ { \ ppc_vsr_t xt, xb; \ + int i; \ \ getVSR(xB(opcode), &xb, env); \ memset(&xt, 0, sizeof(xt)); \ \ - xt.tfld =3D stp##_to_##ttp(xb.sfld, 1, &env->fp_status); \ - if (unlikely(stp##_is_signaling_nan(xb.sfld, \ - &env->fp_status))) { \ - float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); \ - xt.tfld =3D ttp##_snan_to_qnan(xt.tfld); \ + for (i =3D 0; i < nels; i++) { \ + xt.tfld =3D stp##_to_##ttp(xb.sfld, 1, &env->fp_status); \ + if (unlikely(stp##_is_signaling_nan(xb.sfld, \ + &env->fp_status))) { \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); \ + xt.tfld =3D ttp##_snan_to_qnan(xt.tfld); \ + } \ + if (sfprf) { \ + helper_compute_fprf_##ttp(env, xt.tfld); \ + } \ } \ - helper_compute_fprf_##ttp(env, xt.tfld); \ \ putVSR(xT(opcode), &xt, env); \ float_check_status(env); \ } =20 -VSX_CVT_FP_TO_FP_HP(xscvdphp, float64, float16, VsrD(0), VsrH(3)) -VSX_CVT_FP_TO_FP_HP(xscvhpdp, float16, float64, VsrH(3), VsrD(0)) +VSX_CVT_FP_TO_FP_HP(xscvdphp, 1, float64, float16, VsrD(0), VsrH(3), 1) +VSX_CVT_FP_TO_FP_HP(xscvhpdp, 1, float16, float64, VsrH(3), VsrD(0), 1) +VSX_CVT_FP_TO_FP_HP(xvcvsphp, 4, float32, float16, VsrW(i), VsrH(2 * i + = 1), 0) +VSX_CVT_FP_TO_FP_HP(xvcvhpsp, 4, float16, float32, VsrH(2 * i + 1), VsrW(i= ), 0) =20 /* * xscvqpdp isn't using VSX_CVT_FP_TO_FP() because xscvqpdpo will be diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 9f8f0ed..9d4ed08 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -536,6 +536,8 @@ DEF_HELPER_2(xvcmpgesp, void, env, i32) DEF_HELPER_2(xvcmpgtsp, void, env, i32) DEF_HELPER_2(xvcmpnesp, void, env, i32) DEF_HELPER_2(xvcvspdp, void, env, i32) +DEF_HELPER_2(xvcvsphp, void, env, i32) +DEF_HELPER_2(xvcvhpsp, void, env, i32) DEF_HELPER_2(xvcvspsxds, void, env, i32) DEF_HELPER_2(xvcvspsxws, void, env, i32) DEF_HELPER_2(xvcvspuxds, void, env, i32) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index d75474e..9bcc5af 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -913,6 +913,8 @@ GEN_VSX_HELPER_2(xvcmpgtsp, 0x0C, 0x09, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvcmpgesp, 0x0C, 0x0A, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvcmpnesp, 0x0C, 0x0B, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvcvspdp, 0x12, 0x1C, 0, PPC2_VSX) +GEN_VSX_HELPER_2(xvcvhpsp, 0x16, 0x1D, 0x18, PPC2_ISA300) +GEN_VSX_HELPER_2(xvcvsphp, 0x16, 0x1D, 0x19, PPC2_ISA300) GEN_VSX_HELPER_2(xvcvspsxds, 0x10, 0x19, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvcvspsxws, 0x10, 0x09, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvcvspuxds, 0x10, 0x18, 0, PPC2_VSX) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 589b505..ee74312 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -291,6 +291,8 @@ GEN_XX2FORM(xvrspiz, 0x12, 0x09, PPC2_VSX), GEN_XX2FORM_EO(xxbrh, 0x16, 0x1D, 0x07, PPC2_ISA300), GEN_XX2FORM_EO(xxbrw, 0x16, 0x1D, 0x0F, PPC2_ISA300), GEN_XX2FORM_EO(xxbrd, 0x16, 0x1D, 0x17, PPC2_ISA300), +GEN_XX2FORM_EO(xvcvhpsp, 0x16, 0x1D, 0x18, PPC2_ISA300), +GEN_XX2FORM_EO(xvcvsphp, 0x16, 0x1D, 0x19, PPC2_ISA300), GEN_XX2FORM_EO(xxbrq, 0x16, 0x1D, 0x1F, PPC2_ISA300), =20 #define VSX_LOGICAL(name, opc2, opc3, fl2) \ --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017534192678.9626546562585; Wed, 1 Feb 2017 22:38:54 -0800 (PST) Received: from localhost ([::1]:54680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZB2i-0005Pw-Bx for importer@patchew.org; Thu, 02 Feb 2017 01:38:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kG-0007wr-JE for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kA-0004Hv-7t for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:44 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:52387) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k9-0004E5-HY; Thu, 02 Feb 2017 00:15:38 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqZ5Xkwz9sN9; Thu, 2 Feb 2017 16:15:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012506; bh=+Tu4I9uUcaxwFQp9qE2XSEH0iVnXzozOpwIjRyocWi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nxwn2Dyx632J/yOmCaspKsVTPngzSLW8xUCHdzwyQ6Mj+X4Hb/Djp4QD0gaDHUp5m 1fjvO3xp/uiOPNGez/UUhee2cEjn6cn6D8nlZJ73H6n8F/gLfYf7qrpigSQV+CPoWu dvKwE0DlurtV2/b4CNYJ0w6c9ctVRAmTeFsJVK3s= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:30 +1100 Message-Id: <20170202051445.5735-93-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 092/107] powerpc/cpu-models: rename ISAv3.00 logical PVR definition X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Suraj Jitindar Singh , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Suraj Jitindar Singh This logical PVR value now corresponds to ISA version 3.00 so rename it accordingly. Signed-off-by: Suraj Jitindar Singh Signed-off-by: David Gibson --- target/ppc/cpu-models.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h index aafbbd7..d587e69 100644 --- a/target/ppc/cpu-models.h +++ b/target/ppc/cpu-models.h @@ -601,7 +601,7 @@ enum { CPU_POWERPC_LOGICAL_2_06 =3D 0x0F000003, CPU_POWERPC_LOGICAL_2_06_PLUS =3D 0x0F100003, CPU_POWERPC_LOGICAL_2_07 =3D 0x0F000004, - CPU_POWERPC_LOGICAL_2_08 =3D 0x0F000005, + CPU_POWERPC_LOGICAL_3_00 =3D 0x0F000005, }; =20 /* System version register (used on MPC 8xxx) = */ --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14860198334541016.4495962812209; Wed, 1 Feb 2017 23:17:13 -0800 (PST) Received: from localhost ([::1]:54918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBdn-0002JM-6y for importer@patchew.org; Thu, 02 Feb 2017 02:17:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kF-0007vy-TY for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k9-0004Gd-5b for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:43 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:43249) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k8-0004CH-I0; Thu, 02 Feb 2017 00:15:36 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqZ1MhKz9s7Y; Thu, 2 Feb 2017 16:15:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012506; bh=hQtqzISLrpxvMjkEcNMLuCdHpY4RLQ+r6imOHiRS+lE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UoNR+KsX94jd/C0bSUw1WhRZBQyKmLMKLPKWQbf+fFIMfwVJnJEwWJuz3Z6LUN9MM oBJ2pkdoi8dmQrLkOudQeIIL7ICPYAzNQqA1VLesQlaRX+/15IHFfnlbNof6WVv01m 6sxKN5b1r1hw73QaxF2FmACAM6kmvSAhp0kttDMA= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:31 +1100 Message-Id: <20170202051445.5735-94-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 093/107] target/ppc: Add pcr_supported to POWER9 cpu class definition X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Suraj Jitindar Singh , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Suraj Jitindar Singh pcr_supported is used to define the supported PCR values for a given processor. A POWER9 processor can support 3.00, 2.07, 2.06 and 2.05 compatibility modes, thus we set this accordingly. Signed-off-by: Suraj Jitindar Singh Signed-off-by: David Gibson --- target/ppc/cpu.h | 1 + target/ppc/translate_init.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 4d72d75..bc2a2ce 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -2290,6 +2290,7 @@ enum { PCR_COMPAT_2_05 =3D 1ull << (63-62), PCR_COMPAT_2_06 =3D 1ull << (63-61), PCR_COMPAT_2_07 =3D 1ull << (63-60), + PCR_COMPAT_3_00 =3D 1ull << (63-59), PCR_VEC_DIS =3D 1ull << (63-0), /* Vec. disable (bit NA since = POWER8) */ PCR_VSX_DIS =3D 1ull << (63-1), /* VSX disable (bit NA since P= OWER8) */ PCR_TM_DIS =3D 1ull << (63-2), /* Trans. memory disable (POWE= R8) */ diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 388a3e8..c7f7624 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -8797,6 +8797,8 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) dc->props =3D powerpc_servercpu_properties; pcc->pvr_match =3D ppc_pvr_match_power9; pcc->pcr_mask =3D PCR_COMPAT_2_05 | PCR_COMPAT_2_06 | PCR_COMPAT_2_07; + pcc->pcr_supported =3D PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | PCR_COMPAT_= 2_06 | + PCR_COMPAT_2_05; pcc->init_proc =3D init_proc_POWER9; pcc->check_pow =3D check_pow_nocheck; pcc->insns_flags =3D PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB= | --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486016985111816.8907170968793; Wed, 1 Feb 2017 22:29:45 -0800 (PST) Received: from localhost ([::1]:54625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZAtq-0005GA-Ps for importer@patchew.org; Thu, 02 Feb 2017 01:29:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kC-0007s4-MA for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k6-0004Cb-1c for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:40 -0500 Received: from ozlabs.org ([103.22.144.67]:51729) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k5-00049M-E3; Thu, 02 Feb 2017 00:15:33 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqY237kz9s7R; Thu, 2 Feb 2017 16:15:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012505; bh=/3F6AetJtGzwpJWLp4STgXmInhbt4IkOFQoKZAb+9f0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BVVs3UyH8J7YY9BOCE8XwXd/nHuJ0RLKU1s6tqxTf33/Q5ilhvbieKgtGhQnbU73J 5mqi6Hk5LPy49G8SP4+iBoy5tOc1No4DWtI7FILqxKDYFtfd4yu5TPBnOtfOtAa+K0 aXwyw5zxCNxhvC9YaWzxURCNCd17Ioy9yVGpZSPc= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:32 +1100 Message-Id: <20170202051445.5735-95-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 094/107] ppc: Remove unused function cpu_ppc601_rtc_init() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth It is completely unused, thus it can be removed without problems. Signed-off-by: Thomas Huth Signed-off-by: David Gibson --- hw/ppc/ppc.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 8945869..f9a4b51 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -950,13 +950,6 @@ clk_setup_cb cpu_ppc_tb_init (CPUPPCState *env, uint32= _t freq) } =20 /* Specific helpers for POWER & PowerPC 601 RTC */ -#if 0 -static clk_setup_cb cpu_ppc601_rtc_init (CPUPPCState *env) -{ - return cpu_ppc_tb_init(env, 7812500); -} -#endif - void cpu_ppc601_store_rtcu (CPUPPCState *env, uint32_t value) { _cpu_ppc_store_tbu(env, value); --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14860197710431016.9722876514754; Wed, 1 Feb 2017 23:16:11 -0800 (PST) Received: from localhost ([::1]:54913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBcm-0001Gy-Oc for importer@patchew.org; Thu, 02 Feb 2017 02:16:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kO-00086a-EV for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kF-0004PD-MI for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:52 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:56341) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kE-0004LI-VJ; Thu, 02 Feb 2017 00:15:43 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqb4RDwz9sN7; Thu, 2 Feb 2017 16:15:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012507; bh=xEp4KJmw53GNHX/zwPZnxlqE7RoRoejrrrh0JvklfMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YfCzjk84u6MuY7FjIElF0zvYGAhB10HuvaudbY5gjPOdFxecjGjC+LSIJ5gbWqRyf M+puodBK3XS07xcpANXteq3m5yHfl1xvu6MnwkEosr4BgR/1lf2uduTUFtPcLUMB10 xUkl8zqek3IWXHki9Q8pCvuIDwnILZeiLyeQ5Du0= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:33 +1100 Message-Id: <20170202051445.5735-96-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 095/107] spapr: clock should count only if vm is running X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier This is a port to ppc of the i386 commit: 00f4d64 kvmclock: clock should count only if vm is running We remove timebase_post_load function, and use the VM state change handler to save and restore the guest_timebase (on stop and continue). We keep timebase_pre_save to reduce the clock difference on migration like in: 6053a86 kvmclock: reduce kvmclock difference on migration Time base offset has originally been introduced by commit 98a8b52 spapr: Add support for time base offset migration So while VM is paused, the time is stopped. This allows to have the same result with date (based on Time Base Register) and hwclock (based on "get-time-of-day" RTAS call). Moreover in TCG mode, the Time Base is always paused, so this patch also adjust the behavior between TCG and KVM. VM state field "time_of_the_day_ns" is now useless but we keep it to be able to migrate to older version of the machine. As vmstate_ppc_timebase structure (with timebase_pre_save() and timebase_post_load() functions) was only used by vmstate_spapr, we register the VM state change handler only in ppc_spapr_init(). Signed-off-by: Laurent Vivier Signed-off-by: David Gibson --- hw/ppc/ppc.c | 66 ++++++++++++++++++++++++++++++++++--------------= ---- hw/ppc/spapr.c | 6 +++++ target/ppc/cpu-qom.h | 3 +++ 3 files changed, 52 insertions(+), 23 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index f9a4b51..d171e60 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -847,9 +847,8 @@ static void cpu_ppc_set_tb_clk (void *opaque, uint32_t = freq) cpu_ppc_store_purr(cpu, 0x0000000000000000ULL); } =20 -static void timebase_pre_save(void *opaque) +static void timebase_save(PPCTimebase *tb) { - PPCTimebase *tb =3D opaque; uint64_t ticks =3D cpu_get_host_ticks(); PowerPCCPU *first_ppc_cpu =3D POWERPC_CPU(first_cpu); =20 @@ -858,43 +857,30 @@ static void timebase_pre_save(void *opaque) return; } =20 + /* not used anymore, we keep it for compatibility */ tb->time_of_the_day_ns =3D qemu_clock_get_ns(QEMU_CLOCK_HOST); /* - * tb_offset is only expected to be changed by migration so + * tb_offset is only expected to be changed by QEMU so * there is no need to update it from KVM here */ tb->guest_timebase =3D ticks + first_ppc_cpu->env.tb_env->tb_offset; } =20 -static int timebase_post_load(void *opaque, int version_id) +static void timebase_load(PPCTimebase *tb) { - PPCTimebase *tb_remote =3D opaque; CPUState *cpu; PowerPCCPU *first_ppc_cpu =3D POWERPC_CPU(first_cpu); - int64_t tb_off_adj, tb_off, ns_diff; - int64_t migration_duration_ns, migration_duration_tb, guest_tb, host_n= s; + int64_t tb_off_adj, tb_off; unsigned long freq; =20 if (!first_ppc_cpu->env.tb_env) { error_report("No timebase object"); - return -1; + return; } =20 freq =3D first_ppc_cpu->env.tb_env->tb_freq; - /* - * Calculate timebase on the destination side of migration. - * The destination timebase must be not less than the source timebase. - * We try to adjust timebase by downtime if host clocks are not - * too much out of sync (1 second for now). - */ - host_ns =3D qemu_clock_get_ns(QEMU_CLOCK_HOST); - ns_diff =3D MAX(0, host_ns - tb_remote->time_of_the_day_ns); - migration_duration_ns =3D MIN(NANOSECONDS_PER_SECOND, ns_diff); - migration_duration_tb =3D muldiv64(freq, migration_duration_ns, - NANOSECONDS_PER_SECOND); - guest_tb =3D tb_remote->guest_timebase + MIN(0, migration_duration_tb); =20 - tb_off_adj =3D guest_tb - cpu_get_host_ticks(); + tb_off_adj =3D tb->guest_timebase - cpu_get_host_ticks(); =20 tb_off =3D first_ppc_cpu->env.tb_env->tb_offset; trace_ppc_tb_adjust(tb_off, tb_off_adj, tb_off_adj - tb_off, @@ -904,9 +890,44 @@ static int timebase_post_load(void *opaque, int versio= n_id) CPU_FOREACH(cpu) { PowerPCCPU *pcpu =3D POWERPC_CPU(cpu); pcpu->env.tb_env->tb_offset =3D tb_off_adj; +#if defined(CONFIG_KVM) + kvm_set_one_reg(cpu, KVM_REG_PPC_TB_OFFSET, + &pcpu->env.tb_env->tb_offset); +#endif } +} =20 - return 0; +void cpu_ppc_clock_vm_state_change(void *opaque, int running, + RunState state) +{ + PPCTimebase *tb =3D opaque; + + if (running) { + timebase_load(tb); + } else { + timebase_save(tb); + } +} + +/* + * When migrating, read the clock just before migration, + * so that the guest clock counts during the events + * between: + * + * * vm_stop() + * * + * * pre_save() + * + * This reduces clock difference on migration from 5s + * to 0.1s (when max_downtime =3D=3D 5s), because sending the + * final pages of memory (which happens between vm_stop() + * and pre_save()) takes max_downtime. + */ +static void timebase_pre_save(void *opaque) +{ + PPCTimebase *tb =3D opaque; + + timebase_save(tb); } =20 const VMStateDescription vmstate_ppc_timebase =3D { @@ -915,7 +936,6 @@ const VMStateDescription vmstate_ppc_timebase =3D { .minimum_version_id =3D 1, .minimum_version_id_old =3D 1, .pre_save =3D timebase_pre_save, - .post_load =3D timebase_post_load, .fields =3D (VMStateField []) { VMSTATE_UINT64(guest_timebase, PPCTimebase), VMSTATE_INT64(time_of_the_day_ns, PPCTimebase), diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b71cd7a..9fc3fb9 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2129,6 +2129,12 @@ static void ppc_spapr_init(MachineState *machine) qemu_register_reset(spapr_ccs_reset_hook, spapr); =20 qemu_register_boot_set(spapr_boot_set, spapr); + + /* to stop and start vmclock */ + if (kvm_enabled()) { + qemu_add_vm_change_state_handler(cpu_ppc_clock_vm_state_change, + &spapr->tb); + } } =20 static int spapr_kvm_type(const char *vm_type) diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h index d46c31a..b7977ba 100644 --- a/target/ppc/cpu-qom.h +++ b/target/ppc/cpu-qom.h @@ -214,6 +214,9 @@ extern const struct VMStateDescription vmstate_ppc_time= base; .flags =3D VMS_STRUCT, \ .offset =3D vmstate_offset_value(_state, _field, PPCTimebase), \ } + +void cpu_ppc_clock_vm_state_change(void *opaque, int running, + RunState state); #endif =20 #endif --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486017926859170.32765971720687; Wed, 1 Feb 2017 22:45:26 -0800 (PST) Received: from localhost ([::1]:54718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZB93-00049y-0H for importer@patchew.org; Thu, 02 Feb 2017 01:45:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9k8-0007mW-JH for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k3-00048u-Dt for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:36 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:52211) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k2-00045h-Ps; Thu, 02 Feb 2017 00:15:31 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqX00Ysz9s7G; Thu, 2 Feb 2017 16:15:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012504; bh=v1rOQIVyjY7Rr5iNfczcc6o+WGe79bs8TGeJCIyQgRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dE6nYOWyzP8AbCVJENPQXX4eY0orKot/IrtIP4738EaqcfH/JQQUPA5e8lsWF2tF3 EG57DCmTVhLMjeuZnKR7N03B3IBT4F4C6v1w6P2ROQy2j9IA1+573tdXItbrAA5j7x Anp4YhKBsPF1mTCfXYKEXggYV7HA+sJRfdvmCTm8= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:34 +1100 Message-Id: <20170202051445.5735-97-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 096/107] target/ppc: Remove unused POWERPC_FAMILY(POWER) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth We do not support POWER1 CPUs in QEMU, so it does not make sense to keep this stub around. Signed-off-by: Thomas Huth Signed-off-by: David Gibson --- target/ppc/translate_init.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index c7f7624..76f79fa 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -5217,28 +5217,6 @@ POWERPC_FAMILY(e5500)(ObjectClass *oc, void *data) =20 /* Non-embedded PowerPC = */ =20 -/* POWER : same as 601, without mfmsr, mfsr = */ -POWERPC_FAMILY(POWER)(ObjectClass *oc, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(oc); - PowerPCCPUClass *pcc =3D POWERPC_CPU_CLASS(oc); - - dc->desc =3D "POWER"; - /* pcc->insns_flags =3D XXX_TODO; */ - /* POWER RSC (from RAD6000) */ - pcc->msr_mask =3D (1ull << MSR_EE) | - (1ull << MSR_PR) | - (1ull << MSR_FP) | - (1ull << MSR_ME) | - (1ull << MSR_FE0) | - (1ull << MSR_SE) | - (1ull << MSR_DE) | - (1ull << MSR_AL) | - (1ull << MSR_EP) | - (1ull << MSR_IR) | - (1ull << MSR_DR); -} - #define POWERPC_MSRR_601 (0x0000000000001040ULL) =20 static void init_proc_601 (CPUPPCState *env) --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486019545814967.3636167226856; Wed, 1 Feb 2017 23:12:25 -0800 (PST) Received: from localhost ([::1]:54882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBZ9-00066e-Rf for importer@patchew.org; Thu, 02 Feb 2017 02:12:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kD-0007sQ-02 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k6-0004Ch-1s for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:40 -0500 Received: from ozlabs.org ([103.22.144.67]:55963) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k5-00049X-I9; Thu, 02 Feb 2017 00:15:33 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqY4klBz9sN6; Thu, 2 Feb 2017 16:15:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012505; bh=wsYaANR3b6nGOLrKiksy6mPXq0qbPI4yJk5DTCxAkHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OUToJueCtfucmDQV+85acT8NCL3DrFK5TGUDLU4R0XH2eIAHsk/KUahU1gsmengVJ zNUCpxgQWCP1rR4WCpsXjMCtLARfESEHhJekGiG8fG3RkuQdqVkPc2H1qRivTFJPlk 4lYUmvpcOP8iKzkWYMcjPl1F78ah/Bsm8qRkQbgs= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:35 +1100 Message-Id: <20170202051445.5735-98-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 097/107] target/ppc/cpu-models: Fix/remove bad CPU aliases X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth There is no CPU model called "7447_v1.2" in our list, so the "7447" alias should point to "7447_v1.1" instead. Let's also remove the "codename" aliases that point to non-implemented CPU models - they are really of no use here. Signed-off-by: Thomas Huth Signed-off-by: David Gibson --- target/ppc/cpu-models.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c index 506dee1..4d3e635 100644 --- a/target/ppc/cpu-models.c +++ b/target/ppc/cpu-models.c @@ -1375,19 +1375,15 @@ PowerPCCPUAlias ppc_cpu_aliases[] =3D { { "7445", "7445_v3.2" }, { "7455", "7455_v3.2" }, { "Apollo6", "7455" }, - { "7447", "7447_v1.2" }, + { "7447", "7447_v1.1" }, { "7457", "7457_v1.2" }, { "Apollo7", "7457" }, { "7447A", "7447A_v1.2" }, { "7457A", "7457A_v1.2" }, { "Apollo7PM", "7457A_v1.0" }, #if defined(TARGET_PPC64) - { "Trident", "620" }, { "POWER3", "630" }, - { "Boxer", "POWER3" }, - { "Dino", "POWER3" }, { "POWER3+", "631" }, - { "POWER5gr", "POWER5" }, { "POWER5+", "POWER5+_v2.1" }, { "POWER5gs", "POWER5+_v2.1" }, { "POWER7", "POWER7_v2.3" }, @@ -1399,21 +1395,7 @@ PowerPCCPUAlias ppc_cpu_aliases[] =3D { { "970", "970_v2.2" }, { "970fx", "970fx_v3.1" }, { "970mp", "970mp_v1.1" }, - { "Apache", "RS64" }, - { "A35", "RS64" }, - { "NorthStar", "RS64-II" }, - { "A50", "RS64-II" }, - { "Pulsar", "RS64-III" }, - { "IceStar", "RS64-IV" }, - { "IStar", "RS64-IV" }, - { "SStar", "RS64-IV" }, -#endif - { "RIOS", "POWER" }, - { "RSC", "POWER" }, - { "RSC3308", "POWER" }, - { "RSC4608", "POWER" }, - { "RSC2", "POWER2" }, - { "P2SC", "POWER2" }, +#endif =20 /* Generic PowerPCs */ #if defined(TARGET_PPC64) --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486020285923182.09642267179765; Wed, 1 Feb 2017 23:24:45 -0800 (PST) Received: from localhost ([::1]:55006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBl6-00010n-0J for importer@patchew.org; Thu, 02 Feb 2017 02:24:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kH-0007xm-6j for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kA-0004IC-EO for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:45 -0500 Received: from ozlabs.org ([103.22.144.67]:47247) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kA-0004F0-06; Thu, 02 Feb 2017 00:15:38 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqZ6V4dz9sN5; Thu, 2 Feb 2017 16:15:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012506; bh=E5YGdwqxPm6TYKCZQ/G6BNbBKyyYsFy26V3L7+cF5Og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pWtQj44SvxwJqkFKHj0cybA2zDAqbYgCRymX8U7AjfFfNfWM2W4eI9pCz/xGSWKwd E3H34X54YMUP2m/pKhpBPCe68GgfLIuc7JgJBUT2U3TmyD31qS+micon17nY37Wv8e o1h7jypgeVvJxgKQKfXQvYTAsqUrDrYqA6mFgTW4= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:36 +1100 Message-Id: <20170202051445.5735-99-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 098/107] ppc: switch to constants within BUILD_BUG_ON X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, "Michael S. Tsirkin" , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Michael S. Tsirkin" We are switching BUILD_BUG_ON to verify that it's parameter is a compile-time constant, and it turns out that some gcc versions (specifically gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609) are not smart enough to figure it out for expressions involving local variables. This is harmless but means that the check is ineffective for these platforms. To fix, replace the variable with macros. Reported-by: Peter Maydell Signed-off-by: Michael S. Tsirkin [dwg: Correct a printf format warning] Signed-off-by: David Gibson --- hw/ppc/spapr.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9fc3fb9..e465d7a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2662,8 +2662,8 @@ static void spapr_phb_placement(sPAPRMachineState *sp= apr, uint32_t index, * 1TiB 64-bit MMIO windows for each PHB. */ const uint64_t base_buid =3D 0x800000020000000ULL; - const int max_phbs =3D - (SPAPR_PCI_LIMIT - SPAPR_PCI_BASE) / SPAPR_PCI_MEM64_WIN_SIZE - 1; +#define SPAPR_MAX_PHBS ((SPAPR_PCI_LIMIT - SPAPR_PCI_BASE) / \ + SPAPR_PCI_MEM64_WIN_SIZE - 1) int i; =20 /* Sanity check natural alignments */ @@ -2672,12 +2672,14 @@ static void spapr_phb_placement(sPAPRMachineState *= spapr, uint32_t index, QEMU_BUILD_BUG_ON((SPAPR_PCI_MEM64_WIN_SIZE % SPAPR_PCI_MEM32_WIN_SIZE= ) !=3D 0); QEMU_BUILD_BUG_ON((SPAPR_PCI_MEM32_WIN_SIZE % SPAPR_PCI_IO_WIN_SIZE) != =3D 0); /* Sanity check bounds */ - QEMU_BUILD_BUG_ON((max_phbs * SPAPR_PCI_IO_WIN_SIZE) > SPAPR_PCI_MEM32= _WIN_SIZE); - QEMU_BUILD_BUG_ON((max_phbs * SPAPR_PCI_MEM32_WIN_SIZE) > SPAPR_PCI_ME= M64_WIN_SIZE); - - if (index >=3D max_phbs) { - error_setg(errp, "\"index\" for PAPR PHB is too large (max %u)", - max_phbs - 1); + QEMU_BUILD_BUG_ON((SPAPR_MAX_PHBS * SPAPR_PCI_IO_WIN_SIZE) > + SPAPR_PCI_MEM32_WIN_SIZE); + QEMU_BUILD_BUG_ON((SPAPR_MAX_PHBS * SPAPR_PCI_MEM32_WIN_SIZE) > + SPAPR_PCI_MEM64_WIN_SIZE); + + if (index >=3D SPAPR_MAX_PHBS) { + error_setg(errp, "\"index\" for PAPR PHB is too large (max %llu)", + SPAPR_MAX_PHBS - 1); return; } =20 --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486018364419637.8231872263439; Wed, 1 Feb 2017 22:52:44 -0800 (PST) Received: from localhost ([::1]:54768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBG6-0002y1-Ec for importer@patchew.org; Thu, 02 Feb 2017 01:52:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kD-0007si-5J for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k6-0004DR-IH for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:40 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:59211) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k5-00048h-PU; Thu, 02 Feb 2017 00:15:34 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqY0lVxz9sDG; Thu, 2 Feb 2017 16:15:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012505; bh=8Hts3UFwFv2aI0+G/7v2kc1R9A4vcGWtPF8HWX2Dbtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DeL27HNgZ9iV81iFCOVRhYUe1z373VwKh5L0X5Ia6ht0YADaqUY6rh0iddTmo/l/s 2LOzlcgg+NLJqzjL7xO2vpVYyuoFX+4QL/iHZ08uU1a7jZ76pzxLjULd3zzrffxzqx zbGBm97KeNSZQpt6XF0Ch5RI2Un39ojuf/GD0u4A= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:37 +1100 Message-Id: <20170202051445.5735-100-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 099/107] target-ppc: Add MMU model check for booke machines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Valentin Plotkin , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Valentin Plotkin Machines bamboo, e500 and virtex-ml507 assume a certain MMU model, otherwise resulting in unpredictable behavior. Add apropriate checks into *_init functions. Signed-off-by: Valentin Plotkin [regarding virtex parts] Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias Signed-off-by: David Gibson --- hw/ppc/e500.c | 6 ++++++ hw/ppc/ppc440_bamboo.c | 6 ++++++ hw/ppc/virtex_ml507.c | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 792bd79..f7df238 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -827,6 +827,12 @@ void ppce500_init(MachineState *machine, PPCE500Params= *params) env =3D &cpu->env; cs =3D CPU(cpu); =20 + if (env->mmu_model !=3D POWERPC_MMU_BOOKE206) { + fprintf(stderr, "MMU model %i not supported by this machine.\n= ", + env->mmu_model); + exit(1); + } + if (!firstenv) { firstenv =3D env; } diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index 5c535b1..9d997bf 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -193,6 +193,12 @@ static void bamboo_init(MachineState *machine) } env =3D &cpu->env; =20 + if (env->mmu_model !=3D POWERPC_MMU_BOOKE) { + fprintf(stderr, "MMU model %i not supported by this machine.\n", + env->mmu_model); + exit(1); + } + qemu_register_reset(main_cpu_reset, cpu); ppc_booke_timers_init(cpu, 400000000, 0); ppc_dcr_init(env, NULL, NULL); diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index b97d966..fdbcf22 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -221,6 +221,13 @@ static void virtex_init(MachineState *machine) =20 cpu =3D ppc440_init_xilinx(&ram_size, 1, machine->cpu_model, 400000000= ); env =3D &cpu->env; + + if (env->mmu_model !=3D POWERPC_MMU_BOOKE) { + fprintf(stderr, "MMU model %i not supported by this machine.\n", + env->mmu_model); + exit(1); + } + qemu_register_reset(main_cpu_reset, cpu); =20 memory_region_allocate_system_memory(phys_ram, NULL, "ram", ram_size); --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486020105568186.59714686551786; Wed, 1 Feb 2017 23:21:45 -0800 (PST) Received: from localhost ([::1]:54963 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBiB-00076i-Ev for importer@patchew.org; Thu, 02 Feb 2017 02:21:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kG-0007wp-Hl for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9k9-0004GG-0E for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:44 -0500 Received: from ozlabs.org ([103.22.144.67]:57923) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9k8-0004D8-8a; Thu, 02 Feb 2017 00:15:36 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqZ2hNzz9s8c; Thu, 2 Feb 2017 16:15:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012506; bh=WvveVr5pgm+klrRCVe/UrQrh2UH1dFrbQCZqyTuCE2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WYs4hW/wbGn42EPqmiX4mLZL8jJsWTsV87YThH8orH26KKTSZZvm8hXeDKYE4wpD0 OIgbaBhrQo9xyfmzDRCsPErWV+KB8oOnoLQwn4Hxac9z4q11B75RCJAGc7QQrxDBqt g0wTqR1gP3+3N85mrrssSLXMpwfLLb3N0bQBfClw= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:38 +1100 Message-Id: <20170202051445.5735-101-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 100/107] target-ppc: Add xvtstdc[sp, dp] instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xvtstdcsp: VSX Vector Test Data Class Single-Precision xvtstdcdp: VSX Vector Test Data Class Double-Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 40 +++++++++++++++++++++++++++++++++= ++++ target/ppc/helper.h | 2 ++ target/ppc/internal.h | 5 +++-- target/ppc/translate/vsx-impl.inc.c | 2 ++ target/ppc/translate/vsx-ops.inc.c | 8 ++++++++ 5 files changed, 55 insertions(+), 2 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index ffcf9ca..45bc93c 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -3187,3 +3187,43 @@ void helper_xvxsigsp(CPUPPCState *env, uint32_t opco= de) } putVSR(xT(opcode), &xt, env); } + +/* VSX_TEST_DC - VSX floating point test data class + * op - instruction mnemonic + * nels - number of elements (1, 2 or 4) + * xbn - VSR register number + * tp - type (float32 or float64) + * fld - vsr_t field (VsrD(*) or VsrW(*)) + * tfld - target vsr_t field (VsrD(*) or VsrW(*)) + * fld_max - target field max + */ +#define VSX_TEST_DC(op, nels, xbn, tp, fld, tfld, fld_max) \ +void helper_##op(CPUPPCState *env, uint32_t opcode) \ +{ \ + ppc_vsr_t xt, xb; \ + uint32_t i, sign, dcmx; \ + uint32_t match =3D 0; \ + \ + getVSR(xbn, &xb, env); \ + memset(&xt, 0, sizeof(xt)); \ + dcmx =3D DCMX_XV(opcode); \ + \ + for (i =3D 0; i < nels; i++) { \ + sign =3D tp##_is_neg(xb.fld); \ + if (tp##_is_any_nan(xb.fld)) { \ + match =3D extract32(dcmx, 6, 1); \ + } else if (tp##_is_infinity(xb.fld)) { \ + match =3D extract32(dcmx, 4 + !sign, 1); \ + } else if (tp##_is_zero(xb.fld)) { \ + match =3D extract32(dcmx, 2 + !sign, 1); \ + } else if (tp##_is_zero_or_denormal(xb.fld)) { \ + match =3D extract32(dcmx, 0 + !sign, 1); \ + } \ + xt.tfld =3D match ? fld_max : 0; \ + match =3D 0; \ + } \ + putVSR(xT(opcode), &xt, env); \ +} + +VSX_TEST_DC(xvtstdcdp, 2, xB(opcode), float64, VsrD(i), VsrD(i), UINT64_MA= X) +VSX_TEST_DC(xvtstdcsp, 4, xB(opcode), float32, VsrW(i), VsrW(i), UINT32_MA= X) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 9d4ed08..165e4a5 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -546,6 +546,8 @@ DEF_HELPER_2(xvcvsxdsp, void, env, i32) DEF_HELPER_2(xvcvuxdsp, void, env, i32) DEF_HELPER_2(xvcvsxwsp, void, env, i32) DEF_HELPER_2(xvcvuxwsp, void, env, i32) +DEF_HELPER_2(xvtstdcsp, void, env, i32) +DEF_HELPER_2(xvtstdcdp, void, env, i32) DEF_HELPER_2(xvrspi, void, env, i32) DEF_HELPER_2(xvrspic, void, env, i32) DEF_HELPER_2(xvrspim, void, env, i32) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index c22d74e..4c3811a 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -68,7 +68,7 @@ static inline uint32_t name(uint32_t opcode) = \ ((opcode >> (shift2)) & ((1 << (nb2)) - 1)); = \ } =20 -#define EXTRACT_HELPER_DXFORM(name, = \ +#define EXTRACT_HELPER_SPLIT_3(name, = \ d0_bits, shift_op_d0, shift_d0, = \ d1_bits, shift_op_d1, shift_d1, = \ d2_bits, shift_op_d2, shift_d2) = \ @@ -156,7 +156,7 @@ EXTRACT_HELPER(FPFLM, 17, 8); EXTRACT_HELPER(FPW, 16, 1); =20 /* addpcis */ -EXTRACT_HELPER_DXFORM(DX, 10, 6, 6, 5, 16, 1, 1, 0, 0) +EXTRACT_HELPER_SPLIT_3(DX, 10, 6, 6, 5, 16, 1, 1, 0, 0) #if defined(TARGET_PPC64) /* darn */ EXTRACT_HELPER(L, 16, 2); @@ -198,6 +198,7 @@ EXTRACT_HELPER(UIM, 16, 2); EXTRACT_HELPER(SHW, 8, 2); EXTRACT_HELPER(SP, 19, 2); EXTRACT_HELPER(IMM8, 11, 8); +EXTRACT_HELPER_SPLIT_3(DCMX_XV, 5, 16, 0, 1, 2, 5, 1, 6, 6); =20 typedef union _ppc_vsr_t { uint8_t u8[16]; diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 9bcc5af..adb6fc7 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -928,6 +928,8 @@ GEN_VSX_HELPER_2(xvrspic, 0x16, 0x0A, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvrspim, 0x12, 0x0B, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvrspip, 0x12, 0x0A, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvrspiz, 0x12, 0x09, 0, PPC2_VSX) +GEN_VSX_HELPER_2(xvtstdcsp, 0x14, 0x1A, 0, PPC2_VSX) +GEN_VSX_HELPER_2(xvtstdcdp, 0x14, 0x1E, 0, PPC2_VSX) GEN_VSX_HELPER_2(xxperm, 0x08, 0x03, 0, PPC2_ISA300) GEN_VSX_HELPER_2(xxpermr, 0x08, 0x07, 0, PPC2_ISA300) =20 diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index ee74312..6dd5d72 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -133,6 +133,14 @@ GEN_XX2FORM_EO(xvxsigdp, 0x16, 0x1D, 0x01, PPC2_ISA300= ), GEN_XX2FORM_EO(xvxexpsp, 0x16, 0x1D, 0x08, PPC2_ISA300), GEN_XX2FORM_EO(xvxsigsp, 0x16, 0x1D, 0x09, PPC2_ISA300), =20 +/* DCMX =3D bit[25] << 6 | bit[29] << 5 | bit[11:15] */ +#define GEN_XX2FORM_DCMX(name, opc2, opc3, fl2) \ +GEN_XX3FORM(name, opc2, opc3 | 0, fl2), \ +GEN_XX3FORM(name, opc2, opc3 | 1, fl2) + +GEN_XX2FORM_DCMX(xvtstdcdp, 0x14, 0x1E, PPC2_ISA300), +GEN_XX2FORM_DCMX(xvtstdcsp, 0x14, 0x1A, PPC2_ISA300), + GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX), GEN_XX2FORM(xvnabsdp, 0x12, 0x1E, PPC2_VSX), GEN_XX2FORM(xvnegdp, 0x12, 0x1F, PPC2_VSX), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486020445821406.9186784246141; Wed, 1 Feb 2017 23:27:25 -0800 (PST) Received: from localhost ([::1]:55025 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBnf-0002yp-Pl for importer@patchew.org; Thu, 02 Feb 2017 02:27:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kJ-00080n-Em for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kC-0004Ka-9Q for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:47 -0500 Received: from ozlabs.org ([103.22.144.67]:58631) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kB-0004HD-9P; Thu, 02 Feb 2017 00:15:39 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqb0ppxz9sNH; Thu, 2 Feb 2017 16:15:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012507; bh=qOfva8E/krGdgpGb6NkZPFF27fhn+GA5DDzNstIaa6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fT12HUVka4YSLpKu6ITz+cJMHxcMgj0qIBEWUuvPAeey5djMBvX7398HMEAVh8pq7 I0PXEAitidIyQtG3wA6LbwYC0XvMa/F3SX2qDRO8IWjpmoNJG6rzePAKH5TTcczkYH gk2kIVvR8emaPvEtoqGWfJEobhJRNA+tSIKrpnOU= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:39 +1100 Message-Id: <20170202051445.5735-102-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 101/107] target-ppc: Add xststdc[sp, dp, qp] instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, Nikunj A Dadhania , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania xststdcsp: VSX Scalar Test Data Class Single-Precision xststdcdp: VSX Scalar Test Data Class Double-Precision xststdcqp: VSX Scalar Test Data Class Quad-Precision Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- target/ppc/fpu_helper.c | 66 ++++++++++++++++++++++++++++++++-= ---- target/ppc/helper.h | 3 ++ target/ppc/internal.h | 1 + target/ppc/translate/vsx-impl.inc.c | 3 ++ target/ppc/translate/vsx-ops.inc.c | 4 +++ 5 files changed, 69 insertions(+), 8 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 45bc93c..9f5cafd 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -3196,17 +3196,22 @@ void helper_xvxsigsp(CPUPPCState *env, uint32_t opc= ode) * fld - vsr_t field (VsrD(*) or VsrW(*)) * tfld - target vsr_t field (VsrD(*) or VsrW(*)) * fld_max - target field max + * scrf - set result in CR and FPCC */ -#define VSX_TEST_DC(op, nels, xbn, tp, fld, tfld, fld_max) \ +#define VSX_TEST_DC(op, nels, xbn, tp, fld, tfld, fld_max, scrf) \ void helper_##op(CPUPPCState *env, uint32_t opcode) \ { \ ppc_vsr_t xt, xb; \ uint32_t i, sign, dcmx; \ - uint32_t match =3D 0; \ + uint32_t cc, match =3D 0; \ \ getVSR(xbn, &xb, env); \ - memset(&xt, 0, sizeof(xt)); \ - dcmx =3D DCMX_XV(opcode); \ + if (!scrf) { \ + memset(&xt, 0, sizeof(xt)); \ + dcmx =3D DCMX_XV(opcode); \ + } else { \ + dcmx =3D DCMX(opcode); \ + } \ \ for (i =3D 0; i < nels; i++) { \ sign =3D tp##_is_neg(xb.fld); \ @@ -3219,11 +3224,56 @@ void helper_##op(CPUPPCState *env, uint32_t opcode)= \ } else if (tp##_is_zero_or_denormal(xb.fld)) { \ match =3D extract32(dcmx, 0 + !sign, 1); \ } \ - xt.tfld =3D match ? fld_max : 0; \ + \ + if (scrf) { \ + cc =3D sign << CRF_LT_BIT | match << CRF_EQ_BIT; \ + env->fpscr &=3D ~(0x0F << FPSCR_FPRF); \ + env->fpscr |=3D cc << FPSCR_FPRF; \ + env->crf[BF(opcode)] =3D cc; \ + } else { \ + xt.tfld =3D match ? fld_max : 0; \ + } \ match =3D 0; \ } \ - putVSR(xT(opcode), &xt, env); \ + if (!scrf) { \ + putVSR(xT(opcode), &xt, env); \ + } \ } =20 -VSX_TEST_DC(xvtstdcdp, 2, xB(opcode), float64, VsrD(i), VsrD(i), UINT64_MA= X) -VSX_TEST_DC(xvtstdcsp, 4, xB(opcode), float32, VsrW(i), VsrW(i), UINT32_MA= X) +VSX_TEST_DC(xvtstdcdp, 2, xB(opcode), float64, VsrD(i), VsrD(i), UINT64_MA= X, 0) +VSX_TEST_DC(xvtstdcsp, 4, xB(opcode), float32, VsrW(i), VsrW(i), UINT32_MA= X, 0) +VSX_TEST_DC(xststdcdp, 1, xB(opcode), float64, VsrD(0), VsrD(0), 0, 1) +VSX_TEST_DC(xststdcqp, 1, (rB(opcode) + 32), float128, f128, VsrD(0), 0, 1) + +void helper_xststdcsp(CPUPPCState *env, uint32_t opcode) +{ + ppc_vsr_t xb; + uint32_t dcmx, sign, exp; + uint32_t cc, match =3D 0, not_sp =3D 0; + + getVSR(xB(opcode), &xb, env); + dcmx =3D DCMX(opcode); + exp =3D (xb.VsrD(0) >> 52) & 0x7FF; + + sign =3D float64_is_neg(xb.VsrD(0)); + if (float64_is_any_nan(xb.VsrD(0))) { + match =3D extract32(dcmx, 6, 1); + } else if (float64_is_infinity(xb.VsrD(0))) { + match =3D extract32(dcmx, 4 + !sign, 1); + } else if (float64_is_zero(xb.VsrD(0))) { + match =3D extract32(dcmx, 2 + !sign, 1); + } else if (float64_is_zero_or_denormal(xb.VsrD(0)) || + (exp > 0 && exp < 0x381)) { + match =3D extract32(dcmx, 0 + !sign, 1); + } + + not_sp =3D !float64_eq(xb.VsrD(0), + float32_to_float64( + float64_to_float32(xb.VsrD(0), &env->fp_statu= s), + &env->fp_status), &env->fp_status); + + cc =3D sign << CRF_LT_BIT | match << CRF_EQ_BIT | not_sp << CRF_SO_BIT; + env->fpscr &=3D ~(0x0F << FPSCR_FPRF); + env->fpscr |=3D cc << FPSCR_FPRF; + env->crf[BF(opcode)] =3D cc; +} diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 165e4a5..85af9df 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -451,6 +451,9 @@ DEF_HELPER_2(xscvuxdsp, void, env, i32) DEF_HELPER_2(xscvsxdsp, void, env, i32) DEF_HELPER_2(xscvudqp, void, env, i32) DEF_HELPER_2(xscvuxddp, void, env, i32) +DEF_HELPER_2(xststdcsp, void, env, i32) +DEF_HELPER_2(xststdcdp, void, env, i32) +DEF_HELPER_2(xststdcqp, void, env, i32) DEF_HELPER_2(xsrdpi, void, env, i32) DEF_HELPER_2(xsrdpic, void, env, i32) DEF_HELPER_2(xsrdpim, void, env, i32) diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 4c3811a..5a2fd68 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -198,6 +198,7 @@ EXTRACT_HELPER(UIM, 16, 2); EXTRACT_HELPER(SHW, 8, 2); EXTRACT_HELPER(SP, 19, 2); EXTRACT_HELPER(IMM8, 11, 8); +EXTRACT_HELPER(DCMX, 16, 7); EXTRACT_HELPER_SPLIT_3(DCMX_XV, 5, 16, 0, 1, 2, 5, 1, 6, 6); =20 typedef union _ppc_vsr_t { diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index adb6fc7..a44c003 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -850,6 +850,9 @@ GEN_VSX_HELPER_2(xsnmsubasp, 0x04, 0x12, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xsnmsubmsp, 0x04, 0x13, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xscvsxdsp, 0x10, 0x13, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xscvuxdsp, 0x10, 0x12, 0, PPC2_VSX207) +GEN_VSX_HELPER_2(xststdcsp, 0x14, 0x12, 0, PPC2_ISA300) +GEN_VSX_HELPER_2(xststdcdp, 0x14, 0x16, 0, PPC2_ISA300) +GEN_VSX_HELPER_2(xststdcqp, 0x04, 0x16, 0, PPC2_ISA300) =20 GEN_VSX_HELPER_2(xvadddp, 0x00, 0x0C, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvsubdp, 0x00, 0x0D, 0, PPC2_VSX) diff --git a/target/ppc/translate/vsx-ops.inc.c b/target/ppc/translate/vsx-= ops.inc.c index 6dd5d72..7dc9f6f 100644 --- a/target/ppc/translate/vsx-ops.inc.c +++ b/target/ppc/translate/vsx-ops.inc.c @@ -126,6 +126,10 @@ GEN_HANDLER_E(xsiexpdp, 0x3C, 0x16, 0x1C, 0, PPC_NONE,= PPC2_ISA300), GEN_VSX_XFORM_300(xsiexpqp, 0x4, 0x1B, 0x00000001), #endif =20 +GEN_XX2FORM(xststdcdp, 0x14, 0x16, PPC2_ISA300), +GEN_XX2FORM(xststdcsp, 0x14, 0x12, PPC2_ISA300), +GEN_VSX_XFORM_300(xststdcqp, 0x04, 0x16, 0x00000001), + GEN_XX3FORM(xviexpsp, 0x00, 0x1B, PPC2_ISA300), GEN_XX3FORM(xviexpdp, 0x00, 0x1F, PPC2_ISA300), GEN_XX2FORM_EO(xvxexpdp, 0x16, 0x1D, 0x00, PPC2_ISA300), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486018604258762.822513887402; Wed, 1 Feb 2017 22:56:44 -0800 (PST) Received: from localhost ([::1]:54793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBJx-00072o-VQ for importer@patchew.org; Thu, 02 Feb 2017 01:56:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kN-00084k-3V for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kF-0004P1-Ij for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:51 -0500 Received: from ozlabs.org ([103.22.144.67]:47175) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kE-0004Lb-Te; Thu, 02 Feb 2017 00:15:43 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqc6B7mz9sNP; Thu, 2 Feb 2017 16:15:04 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012508; bh=lcX622k3Y4cbiL+S1IgGvlVIXp80WD/yOMU3QyCj2ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UKLZc30bFNtkIoTEiy4ZeAVOlxXvGGPWJdijzsvjCDPO2rjBFdA1RAOzFGGO7KdSE NwzGOfoU6yMnj5r+toUAG6yc8fhNT9lpCLfrLdJ0OPiazBA6Y4NdzcL1AiUrqBoxm3 04MbcMGsQ8tbzQ2KzB4Wx4Wi6TbC4go1IYNTUzQM= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:40 +1100 Message-Id: <20170202051445.5735-103-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 102/107] target/ppc/debug: Print LPCR register value if register exists X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Suraj Jitindar Singh , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Suraj Jitindar Singh It can be useful when debugging to print the LPCR value. Thus we add the LPCR to the "info registers" output if the register had been defined. Signed-off-by: Suraj Jitindar Singh Signed-off-by: David Gibson --- target/ppc/translate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 772929e..5934185 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -6830,6 +6830,9 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, fprint= f_function cpu_fprintf, } #endif =20 + if (env->spr_cb[SPR_LPCR].name) + cpu_fprintf(f, " LPCR " TARGET_FMT_lx "\n", env->spr[SPR_LPCR]); + switch (env->mmu_model) { case POWERPC_MMU_32B: case POWERPC_MMU_601: --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486019395604352.94777777198567; Wed, 1 Feb 2017 23:09:55 -0800 (PST) Received: from localhost ([::1]:54868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBWi-0003xi-Va for importer@patchew.org; Thu, 02 Feb 2017 02:09:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kN-00085H-FV for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kF-0004PK-Ls for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:51 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:47955) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kF-0004LN-3p; Thu, 02 Feb 2017 00:15:43 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqc1VZ1z9sNJ; Thu, 2 Feb 2017 16:15:04 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012508; bh=1NZpvDEluYlJAzl1iQDP55BdUNiTH1m3Vs0zaftJAzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gnyup417Un2rRYWDsdS2Q+agmh3xN3hMxYdSz84Eo/XsNZ0gDRaLRu/HOMS+0lkCd YEWl0g1UkiCYLbLKqBsSd0RseNg8lSBQ7YoDlK4VR6AxaJhhVLx2BSu7Nd8HO2Q05x mqAs4uDVEikhoGh5b0kAUORBtPWcR8cov2UDiJR0= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:41 +1100 Message-Id: <20170202051445.5735-104-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 103/107] tcg/POWER9: NOOP the cp_abort instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Suraj Jitindar Singh , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Suraj Jitindar Singh The cp_abort instruction is used to remove the state of an in progress copy paste sequence. POWER9 compilers add this in various places, such as context switches which causes illegal instruction signals since we don't yet implement this instruction. Given there is no implementation of the copy paste facility and that we don't claim to support it, we can just noop this instruction. Signed-off-by: Suraj Jitindar Singh Signed-off-by: David Gibson --- target/ppc/translate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 5934185..b48abae 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -6020,6 +6020,10 @@ GEN_TM_NOOP(tabortwci); GEN_TM_NOOP(tabortdc); GEN_TM_NOOP(tabortdci); GEN_TM_NOOP(tsr); +static inline void gen_cp_abort(DisasContext *ctx) +{ + // Do Nothing +} =20 static void gen_tcheck(DisasContext *ctx) { @@ -6170,6 +6174,7 @@ GEN_HANDLER2(andi_, "andi.", 0x1C, 0xFF, 0xFF, 0x0000= 0000, PPC_INTEGER), GEN_HANDLER2(andis_, "andis.", 0x1D, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), GEN_HANDLER(cntlzw, 0x1F, 0x1A, 0x00, 0x00000000, PPC_INTEGER), GEN_HANDLER_E(cnttzw, 0x1F, 0x1A, 0x10, 0x00000000, PPC_NONE, PPC2_ISA300), +GEN_HANDLER_E(cp_abort, 0x1F, 0x06, 0x1A, 0x03FFF801, PPC_NONE, PPC2_ISA30= 0), GEN_HANDLER(or, 0x1F, 0x1C, 0x0D, 0x00000000, PPC_INTEGER), GEN_HANDLER(xor, 0x1F, 0x1C, 0x09, 0x00000000, PPC_INTEGER), GEN_HANDLER(ori, 0x18, 0xFF, 0xFF, 0x00000000, PPC_INTEGER), --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486019137612355.06315055756716; Wed, 1 Feb 2017 23:05:37 -0800 (PST) Received: from localhost ([::1]:54842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBSZ-0007rU-Kb for importer@patchew.org; Thu, 02 Feb 2017 02:05:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kN-00085c-OP for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kG-0004R1-Au for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:51 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:49229) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kF-0004MQ-R1; Thu, 02 Feb 2017 00:15:44 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqd0HLxz9s7Q; Thu, 2 Feb 2017 16:15:04 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012509; bh=gd++IZqPGAYJLcUaWTqQ7LE4JC0TCgYT4UjOtOovpL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SUzFfzAldatLRV4iP4bGI1ZsUUZ9Sdhqpf1tpUXojBxtdnkXvyKQStb18BHEIHR1q /fQqlZQaunNZ/PYzrjWWYzx1c4jRCnvakHZaUPrzIN+6j+U70JrWF4Xk351H9RDEJR Fyf/RxcQk+5Yv2DK6vPC0aIX6v5hHe98CocZ7ri4= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:42 +1100 Message-Id: <20170202051445.5735-105-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 104/107] target/ppc/mmu_hash64: Fix printing unsigned as signed int X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Suraj Jitindar Singh , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Suraj Jitindar Singh We were printing an unsigned value as a signed value, fix this. Signed-off-by: Suraj Jitindar Singh Signed-off-by: David Gibson --- target/ppc/mmu-hash64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index 0efc8c6..bb78fb5 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -181,8 +181,8 @@ int ppc_store_slb(PowerPCCPU *cpu, target_ulong slot, slb->vsid =3D vsid; slb->sps =3D sps; =20 - LOG_SLB("%s: %d " TARGET_FMT_lx " - " TARGET_FMT_lx " =3D> %016" PRIx64 - " %016" PRIx64 "\n", __func__, slot, esid, vsid, + LOG_SLB("%s: " TARGET_FMT_lu " " TARGET_FMT_lx " - " TARGET_FMT_lx + " =3D> %016" PRIx64 " %016" PRIx64 "\n", __func__, slot, esid,= vsid, slb->esid, slb->vsid); =20 return 0; --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148601888046289.30923691219357; Wed, 1 Feb 2017 23:01:20 -0800 (PST) Received: from localhost ([::1]:54819 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBOP-0003NV-8k for importer@patchew.org; Thu, 02 Feb 2017 02:01:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kN-00085g-PV for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kF-0004PR-Mc for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:51 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:53845) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kF-0004LM-4z; Thu, 02 Feb 2017 00:15:43 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqb4wV8z9s7S; Thu, 2 Feb 2017 16:15:04 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012507; bh=vt2ZoDNW3KEDWccrCcM9ZQU++Pxly7dpEF/N7ldMvu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n7YnpqR2S84DHLiAv5uuWdI3qzh6y0mSQKTJfaisDcu4hlSCUGyxfFig0yKO3Xz6i jZwILIZEP396Y18upzSH94mOHZASxqFGaGfauMrjW1aXNQa1lbgF+0v6nJItlZSyn9 tDuyZm1901SZ7Q/RVqPIgcbdqyGVB5iz6NP/eFAk= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:43 +1100 Message-Id: <20170202051445.5735-106-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 105/107] target/ppc/mmu_hash64: Fix incorrect shift value in amr calculation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, Suraj Jitindar Singh , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Suraj Jitindar Singh We are calculating the authority mask register key value wrong. The pte entry contains the key value with the two upper bits and the three lower bits stored separately. We should use these two portions to get a 5 bit value, not or them together which will only give us a 3 bit value. Fix this. Signed-off-by: Suraj Jitindar Singh Signed-off-by: David Gibson --- target/ppc/mmu-hash64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/mmu-hash64.h b/target/ppc/mmu-hash64.h index ab5d347..7a0b7fc 100644 --- a/target/ppc/mmu-hash64.h +++ b/target/ppc/mmu-hash64.h @@ -85,7 +85,7 @@ void ppc_hash64_update_rmls(CPUPPCState *env); #define HPTE64_R_C 0x0000000000000080ULL #define HPTE64_R_R 0x0000000000000100ULL #define HPTE64_R_KEY_LO 0x0000000000000e00ULL -#define HPTE64_R_KEY(x) ((((x) & HPTE64_R_KEY_HI) >> 60) | \ +#define HPTE64_R_KEY(x) ((((x) & HPTE64_R_KEY_HI) >> 57) | \ (((x) & HPTE64_R_KEY_LO) >> 9)) =20 #define HPTE64_V_1TB_SEG 0x4000000000000000ULL --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486020627369637.6491076623837; Wed, 1 Feb 2017 23:30:27 -0800 (PST) Received: from localhost ([::1]:55042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBqb-0005Ih-Ew for importer@patchew.org; Thu, 02 Feb 2017 02:30:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kO-000871-O5 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kG-0004QL-04 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:52 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:51503) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kF-0004Lk-F6; Thu, 02 Feb 2017 00:15:43 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqc50gxz9sNM; Thu, 2 Feb 2017 16:15:04 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012508; bh=tL6PPAgo8lesu153s2H9BXBQGnq9xy/d499042X1sgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lKphy6uUf2c0fsZFPBXOFl0lC4R6louDAStLp4pJ3NeCe1slM6klC5x3GTTzk+gMW c/Ovt5NQu+dPr68dGQe0Esc3FfAmj/xCXasu5SLjJBzgx19caZk5UgHo52DcUT9ApF PPWPopvKTqhfmgHWqugnYHIaGnlk8vCiT28vGwvs= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:44 +1100 Message-Id: <20170202051445.5735-107-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 106/107] ppc/kvm: Handle the "family" CPU via alias instead of registering new types X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth When running with KVM on POWER, we are registering a "family" CPU type for the host CPU that we are running on. For example, on all POWER8-compatible hosts, we register a "POWER8" CPU type, so that you can always start QEMU with "-cpu POWER8" there, without the need to know whether you are running on a POWER8, POWER8E or POWER8NVL host machine. However, we also have a "POWER8" CPU alias in the ppc_cpu_aliases list (that is mainly useful for TCG). This leads to two cosmetical drawbacks: If the user runs QEMU with "-cpu ?", we always claim that POWER8 is an "alias for POWER8_v2.0" - which is simply not true when running with KVM on POWER. And when using the 'query-cpu-definitions' QMP call, there are currently two entries for "POWER8", one for the alias, and one for the additional registered type. To solve the two problems, we should rather update the "family" alias instead of registering a new types. We then only have one "POWER8" CPU definition around, an alias, which also points to the right destination. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1396536 Signed-off-by: Thomas Huth Signed-off-by: David Gibson --- target/ppc/kvm.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index e69fca8..663d2e7 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -24,6 +24,7 @@ #include "qemu-common.h" #include "qemu/error-report.h" #include "cpu.h" +#include "cpu-models.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" #include "sysemu/hw_accel.h" @@ -2412,6 +2413,7 @@ static int kvm_ppc_register_host_cpu_type(void) }; PowerPCCPUClass *pvr_pcc; DeviceClass *dc; + int i; =20 pvr_pcc =3D kvm_ppc_get_host_cpu_class(); if (pvr_pcc =3D=3D NULL) { @@ -2420,13 +2422,6 @@ static int kvm_ppc_register_host_cpu_type(void) type_info.parent =3D object_class_get_name(OBJECT_CLASS(pvr_pcc)); type_register(&type_info); =20 - /* Register generic family CPU class for a family */ - pvr_pcc =3D ppc_cpu_get_family_class(pvr_pcc); - dc =3D DEVICE_CLASS(pvr_pcc); - type_info.parent =3D object_class_get_name(OBJECT_CLASS(pvr_pcc)); - type_info.name =3D g_strdup_printf("%s-"TYPE_POWERPC_CPU, dc->desc); - type_register(&type_info); - #if defined(TARGET_PPC64) type_info.name =3D g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, "host"); type_info.parent =3D TYPE_SPAPR_CPU_CORE, @@ -2436,14 +2431,29 @@ static int kvm_ppc_register_host_cpu_type(void) type_info.class_data =3D (void *) "host"; type_register(&type_info); g_free((void *)type_info.name); - - /* Register generic spapr CPU family class for current host CPU type */ - type_info.name =3D g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, dc->desc); - type_info.class_data =3D (void *) dc->desc; - type_register(&type_info); - g_free((void *)type_info.name); #endif =20 + /* + * Update generic CPU family class alias (e.g. on a POWER8NVL host, + * we want "POWER8" to be a "family" alias that points to the current + * host CPU type, too) + */ + dc =3D DEVICE_CLASS(ppc_cpu_get_family_class(pvr_pcc)); + for (i =3D 0; ppc_cpu_aliases[i].alias !=3D NULL; i++) { + if (strcmp(ppc_cpu_aliases[i].alias, dc->desc) =3D=3D 0) { + ObjectClass *oc =3D OBJECT_CLASS(pvr_pcc); + char *suffix; + + ppc_cpu_aliases[i].model =3D g_strdup(object_class_get_name(oc= )); + suffix =3D strstr(ppc_cpu_aliases[i].model, "-"TYPE_POWERPC_CP= U); + if (suffix) { + *suffix =3D 0; + } + ppc_cpu_aliases[i].oc =3D oc; + break; + } + } + return 0; } =20 --=20 2.9.3 From nobody Wed May 1 06:27:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486019599928921.0964527551499; Wed, 1 Feb 2017 23:13:19 -0800 (PST) Received: from localhost ([::1]:54886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZBa2-0006wx-1a for importer@patchew.org; Thu, 02 Feb 2017 02:13:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZ9kN-00085R-NY for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZ9kF-0004QC-W6 for qemu-devel@nongnu.org; Thu, 02 Feb 2017 00:15:51 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:49839) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZ9kF-0004Ld-Eq; Thu, 02 Feb 2017 00:15:43 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vDSqc38Qwz9sNK; Thu, 2 Feb 2017 16:15:05 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1486012508; bh=uS1etbnLrLfTloAOdwnOLwoin/iWAehZg3+Ra89upT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SOtthpNDBu2NMUUTlLiMfcg/Jc9OWpdC0hgsR8Zg+Qrs6lZy5uLemxi6TE8ANlsxa YFZ2GQfLaZG0xHQSYkFu+G7h3Oq2qUY1Pp4bnya1o48l9Ml1tAsJkSgfRjZYtcLdi3 NzaJrBRVw9zPOhKSM7B25EDVHXFLGmIbm0ZMcjZ8= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 2 Feb 2017 16:14:45 +1100 Message-Id: <20170202051445.5735-108-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170202051445.5735-1-david@gibson.dropbear.id.au> References: <20170202051445.5735-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 107/107] hw/ppc/pnv: Use error_report instead of hw_error if a ROM file can't be found X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth hw_error() is for CPU related errors only (it dumps the CPU registers and calls abort()!), so using error_report() is the better choice of reporting an error in case we simply did not find a file. Signed-off-by: Thomas Huth Signed-off-by: David Gibson --- hw/ppc/pnv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 83597fe..4fab5c0 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -381,7 +381,7 @@ static void ppc_powernv_init(MachineState *machine) =20 fw_size =3D load_image_targphys(fw_filename, FW_LOAD_ADDR, FW_MAX_SIZE= ); if (fw_size < 0) { - hw_error("qemu: could not load OPAL '%s'\n", fw_filename); + error_report("qemu: could not load OPAL '%s'", fw_filename); exit(1); } g_free(fw_filename); @@ -393,8 +393,8 @@ static void ppc_powernv_init(MachineState *machine) kernel_size =3D load_image_targphys(machine->kernel_filename, KERNEL_LOAD_ADDR, 0x2000000); if (kernel_size < 0) { - hw_error("qemu: could not load kernel'%s'\n", - machine->kernel_filename); + error_report("qemu: could not load kernel'%s'", + machine->kernel_filename); exit(1); } } --=20 2.9.3