From nobody Mon Feb 9 18:44:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.218.45 as permitted sender) client-ip=209.85.218.45; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ej1-f45.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1608073213; cv=none; d=zohomail.com; s=zohoarc; b=Empu32ohnV15r07P4DDTM4+sHv3HdPwzHm28CuhRwPkVKeEgQYKdD5MDCJ3atmPdkNgAsD63XA8vvtgIqQsa0fq2umksHCBMyBX1j77Qgr6ZAsvIXaZ982tOR1on8XtBveHbzKNyxrg6H3h+xh0bvMwBZMZRnRVjlmxWjh+xYOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608073213; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4FByo0luaRsj+aLeL9XTS/vkQm9Li61qyHi3C9wh89E=; b=Wi/aL6F4OqSAP1lre+SI6Ij09ouhk4Md8jvLlVlkcoSOF16OZdoeiPOOtRvSNLPdP7A5G9iDST7EOGocM6/8vWplnLlt2xTtLlRfWKH2NuIBuYbeqh1f8FaNXmE9uUEqWxQILFwFAhxTxIi2hgLT/HnnpC/gz1Ts+tac0mBpuOo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by mx.zohomail.com with SMTPS id 1608073213510895.1206749842956; Tue, 15 Dec 2020 15:00:13 -0800 (PST) Received: by mail-ej1-f45.google.com with SMTP id j22so12053163eja.13 for ; Tue, 15 Dec 2020 15:00:10 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (101.red-88-21-206.staticip.rima-tde.net. [88.21.206.101]) by smtp.gmail.com with ESMTPSA id h15sm19497149edz.95.2020.12.15.15.00.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Dec 2020 15:00:08 -0800 (PST) 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=4FByo0luaRsj+aLeL9XTS/vkQm9Li61qyHi3C9wh89E=; b=qbkqTfIDUlwvWOW7Gd7einDqrUc20NC6J69WdA//sX2fo8TGhuEXTmkdAH/RZtkQTb MytpnmKRDJ2G3biodDRUNJsm4o2wsUZKKPfrOp9aA2U7ePCJq2nogPiRf7NwhgSC6J5I VxoQxzii3zg6w0RPO8fKylTunHuMfAnetvaZD1PE/CPBNe7y9IXnzT1oSIXiMWZK7hyZ jTPN568DPQA2XPrg5MRhen2iiHE7wvPlKAtrsO45gOHgbHTnLSpgQzFsYUHNwwRNe4CY t7fEqmVjRymZegCRGsKFl6xLMw0pDtbWoJuNd66Y2EkTqcUQAAyDLxkfgy9MQpH/4b93 yQzA== 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=4FByo0luaRsj+aLeL9XTS/vkQm9Li61qyHi3C9wh89E=; b=LX9akjirT3lnGk+1S9BCgpYUf8l8iByL4iLuKr+68eeKH9JTOYPSaB03965wdr+1ro GuXnqfbSe57KMQKQ7k+c58dQcAozcb2SAr6S0e6EPDnE71EsmwEExG2esJ9+AFgztPsk 1wbo/hFrhyAtSDaBulDqlVfO049Y7+YmFGvinfyxMPXD3+ldxBkXUx9TAUghyByG055d dMAmXRFnKYWfWezBcVM5czFdyyEuHt3YvaAHFCHQyYslLxv1QbnLcY6nFcIALpqE3lrj OozH8amppWb0jOEfRGJVz0DZp2F7fvPRzAd3RqjFHMnYgEAi/owmQT9n+WjHu5ohrJN6 nSGg== X-Gm-Message-State: AOAM530Bo1vCMaETW2ukc6hEw1Bn7fbp9uCNrokNR8j6vSwHNn4j0ktJ rCXbwKVoLPQpkwlxxU1CZeg= X-Google-Smtp-Source: ABdhPJwDVfUkiC184zELa5kw8x1BW2v7eil7oduSJGx+lW/j20b1aOWUnA0EMRSvgjtAUsGKyYriMg== X-Received: by 2002:a17:906:b793:: with SMTP id dt19mr28515625ejb.120.1608073209280; Tue, 15 Dec 2020 15:00:09 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Richard Henderson , qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, Aleksandar Rikalo , Paolo Bonzini , Aurelien Jarno , Jiaxun Yang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Huacai Chen Subject: [PATCH v2 23/24] target/mips: Introduce decodetree helpers for Release6 LSA/DLSA opcodes Date: Tue, 15 Dec 2020 23:57:56 +0100 Message-Id: <20201215225757.764263-24-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201215225757.764263-1-f4bug@amsat.org> References: <20201215225757.764263-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) LSA and LDSA opcodes are also available with MIPS release 6. Introduce the decodetree config files and call the decode() helpers in the main decode_opc() loop. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/mips/translate.h | 1 + target/mips/isa-mips32r6.decode | 17 ++++++++++++ target/mips/isa-mips64r6.decode | 17 ++++++++++++ target/mips/isa-mips_rel6_translate.c | 37 +++++++++++++++++++++++++++ target/mips/translate.c | 5 ++++ target/mips/meson.build | 3 +++ 6 files changed, 80 insertions(+) create mode 100644 target/mips/isa-mips32r6.decode create mode 100644 target/mips/isa-mips64r6.decode create mode 100644 target/mips/isa-mips_rel6_translate.c diff --git a/target/mips/translate.h b/target/mips/translate.h index 47129de81d9..cbaef53b958 100644 --- a/target/mips/translate.h +++ b/target/mips/translate.h @@ -161,6 +161,7 @@ extern TCGv bcond; void msa_translate_init(void); =20 /* decodetree generated */ +bool decode_isa_rel6(DisasContext *ctx, uint32_t insn); bool decode_ase_msa(DisasContext *ctx, uint32_t insn); =20 #endif diff --git a/target/mips/isa-mips32r6.decode b/target/mips/isa-mips32r6.dec= ode new file mode 100644 index 00000000000..027585ee042 --- /dev/null +++ b/target/mips/isa-mips32r6.decode @@ -0,0 +1,17 @@ +# MIPS32 Release 6 instruction set +# +# Copyright (C) 2020 Philippe Mathieu-Daud=C3=A9 +# +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Reference: +# MIPS Architecture for Programmers Volume II-A +# The MIPS32 Instruction Set Reference Manual, Revision 6.06 +# (Document Number: MD00086-2B-MIPS32BIS-AFP-06.06) +# + +&lsa rd rt rs sa + +@lsa ...... rs:5 rt:5 rd:5 ... sa:2 ...... &lsa + +LSA 000000 ..... ..... ..... 000 .. 000101 @lsa diff --git a/target/mips/isa-mips64r6.decode b/target/mips/isa-mips64r6.dec= ode new file mode 100644 index 00000000000..e812224341e --- /dev/null +++ b/target/mips/isa-mips64r6.decode @@ -0,0 +1,17 @@ +# MIPS64 Release 6 instruction set +# +# Copyright (C) 2020 Philippe Mathieu-Daud=C3=A9 +# +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Reference: +# MIPS Architecture for Programmers Volume II-A +# The MIPS64 Instruction Set Reference Manual, Revision 6.06 +# (Document Number: MD00087-2B-MIPS64BIS-AFP-6.06) +# + +&lsa rd rt rs sa !extern + +@lsa ...... rs:5 rt:5 rd:5 ... sa:2 ...... &lsa + +DLSA 000000 ..... ..... ..... 000 .. 010101 @lsa diff --git a/target/mips/isa-mips_rel6_translate.c b/target/mips/isa-mips_r= el6_translate.c new file mode 100644 index 00000000000..d5872bbf8fc --- /dev/null +++ b/target/mips/isa-mips_rel6_translate.c @@ -0,0 +1,37 @@ +/* + * MIPS emulation for QEMU - # Release 6 translation routines + * + * Copyright (c) 2004-2005 Jocelyn Mayer + * Copyright (c) 2006 Marius Groeger (FPU operations) + * Copyright (c) 2006 Thiemo Seufer (MIPS32R2 support) + * Copyright (c) 2020 Philippe Mathieu-Daud=C3=A9 + * + * This code is licensed under the GNU GPLv2 and later. + */ + +#include "qemu/osdep.h" +#include "tcg/tcg-op.h" +#include "exec/helper-gen.h" +#include "translate.h" + +/* Include the auto-generated decoder. */ +#include "decode-isa-mips32r6.c.inc" +#include "decode-isa-mips64r6.c.inc" + +static bool trans_LSA(DisasContext *ctx, arg_LSA *a) +{ + return gen_LSA(ctx, a->rd, a->rt, a->rs, a->sa); +} + +static bool trans_DLSA(DisasContext *ctx, arg_LSA *a) +{ + return gen_DLSA(ctx, a->rd, a->rt, a->rs, a->sa); +} + +bool decode_isa_rel6(DisasContext *ctx, uint32_t insn) +{ + if (TARGET_LONG_BITS =3D=3D 64 && decode_mips64r6(ctx, insn)) { + return true; + } + return decode_mips32r6(ctx, insn); +} diff --git a/target/mips/translate.c b/target/mips/translate.c index e0439ba92d8..125b2aac848 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -29027,6 +29027,11 @@ static void decode_opc(CPUMIPSState *env, DisasCon= text *ctx) return; } =20 + /* ISA */ + if (isa_rel6_available(env) && decode_isa_rel6(ctx, ctx->opcode)) { + return; + } + if (!decode_opc_legacy(env, ctx)) { gen_reserved_instruction(ctx); } diff --git a/target/mips/meson.build b/target/mips/meson.build index 8e2e5fa40b8..2d62288d604 100644 --- a/target/mips/meson.build +++ b/target/mips/meson.build @@ -1,4 +1,6 @@ gen =3D [ + decodetree.process('isa-mips32r6.decode', extra_args: [ '--static-decode= =3Ddecode_mips32r6' ]), + decodetree.process('isa-mips64r6.decode', extra_args: [ '--static-decode= =3Ddecode_mips64r6' ]), decodetree.process('mod-msa32.decode', extra_args: [ '--static-decode=3D= decode_msa32' ]), decodetree.process('mod-msa64.decode', extra_args: [ '--static-decode=3D= decode_msa64' ]), ] @@ -12,6 +14,7 @@ mips_ss.add(when: 'CONFIG_TCG', if_true: files( 'dsp_helper.c', 'fpu_helper.c', + 'isa-mips_rel6_translate.c', 'lmmi_helper.c', 'op_helper.c', 'mod-msa_helper.c', --=20 2.26.2