From nobody Tue May 7 08:49:49 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1622711123; cv=none; d=zohomail.com; s=zohoarc; b=TAAywAOyzLRQhBYjXxePC4gs3gNHOMiO9XTklK+VAw/isANZMlxOsedRP0fAS1MzONa654acxfTICeFcKz7R7XroKFFN2C6VkF9ZYW6piMbHBbqxASUpKmsh6PtNUBNOFHJG5rYdTWzEZ6PbRKFcwfJOyM/Ny/VKrLqZPnfBidk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622711123; h=Content-Type: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=ycDqdBNMfE6sy0aNiEZr8G7a3sAQ4DzhtUJazHFG448=; b=lDpDrnuB8rVvYWl1QpKIOkgutHLQtAVYi/zdT4JICN3uHg+oGIiwa2l+bHXPMWJYtUja3ONwGX4UV0RwIeftSsahXHiJVAsy4UXISIqTr6HMG0WIDLKMjyHm2GTv3VX07JNDatY5H9dXWnCoRxLIevZTHnRTuU4pvk4lnCIVvBk= 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+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622711123745533.6015998411434; Thu, 3 Jun 2021 02:05:23 -0700 (PDT) Received: from localhost ([::1]:38316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lojI2-0006Si-NV for importer2@patchew.org; Thu, 03 Jun 2021 05:05:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lojG4-0003qM-Tk for qemu-devel@nongnu.org; Thu, 03 Jun 2021 05:03:21 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:45802) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lojG3-0008Vn-EF for qemu-devel@nongnu.org; Thu, 03 Jun 2021 05:03:20 -0400 Received: by mail-ej1-x635.google.com with SMTP id k7so8068096ejv.12 for ; Thu, 03 Jun 2021 02:03:18 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id z19sm491776edr.77.2021.06.03.02.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 02:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ycDqdBNMfE6sy0aNiEZr8G7a3sAQ4DzhtUJazHFG448=; b=Gb1x1GerQQu/ps4AXoeAG0KMSGDYzaSDzSNDL7UCCzwonF03v50XjR3qAczlHcK5/B GNaXbKvfKw3CXgKa6CSouH/FSFQclrEH50LobGdXLNOeKxE/xV1TSHWoCcQqwQ1nzNOe ZCYqdNhI7jmt7zLxF6tc9VS6/A6pujkOU75JzPxLhYb9hNoh6rqG+Zj1TmI80DnVsy9/ qKsrLtSzyLykBfI10cw2pQWoqMKHRm0DSzoCqFyIcTxa0/oHROkPs5TIqsh54B7Q/tMd vO29QNkdFNgVFS+v59SbS3UYSTKdyijdarIK8ZNbipsuIjpyRXkcbIlamvXibtvW4Mws qPdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ycDqdBNMfE6sy0aNiEZr8G7a3sAQ4DzhtUJazHFG448=; b=mPmSkvhfv1sDkEN2m8mAcdtYbfNSpDDYYN7p4tGo7X4WnaXDDmJwkW92D3/mCZZCML ElcCYzhHUUIROrvsGoWvDSvONBUPs8sKdJnJt6nRD1mAxGKD263XqOGPcJ9jim9vEbsA z0wa7WSZIa9eyt8mXIpe9lRKPyswiIJKsOynQDAw63vD5LJGPIr5mzISS/Ofq+KovwWl YchpYp8ZVIRQMdZAwdUvggekJst44ndUphUPtt+byLDgGamshrLBfUrJlnovD8pXyW5k MdOgdOhwIvhr7xkieBYStt3OojM7KXXfbTXahRdqMPUhi5YqcyJ5wTKFvqdcXF4yoVGX L0Ig== X-Gm-Message-State: AOAM530h/bkSGXur7fiqF2XeMb1T73HN6th0E2Qm35eCUAIF2SvHBs9o GsgH6oZbbj1dMDAXaZY1AtBWtYEw8S5Hqw== X-Google-Smtp-Source: ABdhPJwso4LzkdxtufJAanXZwFgGzbjUIjTPycJPJsabexUSQrZuEUzbFauLC0IUYu3bjJdsvtfSSg== X-Received: by 2002:a17:906:180a:: with SMTP id v10mr5955483eje.22.1622710997629; Thu, 03 Jun 2021 02:03:17 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 1/6] target/microblaze: Use the IEC binary prefix definitions Date: Thu, 3 Jun 2021 11:03:05 +0200 Message-Id: <20210603090310.2749892-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210603090310.2749892-1-f4bug@amsat.org> References: <20210603090310.2749892-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E. Iglesias" , Richard Henderson , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) IEC binary prefixes ease code review: the unit is explicit. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Reviewed-by: Edgar E. Iglesias Reviewed-by: Richard Henderson --- target/microblaze/mmu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/microblaze/mmu.c b/target/microblaze/mmu.c index cc40f275eaf..1481e2769f1 100644 --- a/target/microblaze/mmu.c +++ b/target/microblaze/mmu.c @@ -19,14 +19,15 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include "cpu.h" #include "exec/exec-all.h" =20 static unsigned int tlb_decode_size(unsigned int f) { static const unsigned int sizes[] =3D { - 1 * 1024, 4 * 1024, 16 * 1024, 64 * 1024, 256 * 1024, - 1 * 1024 * 1024, 4 * 1024 * 1024, 16 * 1024 * 1024 + 1 * KiB, 4 * KiB, 16 * KiB, 64 * KiB, 256 * KiB, + 1 * MiB, 4 * MiB, 16 * MiB }; assert(f < ARRAY_SIZE(sizes)); return sizes[f]; --=20 2.26.3 From nobody Tue May 7 08:49:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1622711251; cv=none; d=zohomail.com; s=zohoarc; b=MlIgAMS6NLY53MtKY/+M0/RgVkt8Ahh5hHWrtzkchBN+0ISAGjNMaVpkkXJcEKoH9DG3ZpjUm2qT1M4ed1KI6KxERDu0BAchJimJC6LAEMQATveYVOg5GZMQIk3HbE72+ypgp1J7TSKQg8enbCCtAaD/i0vBm84K9pvHOa7EcLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622711251; h=Content-Type: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=o0IJ99GBNBgLTCqp2mtuSzLlVDmKBunZStjd7bCnLMU=; b=VNiyiGwUgNEpIpCRQZPtkN06nYdkzeyd/GPDg60oGo4GZQfviQgY0bA+yUnLpahk1LO/kr26JKoBVVAvOxpClcRwn9EkfBYol+QSPJCxggAZCsZTISORZ2r4/FtCHxdBM3a9X2KRDJ0udElFIVJWexHNWD6zMdfeHkYhmL0FOSk= 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+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622711251235319.75089161690323; Thu, 3 Jun 2021 02:07:31 -0700 (PDT) Received: from localhost ([::1]:44964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lojK6-0002YA-1J for importer2@patchew.org; Thu, 03 Jun 2021 05:07:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lojGB-0003tC-LL for qemu-devel@nongnu.org; Thu, 03 Jun 2021 05:03:29 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:41560) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lojG9-00007m-3i for qemu-devel@nongnu.org; Thu, 03 Jun 2021 05:03:27 -0400 Received: by mail-ed1-x529.google.com with SMTP id g18so4223130edq.8 for ; Thu, 03 Jun 2021 02:03:24 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id t14sm1419253edv.27.2021.06.03.02.03.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 02:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o0IJ99GBNBgLTCqp2mtuSzLlVDmKBunZStjd7bCnLMU=; b=Umd0SHxEJxu7y1eAGW3T4MiU1jZcRufZwB/BjqG27nmQ0gQPmABCWmC5TPyUFyrHAt vcnZrhAdDcWOTby+el7frCZ7PwJrxh0Uc2tJfqCvF0RLAClKqj8bn5igqdAq5MXXrTJq IalDI8XH4VI6rlU1Up8MrDSthXhpl5bfy2xZRW/qbcbxcPwNeDrwxWaoGKNbqdOZtQVL GZbp9sSENbEitExy4qYcUuL6+wDLWLgufNXX1JbP+GbDDJFKAm8KIZE8r2nnh6+oj1i3 YHdq8XxMTq7zzmPyg37OU8KTd2tamtWYu/xoKEMYnnuyJbJtexHAitdOfC6kMlGxwvu5 h/Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=o0IJ99GBNBgLTCqp2mtuSzLlVDmKBunZStjd7bCnLMU=; b=Z6UOwrrQIk2vNikKaAIcBV9mQBXa0zefOeLcbDE35jsJsrdilz3L0wOxhzu5qVrrGg y5OWhU1+ZcvJ5qZUseHOpVJ1UIMU0eNgkakKb/aMrVQ6thYkVipJVn0343ZKgRAgcSrC xD1bwbtiKu2fsG9bg4NcbLaA6CLo9qWuqlROf5mXc13B1FInaw7ikYb2yho0YP7FkpoZ 4A5UnlFfiMMv8j9+/kvVCadsaawyaPXC/+BoVTrE4QiHaSvqx5qr8plD9SZ62Wg71Hfn cT/MRxFSAtkpLlahLUMOJAS+DfukzNPUUeN4yAOQ9agOqil9xY/6JKgybgJCs1fdgzJz oF9A== X-Gm-Message-State: AOAM530hgxn3r/vqwMn0+kYw1KeBDvsfnyvapambAYqfeyXW4Lwim2VO 3Hbpy6BFN3RmwrWEW+IWaCCVrivTPL0wEg== X-Google-Smtp-Source: ABdhPJxK2MFlFXwzQspEnvi25vfQrcPApLMakZQZRv5Bj022TCXEPYReDUW65GKIGUkCmLTPfs6OQQ== X-Received: by 2002:a05:6402:548:: with SMTP id i8mr6356535edx.344.1622711002636; Thu, 03 Jun 2021 02:03:22 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 2/6] target/microblaze: Extract FPU helpers to fpu_helper.c Date: Thu, 3 Jun 2021 11:03:06 +0200 Message-Id: <20210603090310.2749892-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210603090310.2749892-1-f4bug@amsat.org> References: <20210603090310.2749892-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ed1-x529.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E. Iglesias" , Richard Henderson , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Extract FPU helpers to their own file: fpu_helper.c, so it is easier to focus on the generic helpers in op_helper.c. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Reviewed-by: Edgar E. Iglesias --- target/microblaze/fpu_helper.c | 308 +++++++++++++++++++++++++++++++++ target/microblaze/op_helper.c | 287 +----------------------------- target/microblaze/meson.build | 1 + 3 files changed, 310 insertions(+), 286 deletions(-) create mode 100644 target/microblaze/fpu_helper.c diff --git a/target/microblaze/fpu_helper.c b/target/microblaze/fpu_helper.c new file mode 100644 index 00000000000..ce729947079 --- /dev/null +++ b/target/microblaze/fpu_helper.c @@ -0,0 +1,308 @@ +/* + * Microblaze FPU helper routines. + * + * Copyright (c) 2009 Edgar E. Iglesias . + * Copyright (c) 2009-2012 PetaLogix Qld Pty Ltd. + * + * 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.1 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 "cpu.h" +#include "exec/helper-proto.h" +#include "exec/exec-all.h" +#include "fpu/softfloat.h" + +static bool check_divz(CPUMBState *env, uint32_t a, uint32_t b, uintptr_t = ra) +{ + if (unlikely(b =3D=3D 0)) { + env->msr |=3D MSR_DZ; + + if ((env->msr & MSR_EE) && + env_archcpu(env)->cfg.div_zero_exception) { + CPUState *cs =3D env_cpu(env); + + env->esr =3D ESR_EC_DIVZERO; + cs->exception_index =3D EXCP_HW_EXCP; + cpu_loop_exit_restore(cs, ra); + } + return false; + } + return true; +} + +uint32_t helper_divs(CPUMBState *env, uint32_t a, uint32_t b) +{ + if (!check_divz(env, a, b, GETPC())) { + return 0; + } + return (int32_t)a / (int32_t)b; +} + +uint32_t helper_divu(CPUMBState *env, uint32_t a, uint32_t b) +{ + if (!check_divz(env, a, b, GETPC())) { + return 0; + } + return a / b; +} + +/* raise FPU exception. */ +static void raise_fpu_exception(CPUMBState *env, uintptr_t ra) +{ + CPUState *cs =3D env_cpu(env); + + env->esr =3D ESR_EC_FPU; + cs->exception_index =3D EXCP_HW_EXCP; + cpu_loop_exit_restore(cs, ra); +} + +static void update_fpu_flags(CPUMBState *env, int flags, uintptr_t ra) +{ + int raise =3D 0; + + if (flags & float_flag_invalid) { + env->fsr |=3D FSR_IO; + raise =3D 1; + } + if (flags & float_flag_divbyzero) { + env->fsr |=3D FSR_DZ; + raise =3D 1; + } + if (flags & float_flag_overflow) { + env->fsr |=3D FSR_OF; + raise =3D 1; + } + if (flags & float_flag_underflow) { + env->fsr |=3D FSR_UF; + raise =3D 1; + } + if (raise + && (env_archcpu(env)->cfg.pvr_regs[2] & PVR2_FPU_EXC_MASK) + && (env->msr & MSR_EE)) { + raise_fpu_exception(env, ra); + } +} + +uint32_t helper_fadd(CPUMBState *env, uint32_t a, uint32_t b) +{ + CPU_FloatU fd, fa, fb; + int flags; + + set_float_exception_flags(0, &env->fp_status); + fa.l =3D a; + fb.l =3D b; + fd.f =3D float32_add(fa.f, fb.f, &env->fp_status); + + flags =3D get_float_exception_flags(&env->fp_status); + update_fpu_flags(env, flags, GETPC()); + return fd.l; +} + +uint32_t helper_frsub(CPUMBState *env, uint32_t a, uint32_t b) +{ + CPU_FloatU fd, fa, fb; + int flags; + + set_float_exception_flags(0, &env->fp_status); + fa.l =3D a; + fb.l =3D b; + fd.f =3D float32_sub(fb.f, fa.f, &env->fp_status); + flags =3D get_float_exception_flags(&env->fp_status); + update_fpu_flags(env, flags, GETPC()); + return fd.l; +} + +uint32_t helper_fmul(CPUMBState *env, uint32_t a, uint32_t b) +{ + CPU_FloatU fd, fa, fb; + int flags; + + set_float_exception_flags(0, &env->fp_status); + fa.l =3D a; + fb.l =3D b; + fd.f =3D float32_mul(fa.f, fb.f, &env->fp_status); + flags =3D get_float_exception_flags(&env->fp_status); + update_fpu_flags(env, flags, GETPC()); + + return fd.l; +} + +uint32_t helper_fdiv(CPUMBState *env, uint32_t a, uint32_t b) +{ + CPU_FloatU fd, fa, fb; + int flags; + + set_float_exception_flags(0, &env->fp_status); + fa.l =3D a; + fb.l =3D b; + fd.f =3D float32_div(fb.f, fa.f, &env->fp_status); + flags =3D get_float_exception_flags(&env->fp_status); + update_fpu_flags(env, flags, GETPC()); + + return fd.l; +} + +uint32_t helper_fcmp_un(CPUMBState *env, uint32_t a, uint32_t b) +{ + CPU_FloatU fa, fb; + uint32_t r =3D 0; + + fa.l =3D a; + fb.l =3D b; + + if (float32_is_signaling_nan(fa.f, &env->fp_status) || + float32_is_signaling_nan(fb.f, &env->fp_status)) { + update_fpu_flags(env, float_flag_invalid, GETPC()); + r =3D 1; + } + + if (float32_is_quiet_nan(fa.f, &env->fp_status) || + float32_is_quiet_nan(fb.f, &env->fp_status)) { + r =3D 1; + } + + return r; +} + +uint32_t helper_fcmp_lt(CPUMBState *env, uint32_t a, uint32_t b) +{ + CPU_FloatU fa, fb; + int r; + int flags; + + set_float_exception_flags(0, &env->fp_status); + fa.l =3D a; + fb.l =3D b; + r =3D float32_lt(fb.f, fa.f, &env->fp_status); + flags =3D get_float_exception_flags(&env->fp_status); + update_fpu_flags(env, flags & float_flag_invalid, GETPC()); + + return r; +} + +uint32_t helper_fcmp_eq(CPUMBState *env, uint32_t a, uint32_t b) +{ + CPU_FloatU fa, fb; + int flags; + int r; + + set_float_exception_flags(0, &env->fp_status); + fa.l =3D a; + fb.l =3D b; + r =3D float32_eq_quiet(fa.f, fb.f, &env->fp_status); + flags =3D get_float_exception_flags(&env->fp_status); + update_fpu_flags(env, flags & float_flag_invalid, GETPC()); + + return r; +} + +uint32_t helper_fcmp_le(CPUMBState *env, uint32_t a, uint32_t b) +{ + CPU_FloatU fa, fb; + int flags; + int r; + + fa.l =3D a; + fb.l =3D b; + set_float_exception_flags(0, &env->fp_status); + r =3D float32_le(fa.f, fb.f, &env->fp_status); + flags =3D get_float_exception_flags(&env->fp_status); + update_fpu_flags(env, flags & float_flag_invalid, GETPC()); + + + return r; +} + +uint32_t helper_fcmp_gt(CPUMBState *env, uint32_t a, uint32_t b) +{ + CPU_FloatU fa, fb; + int flags, r; + + fa.l =3D a; + fb.l =3D b; + set_float_exception_flags(0, &env->fp_status); + r =3D float32_lt(fa.f, fb.f, &env->fp_status); + flags =3D get_float_exception_flags(&env->fp_status); + update_fpu_flags(env, flags & float_flag_invalid, GETPC()); + return r; +} + +uint32_t helper_fcmp_ne(CPUMBState *env, uint32_t a, uint32_t b) +{ + CPU_FloatU fa, fb; + int flags, r; + + fa.l =3D a; + fb.l =3D b; + set_float_exception_flags(0, &env->fp_status); + r =3D !float32_eq_quiet(fa.f, fb.f, &env->fp_status); + flags =3D get_float_exception_flags(&env->fp_status); + update_fpu_flags(env, flags & float_flag_invalid, GETPC()); + + return r; +} + +uint32_t helper_fcmp_ge(CPUMBState *env, uint32_t a, uint32_t b) +{ + CPU_FloatU fa, fb; + int flags, r; + + fa.l =3D a; + fb.l =3D b; + set_float_exception_flags(0, &env->fp_status); + r =3D !float32_lt(fa.f, fb.f, &env->fp_status); + flags =3D get_float_exception_flags(&env->fp_status); + update_fpu_flags(env, flags & float_flag_invalid, GETPC()); + + return r; +} + +uint32_t helper_flt(CPUMBState *env, uint32_t a) +{ + CPU_FloatU fd, fa; + + fa.l =3D a; + fd.f =3D int32_to_float32(fa.l, &env->fp_status); + return fd.l; +} + +uint32_t helper_fint(CPUMBState *env, uint32_t a) +{ + CPU_FloatU fa; + uint32_t r; + int flags; + + set_float_exception_flags(0, &env->fp_status); + fa.l =3D a; + r =3D float32_to_int32(fa.f, &env->fp_status); + flags =3D get_float_exception_flags(&env->fp_status); + update_fpu_flags(env, flags, GETPC()); + + return r; +} + +uint32_t helper_fsqrt(CPUMBState *env, uint32_t a) +{ + CPU_FloatU fd, fa; + int flags; + + set_float_exception_flags(0, &env->fp_status); + fa.l =3D a; + fd.l =3D float32_sqrt(fa.f, &env->fp_status); + flags =3D get_float_exception_flags(&env->fp_status); + update_fpu_flags(env, flags, GETPC()); + + return fd.l; +} diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index 58d633584d3..8d20522ee88 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -21,10 +21,8 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/helper-proto.h" -#include "qemu/host-utils.h" +#include "qemu/log.h" #include "exec/exec-all.h" -#include "exec/cpu_ldst.h" -#include "fpu/softfloat.h" =20 void helper_put(uint32_t id, uint32_t ctrl, uint32_t data) { @@ -69,289 +67,6 @@ void helper_raise_exception(CPUMBState *env, uint32_t i= ndex) cpu_loop_exit(cs); } =20 -static bool check_divz(CPUMBState *env, uint32_t a, uint32_t b, uintptr_t = ra) -{ - if (unlikely(b =3D=3D 0)) { - env->msr |=3D MSR_DZ; - - if ((env->msr & MSR_EE) && - env_archcpu(env)->cfg.div_zero_exception) { - CPUState *cs =3D env_cpu(env); - - env->esr =3D ESR_EC_DIVZERO; - cs->exception_index =3D EXCP_HW_EXCP; - cpu_loop_exit_restore(cs, ra); - } - return false; - } - return true; -} - -uint32_t helper_divs(CPUMBState *env, uint32_t a, uint32_t b) -{ - if (!check_divz(env, a, b, GETPC())) { - return 0; - } - return (int32_t)a / (int32_t)b; -} - -uint32_t helper_divu(CPUMBState *env, uint32_t a, uint32_t b) -{ - if (!check_divz(env, a, b, GETPC())) { - return 0; - } - return a / b; -} - -/* raise FPU exception. */ -static void raise_fpu_exception(CPUMBState *env, uintptr_t ra) -{ - CPUState *cs =3D env_cpu(env); - - env->esr =3D ESR_EC_FPU; - cs->exception_index =3D EXCP_HW_EXCP; - cpu_loop_exit_restore(cs, ra); -} - -static void update_fpu_flags(CPUMBState *env, int flags, uintptr_t ra) -{ - int raise =3D 0; - - if (flags & float_flag_invalid) { - env->fsr |=3D FSR_IO; - raise =3D 1; - } - if (flags & float_flag_divbyzero) { - env->fsr |=3D FSR_DZ; - raise =3D 1; - } - if (flags & float_flag_overflow) { - env->fsr |=3D FSR_OF; - raise =3D 1; - } - if (flags & float_flag_underflow) { - env->fsr |=3D FSR_UF; - raise =3D 1; - } - if (raise - && (env_archcpu(env)->cfg.pvr_regs[2] & PVR2_FPU_EXC_MASK) - && (env->msr & MSR_EE)) { - raise_fpu_exception(env, ra); - } -} - -uint32_t helper_fadd(CPUMBState *env, uint32_t a, uint32_t b) -{ - CPU_FloatU fd, fa, fb; - int flags; - - set_float_exception_flags(0, &env->fp_status); - fa.l =3D a; - fb.l =3D b; - fd.f =3D float32_add(fa.f, fb.f, &env->fp_status); - - flags =3D get_float_exception_flags(&env->fp_status); - update_fpu_flags(env, flags, GETPC()); - return fd.l; -} - -uint32_t helper_frsub(CPUMBState *env, uint32_t a, uint32_t b) -{ - CPU_FloatU fd, fa, fb; - int flags; - - set_float_exception_flags(0, &env->fp_status); - fa.l =3D a; - fb.l =3D b; - fd.f =3D float32_sub(fb.f, fa.f, &env->fp_status); - flags =3D get_float_exception_flags(&env->fp_status); - update_fpu_flags(env, flags, GETPC()); - return fd.l; -} - -uint32_t helper_fmul(CPUMBState *env, uint32_t a, uint32_t b) -{ - CPU_FloatU fd, fa, fb; - int flags; - - set_float_exception_flags(0, &env->fp_status); - fa.l =3D a; - fb.l =3D b; - fd.f =3D float32_mul(fa.f, fb.f, &env->fp_status); - flags =3D get_float_exception_flags(&env->fp_status); - update_fpu_flags(env, flags, GETPC()); - - return fd.l; -} - -uint32_t helper_fdiv(CPUMBState *env, uint32_t a, uint32_t b) -{ - CPU_FloatU fd, fa, fb; - int flags; - - set_float_exception_flags(0, &env->fp_status); - fa.l =3D a; - fb.l =3D b; - fd.f =3D float32_div(fb.f, fa.f, &env->fp_status); - flags =3D get_float_exception_flags(&env->fp_status); - update_fpu_flags(env, flags, GETPC()); - - return fd.l; -} - -uint32_t helper_fcmp_un(CPUMBState *env, uint32_t a, uint32_t b) -{ - CPU_FloatU fa, fb; - uint32_t r =3D 0; - - fa.l =3D a; - fb.l =3D b; - - if (float32_is_signaling_nan(fa.f, &env->fp_status) || - float32_is_signaling_nan(fb.f, &env->fp_status)) { - update_fpu_flags(env, float_flag_invalid, GETPC()); - r =3D 1; - } - - if (float32_is_quiet_nan(fa.f, &env->fp_status) || - float32_is_quiet_nan(fb.f, &env->fp_status)) { - r =3D 1; - } - - return r; -} - -uint32_t helper_fcmp_lt(CPUMBState *env, uint32_t a, uint32_t b) -{ - CPU_FloatU fa, fb; - int r; - int flags; - - set_float_exception_flags(0, &env->fp_status); - fa.l =3D a; - fb.l =3D b; - r =3D float32_lt(fb.f, fa.f, &env->fp_status); - flags =3D get_float_exception_flags(&env->fp_status); - update_fpu_flags(env, flags & float_flag_invalid, GETPC()); - - return r; -} - -uint32_t helper_fcmp_eq(CPUMBState *env, uint32_t a, uint32_t b) -{ - CPU_FloatU fa, fb; - int flags; - int r; - - set_float_exception_flags(0, &env->fp_status); - fa.l =3D a; - fb.l =3D b; - r =3D float32_eq_quiet(fa.f, fb.f, &env->fp_status); - flags =3D get_float_exception_flags(&env->fp_status); - update_fpu_flags(env, flags & float_flag_invalid, GETPC()); - - return r; -} - -uint32_t helper_fcmp_le(CPUMBState *env, uint32_t a, uint32_t b) -{ - CPU_FloatU fa, fb; - int flags; - int r; - - fa.l =3D a; - fb.l =3D b; - set_float_exception_flags(0, &env->fp_status); - r =3D float32_le(fa.f, fb.f, &env->fp_status); - flags =3D get_float_exception_flags(&env->fp_status); - update_fpu_flags(env, flags & float_flag_invalid, GETPC()); - - - return r; -} - -uint32_t helper_fcmp_gt(CPUMBState *env, uint32_t a, uint32_t b) -{ - CPU_FloatU fa, fb; - int flags, r; - - fa.l =3D a; - fb.l =3D b; - set_float_exception_flags(0, &env->fp_status); - r =3D float32_lt(fa.f, fb.f, &env->fp_status); - flags =3D get_float_exception_flags(&env->fp_status); - update_fpu_flags(env, flags & float_flag_invalid, GETPC()); - return r; -} - -uint32_t helper_fcmp_ne(CPUMBState *env, uint32_t a, uint32_t b) -{ - CPU_FloatU fa, fb; - int flags, r; - - fa.l =3D a; - fb.l =3D b; - set_float_exception_flags(0, &env->fp_status); - r =3D !float32_eq_quiet(fa.f, fb.f, &env->fp_status); - flags =3D get_float_exception_flags(&env->fp_status); - update_fpu_flags(env, flags & float_flag_invalid, GETPC()); - - return r; -} - -uint32_t helper_fcmp_ge(CPUMBState *env, uint32_t a, uint32_t b) -{ - CPU_FloatU fa, fb; - int flags, r; - - fa.l =3D a; - fb.l =3D b; - set_float_exception_flags(0, &env->fp_status); - r =3D !float32_lt(fa.f, fb.f, &env->fp_status); - flags =3D get_float_exception_flags(&env->fp_status); - update_fpu_flags(env, flags & float_flag_invalid, GETPC()); - - return r; -} - -uint32_t helper_flt(CPUMBState *env, uint32_t a) -{ - CPU_FloatU fd, fa; - - fa.l =3D a; - fd.f =3D int32_to_float32(fa.l, &env->fp_status); - return fd.l; -} - -uint32_t helper_fint(CPUMBState *env, uint32_t a) -{ - CPU_FloatU fa; - uint32_t r; - int flags; - - set_float_exception_flags(0, &env->fp_status); - fa.l =3D a; - r =3D float32_to_int32(fa.f, &env->fp_status); - flags =3D get_float_exception_flags(&env->fp_status); - update_fpu_flags(env, flags, GETPC()); - - return r; -} - -uint32_t helper_fsqrt(CPUMBState *env, uint32_t a) -{ - CPU_FloatU fd, fa; - int flags; - - set_float_exception_flags(0, &env->fp_status); - fa.l =3D a; - fd.l =3D float32_sqrt(fa.f, &env->fp_status); - flags =3D get_float_exception_flags(&env->fp_status); - update_fpu_flags(env, flags, GETPC()); - - return fd.l; -} - uint32_t helper_pcmpbf(uint32_t a, uint32_t b) { unsigned int i; diff --git a/target/microblaze/meson.build b/target/microblaze/meson.build index 05ee0ec1635..0a5e46027af 100644 --- a/target/microblaze/meson.build +++ b/target/microblaze/meson.build @@ -4,6 +4,7 @@ microblaze_ss.add(gen) microblaze_ss.add(files( 'cpu.c', + 'fpu_helper.c', 'gdbstub.c', 'helper.c', 'op_helper.c', --=20 2.26.3 From nobody Tue May 7 08:49:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1622711122; cv=none; d=zohomail.com; s=zohoarc; b=XvaY4YSbSrrNLE3HBxVF4dcTf8mYKq/4eR1vyjmCivoD/C2gVHwyZwtP/sjcdD4FrQAmzLqLRPAqhrTXTSwG79AZA5klQgN8FCPk66KVF3XqT2SyTtKA3A/WfnA6BNhogcXo6bmswDV7BIVXjd3vXWAUOmG15bytwtTdVvhyUkA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622711122; h=Content-Type: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=5sevVFrnb8PFEJqb8tjfwJ5PpGOfYaPfNnd2GAELM28=; b=K95n4dLT1qez1F8lyBS6Sn895+GCb2TjVU9x/W7Tm66XJVyTSi9HD5VIBvN7dbXxbtHX+LDx45j/OLCY/3zmgDBSz6aqpCdvg+w2dvBU7PLdL0e1hLDO4rWAzd8Nxnbjyy5xesdOvjpxRTzeHcKp9DHcRSNRQiGpxml1O4g5lms= 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+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622711122688919.4243371422125; Thu, 3 Jun 2021 02:05:22 -0700 (PDT) Received: from localhost ([::1]:38234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lojI1-0006PS-MB for importer2@patchew.org; Thu, 03 Jun 2021 05:05:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lojGE-0003uG-Df for qemu-devel@nongnu.org; Thu, 03 Jun 2021 05:03:31 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:36444) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lojGD-0000B8-42 for qemu-devel@nongnu.org; Thu, 03 Jun 2021 05:03:30 -0400 Received: by mail-ed1-x531.google.com with SMTP id w21so6129647edv.3 for ; Thu, 03 Jun 2021 02:03:28 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id i12sm1412143edx.13.2021.06.03.02.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 02:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5sevVFrnb8PFEJqb8tjfwJ5PpGOfYaPfNnd2GAELM28=; b=spT1DOgqGrG7fS96sbEzZX1jWqOkX2yKvAoAzo/hvMRUZkMejLSHUVomZU9dmDXk83 ySsS+9wV1BZrS3dtOPrronExChdfjh70HI8N8pkeXHduZP4CLl07xVYoWNnf0c5gOTst jL9pu2WCTaFKrdqRmVhKB8Sy302lGnnI1uobLGH9RaDhdcZ2S6S4neMBVRa/8uy8uCls jt7Ajotnu++pIHuK9VGw3lldH5ebGy5Ph3ZA/umO+yhMIQLXbL1CpaRMei4E9LvNJ4AH LtO91kbKzV4qvV252XgDgKiI9GrGqVkE3R7Bkc0kavQKepjcQy00NquCvU9P1t8ADyFU xKyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=5sevVFrnb8PFEJqb8tjfwJ5PpGOfYaPfNnd2GAELM28=; b=B8PWEiJkv7IDBPAaC1wiiLsx9/ExD/Ie+A9+5LH6Yjn3VGwwFQnJFzCCOMm4Lu0TAt OkOdT1DWHuKA80FalqZKB7t3aHuzaxvdQTr+yMuhgj0yd4/rLNWT5XBYLKsWWrSoyxcU NKzw5FHs0iGqxwdB2JYRMcWjpZuOAl1rtydVlk5N77LNBL0wUqoQJI7a/jJiik7TWmQf 3gS2+szukPWLqitOrFbqFWJBm1Qvg61TVXm6NStTB/+l5QiYJvuQlJkwKC6sSz3WkfA8 BdhGoTaAi0mxwMkYlCNTPuBDsvkoIzswJmqam74u2mE7PS8SDKytUUmBlHz9pbU0d2En Y4yA== X-Gm-Message-State: AOAM531whg0+jHLiF6LUj34/76WDxemXHjpQ+Z/qMCJUpZEIIhSn2mRh eq36eZJoO328I9LsqmOjRnJBLNWXJjzKig== X-Google-Smtp-Source: ABdhPJw0l2ndqqHOCmeS+6Z9vZBweHDQFaWjuseXXATWzkfB7GmQ5MF7ZBMv8gmWSBMlKW2L9/tk2g== X-Received: by 2002:aa7:ca50:: with SMTP id j16mr11466174edt.158.1622711007594; Thu, 03 Jun 2021 02:03:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 3/6] target/microblaze: Assert transaction failures have exception enabled Date: Thu, 3 Jun 2021 11:03:07 +0200 Message-Id: <20210603090310.2749892-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210603090310.2749892-1-f4bug@amsat.org> References: <20210603090310.2749892-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ed1-x531.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E. Iglesias" , Richard Henderson , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) If exceptions are disabled, we must not get a transaction failure. Assert they are enabled passed that point. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/microblaze/op_helper.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index 8d20522ee88..1048e656e27 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -122,9 +122,7 @@ void mb_cpu_transaction_failed(CPUState *cs, hwaddr phy= saddr, vaddr addr, access_type =3D=3D MMU_INST_FETCH ? "INST_FETCH" : (access_type =3D=3D MMU_DATA_LOAD ? "DATA_LOAD" : "DATA_= STORE")); =20 - if (!(env->msr & MSR_EE)) { - return; - } + assert(env->msr & MSR_EE); =20 if (access_type =3D=3D MMU_INST_FETCH) { if (!cpu->cfg.iopb_bus_exception) { --=20 2.26.3 From nobody Tue May 7 08:49:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1622711373; cv=none; d=zohomail.com; s=zohoarc; b=ZfRA771bEm3q+/uySEcVUTLrrPhqLoyZ8tu8b5R/eUld+ZMOac5G9xuGu27Zj7yZzJlL62Ua0cWn3jVi/AIt5I7wEUpMZO5jBCv+MuLAvZzUi2wu+bJFQYVIanVz1fDdSwz+aXV5BDhmMSbvGA0m7TbdpQ5zKfGLtekpVD/tTXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622711373; h=Content-Type: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=aPYdoGgpX0ZUspn+3dr8FCwIyeB5KG9UkLhwzhTVuOg=; b=C4x0a3i7uU2W7Qf0Iq9GzPijLCkvt6ku7l0PxXZTb86DfI8I/8wCQPL9GO6kTYbaB7mp1Qu+glreakLUHGEd1OHMWGhosmXnXNW/ba3oXaWio+fCFsY3/9nqsNW3M8EN0xuP4dINLYHE4MLZMr2vQcz8CJvotYrb/cLiR7gPnhs= 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+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162271137328530.518362992394486; Thu, 3 Jun 2021 02:09:33 -0700 (PDT) Received: from localhost ([::1]:50962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lojM4-0006Z7-9h for importer2@patchew.org; Thu, 03 Jun 2021 05:09:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lojGJ-0004Bh-Ba for qemu-devel@nongnu.org; Thu, 03 Jun 2021 05:03:35 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:33307) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lojGH-0000Fq-Uk for qemu-devel@nongnu.org; Thu, 03 Jun 2021 05:03:35 -0400 Received: by mail-ed1-x529.google.com with SMTP id f5so1221626eds.0 for ; Thu, 03 Jun 2021 02:03:33 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id f26sm1420082edu.31.2021.06.03.02.03.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 02:03:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aPYdoGgpX0ZUspn+3dr8FCwIyeB5KG9UkLhwzhTVuOg=; b=Eq+Fk8yQD30VFL6oOz6NItDgBROJ1Qec+eLXguO1ZdLG8IYAVemLbbY7KePaXUz3D6 DYffV6lnBh+nvNcvwUrDSY3J1vU2v78nxN3l3zGYARTfMRp1pBYpjBmlFnUJsqzOCd+a wxRtYKnVu4xYFx56rp0Fv2EsCLOReU4uvjrmVTAkrEkt114sqoXTovIxqHU42ykcHJaf 5uMxI5TF3oek6Wj2GuGD/rrAtjuu/2Qp1ZAYQDqhiHzplOoVECq30UpcpHU0cFN0QeRJ E15CzZE0BGCDrSy4jvf6Qi/1W4MEVl/UONaMvtl/42KfwbGZwgtCdOc2X0RCnNEPs7h8 2BHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=aPYdoGgpX0ZUspn+3dr8FCwIyeB5KG9UkLhwzhTVuOg=; b=hbtkRS/glzvYVOKsmcod3zekakOPMnpMRKOlwzgDUI/x3vZb57LplI/MQryW20uPkW uESux5auMxqLdezJB9fSkQM6y/6wuBZt+qcu3fajaTCZj+6BureFEdlzwInR0JzIYevb DFFAx64IbLVxsE3NYEWA0qtzM3Bqn+3e1RR1Tv4jkx9eJbpkZXEnq2zDQ6kmvfHDMKfv 3rpF/szDqHzmN3YM6wpwXNF0NrhgsnWoHIfgqd0f/IXCNCtmBAwKRytNLMfpB+qJHFHM bVf81jvwdoP6vmM0HcaLAfiP4DU2BY9iKFc6PRnA9UkEk523mLTdyvGl7kP0lIgzjJau DAwg== X-Gm-Message-State: AOAM5326x9YXQNKht+XSaTPAsDqwCpjvQd5F572Zc/S5GXkWkI4Ms0/9 is1Ir4SgbGv7O/rMWtLmy7X/wl7tMKBEXg== X-Google-Smtp-Source: ABdhPJyQ2hSmNBO3nLzxUeH0kAaoNbgrHsqjdXf7LNBgWW93RAUmxRyOG2Z+7aPismMUQRhGmaS/zw== X-Received: by 2002:a05:6402:44:: with SMTP id f4mr43212973edu.364.1622711012437; Thu, 03 Jun 2021 02:03:32 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 4/6] target/microblaze: Fix Exception Status Register 'Cause' definitions Date: Thu, 3 Jun 2021 11:03:08 +0200 Message-Id: <20210603090310.2749892-5-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210603090310.2749892-1-f4bug@amsat.org> References: <20210603090310.2749892-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ed1-x529.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E. Iglesias" , Richard Henderson , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) See 'MicroBlaze Processor Reference Guide' UG081 (v9.0), Table 1-11: "Exception Status Register (ESR)". Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- target/microblaze/cpu.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index e4bba8a7551..42b9ad8d313 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -95,10 +95,10 @@ typedef struct CPUMBState CPUMBState; #define ESR_EC_FPU 6 #define ESR_EC_PRIVINSN 7 #define ESR_EC_STACKPROT 7 /* Same as PRIVINSN. */ -#define ESR_EC_DATA_STORAGE 8 -#define ESR_EC_INSN_STORAGE 9 -#define ESR_EC_DATA_TLB 10 -#define ESR_EC_INSN_TLB 11 +#define ESR_EC_DATA_STORAGE 16 +#define ESR_EC_INSN_STORAGE 17 +#define ESR_EC_DATA_TLB 18 +#define ESR_EC_INSN_TLB 19 #define ESR_EC_MASK 31 =20 /* Floating Point Status Register (FSR) Bits */ --=20 2.26.3 From nobody Tue May 7 08:49:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1622711248; cv=none; d=zohomail.com; s=zohoarc; b=G6ttSCMp2iNnY3BdxL+oBxMcQriP2Ws8Ot9B7OTzIHO3QzlBTNhS8H92pipYKQ+sjfiapiRplOlyJhEpv5nGcAb1BgDxpkohoz/h+B1bocBc4a8sQdVFz8osulD1cnZ5eWs8DENwdMPDZUE54ftyiNdTWb8SbtQ8qfy1IcmAJns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622711248; h=Content-Type: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=+aq3bYmzCfrRF1OZBJAm7L1BFoguyeY0vM7CmI9EICc=; b=mfvPFjCJWorFHq6qG6Z4IBYrBsOYNhaZ5emVB3eM89laKXZxPdo6OEtHEFi1dHIYgWZtBiiHjbDg7Qq9cokMcyqQlF3LyaIsOkVeDY4F/C5oLt79UXb5PKhG4dTV5YQp7eEdZaktwZjJqol+b12wniaauZYdTeTByah90fGls8E= 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+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622711248552834.0841114209101; Thu, 3 Jun 2021 02:07:28 -0700 (PDT) Received: from localhost ([::1]:44804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lojK3-0002Rl-Ab for importer2@patchew.org; Thu, 03 Jun 2021 05:07:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lojGQ-0004a6-KA for qemu-devel@nongnu.org; Thu, 03 Jun 2021 05:03:42 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]:43620) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lojGM-0000Jb-RQ for qemu-devel@nongnu.org; Thu, 03 Jun 2021 05:03:40 -0400 Received: by mail-ed1-x532.google.com with SMTP id s6so6205665edu.10 for ; Thu, 03 Jun 2021 02:03:38 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id u1sm1380327edv.91.2021.06.03.02.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 02:03:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+aq3bYmzCfrRF1OZBJAm7L1BFoguyeY0vM7CmI9EICc=; b=iX1YCkrvg1cnb1i+Uo83gLbx0VLvoOJCo/g20HG7dJvzW9opJ1yXwPSR4f6UwzUZGO oWTtwoSIZiGGoulDKhwlG6xXOdTL8ptcqvxnwNWcjX9zzuLdQci23RuNudm4QJ2hxuSY zK33wfbIujZx1hHfXR1/S2F4LcPjbV7cM3zxLVnUBF7RkSAcdVc8c3JQ3uxzHOZ2nNFk /C2eQ8fF+7IBK4gXZfDFR/fPIPwNO10JNWXq9DFpe7qxjNOjdP9Kk2h/RIiKUZ7ToKm+ b4aR0OVamSEeIOGYKOFx+UcyM1cYibuf8/1Ty4P9lPy8AED//B0xtwzBLhfC08HzyW1D QmbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=+aq3bYmzCfrRF1OZBJAm7L1BFoguyeY0vM7CmI9EICc=; b=kgsS7GZmwijmytzQM14PvkOrTIyvY3tQ5izod/b6FTtxWkE4x2yKx2MOC8Bda8W5f1 ok/gsOXEWdR2wf3but6S1OYjAvnWKANxjWh8KPAnvCG54TYAB3Ww5uFTC68oYTeW+tvo kyOxXpwtkaZ31H9qQ+kjOH8DDCGSlU8mheAO91wlVQPf/iYvQ5MRXed2t/hOb5OO/Qee FOhkMKjMJB2o8WtYhpJroowFbT3DHepuIbGmTezyZu8LcrDLNplgnxw5+Y4N6O62z0rC +mI31zN2RipV0dJdC4KJHm0g4d0XQQIuKba+lOChZBcpdEOJu+Aw01hv3G7YtRElQ4C+ 8wuw== X-Gm-Message-State: AOAM53116SOpPQh4QMCNLK3QqzjqpgZb0Z4fuM1a5h+nmvzmK3SoLi+O 8jiX+hi6VYSqRXMmiY+tsfChniog6BdO/A== X-Google-Smtp-Source: ABdhPJz2l6GaL/M2V3y+cmBe/2MU0BPXO5o9vnFtKXR6Sr4RzOzk0m1areBGPbjYt8H6T1rbYNm5AQ== X-Received: by 2002:a05:6402:368:: with SMTP id s8mr27852654edw.129.1622711017284; Thu, 03 Jun 2021 02:03:37 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 5/6] target/microblaze: Replace magic values by proper definitions Date: Thu, 3 Jun 2021 11:03:09 +0200 Message-Id: <20210603090310.2749892-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210603090310.2749892-1-f4bug@amsat.org> References: <20210603090310.2749892-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ed1-x532.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E. Iglesias" , Richard Henderson , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Use the Exception Status Register definitions from "cpu.h". Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- target/microblaze/helper.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c index 20dbd673136..d537f300ca6 100644 --- a/target/microblaze/helper.c +++ b/target/microblaze/helper.c @@ -99,14 +99,22 @@ bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int s= ize, mmu_idx, address); =20 env->ear =3D address; + + env->esr =3D (access_type =3D=3D MMU_DATA_STORE) ? ESR_S : 0; switch (lu.err) { case ERR_PROT: - env->esr =3D access_type =3D=3D MMU_INST_FETCH ? 17 : 16; - env->esr |=3D (access_type =3D=3D MMU_DATA_STORE) << 10; + if (access_type =3D=3D MMU_INST_FETCH) { + env->esr |=3D ESR_EC_INSN_STORAGE; + } else { + env->esr |=3D ESR_EC_DATA_STORAGE; + } break; case ERR_MISS: - env->esr =3D access_type =3D=3D MMU_INST_FETCH ? 19 : 18; - env->esr |=3D (access_type =3D=3D MMU_DATA_STORE) << 10; + if (access_type =3D=3D MMU_INST_FETCH) { + env->esr |=3D ESR_EC_INSN_TLB; + } else { + env->esr |=3D ESR_EC_DATA_TLB; + } break; default: abort(); --=20 2.26.3 From nobody Tue May 7 08:49:50 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1622711386; cv=none; d=zohomail.com; s=zohoarc; b=UgQnJ1sh4YTXhnCzLcfYUy+mQyuplB7TXH8BIBamlaz0w4zukUIvBR+FIHLQqPqk8xwk1qUiHTHTVwgihUzmiuvBxcc0cclW1i1/KAX2pqJ1+PT5E2d9IjKDlVgd4HAapk0ZVm+7XZjq//2lG1JHemqqitayDtmraG4joTbyM/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622711386; h=Content-Type: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=O9+spEcANDKYx8HcPdHHRJ407zGYpuqHR7eNVlkhEK0=; b=czk3jzaFiiSQbbIH3Ln6bYtuvZzQrXpYuPs8go6Ov60joNH2vvYBSM0LFOqepqkbYbmc+NR3gZB/Rs8RL3vgq3MU08bDiTyFlBdn0mnpT9LLIKsG2P2KHjV2UpytruiZb7Gh/M3gTOSd5imoi8c8zOk7Bz02dJzK6QwRogfpGfo= 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+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622711386778794.7044680517511; Thu, 3 Jun 2021 02:09:46 -0700 (PDT) Received: from localhost ([::1]:51812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lojMH-00078z-Q6 for importer2@patchew.org; Thu, 03 Jun 2021 05:09:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lojGU-0004gs-HZ for qemu-devel@nongnu.org; Thu, 03 Jun 2021 05:03:48 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:34807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lojGS-0000Lm-AD for qemu-devel@nongnu.org; Thu, 03 Jun 2021 05:03:45 -0400 Received: by mail-ej1-x62b.google.com with SMTP id g8so8170755ejx.1 for ; Thu, 03 Jun 2021 02:03:43 -0700 (PDT) Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id r12sm1371078edv.82.2021.06.03.02.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 02:03:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O9+spEcANDKYx8HcPdHHRJ407zGYpuqHR7eNVlkhEK0=; b=P+GQzUDBJKchMe+VJFjm2byIVSgkNkT+dQHKhqtqG1WVw9NJCJ3jPz+OYPWU0QnrqJ 7lxK1rHTStON3JWralPF/3pDicxZRnORwl+Eg5Of8danL5m+QqQU50yVTjGxxXrK0WF+ MED/44icC6RiRI11Sl5mRoJYTuR4MOaEb4V+Uws5NZARR1yHcxlh194MlL4QDbR8Vz8L zKglPiY2c+zZ68u1DtYOqeOt67ff2uJA8DDaGiYn9mnsZDvE2Ece+H50MBsBgn3MEa+Q zLdTUcGOcfZK6HVC0WPfdbFXC+h91dzIUqBWehy1Sh465R1dJrgpmWIrA4I8/d6DbXfA o4Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=O9+spEcANDKYx8HcPdHHRJ407zGYpuqHR7eNVlkhEK0=; b=FIFw0nKZ2DFsSCtx2OHFy+jyjuHOEidSgufMZZsIxqsOJal4ZQuxT9umvOxg4PyGR6 Go3PDE3+Rq2AnHpBjBhWl9aCBXvH7kV1CBw+E9Ri2L14RvruykINk8udS7dQsxjtvAP/ IfHhhNyLbfpP5iKfQkoGYUMwY7eDS5FXhxOQq/R9EajYm1jJ8yyLIFxDsFT6wvq1/nlS 9kYVi3Ss8u+3jazVymVTLBDPIidMdoNoID+1Vnp55DmSPpJZBmXLtPvRgVnSgv8PMxa7 xHC+3i9mUugzAe/Xtx+pmL3J8lC3ib/eTfBasuZVzAXD5RJDPkspbC9ObOQueI7pqp7r uRgA== X-Gm-Message-State: AOAM530DCrJwLY9NoY/nZ3SBfGus9ZGQQk3zCz0GkTTqGfXozvjIzHth tfkg6MFqDU4diFOV2R0Zci+3vCDpaYq4Pg== X-Google-Smtp-Source: ABdhPJwEhVO/WNqBx4Wb2gI5thEygerLdYOLoPG9K7p1SprDxZcbEbt+HkrK3HYqgMpZn1dQ1QNJqg== X-Received: by 2002:a17:906:22c6:: with SMTP id q6mr38534524eja.275.1622711022264; Thu, 03 Jun 2021 02:03:42 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 6/6] target/microblaze: Set OPB bits in tlb_fill, not in transaction_failed Date: Thu, 3 Jun 2021 11:03:10 +0200 Message-Id: <20210603090310.2749892-7-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210603090310.2749892-1-f4bug@amsat.org> References: <20210603090310.2749892-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-x62b.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E. Iglesias" , Richard Henderson , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Per the 'MicroBlaze Processor Reference Guide' UG081 (v9.0), "Hardware Exceptions" chapter: Exception Causes: * Instruction Bus Exception The instruction On-chip Peripheral Bus exception is caused by an active error signal from the slave (IOPB_errAck) or timeout signal from the arbiter (IOPB_timeout). * Data Bus Exception The data On-chip Peripheral Bus exception is caused by an active error signal from the slave (DOPB_errAck) or timeout signal from the arbiter (DOPB_timeout). the table 1-24 (Processor Version Register 2): * IOPBEXC: Generate exception for IOPB error * DOPBEXC: Generate exception for DOPB error and the table 2-12 (MPD Parameters): * C_IOPB_BUS_EXCEPTION Enable exception handling for IOPB bus error * C_DOPB_BUS_EXCEPTION Enable exception handling for DOPB bus error So if PVR2.[ID]OPBEXC feature is disabled, no exception will be generated. Thus we can not get to the transaction_failed() handler. The ESR bits have to be set in tlb_fill(). However we never implemented the MMU check whether the address belong to the On-chip Peripheral Bus interface, so simply add a stub for it, warning the feature is not implemented. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/microblaze/helper.c | 19 +++++++++++++++++++ target/microblaze/op_helper.c | 13 ------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c index d537f300ca6..60e62bc0710 100644 --- a/target/microblaze/helper.c +++ b/target/microblaze/helper.c @@ -56,6 +56,18 @@ static bool mb_cpu_access_is_secure(MicroBlazeCPU *cpu, } } =20 +/* On-chip Peripheral Bus (OPB) interface */ +static bool mb_cpu_address_is_opb(MicroBlazeCPU *cpu, + vaddr address, unsigned size) +{ + if (cpu->cfg.iopb_bus_exception || cpu->cfg.dopb_bus_exception) { + /* TODO */ + warn_report_once("On-chip Peripheral Bus (OPB) interface " + "feature not implemented."); + } + return false; +} + bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr) @@ -119,6 +131,13 @@ bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int = size, default: abort(); } + if (mb_cpu_address_is_opb(cpu, address, size)) { + if (access_type =3D=3D MMU_INST_FETCH) { + env->esr =3D ESR_EC_INSN_BUS; + } else { + env->esr =3D ESR_EC_DATA_BUS; + } + } =20 if (cs->exception_index =3D=3D EXCP_MMU) { cpu_abort(cs, "recursive faults\n"); diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index 1048e656e27..171c4cf99a0 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -123,19 +123,6 @@ void mb_cpu_transaction_failed(CPUState *cs, hwaddr ph= ysaddr, vaddr addr, (access_type =3D=3D MMU_DATA_LOAD ? "DATA_LOAD" : "DATA_= STORE")); =20 assert(env->msr & MSR_EE); - - if (access_type =3D=3D MMU_INST_FETCH) { - if (!cpu->cfg.iopb_bus_exception) { - return; - } - env->esr =3D ESR_EC_INSN_BUS; - } else { - if (!cpu->cfg.dopb_bus_exception) { - return; - } - env->esr =3D ESR_EC_DATA_BUS; - } - env->ear =3D addr; cs->exception_index =3D EXCP_HW_EXCP; cpu_loop_exit_restore(cs, retaddr); --=20 2.26.3