From nobody Tue Feb 10 20:06:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.48 as permitted sender) client-ip=209.85.221.48; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f48.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.48 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1618859921; cv=none; d=zohomail.com; s=zohoarc; b=fOc/izksxGaYbC0fUB1RBjD55rnwo+AwNGrn0Gb9B01dYJAxhG0vCQBih+Wk5RlOaqL+8xSjv1zTMSgWBuoY4a9aK5j1+q876V9XUVSJ4l9+svzhPc0l9D/hgAyR8tho1VbevVzQaUiuzXQtnPZMMqyyXOOIYnllGhL6ZMeyvpQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618859921; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yMxvZRcRgCBUS8Ws91rPcuJR47xd/yHVMPRhORw6260=; b=Bs/T97Aa828P83XeLAOE6xS26X07zdSTbcK0xFTGW/7gu5LXRKhZ8kEnhOGSUKhQElQBrtYw9W8TNgKtErYxmRnUZJ0IsXsJjZxRo9rJa6f1F/a8RV6eb9lL8JbVbvZA9q8WHSH4jyHSCerg+9rzz6UVHP9kS7pKhpWsu7CBLy4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.48 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mx.zohomail.com with SMTPS id 1618859921560659.5700540351123; Mon, 19 Apr 2021 12:18:41 -0700 (PDT) Received: by mail-wr1-f48.google.com with SMTP id p6so28471615wrn.9 for ; Mon, 19 Apr 2021 12:18:40 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (39.red-81-40-121.staticip.rima-tde.net. [81.40.121.39]) by smtp.gmail.com with ESMTPSA id g5sm23970738wrq.30.2021.04.19.12.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 12:18:39 -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=yMxvZRcRgCBUS8Ws91rPcuJR47xd/yHVMPRhORw6260=; b=nQE502sHi5eGXJbb1fVxBwVrznc3AS7pXvc8Qa/ZpuNM+OG0Yfy8boGqOR1OfgOQhM 0ydB6OKTfl4YDhx9QM+yHiZZQuNC/eV+IjW9OW232W8EZLgUOPiq0zaHtZrHgDGVylXl bGpx1k+lhD2cmpHzljRV3YGWjxD8fypndsbfs6PDUgXqtedb1kHY23VCr0hN5jo4jBke FaaQt2tEVyPhL4rVWJklWVBdHiHCp1FnkE1CN3HeJQhGNTtHseBDf2YaiKBQ4dNKsUQc fTcBG8Ksma45W0RitXPZdSPgAphx2VTonrYLJoJcEmKGlVTyh0cj+zi+SW2IfFCEO1zZ fPsQ== 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=yMxvZRcRgCBUS8Ws91rPcuJR47xd/yHVMPRhORw6260=; b=blYPdh+anZCMkJ8G8ca7GJ2tRCFQu2hn3NVLxDv4Rkq1ME8EZqMdjfIY+f8O2GK8Z3 3GNOsB96F799NFg0UjC8/QGf83KtcUaDn6PSK76BDzvux9hr+YsfAwqBJbRQApzUUwRx qXuFchJijD2Z25yPjoZDfZgAERNdXRMBPojy4xk74Jn4EbsPQpX0Bo1aQyHS+EzgzJ6H hpD2tcoMpN0iAZYx5EXI0Fak4/gOqUonbkvkv4zWtoLXTYlD8xSml/e2aGD27n/zsKGF FyfByAkaJNdJTKb7BVPR5yxtYPYQKJ5XfGrWHffB4O9VZTqDvwG7jmIcikUDMYhWS+tM OkSg== X-Gm-Message-State: AOAM532ok5MilvIUsUGuQ4xulvrDdtzYuLZkuo57IVu2GH86qbSFkB4V SOSbqJIymtRGjvm94Y9aoXk= X-Google-Smtp-Source: ABdhPJxwGLP6MlXN6ThkTGEFofWzQJz6yBu73ZjjgmqIhu+NOoRHZ8TOzzEw0x7Hnsxg8MZKRI9LmQ== X-Received: by 2002:a5d:4cc1:: with SMTP id c1mr16408730wrt.291.1618859919698; Mon, 19 Apr 2021 12:18:39 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jiaxun Yang , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aleksandar Rikalo , Aurelien Jarno , Huacai Chen Subject: [PATCH v3 03/30] target/mips: Move msa_reset() to new source file Date: Mon, 19 Apr 2021 21:17:56 +0200 Message-Id: <20210419191823.1555482-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210419191823.1555482-1-f4bug@amsat.org> References: <20210419191823.1555482-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) mips_cpu_reset() is used by all accelerators, and calls msa_reset(), which is defined in msa_helper.c. Beside msa_reset(), the rest of msa_helper.c is only useful to the TCG accelerator. To be able to restrict this helper file to TCG, we need to move msa_reset() out of it. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/mips/msa.c | 60 ++++++++++++++++++++++++++++++++++++++++ target/mips/msa_helper.c | 36 ------------------------ target/mips/meson.build | 1 + 3 files changed, 61 insertions(+), 36 deletions(-) create mode 100644 target/mips/msa.c diff --git a/target/mips/msa.c b/target/mips/msa.c new file mode 100644 index 00000000000..61f1a9a5936 --- /dev/null +++ b/target/mips/msa.c @@ -0,0 +1,60 @@ +/* + * MIPS SIMD Architecture Module Instruction emulation helpers for QEMU. + * + * Copyright (c) 2014 Imagination Technologies + * + * 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 "internal.h" +#include "fpu/softfloat.h" +#include "fpu_helper.h" + +void msa_reset(CPUMIPSState *env) +{ + if (!ase_msa_available(env)) { + return; + } + +#ifdef CONFIG_USER_ONLY + /* MSA access enabled */ + env->CP0_Config5 |=3D 1 << CP0C5_MSAEn; + env->CP0_Status |=3D (1 << CP0St_CU1) | (1 << CP0St_FR); +#endif + + /* + * MSA CSR: + * - non-signaling floating point exception mode off (NX bit is 0) + * - Cause, Enables, and Flags are all 0 + * - round to nearest / ties to even (RM bits are 0) + */ + env->active_tc.msacsr =3D 0; + + restore_msa_fp_status(env); + + /* tininess detected after rounding.*/ + set_float_detect_tininess(float_tininess_after_rounding, + &env->active_tc.msa_fp_status); + + /* clear float_status exception flags */ + set_float_exception_flags(0, &env->active_tc.msa_fp_status); + + /* clear float_status nan mode */ + set_default_nan_mode(0, &env->active_tc.msa_fp_status); + + /* set proper signanling bit meaning ("1" means "quiet") */ + set_snan_bit_is_one(0, &env->active_tc.msa_fp_status); +} diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c index 4caefe29ad7..04af54f66d1 100644 --- a/target/mips/msa_helper.c +++ b/target/mips/msa_helper.c @@ -8595,39 +8595,3 @@ void helper_msa_st_d(CPUMIPSState *env, uint32_t wd, cpu_stq_data(env, addr + (1 << DF_DOUBLE), pwd->d[1]); #endif } - -void msa_reset(CPUMIPSState *env) -{ - if (!ase_msa_available(env)) { - return; - } - -#ifdef CONFIG_USER_ONLY - /* MSA access enabled */ - env->CP0_Config5 |=3D 1 << CP0C5_MSAEn; - env->CP0_Status |=3D (1 << CP0St_CU1) | (1 << CP0St_FR); -#endif - - /* - * MSA CSR: - * - non-signaling floating point exception mode off (NX bit is 0) - * - Cause, Enables, and Flags are all 0 - * - round to nearest / ties to even (RM bits are 0) - */ - env->active_tc.msacsr =3D 0; - - restore_msa_fp_status(env); - - /* tininess detected after rounding.*/ - set_float_detect_tininess(float_tininess_after_rounding, - &env->active_tc.msa_fp_status); - - /* clear float_status exception flags */ - set_float_exception_flags(0, &env->active_tc.msa_fp_status); - - /* clear float_status nan mode */ - set_default_nan_mode(0, &env->active_tc.msa_fp_status); - - /* set proper signanling bit meaning ("1" means "quiet") */ - set_snan_bit_is_one(0, &env->active_tc.msa_fp_status); -} diff --git a/target/mips/meson.build b/target/mips/meson.build index 5fcb211ca9a..daf5f1d55bc 100644 --- a/target/mips/meson.build +++ b/target/mips/meson.build @@ -11,6 +11,7 @@ 'cpu.c', 'fpu.c', 'gdbstub.c', + 'msa.c', )) mips_tcg_ss =3D ss.source_set() mips_tcg_ss.add(gen) --=20 2.26.3