Skip to content

Commit b82fad4

Browse files
seehearfeelchenhuacai
authored andcommitted
LoongArch: Check for AMO instructions in insns_not_supported()
Like llsc instructions, the atomic memory access instructions shouldn't be supported for probing, so check for them in insns_not_supported(). Closes: https://lore.kernel.org/all/SY4P282MB351877A70A0333C790FE85A5C09C9@SY4P282MB3518.AUSP282.PROD.OUTLOOK.COM/ Tested-by: Jeff Xie <[email protected]> Reported-by: Hengqi Chen <[email protected]> Signed-off-by: Tiezhu Yang <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 3d2c3da commit b82fad4

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

arch/loongarch/include/asm/inst.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,32 @@ enum reg3_op {
187187
amord_op = 0x70c7,
188188
amxorw_op = 0x70c8,
189189
amxord_op = 0x70c9,
190+
ammaxw_op = 0x70ca,
191+
ammaxd_op = 0x70cb,
192+
amminw_op = 0x70cc,
193+
ammind_op = 0x70cd,
194+
ammaxwu_op = 0x70ce,
195+
ammaxdu_op = 0x70cf,
196+
amminwu_op = 0x70d0,
197+
ammindu_op = 0x70d1,
198+
amswapdbw_op = 0x70d2,
199+
amswapdbd_op = 0x70d3,
200+
amadddbw_op = 0x70d4,
201+
amadddbd_op = 0x70d5,
202+
amanddbw_op = 0x70d6,
203+
amanddbd_op = 0x70d7,
204+
amordbw_op = 0x70d8,
205+
amordbd_op = 0x70d9,
206+
amxordbw_op = 0x70da,
207+
amxordbd_op = 0x70db,
208+
ammaxdbw_op = 0x70dc,
209+
ammaxdbd_op = 0x70dd,
210+
ammindbw_op = 0x70de,
211+
ammindbd_op = 0x70df,
212+
ammaxdbwu_op = 0x70e0,
213+
ammaxdbdu_op = 0x70e1,
214+
ammindbwu_op = 0x70e2,
215+
ammindbdu_op = 0x70e3,
190216
fldgts_op = 0x70e8,
191217
fldgtd_op = 0x70e9,
192218
fldles_op = 0x70ea,

arch/loongarch/kernel/inst.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ void simu_branch(struct pt_regs *regs, union loongarch_instruction insn)
135135

136136
bool insns_not_supported(union loongarch_instruction insn)
137137
{
138+
switch (insn.reg3_format.opcode) {
139+
case amswapw_op ... ammindbdu_op:
140+
pr_notice("atomic memory access instructions are not supported\n");
141+
return true;
142+
}
143+
138144
switch (insn.reg2i14_format.opcode) {
139145
case llw_op:
140146
case lld_op:

0 commit comments

Comments
 (0)