From nobody Mon Feb 9 08:11:24 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1587405403; cv=none; d=zohomail.com; s=zohoarc; b=YGpeZDbJXRtTK4mDFtuF3yIDzBCuI2AbKLkTfRdoHoIaYS4fRoPMkXaOKBUZxnGdzRRvIT+vIW1I2mYrBOhy07RBQD61e3nZALcBw4D00rFtsJn5JyaiOUITWHNlEAO0FwIFp4gXUqXBpwPKWV6fuForXwu9N7cUAnVgD42OEV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587405403; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LaPaoVtThQwYoQG+zx194rpdA5Jb5QupwjNlgtB5GgQ=; b=cVuNe9EYV8O+u5coReBPTYtIJvpPUokU5pRnqHmEaE3yDhzVg42r6FEuWo7Zhhc6FtQtvyga7SKa+nF5Ea5c1up+TiGM1e/O2kGt1XAxRcPbCPL4T/RK6yBKocFU957W/aC6kGwAMn5CF4diKkG5h6HM2XtprVRMGn7uVGXYSnc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587405403144528.2971057348212; Mon, 20 Apr 2020 10:56:43 -0700 (PDT) Received: from localhost ([::1]:40016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQaev-0003iO-Ph for importer@patchew.org; Mon, 20 Apr 2020 13:56:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36574 helo=eggs1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQabQ-0006ml-G9 for qemu-devel@nongnu.org; Mon, 20 Apr 2020 13:53:04 -0400 Received: from Debian-exim by eggs1p.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQabL-00042o-Uu for qemu-devel@nongnu.org; Mon, 20 Apr 2020 13:53:04 -0400 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]:35442) by eggs1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jQabL-0003zR-Hw for qemu-devel@nongnu.org; Mon, 20 Apr 2020 13:52:59 -0400 Received: by mail-lj1-x243.google.com with SMTP id g4so2874643ljl.2 for ; Mon, 20 Apr 2020 10:52:59 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id g3sm122709ljj.13.2020.04.20.10.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 10:52:56 -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 :mime-version:content-transfer-encoding; bh=LaPaoVtThQwYoQG+zx194rpdA5Jb5QupwjNlgtB5GgQ=; b=HNvt03FthLs3GrZSrOp6vBmEieBjGl8BccPXAU8N6kN/9n2YF0iIIPUaTQkcKekaCu 9R4x6oTIIW6cGhFl5w/YkOFkb09J7wbuEGoz/PEUQAjF+IqgxXqvnqIsrB0ltCvE1BgZ qCsWzVIr7OpaK6iLbOOViUMQ9jjmjO+/FKwvO9v+FHZdu3040/jNEfdRddlMobhavjWI 8t0ZImWnxGceRrFNzTsCe0otLdzqOnF6Dh4cyZD1vxCXWPyO+J9m8RWvKs4adKDJ6Wxi b1HjWQFrOML7bDUZcfZQ5AHDMxlxFBqmQHAP3HjfYZUM0TOjKfJAs8k3mBvtXk1rWsdF hWXA== 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:mime-version:content-transfer-encoding; bh=LaPaoVtThQwYoQG+zx194rpdA5Jb5QupwjNlgtB5GgQ=; b=QZ2bRCDMx1JjwX0LuRN0YxrBni2vxJDtGfbQSitnnabYrm1O7PqnZZQyKYIQioFL78 OQ99Lr85HIHAFqyZ+ubMJLqEtn59ovtGMTZ6rC6cemdNNGWSm3vyaftcyLu2Z7gro9r+ u75jYF1XOi2tpHQ9hpDbc1ESmbR8mWt/INXJmLZ0pFr+D/vW+P4SMLQW4b3qN4dUik0i qaMfGwyu2CfDBR4kwLuaEQr5pC6T6lacw4h2Xyj9Y4ZB/A9218530C6hrsKjmqah7A7/ VVEKnUsoDgQFPqVLX2vPDuQdBDtS2StbL9educUnzUbX6SzHZKSofe7HWi0OVWdq1mEb /UhA== X-Gm-Message-State: AGi0Pubk+CS795bKXIPPhipINGbfDHImk1jJmugAG58uGqlniuDALLiK SDhT340OWrmdGKjcOK9SlJvDC2wqcNw= X-Google-Smtp-Source: APiQypKH6HOyd8BVhoarhfmekiq5Ot8mqyiPho5QIgvDOTpecrXZVnsB0UmNI2CYHcQxuf3Rvox5Jg== X-Received: by 2002:a2e:8046:: with SMTP id p6mr10243326ljg.21.1587405177265; Mon, 20 Apr 2020 10:52:57 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PATCH v2 4/6] target/microblaze: Add the unaligned-exceptions property Date: Mon, 20 Apr 2020 19:52:48 +0200 Message-Id: <20200420175250.25777-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200420175250.25777-1-edgar.iglesias@gmail.com> References: <20200420175250.25777-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::243; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x243.google.com X-detected-operating-system: by eggs1p.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::243 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: figlesia@xilinx.com, peter.maydell@linaro.org, sstabellini@kernel.org, edgar.iglesias@xilinx.com, sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com, alistair@alistair23.me, richard.henderson@linaro.org, frederic.konrad@adacore.com, philmd@redhat.com, luc.michel@greensocs.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Add the unaligned-exceptions property to control if the core traps unaligned memory accesses. Reviewed-by: Alistair Francis Reviewed-by: Luc Michel Signed-off-by: Edgar E. Iglesias --- target/microblaze/cpu.c | 4 ++++ target/microblaze/cpu.h | 1 + target/microblaze/translate.c | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 53e80f4e5d..10d90c64dd 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -211,6 +211,8 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **= errp) PVR2_DIV_ZERO_EXC_MASK : = 0) | (cpu->cfg.illegal_opcode_exception ? PVR2_ILL_OPCODE_EXC_MASK := 0) | + (cpu->cfg.unaligned_exceptions ? + PVR2_UNALIGNED_EXC_MASK : = 0) | (cpu->cfg.opcode_0_illegal ? PVR2_OPCODE_0x0_ILL_MASK = : 0); =20 @@ -284,6 +286,8 @@ static Property mb_properties[] =3D { cfg.illegal_opcode_exception, false), DEFINE_PROP_BOOL("div-zero-exception", MicroBlazeCPU, cfg.div_zero_exception, false), + DEFINE_PROP_BOOL("unaligned-exceptions", MicroBlazeCPU, + cfg.unaligned_exceptions, false), DEFINE_PROP_BOOL("opcode-0x0-illegal", MicroBlazeCPU, cfg.opcode_0_illegal, false), DEFINE_PROP_STRING("version", MicroBlazeCPU, cfg.version), diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 3c07f9b3f7..ef9081db40 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -306,6 +306,7 @@ struct MicroBlazeCPU { bool illegal_opcode_exception; bool opcode_0_illegal; bool div_zero_exception; + bool unaligned_exceptions; char *version; uint8_t pvr; } cfg; diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index b4a78551ef..20b7427811 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -995,7 +995,7 @@ static void dec_load(DisasContext *dc) v =3D tcg_temp_new_i32(); tcg_gen_qemu_ld_i32(v, addr, mem_index, mop); =20 - if ((dc->cpu->env.pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && size > 1) { + if (dc->cpu->cfg.unaligned_exceptions && size > 1) { TCGv_i32 t0 =3D tcg_const_i32(0); TCGv_i32 treg =3D tcg_const_i32(dc->rd); TCGv_i32 tsize =3D tcg_const_i32(size - 1); @@ -1110,7 +1110,7 @@ static void dec_store(DisasContext *dc) tcg_gen_qemu_st_i32(cpu_R[dc->rd], addr, mem_index, mop); =20 /* Verify alignment if needed. */ - if ((dc->cpu->env.pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && size > 1) { + if (dc->cpu->cfg.unaligned_exceptions && size > 1) { TCGv_i32 t1 =3D tcg_const_i32(1); TCGv_i32 treg =3D tcg_const_i32(dc->rd); TCGv_i32 tsize =3D tcg_const_i32(size - 1); --=20 2.20.1