<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/arch/loongarch/lib, branch master</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=master</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-12-08T10:09:17Z</updated>
<entry>
<title>LoongArch: Adjust misc routines for 32BIT/64BIT</title>
<updated>2025-12-08T10:09:17Z</updated>
<author>
<name>Huacai Chen</name>
<email>chenhuacai@loongson.cn</email>
</author>
<published>2025-12-08T10:09:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b15dfdacd99dc0014413c71bc1157fc4e895ce68'/>
<id>urn:sha1:b15dfdacd99dc0014413c71bc1157fc4e895ce68</id>
<content type='text'>
Adjust misc routines for both 32BIT and 64BIT, including: bitops, bswap,
checksum, string, jump label, unaligned access emulator, suspend/wakeup
routines, etc.

Reviewed-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Jiaxun Yang &lt;jiaxun.yang@flygoat.com&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Adjust user accessors for 32BIT/64BIT</title>
<updated>2025-12-08T10:09:17Z</updated>
<author>
<name>Huacai Chen</name>
<email>chenhuacai@loongson.cn</email>
</author>
<published>2025-12-08T10:09:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=48c7294775be0f17ffd8a7d5ef0df3ab5e696ab4'/>
<id>urn:sha1:48c7294775be0f17ffd8a7d5ef0df3ab5e696ab4</id>
<content type='text'>
Adjust user accessors for both 32BIT and 64BIT, including: get_user(),
put_user(), copy_user(), clear_user(), etc.

Reviewed-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Jiaxun Yang &lt;jiaxun.yang@flygoat.com&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Adjust memory management for 32BIT/64BIT</title>
<updated>2025-12-08T10:09:17Z</updated>
<author>
<name>Huacai Chen</name>
<email>chenhuacai@loongson.cn</email>
</author>
<published>2025-12-08T10:09:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dd55dd0d7e5ddceb6df451dac208af38609d1963'/>
<id>urn:sha1:dd55dd0d7e5ddceb6df451dac208af38609d1963</id>
<content type='text'>
Adjust memory management for both 32BIT and 64BIT, including: address
space definition, DMW CSR definition, page table bits definition, boot
time detection of VA/PA bits, page table init, tlb exception handling,
copy_page/clear_page/dump_tlb libraries, etc.

Reviewed-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Jiaxun Yang &lt;jiaxun.yang@flygoat.com&gt;
Signed-off-by: Yawei Li &lt;liyawei@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Add adaptive CSR accessors for 32BIT/64BIT</title>
<updated>2025-12-06T02:40:32Z</updated>
<author>
<name>Huacai Chen</name>
<email>chenhuacai@loongson.cn</email>
</author>
<published>2025-12-06T02:40:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=81f5d15c48c441a2dadd3c4132fb80d8404fe7af'/>
<id>urn:sha1:81f5d15c48c441a2dadd3c4132fb80d8404fe7af</id>
<content type='text'>
32BIT platforms only have 32bit CSR/IOCSR registers, 64BIT platforms
have both 32bit/64bit CSR/IOCSR registers. Now there are both 32bit and
64bit CSR accessors:

csr_read32()/csr_write32()/csr_xchg32();
csr_read64()/csr_write64()/csr_xchg64();

Some CSR registers (address and timer registers) are 32bit length on
32BIT platform and 64bit length on 64BIT platform. To avoid #ifdefs here
and there, they need adaptive accessors, so we define and use:

csr_read()/csr_write()/csr_xchg();

IOCSR doesn't have a "natural length", which means a 64bit register can
be treated as two 32bit registers, so we just use two 32bit accessors to
emulate a 64bit accessors.

Reviewed-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Jiaxun Yang &lt;jiaxun.yang@flygoat.com&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>lib/crc: loongarch: Migrate optimized CRC code into lib/crc/</title>
<updated>2025-06-30T16:31:57Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@kernel.org</email>
</author>
<published>2025-06-07T20:04:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b10d2d20d9786c14133c76cc6aee13e46664dabc'/>
<id>urn:sha1:b10d2d20d9786c14133c76cc6aee13e46664dabc</id>
<content type='text'>
Move the loongarch-optimized CRC code from arch/loongarch/lib/crc* into
its new location in lib/crc/loongarch/, and wire it up in the new way.
This new way of organizing the CRC code eliminates the need to
artificially split the code for each CRC variant into separate arch and
generic modules, enabling better inlining and dead code elimination.
For more details, see "lib/crc: Prepare for arch-optimized code in
subdirs of lib/crc/".

Reviewed-by: "Martin K. Petersen" &lt;martin.petersen@oracle.com&gt;
Acked-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Acked-by: "Jason A. Donenfeld" &lt;Jason@zx2c4.com&gt;
Link: https://lore.kernel.org/r/20250607200454.73587-6-ebiggers@kernel.org
Signed-off-by: Eric Biggers &lt;ebiggers@kernel.org&gt;
</content>
</entry>
<entry>
<title>LoongArch: Fix build warnings about export.h</title>
<updated>2025-06-26T12:07:18Z</updated>
<author>
<name>Huacai Chen</name>
<email>chenhuacai@loongson.cn</email>
</author>
<published>2025-06-26T12:07:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7d69294b8a8d0e19600797711ed3bc047fead1c1'/>
<id>urn:sha1:7d69294b8a8d0e19600797711ed3bc047fead1c1</id>
<content type='text'>
After commit a934a57a42f64a4 ("scripts/misc-check: check missing #include
&lt;linux/export.h&gt; when W=1") and 7d95680d64ac8e836c ("scripts/misc-check:
check unnecessary #include &lt;linux/export.h&gt; when W=1"), we get some build
warnings with W=1:

arch/loongarch/kernel/acpi.c: warning: EXPORT_SYMBOL() is used, but #include &lt;linux/export.h&gt; is missing
arch/loongarch/kernel/alternative.c: warning: EXPORT_SYMBOL() is used, but #include &lt;linux/export.h&gt; is missing
arch/loongarch/kernel/kfpu.c: warning: EXPORT_SYMBOL() is used, but #include &lt;linux/export.h&gt; is missing
arch/loongarch/kernel/traps.c: warning: EXPORT_SYMBOL() is used, but #include &lt;linux/export.h&gt; is missing
arch/loongarch/kernel/unwind_guess.c: warning: EXPORT_SYMBOL() is used, but #include &lt;linux/export.h&gt; is missing
arch/loongarch/kernel/unwind_orc.c: warning: EXPORT_SYMBOL() is used, but #include &lt;linux/export.h&gt; is missing
arch/loongarch/kernel/unwind_prologue.c: warning: EXPORT_SYMBOL() is used, but #include &lt;linux/export.h&gt; is missing
arch/loongarch/lib/crc32-loongarch.c: warning: EXPORT_SYMBOL() is used, but #include &lt;linux/export.h&gt; is missing
arch/loongarch/lib/csum.c: warning: EXPORT_SYMBOL() is used, but #include &lt;linux/export.h&gt; is missing
arch/loongarch/kernel/elf.c: warning: EXPORT_SYMBOL() is not used, but #include &lt;linux/export.h&gt; is present
arch/loongarch/kernel/paravirt.c: warning: EXPORT_SYMBOL() is not used, but #include &lt;linux/export.h&gt; is present
arch/loongarch/pci/pci.c: warning: EXPORT_SYMBOL() is not used, but #include &lt;linux/export.h&gt; is present

So fix these build warnings for LoongArch.

Reviewed-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>lib/crc: make arch-optimized code use subsys_initcall</title>
<updated>2025-05-10T04:02:37Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2025-05-10T03:59:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=648c7fb16f609c53d2659fefb5088af619485ab4'/>
<id>urn:sha1:648c7fb16f609c53d2659fefb5088af619485ab4</id>
<content type='text'>
Make the architecture-optimized CRC code do its CPU feature checks in
subsys_initcalls instead of arch_initcalls.  This makes it consistent
with arch/*/lib/crypto/ and ensures that it runs after initcalls that
possibly could be a prerequisite for kernel-mode FPU, such as x86's
xfd_update_static_branch() and loongarch's init_euen_mask().

Note: as far as I can tell, x86's xfd_update_static_branch() isn't
*actually* needed for kernel-mode FPU.  loongarch's init_euen_mask() is
needed to enable save/restore of the vector registers, but loongarch
doesn't yet have any CRC or crypto code that uses vector registers
anyway.  Regardless, let's be consistent with arch/*/lib/crypto/ and
robust against any potential future dependency on an arch_initcall.

Link: https://lore.kernel.org/r/20250510035959.87995-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
</content>
</entry>
<entry>
<title>lib/crc: make the CPU feature static keys __ro_after_init</title>
<updated>2025-04-28T16:07:19Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2025-04-13T15:43:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7ef377c4d4abb7a2a74fc319dc1bce46f2449af7'/>
<id>urn:sha1:7ef377c4d4abb7a2a74fc319dc1bce46f2449af7</id>
<content type='text'>
All of the CRC library's CPU feature static_keys are initialized by
initcalls and never change afterwards, so there's no need for them to be
in the regular .data section.  Put them in .data..ro_after_init instead.

Reviewed-by: "Martin K. Petersen" &lt;martin.petersen@oracle.com&gt;
Acked-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Acked-by: Heiko Carstens &lt;hca@linux.ibm.com&gt; # s390
Link: https://lore.kernel.org/r/20250413154350.10819-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'crc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux</title>
<updated>2025-03-26T01:33:04Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2025-03-26T01:33:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ee6740fd34eb53c5c76be01201c15310f461b69f'/>
<id>urn:sha1:ee6740fd34eb53c5c76be01201c15310f461b69f</id>
<content type='text'>
Pull CRC updates from Eric Biggers:
 "Another set of improvements to the kernel's CRC (cyclic redundancy
  check) code:

   - Rework the CRC64 library functions to be directly optimized, like
     what I did last cycle for the CRC32 and CRC-T10DIF library
     functions

   - Rewrite the x86 PCLMULQDQ-optimized CRC code, and add VPCLMULQDQ
     support and acceleration for crc64_be and crc64_nvme

   - Rewrite the riscv Zbc-optimized CRC code, and add acceleration for
     crc_t10dif, crc64_be, and crc64_nvme

   - Remove crc_t10dif and crc64_rocksoft from the crypto API, since
     they are no longer needed there

   - Rename crc64_rocksoft to crc64_nvme, as the old name was incorrect

   - Add kunit test cases for crc64_nvme and crc7

   - Eliminate redundant functions for calculating the Castagnoli CRC32,
     settling on just crc32c()

   - Remove unnecessary prompts from some of the CRC kconfig options

   - Further optimize the x86 crc32c code"

* tag 'crc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux: (36 commits)
  x86/crc: drop the avx10_256 functions and rename avx10_512 to avx512
  lib/crc: remove unnecessary prompt for CONFIG_CRC64
  lib/crc: remove unnecessary prompt for CONFIG_LIBCRC32C
  lib/crc: remove unnecessary prompt for CONFIG_CRC8
  lib/crc: remove unnecessary prompt for CONFIG_CRC7
  lib/crc: remove unnecessary prompt for CONFIG_CRC4
  lib/crc7: unexport crc7_be_syndrome_table
  lib/crc_kunit.c: update comment in crc_benchmark()
  lib/crc_kunit.c: add test and benchmark for crc7_be()
  x86/crc32: optimize tail handling for crc32c short inputs
  riscv/crc64: add Zbc optimized CRC64 functions
  riscv/crc-t10dif: add Zbc optimized CRC-T10DIF function
  riscv/crc32: reimplement the CRC32 functions using new template
  riscv/crc: add "template" for Zbc optimized CRC functions
  x86/crc: add ANNOTATE_NOENDBR to suppress objtool warnings
  x86/crc32: improve crc32c_arch() code generation with clang
  x86/crc64: implement crc64_be and crc64_nvme using new template
  x86/crc-t10dif: implement crc_t10dif using new template
  x86/crc32: implement crc32_le using new template
  x86/crc: add "template" for [V]PCLMULQDQ based CRC functions
  ...
</content>
</entry>
<entry>
<title>LoongArch: csum: Fix OoB access in IP checksum code for negative lengths</title>
<updated>2025-02-13T04:02:40Z</updated>
<author>
<name>Yuli Wang</name>
<email>wangyuli@uniontech.com</email>
</author>
<published>2025-02-13T04:02:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6287f1a8c16138c2ec750953e35039634018c84a'/>
<id>urn:sha1:6287f1a8c16138c2ec750953e35039634018c84a</id>
<content type='text'>
Commit 69e3a6aa6be2 ("LoongArch: Add checksum optimization for 64-bit
system") would cause an undefined shift and an out-of-bounds read.

Commit 8bd795fedb84 ("arm64: csum: Fix OoB access in IP checksum code
for negative lengths") fixes the same issue on ARM64.

Fixes: 69e3a6aa6be2 ("LoongArch: Add checksum optimization for 64-bit system")
Co-developed-by: Wentao Guan &lt;guanwentao@uniontech.com&gt;
Signed-off-by: Wentao Guan &lt;guanwentao@uniontech.com&gt;
Signed-off-by: Yuli Wang &lt;wangyuli@uniontech.com&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
</feed>
