qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Francis <alistair23@gmail.com>
To: Djordje Todorovic <Djordje.Todorovic@htecgroup.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"qemu-riscv@nongnu.org" <qemu-riscv@nongnu.org>,
	 "cfu@mips.com" <cfu@mips.com>, "mst@redhat.com" <mst@redhat.com>,
	 "marcel.apfelbaum@gmail.com" <marcel.apfelbaum@gmail.com>,
	 "dbarboza@ventanamicro.com" <dbarboza@ventanamicro.com>,
	"philmd@linaro.org" <philmd@linaro.org>
Subject: Re: [PATCH v8 06/14] target/riscv: Add mips.pref instruction
Date: Tue, 30 Sep 2025 11:19:38 +1000	[thread overview]
Message-ID: <CAKmqyKP=DLAZ=io1hSr66sZQuWk7zvsAHi1yXtFYL4DhpU5-mw@mail.gmail.com> (raw)
In-Reply-To: <20250924091746.1882125-7-djordje.todorovic@htecgroup.com>

On Wed, Sep 24, 2025 at 7:23 PM Djordje Todorovic
<Djordje.Todorovic@htecgroup.com> wrote:
>
> Add MIPS P8700 prefetch instruction defined by Xmipscbop.
>
> Signed-off-by: Chao-ying Fu <cfu@mips.com>
> Signed-off-by: Djordje Todorovic <djordje.todorovic@htecgroup.com>
> Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
>  target/riscv/cpu.c                        |  3 +++
>  target/riscv/cpu_cfg.h                    |  2 +-
>  target/riscv/cpu_cfg_fields.h.inc         |  1 +
>  target/riscv/insn_trans/trans_xmips.c.inc | 14 ++++++++++++++
>  target/riscv/xmips.decode                 |  1 +
>  5 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index 77fbf67776..87f9eb7ac4 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -247,6 +247,7 @@ const RISCVIsaExtData isa_edata_arr[] = {
>      ISA_EXT_DATA_ENTRY(svrsw60t59b, PRIV_VERSION_1_13_0, ext_svrsw60t59b),
>      ISA_EXT_DATA_ENTRY(svukte, PRIV_VERSION_1_13_0, ext_svukte),
>      ISA_EXT_DATA_ENTRY(svvptc, PRIV_VERSION_1_13_0, ext_svvptc),
> +    ISA_EXT_DATA_ENTRY(xmipscbop, PRIV_VERSION_1_12_0, ext_xmipscbop),
>      ISA_EXT_DATA_ENTRY(xmipscmov, PRIV_VERSION_1_12_0, ext_xmipscmov),
>      ISA_EXT_DATA_ENTRY(xtheadba, PRIV_VERSION_1_11_0, ext_xtheadba),
>      ISA_EXT_DATA_ENTRY(xtheadbb, PRIV_VERSION_1_11_0, ext_xtheadbb),
> @@ -1380,6 +1381,7 @@ const RISCVCPUMultiExtConfig riscv_cpu_vendor_exts[] = {
>      MULTI_EXT_CFG_BOOL("xtheadmempair", ext_xtheadmempair, false),
>      MULTI_EXT_CFG_BOOL("xtheadsync", ext_xtheadsync, false),
>      MULTI_EXT_CFG_BOOL("xventanacondops", ext_XVentanaCondOps, false),
> +    MULTI_EXT_CFG_BOOL("xmipscbop", ext_xmipscbop, false),
>      MULTI_EXT_CFG_BOOL("xmipscmov", ext_xmipscmov, false),
>
>      { },
> @@ -3295,6 +3297,7 @@ static const TypeInfo riscv_cpu_type_infos[] = {
>          .cfg.pmp = true,
>          .cfg.ext_zba = true,
>          .cfg.ext_zbb = true,
> +        .cfg.ext_xmipscbop = true,
>          .cfg.ext_xmipscmov = true,
>          .cfg.marchid = 0x8000000000000201,
>          .cfg.mvendorid = MIPS_VENDOR_ID,
> diff --git a/target/riscv/cpu_cfg.h b/target/riscv/cpu_cfg.h
> index 2db471ad17..e4d5039c49 100644
> --- a/target/riscv/cpu_cfg.h
> +++ b/target/riscv/cpu_cfg.h
> @@ -38,7 +38,7 @@ static inline bool always_true_p(const RISCVCPUConfig *cfg __attribute__((__unus
>
>  static inline bool has_xmips_p(const RISCVCPUConfig *cfg)
>  {
> -    return cfg->ext_xmipscmov;
> +    return cfg->ext_xmipscbop || cfg->ext_xmipscmov;
>  }
>
>  static inline bool has_xthead_p(const RISCVCPUConfig *cfg)
> diff --git a/target/riscv/cpu_cfg_fields.h.inc b/target/riscv/cpu_cfg_fields.h.inc
> index a290303ee7..dd3ee7ba2b 100644
> --- a/target/riscv/cpu_cfg_fields.h.inc
> +++ b/target/riscv/cpu_cfg_fields.h.inc
> @@ -147,6 +147,7 @@ BOOL_FIELD(ext_xtheadmemidx)
>  BOOL_FIELD(ext_xtheadmempair)
>  BOOL_FIELD(ext_xtheadsync)
>  BOOL_FIELD(ext_XVentanaCondOps)
> +BOOL_FIELD(ext_xmipscbop)
>  BOOL_FIELD(ext_xmipscmov)
>
>  BOOL_FIELD(mmu)
> diff --git a/target/riscv/insn_trans/trans_xmips.c.inc b/target/riscv/insn_trans/trans_xmips.c.inc
> index 045034ae32..95b8238081 100644
> --- a/target/riscv/insn_trans/trans_xmips.c.inc
> +++ b/target/riscv/insn_trans/trans_xmips.c.inc
> @@ -9,6 +9,12 @@
>   *            (https://mips.com/products/hardware/p8700/)
>   */
>
> +#define REQUIRE_XMIPSCBOP(ctx) do {              \
> +    if (!ctx->cfg_ptr->ext_xmipscbop) {          \
> +        return false;                            \
> +    }                                            \
> +} while (0)
> +
>  #define REQUIRE_XMIPSCMOV(ctx) do {              \
>      if (!ctx->cfg_ptr->ext_xmipscmov) {          \
>          return false;                            \
> @@ -30,3 +36,11 @@ static bool trans_ccmov(DisasContext *ctx, arg_ccmov *a)
>
>      return true;
>  }
> +
> +static bool trans_pref(DisasContext *ctx, arg_pref *a)
> +{
> +    REQUIRE_XMIPSCBOP(ctx);
> +
> +    /* Nop */

Can we add some documentation of these instructions? What does this
and the other instructions do? Maybe just one sentence for each and a
link to a datasheet

Alistair

> +    return true;
> +}
> diff --git a/target/riscv/xmips.decode b/target/riscv/xmips.decode
> index fadcb78470..4215813b32 100644
> --- a/target/riscv/xmips.decode
> +++ b/target/riscv/xmips.decode
> @@ -9,3 +9,4 @@
>  #            (https://mips.com/products/hardware/p8700/)
>
>  ccmov          rs3:5 11 rs2:5 rs1:5 011 rd:5 0001011
> +pref        000 imm_9:9 rs1:5 000 imm_hint:5 0001011
> --
> 2.34.1
>


  reply	other threads:[~2025-09-30  1:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24  9:18 [PATCH v8 00/14] riscv: Add support for MIPS P8700 CPU Djordje Todorovic
2025-09-24  9:18 ` [PATCH v8 02/14] target/riscv: Add cpu_set_exception_base Djordje Todorovic
2025-09-30  1:06   ` Alistair Francis
2025-10-01  9:32     ` Djordje Todorovic
2025-09-24  9:18 ` [PATCH v8 01/14] hw/intc: Allow gaps in hartids for aclint and aplic Djordje Todorovic
2025-09-30  1:02   ` Alistair Francis
2025-09-24  9:18 ` [PATCH v8 03/14] target/riscv: Add MIPS P8700 CPU Djordje Todorovic
2025-09-30  1:07   ` Alistair Francis
2025-09-24  9:18 ` [PATCH v8 05/14] target/riscv: Add mips.ccmov instruction Djordje Todorovic
2025-09-30  1:14   ` Alistair Francis
2025-09-24  9:18 ` [PATCH v8 04/14] target/riscv: Add MIPS P8700 CSRs Djordje Todorovic
2025-09-30  1:11   ` Alistair Francis
2025-09-24  9:18 ` [PATCH v8 06/14] target/riscv: Add mips.pref instruction Djordje Todorovic
2025-09-30  1:19   ` Alistair Francis [this message]
2025-10-01  9:38     ` Djordje Todorovic
2025-09-24  9:18 ` [PATCH v8 07/14] target/riscv: Add Xmipslsp instructions Djordje Todorovic
2025-09-24  9:18 ` [PATCH v8 09/14] hw/misc: Add RISC-V CPC device implementation Djordje Todorovic
2025-09-30  1:24   ` Alistair Francis
2025-09-24  9:18 ` [PATCH v8 08/14] hw/misc: Add RISC-V CMGCR " Djordje Todorovic
2025-09-30  1:22   ` Alistair Francis
2025-10-01  9:48     ` Djordje Todorovic
2025-09-24  9:18 ` [PATCH v8 12/14] hw/pci: Allow explicit function numbers in pci Djordje Todorovic
2025-09-24  9:18 ` [PATCH v8 10/14] hw/riscv: Add support for RISCV CPS Djordje Todorovic
2025-09-24  9:18 ` [PATCH v8 11/14] hw/riscv: Add support for MIPS Boston-aia board mode Djordje Todorovic
2025-09-24  9:18 ` [PATCH v8 13/14] riscv/boston-aia: Add an e1000e NIC in slot 0 func 1 Djordje Todorovic
2025-09-24  9:18 ` [PATCH v8 14/14] test/functional: Add test for boston-aia board Djordje Todorovic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKmqyKP=DLAZ=io1hSr66sZQuWk7zvsAHi1yXtFYL4DhpU5-mw@mail.gmail.com' \
    --to=alistair23@gmail.com \
    --cc=Djordje.Todorovic@htecgroup.com \
    --cc=cfu@mips.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).