[PATCH v4 0/3] nolibc: add part2 of support for rv32

From: Zhangjin Wu
Date: Wed Jun 07 2023 - 05:23:37 EST


Hi, Willy

This is the v4 part2 of support for rv32 (v3 [1]), it applied the
suggestions from Thomas, Arnd [2] and you [3]. now, the rv32 compile
support almost aligned with x86 except the extra KARCH to make kernel
happy, thanks very much for your nice review!

Since the 'override' method mentioned in [4] split the whole Makefile
context to two parts, it may make the code not that easy to maintain,
so, this patchset goes back to the KARCH (suggested from Willy, before,
I used something like _ARCH) passing method, as suggested by Willy, we
also aligned the KARCH assignment with the other variables.

Changes from v3 -> v4:

* No new changes in the first two except a new Reviewed-by line from Arnd

* selftests/nolibc: riscv: customize makefile for rv32

Do it like the other architectures, especially like x86.

The difference from x86 is, the top-level kernel Makefile doesn't
accept riscv32 and riscv64, it only accept riscv, to make kernel happy,
a KARCH variable is added for riscv32 and riscv64, and then passed to
kernel with ARCH=$(KARCH).

Since tools/include/nolibc/Makefile shares arch-riscv.h between riscv32
and riscv64 and there is a headers_standalone target who called kernel
headers and headers_install, so, pass ARCH=$(KARCH) to it too.

Did compile test for aarch64, rv32 and rv64, include run-user and run.

Note, this is required with the default config from the
20230606-nolibc-rv32+stkp7a branch of [5]:

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index ce02bb09651b..72bd8fe0cad6 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -1934,11 +1934,13 @@ void show_rcu_tasks_gp_kthreads(void)
}
#endif /* #ifndef CONFIG_TINY_RCU */

+#ifdef CONFIG_TASKS_RCU
struct task_struct *get_rcu_tasks_gp_kthread(void)
{
return rcu_tasks.kthread_ptr;
}
EXPORT_SYMBOL_GPL(get_rcu_tasks_gp_kthread);
+#endif

#ifdef CONFIG_PROVE_RCU
struct rcu_tasks_test_desc {


Best regards,
Zhangjin

---

[1]: https://lore.kernel.org/linux-riscv/cover.1685780412.git.falcon@xxxxxxxxxxx/
[2]: https://lore.kernel.org/linux-riscv/d1c83340-af4c-4780-a101-b9d22b47379c@xxxxxxxxxxxxxxxx/
[3]: https://lore.kernel.org/lkml/ZIAywHvr6UB1J4of@xxxxxx/
[4]: https://lore.kernel.org/lkml/20230607063314.671429-1-falcon@xxxxxxxxxxx/
[5]: https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/nolibc.git



Zhangjin Wu (3):
tools/nolibc: fix up #error compile failures with -ENOSYS
tools/nolibc: fix up undeclared syscall macros with #ifdef and -ENOSYS
selftests/nolibc: riscv: customize makefile for rv32

tools/include/nolibc/sys.h | 38 ++++++++++++++++---------
tools/testing/selftests/nolibc/Makefile | 20 +++++++++++--
2 files changed, 42 insertions(+), 16 deletions(-)

--
2.25.1