All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Huacai Chen <chenhuacai@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, loongarch@lists.linux.dev
Subject: [RFC PATCH 1/5] LoongArch: Fix some instruction formats
Date: Tue,  9 Aug 2022 10:52:56 +0800	[thread overview]
Message-ID: <1660013580-19053-2-git-send-email-yangtiezhu@loongson.cn> (raw)
In-Reply-To: <1660013580-19053-1-git-send-email-yangtiezhu@loongson.cn>

struct reg2i12_format is used to generate the instruction lu52id
in larch_insn_gen_lu52id(), according to the instruction format
of lu52id in LoongArch Reference Manual [1], the type of field
"immediate" should be "signed int" rather than "unsigned int".

There are similar problems in the other structs reg0i26_format,
reg1i20_format, reg1i21_format and reg2i16_format, fix them.

[1] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_lu12i_w_lu32i_d_lu52i_d

Fixes: b738c106f735 ("LoongArch: Add other common headers")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/loongarch/include/asm/inst.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/loongarch/include/asm/inst.h b/arch/loongarch/include/asm/inst.h
index 7b07cbb..ff51481 100644
--- a/arch/loongarch/include/asm/inst.h
+++ b/arch/loongarch/include/asm/inst.h
@@ -53,35 +53,35 @@ enum reg2i16_op {
 };
 
 struct reg0i26_format {
-	unsigned int immediate_h : 10;
-	unsigned int immediate_l : 16;
+	signed int immediate_h : 10;
+	signed int immediate_l : 16;
 	unsigned int opcode : 6;
 };
 
 struct reg1i20_format {
 	unsigned int rd : 5;
-	unsigned int immediate : 20;
+	signed int immediate : 20;
 	unsigned int opcode : 7;
 };
 
 struct reg1i21_format {
-	unsigned int immediate_h  : 5;
+	signed int immediate_h  : 5;
 	unsigned int rj : 5;
-	unsigned int immediate_l : 16;
+	signed int immediate_l : 16;
 	unsigned int opcode : 6;
 };
 
 struct reg2i12_format {
 	unsigned int rd : 5;
 	unsigned int rj : 5;
-	unsigned int immediate : 12;
+	signed int immediate : 12;
 	unsigned int opcode : 10;
 };
 
 struct reg2i16_format {
 	unsigned int rd : 5;
 	unsigned int rj : 5;
-	unsigned int immediate : 16;
+	signed int immediate : 16;
 	unsigned int opcode : 6;
 };
 
-- 
2.1.0


  reply	other threads:[~2022-08-09  2:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09  2:52 [RFC PATCH 0/5] Add BPF JIT support for LoongArch Tiezhu Yang
2022-08-09  2:52 ` Tiezhu Yang [this message]
2022-08-09 12:01   ` [RFC PATCH 1/5] LoongArch: Fix some instruction formats Youling Tang
2022-08-09 12:55     ` Huacai Chen
2022-08-09  2:52 ` [RFC PATCH 2/5] LoongArch: Add some instruction opcodes and formats Tiezhu Yang
2022-08-09  2:52 ` [RFC PATCH 3/5] LoongArch: Add BPF JIT support Tiezhu Yang
2022-08-09  3:56   ` Jinyang He
2022-08-09  4:55   ` Qing Zhang
2022-08-09 12:35   ` Youling Tang
2022-08-09  2:52 ` [RFC PATCH 4/5] LoongArch: Update loongson3_defconfig to make it clean Tiezhu Yang
2022-08-09  2:53 ` [RFC PATCH 5/5] LoongArch: Enable BPF_JIT and TEST_BPF in loongson3_defconfig Tiezhu Yang

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=1660013580-19053-2-git-send-email-yangtiezhu@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=loongarch@lists.linux.dev \
    /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.