From: Leo Liang <ycliang@andestech.com>
To: Mayuresh Chitale <mchitale@ventanamicro.com>
Cc: <u-boot@lists.denx.de>, Rick Chen <rick@andestech.com>,
Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH v2 1/2] riscv: Add support for defining instructions
Date: Mon, 28 Oct 2024 18:24:33 +0800 [thread overview]
Message-ID: <Zx9mYVyT_I371nTt@swlinux02> (raw)
In-Reply-To: <20240823094127.207866-2-mchitale@ventanamicro.com>
Hi Mayuresh,
On Fri, Aug 23, 2024 at 09:41:25AM +0000, Mayuresh Chitale wrote:
> Add insn-def.h which is similar to that in linux and contains the macros
> to generate any instruction of type 'I' using the assembler's .insn
> directive.
>
> Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
> ---
> arch/riscv/include/asm/insn-def.h | 42 +++++++++++++++++++++++++++++++
> 1 file changed, 42 insertions(+)
> create mode 100644 arch/riscv/include/asm/insn-def.h
>
> diff --git a/arch/riscv/include/asm/insn-def.h b/arch/riscv/include/asm/insn-def.h
> new file mode 100644
> index 0000000000..99ad5b8f6a
> --- /dev/null
> +++ b/arch/riscv/include/asm/insn-def.h
> @@ -0,0 +1,42 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (C) 2024 Ventana Micro Systems Ltd.
> + *
> + * Ported from linux insn-def.h.
> + */
> +
> +#ifndef _ASM_RISCV_BARRIER_H
> +#define _ASM_RISCV_BARRIER_H
> +
> +#define INSN_I_SIMM12_SHIFT 20
> +#define INSN_I_RS1_SHIFT 15
> +#define INSN_I_FUNC3_SHIFT 12
> +#define INSN_I_RD_SHIFT 7
> +#define INSN_I_OPCODE_SHIFT 0
> +
> +#define RV_OPCODE(v) __ASM_STR(v)
> +#define RV_FUNC3(v) __ASM_STR(v)
> +#define RV_FUNC7(v) __ASM_STR(v)
> +#define RV_SIMM12(v) __ASM_STR(v)
> +#define RV_RD(v) __ASM_STR(v)
> +#define RV_RS1(v) __ASM_STR(v)
> +#define RV_RS2(v) __ASM_STR(v)
> +#define __RV_REG(v) __ASM_STR(x ## v)
> +#define RV___RD(v) __RV_REG(v)
> +#define RV___RS1(v) __RV_REG(v)
> +#define RV___RS2(v) __RV_REG(v)
> +
> +#define RV_OPCODE_MISC_MEM RV_OPCODE(15)
> +#define RV_OPCODE_SYSTEM RV_OPCODE(115)
> +
> +#define RV_OPCODE_MISC_MEM RV_OPCODE(15)
> +#define RV_OPCODE_SYSTEM RV_OPCODE(115)
These two lines are duplicated but I could fix this when merging the patch.
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
> +
> +#define __INSN_I(opcode, func3, rd, rs1, simm12) \
> + ".insn i " opcode ", " func3 ", " rd ", " rs1 ", " simm12 "\n"
> +
> +#define INSN_I(opcode, func3, rd, rs1, simm12) \
> + __INSN_I(RV_##opcode, RV_##func3, RV_##rd, \
> + RV_##rs1, RV_##simm12)
> +
> +#endif /* _ASM_RISCV_BARRIER_H */
next prev parent reply other threads:[~2024-10-28 10:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 9:41 [PATCH v2 0/2] Risc-V cache operations Mayuresh Chitale
2024-08-23 9:41 ` [PATCH v2 1/2] riscv: Add support for defining instructions Mayuresh Chitale
2024-10-28 10:24 ` Leo Liang [this message]
2024-08-23 9:41 ` [PATCH v2 2/2] riscv: cache: Add CBO instructions Mayuresh Chitale
2024-10-28 10:45 ` Leo Liang
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=Zx9mYVyT_I371nTt@swlinux02 \
--to=ycliang@andestech.com \
--cc=mchitale@ventanamicro.com \
--cc=rick@andestech.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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