From nobody Mon Feb 9 02:14:39 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 1497974007031433.8027985447576; Tue, 20 Jun 2017 08:53:27 -0700 (PDT) Received: from localhost ([::1]:49425 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNLT2-0006Nk-Ka for importer@patchew.org; Tue, 20 Jun 2017 11:53:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39011) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNLRJ-000549-D4 for qemu-devel@nongnu.org; Tue, 20 Jun 2017 11:51:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dNLRI-0003zh-FE for qemu-devel@nongnu.org; Tue, 20 Jun 2017 11:51:37 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:32899) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dNLRI-0003zR-76 for qemu-devel@nongnu.org; Tue, 20 Jun 2017 11:51:36 -0400 Received: by mail-lf0-x241.google.com with SMTP id u62so15459888lfg.0 for ; Tue, 20 Jun 2017 08:51:36 -0700 (PDT) Received: from localhost (81-231-233-234-no56.tbcn.telia.com. [81.231.233.234]) by smtp.gmail.com with ESMTPSA id v68sm4085274lfi.50.2017.06.20.08.51.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 08:51:33 -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=dwIqBx3Nb0ybOBCVkBuxFdIV0eMMXP5iPFb+mQ2gQ94=; b=Kwro6xgWv9eDTVNLVzJKjZzurkPxY0V+B6hQRXD+52SPLXrQma5QiG1M/AwwZ1ILlu 0JgFbBujEbOh7HXOG9LurL/lfVgSjfT7bjmiD3yJZxe29vZjvG7iuOaA4pFbVrkJVN0y +o4skZ1ZGf/uRR02bCY289qZVy4dZuTvvLiSIa+SiUQ1imP32fYkL2GWTUmNqb0OYdaM YQxxw6uOyOhOhj6Hi4KlvMRPAINEhw2ipkDaVKa6z2gGcW81cQizaGmapy66Xb4RyQD3 0PhEZfkLpbiqfpZqpfympFdP9Cx/So6giz5Bqg5+xvbcAvwJTtKml+TzQ21lz3Gy58Qr q0Vg== 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=dwIqBx3Nb0ybOBCVkBuxFdIV0eMMXP5iPFb+mQ2gQ94=; b=aox69b9iksmTLnMXzH6zevgnCNSI50M//4DinagkkXABptWs07qe004dPX34VGLAf4 TzLWgJhojk6F0K50vNHJStq/vH8B17JGNtdQK0Pj0oIn6c7nf/I/pL1yT8ExxjrDX4Bh U4+2lR1wDwX7pgmv3ekVkShSHLF4Xg4qxtH84QLVE0hTa8RdRrBjN0tSiF++AgJm1Q/t 8C3HGpJOOeS0iXe77I5JGrcRQG6JSqqZBC1wRK7l9Wvf0VGiho3hE3bSwmDq4nKtzCQE s7kHcQuNsCDS3FQuXxZ8rvbPQUAPGRAraWcV0hYfsfHtYbDS9QWPKpVQcm9wIX6f5TYF PJzw== X-Gm-Message-State: AKS2vOx8PgAWXnlEME/slEt9pHYmEM6eEoSN5sdsDNA1oBDmFT1BeO8b LVvGaKK5CKLCzyuM X-Received: by 10.25.235.69 with SMTP id j66mr572598lfh.141.1497973894656; Tue, 20 Jun 2017 08:51:34 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Tue, 20 Jun 2017 17:51:23 +0200 Message-Id: <1497973886-26257-6-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497973886-26257-1-git-send-email-edgar.iglesias@gmail.com> References: <1497973886-26257-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::241 Subject: [Qemu-devel] [PATCH v1 5/8] target-microblaze: Introduce a use-div 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 division instructions optional. Signed-off-by: Edgar E. Iglesias Reviewed-by: Alistair Francis --- target/microblaze/cpu.c | 9 +++++---- target/microblaze/cpu.h | 1 + target/microblaze/translate.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index bae47b5..5bf2a29 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_DIV_MASK \ - | PVR0_USE_HW_MUL_MASK \ + env->pvr.regs[0] =3D PVR0_USE_HW_MUL_MASK \ | PVR0_USE_EXC_MASK \ | PVR0_USE_ICACHE_MASK \ | PVR0_USE_DCACHE_MASK; @@ -161,7 +160,6 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **= errp) | PVR2_I_LMB_MASK \ | PVR2_USE_MSR_INSTR \ | PVR2_USE_PCMP_INSTR \ - | PVR2_USE_DIV_MASK \ | PVR2_USE_HW_MUL_MASK \ | PVR2_USE_MUL64_MASK \ | PVR2_FPU_EXC_MASK \ @@ -181,6 +179,7 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **= errp) env->pvr.regs[0] |=3D (cpu->cfg.stackprot ? PVR0_SPROT_MASK : 0) | (cpu->cfg.use_fpu ? PVR0_USE_FPU_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) | (cpu->cfg.endi ? PVR0_ENDI_MASK : 0) | (version_code << PVR0_VERSION_SHIFT) | @@ -188,7 +187,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_barrel ? PVR2_USE_BARREL_MASK : 0); + (cpu->cfg.use_barrel ? PVR2_USE_BARREL_MASK : 0) | + (cpu->cfg.use_div ? PVR2_USE_DIV_MASK : 0); =20 env->pvr.regs[5] |=3D cpu->cfg.dcache_writeback ? PVR5_DCACHE_WRITEBACK_MASK : 0; @@ -236,6 +236,7 @@ static Property mb_properties[] =3D { */ DEFINE_PROP_UINT8("use-fpu", MicroBlazeCPU, cfg.use_fpu, 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), DEFINE_PROP_BOOL("dcache-writeback", MicroBlazeCPU, cfg.dcache_writeba= ck, false), diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 2a4a65a..4397338 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -299,6 +299,7 @@ struct MicroBlazeCPU { uint32_t base_vectors; uint8_t use_fpu; bool use_barrel; + bool use_div; bool use_mmu; bool dcache_writeback; bool endi; diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 26b221c..afe4bd4 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -643,7 +643,7 @@ static void dec_div(DisasContext *dc) LOG_DIS("div\n"); =20 if ((dc->cpu->env.pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK) - && !((dc->cpu->env.pvr.regs[0] & PVR0_USE_DIV_MASK))) { + && !dc->cpu->cfg.use_div) { tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP); t_gen_raise_exception(dc, EXCP_HW_EXCP); } --=20 2.7.4