<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/loongarch, branch 0x221E-v0.0-v7.0</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=0x221E-v0.0-v7.0</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=0x221E-v0.0-v7.0'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2026-03-26T06:29:09Z</updated>
<entry>
<title>LoongArch: KVM: Fix base address calculation in kvm_eiointc_regs_access()</title>
<updated>2026-03-26T06:29:09Z</updated>
<author>
<name>Bibo Mao</name>
</author>
<published>2026-03-26T06:29:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6bcfb7f46d667b04bd1a1169ccedf5fb699c60df'/>
<id>urn:sha1:6bcfb7f46d667b04bd1a1169ccedf5fb699c60df</id>
<content type='text'>
In function kvm_eiointc_regs_access(), the register base address is
caculated from array base address plus offset, the offset is absolute
value from the base address. The data type of array base address is
u64, it should be converted into the "void *" type and then plus the
offset.

Cc: &lt;stable@vger.kernel.org&gt;
Fixes: d3e43a1f34ac ("LoongArch: KVM: Use 64-bit register definition for EIOINTC").
Reported-by: Aurelien Jarno &lt;aurel32@debian.org&gt;
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1131431
Signed-off-by: Bibo Mao &lt;maobibo@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: KVM: Handle the case that EIOINTC's coremap is empty</title>
<updated>2026-03-26T06:29:09Z</updated>
<author>
<name>Huacai Chen</name>
</author>
<published>2026-03-26T06:29:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b97bd69eb0f67b5f961b304d28e9ba45e202d841'/>
<id>urn:sha1:b97bd69eb0f67b5f961b304d28e9ba45e202d841</id>
<content type='text'>
EIOINTC's coremap in eiointc_update_sw_coremap() can be empty, currently
we get a cpuid with -1 in this case, but we actually need 0 because it's
similar as the case that cpuid &gt;= 4.

This fix an out-of-bounds access to kvm_arch::phyid_map::phys_map[].

Cc: &lt;stable@vger.kernel.org&gt;
Fixes: 3956a52bc05bd81 ("LoongArch: KVM: Add EIOINTC read and write functions")
Reported-by: Aurelien Jarno &lt;aurel32@debian.org&gt;
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1131431
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: KVM: Make kvm_get_vcpu_by_cpuid() more robust</title>
<updated>2026-03-26T06:29:09Z</updated>
<author>
<name>Huacai Chen</name>
</author>
<published>2026-03-26T06:29:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2db06c15d8c7a0ccb6108524e16cd9163753f354'/>
<id>urn:sha1:2db06c15d8c7a0ccb6108524e16cd9163753f354</id>
<content type='text'>
kvm_get_vcpu_by_cpuid() takes a cpuid parameter whose type is int, so
cpuid can be negative. Let kvm_get_vcpu_by_cpuid() return NULL for this
case so as to make it more robust.

This fix an out-of-bounds access to kvm_arch::phyid_map::phys_map[].

Cc: &lt;stable@vger.kernel.org&gt;
Fixes: 73516e9da512adc ("LoongArch: KVM: Add vcpu mapping from physical cpuid")
Reported-by: Aurelien Jarno &lt;aurel32@debian.org&gt;
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1131431
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: vDSO: Emit GNU_EH_FRAME correctly</title>
<updated>2026-03-26T06:29:09Z</updated>
<author>
<name>Xi Ruoyao</name>
</author>
<published>2026-03-26T06:29:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e4878c37f6679fdea91b27a0f4e60a871f0b7bad'/>
<id>urn:sha1:e4878c37f6679fdea91b27a0f4e60a871f0b7bad</id>
<content type='text'>
With -fno-asynchronous-unwind-tables and --no-eh-frame-hdr (the default
of the linker), the GNU_EH_FRAME segment (specified by vdso.lds.S) is
empty.  This is not valid, as the current DWARF specification mandates
the first byte of the EH frame to be the version number 1.  It causes
some unwinders to complain, for example the ClickHouse query profiler
spams the log with messages:

    clickhouse-server[365854]: libunwind: unsupported .eh_frame_hdr
    version: 127 at 7ffffffb0000

Here "127" is just the byte located at the p_vaddr (0, i.e. the
beginning of the vDSO) of the empty GNU_EH_FRAME segment. Cross-
checking with /proc/365854/maps has also proven 7ffffffb0000 is the
start of vDSO in the process VM image.

In LoongArch the -fno-asynchronous-unwind-tables option seems just a
MIPS legacy, and MIPS only uses this option to satisfy the MIPS-specific
"genvdso" program, per the commit cfd75c2db17e ("MIPS: VDSO: Explicitly
use -fno-asynchronous-unwind-tables").  IIRC it indicates some inherent
limitation of the MIPS ELF ABI and has nothing to do with LoongArch.  So
we can simply flip it over to -fasynchronous-unwind-tables and pass
--eh-frame-hdr for linking the vDSO, allowing the profilers to unwind the
stack for statistics even if the sample point is taken when the PC is in
the vDSO.

However simply adjusting the options above would exploit an issue: when
the libgcc unwinder saw the invalid GNU_EH_FRAME segment, it silently
falled back to a machine-specific routine to match the code pattern of
rt_sigreturn() and extract the registers saved in the sigframe if the
code pattern is matched.  As unwinding from signal handlers is vital for
libgcc to support pthread cancellation etc., the fall-back routine had
been silently keeping the LoongArch Linux systems functioning since
Linux 5.19.  But when we start to emit GNU_EH_FRAME with the correct
format, fall-back routine will no longer be used and libgcc will fail
to unwind the sigframe, and unwinding from signal handlers will no
longer work, causing dozens of glibc test failures.  To make it possible
to unwind from signal handlers again, it's necessary to code the unwind
info in __vdso_rt_sigreturn via .cfi_* directives.

The offsets in the .cfi_* directives depend on the layout of struct
sigframe, notably the offset of sigcontext in the sigframe.  To use the
offset in the assembly file, factor out struct sigframe into a header to
allow asm-offsets.c to output the offset for assembly.

To work around a long-term issue in the libgcc unwinder (the pc is
unconditionally substracted by 1: doing so is technically incorrect for
a signal frame), a nop instruction is included with the two real
instructions in __vdso_rt_sigreturn in the same FDE PC range.  The same
hack has been used on x86 for a long time.

Cc: stable@vger.kernel.org
Fixes: c6b99bed6b8f ("LoongArch: Add VDSO and VSYSCALL support")
Signed-off-by: Xi Ruoyao &lt;xry111@xry111.site&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Workaround LS2K/LS7A GPU DMA hang bug</title>
<updated>2026-03-26T06:29:09Z</updated>
<author>
<name>Huacai Chen</name>
</author>
<published>2026-03-26T06:29:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=95db0c9f526d583634cddb2e5914718570fbac87'/>
<id>urn:sha1:95db0c9f526d583634cddb2e5914718570fbac87</id>
<content type='text'>
1. Hardware limitation: GPU, DC and VPU are typically PCI device 06.0,
06.1 and 06.2. They share some hardware resources, so when configure the
PCI 06.0 device BAR1, DMA memory access cannot be performed through this
BAR, otherwise it will cause hardware abnormalities.

2. In typical scenarios of reboot or S3/S4, DC access to memory through
BAR is not prohibited, resulting in GPU DMA hangs.

3. Workaround method: When configuring the 06.0 device BAR1, turn off
the memory access of DC, GPU and VPU (via DC's CRTC registers).

Cc: stable@vger.kernel.org
Signed-off-by: Qianhai Wu &lt;wuqianhai@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Fix missing NULL checks for kstrdup()</title>
<updated>2026-03-26T06:29:08Z</updated>
<author>
<name>Li Jun</name>
</author>
<published>2026-03-26T06:29:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3a28daa9b7d7c2ddf2c722e9e95d7e0928bf0cd1'/>
<id>urn:sha1:3a28daa9b7d7c2ddf2c722e9e95d7e0928bf0cd1</id>
<content type='text'>
1. Replace "of_find_node_by_path("/")" with "of_root" to avoid multiple
calls to "of_node_put()".

2. Fix a potential kernel oops during early boot when memory allocation
fails while parsing CPU model from device tree.

Cc: stable@vger.kernel.org
Signed-off-by: Li Jun &lt;lijun01@kylinos.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: KVM: Fix typo issue in kvm_vm_init_features()</title>
<updated>2026-03-16T02:36:02Z</updated>
<author>
<name>Bibo Mao</name>
</author>
<published>2026-03-16T02:36:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c252c12d1f55bd5737e3b8e7839914ccdc7a701c'/>
<id>urn:sha1:c252c12d1f55bd5737e3b8e7839914ccdc7a701c</id>
<content type='text'>
Most of VM feature detections are integer OR operations, and integer
assignment operation will clear previous integer OR operation. So here
change all integer assignment operations to integer OR operations.

Fixes: 82db90bf461b ("LoongArch: KVM: Move feature detection in kvm_vm_init_features()")
Signed-off-by: Bibo Mao &lt;maobibo@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: BPF: Make arch_protect_bpf_trampoline() return 0</title>
<updated>2026-03-16T02:36:01Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2026-03-16T02:36:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b254c629a963f0b9d635902f3f979bddbc65f90f'/>
<id>urn:sha1:b254c629a963f0b9d635902f3f979bddbc65f90f</id>
<content type='text'>
Occasionally there exist "text_copy_cb: operation failed" when executing
the bpf selftests, the reason is copy_to_kernel_nofault() failed and the
ecode of ESTAT register is 0x4 (PME: Page Modification Exception) due to
the pte is not writeable. The root cause is that there is another place
to set the pte entry as readonly which is in the generic weak version of
arch_protect_bpf_trampoline().

There are two ways to fix this race condition issue: the direct way is
to modify the generic weak arch_protect_bpf_trampoline() to add a mutex
lock for set_memory_rox(), but the other simple and proper way is to
just make arch_protect_bpf_trampoline() return 0 in the arch-specific
code because LoongArch has already use the BPF prog pack allocator for
trampoline.

Here are the trimmed kernel log messages:

  copy_to_kernel_nofault: memory access failed, ecode 0x4
  copy_to_kernel_nofault: the caller is text_copy_cb+0x50/0xa0
  text_copy_cb: operation failed
  ------------[ cut here ]------------
  bpf_prog_pack bug: missing bpf_arch_text_invalidate?
  WARNING: kernel/bpf/core.c:1008 at bpf_prog_pack_free+0x200/0x228
  ...
  Call Trace:
  [&lt;9000000000248914&gt;] show_stack+0x64/0x188
  [&lt;9000000000241308&gt;] dump_stack_lvl+0x6c/0x9c
  [&lt;90000000002705bc&gt;] __warn+0x9c/0x200
  [&lt;9000000001c428c0&gt;] __report_bug+0xa8/0x1c0
  [&lt;9000000001c42b5c&gt;] report_bug+0x64/0x120
  [&lt;9000000001c7dcd0&gt;] do_bp+0x270/0x3c0
  [&lt;9000000000246f40&gt;] handle_bp+0x120/0x1c0
  [&lt;900000000047b030&gt;] bpf_prog_pack_free+0x200/0x228
  [&lt;900000000047b2ec&gt;] bpf_jit_binary_pack_free+0x24/0x60
  [&lt;900000000026989c&gt;] bpf_jit_free+0x54/0xb0
  [&lt;900000000029e10c&gt;] process_one_work+0x184/0x610
  [&lt;900000000029ef8c&gt;] worker_thread+0x24c/0x388
  [&lt;90000000002a902c&gt;] kthread+0x13c/0x170
  [&lt;9000000001c7dfe8&gt;] ret_from_kernel_thread+0x28/0x1c0
  [&lt;9000000000246624&gt;] ret_from_kernel_thread_asm+0xc/0x88

  ---[ end trace 0000000000000000 ]---

Here is a simple shell script to reproduce:

  #!/bin/bash

  for ((i=1; i&lt;=1000; i++))
  do
    echo "Under testing $i ..."
    dmesg -c &gt; /dev/null
    ./test_progs -t fentry_attach_stress &gt; /dev/null
    dmesg -t | grep "text_copy_cb: operation failed"
    if [ $? -eq 0 ]; then
      break
    fi
  done

Cc: stable@vger.kernel.org
Fixes: 4ab17e762b34 ("LoongArch: BPF: Use BPF prog pack allocator")
Acked-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: No need to flush icache if text copy failed</title>
<updated>2026-03-16T02:36:01Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2026-03-16T02:36:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d3b8491961207ac967795c34375890407fd51a45'/>
<id>urn:sha1:d3b8491961207ac967795c34375890407fd51a45</id>
<content type='text'>
If copy_to_kernel_nofault() failed, no need to flush icache and just
return immediately.

Cc: stable@vger.kernel.org
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 return values for set_memory_{rw,rox}</title>
<updated>2026-03-16T02:36:01Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2026-03-16T02:36:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=431ce839dad66d0d56fb604785452c6a57409f35'/>
<id>urn:sha1:431ce839dad66d0d56fb604785452c6a57409f35</id>
<content type='text'>
set_memory_rw() and set_memory_rox() may fail, so we should check the
return values and return immediately in larch_insn_text_copy().

Cc: stable@vger.kernel.org
Signed-off-by: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
</feed>
