<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/loongarch/kernel/inst.c, branch linux-6.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2025-10-02T14:39:35Z</updated>
<entry>
<title>LoongArch: Handle new atomic instructions for probes</title>
<updated>2025-10-02T14:39:35Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2025-10-02T14:39:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=db740f5689e61f2e75b73e5c8e7c985a3b4bc045'/>
<id>urn:sha1:db740f5689e61f2e75b73e5c8e7c985a3b4bc045</id>
<content type='text'>
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 &lt;yangtiezhu@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: BPF: Add dynamic code modification support</title>
<updated>2025-08-05T11:00:18Z</updated>
<author>
<name>Chenghao Duan</name>
</author>
<published>2025-08-05T11:00:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9fbd18cf4c69f512f7de3ab73235078f3e32ecec'/>
<id>urn:sha1:9fbd18cf4c69f512f7de3ab73235078f3e32ecec</id>
<content type='text'>
This commit adds support for BPF dynamic code modification on the
LoongArch architecture:
1. Add bpf_arch_text_copy() for instruction block copying.
2. Add bpf_arch_text_poke() for runtime instruction patching.
3. Add bpf_arch_text_invalidate() for code invalidation.

On LoongArch, since symbol addresses in the direct mapping region can't
be reached via relative jump instructions from the paged mapping region,
we use the move_imm+jirl instruction pair as absolute jump instructions.
These require 2-5 instructions, so we reserve 5 NOP instructions in the
program as placeholders for function jumps.

The larch_insn_text_copy() function is solely used for BPF. And the use
of larch_insn_text_copy() requires PAGE_SIZE alignment. Currently, only
the size of the BPF trampoline is page-aligned.

Co-developed-by: George Guo &lt;guodongtai@kylinos.cn&gt;
Signed-off-by: George Guo &lt;guodongtai@kylinos.cn&gt;
Signed-off-by: Chenghao Duan &lt;duanchenghao@kylinos.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Add larch_insn_gen_{beq,bne} helpers</title>
<updated>2025-08-03T14:49:50Z</updated>
<author>
<name>Chenghao Duan</name>
</author>
<published>2025-08-03T14:49:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6ab55e0a9eac638ca390bfaef6408c10c127e623'/>
<id>urn:sha1:6ab55e0a9eac638ca390bfaef6408c10c127e623</id>
<content type='text'>
Add larch_insn_gen_beq() and larch_insn_gen_bne() helpers which will be
used in BPF trampoline implementation.

Reviewed-by: Hengqi Chen &lt;hengqi.chen@gmail.com&gt;
Co-developed-by: George Guo &lt;guodongtai@kylinos.cn&gt;
Signed-off-by: George Guo &lt;guodongtai@kylinos.cn&gt;
Co-developed-by: Youling Tang &lt;tangyouling@kylinos.cn&gt;
Signed-off-by: Youling Tang &lt;tangyouling@kylinos.cn&gt;
Signed-off-by: Chenghao Duan &lt;duanchenghao@kylinos.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: BPF: Adjust the parameter of emit_jirl()</title>
<updated>2024-12-02T08:42:08Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2024-12-02T08:42:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c1474bb0b7cff4e8481095bd0618b8f6c2f0aeb4'/>
<id>urn:sha1:c1474bb0b7cff4e8481095bd0618b8f6c2f0aeb4</id>
<content type='text'>
The branch instructions beq, bne, blt, bge, bltu, bgeu and jirl belong
to the format reg2i16, but the sequence of oprand is different for the
instruction jirl. So adjust the parameter order of emit_jirl() to make
it more readable correspond with the Instruction Set Architecture manual.

Here are the instruction formats:

  beq     rj, rd, offs16
  bne     rj, rd, offs16
  blt     rj, rd, offs16
  bge     rj, rd, offs16
  bltu    rj, rd, offs16
  bgeu    rj, rd, offs16
  jirl    rd, rj, offs16

Link: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#branch-instructions
Suggested-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
Signed-off-by: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Add larch_insn_gen_break() to generate break insns</title>
<updated>2023-06-29T12:58:44Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2023-06-29T12:58:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=49ed320da5f52ec729e7f2f9edbc6e79848455bd'/>
<id>urn:sha1:49ed320da5f52ec729e7f2f9edbc6e79848455bd</id>
<content type='text'>
There exist various break insns such as BRK_KPROBE_BP, BRK_KPROBE_SSTEPBP,
BRK_UPROBE_BP and BRK_UPROBE_XOLBP, add larch_insn_gen_break() to generate
break insns simpler, this is preparation for later patch.

Tested-by: Jeff Xie &lt;xiehuan09@gmail.com&gt;
Signed-off-by: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Check for AMO instructions in insns_not_supported()</title>
<updated>2023-06-29T12:58:44Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2023-06-29T12:58:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b82fad4d5deb2c2a15fdb581a1e6725dcea666e7'/>
<id>urn:sha1:b82fad4d5deb2c2a15fdb581a1e6725dcea666e7</id>
<content type='text'>
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 &lt;xiehuan09@gmail.com&gt;
Reported-by: Hengqi Chen &lt;hengqi.chen@gmail.com&gt;
Signed-off-by: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Move three functions from kprobes.c to inst.c</title>
<updated>2023-06-29T12:58:44Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2023-06-29T12:58:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3d2c3daf82544283c5597028a8a3efc9ac0fb02b'/>
<id>urn:sha1:3d2c3daf82544283c5597028a8a3efc9ac0fb02b</id>
<content type='text'>
The three functions insns_not_supported(), insns_need_simulation() and
arch_simulate_insn() will be used for uprobes, move them from kprobes.c
to inst.c, this is preparation for later patch, no functionality change.

Tested-by: Jeff Xie &lt;xiehuan09@gmail.com&gt;
Signed-off-by: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Add guard for the larch_insn_gen_xxx functions</title>
<updated>2023-06-29T12:58:42Z</updated>
<author>
<name>WANG Rui</name>
</author>
<published>2023-06-29T12:58:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0d03e9dce5c91d841a35af05ca61a5cf318f5064'/>
<id>urn:sha1:0d03e9dce5c91d841a35af05ca61a5cf318f5064</id>
<content type='text'>
Add guard for the larch_insn_gen_xxx functions to verify whether the
immediate operand is within the acceptable range.

Signed-off-by: WANG Rui &lt;wangrui@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Simulate branch and PC* instructions</title>
<updated>2023-02-25T14:12:17Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2023-02-25T07:52:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9b3441a6b0e1ed4796e7f5a8586c4d6023c4e3ab'/>
<id>urn:sha1:9b3441a6b0e1ed4796e7f5a8586c4d6023c4e3ab</id>
<content type='text'>
According to LoongArch Reference Manual, simulate branch and PC*
instructions, this is preparation for later patch.

Link: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#branch-instructions
Link: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_pcaddi_pcaddu121_pcaddu18l_pcalau12i

Tested-by: Jeff Xie &lt;xiehuan09@gmail.com&gt;
Co-developed-by: Jinyang He &lt;hejinyang@loongson.cn&gt;
Signed-off-by: Jinyang He &lt;hejinyang@loongson.cn&gt;
Signed-off-by: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Simplify larch_insn_gen_xxx implementation</title>
<updated>2023-01-17T03:42:16Z</updated>
<author>
<name>Youling Tang</name>
</author>
<published>2023-01-17T03:42:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3200983fa8e2c8aa17ed911b617b4a248bcb1267'/>
<id>urn:sha1:3200983fa8e2c8aa17ed911b617b4a248bcb1267</id>
<content type='text'>
Simplify larch_insn_gen_xxx implementation by reusing emit_xxx.

Signed-off-by: Youling Tang &lt;tangyouling@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
</feed>
