All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aleksandar Rikalo <arikalo@gmail.com>
To: linux-riscv@lists.infradead.org
Cc: "Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Andrew Jones" <ajones@ventanamicro.com>,
	"Christoph Müllner" <christoph.muellner@vrull.eu>,
	"Aleksandar Rikalo" <arikalo@gmail.com>,
	linux-kernel@vger.kernel.org,
	"Djordje Todorovic" <djordje.todorovic@htecgroup.com>
Subject: [PATCH] riscv: Fix the PAUSE Opcode for MIPS P8700.
Date: Wed, 18 Dec 2024 14:33:40 +0100	[thread overview]
Message-ID: <20241218133340.51003-1-arikalo@gmail.com> (raw)

From: Raj Vishwanathan4 <rvishwanathan@mips.com>

The riscv MIPS P8700 uses a different opcode for PAUSE.
It is a ‘hint’ encoding of the SLLI instruction, with rd=0, rs1=0 and
imm=5. It will behave as a NOP instruction if no additional behavior
beyond that of SLLI is implemented.

Signed-off-by: Raj Vishwanathan4 <rvishwanathan@mips.com>
Signed-off-by: Aleksandar Rikalo <arikalo@gmail.com>
---
 arch/riscv/Kconfig                | 12 ++++++++++++
 arch/riscv/include/asm/insn-def.h |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index d4a7ca0388c0..07a77fa0a014 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -716,6 +716,18 @@ config RISCV_ISA_ZACAS
 
 	  If you don't know what to do here, say Y.
 
+config RISCV_MIPS_P8700_PAUSE_OPCODE_FIX
+	bool "Fix the PAUSE Opcode for MIPS P8700"
+	default n
+	help
+	   The RISCV MIPS P8700 uses a different opcode for PAUSE.
+	   It is a 'hint' encoding of the SLLI instruction,
+	   with rd=0, rs1=0 and imm=5. It will behave as a NOP
+	   instruction if no additional behavior beyond that of
+	   SLLI is implemented.
+
+	   If you are not using the P8700 processor, say n.
+
 config TOOLCHAIN_HAS_ZBB
 	bool
 	default y
diff --git a/arch/riscv/include/asm/insn-def.h b/arch/riscv/include/asm/insn-def.h
index 9a913010cdd9..793eedde3516 100644
--- a/arch/riscv/include/asm/insn-def.h
+++ b/arch/riscv/include/asm/insn-def.h
@@ -196,7 +196,12 @@
 	INSN_I(OPCODE_MISC_MEM, FUNC3(2), __RD(0),		\
 	       RS1(base), SIMM12(4))
 
+#ifndef CONFIG_RISCV_MIPS_P8700_PAUSE_OPCODE_FIX
 #define RISCV_PAUSE	".4byte 0x100000f"
+#else
+#define RISCV_PAUSE	".4byte 0x00501013"
+#endif
+
 #define ZAWRS_WRS_NTO	".4byte 0x00d00073"
 #define ZAWRS_WRS_STO	".4byte 0x01d00073"
 
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: Aleksandar Rikalo <arikalo@gmail.com>
To: linux-riscv@lists.infradead.org
Cc: "Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Andrew Jones" <ajones@ventanamicro.com>,
	"Christoph Müllner" <christoph.muellner@vrull.eu>,
	"Aleksandar Rikalo" <arikalo@gmail.com>,
	linux-kernel@vger.kernel.org,
	"Djordje Todorovic" <djordje.todorovic@htecgroup.com>
Subject: [PATCH] riscv: Fix the PAUSE Opcode for MIPS P8700.
Date: Wed, 18 Dec 2024 14:33:40 +0100	[thread overview]
Message-ID: <20241218133340.51003-1-arikalo@gmail.com> (raw)

From: Raj Vishwanathan4 <rvishwanathan@mips.com>

The riscv MIPS P8700 uses a different opcode for PAUSE.
It is a ‘hint’ encoding of the SLLI instruction, with rd=0, rs1=0 and
imm=5. It will behave as a NOP instruction if no additional behavior
beyond that of SLLI is implemented.

Signed-off-by: Raj Vishwanathan4 <rvishwanathan@mips.com>
Signed-off-by: Aleksandar Rikalo <arikalo@gmail.com>
---
 arch/riscv/Kconfig                | 12 ++++++++++++
 arch/riscv/include/asm/insn-def.h |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index d4a7ca0388c0..07a77fa0a014 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -716,6 +716,18 @@ config RISCV_ISA_ZACAS
 
 	  If you don't know what to do here, say Y.
 
+config RISCV_MIPS_P8700_PAUSE_OPCODE_FIX
+	bool "Fix the PAUSE Opcode for MIPS P8700"
+	default n
+	help
+	   The RISCV MIPS P8700 uses a different opcode for PAUSE.
+	   It is a 'hint' encoding of the SLLI instruction,
+	   with rd=0, rs1=0 and imm=5. It will behave as a NOP
+	   instruction if no additional behavior beyond that of
+	   SLLI is implemented.
+
+	   If you are not using the P8700 processor, say n.
+
 config TOOLCHAIN_HAS_ZBB
 	bool
 	default y
diff --git a/arch/riscv/include/asm/insn-def.h b/arch/riscv/include/asm/insn-def.h
index 9a913010cdd9..793eedde3516 100644
--- a/arch/riscv/include/asm/insn-def.h
+++ b/arch/riscv/include/asm/insn-def.h
@@ -196,7 +196,12 @@
 	INSN_I(OPCODE_MISC_MEM, FUNC3(2), __RD(0),		\
 	       RS1(base), SIMM12(4))
 
+#ifndef CONFIG_RISCV_MIPS_P8700_PAUSE_OPCODE_FIX
 #define RISCV_PAUSE	".4byte 0x100000f"
+#else
+#define RISCV_PAUSE	".4byte 0x00501013"
+#endif
+
 #define ZAWRS_WRS_NTO	".4byte 0x00d00073"
 #define ZAWRS_WRS_STO	".4byte 0x01d00073"
 
-- 
2.25.1


             reply	other threads:[~2024-12-18 13:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 13:33 Aleksandar Rikalo [this message]
2024-12-18 13:33 ` [PATCH] riscv: Fix the PAUSE Opcode for MIPS P8700 Aleksandar Rikalo
2024-12-19 18:45 ` Olof Johansson
2024-12-19 18:45   ` Olof Johansson
2024-12-27 14:01   ` Aleksandar Rikalo
2024-12-27 14:01     ` Aleksandar Rikalo

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=20241218133340.51003-1-arikalo@gmail.com \
    --to=arikalo@gmail.com \
    --cc=ajones@ventanamicro.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=christoph.muellner@vrull.eu \
    --cc=djordje.todorovic@htecgroup.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.