Re: [PATCH 09/13] powerpc: Disable KMSAN checks on functions which walk the stack

2024-01-09 Thread Nicholas Miehlbradt




On 14/12/2023 8:00 pm, Christophe Leroy wrote:



Le 14/12/2023 à 06:55, Nicholas Miehlbradt a écrit :

Functions which walk the stack read parts of the stack which cannot be
instrumented by KMSAN e.g. the backchain. Disable KMSAN sanitization of
these functions to prevent false positives.


Do other architectures have to do it as well ?

I don't see it for show_stack(), is that a specific need for powerpc ?
Other archs have the annotation on functions called by show_stack(). For 
x86 it's on show_trace_log_lvl() and for s390 it's on __unwind_start() 
and unwind_next_frame().




Re: [PATCH 12/13] powerpc/string: Add KMSAN support

2024-01-09 Thread Nicholas Miehlbradt




On 14/12/2023 8:25 pm, Christophe Leroy wrote:



Le 14/12/2023 à 06:55, Nicholas Miehlbradt a écrit :

KMSAN expects functions __mem{set,cpy,move} so add aliases pointing to
the respective functions.

Disable use of architecture specific memset{16,32,64} to ensure that
metadata is correctly updated and strn{cpy,cmp} and mem{chr,cmp} which
are implemented in assembly and therefore cannot be instrumented to
propagate/check metadata.

Alias calls to mem{set,cpy,move} to __msan_mem{set,cpy,move} in
instrumented code to correctly propagate metadata.

Signed-off-by: Nicholas Miehlbradt 
---
   arch/powerpc/include/asm/kmsan.h   |  7 +++
   arch/powerpc/include/asm/string.h  | 18 --
   arch/powerpc/lib/Makefile  |  2 ++
   arch/powerpc/lib/mem_64.S  |  5 -
   arch/powerpc/lib/memcpy_64.S   |  2 ++
   .../selftests/powerpc/copyloops/asm/kmsan.h|  0
   .../selftests/powerpc/copyloops/linux/export.h |  1 +
   7 files changed, 32 insertions(+), 3 deletions(-)
   create mode 100644 tools/testing/selftests/powerpc/copyloops/asm/kmsan.h

diff --git a/arch/powerpc/include/asm/kmsan.h b/arch/powerpc/include/asm/kmsan.h
index bc84f6ff2ee9..fc59dc24e170 100644
--- a/arch/powerpc/include/asm/kmsan.h
+++ b/arch/powerpc/include/asm/kmsan.h
@@ -7,6 +7,13 @@
   #ifndef _ASM_POWERPC_KMSAN_H
   #define _ASM_POWERPC_KMSAN_H
   
+#ifdef CONFIG_KMSAN

+#define EXPORT_SYMBOL_KMSAN(fn) SYM_FUNC_ALIAS(__##fn, fn) \
+   EXPORT_SYMBOL(__##fn)
+#else
+#define EXPORT_SYMBOL_KMSAN(fn)
+#endif
+
   #ifndef __ASSEMBLY__
   #ifndef MODULE
   
diff --git a/arch/powerpc/include/asm/string.h b/arch/powerpc/include/asm/string.h

index 60ba22770f51..412626ce619b 100644
--- a/arch/powerpc/include/asm/string.h
+++ b/arch/powerpc/include/asm/string.h
@@ -4,7 +4,7 @@
   
   #ifdef __KERNEL__
   
-#ifndef CONFIG_KASAN

+#if !defined(CONFIG_KASAN) && !defined(CONFIG_KMSAN)
   #define __HAVE_ARCH_STRNCPY
   #define __HAVE_ARCH_STRNCMP
   #define __HAVE_ARCH_MEMCHR
@@ -56,8 +56,22 @@ void *__memmove(void *to, const void *from, __kernel_size_t 
n);
   #endif /* CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX */
   #endif /* CONFIG_KASAN */
   
+#ifdef CONFIG_KMSAN

+
+void *__memset(void *s, int c, __kernel_size_t count);
+void *__memcpy(void *to, const void *from, __kernel_size_t n);
+void *__memmove(void *to, const void *from, __kernel_size_t n);
+


The same is done for KASAN, can't you reuse it ?

I tried this but I believe it makes the file more disorganised and 
difficult to edit since there ends up being a set of definitions for 
each intersection of features e.g. the definitions needed for both KASAN 
and KMSAN, just KASAN, just KMSAN, etc.


This way it's clearer what each sanitizer needs and changing definitions 
for one one sanitizer won't require refactors affecting other sanitizers.



+#ifdef __SANITIZE_MEMORY__
+#include 
+#define memset __msan_memset
+#define memcpy __msan_memcpy
+#define memmove __msan_memmove
+#endif


Will that work as you wish ?
What about the calls to memset() or memcpy() emited directly by GCC ?

These are handled by the compiler instrumentation which replaces these 
with calls to the instrumented equivalent.



+#endif /* CONFIG_KMSAN */
+
   #ifdef CONFIG_PPC64
-#ifndef CONFIG_KASAN
+#if !defined(CONFIG_KASAN) && !defined(CONFIG_KMSAN)
   #define __HAVE_ARCH_MEMSET32
   #define __HAVE_ARCH_MEMSET64
   
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile

index 51ad0397c17a..fc3ea3eebbd6 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -32,9 +32,11 @@ obj-y += code-patching.o feature-fixups.o pmem.o
   obj-$(CONFIG_CODE_PATCHING_SELFTEST) += test-code-patching.o
   
   ifndef CONFIG_KASAN

+ifndef CONFIG_KMSAN
   obj-y+=  string.o memcmp_$(BITS).o
   obj-$(CONFIG_PPC32)  += strlen_32.o
   endif
+endif
   
   obj-$(CONFIG_PPC32)	+= div64.o copy_32.o crtsavres.o
   
diff --git a/arch/powerpc/lib/mem_64.S b/arch/powerpc/lib/mem_64.S

index 6fd06cd20faa..a55f2fac49b3 100644
--- a/arch/powerpc/lib/mem_64.S
+++ b/arch/powerpc/lib/mem_64.S
@@ -9,8 +9,9 @@
   #include 
   #include 
   #include 
+#include 
   
-#ifndef CONFIG_KASAN

+#if !defined(CONFIG_KASAN) && !defined(CONFIG_KMSAN)
   _GLOBAL(__memset16)
rlwimi  r4,r4,16,0,15
/* fall through */
@@ -96,6 +97,7 @@ _GLOBAL_KASAN(memset)
blr
   EXPORT_SYMBOL(memset)
   EXPORT_SYMBOL_KASAN(memset)
+EXPORT_SYMBOL_KMSAN(memset)
   
   _GLOBAL_TOC_KASAN(memmove)

cmplw   0,r3,r4
@@ -140,3 +142,4 @@ _GLOBAL(backwards_memcpy)
b   1b
   EXPORT_SYMBOL(memmove)
   EXPORT_SYMBOL_KASAN(memmove)
+EXPORT_SYMBOL_KMSAN(memmove)
diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S
index b5a67e20143f..1657861618cc 100644
--- a/arch/powerpc/lib/memcpy_64.S
+++ b/arch/powerpc/lib/memcpy_64.S
@@ -8,6 +8,7 @@
   #include 
   #include 
   #include 

Re: [PATCH 10/13] powerpc: Define KMSAN metadata address ranges for vmalloc and ioremap

2024-01-09 Thread Nicholas Miehlbradt




On 14/12/2023 8:17 pm, Christophe Leroy wrote:



Le 14/12/2023 à 06:55, Nicholas Miehlbradt a écrit :

Splits the vmalloc region into four. The first quarter is the new
vmalloc region, the second is used to store shadow metadata and the
third is used to store origin metadata. The fourth quarter is unused.

Do the same for the ioremap region.

Module data is stored in the vmalloc region so alias the modules
metadata addresses to the respective vmalloc metadata addresses. Define
MODULES_VADDR and MODULES_END to the start and end of the vmalloc
region.

Since MODULES_VADDR was previously only defined on ppc32 targets checks
for if this macro is defined need to be updated to include
defined(CONFIG_PPC32).


Why ?

In your case MODULES_VADDR is above PAGE_OFFSET so there should be no
difference.

Christophe

On 64 bit builds the BUILD_BUG always triggers since MODULES_VADDR 
expands to __vmalloc_start which is defined in a different translation 
unit. I can restrict the #ifdef CONFIG_PPC32 to just around the 
BUILD_BUG since as you pointed out there is no difference otherwise.


Signed-off-by: Nicholas Miehlbradt 
---
   arch/powerpc/include/asm/book3s/64/pgtable.h | 42 
   arch/powerpc/kernel/module.c |  2 +-
   2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h 
b/arch/powerpc/include/asm/book3s/64/pgtable.h
index cb77eddca54b..b3a02b8d96e3 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -249,7 +249,38 @@ enum pgtable_index {
   extern unsigned long __vmalloc_start;
   extern unsigned long __vmalloc_end;
   #define VMALLOC_START__vmalloc_start
+
+#ifndef CONFIG_KMSAN
   #define VMALLOC_END  __vmalloc_end
+#else
+/*
+ * In KMSAN builds vmalloc area is four times smaller, and the remaining 3/4
+ * are used to keep the metadata for virtual pages. The memory formerly
+ * belonging to vmalloc area is now laid out as follows:
+ *
+ * 1st quarter: VMALLOC_START to VMALLOC_END - new vmalloc area
+ * 2nd quarter: KMSAN_VMALLOC_SHADOW_START to
+ *  KMSAN_VMALLOC_SHADOW_START+VMALLOC_LEN - vmalloc area shadow
+ * 3rd quarter: KMSAN_VMALLOC_ORIGIN_START to
+ *  KMSAN_VMALLOC_ORIGIN_START+VMALLOC_LEN - vmalloc area origins
+ * 4th quarter: unused
+ */
+#define VMALLOC_LEN ((__vmalloc_end - __vmalloc_start) >> 2)
+#define VMALLOC_END (VMALLOC_START + VMALLOC_LEN)
+
+#define KMSAN_VMALLOC_SHADOW_START VMALLOC_END
+#define KMSAN_VMALLOC_ORIGIN_START (VMALLOC_END + VMALLOC_LEN)
+
+/*
+ * Module metadata is stored in the corresponding vmalloc metadata regions
+ */
+#define KMSAN_MODULES_SHADOW_START KMSAN_VMALLOC_SHADOW_START
+#define KMSAN_MODULES_ORIGIN_START KMSAN_VMALLOC_ORIGIN_START
+#endif /* CONFIG_KMSAN */
+
+#define MODULES_VADDR VMALLOC_START
+#define MODULES_END VMALLOC_END
+#define MODULES_LEN(MODULES_END - MODULES_VADDR)
   
   static inline unsigned int ioremap_max_order(void)

   {
@@ -264,7 +295,18 @@ extern unsigned long __kernel_io_start;
   extern unsigned long __kernel_io_end;
   #define KERN_VIRT_START __kernel_virt_start
   #define KERN_IO_START  __kernel_io_start
+#ifndef CONFIG_KMSAN
   #define KERN_IO_END __kernel_io_end
+#else
+/*
+ * In KMSAN builds IO space is 4 times smaller, the remaining space is used to
+ * store metadata. See comment for vmalloc regions above.
+ */
+#define KERN_IO_LEN ((__kernel_io_end - __kernel_io_start) >> 2)
+#define KERN_IO_END (KERN_IO_START + KERN_IO_LEN)
+#define KERN_IO_SHADOW_STARTKERN_IO_END
+#define KERN_IO_ORIGIN_START(KERN_IO_SHADOW_START + KERN_IO_LEN)
+#endif /* !CONFIG_KMSAN */
   
   extern struct page *vmemmap;

   extern unsigned long pci_io_base;
diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
index f6d6ae0a1692..5043b959ad4d 100644
--- a/arch/powerpc/kernel/module.c
+++ b/arch/powerpc/kernel/module.c
@@ -107,7 +107,7 @@ __module_alloc(unsigned long size, unsigned long start, 
unsigned long end, bool
   
   void *module_alloc(unsigned long size)

   {
-#ifdef MODULES_VADDR
+#if defined(MODULES_VADDR) && defined(CONFIG_PPC32)
unsigned long limit = (unsigned long)_etext - SZ_32M;
void *ptr = NULL;
   


[PATCH 3/3] treewide: Update LLVM Bugzilla links

2024-01-09 Thread Nathan Chancellor
LLVM moved their issue tracker from their own Bugzilla instance to
GitHub issues. While all of the links are still valid, they may not
necessarily show the most up to date information around the issues, as
all updates will occur on GitHub, not Bugzilla.

Another complication is that the Bugzilla issue number is not always the
same as the GitHub issue number. Thankfully, LLVM maintains this mapping
through two shortlinks:

  https://llvm.org/bz -> https://bugs.llvm.org/show_bug.cgi?id=
  https://llvm.org/pr -> 
https://github.com/llvm/llvm-project/issues/

Switch all "https://bugs.llvm.org/show_bug.cgi?id=" links to the
"https://llvm.org/pr" shortlink so that the links show the most up
to date information. Each migrated issue links back to the Bugzilla
entry, so there should be no loss of fidelity of information here.

Signed-off-by: Nathan Chancellor 
---
 arch/powerpc/Makefile   | 4 ++--
 arch/powerpc/kvm/book3s_hv_nested.c | 2 +-
 arch/s390/include/asm/ftrace.h  | 2 +-
 arch/x86/power/Makefile | 2 +-
 crypto/blake2b_generic.c| 2 +-
 drivers/firmware/efi/libstub/Makefile   | 2 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c| 2 +-
 drivers/media/test-drivers/vicodec/codec-fwht.c | 2 +-
 drivers/regulator/Kconfig   | 2 +-
 include/asm-generic/vmlinux.lds.h   | 2 +-
 lib/Kconfig.kasan   | 2 +-
 lib/raid6/Makefile  | 2 +-
 lib/stackinit_kunit.c   | 2 +-
 mm/slab_common.c| 2 +-
 net/bridge/br_multicast.c   | 2 +-
 security/Kconfig| 2 +-
 16 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index f19dbaa1d541..cd6aaa45f355 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -133,11 +133,11 @@ CFLAGS-$(CONFIG_PPC64)+= $(call 
cc-option,-mno-pointers-to-nested-functions)
 CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mlong-double-128)
 
 # Clang unconditionally reserves r2 on ppc32 and does not support the flag
-# https://bugs.llvm.org/show_bug.cgi?id=39555
+# https://llvm.org/pr39555
 CFLAGS-$(CONFIG_PPC32) := $(call cc-option, -ffixed-r2)
 
 # Clang doesn't support -mmultiple / -mno-multiple
-# https://bugs.llvm.org/show_bug.cgi?id=39556
+# https://llvm.org/pr39556
 CFLAGS-$(CONFIG_PPC32) += $(call cc-option, $(MULTIPLEWORD))
 
 CFLAGS-$(CONFIG_PPC32) += $(call cc-option,-mno-readonly-in-sdata)
diff --git a/arch/powerpc/kvm/book3s_hv_nested.c 
b/arch/powerpc/kvm/book3s_hv_nested.c
index 3b658b8696bc..3f5970f74c6b 100644
--- a/arch/powerpc/kvm/book3s_hv_nested.c
+++ b/arch/powerpc/kvm/book3s_hv_nested.c
@@ -55,7 +55,7 @@ void kvmhv_save_hv_regs(struct kvm_vcpu *vcpu, struct 
hv_guest_state *hr)
hr->dawrx1 = vcpu->arch.dawrx1;
 }
 
-/* Use noinline_for_stack due to https://bugs.llvm.org/show_bug.cgi?id=49610 */
+/* Use noinline_for_stack due to https://llvm.org/pr49610 */
 static noinline_for_stack void byteswap_pt_regs(struct pt_regs *regs)
 {
unsigned long *addr = (unsigned long *) regs;
diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h
index 5a82b08f03cd..621f23d5ae30 100644
--- a/arch/s390/include/asm/ftrace.h
+++ b/arch/s390/include/asm/ftrace.h
@@ -9,7 +9,7 @@
 #ifndef __ASSEMBLY__
 
 #ifdef CONFIG_CC_IS_CLANG
-/* https://bugs.llvm.org/show_bug.cgi?id=41424 */
+/* https://llvm.org/pr41424 */
 #define ftrace_return_address(n) 0UL
 #else
 #define ftrace_return_address(n) __builtin_return_address(n)
diff --git a/arch/x86/power/Makefile b/arch/x86/power/Makefile
index 379777572bc9..e0cd7afd5302 100644
--- a/arch/x86/power/Makefile
+++ b/arch/x86/power/Makefile
@@ -5,7 +5,7 @@
 CFLAGS_cpu.o   := -fno-stack-protector
 
 # Clang may incorrectly inline functions with stack protector enabled into
-# __restore_processor_state(): https://bugs.llvm.org/show_bug.cgi?id=47479
+# __restore_processor_state(): https://llvm.org/pr47479
 CFLAGS_REMOVE_cpu.o := $(CC_FLAGS_LTO)
 
 obj-$(CONFIG_PM_SLEEP) += cpu.o
diff --git a/crypto/blake2b_generic.c b/crypto/blake2b_generic.c
index 6704c0355889..32e380b714b6 100644
--- a/crypto/blake2b_generic.c
+++ b/crypto/blake2b_generic.c
@@ -102,7 +102,7 @@ static void blake2b_compress_one_generic(struct 
blake2b_state *S,
ROUND(10);
ROUND(11);
 #ifdef CONFIG_CC_IS_CLANG
-#pragma nounroll /* https://bugs.llvm.org/show_bug.cgi?id=45803 */
+#pragma nounroll /* https://llvm.org/pr45803 */
 #endif
for (i = 0; i < 8; ++i)
S->h[i] = S->h[i] ^ v[i] ^ v[i + 8];
diff --git a/drivers/firmware/efi/libstub/Makefile 
b/drivers/firmware/efi/libstub/Makefile
index 06964a3c130f..a223bd10564b 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -105,7 +105,7 @@ lib-y  

[PATCH 1/3] selftests/bpf: Update LLVM Phabricator links

2024-01-09 Thread Nathan Chancellor
reviews.llvm.org was LLVM's Phabricator instances for code review. It
has been abandoned in favor of GitHub pull requests. While the majority
of links in the kernel sources still work because of the work Fangrui
has done turning the dynamic Phabricator instance into a static archive,
there are some issues with that work, so preemptively convert all the
links in the kernel sources to point to the commit on GitHub.

Most of the commits have the corresponding differential review link in
the commit message itself so there should not be any loss of fidelity in
the relevant information.

Additionally, fix a typo in the xdpwall.c print ("LLMV" -> "LLVM") while
in the area.

Link: https://discourse.llvm.org/t/update-on-github-pull-requests/71540/172
Signed-off-by: Nathan Chancellor 
---
Cc: a...@kernel.org
Cc: dan...@iogearbox.net
Cc: and...@kernel.org
Cc: myko...@fb.com
Cc: b...@vger.kernel.org
Cc: linux-kselft...@vger.kernel.org
---
 tools/testing/selftests/bpf/README.rst | 32 +++---
 tools/testing/selftests/bpf/prog_tests/xdpwall.c   |  2 +-
 .../selftests/bpf/progs/test_core_reloc_type_id.c  |  2 +-
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/tools/testing/selftests/bpf/README.rst 
b/tools/testing/selftests/bpf/README.rst
index cb9b95702ac6..b9a493f66557 100644
--- a/tools/testing/selftests/bpf/README.rst
+++ b/tools/testing/selftests/bpf/README.rst
@@ -115,7 +115,7 @@ the insn 20 undoes map_value addition. It is currently 
impossible for the
 verifier to understand such speculative pointer arithmetic.
 Hence `this patch`__ addresses it on the compiler side. It was committed on 
llvm 12.
 
-__ https://reviews.llvm.org/D85570
+__ 
https://github.com/llvm/llvm-project/commit/ddf1864ace484035e3cde5e83b3a31ac81e059c6
 
 The corresponding C code
 
@@ -165,7 +165,7 @@ This is due to a llvm BPF backend bug. `The fix`__
 has been pushed to llvm 10.x release branch and will be
 available in 10.0.1. The patch is available in llvm 11.0.0 trunk.
 
-__  https://reviews.llvm.org/D78466
+__  
https://github.com/llvm/llvm-project/commit/3cb7e7bf959dcd3b8080986c62e10a75c7af43f0
 
 bpf_verif_scale/loop6.bpf.o test failure with Clang 12
 ==
@@ -204,7 +204,7 @@ r5(w5) is eventually saved on stack at insn #24 for later 
use.
 This cause later verifier failure. The bug has been `fixed`__ in
 Clang 13.
 
-__  https://reviews.llvm.org/D97479
+__  
https://github.com/llvm/llvm-project/commit/1959ead525b8830cc8a345f45e1c3ef9902d3229
 
 BPF CO-RE-based tests and Clang version
 ===
@@ -221,11 +221,11 @@ failures:
 - __builtin_btf_type_id() [0_, 1_, 2_];
 - __builtin_preserve_type_info(), __builtin_preserve_enum_value() [3_, 4_].
 
-.. _0: https://reviews.llvm.org/D74572
-.. _1: https://reviews.llvm.org/D74668
-.. _2: https://reviews.llvm.org/D85174
-.. _3: https://reviews.llvm.org/D83878
-.. _4: https://reviews.llvm.org/D83242
+.. _0: 
https://github.com/llvm/llvm-project/commit/6b01b465388b204d543da3cf49efd6080db094a9
+.. _1: 
https://github.com/llvm/llvm-project/commit/072cde03aaa13a2c57acf62d79876bf79aa1919f
+.. _2: 
https://github.com/llvm/llvm-project/commit/00602ee7ef0bf6c68d690a2bd729c12b95c95c99
+.. _3: 
https://github.com/llvm/llvm-project/commit/6d218b4adb093ff2e9764febbbc89f429412006c
+.. _4: 
https://github.com/llvm/llvm-project/commit/6d6750696400e7ce988d66a1a00e1d0cb32815f8
 
 Floating-point tests and Clang version
 ==
@@ -234,7 +234,7 @@ Certain selftests, e.g. core_reloc, require support for the 
floating-point
 types, which was introduced in `Clang 13`__. The older Clang versions will
 either crash when compiling these tests, or generate an incorrect BTF.
 
-__  https://reviews.llvm.org/D83289
+__  
https://github.com/llvm/llvm-project/commit/a7137b238a07d9399d3ae96c0b461571bd5aa8b2
 
 Kernel function call test and Clang version
 ===
@@ -248,7 +248,7 @@ Without it, the error from compiling bpf selftests looks 
like:
 
   libbpf: failed to find BTF for extern 'tcp_slow_start' [25] section: -2
 
-__ https://reviews.llvm.org/D93563
+__ 
https://github.com/llvm/llvm-project/commit/886f9ff53155075bd5f1e994f17b85d1e1b7470c
 
 btf_tag test and Clang version
 ==
@@ -264,8 +264,8 @@ Without them, the btf_tag selftest will be skipped and you 
will observe:
 
   # btf_tag:SKIP
 
-.. _0: https://reviews.llvm.org/D111588
-.. _1: https://reviews.llvm.org/D99
+.. _0: 
https://github.com/llvm/llvm-project/commit/a162b67c98066218d0d00aa13b99afb95d9bb5e6
+.. _1: 
https://github.com/llvm/llvm-project/commit/3466e00716e12e32fdb100e3fcfca5c2b3e8d784
 
 Clang dependencies for static linking tests
 ===
@@ -274,7 +274,7 @@ linked_vars, linked_maps, and linked_funcs tests depend on 
`Clang fix`__ to
 generate valid BTF information for weak variables. Please make 

[PATCH 2/3] arch and include: Update LLVM Phabricator links

2024-01-09 Thread Nathan Chancellor
reviews.llvm.org was LLVM's Phabricator instances for code review. It
has been abandoned in favor of GitHub pull requests. While the majority
of links in the kernel sources still work because of the work Fangrui
has done turning the dynamic Phabricator instance into a static archive,
there are some issues with that work, so preemptively convert all the
links in the kernel sources to point to the commit on GitHub.

Most of the commits have the corresponding differential review link in
the commit message itself so there should not be any loss of fidelity in
the relevant information.

Link: https://discourse.llvm.org/t/update-on-github-pull-requests/71540/172
Signed-off-by: Nathan Chancellor 
---
 arch/arm64/Kconfig  | 4 ++--
 arch/riscv/Kconfig  | 2 +-
 arch/riscv/include/asm/ftrace.h | 2 +-
 include/linux/compiler-clang.h  | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 7b071a00425d..3304ba7c6c2a 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -380,7 +380,7 @@ config BROKEN_GAS_INST
 config BUILTIN_RETURN_ADDRESS_STRIPS_PAC
bool
# Clang's __builtin_return_adddress() strips the PAC since 12.0.0
-   # https://reviews.llvm.org/D75044
+   # 
https://github.com/llvm/llvm-project/commit/2a96f47c5ffca84cd774ad402cacd137f4bf45e2
default y if CC_IS_CLANG && (CLANG_VERSION >= 12)
# GCC's __builtin_return_address() strips the PAC since 11.1.0,
# and this was backported to 10.2.0, 9.4.0, 8.5.0, but not earlier
@@ -2202,7 +2202,7 @@ config STACKPROTECTOR_PER_TASK
 
 config UNWIND_PATCH_PAC_INTO_SCS
bool "Enable shadow call stack dynamically using code patching"
-   # needs Clang with https://reviews.llvm.org/D111780 incorporated
+   # needs Clang with 
https://github.com/llvm/llvm-project/commit/de07cde67b5d205d58690be012106022aea6d2b3
 incorporated
depends on CC_IS_CLANG && CLANG_VERSION >= 15
depends on ARM64_PTR_AUTH_KERNEL && CC_HAS_BRANCH_PROT_PAC_RET
depends on SHADOW_CALL_STACK
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index cd4c9a204d08..f7453eba0b62 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -291,7 +291,7 @@ config AS_HAS_INSN
def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) 
t0$(comma) zero)
 
 config AS_HAS_OPTION_ARCH
-   # https://reviews.llvm.org/D123515
+   # 
https://github.com/llvm/llvm-project/commit/9e8ed3403c191ab9c4903e8eeb8f732ff8a43cb4
def_bool y
depends on $(as-instr, .option arch$(comma) +m)
depends on !$(as-instr, .option arch$(comma) -i)
diff --git a/arch/riscv/include/asm/ftrace.h b/arch/riscv/include/asm/ftrace.h
index 2b2f5df7ef2c..3f526404a718 100644
--- a/arch/riscv/include/asm/ftrace.h
+++ b/arch/riscv/include/asm/ftrace.h
@@ -15,7 +15,7 @@
 
 /*
  * Clang prior to 13 had "mcount" instead of "_mcount":
- * https://reviews.llvm.org/D98881
+ * 
https://github.com/llvm/llvm-project/commit/ef58ae86ba778ed7d01cd3f6bd6d08f943abab44
  */
 #if defined(CONFIG_CC_IS_GCC) || CONFIG_CLANG_VERSION >= 13
 #define MCOUNT_NAME _mcount
diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
index ddab1ef22bee..f0a47afef125 100644
--- a/include/linux/compiler-clang.h
+++ b/include/linux/compiler-clang.h
@@ -9,7 +9,7 @@
  * Clang prior to 17 is being silly and considers many __cleanup() variables
  * as unused (because they are, their sole purpose is to go out of scope).
  *
- * https://reviews.llvm.org/D152180
+ * 
https://github.com/llvm/llvm-project/commit/877210faa447f4cc7db87812f8ed80e398fedd61
  */
 #undef __cleanup
 #define __cleanup(func) __maybe_unused __attribute__((__cleanup__(func)))

-- 
2.43.0



[PATCH 0/3] Update LLVM Phabricator and Bugzilla links

2024-01-09 Thread Nathan Chancellor
This series updates all instances of LLVM Phabricator and Bugzilla links
to point to GitHub commits directly and LLVM's Bugzilla to GitHub issue
shortlinks respectively.

I split up the Phabricator patch into BPF selftests and the rest of the
kernel in case the BPF folks want to take it separately from the rest of
the series, there are obviously no dependency issues in that case. The
Bugzilla change was mechanical enough and should have no conflicts.

I am aiming this at Andrew and CC'ing other lists, in case maintainers
want to chime in, but I think this is pretty uncontroversial (famous
last words...).

---
Nathan Chancellor (3):
  selftests/bpf: Update LLVM Phabricator links
  arch and include: Update LLVM Phabricator links
  treewide: Update LLVM Bugzilla links

 arch/arm64/Kconfig |  4 +--
 arch/powerpc/Makefile  |  4 +--
 arch/powerpc/kvm/book3s_hv_nested.c|  2 +-
 arch/riscv/Kconfig |  2 +-
 arch/riscv/include/asm/ftrace.h|  2 +-
 arch/s390/include/asm/ftrace.h |  2 +-
 arch/x86/power/Makefile|  2 +-
 crypto/blake2b_generic.c   |  2 +-
 drivers/firmware/efi/libstub/Makefile  |  2 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c   |  2 +-
 drivers/media/test-drivers/vicodec/codec-fwht.c|  2 +-
 drivers/regulator/Kconfig  |  2 +-
 include/asm-generic/vmlinux.lds.h  |  2 +-
 include/linux/compiler-clang.h |  2 +-
 lib/Kconfig.kasan  |  2 +-
 lib/raid6/Makefile |  2 +-
 lib/stackinit_kunit.c  |  2 +-
 mm/slab_common.c   |  2 +-
 net/bridge/br_multicast.c  |  2 +-
 security/Kconfig   |  2 +-
 tools/testing/selftests/bpf/README.rst | 32 +++---
 tools/testing/selftests/bpf/prog_tests/xdpwall.c   |  2 +-
 .../selftests/bpf/progs/test_core_reloc_type_id.c  |  2 +-
 23 files changed, 40 insertions(+), 40 deletions(-)
---
base-commit: 0dd3ee31125508cd67f7e7172247f05b7fd1753a
change-id: 20240109-update-llvm-links-d03f9d649e1e

Best regards,
-- 
Nathan Chancellor 



Re: [PATCH] powerpc/Makefile: Remove bits related to the previous use of -mcmodel=large

2024-01-09 Thread Segher Boessenkool
On Tue, Jan 09, 2024 at 03:15:35PM +, Christophe Leroy wrote:
> >   CFLAGS-$(CONFIG_PPC64)+= $(call cc-option,-mcall-aixdesc)
> >   endif
> >   endif
> > -CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call 
> > cc-option,-mminimal-toc))
> > +CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium)
> 
> Should we still use $(call cc-option  here ?
> As we only deal with medium model now, shouldn't we make it such that it 
> fails in case the compiler doesn't support -mcmodel=medium ?

The -mcmodel= flag has been supported since 2010.  The kernel requires
a GCC from 2015 or later (GCC 5.1 is the minimum).  -mcmodel=medium is
(and always has been) the default, so it is always supported, yes.


Segher


Re: [PATCH 1/4] arm: ptdump: Rename CONFIG_DEBUG_WX to CONFIG_ARM_DEBUG_WX

2024-01-09 Thread Florian Fainelli

On 1/9/24 04:14, Christophe Leroy wrote:

CONFIG_DEBUG_WX is a core option defined in mm/Kconfig.debug

To avoid any future conflict, rename ARM version
into CONFIG_ARM_DEBUG_WX.

Signed-off-by: Christophe Leroy 


Looks fine, you might also want to 
s/CONFIG_DEBUG_WX/CONFIG_ARM_DEBUG_WX/ in 
arch/arm/configs/aspeed_g{4,5}_defconfig so there are no surprises when 
people pull in those changes.

--
Florian



Re: [PATCH] powerpc/Makefile: Remove bits related to the previous use of -mcmodel=large

2024-01-09 Thread Christophe Leroy


Le 09/01/2024 à 14:34, Naveen N Rao a écrit :
> All supported compilers today (gcc v5.1+ and clang v11+) have support for
> -mcmodel=medium. As such, NO_MINIMAL_TOC is no longer being set. Remove
> NO_MINIMAL_TOC as well as the fallback to -mminimal-toc.
> 
> Signed-off-by: Naveen N Rao 

Reviewed-by: Christophe Leroy 

Small comment below,

> ---
>   arch/powerpc/Makefile   | 6 +-
>   arch/powerpc/kernel/Makefile| 3 ---
>   arch/powerpc/lib/Makefile   | 2 --
>   arch/powerpc/mm/Makefile| 2 --
>   arch/powerpc/mm/book3s64/Makefile   | 2 --
>   arch/powerpc/mm/nohash/Makefile | 2 --
>   arch/powerpc/platforms/pseries/Makefile | 1 -
>   arch/powerpc/sysdev/Makefile| 2 --
>   arch/powerpc/xmon/Makefile  | 2 --
>   9 files changed, 1 insertion(+), 21 deletions(-)
> 
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 051247027da0..a0eb0fb1aba8 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -114,7 +114,6 @@ LDFLAGS_vmlinux   := $(LDFLAGS_vmlinux-y)
>   
>   ifdef CONFIG_PPC64
>   ifndef CONFIG_PPC_KERNEL_PCREL
> -ifeq ($(call cc-option-yn,-mcmodel=medium),y)
>   # -mcmodel=medium breaks modules because it uses 32bit offsets from
>   # the TOC pointer to create pointers where possible. Pointers into the
>   # percpu data area are created by this method.
> @@ -124,9 +123,6 @@ ifeq ($(call cc-option-yn,-mcmodel=medium),y)
>   # kernel percpu data space (starting with 0xc...). We need a full
>   # 64bit relocation for this to work, hence -mcmodel=large.
>   KBUILD_CFLAGS_MODULE += -mcmodel=large
> -else
> - export NO_MINIMAL_TOC := -mno-minimal-toc
> -endif
>   endif
>   endif
>   
> @@ -139,7 +135,7 @@ CFLAGS-$(CONFIG_PPC64)+= $(call cc-option,-mabi=elfv1)
>   CFLAGS-$(CONFIG_PPC64)  += $(call cc-option,-mcall-aixdesc)
>   endif
>   endif
> -CFLAGS-$(CONFIG_PPC64)   += $(call cc-option,-mcmodel=medium,$(call 
> cc-option,-mminimal-toc))
> +CFLAGS-$(CONFIG_PPC64)   += $(call cc-option,-mcmodel=medium)

Should we still use $(call cc-option  here ?
As we only deal with medium model now, shouldn't we make it such that it 
fails in case the compiler doesn't support -mcmodel=medium ?

>   CFLAGS-$(CONFIG_PPC64)  += $(call 
> cc-option,-mno-pointers-to-nested-functions)
>   CFLAGS-$(CONFIG_PPC64)  += $(call cc-option,-mlong-double-128)
>   


Re: [PATCH 3/3] ASoC: dt-bindings: fsl,micfil: Add compatible string for i.MX95 platform

2024-01-09 Thread Daniel Baluta
On Tue, Jan 9, 2024 at 9:58 AM Chancel Liu  wrote:
>
> Add compatible string "fsl,imx95-micfil" for i.MX95 platform.
>
> Signed-off-by: Chancel Liu 
> ---
>  .../devicetree/bindings/sound/fsl,micfil.yaml | 15 +++
>  1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/sound/fsl,micfil.yaml 
> b/Documentation/devicetree/bindings/sound/fsl,micfil.yaml
> index b7e605835639..f0d3d11d07d2 100644
> --- a/Documentation/devicetree/bindings/sound/fsl,micfil.yaml
> +++ b/Documentation/devicetree/bindings/sound/fsl,micfil.yaml
> @@ -15,10 +15,17 @@ description: |
>
>  properties:
>compatible:
> -enum:
> -  - fsl,imx8mm-micfil
> -  - fsl,imx8mp-micfil
> -  - fsl,imx93-micfil
> +oneOf:
> +  - items:
> +  - enum:
> +  - fsl,imx95-micfil
> +  - const: fsl,imx93-micfil
> +
> +  - items:
> +  - enum:
> +  - fsl,imx8mm-micfil
> +  - fsl,imx8mp-micfil
> +  - fsl,imx93-micfil

My yaml knowledge is very limited. Can you describe in natural
language in the commit what exactly we are doing here.

Why something like this:


>compatible:
> enum:
>   - fsl,imx8mm-micfil
>   - fsl,imx8mp-micfil
>   - fsl,imx93-micfil
+- fsl,imx95-micfil

Isn't enough?


Re: [PATCH 4/4] ptdump: add check_wx_pages debugfs attribute

2024-01-09 Thread Heiko Carstens
On Tue, Jan 09, 2024 at 01:14:38PM +0100, Christophe Leroy wrote:
> Add a writable attribute in debugfs to trigger a
> W^X pages check at any time.
> 
> To trigger the test, just echo any numeric value into
> /sys/kernel/debug/check_wx_pages
> 
> The result is provided into dmesg.
> 
> Signed-off-by: Christophe Leroy 
> ---
>  mm/ptdump.c | 19 +++
>  1 file changed, 19 insertions(+)
...
> +static int check_wx_debugfs_set(void *data, u64 val)
> +{
> + ptdump_check_wx();
> +
> + return 0;
> +}
> +
> +DEFINE_SIMPLE_ATTRIBUTE(check_wx_fops, NULL, check_wx_debugfs_set, "%llu\n");
> +
> +static int ptdump_debugfs_init(void)
> +{
> + debugfs_create_file("check_wx_pages", 0200, NULL, NULL, _wx_fops);
> +
> + return 0;
> +}

Wouldn't it be better to have (only?) a readable attribute which triggers
this, and provides the result via this attribute?
That would allow for automated tests without having to parse dmesg.


[PATCH] powerpc/Makefile: Remove bits related to the previous use of -mcmodel=large

2024-01-09 Thread Naveen N Rao
All supported compilers today (gcc v5.1+ and clang v11+) have support for
-mcmodel=medium. As such, NO_MINIMAL_TOC is no longer being set. Remove
NO_MINIMAL_TOC as well as the fallback to -mminimal-toc.

Signed-off-by: Naveen N Rao 
---
 arch/powerpc/Makefile   | 6 +-
 arch/powerpc/kernel/Makefile| 3 ---
 arch/powerpc/lib/Makefile   | 2 --
 arch/powerpc/mm/Makefile| 2 --
 arch/powerpc/mm/book3s64/Makefile   | 2 --
 arch/powerpc/mm/nohash/Makefile | 2 --
 arch/powerpc/platforms/pseries/Makefile | 1 -
 arch/powerpc/sysdev/Makefile| 2 --
 arch/powerpc/xmon/Makefile  | 2 --
 9 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 051247027da0..a0eb0fb1aba8 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -114,7 +114,6 @@ LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
 
 ifdef CONFIG_PPC64
 ifndef CONFIG_PPC_KERNEL_PCREL
-ifeq ($(call cc-option-yn,-mcmodel=medium),y)
# -mcmodel=medium breaks modules because it uses 32bit offsets from
# the TOC pointer to create pointers where possible. Pointers into the
# percpu data area are created by this method.
@@ -124,9 +123,6 @@ ifeq ($(call cc-option-yn,-mcmodel=medium),y)
# kernel percpu data space (starting with 0xc...). We need a full
# 64bit relocation for this to work, hence -mcmodel=large.
KBUILD_CFLAGS_MODULE += -mcmodel=large
-else
-   export NO_MINIMAL_TOC := -mno-minimal-toc
-endif
 endif
 endif
 
@@ -139,7 +135,7 @@ CFLAGS-$(CONFIG_PPC64)  += $(call cc-option,-mabi=elfv1)
 CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc)
 endif
 endif
-CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call 
cc-option,-mminimal-toc))
+CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium)
 CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
 CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mlong-double-128)
 
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 2919433be355..2b0567926259 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -3,9 +3,6 @@
 # Makefile for the linux kernel.
 #
 
-ifdef CONFIG_PPC64
-CFLAGS_prom_init.o += $(NO_MINIMAL_TOC)
-endif
 ifdef CONFIG_PPC32
 CFLAGS_prom_init.o  += -fPIC
 CFLAGS_btext.o += -fPIC
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 6eac63e79a89..50d88651d04f 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -3,8 +3,6 @@
 # Makefile for ppc-specific library files..
 #
 
-ccflags-$(CONFIG_PPC64):= $(NO_MINIMAL_TOC)
-
 CFLAGS_code-patching.o += -fno-stack-protector
 CFLAGS_feature-fixups.o += -fno-stack-protector
 
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index 503a6e249940..0fe2f085c05a 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -3,8 +3,6 @@
 # Makefile for the linux ppc-specific parts of the memory manager.
 #
 
-ccflags-$(CONFIG_PPC64):= $(NO_MINIMAL_TOC)
-
 obj-y  := fault.o mem.o pgtable.o maccess.o pageattr.o 
\
   init_$(BITS).o pgtable_$(BITS).o \
   pgtable-frag.o ioremap.o ioremap_$(BITS).o \
diff --git a/arch/powerpc/mm/book3s64/Makefile 
b/arch/powerpc/mm/book3s64/Makefile
index cad2abc1730f..33af5795856a 100644
--- a/arch/powerpc/mm/book3s64/Makefile
+++ b/arch/powerpc/mm/book3s64/Makefile
@@ -1,7 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 
-ccflags-y  := $(NO_MINIMAL_TOC)
-
 obj-y  += mmu_context.o pgtable.o trace.o
 ifdef CONFIG_PPC_64S_HASH_MMU
 CFLAGS_REMOVE_slb.o = $(CC_FLAGS_FTRACE)
diff --git a/arch/powerpc/mm/nohash/Makefile b/arch/powerpc/mm/nohash/Makefile
index f3894e79d5f7..b3f0498dd42f 100644
--- a/arch/powerpc/mm/nohash/Makefile
+++ b/arch/powerpc/mm/nohash/Makefile
@@ -1,7 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 
-ccflags-$(CONFIG_PPC64):= $(NO_MINIMAL_TOC)
-
 obj-y  += mmu_context.o tlb.o tlb_low.o kup.o
 obj-$(CONFIG_PPC_BOOK3E_64)+= tlb_low_64e.o book3e_pgtable.o
 obj-$(CONFIG_40x)  += 40x.o
diff --git a/arch/powerpc/platforms/pseries/Makefile 
b/arch/powerpc/platforms/pseries/Makefile
index f936962a2946..7bf506f6b8c8 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -1,5 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-ccflags-$(CONFIG_PPC64):= $(NO_MINIMAL_TOC)
 ccflags-$(CONFIG_PPC_PSERIES_DEBUG)+= -DDEBUG
 
 obj-y  := lpar.o hvCall.o nvram.o reconfig.o \
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 9cb1d029511a..24a177d164f1 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -1,7 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 

Re: [PATCH 2/4] arm64, powerpc, riscv, s390, x86: Refactor CONFIG_DEBUG_WX

2024-01-09 Thread Alexandre Ghiti

Hi Christophe,

On 09/01/2024 13:14, Christophe Leroy wrote:

All architectures using the core ptdump functionality also implement
CONFIG_DEBUG_WX, and they all do it more or less the same way, with a
function called debug_checkwx() that is called by mark_rodata_ro(),
which is a substitute to ptdump_check_wx() when CONFIG_DEBUG_WX is
set and a no-op otherwise.

Refactor by centraly defining debug_checkwx() in linux/ptdump.h and
call debug_checkwx() immediately after calling mark_rodata_ro()
instead of calling it at the end of every mark_rodata_ro().

On x86_32, mark_rodata_ro() first checks __supported_pte_mask has
_PAGE_NX before calling debug_checkwx(). Now the check is inside the
callee ptdump_walk_pgd_level_checkwx().

On powerpc_64, mark_rodata_ro() bails out early before calling
ptdump_check_wx() when the MMU doesn't have KERNEL_RO feature. The
check is now also done in ptdump_check_wx() as it is called outside
mark_rodata_ro().

Signed-off-by: Christophe Leroy 
---
  arch/arm64/include/asm/ptdump.h |  7 ---
  arch/arm64/mm/mmu.c |  2 --
  arch/powerpc/mm/mmu_decl.h  |  6 --
  arch/powerpc/mm/pgtable_32.c|  4 
  arch/powerpc/mm/pgtable_64.c|  3 ---
  arch/powerpc/mm/ptdump/ptdump.c |  3 +++
  arch/riscv/include/asm/ptdump.h | 22 --
  arch/riscv/mm/init.c|  3 ---
  arch/riscv/mm/ptdump.c  |  1 -
  arch/s390/include/asm/ptdump.h  | 14 --
  arch/s390/mm/dump_pagetables.c  |  1 -
  arch/s390/mm/init.c |  2 --
  arch/x86/include/asm/pgtable.h  |  3 +--
  arch/x86/mm/dump_pagetables.c   |  3 +++
  arch/x86/mm/init_32.c   |  2 --
  arch/x86/mm/init_64.c   |  2 --
  include/linux/ptdump.h  |  7 +++
  init/main.c |  2 ++
  18 files changed, 16 insertions(+), 71 deletions(-)
  delete mode 100644 arch/riscv/include/asm/ptdump.h
  delete mode 100644 arch/s390/include/asm/ptdump.h

diff --git a/arch/arm64/include/asm/ptdump.h b/arch/arm64/include/asm/ptdump.h
index 581caac525b0..5b1701c76d1c 100644
--- a/arch/arm64/include/asm/ptdump.h
+++ b/arch/arm64/include/asm/ptdump.h
@@ -29,13 +29,6 @@ void __init ptdump_debugfs_register(struct ptdump_info 
*info, const char *name);
  static inline void ptdump_debugfs_register(struct ptdump_info *info,
   const char *name) { }
  #endif
-void ptdump_check_wx(void);
  #endif /* CONFIG_PTDUMP_CORE */
  
-#ifdef CONFIG_DEBUG_WX

-#define debug_checkwx()ptdump_check_wx()
-#else
-#define debug_checkwx()do { } while (0)
-#endif
-
  #endif /* __ASM_PTDUMP_H */
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 15f6347d23b6..e011beb2e5e3 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -635,8 +635,6 @@ void mark_rodata_ro(void)
section_size = (unsigned long)__init_begin - (unsigned 
long)__start_rodata;
update_mapping_prot(__pa_symbol(__start_rodata), (unsigned 
long)__start_rodata,
section_size, PAGE_KERNEL_RO);
-
-   debug_checkwx();
  }
  
  static void __init map_kernel_segment(pgd_t *pgdp, void *va_start, void *va_end,

diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index 72341b9fb552..90dcc2844056 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -171,12 +171,6 @@ static inline void mmu_mark_rodata_ro(void) { }
  void __init mmu_mapin_immr(void);
  #endif
  
-#ifdef CONFIG_DEBUG_WX

-void ptdump_check_wx(void);
-#else
-static inline void ptdump_check_wx(void) { }
-#endif
-
  static inline bool debug_pagealloc_enabled_or_kfence(void)
  {
return IS_ENABLED(CONFIG_KFENCE) || debug_pagealloc_enabled();
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 5c02fd08d61e..12498017da8e 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -153,7 +153,6 @@ void mark_rodata_ro(void)
  
  	if (v_block_mapped((unsigned long)_stext + 1)) {

mmu_mark_rodata_ro();
-   ptdump_check_wx();
return;
}
  
@@ -166,9 +165,6 @@ void mark_rodata_ro(void)

   PFN_DOWN((unsigned long)_stext);
  
  	set_memory_ro((unsigned long)_stext, numpages);

-
-   // mark_initmem_nx() should have already run by now
-   ptdump_check_wx();
  }
  #endif
  
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c

index 5ac1fd30341b..1b366526f4f2 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -150,9 +150,6 @@ void mark_rodata_ro(void)
radix__mark_rodata_ro();
else
hash__mark_rodata_ro();
-
-   // mark_initmem_nx() should have already run by now
-   ptdump_check_wx();
  }
  
  void mark_initmem_nx(void)

diff --git a/arch/powerpc/mm/ptdump/ptdump.c b/arch/powerpc/mm/ptdump/ptdump.c
index 2313053fe679..620d4917ebe8 100644
--- a/arch/powerpc/mm/ptdump/ptdump.c
+++ 

[PATCH 4/4] ptdump: add check_wx_pages debugfs attribute

2024-01-09 Thread Christophe Leroy
Add a writable attribute in debugfs to trigger a
W^X pages check at any time.

To trigger the test, just echo any numeric value into
/sys/kernel/debug/check_wx_pages

The result is provided into dmesg.

Signed-off-by: Christophe Leroy 
---
 mm/ptdump.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/mm/ptdump.c b/mm/ptdump.c
index 03c1bdae4a43..e154099c2584 100644
--- a/mm/ptdump.c
+++ b/mm/ptdump.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 
 #include 
+#include 
 #include 
 #include 
 
@@ -163,3 +164,21 @@ void ptdump_walk_pgd(struct ptdump_state *st, struct 
mm_struct *mm, pgd_t *pgd)
/* Flush out the last page */
st->note_page(st, 0, -1, 0);
 }
+
+static int check_wx_debugfs_set(void *data, u64 val)
+{
+   ptdump_check_wx();
+
+   return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(check_wx_fops, NULL, check_wx_debugfs_set, "%llu\n");
+
+static int ptdump_debugfs_init(void)
+{
+   debugfs_create_file("check_wx_pages", 0200, NULL, NULL, _wx_fops);
+
+   return 0;
+}
+
+device_initcall(ptdump_debugfs_init);
-- 
2.41.0



[PATCH 3/4] powerpc,s390: Define ptdump_check_wx() regardless of CONFIG_DEBUG_WX

2024-01-09 Thread Christophe Leroy
Following patch will use ptdump_check_wx() regardless of
CONFIG_DEBUG_WX, so define it at all times of powerpc and s390
just like other architectures. Though keep the WARN_ON_ONCE()
only when CONFIG_DEBUG_WX is set.

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/mm/ptdump/ptdump.c | 7 +++
 arch/s390/mm/dump_pagetables.c  | 7 ++-
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/mm/ptdump/ptdump.c b/arch/powerpc/mm/ptdump/ptdump.c
index 620d4917ebe8..b835c80371cd 100644
--- a/arch/powerpc/mm/ptdump/ptdump.c
+++ b/arch/powerpc/mm/ptdump/ptdump.c
@@ -184,13 +184,14 @@ static void note_prot_wx(struct pg_state *st, unsigned 
long addr)
 {
pte_t pte = __pte(st->current_flags);
 
-   if (!IS_ENABLED(CONFIG_DEBUG_WX) || !st->check_wx)
+   if (!st->check_wx)
return;
 
if (!pte_write(pte) || !pte_exec(pte))
return;
 
-   WARN_ONCE(1, "powerpc/mm: Found insecure W+X mapping at address 
%p/%pS\n",
+   WARN_ONCE(IS_ENABLED(CONFIG_DEBUG_WX),
+ "powerpc/mm: Found insecure W+X mapping at address %p/%pS\n",
  (void *)st->start_address, (void *)st->start_address);
 
st->wx_pages += (addr - st->start_address) / PAGE_SIZE;
@@ -326,7 +327,6 @@ static void __init build_pgtable_complete_mask(void)
pg_level[i].mask |= pg_level[i].flag[j].mask;
 }
 
-#ifdef CONFIG_DEBUG_WX
 void ptdump_check_wx(void)
 {
struct pg_state st = {
@@ -354,7 +354,6 @@ void ptdump_check_wx(void)
else
pr_info("Checked W+X mappings: passed, no W+X pages found\n");
 }
-#endif
 
 static int __init ptdump_init(void)
 {
diff --git a/arch/s390/mm/dump_pagetables.c b/arch/s390/mm/dump_pagetables.c
index 8dcb4e0c71bd..99da5a5602a8 100644
--- a/arch/s390/mm/dump_pagetables.c
+++ b/arch/s390/mm/dump_pagetables.c
@@ -121,7 +121,6 @@ static void print_prot(struct seq_file *m, unsigned int pr, 
int level)
 
 static void note_prot_wx(struct pg_state *st, unsigned long addr)
 {
-#ifdef CONFIG_DEBUG_WX
if (!st->check_wx)
return;
if (st->current_prot & _PAGE_INVALID)
@@ -138,10 +137,10 @@ static void note_prot_wx(struct pg_state *st, unsigned 
long addr)
 */
if (addr == PAGE_SIZE && (nospec_uses_trampoline() || 
!static_key_enabled(_has_bear)))
return;
-   WARN_ONCE(1, "s390/mm: Found insecure W+X mapping at address %pS\n",
+   WARN_ONCE(IS_ENABLED(CONFIG_DEBUG_WX),
+ "s390/mm: Found insecure W+X mapping at address %pS\n",
  (void *)st->start_address);
st->wx_pages += (addr - st->start_address) / PAGE_SIZE;
-#endif /* CONFIG_DEBUG_WX */
 }
 
 static void note_page(struct ptdump_state *pt_st, unsigned long addr, int 
level, u64 val)
@@ -193,7 +192,6 @@ static void note_page(struct ptdump_state *pt_st, unsigned 
long addr, int level,
}
 }
 
-#ifdef CONFIG_DEBUG_WX
 void ptdump_check_wx(void)
 {
struct pg_state st = {
@@ -226,7 +224,6 @@ void ptdump_check_wx(void)
(nospec_uses_trampoline() || 
!static_key_enabled(_has_bear)) ?
"unexpected " : "");
 }
-#endif /* CONFIG_DEBUG_WX */
 
 #ifdef CONFIG_PTDUMP_DEBUGFS
 static int ptdump_show(struct seq_file *m, void *v)
-- 
2.41.0



[PATCH 2/4] arm64, powerpc, riscv, s390, x86: Refactor CONFIG_DEBUG_WX

2024-01-09 Thread Christophe Leroy
All architectures using the core ptdump functionality also implement
CONFIG_DEBUG_WX, and they all do it more or less the same way, with a
function called debug_checkwx() that is called by mark_rodata_ro(),
which is a substitute to ptdump_check_wx() when CONFIG_DEBUG_WX is
set and a no-op otherwise.

Refactor by centraly defining debug_checkwx() in linux/ptdump.h and
call debug_checkwx() immediately after calling mark_rodata_ro()
instead of calling it at the end of every mark_rodata_ro().

On x86_32, mark_rodata_ro() first checks __supported_pte_mask has
_PAGE_NX before calling debug_checkwx(). Now the check is inside the
callee ptdump_walk_pgd_level_checkwx().

On powerpc_64, mark_rodata_ro() bails out early before calling
ptdump_check_wx() when the MMU doesn't have KERNEL_RO feature. The
check is now also done in ptdump_check_wx() as it is called outside
mark_rodata_ro().

Signed-off-by: Christophe Leroy 
---
 arch/arm64/include/asm/ptdump.h |  7 ---
 arch/arm64/mm/mmu.c |  2 --
 arch/powerpc/mm/mmu_decl.h  |  6 --
 arch/powerpc/mm/pgtable_32.c|  4 
 arch/powerpc/mm/pgtable_64.c|  3 ---
 arch/powerpc/mm/ptdump/ptdump.c |  3 +++
 arch/riscv/include/asm/ptdump.h | 22 --
 arch/riscv/mm/init.c|  3 ---
 arch/riscv/mm/ptdump.c  |  1 -
 arch/s390/include/asm/ptdump.h  | 14 --
 arch/s390/mm/dump_pagetables.c  |  1 -
 arch/s390/mm/init.c |  2 --
 arch/x86/include/asm/pgtable.h  |  3 +--
 arch/x86/mm/dump_pagetables.c   |  3 +++
 arch/x86/mm/init_32.c   |  2 --
 arch/x86/mm/init_64.c   |  2 --
 include/linux/ptdump.h  |  7 +++
 init/main.c |  2 ++
 18 files changed, 16 insertions(+), 71 deletions(-)
 delete mode 100644 arch/riscv/include/asm/ptdump.h
 delete mode 100644 arch/s390/include/asm/ptdump.h

diff --git a/arch/arm64/include/asm/ptdump.h b/arch/arm64/include/asm/ptdump.h
index 581caac525b0..5b1701c76d1c 100644
--- a/arch/arm64/include/asm/ptdump.h
+++ b/arch/arm64/include/asm/ptdump.h
@@ -29,13 +29,6 @@ void __init ptdump_debugfs_register(struct ptdump_info 
*info, const char *name);
 static inline void ptdump_debugfs_register(struct ptdump_info *info,
   const char *name) { }
 #endif
-void ptdump_check_wx(void);
 #endif /* CONFIG_PTDUMP_CORE */
 
-#ifdef CONFIG_DEBUG_WX
-#define debug_checkwx()ptdump_check_wx()
-#else
-#define debug_checkwx()do { } while (0)
-#endif
-
 #endif /* __ASM_PTDUMP_H */
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 15f6347d23b6..e011beb2e5e3 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -635,8 +635,6 @@ void mark_rodata_ro(void)
section_size = (unsigned long)__init_begin - (unsigned 
long)__start_rodata;
update_mapping_prot(__pa_symbol(__start_rodata), (unsigned 
long)__start_rodata,
section_size, PAGE_KERNEL_RO);
-
-   debug_checkwx();
 }
 
 static void __init map_kernel_segment(pgd_t *pgdp, void *va_start, void 
*va_end,
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index 72341b9fb552..90dcc2844056 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -171,12 +171,6 @@ static inline void mmu_mark_rodata_ro(void) { }
 void __init mmu_mapin_immr(void);
 #endif
 
-#ifdef CONFIG_DEBUG_WX
-void ptdump_check_wx(void);
-#else
-static inline void ptdump_check_wx(void) { }
-#endif
-
 static inline bool debug_pagealloc_enabled_or_kfence(void)
 {
return IS_ENABLED(CONFIG_KFENCE) || debug_pagealloc_enabled();
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 5c02fd08d61e..12498017da8e 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -153,7 +153,6 @@ void mark_rodata_ro(void)
 
if (v_block_mapped((unsigned long)_stext + 1)) {
mmu_mark_rodata_ro();
-   ptdump_check_wx();
return;
}
 
@@ -166,9 +165,6 @@ void mark_rodata_ro(void)
   PFN_DOWN((unsigned long)_stext);
 
set_memory_ro((unsigned long)_stext, numpages);
-
-   // mark_initmem_nx() should have already run by now
-   ptdump_check_wx();
 }
 #endif
 
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 5ac1fd30341b..1b366526f4f2 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -150,9 +150,6 @@ void mark_rodata_ro(void)
radix__mark_rodata_ro();
else
hash__mark_rodata_ro();
-
-   // mark_initmem_nx() should have already run by now
-   ptdump_check_wx();
 }
 
 void mark_initmem_nx(void)
diff --git a/arch/powerpc/mm/ptdump/ptdump.c b/arch/powerpc/mm/ptdump/ptdump.c
index 2313053fe679..620d4917ebe8 100644
--- a/arch/powerpc/mm/ptdump/ptdump.c
+++ b/arch/powerpc/mm/ptdump/ptdump.c
@@ -343,6 +343,9 @@ void ptdump_check_wx(void)
}
};
 
+  

[PATCH 1/4] arm: ptdump: Rename CONFIG_DEBUG_WX to CONFIG_ARM_DEBUG_WX

2024-01-09 Thread Christophe Leroy
CONFIG_DEBUG_WX is a core option defined in mm/Kconfig.debug

To avoid any future conflict, rename ARM version
into CONFIG_ARM_DEBUG_WX.

Signed-off-by: Christophe Leroy 
---
 arch/arm/Kconfig.debug| 2 +-
 arch/arm/include/asm/ptdump.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index fc2b41d41447..141151d632f6 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -17,7 +17,7 @@ config ARM_PTDUMP_DEBUGFS
  kernel.
  If in doubt, say "N"
 
-config DEBUG_WX
+config ARM_DEBUG_WX
bool "Warn on W+X mappings at boot"
depends on MMU
select ARM_PTDUMP_CORE
diff --git a/arch/arm/include/asm/ptdump.h b/arch/arm/include/asm/ptdump.h
index aad1d034136c..46a4575146ee 100644
--- a/arch/arm/include/asm/ptdump.h
+++ b/arch/arm/include/asm/ptdump.h
@@ -32,10 +32,10 @@ void ptdump_check_wx(void);
 
 #endif /* CONFIG_ARM_PTDUMP_CORE */
 
-#ifdef CONFIG_DEBUG_WX
-#define debug_checkwx() ptdump_check_wx()
+#ifdef CONFIG_ARM_DEBUG_WX
+#define arm_debug_checkwx() ptdump_check_wx()
 #else
-#define debug_checkwx() do { } while (0)
+#define arm_debug_checkwx() do { } while (0)
 #endif
 
 #endif /* __ASM_PTDUMP_H */
-- 
2.41.0



[PATCH 0/4] Refactor CONFIG_DEBUG_WX and check_wx_pages debugfs attribute

2024-01-09 Thread Christophe Leroy
Refer old discussion at 
https://lore.kernel.org/lkml/20200422152656.GF676@willie-the-truck/T/#m802eaf33efd6f8d575939d157301b35ac0d4a64f
And https://github.com/KSPP/linux/issues/35

This series refactors CONFIG_DEBUG_WX for the 5 architectures
implementing CONFIG_GENERIC_PTDUMP

First rename stuff in ARM which uses similar names while not
implementing CONFIG_GENERIC_PTDUMP.

Then define a generic version of debug_checkwx() that calls
ptdump_check_wx() when CONFIG_DEBUG_WX is set. Call it immediately
after calling mark_rodata_ro() instead of calling it at the end of
every mark_rodata_ro().

Then implement a debugfs attribute that can be used to trigger
a W^X test at anytime and regardless of CONFIG_DEBUG_WX

Christophe Leroy (4):
  arm: ptdump: Rename CONFIG_DEBUG_WX to CONFIG_ARM_DEBUG_WX
  arm64, powerpc, riscv, s390, x86: Refactor CONFIG_DEBUG_WX
  powerpc,s390: Define ptdump_check_wx() regardless of CONFIG_DEBUG_WX
  ptdump: add check_wx_pages debugfs attribute

 arch/arm/Kconfig.debug  |  2 +-
 arch/arm/include/asm/ptdump.h   |  6 +++---
 arch/arm64/include/asm/ptdump.h |  7 ---
 arch/arm64/mm/mmu.c |  2 --
 arch/powerpc/mm/mmu_decl.h  |  6 --
 arch/powerpc/mm/pgtable_32.c|  4 
 arch/powerpc/mm/pgtable_64.c|  3 ---
 arch/powerpc/mm/ptdump/ptdump.c | 10 ++
 arch/riscv/include/asm/ptdump.h | 22 --
 arch/riscv/mm/init.c|  3 ---
 arch/riscv/mm/ptdump.c  |  1 -
 arch/s390/include/asm/ptdump.h  | 14 --
 arch/s390/mm/dump_pagetables.c  |  8 ++--
 arch/s390/mm/init.c |  2 --
 arch/x86/include/asm/pgtable.h  |  3 +--
 arch/x86/mm/dump_pagetables.c   |  3 +++
 arch/x86/mm/init_32.c   |  2 --
 arch/x86/mm/init_64.c   |  2 --
 include/linux/ptdump.h  |  7 +++
 init/main.c |  2 ++
 mm/ptdump.c | 19 +++
 21 files changed, 44 insertions(+), 84 deletions(-)
 delete mode 100644 arch/riscv/include/asm/ptdump.h
 delete mode 100644 arch/s390/include/asm/ptdump.h

-- 
2.41.0



Re: [PATCH] powerpc: Fix preserved memory size for int-vectors

2024-01-09 Thread Christophe Leroy


Le 09/01/2024 à 04:38, GUO Zihua a écrit :
> [Vous ne recevez pas souvent de courriers de guozi...@huawei.com. Découvrez 
> pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> The first 32k of memory is reserved for interrupt vectors, however for
> powerpc64 this might not be enough. Fix this by reserving the maximum
> size between 32k and the real size of interrupt vectors.

You say "this might not be enough". Do you have exemples of when it is 
not enough, or is it just hypothetycal ?

> 
> Signed-off-by: GUO Zihua 
> ---
>   arch/powerpc/kernel/prom.c | 11 ++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 0b5878c3125b..f374487513b3 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -758,6 +758,7 @@ static inline void save_fscr_to_task(void) {}
>   void __init early_init_devtree(void *params)
>   {
>  phys_addr_t limit;
> +   size_t int_vector_size;

Why size_t ?

memblock_reserve() takes a phys_addr_t

> 
>  DBG(" -> early_init_devtree(%px)\n", params);
> 
> @@ -810,9 +811,17 @@ void __init early_init_devtree(void *params)
>  setup_initial_memory_limit(memstart_addr, first_memblock_size);
>  /* Reserve MEMBLOCK regions used by kernel, initrd, dt, etc... */
>  memblock_reserve(PHYSICAL_START, __pa(_end) - PHYSICAL_START);
> +#ifdef CONFIG_PPC64
> +   /* If relocatable, reserve at least 32k for interrupt vectors etc. */
> +   int_vector_size = (size_t)((uintptr_t)__end_interrupts -
> +  (uintptr_t)_stext);

Why do you need so many casts ? When I look into function 
overlaps_interrupt_vector_text() it seems to work well without cast at all.

> +   int_vector_size = max_t(size_t, 0x8000, int_vector_size);

Use SZ_32K instead of 0x8000

> +#else
>  /* If relocatable, reserve first 32k for interrupt vectors etc. */
> +   int_vector_size = 0x8000;

Use SZ_32K

> +#endif
>  if (PHYSICAL_START > MEMORY_START)
> -   memblock_reserve(MEMORY_START, 0x8000);
> +   memblock_reserve(MEMORY_START, int_vector_size);
>  reserve_kdump_trampoline();
>   #if defined(CONFIG_FA_DUMP) || defined(CONFIG_PRESERVE_FA_DUMP)
>  /*
> --
> 2.34.1
> 


Re: [PATCH] powerpc/ps3_defconfig: Disable PPC64_BIG_ENDIAN_ELF_ABI_V2

2024-01-09 Thread Geert Uytterhoeven

Hi Geoff,

On Wed, 27 Dec 2023, Geoff Levand wrote:

On 12/27/23 10:27, Michael Ellerman wrote:

Geoff Levand  writes:

Commit 8c5fa3b5c4df3d071dab42b04b971df370d99354 (powerpc/64: Make ELFv2 the
default for big-endian builds), merged in Linux-6.5-rc1 changes the calling ABI
in a way that is incompatible with the current code for the PS3's LV1 hypervisor
calls.


I'll take this for now.

But medium term we would like to switch to only using ELFv2, so it would
be good if we can work out what the actual problem is.


I've been looking into converting the LV1 hypercalls to v2.


Until then, you may want to add "depends on !CONFIG_PPC64_BIG_ENDIAN_ELF_ABI_V2"
to config PPC_PS3.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[PATCH 3/3] ASoC: dt-bindings: fsl,micfil: Add compatible string for i.MX95 platform

2024-01-09 Thread Chancel Liu
Add compatible string "fsl,imx95-micfil" for i.MX95 platform.

Signed-off-by: Chancel Liu 
---
 .../devicetree/bindings/sound/fsl,micfil.yaml | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/fsl,micfil.yaml 
b/Documentation/devicetree/bindings/sound/fsl,micfil.yaml
index b7e605835639..f0d3d11d07d2 100644
--- a/Documentation/devicetree/bindings/sound/fsl,micfil.yaml
+++ b/Documentation/devicetree/bindings/sound/fsl,micfil.yaml
@@ -15,10 +15,17 @@ description: |
 
 properties:
   compatible:
-enum:
-  - fsl,imx8mm-micfil
-  - fsl,imx8mp-micfil
-  - fsl,imx93-micfil
+oneOf:
+  - items:
+  - enum:
+  - fsl,imx95-micfil
+  - const: fsl,imx93-micfil
+
+  - items:
+  - enum:
+  - fsl,imx8mm-micfil
+  - fsl,imx8mp-micfil
+  - fsl,imx93-micfil
 
   reg:
 maxItems: 1
-- 
2.42.0