From: Conor Dooley <conor@kernel.org>
To: Heiko Stuebner <heiko@sntech.de>
Cc: linux-riscv@lists.infradead.org, palmer@dabbelt.com,
christoph.muellner@vrull.eu, philipp.tomsich@vrull.eu,
ajones@ventanamicro.com, jszhang@kernel.org,
Heiko Stuebner <heiko.stuebner@vrull.eu>
Subject: Re: [PATCH v4 1/5] RISC-V: move some stray __RISCV_INSN_FUNCS definitions from kprobes
Date: Mon, 9 Jan 2023 20:53:27 +0000 [thread overview]
Message-ID: <Y7x+x3oiig3j94Bb@spud> (raw)
In-Reply-To: <20230109181755.2383085-2-heiko@sntech.de>
[-- Attachment #1.1: Type: text/plain, Size: 3787 bytes --]
On Mon, Jan 09, 2023 at 07:17:51PM +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@vrull.eu>
>
> The __RISCV_INSN_FUNCS originally declared riscv_insn_is_* functions inside
> the kprobes implementation. This got moved into a central header in
> commit ec5f90877516 ("RISC-V: Move riscv_insn_is_* macros into a common header").
>
> Though it looks like I overlooked two of them, so fix that. FENCE itself is
> an instruction defined directly by its own opcode, while the created
> riscv_isn_is_system function covers all instructions defined under the SYSTEM
> opcode.
>
> Fixes: ec5f90877516 ("RISC-V: Move riscv_insn_is_* macros into a common header")
Not quite sure why it needs a fixes tag, nothing was actually broken
previously, right?
Not that I really care, but Sasha is likely gonna pick it up for
backporting as a result.
Either way, looks grand.
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@vrull.eu>
> ---
> arch/riscv/include/asm/insn.h | 10 ++++++++++
> arch/riscv/kernel/probes/simulate-insn.h | 3 ---
> 2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/include/asm/insn.h b/arch/riscv/include/asm/insn.h
> index 98453535324a..0455b4dcb0a7 100644
> --- a/arch/riscv/include/asm/insn.h
> +++ b/arch/riscv/include/asm/insn.h
> @@ -128,6 +128,7 @@
> #define RVC_C2_RD_OPOFF 7
>
> /* parts of opcode for RVG*/
> +#define RVG_OPCODE_FENCE 0x0f
> #define RVG_OPCODE_AUIPC 0x17
> #define RVG_OPCODE_BRANCH 0x63
> #define RVG_OPCODE_JALR 0x67
> @@ -163,6 +164,7 @@
> #define RVG_MATCH_AUIPC (RVG_OPCODE_AUIPC)
> #define RVG_MATCH_JALR (RV_ENCODE_FUNCT3(JALR) | RVG_OPCODE_JALR)
> #define RVG_MATCH_JAL (RVG_OPCODE_JAL)
> +#define RVG_MATCH_FENCE (RVG_OPCODE_FENCE)
> #define RVG_MATCH_BEQ (RV_ENCODE_FUNCT3(BEQ) | RVG_OPCODE_BRANCH)
> #define RVG_MATCH_BNE (RV_ENCODE_FUNCT3(BNE) | RVG_OPCODE_BRANCH)
> #define RVG_MATCH_BLT (RV_ENCODE_FUNCT3(BLT) | RVG_OPCODE_BRANCH)
> @@ -182,6 +184,7 @@
> #define RVG_MASK_AUIPC (RV_INSN_OPCODE_MASK)
> #define RVG_MASK_JALR (RV_INSN_FUNCT3_MASK | RV_INSN_OPCODE_MASK)
> #define RVG_MASK_JAL (RV_INSN_OPCODE_MASK)
> +#define RVG_MASK_FENCE (RV_INSN_OPCODE_MASK)
> #define RVC_MASK_C_JALR (RVC_INSN_FUNCT4_MASK | RVC_INSN_J_RS2_MASK | RVC_INSN_OPCODE_MASK)
> #define RVC_MASK_C_JR (RVC_INSN_FUNCT4_MASK | RVC_INSN_J_RS2_MASK | RVC_INSN_OPCODE_MASK)
> #define RVC_MASK_C_JAL (RVC_INSN_FUNCT3_MASK | RVC_INSN_OPCODE_MASK)
> @@ -233,6 +236,13 @@ __RISCV_INSN_FUNCS(c_bnez, RVC_MASK_C_BNEZ, RVC_MATCH_C_BNEZ)
> __RISCV_INSN_FUNCS(c_ebreak, RVC_MASK_C_EBREAK, RVC_MATCH_C_EBREAK)
> __RISCV_INSN_FUNCS(ebreak, RVG_MASK_EBREAK, RVG_MATCH_EBREAK)
> __RISCV_INSN_FUNCS(sret, RVG_MASK_SRET, RVG_MATCH_SRET)
> +__RISCV_INSN_FUNCS(fence, RVG_MASK_FENCE, RVG_MATCH_FENCE);
> +
> +/* special case to catch _any_ system instruction */
> +static __always_inline bool riscv_insn_is_system(u32 code)
> +{
> + return (code & RV_INSN_OPCODE_MASK) == RVG_OPCODE_SYSTEM;
> +}
>
> /* special case to catch _any_ branch instruction */
> static __always_inline bool riscv_insn_is_branch(u32 code)
> diff --git a/arch/riscv/kernel/probes/simulate-insn.h b/arch/riscv/kernel/probes/simulate-insn.h
> index a19aaa0feb44..61e35db31001 100644
> --- a/arch/riscv/kernel/probes/simulate-insn.h
> +++ b/arch/riscv/kernel/probes/simulate-insn.h
> @@ -12,9 +12,6 @@
> } \
> } while (0)
>
> -__RISCV_INSN_FUNCS(system, 0x7f, 0x73);
> -__RISCV_INSN_FUNCS(fence, 0x7f, 0x0f);
> -
> #define RISCV_INSN_SET_SIMULATE(name, code) \
> do { \
> if (riscv_insn_is_##name(code)) { \
> --
> 2.35.1
>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2023-01-09 20:53 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-09 18:17 [PATCH v4 0/5] Zbb string optimizations and call support in alternatives Heiko Stuebner
2023-01-09 18:17 ` [PATCH v4 1/5] RISC-V: move some stray __RISCV_INSN_FUNCS definitions from kprobes Heiko Stuebner
2023-01-09 20:53 ` Conor Dooley [this message]
2023-01-11 15:14 ` Heiko Stübner
2023-01-10 8:32 ` Andrew Jones
2023-01-09 18:17 ` [PATCH v4 2/5] RISC-V: add helpers for J-type immediate handling Heiko Stuebner
2023-01-09 22:22 ` Conor Dooley
2023-01-10 8:44 ` Andrew Jones
2023-01-10 8:54 ` Conor Dooley
2023-01-11 14:43 ` Jisheng Zhang
2023-01-09 18:17 ` [PATCH v4 3/5] RISC-V: fix jal addresses in patched alternatives Heiko Stuebner
2023-01-10 9:28 ` Andrew Jones
2023-01-11 17:15 ` Jisheng Zhang
2023-01-11 13:18 ` Jisheng Zhang
2023-01-11 13:53 ` Heiko Stübner
2023-01-11 14:15 ` Andrew Jones
2023-01-11 14:44 ` Jisheng Zhang
2023-01-09 18:17 ` [PATCH v4 4/5] RISC-V: add infrastructure to allow different str* implementations Heiko Stuebner
2023-01-09 22:37 ` Conor Dooley
2023-01-09 23:31 ` Heiko Stübner
2023-01-10 9:39 ` Andrew Jones
2023-01-10 10:46 ` Heiko Stübner
2023-01-10 11:16 ` Andrew Jones
2023-01-11 12:34 ` Andrew Jones
[not found] ` <CAEg0e7gJgpoiGjfLeedba0-r=dCE1Z_qkU53w_+-cVjsuqaC3A@mail.gmail.com>
2023-01-11 13:42 ` Philipp Tomsich
2023-01-11 13:47 ` Andrew Jones
2023-01-10 12:13 ` Andrew Jones
2023-01-11 12:30 ` Andrew Jones
2023-01-12 16:05 ` Heiko Stübner
2023-01-09 18:17 ` [PATCH v4 5/5] RISC-V: add zbb support to string functions Heiko Stuebner
2023-01-09 20:39 ` Conor Dooley
2023-01-10 9:57 ` Andrew Jones
2023-01-10 10:14 ` Conor Dooley
2023-01-12 11:21 ` Heiko Stübner
2023-01-12 12:06 ` Conor Dooley
2023-01-12 12:28 ` Heiko Stübner
2023-01-11 12:24 ` Andrew Jones
2023-01-11 14:27 ` Christoph Müllner
2023-01-11 15:16 ` Andrew Jones
2023-01-11 15:22 ` Jeff Law
2023-01-12 22:05 ` Heiko Stübner
2023-01-11 13:24 ` [PATCH v4 0/5] Zbb string optimizations and call support in alternatives Jisheng Zhang
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=Y7x+x3oiig3j94Bb@spud \
--to=conor@kernel.org \
--cc=ajones@ventanamicro.com \
--cc=christoph.muellner@vrull.eu \
--cc=heiko.stuebner@vrull.eu \
--cc=heiko@sntech.de \
--cc=jszhang@kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=philipp.tomsich@vrull.eu \
/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