Skip to content

watchdog: th1520: skip registration on non-TH1520 machines - #377

Open
ifnfn wants to merge 1606 commits into
RVCK-Project:rvck-6.6from
ifnfn:fix-th1520-wdt-non-th1520
Open

watchdog: th1520: skip registration on non-TH1520 machines#377
ifnfn wants to merge 1606 commits into
RVCK-Project:rvck-6.6from
ifnfn:fix-th1520-wdt-non-th1520

Conversation

@ifnfn

@ifnfn ifnfn commented Aug 26, 2026

Copy link
Copy Markdown

Fixes #376

This PR also fixed #39

Summary

th1520_wdt currently registers its virtual platform device unconditionally from device_initcall(). If CONFIG_TH1520_PMIC_WATCHDOG=y is enabled in a kernel booted on another SoC, such as ZhiHe A210, the virtual th1520-wdt device is still created and then remains deferred while waiting for the TH1520 AON global channel.

This results in boot-time noise such as:

platform th1520-wdt: deferred probe pending

Only register the virtual device when the root compatible matches thead,th1520.

Test

make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- -j8 drivers/watchdog/th1520_wdt.o

Andrew Jones and others added 30 commits August 5, 2026 18:38
mainline inclusion
from mainline-6.14-rc1
commit 023c151
category: feature
bugzilla: RVCK-Project#262

--------------------------------

Implement a KVM SBI SUSP extension handler. The handler only
validates the system suspend entry criteria and prepares for resuming
in the appropriate state at the resume_addr (as specified by the SBI
spec), but then it forwards the call to the VMM where any system
suspend behavior may be implemented. Since VMM support is needed, KVM
disables the extension by default.

Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20241017074538.18867-5-ajones@ventanamicro.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.14-rc1
commit cc57f6c
category: feature
bugzilla: RVCK-Project#262

--------------------------------

KVM supports SBI SUSP, so add it to the get-reg-list test.

Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20241017074538.18867-6-ajones@ventanamicro.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.14-rc5
commit 351e02b
category: feature
bugzilla: RVCK-Project#262

--------------------------------

The spec says sleep_type is 32 bits wide and "In case the data is
defined as 32bit wide, higher privilege software must ensure that it
only uses 32 bit data." Mask off upper bits of sleep_type before
using it.

Fixes: 023c151 ("RISC-V: KVM: Add SBI system suspend support")
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20250217084506.18763-12-ajones@ventanamicro.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
riscv inclusion
category: config
bugzilla: RVCK-Project#268

------------------------

Turn on CONFIG_EDAC and CONFIG_EDAC_GHES to support hardware memory
error reporting via the ACPI/APEI GHES interface:

- CONFIG_EDAC=y
- CONFIG_EDAC_GHES=y

These options align with arm64 defconfig.

Signed-off-by: Lu Peng <lu.peng3@zte.com.cn>
Signed-off-by: liuqingtao <liu.qingtao2@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-v7.1
commit 5d5c5d0
category: feature
bugzilla: RVCK-Project#269
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20260413&id=5d5c5d0f2be9cf0351ad8e90516c519a8db22981

---------------------------

Add support for handling hardware error traps (exception code 19)
in the RISC-V architecture. The changes include:

- Add do_trap_hardware_error function declaration in asm-prototypes.h
- Add hardware error trap vector entry in entry.S exception vector table
- Implement do_trap_hardware_error handler in traps.c that generates
  SIGBUS with BUS_MCEERR_AR for hardware errors

This enables proper handling of hardware error exceptions that may occur
in RISC-V systems, providing appropriate error reporting and signal
generation for user space processes.

Signed-off-by: Rui Qi <qirui.001@bytedance.com>
Link: https://patch.msgid.link/20260202094200.53735-1-qirui.001@bytedance.com
[pjw@kernel.org: clean up commit message slightly]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Lu Peng <lu.peng3@zte.com.cn>
Signed-off-by: liuqingtao <liu.qingtao2@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
driver inclusion
category: feature
Link: RVCK-Project#272

---------------------------

This patch adds PMU support for the LRW PCIE controller via the perf
framework. The implementation registers a dedicated PMU driver,
provides basic counter support for PCIE performance metrics, and
integrates with the perf subsystem to allow user-space access.

Signed-off-by: guowu <guo.wu1@zte.com.cn>
Signed-off-by: liuqingtao <liu.qingtao2@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-v6.13-rc1
commit 5a90c15
category: bugfix
Link: RVCK-Project#277

--------------------------------

The performance improvement of writing to tmpfs via fio becomes more
significant as the block size increases. When the block size (BS) is small,
the performance advantage isn't obvious and the data tends to fluctuate.
However, with a larger BS, a clear advantage can still be observed even
if there is some data fluctuation.

Tested on qemu-system-riscv64, vcpu=1, mem=16G.
Test command:
1.dd if=/dev/zero of=/mnt/tmpfs_test/test_file bs=1M count=1024
2.fio --name=seqwrite --filename=/mnt/test_file --rw=write --bs=?M \
--size=1G --direct=1 --numjobs=1 --time_based --runtime=30 \
--group_reporting

```
bs(MiB)	Repetition	before(MiB/s)	after(MiB/s)	improvement
bs=2M	1			1077			1061			-1.49%
	2			1170			1109			-5.21%
	3			1106			1104			-0.18%
	4			1101			1155			+4.90%
bs=4M	1			1196			1132			-5.35%
	2			1222			1092			-10.63%
	3			1203			1200			-0.25%
	4			1228			1445			+17.67%
bs=8M	1			1406			1611			+14.58%
	2			1278			1517			+22.93%
	3			1484			1564			+5.39%
	4			1503			1562			+3.93%
bs=16M	1			1551			1656			+6.77%
	2			1531			1638			+6.99%
	3			1578			1671			+5.89%
	4			1560			1603			+2.76%
```

original changelog

tmpfs can support large folios, but there are some configurable options
(mount options and runtime deny/force) to enable/disable large folio
allocation, so there is a performance issue when performing writes without
large folios.  The issue is similar to commit 4e527d5 ("iomap: fault
in smaller chunks for non-large folio mappings").

Since 'deny' is for emergencies and 'force' is for testing, performance
issues should not be a problem in real production environments, so don't
call mapping_set_large_folios() in __shmem_get_inode() when large folio is
disabled with mount huge=never option (default policy).

Link: https://lkml.kernel.org/r/20241017141742.1169404-1-wangkefeng.wang@huawei.com
Fixes: 9aac777 ("filemap: Convert generic_perform_write() to support large folios")
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Yang Susheng <yang.susheng@zte.com.cn>
Signed-off-by: Liu Qingtao <liu.qingtao2@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.6-rc2
commit 83feeb1
category: feature
bugzilla: RVCK-Project#280

--------------------------------

printbuf now needs to know the number of characters that would have been
written if the buffer was too small, like snprintf(); this changes
string_get_size() to return the the return value of snprintf().

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.8-rc7
commit f0b7f8a
category: feature
bugzilla: RVCK-Project#280

--------------------------------

The new flags parameter allows controlling
 - Whether or not the units suffix is separated by a space, for
   compatibility with sort -h
 - Whether or not to append a B suffix - we're not always printing
   bytes.

Co-developed-by: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Kent Overstreet <kent.overstreet@linux.dev>
Link: https://lore.kernel.org/r/20240229205345.93902-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.8
commit 29d8568
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Convert test_string.c to KUnit so it can be easily run with everything
else.

Additional text context is retained for failure reporting. For example,
when forcing a bad match, we can see the loop counters reported for the
memset() tests:

[09:21:52]     # test_memset64: ASSERTION FAILED at lib/string_kunit.c:93
[09:21:52]     Expected v == 0xa2a1a1a1a1a1a1a1ULL, but
[09:21:52]         v == -6799976246779207263 (0xa1a1a1a1a1a1a1a1)
[09:21:52]         0xa2a1a1a1a1a1a1a1ULL == -6727918652741279327 (0xa2a1a1a1a1a1a1a1)
[09:21:52] i:0 j:0 k:0
[09:21:52] [FAILED] test_memset64

Currently passes without problems:

$ ./tools/testing/kunit/kunit.py run string
...
[09:37:40] Starting KUnit Kernel (1/1)...
[09:37:40] ============================================================
[09:37:40] =================== string (6 subtests) ====================
[09:37:40] [PASSED] test_memset16
[09:37:40] [PASSED] test_memset32
[09:37:40] [PASSED] test_memset64
[09:37:40] [PASSED] test_strchr
[09:37:40] [PASSED] test_strnchr
[09:37:40] [PASSED] test_strspn
[09:37:40] ===================== [PASSED] string ======================
[09:37:40] ============================================================
[09:37:40] Testing complete. Ran 6 tests: passed: 6
[09:37:40] Elapsed time: 6.730s total, 0.001s configuring, 6.562s building, 0.131s running

Link: https://lore.kernel.org/r/20240301202732.2688342-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.8
commit fb57550
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Convert test-string_helpers.c to KUnit so it can be easily run with
everything else.

Failure reporting doesn't need to be open-coded in most places, for
example, forcing a failure in the expected output for upper/lower
testing looks like this:

[12:18:43] # test_upper_lower: EXPECTATION FAILED at lib/string_helpers_kunit.c:579
[12:18:43] Expected dst == strings_upper[i].out, but
[12:18:43]     dst == "ABCDEFGH1234567890TEST"
[12:18:43]     strings_upper[i].out == "ABCDEFGH1234567890TeST"
[12:18:43] [FAILED] test_upper_lower

Currently passes without problems:

$ ./tools/testing/kunit/kunit.py run string_helpers
...
[12:23:55] Starting KUnit Kernel (1/1)...
[12:23:55] ============================================================
[12:23:55] =============== string_helpers (3 subtests) ================
[12:23:55] [PASSED] test_get_size
[12:23:55] [PASSED] test_upper_lower
[12:23:55] [PASSED] test_unescape
[12:23:55] ================= [PASSED] string_helpers ==================
[12:23:55] ============================================================
[12:23:55] Testing complete. Ran 3 tests: passed: 3
[12:23:55] Elapsed time: 6.709s total, 0.001s configuring, 6.591s building, 0.066s running

Link: https://lore.kernel.org/r/20240301202732.2688342-2-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.9-rc3
commit 9259a47
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Currently, str*cmp functions (strcmp, strncmp, strcasecmp and
strncasecmp) are not covered with tests. Extend the `string_kunit.c`
test by adding the test cases for them.

This patch adds 8 more test cases:

1) strcmp test
2) strcmp test on long strings (2048 chars)
3) strncmp test
4) strncmp test on long strings (2048 chars)
5) strcasecmp test
6) strcasecmp test on long strings
7) strncasecmp test
8) strncasecmp test on long strings

These test cases aim at covering as many edge cases as possible,
including the tests on empty strings, situations when the different
symbol is placed at the end of one of the strings, etc.

Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20240417233033.717596-1-ivan.orlov0322@gmail.com
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.9-rc5
commit b03442f
category: feature
bugzilla: RVCK-Project#280

--------------------------------

In preparation for moving the strscpy_kunit.c tests into string_kunit.c,
rename "tc" to "strscpy_check" for better readability.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20240419140155.3028912-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.9-rc5
commit bb8d9b7
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Move the strscpy() tests into string_kunit.c. Remove the separate
Kconfig and Makefile rule.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20240419140155.3028912-2-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.9-rc5
commit 6e4ef14
category: feature
bugzilla: RVCK-Project#280

--------------------------------

The test naming convention differs between string_kunit.c and
strcat_kunit.c. Move "test" to the beginning of the function name.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20240419140155.3028912-3-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.9-rc5
commit bd678f7
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Move the strcat() tests into string_kunit.c. Remove the separate
Kconfig and Makefile rule.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20240419140155.3028912-4-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.9-rc5
commit dde915c
category: feature
bugzilla: RVCK-Project#280

--------------------------------

The KUnit convention for test names is AREA_test_WHAT. Adjust the string
test names to follow this pattern.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20240419140155.3028912-5-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.9-rc6
commit 0efc599
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Another ambiguous use of strncpy() is to copy from strings that may not
be NUL-terminated. These cases depend on having the destination buffer
be explicitly larger than the source buffer's maximum size, having
the size of the copy exactly match the source buffer's maximum size,
and for the destination buffer to get explicitly NUL terminated.

This usually happens when parsing protocols or hardware character arrays
that are not guaranteed to be NUL-terminated. The code pattern is
effectively this:

	char dest[sizeof(src) + 1];

	strncpy(dest, src, sizeof(src));
	dest[sizeof(dest) - 1] = '\0';

In practice it usually looks like:

struct from_hardware {
	...
	char name[HW_NAME_SIZE] __nonstring;
	...
};

	struct from_hardware *p = ...;
	char name[HW_NAME_SIZE + 1];

	strncpy(name, p->name, HW_NAME_SIZE);
	name[NW_NAME_SIZE] = '\0';

This cannot be replaced with:

	strscpy(name, p->name, sizeof(name));

because p->name is smaller and not NUL-terminated, so FORTIFY will
trigger when strnlen(p->name, sizeof(name)) is used. And it cannot be
replaced with:

	strscpy(name, p->name, sizeof(p->name));

because then "name" may contain a 1 character early truncation of
p->name.

Provide an unambiguous interface for converting a maybe not-NUL-terminated
string to a NUL-terminated string, with compile-time buffer size checking
so that it can never fail at runtime: memtostr() and memtostr_pad(). Also
add KUnit tests for both.

Link: https://lore.kernel.org/r/20240410023155.2100422-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.9-rc6
commit c01c41e
category: feature
bugzilla: RVCK-Project#280

--------------------------------

It is more logical to have the strtomem() test in string_kunit.c instead
of the memcpy() suite. Move it to live with memtostr().

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-7.0-rc6
commit ae45f89
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Add a KUnit test for strlen() to verify correctness across
different string lengths and memory alignments. Use vmalloc()
to place the NUL character at the page boundary to ensure
over-reads are detected.

Suggested-by: Kees Cook <kees@kernel.org>
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20260130025018.172925-2-jiangfeng@kylinos.cn
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-7.0-rc6
commit 263dca2
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Add a KUnit test for strnlen() to verify correctness across
different string lengths and memory alignments. Use vmalloc()
to place the NUL character at the page boundary to ensure
over-reads are detected.

Suggested-by: Andy Shevchenko <andy@kernel.org>
Suggested-by: Kees Cook <kees@kernel.org>
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20260130025018.172925-3-jiangfeng@kylinos.cn
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-7.0-rc6
commit 27b2810
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Add a KUnit test for strrchr() to verify correctness across
different string lengths and memory alignments. Use vmalloc()
to place the NUL character at the page boundary to ensure
over-reads are detected.

Suggested-by: Kees Cook <kees@kernel.org>
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20260130025018.172925-4-jiangfeng@kylinos.cn
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-7.0-rc6
commit 0020240
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Introduce a benchmarking framework to the string_kunit test suite to
measure the execution efficiency of string functions.

The implementation is inspired by crc_benchmark(), measuring throughput
(MB/s) and latency (ns/call) across a range of string lengths. It
includes a warm-up phase, disables preemption during measurement, and
uses a fixed seed for reproducible results.

This framework allows for comparing different implementations (e.g.,
generic C vs. architecture-optimized assembly) within the KUnit
environment.

Initially, provide a benchmark for strlen().

Suggested-by: Andy Shevchenko <andy@kernel.org>
Suggested-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20260130025018.172925-5-jiangfeng@kylinos.cn
[pjw@kernel.org: fixed a checkpatch issue]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-7.0-rc6
commit e73bcb3
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Extend the string benchmarking suite to include strnlen(), strchr(),
and strrchr().

For character search functions strchr() and strrchr(), the benchmark
targets the NUL character. This ensures the entire string is scanned,
providing a consistent measure of full-length processing efficiency
comparable to strlen().

Suggested-by: Andy Shevchenko <andy@kernel.org>
Suggested-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Acked-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20260130025018.172925-6-jiangfeng@kylinos.cn
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-7.0-rc6
commit 5ba15d4
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Add an optimized strnlen() implementation for RISC-V. This version
includes a generic optimization and a Zbb-powered optimization using
the 'orc.b' instruction, derived from the strlen() implementation.

Benchmark results (QEMU TCG, rv64):
  Length | Original (MB/s) | Optimized (MB/s) | Improvement
  -------|-----------------|------------------|------------
  16 B   | 179             | 309              | +72.6%
  512 B  | 347             | 1562             | +350.1%
  4096 B | 356             | 1878             | +427.5%

Suggested-by: Qingfang Deng <dqfext@gmail.com>
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Link: https://patch.msgid.link/20260130025018.172925-7-jiangfeng@kylinos.cn
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-7.0-rc6
commit adf5421
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Add an assembly implementation of strchr() for RISC-V.

By eliminating stack frame management (prologue/epilogue) and optimizing
the function entries, the assembly version provides significant relative
gains for short strings where the fixed overhead of the C function is
most prominent. As string length increases, performance converges with
the generic C implementation.

Benchmark results (QEMU TCG, rv64):
  Length | Original (MB/s) | Optimized (MB/s) | Improvement
  -------|-----------------|------------------|------------
  1 B    | 21              | 22               | +4.8%
  7 B    | 113             | 121              | +7.1%
  16 B   | 195             | 202              | +3.6%
  512 B  | 376             | 389              | +3.5%
  4096 B | 394             | 393              | -0.3%

Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Tested-by: Joel Stanley <joel@jms.id.au>
Link: https://patch.msgid.link/20260130025018.172925-8-jiangfeng@kylinos.cn
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-7.0-rc6
commit bef64bc
category: feature
bugzilla: RVCK-Project#280

--------------------------------

Add an assembly implementation of strrchr() for RISC-V.

This implementation minimizes instruction count and avoids unnecessary
memory access to the stack. The performance benefits are most visible
on small workloads (1-16 bytes) where the architectural savings in
function overhead outweigh the execution time of the scan loop.

Benchmark results (QEMU TCG, rv64):
  Length | Original (MB/s) | Optimized (MB/s) | Improvement
  -------|-----------------|------------------|------------
  1 B    | 20              | 21               | +5.0%
  7 B    | 111             | 120              | +8.1%
  16 B   | 189             | 199              | +5.3%
  512 B  | 361             | 382              | +5.8%
  4096 B | 388             | 391              | +0.8%

Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Tested-by: Joel Stanley <joel@jms.id.au>
Link: https://patch.msgid.link/20260130025018.172925-9-jiangfeng@kylinos.cn
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
… file"

dist inclusion
category: cleanup
bugzilla: RVCK-Project#290

--------------------------------

This reverts commit 7ecf0f6.

The original backport only modified steal_time.c but missed the key
changes to processor.h, sbi.h, and ucall.h. Upstream has a complete
version of this commit which will be cherry-picked next.

Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from Linux 6.10-rc1
commit 9408a23
category: feature
bugzilla: RVCK-Project#290

--------------------------------

The SBI definitions will continue to grow. Move the sbi related
definitions to its own header file from processor.h

Suggested-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Atish Patra <atishp@rivosinc.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20240420151741.962500-18-atishp@rivosinc.com
Signed-off-by: Anup Patel <anup@brainfault.org>
[Resolve conflicts with existing backported SBI PMU definitions and keep local SATP mode macros. - ZhenXing Zhu]
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from Linux 6.10-rc1
commit 0fc670d
category: bugfix
bugzilla: RVCK-Project#290

--------------------------------

Due to commit 2b7deea ("Revert "kvm: selftests: move base
kvm_util.h declarations to kvm_util_base.h"") kvm selftests now
requires explicitly including ucall_common.h when needed. The commit
added the directives everywhere they were needed at the time, but, by
merge time, new places had been merged for RISC-V. Add those now to
fix RISC-V compilation.

Fixes: dee7ea4 ("Merge tag kvm-x86-selftests_utils-6.10 of https://github.com/kvm-x86/linux into HEAD")
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Link: https://lore.kernel.org/r/20240603122045.323064-2-ajones@ventanamicro.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
Zhiguo Zhu and others added 12 commits August 19, 2026 17:16
dist inclusion
category: feature
bugzilla: RVCK-Project#348

--------------------------------

Add ZhiHe A210 SDHCI support to the DWC MSHC driver. The A210 SDHCI
IP behaves identically to TH1520, so reuse the existing TH1520 platform
data and callbacks directly.

Signed-off-by: Zhiguo Zhu <zhiguo.zhu@linux.alibaba.com>
dist inclusion
category: feature
bugzilla: RVCK-Project#348

--------------------------------

Probe the ZhiHe A210 PLIC during early irqchip initialization so early
timers can resolve their interrupt parent.

Signed-off-by: Zhiguo Zhu <zhiguo.zhu@linux.alibaba.com>
dist inclusion
category: feature
bugzilla: RVCK-Project#348

--------------------------------

Add device tree files for the ZhiHe A210 SoC and boards:
  - a210.dtsi: CPU cluster, interrupt controller, memory, clocks,
    resets, core bus infrastructure and on-chip peripherals
  - a210-evb.dts: A210 EVB configuration
  - a210-dev.dts: A210 development board configuration

The device tree describes the Always-On subsystem, power domains, pin
controller and on-chip peripherals.

Signed-off-by: Zhiguo Zhu <zhiguo.zhu@linux.alibaba.com>
dist inclusion
category: feature
bugzilla: RVCK-Project#348

--------------------------------

Enable ZhiHe A210 platform support in rvck_defconfig and raise the
build-time and runtime 8250 UART limits so all A210 UART controllers can
be used.

Signed-off-by: Zhiguo Zhu <zhiguo.zhu@linux.alibaba.com>
…theadvector-backport

riscv: backport mainline xtheadvector support
riscv: initial support for ZhiHe A210
dist inclusion
category: feature
bugzilla: RVCK-Project#370

--------------------------------

Allow the ZhiHe A210 GMAC syscon compatible string in syscon nodes.

Signed-off-by: Zhiguo Zhu <zhiguo.zhu@linux.alibaba.com>
Reviewed-by: Chen Wang <wangchen20@iscas.ac.cn>
dist inclusion
category: feature
bugzilla: RVCK-Project#370

--------------------------------

Document the ZhiHe A210 DWMAC glue layer and allow its platform data.

Signed-off-by: Zhiguo Zhu <zhiguo.zhu@linux.alibaba.com>
Reviewed-by: Chen Wang <wangchen20@iscas.ac.cn>
dist inclusion
category: feature
bugzilla: RVCK-Project#370

--------------------------------

Add the ZhiHe A210 DWMAC glue layer for clocks, resets and syscon setup.

Signed-off-by: Zhiguo Zhu <zhiguo.zhu@linux.alibaba.com>
Reviewed-by: Chen Wang <wangchen20@iscas.ac.cn>
dist inclusion
category: feature
bugzilla: RVCK-Project#370

--------------------------------

A210 integrates two Synopsys DWMAC 5.20 Ethernet controllers behind a
ZhiHe glue block that controls interface mode, link speed, clock gates
and reset sequencing.

Describe both controller instances in the SoC dtsi. The development
board enables GMAC0 as its single RGMII port, while the EVB describes
GMAC0 and GMAC1 so board-specific enablement can select the populated
ports.

Signed-off-by: Zhiguo Zhu <zhiguo.zhu@linux.alibaba.com>
Reviewed-by: Chen Wang <wangchen20@iscas.ac.cn>
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/32940389616

参数解析结果
args value
repository RVCK-Project/rvck
head ref pull/377/head
base ref rvck-6.6
LAVA repo RVCK-Project/lavaci
LAVA hardware ['qemu']
LAVA Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:
check result
kunit-test success
kernel-build success
check-patch success
lava-trigger-qemu success
lava-trigger-sg2042 skipped
lava-trigger-k1 skipped
lava-trigger-lpi4a skipped

Kunit Test Result

[07:01:30] Testing complete. Ran 482 tests: passed: 465, skipped: 17

Kernel Build Result

Check Patch Result

Total Errors 0
Total Warnings 1

LAVA Check (qemu)

args value
testcase_repo RVCK-Project/lavaci
lava_template lava-job-template/qemu/qemu-ltp.yaml
testcase_path lava-testcases/common-test/ltp/ltp.yaml
kernel_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/377_32940389616_1/Image
initramfs_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/377_32940389616_1/initramfs.img
rootfs_download_url https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/openEuler24.03-LTS-SP1/openeuler-rootfs.img.zst
testcase_ref main
testitem_name RVCK-Project_rvck_pull_request_target_377__common-test_qemu

result: Lava check done!

dist inclusion
category: bugfix
bugzilla: RVCK-Project#376

--------------------------------

The TH1520 PMIC watchdog driver registers a virtual platform device from
its initcall. When this driver is built into a kernel used on another SoC,
such as ZhiHe A210, the virtual device is still created and then waits
forever for the TH1520 AON global channel.

This leaves a stale deferred-probe entry on non-TH1520 platforms:

  platform th1520-wdt: deferred probe pending

Only register the virtual watchdog device on TH1520 machines so other
platforms do not get the unused deferred device.

Signed-off-by: Zhiguo Zhu <zhiguo.zhu@linux.alibaba.com>
@ifnfn
ifnfn force-pushed the fix-th1520-wdt-non-th1520 branch from 09098bd to b7c6528 Compare August 26, 2026 07:00
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/32940658714

参数解析结果
args value
repository RVCK-Project/rvck
head ref pull/377/head
base ref rvck-6.6
LAVA repo RVCK-Project/lavaci
LAVA hardware ['qemu']
LAVA Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:
check result
kunit-test success
kernel-build success
check-patch success
lava-trigger-qemu success
lava-trigger-sg2042 skipped
lava-trigger-k1 skipped
lava-trigger-lpi4a skipped

Kunit Test Result

[07:07:27] Testing complete. Ran 482 tests: passed: 465, skipped: 17

Kernel Build Result

Check Patch Result

Total Errors 0
Total Warnings 1

LAVA Check (qemu)

args value
testcase_repo RVCK-Project/lavaci
lava_template lava-job-template/qemu/qemu-ltp.yaml
testcase_path lava-testcases/common-test/ltp/ltp.yaml
kernel_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/377_32940658714_1/Image
initramfs_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/377_32940658714_1/initramfs.img
rootfs_download_url https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/openEuler24.03-LTS-SP1/openeuler-rootfs.img.zst
testcase_ref main
testitem_name RVCK-Project_rvck_pull_request_target_377__common-test_qemu

result: Lava check done!

@unicornx
unicornx self-requested a review August 26, 2026 07:34

@unicornx unicornx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Reviewed-by: Chen Wang wangchen20@iscas.ac.cn
Tested-by: Chen Wang wangchen20@iscas.ac.cn # QEMU-virt & Pioneerbox/SG2042

@unicornx

Copy link
Copy Markdown
Contributor

@sterling-teng: can you help verify this on TH1520? thanks.

@unicornx

unicornx commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

@ifnfn 你有在 th1520 上试过吗,对 th1520 应该没有影响吧,我这里没有 th1520 的板子

@sterling-teng
sterling-teng requested a review from uestc-gr August 27, 2026 07:40
@unicornx

Copy link
Copy Markdown
Contributor

@uestc-gr 请帮忙 review 一下,谢谢

@uestc-gr uestc-gr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Reviewed-by: Gao Rui gao.rui@zte.com.cn

@uestc-gr

Copy link
Copy Markdown
Contributor

@uestc-gr 请帮忙 review 一下,谢谢

已评审 @unicornx

@Icenowy

Icenowy commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Please make the AON driver to register the wdt platform device instead of the wdt driver registering itself.

@unicornx unicornx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

补充一下,最新的考量是不建议采用 of_machine_is_compatible 的方式强制过滤。是否可以按照标准的 of_match_table 方式改写原有的 th1520 wdt 驱动,让它通过标准的 compatible 匹配的方式去完成注册,和其他 wdt driver 一样。

@Icenowy

Icenowy commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

我认为这是一个子设备,所以单独创建 of node 其实也不是很合适,更合适的方式是在父设备里进行子设备的创建?

@Icenowy

Icenowy commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

类似于最新 Linux 内核的 faux device 机制(主线的 th1520-aon-reboot 是用这个机制创建的),但是 6.6 没有 faux 所以需要用 platform device

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

watchdog: th1520-wdt should not register on non-TH1520 machines th1520-wdt being probed on all platforms