Skip to content

Commit db740f5

Browse files
seehearfeelchenhuacai
authored andcommitted
LoongArch: Handle new atomic instructions for probes
The atomic instructions sc.q, llacq.{w/d}, screl.{w/d} were newly added in the LoongArch Reference Manual v1.10, it is necessary to handle them in insns_not_supported() to avoid putting a breakpoint in the middle of a ll/sc atomic sequence, otherwise it will loop forever for kprobes and uprobes. Signed-off-by: Tiezhu Yang <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 892979b commit db740f5

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

arch/loongarch/include/asm/inst.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ enum reg2_op {
7777
iocsrwrh_op = 0x19205,
7878
iocsrwrw_op = 0x19206,
7979
iocsrwrd_op = 0x19207,
80+
llacqw_op = 0xe15e0,
81+
screlw_op = 0xe15e1,
82+
llacqd_op = 0xe15e2,
83+
screld_op = 0xe15e3,
8084
};
8185

8286
enum reg2i5_op {
@@ -189,6 +193,7 @@ enum reg3_op {
189193
fldxd_op = 0x7068,
190194
fstxs_op = 0x7070,
191195
fstxd_op = 0x7078,
196+
scq_op = 0x70ae,
192197
amswapw_op = 0x70c0,
193198
amswapd_op = 0x70c1,
194199
amaddw_op = 0x70c2,

arch/loongarch/kernel/inst.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ bool insns_not_supported(union loongarch_instruction insn)
141141
case amswapw_op ... ammindbdu_op:
142142
pr_notice("atomic memory access instructions are not supported\n");
143143
return true;
144+
case scq_op:
145+
pr_notice("sc.q instruction is not supported\n");
146+
return true;
144147
}
145148

146149
switch (insn.reg2i14_format.opcode) {
@@ -152,6 +155,15 @@ bool insns_not_supported(union loongarch_instruction insn)
152155
return true;
153156
}
154157

158+
switch (insn.reg2_format.opcode) {
159+
case llacqw_op:
160+
case llacqd_op:
161+
case screlw_op:
162+
case screld_op:
163+
pr_notice("llacq and screl instructions are not supported\n");
164+
return true;
165+
}
166+
155167
switch (insn.reg1i21_format.opcode) {
156168
case bceqz_op:
157169
pr_notice("bceqz and bcnez instructions are not supported\n");

0 commit comments

Comments
 (0)