Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit 0e5c67a

Browse files
Merge pull request #194 from nathanchance/unbreak-ppc32
Unbreak ppc32
2 parents 665f548 + adc528c commit 0e5c67a

File tree

3 files changed

+79
-3
lines changed

3 files changed

+79
-3
lines changed

driver.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ setup_variables() {
4141
[[ -z "${url:-}" ]] && url=git://git.kernel.org/pub/scm/linux/kernel/git/${owner}/${tree}.git
4242

4343
# arm64 is the current default if nothing is specified
44-
case ${ARCH:=arm64} in
44+
SUBARCH=${ARCH:=arm64}
45+
case ${SUBARCH} in
4546
"arm32_v5")
4647
config=multi_v5_defconfig
4748
image_name=zImage
@@ -259,11 +260,11 @@ build_linux() {
259260
llvm_all_folder="../patches/llvm-all"
260261
apply_patches "${llvm_all_folder}/kernel-all"
261262
apply_patches "${llvm_all_folder}/${REPO}/arch-all"
262-
apply_patches "${llvm_all_folder}/${REPO}/${ARCH}"
263+
apply_patches "${llvm_all_folder}/${REPO}/${SUBARCH}"
263264
llvm_version_folder="../patches/llvm-$(echo __clang_major__ | ${CC} -E -x c - | tail -n 1)"
264265
apply_patches "${llvm_version_folder}/kernel-all"
265266
apply_patches "${llvm_version_folder}/${REPO}/arch-all"
266-
apply_patches "${llvm_version_folder}/${REPO}/${ARCH}"
267+
apply_patches "${llvm_version_folder}/${REPO}/${SUBARCH}"
267268

268269
# Only clean up old artifacts if requested, the Linux build system
269270
# is good about figuring out what needs to be rebuilt

patches/llvm-all/linux-next

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
linux
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
From 4f764e21e589c2c5704342237259cb2a8c0a304a Mon Sep 17 00:00:00 2001
2+
From: Nick Desaulniers <ndesaulniers@google.com>
3+
Date: Mon, 29 Jul 2019 10:12:14 -0700
4+
Subject: [PATCH] powerpc: workaround clang codegen bug in dcbz
5+
6+
Commit 6c5875843b87 ("powerpc: slightly improve cache helpers") exposed
7+
what looks like a codegen bug in Clang's handling of `%y` output
8+
template with `Z` constraint. This is resulting in panics during boot
9+
for 32b powerpc builds w/ Clang, as reported by our CI.
10+
11+
Add back the original code that worked behind a preprocessor check for
12+
__clang__ until we can fix LLVM.
13+
14+
Further, it seems that clang allnoconfig builds are unhappy with `Z`, as
15+
reported by 0day bot. This is likely because Clang warns about inline
16+
asm constraints when the constraint requires inlining to be semantically
17+
valid.
18+
19+
Link: https://bugs.llvm.org/show_bug.cgi?id=42762
20+
Link: https://github.com/ClangBuiltLinux/linux/issues/593
21+
Link: https://lore.kernel.org/lkml/20190721075846.GA97701@archlinux-threadripper/
22+
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
23+
Reported-by: kbuild test robot <lkp@intel.com>
24+
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
25+
---
26+
arch/powerpc/include/asm/cache.h | 25 +++++++++++++++++++++++++
27+
1 file changed, 25 insertions(+)
28+
29+
diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h
30+
index b3388d95f451..72983da94dce 100644
31+
--- a/arch/powerpc/include/asm/cache.h
32+
+++ b/arch/powerpc/include/asm/cache.h
33+
@@ -105,6 +105,30 @@ extern void _set_L3CR(unsigned long);
34+
#define _set_L3CR(val) do { } while(0)
35+
#endif
36+
37+
+/*
38+
+ * Workaround for https://bugs.llvm.org/show_bug.cgi?id=42762.
39+
+ */
40+
+#ifdef __clang__
41+
+static inline void dcbz(void *addr)
42+
+{
43+
+ __asm__ __volatile__ ("dcbz 0, %0" : : "r"(addr) : "memory");
44+
+}
45+
+
46+
+static inline void dcbi(void *addr)
47+
+{
48+
+ __asm__ __volatile__ ("dcbi 0, %0" : : "r"(addr) : "memory");
49+
+}
50+
+
51+
+static inline void dcbf(void *addr)
52+
+{
53+
+ __asm__ __volatile__ ("dcbf 0, %0" : : "r"(addr) : "memory");
54+
+}
55+
+
56+
+static inline void dcbst(void *addr)
57+
+{
58+
+ __asm__ __volatile__ ("dcbst 0, %0" : : "r"(addr) : "memory");
59+
+}
60+
+#else
61+
static inline void dcbz(void *addr)
62+
{
63+
__asm__ __volatile__ ("dcbz %y0" : : "Z"(*(u8 *)addr) : "memory");
64+
@@ -124,6 +148,7 @@ static inline void dcbst(void *addr)
65+
{
66+
__asm__ __volatile__ ("dcbst %y0" : : "Z"(*(u8 *)addr) : "memory");
67+
}
68+
+#endif /* __clang__ */
69+
#endif /* !__ASSEMBLY__ */
70+
#endif /* __KERNEL__ */
71+
#endif /* _ASM_POWERPC_CACHE_H */
72+
--
73+
2.22.0
74+

0 commit comments

Comments
 (0)