From nobody Mon Feb 9 00:26:58 2026 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; dkim=fail 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 1499162443101673.2069570906378; Tue, 4 Jul 2017 03:00:43 -0700 (PDT) Received: from localhost ([::1]:40043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSKdN-0007V2-GZ for importer@patchew.org; Tue, 04 Jul 2017 06:00:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSKXu-00027D-GD for qemu-devel@nongnu.org; Tue, 04 Jul 2017 05:55:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSKXt-0000ZR-HI for qemu-devel@nongnu.org; Tue, 04 Jul 2017 05:55:02 -0400 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:36796) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dSKXt-0000Z3-9c for qemu-devel@nongnu.org; Tue, 04 Jul 2017 05:55:01 -0400 Received: by mail-lf0-x244.google.com with SMTP id f28so17186236lfi.3 for ; Tue, 04 Jul 2017 02:55:01 -0700 (PDT) Received: from localhost (81-231-233-234-no56.tbcn.telia.com. [81.231.233.234]) by smtp.gmail.com with ESMTPSA id i77sm4866932lfk.29.2017.07.04.02.54.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 02:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QJjLxUIcIccuEeRSnmDlmw5G8s9vdbFH4v5pD3q/kmM=; b=H8Lsla4MHZXyc2T7YLYYGhGHNMKF79mX1u+OK/l7+3QdPBGKsl6glZhFEna93c4bHA SsWLDuNGs9OTKAwKpFEWld+BL5TC8l6pxMlfECc0Bp/vccRZAC+D5Ltl8xA0GipX0p7o aJ4Mp37Kcn+feAdBbPvbavKgnHcyo9KPmEj/7cBW/8FxTUhOe25iGOWYq3QxW5/V+iAm /zhYDZOgr+rY7jE1Y1t4Ad2ohIGTWNRuvwj6IV5DM1zrdR8UlDdlhOKzLdtHbvGd83fs 3IDOcWI/qiNm8I/VWRd+5P8mdd1j6BceG3cH+MpRFSoDohyeg91jm+wMqXceimkczrmv 7JCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QJjLxUIcIccuEeRSnmDlmw5G8s9vdbFH4v5pD3q/kmM=; b=NJF2aCIQwwUw+rZZuk8oOD7bObyGxetp699XXvWbmgYTSgi92L3IDBeHeU6bMhumIz rnucI9uH6XnR7sjWeBsSpf24+vRxFnInRFarHExKauh91+qVJrSPi8YxGSmSB/uiXj0F +kicK+DrsaWvtG1eT+sGzG9ydtClhyWPUra0bVDFOULXGdA6yTwjkJ8mRAukpJG00WqY KpYJCYEeXuOT4sST/eUHqh7sXA1ozvhZ4Vm2apLlCNCJ0f1KtuoBPYjxAurgWwBpnKzu lUc/NplElLewiqzhTB3ZVVFMxxXtKiRHNYMWNt8SlaOcWhbHmyIHvRbFmL6EEDC1t9lr be5w== X-Gm-Message-State: AKS2vOxgjcSKUlUC5A/4Dz3fKvsqGEzsaUTq5l4RA4IIHpz+ryYczKn5 s4sOTLI5RLM4iBHM X-Received: by 10.46.84.83 with SMTP id y19mr6437411ljd.134.1499162099735; Tue, 04 Jul 2017 02:54:59 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 4 Jul 2017 11:54:38 +0200 Message-Id: <1499162088-1562-8-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499162088-1562-1-git-send-email-edgar.iglesias@gmail.com> References: <1499162088-1562-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::244 Subject: [Qemu-devel] [PULL v1 07/17] target-microblaze: Introduce a use-hw-mul property 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: sai.pavan.boddu@xilinx.com, edgar.iglesias@xilinx.com, alistai@xilinx.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Introduce a use-div property making multiplication instructions optional. Reviewed-by: Alistair Francis Signed-off-by: Edgar E. Iglesias --- target/microblaze/cpu.c | 12 ++++++++---- target/microblaze/cpu.h | 1 + target/microblaze/translate.c | 5 ++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 5bf2a29..70e4743 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -150,8 +150,7 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **= errp) =20 qemu_init_vcpu(cs); =20 - env->pvr.regs[0] =3D PVR0_USE_HW_MUL_MASK \ - | PVR0_USE_EXC_MASK \ + env->pvr.regs[0] =3D PVR0_USE_EXC_MASK \ | PVR0_USE_ICACHE_MASK \ | PVR0_USE_DCACHE_MASK; env->pvr.regs[2] =3D PVR2_D_OPB_MASK \ @@ -160,8 +159,6 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **= errp) | PVR2_I_LMB_MASK \ | PVR2_USE_MSR_INSTR \ | PVR2_USE_PCMP_INSTR \ - | PVR2_USE_HW_MUL_MASK \ - | PVR2_USE_MUL64_MASK \ | PVR2_FPU_EXC_MASK \ | 0; =20 @@ -178,6 +175,7 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **= errp) =20 env->pvr.regs[0] |=3D (cpu->cfg.stackprot ? PVR0_SPROT_MASK : 0) | (cpu->cfg.use_fpu ? PVR0_USE_FPU_MASK : 0) | + (cpu->cfg.use_hw_mul ? PVR0_USE_HW_MUL_MASK : 0) | (cpu->cfg.use_barrel ? PVR0_USE_BARREL_MASK : 0) | (cpu->cfg.use_div ? PVR0_USE_DIV_MASK : 0) | (cpu->cfg.use_mmu ? PVR0_USE_MMU_MASK : 0) | @@ -187,6 +185,8 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **= errp) =20 env->pvr.regs[2] |=3D (cpu->cfg.use_fpu ? PVR2_USE_FPU_MASK : 0) | (cpu->cfg.use_fpu > 1 ? PVR2_USE_FPU2_MASK : 0) | + (cpu->cfg.use_hw_mul ? PVR2_USE_HW_MUL_MASK : 0) | + (cpu->cfg.use_hw_mul > 1 ? PVR2_USE_MUL64_MASK : 0= ) | (cpu->cfg.use_barrel ? PVR2_USE_BARREL_MASK : 0) | (cpu->cfg.use_div ? PVR2_USE_DIV_MASK : 0); =20 @@ -235,6 +235,10 @@ static Property mb_properties[] =3D { * are enabled */ DEFINE_PROP_UINT8("use-fpu", MicroBlazeCPU, cfg.use_fpu, 2), + /* If use-hw-mul > 0 - Multiplier is enabled + * If use-hw-mul =3D 2 - 64-bit multiplier is enabled + */ + DEFINE_PROP_UINT8("use-hw-mul", MicroBlazeCPU, cfg.use_hw_mul, 2), DEFINE_PROP_BOOL("use-barrel", MicroBlazeCPU, cfg.use_barrel, true), DEFINE_PROP_BOOL("use-div", MicroBlazeCPU, cfg.use_div, true), DEFINE_PROP_BOOL("use-mmu", MicroBlazeCPU, cfg.use_mmu, true), diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 4397338..e202229 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -298,6 +298,7 @@ struct MicroBlazeCPU { bool stackprot; uint32_t base_vectors; uint8_t use_fpu; + uint8_t use_hw_mul; bool use_barrel; bool use_div; bool use_mmu; diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index afe4bd4..36caa03 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -589,7 +589,7 @@ static void dec_mul(DisasContext *dc) =20 if ((dc->tb_flags & MSR_EE_FLAG) && (dc->cpu->env.pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK) - && !(dc->cpu->env.pvr.regs[0] & PVR0_USE_HW_MUL_MASK)) { + && !dc->cpu->cfg.use_hw_mul) { tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP); t_gen_raise_exception(dc, EXCP_HW_EXCP); return; @@ -604,8 +604,7 @@ static void dec_mul(DisasContext *dc) } =20 /* mulh, mulhsu and mulhu are not available if C_USE_HW_MUL is < 2. */ - if (subcode >=3D 1 && subcode <=3D 3 - && !((dc->cpu->env.pvr.regs[2] & PVR2_USE_MUL64_MASK))) { + if (subcode >=3D 1 && subcode <=3D 3 && dc->cpu->cfg.use_hw_mul < 2) { /* nop??? */ } =20 --=20 2.7.4