LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 5.4 00/52] 5.4.153-rc2 review
From: Greg Kroah-Hartman @ 2021-10-12  9:28 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: Song Liu, Florian Fainelli, bpf, Johan Almbladh, Pavel Machek,
	linuxppc-dev, open list, lkft-triage, Jon Hunter, Linus Torvalds,
	linux-stable, patches, Andrew Morton, Shuah Khan, Naveen N. Rao,
	Guenter Roeck
In-Reply-To: <CA+G9fYt3vmhvuoFJ6p49DHiFE60oBeWUwuSLrh7vXwr=8_rpfg@mail.gmail.com>

On Tue, Oct 12, 2021 at 01:04:54PM +0530, Naresh Kamboju wrote:
> On Tue, 12 Oct 2021 at 12:16, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > This is the start of the stable review cycle for the 5.4.153 release.
> > There are 52 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> >
> > Responses should be made by Thu, 14 Oct 2021 06:44:25 +0000.
> > Anything received after that time might be too late.
> >
> > The whole patch series can be found in one patch at:
> >         https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.153-rc2.gz
> > or in the git tree and branch at:
> >         git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
> > and the diffstat can be found below.
> >
> > thanks,
> >
> > greg k-h
> 
> stable rc 5.4.153-rc2 Powerpc build failed.
> 
> In file included from arch/powerpc/net/bpf_jit64.h:11,
>                  from arch/powerpc/net/bpf_jit_comp64.c:19:
> arch/powerpc/net/bpf_jit_comp64.c: In function 'bpf_jit_build_body':
> arch/powerpc/net/bpf_jit.h:32:9: error: expected expression before 'do'
>    32 |         do { if (d) { (d)[idx] = instr; } idx++; } while (0)
>       |         ^~
> arch/powerpc/net/bpf_jit.h:33:33: note: in expansion of macro 'PLANT_INSTR'
>    33 | #define EMIT(instr)             PLANT_INSTR(image, ctx->idx, instr)
>       |                                 ^~~~~~~~~~~
> arch/powerpc/net/bpf_jit_comp64.c:415:41: note: in expansion of macro 'EMIT'
>   415 |                                         EMIT(PPC_LI(dst_reg, 0));
>       |                                         ^~~~
> arch/powerpc/net/bpf_jit.h:33:33: note: in expansion of macro 'PLANT_INSTR'
>    33 | #define EMIT(instr)             PLANT_INSTR(image, ctx->idx, instr)
>       |                                 ^~~~~~~~~~~
> arch/powerpc/net/bpf_jit.h:41:33: note: in expansion of macro 'EMIT'
>    41 | #define PPC_ADDI(d, a, i)       EMIT(PPC_INST_ADDI |
> ___PPC_RT(d) |           \
>       |                                 ^~~~
> arch/powerpc/net/bpf_jit.h:44:33: note: in expansion of macro 'PPC_ADDI'
>    44 | #define PPC_LI(r, i)            PPC_ADDI(r, 0, i)
>       |                                 ^~~~~~~~
> arch/powerpc/net/bpf_jit_comp64.c:415:46: note: in expansion of macro 'PPC_LI'
>   415 |                                         EMIT(PPC_LI(dst_reg, 0));
>       |                                              ^~~~~~
> make[3]: *** [scripts/Makefile.build:262:
> arch/powerpc/net/bpf_jit_comp64.o] Error 1
> make[3]: Target '__build' not remade because of errors.
> 
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>

Ok, I'm just going to go delete this patch from the queue now...

Thanks for the quick report.

greg k-h

^ permalink raw reply

* [PATCH] powerpc: Set max_mapnr correctly
From: Christophe Leroy @ 2021-10-12 10:40 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linuxppc-dev, linux-kernel

max_mapnr is used by virt_addr_valid() to check if a linear
address is valid.

It must only include lowmem PFNs, like other architectures.

Problem detected on a system with 1G mem (Only 768M are mapped), with
CONFIG_DEBUG_VIRTUAL and CONFIG_TEST_DEBUG_VIRTUAL, it didn't report
virt_to_phys(VMALLOC_START), VMALLOC_START being 0xf1000000.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/mm/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index c3c4e31462ec..889f36b55df9 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -256,7 +256,7 @@ void __init mem_init(void)
 #endif
 
 	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
-	set_max_mapnr(max_pfn);
+	set_max_mapnr(max_low_pfn);
 
 	kasan_late_init();
 
-- 
2.31.1


^ permalink raw reply related

* Re: [PATCH 2/2] ftrace: prevent preemption in perf_ftrace_function_call()
From: Peter Zijlstra @ 2021-10-12 11:20 UTC (permalink / raw)
  To: 王贇
  Cc: Paul Walmsley, James E.J. Bottomley, Guo Ren, Jisheng Zhang,
	H. Peter Anvin, live-patching, linux-riscv, Miroslav Benes,
	Paul Mackerras, Joe Lawrence, Helge Deller, x86, linux-csky,
	Ingo Molnar, Petr Mladek, Albert Ou, Jiri Kosina, Steven Rostedt,
	Borislav Petkov, Nicholas Piggin, Josh Poimboeuf, Thomas Gleixner,
	linux-parisc, linux-kernel, Palmer Dabbelt, Masami Hiramatsu,
	Colin Ian King, linuxppc-dev
In-Reply-To: <7ec34e08-a357-58d6-2ce4-c7472d8b0381@linux.alibaba.com>

On Tue, Oct 12, 2021 at 01:40:31PM +0800, 王贇 wrote:

> diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
> index 6aed10e..33c2f76 100644
> --- a/kernel/trace/trace_event_perf.c
> +++ b/kernel/trace/trace_event_perf.c
> @@ -441,12 +441,19 @@ void perf_trace_buf_update(void *record, u16 type)
>  	if (!rcu_is_watching())
>  		return;
> 
> +	/*
> +	 * Prevent CPU changing from now on. rcu must
> +	 * be in watching if the task was migrated and
> +	 * scheduled.
> +	 */
> +	preempt_disable_notrace();
> +
>  	if ((unsigned long)ops->private != smp_processor_id())
> -		return;
> +		goto out;
> 
>  	bit = ftrace_test_recursion_trylock(ip, parent_ip);
>  	if (bit < 0)
> -		return;
> +		goto out;
> 
>  	event = container_of(ops, struct perf_event, ftrace_ops);
> 

This seems rather daft, wouldn't it be easier to just put that check
under the recursion thing?

^ permalink raw reply

* Re: [PATCH 1/2] ftrace: disable preemption on the testing of recursion
From: Steven Rostedt @ 2021-10-12 12:17 UTC (permalink / raw)
  To: 王贇
  Cc: Peter Zijlstra (Intel), Paul Walmsley, James E.J. Bottomley,
	Guo Ren, Jisheng Zhang, H. Peter Anvin, live-patching,
	linux-riscv, Miroslav Benes, Paul Mackerras, Joe Lawrence,
	Helge Deller, x86, linux-csky, Ingo Molnar, Petr Mladek,
	Albert Ou, Jiri Kosina, Nicholas Piggin, Borislav Petkov,
	Josh Poimboeuf, Thomas Gleixner, linux-parisc, linux-kernel,
	Palmer Dabbelt, Masami Hiramatsu, Colin Ian King, linuxppc-dev
In-Reply-To: <a8756482-024c-c858-b3d1-1ffa9a5eb3f7@linux.alibaba.com>

On Tue, 12 Oct 2021 13:40:08 +0800
王贇 <yun.wang@linux.alibaba.com> wrote:

> @@ -52,11 +52,6 @@ static void notrace klp_ftrace_handler(unsigned long ip,
>  	bit = ftrace_test_recursion_trylock(ip, parent_ip);
>  	if (WARN_ON_ONCE(bit < 0))
>  		return;
> -	/*
> -	 * A variant of synchronize_rcu() is used to allow patching functions
> -	 * where RCU is not watching, see klp_synchronize_transition().
> -	 */

I have to take a deeper look at this patch set, but do not remove this
comment, as it explains the protection here, that is not obvious with the
changes you made.

-- Steve


> -	preempt_disable_notrace();
> 
>  	func = list_first_or_null_rcu(&ops->func_stack, struct klp_func,
>  				      stack_node);

^ permalink raw reply

* Re: [PATCH 1/2] ftrace: disable preemption on the testing of recursion
From: Steven Rostedt @ 2021-10-12 12:29 UTC (permalink / raw)
  To: Miroslav Benes
  Cc: 王贇, Peter Zijlstra (Intel), Paul Walmsley,
	James E.J. Bottomley, Guo Ren, Jisheng Zhang, H. Peter Anvin,
	live-patching, linux-riscv, Paul Mackerras, Joe Lawrence,
	Helge Deller, x86, linux-csky, Ingo Molnar, Petr Mladek,
	Albert Ou, Jiri Kosina, Nicholas Piggin, Borislav Petkov,
	Josh Poimboeuf, Thomas Gleixner, linux-parisc, linux-kernel,
	Palmer Dabbelt, Masami Hiramatsu, Colin Ian King, linuxppc-dev
In-Reply-To: <alpine.LSU.2.21.2110121421260.3394@pobox.suse.cz>

On Tue, 12 Oct 2021 14:24:43 +0200 (CEST)
Miroslav Benes <mbenes@suse.cz> wrote:

> > +++ b/kernel/livepatch/patch.c
> > @@ -52,11 +52,6 @@ static void notrace klp_ftrace_handler(unsigned long ip,
> >  	bit = ftrace_test_recursion_trylock(ip, parent_ip);
> >  	if (WARN_ON_ONCE(bit < 0))
> >  		return;
> > -	/*
> > -	 * A variant of synchronize_rcu() is used to allow patching functions
> > -	 * where RCU is not watching, see klp_synchronize_transition().
> > -	 */
> > -	preempt_disable_notrace();
> > 
> >  	func = list_first_or_null_rcu(&ops->func_stack, struct klp_func,
> >  				      stack_node);
> > @@ -120,7 +115,6 @@ static void notrace klp_ftrace_handler(unsigned long ip,
> >  	klp_arch_set_pc(fregs, (unsigned long)func->new_func);
> > 
> >  unlock:
> > -	preempt_enable_notrace();
> >  	ftrace_test_recursion_unlock(bit);
> >  }  
> 
> I don't like this change much. We have preempt_disable there not because 
> of ftrace_test_recursion, but because of RCU. ftrace_test_recursion was 
> added later. Yes, it would work with the change, but it would also hide 
> things which should not be hidden in my opinion.

Agreed, but I believe the change is fine, but requires a nice comment to
explain what you said above.

Thus, before the "ftrace_test_recursion_trylock()" we need:

	/*
	 * The ftrace_test_recursion_trylock() will disable preemption,
	 * which is required for the variant of synchronize_rcu() that is
	 * used to allow patching functions where RCU is not watching.
	 * See klp_synchronize_transition() for more details.
	 */

-- Steve

^ permalink raw reply

* [RESEND PATCH v4 2/8] bpf powerpc: Remove extra_pass from bpf_jit_build_body()
From: Hari Bathini @ 2021-10-12 12:30 UTC (permalink / raw)
  To: naveen.n.rao, christophe.leroy, mpe, ast, daniel
  Cc: Ravi Bangoria, songliubraving, netdev, john.fastabend, andrii,
	kpsingh, paulus, yhs, bpf, linuxppc-dev, kafai
In-Reply-To: <20211012123056.485795-1-hbathini@linux.ibm.com>

From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>

In case of extra_pass, usual JIT passes are always skipped. So,
extra_pass is always false while calling bpf_jit_build_body() and
can be removed.

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---

* No changes in v4.


 arch/powerpc/net/bpf_jit.h        | 2 +-
 arch/powerpc/net/bpf_jit_comp.c   | 6 +++---
 arch/powerpc/net/bpf_jit_comp32.c | 4 ++--
 arch/powerpc/net/bpf_jit_comp64.c | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index 89bd744c2bff..7145b651fc2a 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -175,7 +175,7 @@ static inline void bpf_clear_seen_register(struct codegen_context *ctx, int i)
 
 void bpf_jit_emit_func_call_rel(u32 *image, struct codegen_context *ctx, u64 func);
 int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *ctx,
-		       u32 *addrs, bool extra_pass);
+		       u32 *addrs);
 void bpf_jit_build_prologue(u32 *image, struct codegen_context *ctx);
 void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx);
 void bpf_jit_realloc_regs(struct codegen_context *ctx);
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index fcbf7a917c56..f7972b2c21f6 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -149,7 +149,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 	cgctx.stack_size = round_up(fp->aux->stack_depth, 16);
 
 	/* Scouting faux-generate pass 0 */
-	if (bpf_jit_build_body(fp, 0, &cgctx, addrs, false)) {
+	if (bpf_jit_build_body(fp, 0, &cgctx, addrs)) {
 		/* We hit something illegal or unsupported. */
 		fp = org_fp;
 		goto out_addrs;
@@ -162,7 +162,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 	 */
 	if (cgctx.seen & SEEN_TAILCALL) {
 		cgctx.idx = 0;
-		if (bpf_jit_build_body(fp, 0, &cgctx, addrs, false)) {
+		if (bpf_jit_build_body(fp, 0, &cgctx, addrs)) {
 			fp = org_fp;
 			goto out_addrs;
 		}
@@ -210,7 +210,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 		/* Now build the prologue, body code & epilogue for real. */
 		cgctx.idx = 0;
 		bpf_jit_build_prologue(code_base, &cgctx);
-		if (bpf_jit_build_body(fp, code_base, &cgctx, addrs, extra_pass)) {
+		if (bpf_jit_build_body(fp, code_base, &cgctx, addrs)) {
 			bpf_jit_binary_free(bpf_hdr);
 			fp = org_fp;
 			goto out_addrs;
diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c
index 0da31d41d413..903f945601c0 100644
--- a/arch/powerpc/net/bpf_jit_comp32.c
+++ b/arch/powerpc/net/bpf_jit_comp32.c
@@ -268,7 +268,7 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o
 
 /* Assemble the body code between the prologue & epilogue */
 int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *ctx,
-		       u32 *addrs, bool extra_pass)
+		       u32 *addrs)
 {
 	const struct bpf_insn *insn = fp->insnsi;
 	int flen = fp->len;
@@ -862,7 +862,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
 		case BPF_JMP | BPF_CALL:
 			ctx->seen |= SEEN_FUNC;
 
-			ret = bpf_jit_get_func_addr(fp, &insn[i], extra_pass,
+			ret = bpf_jit_get_func_addr(fp, &insn[i], false,
 						    &func_addr, &func_addr_fixed);
 			if (ret < 0)
 				return ret;
diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
index 8b5157ccfeba..b25bf9b11b9d 100644
--- a/arch/powerpc/net/bpf_jit_comp64.c
+++ b/arch/powerpc/net/bpf_jit_comp64.c
@@ -297,7 +297,7 @@ asm (
 
 /* Assemble the body code between the prologue & epilogue */
 int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *ctx,
-		       u32 *addrs, bool extra_pass)
+		       u32 *addrs)
 {
 	enum stf_barrier_type stf_barrier = stf_barrier_type_get();
 	const struct bpf_insn *insn = fp->insnsi;
@@ -831,7 +831,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
 		case BPF_JMP | BPF_CALL:
 			ctx->seen |= SEEN_FUNC;
 
-			ret = bpf_jit_get_func_addr(fp, &insn[i], extra_pass,
+			ret = bpf_jit_get_func_addr(fp, &insn[i], false,
 						    &func_addr, &func_addr_fixed);
 			if (ret < 0)
 				return ret;
-- 
2.31.1


^ permalink raw reply related

* [RESEND PATCH v4 3/8] bpf powerpc: refactor JIT compiler code
From: Hari Bathini @ 2021-10-12 12:30 UTC (permalink / raw)
  To: naveen.n.rao, christophe.leroy, mpe, ast, daniel
  Cc: songliubraving, netdev, john.fastabend, andrii, kpsingh, paulus,
	yhs, bpf, linuxppc-dev, kafai, Hari Bathini
In-Reply-To: <20211012123056.485795-1-hbathini@linux.ibm.com>

Refactor powerpc LDX JITing code to simplify adding BPF_PROBE_MEM
support.

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---

Changes in v4:
* Dropped the default case in the switch statement for bpf size.
* Dropped explicit fallthrough statement for empty switch cases.


 arch/powerpc/net/bpf_jit_comp32.c | 33 ++++++++++++++++++-------------
 arch/powerpc/net/bpf_jit_comp64.c | 31 +++++++++++++++++------------
 2 files changed, 37 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c
index 903f945601c0..8b2ac1c27f1f 100644
--- a/arch/powerpc/net/bpf_jit_comp32.c
+++ b/arch/powerpc/net/bpf_jit_comp32.c
@@ -284,6 +284,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
 		u32 src_reg = bpf_to_ppc(ctx, insn[i].src_reg);
 		u32 src_reg_h = src_reg - 1;
 		u32 tmp_reg = bpf_to_ppc(ctx, TMP_REG);
+		u32 size = BPF_SIZE(code);
 		s16 off = insn[i].off;
 		s32 imm = insn[i].imm;
 		bool func_addr_fixed;
@@ -812,23 +813,27 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
 		 * BPF_LDX
 		 */
 		case BPF_LDX | BPF_MEM | BPF_B: /* dst = *(u8 *)(ul) (src + off) */
-			EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
-			if (!fp->aux->verifier_zext)
-				EMIT(PPC_RAW_LI(dst_reg_h, 0));
-			break;
 		case BPF_LDX | BPF_MEM | BPF_H: /* dst = *(u16 *)(ul) (src + off) */
-			EMIT(PPC_RAW_LHZ(dst_reg, src_reg, off));
-			if (!fp->aux->verifier_zext)
-				EMIT(PPC_RAW_LI(dst_reg_h, 0));
-			break;
 		case BPF_LDX | BPF_MEM | BPF_W: /* dst = *(u32 *)(ul) (src + off) */
-			EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off));
-			if (!fp->aux->verifier_zext)
-				EMIT(PPC_RAW_LI(dst_reg_h, 0));
-			break;
 		case BPF_LDX | BPF_MEM | BPF_DW: /* dst = *(u64 *)(ul) (src + off) */
-			EMIT(PPC_RAW_LWZ(dst_reg_h, src_reg, off));
-			EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off + 4));
+			switch (size) {
+			case BPF_B:
+				EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
+				break;
+			case BPF_H:
+				EMIT(PPC_RAW_LHZ(dst_reg, src_reg, off));
+				break;
+			case BPF_W:
+				EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off));
+				break;
+			case BPF_DW:
+				EMIT(PPC_RAW_LWZ(dst_reg_h, src_reg, off));
+				EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off + 4));
+				break;
+			}
+
+			if (size != BPF_DW && !fp->aux->verifier_zext)
+				EMIT(PPC_RAW_LI(dst_reg_h, 0));
 			break;
 
 		/*
diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
index b25bf9b11b9d..ad852f15ca61 100644
--- a/arch/powerpc/net/bpf_jit_comp64.c
+++ b/arch/powerpc/net/bpf_jit_comp64.c
@@ -311,6 +311,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
 		u32 code = insn[i].code;
 		u32 dst_reg = b2p[insn[i].dst_reg];
 		u32 src_reg = b2p[insn[i].src_reg];
+		u32 size = BPF_SIZE(code);
 		s16 off = insn[i].off;
 		s32 imm = insn[i].imm;
 		bool func_addr_fixed;
@@ -778,25 +779,29 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
 		 */
 		/* dst = *(u8 *)(ul) (src + off) */
 		case BPF_LDX | BPF_MEM | BPF_B:
-			EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
-			if (insn_is_zext(&insn[i + 1]))
-				addrs[++i] = ctx->idx * 4;
-			break;
 		/* dst = *(u16 *)(ul) (src + off) */
 		case BPF_LDX | BPF_MEM | BPF_H:
-			EMIT(PPC_RAW_LHZ(dst_reg, src_reg, off));
-			if (insn_is_zext(&insn[i + 1]))
-				addrs[++i] = ctx->idx * 4;
-			break;
 		/* dst = *(u32 *)(ul) (src + off) */
 		case BPF_LDX | BPF_MEM | BPF_W:
-			EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off));
-			if (insn_is_zext(&insn[i + 1]))
-				addrs[++i] = ctx->idx * 4;
-			break;
 		/* dst = *(u64 *)(ul) (src + off) */
 		case BPF_LDX | BPF_MEM | BPF_DW:
-			PPC_BPF_LL(dst_reg, src_reg, off);
+			switch (size) {
+			case BPF_B:
+				EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
+				break;
+			case BPF_H:
+				EMIT(PPC_RAW_LHZ(dst_reg, src_reg, off));
+				break;
+			case BPF_W:
+				EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off));
+				break;
+			case BPF_DW:
+				PPC_BPF_LL(dst_reg, src_reg, off);
+				break;
+			}
+
+			if (size != BPF_DW && insn_is_zext(&insn[i + 1]))
+				addrs[++i] = ctx->idx * 4;
 			break;
 
 		/*
-- 
2.31.1


^ permalink raw reply related

* [RESEND PATCH v4 5/8] bpf ppc64: Add BPF_PROBE_MEM support for JIT
From: Hari Bathini @ 2021-10-12 12:30 UTC (permalink / raw)
  To: naveen.n.rao, christophe.leroy, mpe, ast, daniel
  Cc: Ravi Bangoria, songliubraving, netdev, john.fastabend, andrii,
	kpsingh, paulus, yhs, bpf, linuxppc-dev, kafai, Hari Bathini
In-Reply-To: <20211012123056.485795-1-hbathini@linux.ibm.com>

From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>

BPF load instruction with BPF_PROBE_MEM mode can cause a fault
inside kernel. Append exception table for such instructions
within BPF program.

Unlike other archs which uses extable 'fixup' field to pass dest_reg
and nip, BPF exception table on PowerPC follows the generic PowerPC
exception table design, where it populates both fixup and extable
sections within BPF program. fixup section contains two instructions,
first instruction clears dest_reg and 2nd jumps to next instruction
in the BPF code. extable 'insn' field contains relative offset of
the instruction and 'fixup' field contains relative offset of the
fixup entry. Example layout of BPF program with extable present:

             +------------------+
             |                  |
             |                  |
   0x4020 -->| ld   r27,4(r3)   |
             |                  |
             |                  |
   0x40ac -->| lwz  r3,0(r4)    |
             |                  |
             |                  |
             |------------------|
   0x4280 -->| li  r27,0        |  \ fixup entry
             | b   0x4024       |  /
   0x4288 -->| li  r3,0         |
             | b   0x40b0       |
             |------------------|
   0x4290 -->| insn=0xfffffd90  |  \ extable entry
             | fixup=0xffffffec |  /
   0x4298 -->| insn=0xfffffe14  |
             | fixup=0xffffffec |
             +------------------+

   (Addresses shown here are chosen random, not real)

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---

Changes in v4:
* Dropped explicit fallthrough statement for empty switch cases.


 arch/powerpc/net/bpf_jit.h        |  8 +++-
 arch/powerpc/net/bpf_jit_comp.c   | 66 ++++++++++++++++++++++++++++---
 arch/powerpc/net/bpf_jit_comp32.c |  2 +-
 arch/powerpc/net/bpf_jit_comp64.c | 13 +++++-
 4 files changed, 80 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index 6a945f6211f4..444c9debce91 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -150,8 +150,11 @@ struct codegen_context {
 	unsigned int idx;
 	unsigned int stack_size;
 	int b2p[ARRAY_SIZE(b2p)];
+	unsigned int exentry_idx;
 };
 
+#define BPF_FIXUP_LEN	2 /* Two instructions => 8 bytes */
+
 static inline void bpf_flush_icache(void *start, void *end)
 {
 	smp_wmb();	/* smp write barrier */
@@ -175,11 +178,14 @@ static inline void bpf_clear_seen_register(struct codegen_context *ctx, int i)
 
 void bpf_jit_emit_func_call_rel(u32 *image, struct codegen_context *ctx, u64 func);
 int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *ctx,
-		       u32 *addrs);
+		       u32 *addrs, int pass);
 void bpf_jit_build_prologue(u32 *image, struct codegen_context *ctx);
 void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx);
 void bpf_jit_realloc_regs(struct codegen_context *ctx);
 
+int bpf_add_extable_entry(struct bpf_prog *fp, u32 *image, int pass, struct codegen_context *ctx,
+			  int insn_idx, int jmp_off, int dst_reg);
+
 #endif
 
 #endif
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index f7972b2c21f6..f02457c6b54f 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -101,6 +101,8 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 	struct bpf_prog *tmp_fp;
 	bool bpf_blinded = false;
 	bool extra_pass = false;
+	u32 extable_len;
+	u32 fixup_len;
 
 	if (!fp->jit_requested)
 		return org_fp;
@@ -131,7 +133,6 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 		image = jit_data->image;
 		bpf_hdr = jit_data->header;
 		proglen = jit_data->proglen;
-		alloclen = proglen + FUNCTION_DESCR_SIZE;
 		extra_pass = true;
 		goto skip_init_ctx;
 	}
@@ -149,7 +150,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 	cgctx.stack_size = round_up(fp->aux->stack_depth, 16);
 
 	/* Scouting faux-generate pass 0 */
-	if (bpf_jit_build_body(fp, 0, &cgctx, addrs)) {
+	if (bpf_jit_build_body(fp, 0, &cgctx, addrs, 0)) {
 		/* We hit something illegal or unsupported. */
 		fp = org_fp;
 		goto out_addrs;
@@ -162,7 +163,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 	 */
 	if (cgctx.seen & SEEN_TAILCALL) {
 		cgctx.idx = 0;
-		if (bpf_jit_build_body(fp, 0, &cgctx, addrs)) {
+		if (bpf_jit_build_body(fp, 0, &cgctx, addrs, 0)) {
 			fp = org_fp;
 			goto out_addrs;
 		}
@@ -177,8 +178,11 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 	bpf_jit_build_prologue(0, &cgctx);
 	bpf_jit_build_epilogue(0, &cgctx);
 
+	fixup_len = fp->aux->num_exentries * BPF_FIXUP_LEN * 4;
+	extable_len = fp->aux->num_exentries * sizeof(struct exception_table_entry);
+
 	proglen = cgctx.idx * 4;
-	alloclen = proglen + FUNCTION_DESCR_SIZE;
+	alloclen = proglen + FUNCTION_DESCR_SIZE + fixup_len + extable_len;
 
 	bpf_hdr = bpf_jit_binary_alloc(alloclen, &image, 4, bpf_jit_fill_ill_insns);
 	if (!bpf_hdr) {
@@ -186,6 +190,9 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 		goto out_addrs;
 	}
 
+	if (extable_len)
+		fp->aux->extable = (void *)image + FUNCTION_DESCR_SIZE + proglen + fixup_len;
+
 skip_init_ctx:
 	code_base = (u32 *)(image + FUNCTION_DESCR_SIZE);
 
@@ -210,7 +217,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 		/* Now build the prologue, body code & epilogue for real. */
 		cgctx.idx = 0;
 		bpf_jit_build_prologue(code_base, &cgctx);
-		if (bpf_jit_build_body(fp, code_base, &cgctx, addrs)) {
+		if (bpf_jit_build_body(fp, code_base, &cgctx, addrs, pass)) {
 			bpf_jit_binary_free(bpf_hdr);
 			fp = org_fp;
 			goto out_addrs;
@@ -238,7 +245,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 
 	fp->bpf_func = (void *)image;
 	fp->jited = 1;
-	fp->jited_len = alloclen;
+	fp->jited_len = proglen + FUNCTION_DESCR_SIZE;
 
 	bpf_flush_icache(bpf_hdr, (u8 *)bpf_hdr + (bpf_hdr->pages * PAGE_SIZE));
 	bpf_jit_binary_lock_ro(bpf_hdr);
@@ -262,3 +269,50 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 
 	return fp;
 }
+
+/*
+ * The caller should check for (BPF_MODE(code) == BPF_PROBE_MEM) before calling
+ * this function, as this only applies to BPF_PROBE_MEM, for now.
+ */
+int bpf_add_extable_entry(struct bpf_prog *fp, u32 *image, int pass, struct codegen_context *ctx,
+			  int insn_idx, int jmp_off, int dst_reg)
+{
+	off_t offset;
+	unsigned long pc;
+	struct exception_table_entry *ex;
+	u32 *fixup;
+
+	/* Populate extable entries only in the last pass */
+	if (pass != 2)
+		return 0;
+
+	if (!fp->aux->extable ||
+	    WARN_ON_ONCE(ctx->exentry_idx >= fp->aux->num_exentries))
+		return -EINVAL;
+
+	pc = (unsigned long)&image[insn_idx];
+
+	fixup = (void *)fp->aux->extable -
+		(fp->aux->num_exentries * BPF_FIXUP_LEN * 4) +
+		(ctx->exentry_idx * BPF_FIXUP_LEN * 4);
+
+	fixup[0] = PPC_RAW_LI(dst_reg, 0);
+
+	fixup[BPF_FIXUP_LEN - 1] =
+		PPC_RAW_BRANCH((long)(pc + jmp_off) - (long)&fixup[BPF_FIXUP_LEN - 1]);
+
+	ex = &fp->aux->extable[ctx->exentry_idx];
+
+	offset = pc - (long)&ex->insn;
+	if (WARN_ON_ONCE(offset >= 0 || offset < INT_MIN))
+		return -ERANGE;
+	ex->insn = offset;
+
+	offset = (long)fixup - (long)&ex->fixup;
+	if (WARN_ON_ONCE(offset >= 0 || offset < INT_MIN))
+		return -ERANGE;
+	ex->fixup = offset;
+
+	ctx->exentry_idx++;
+	return 0;
+}
diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c
index 8b2ac1c27f1f..54e7cef3e1f2 100644
--- a/arch/powerpc/net/bpf_jit_comp32.c
+++ b/arch/powerpc/net/bpf_jit_comp32.c
@@ -268,7 +268,7 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o
 
 /* Assemble the body code between the prologue & epilogue */
 int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *ctx,
-		       u32 *addrs)
+		       u32 *addrs, int pass)
 {
 	const struct bpf_insn *insn = fp->insnsi;
 	int flen = fp->len;
diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
index ad852f15ca61..ede8cb3e453f 100644
--- a/arch/powerpc/net/bpf_jit_comp64.c
+++ b/arch/powerpc/net/bpf_jit_comp64.c
@@ -297,7 +297,7 @@ asm (
 
 /* Assemble the body code between the prologue & epilogue */
 int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *ctx,
-		       u32 *addrs)
+		       u32 *addrs, int pass)
 {
 	enum stf_barrier_type stf_barrier = stf_barrier_type_get();
 	const struct bpf_insn *insn = fp->insnsi;
@@ -779,12 +779,16 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
 		 */
 		/* dst = *(u8 *)(ul) (src + off) */
 		case BPF_LDX | BPF_MEM | BPF_B:
+		case BPF_LDX | BPF_PROBE_MEM | BPF_B:
 		/* dst = *(u16 *)(ul) (src + off) */
 		case BPF_LDX | BPF_MEM | BPF_H:
+		case BPF_LDX | BPF_PROBE_MEM | BPF_H:
 		/* dst = *(u32 *)(ul) (src + off) */
 		case BPF_LDX | BPF_MEM | BPF_W:
+		case BPF_LDX | BPF_PROBE_MEM | BPF_W:
 		/* dst = *(u64 *)(ul) (src + off) */
 		case BPF_LDX | BPF_MEM | BPF_DW:
+		case BPF_LDX | BPF_PROBE_MEM | BPF_DW:
 			switch (size) {
 			case BPF_B:
 				EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
@@ -802,6 +806,13 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
 
 			if (size != BPF_DW && insn_is_zext(&insn[i + 1]))
 				addrs[++i] = ctx->idx * 4;
+
+			if (BPF_MODE(code) == BPF_PROBE_MEM) {
+				ret = bpf_add_extable_entry(fp, image, pass, ctx, ctx->idx - 1,
+							    4, dst_reg);
+				if (ret)
+					return ret;
+			}
 			break;
 
 		/*
-- 
2.31.1


^ permalink raw reply related

* [RESEND PATCH v4 6/8] bpf ppc64: Access only if addr is kernel address
From: Hari Bathini @ 2021-10-12 12:30 UTC (permalink / raw)
  To: naveen.n.rao, christophe.leroy, mpe, ast, daniel
  Cc: Ravi Bangoria, songliubraving, netdev, john.fastabend, andrii,
	kpsingh, paulus, yhs, bpf, linuxppc-dev, kafai, Hari Bathini
In-Reply-To: <20211012123056.485795-1-hbathini@linux.ibm.com>

From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>

On PPC64 with KUAP enabled, any kernel code which wants to
access userspace needs to be surrounded by disable-enable KUAP.
But that is not happening for BPF_PROBE_MEM load instruction.
So, when BPF program tries to access invalid userspace address,
page-fault handler considers it as bad KUAP fault:

  Kernel attempted to read user page (d0000000) - exploit attempt? (uid: 0)

Considering the fact that PTR_TO_BTF_ID (which uses BPF_PROBE_MEM
mode) could either be a valid kernel pointer or NULL but should
never be a pointer to userspace address, execute BPF_PROBE_MEM load
only if addr is kernel address, otherwise set dst_reg=0 and move on.

This will catch NULL, valid or invalid userspace pointers. Only bad
kernel pointer will be handled by BPF exception table.

[Alexei suggested for x86]
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---

Changes in v4:
* Used IS_ENABLED() instead of #ifdef.
* Dropped the else case that is not applicable for PPC64.


 arch/powerpc/net/bpf_jit_comp64.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
index ede8cb3e453f..472d4a551945 100644
--- a/arch/powerpc/net/bpf_jit_comp64.c
+++ b/arch/powerpc/net/bpf_jit_comp64.c
@@ -789,6 +789,32 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
 		/* dst = *(u64 *)(ul) (src + off) */
 		case BPF_LDX | BPF_MEM | BPF_DW:
 		case BPF_LDX | BPF_PROBE_MEM | BPF_DW:
+			/*
+			 * As PTR_TO_BTF_ID that uses BPF_PROBE_MEM mode could either be a valid
+			 * kernel pointer or NULL but not a userspace address, execute BPF_PROBE_MEM
+			 * load only if addr is kernel address (see is_kernel_addr()), otherwise
+			 * set dst_reg=0 and move on.
+			 */
+			if (BPF_MODE(code) == BPF_PROBE_MEM) {
+				EMIT(PPC_RAW_ADDI(b2p[TMP_REG_1], src_reg, off));
+				if (IS_ENABLED(CONFIG_PPC_BOOK3E_64))
+					PPC_LI64(b2p[TMP_REG_2], 0x8000000000000000ul);
+				else /* BOOK3S_64 */
+					PPC_LI64(b2p[TMP_REG_2], PAGE_OFFSET);
+				EMIT(PPC_RAW_CMPLD(b2p[TMP_REG_1], b2p[TMP_REG_2]));
+				PPC_BCC(COND_GT, (ctx->idx + 4) * 4);
+				EMIT(PPC_RAW_LI(dst_reg, 0));
+				/*
+				 * Check if 'off' is word aligned because PPC_BPF_LL()
+				 * (BPF_DW case) generates two instructions if 'off' is not
+				 * word-aligned and one instruction otherwise.
+				 */
+				if (BPF_SIZE(code) == BPF_DW && (off & 3))
+					PPC_JMP((ctx->idx + 3) * 4);
+				else
+					PPC_JMP((ctx->idx + 2) * 4);
+			}
+
 			switch (size) {
 			case BPF_B:
 				EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
-- 
2.31.1


^ permalink raw reply related

* [RESEND PATCH v4 4/8] powerpc/ppc-opcode: introduce PPC_RAW_BRANCH() macro
From: Hari Bathini @ 2021-10-12 12:30 UTC (permalink / raw)
  To: naveen.n.rao, christophe.leroy, mpe, ast, daniel
  Cc: songliubraving, netdev, john.fastabend, andrii, kpsingh, paulus,
	yhs, bpf, linuxppc-dev, kafai, Hari Bathini
In-Reply-To: <20211012123056.485795-1-hbathini@linux.ibm.com>

Define and use PPC_RAW_BRANCH() macro instead of open coding it. This
macro is used while adding BPF_PROBE_MEM support.

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---

* No changes in v4.


 arch/powerpc/include/asm/ppc-opcode.h | 2 ++
 arch/powerpc/net/bpf_jit.h            | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index baea657bc868..f50213e2a3e0 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -566,6 +566,8 @@
 #define PPC_RAW_MTSPR(spr, d)		(0x7c0003a6 | ___PPC_RS(d) | __PPC_SPR(spr))
 #define PPC_RAW_EIEIO()			(0x7c0006ac)
 
+#define PPC_RAW_BRANCH(addr)		(PPC_INST_BRANCH | ((addr) & 0x03fffffc))
+
 /* Deal with instructions that older assemblers aren't aware of */
 #define	PPC_BCCTR_FLUSH		stringify_in_c(.long PPC_INST_BCCTR_FLUSH)
 #define	PPC_CP_ABORT		stringify_in_c(.long PPC_RAW_CP_ABORT)
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index 7145b651fc2a..6a945f6211f4 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -31,7 +31,7 @@
 			pr_err_ratelimited("Branch offset 0x%lx (@%u) out of range\n", offset, ctx->idx);			\
 			return -ERANGE;					      \
 		}							      \
-		EMIT(PPC_INST_BRANCH | (offset & 0x03fffffc));		      \
+		EMIT(PPC_RAW_BRANCH(offset));				      \
 	} while (0)
 
 /* blr; (unconditional 'branch' with link) to absolute address */
-- 
2.31.1


^ permalink raw reply related

* [RESEND PATCH v4 7/8] bpf ppc32: Add BPF_PROBE_MEM support for JIT
From: Hari Bathini @ 2021-10-12 12:30 UTC (permalink / raw)
  To: naveen.n.rao, christophe.leroy, mpe, ast, daniel
  Cc: songliubraving, netdev, john.fastabend, andrii, kpsingh, paulus,
	yhs, bpf, linuxppc-dev, kafai, Hari Bathini
In-Reply-To: <20211012123056.485795-1-hbathini@linux.ibm.com>

BPF load instruction with BPF_PROBE_MEM mode can cause a fault
inside kernel. Append exception table for such instructions
within BPF program.

Unlike other archs which uses extable 'fixup' field to pass dest_reg
and nip, BPF exception table on PowerPC follows the generic PowerPC
exception table design, where it populates both fixup and extable
sections within BPF program. fixup section contains 3 instructions,
first 2 instructions clear dest_reg (lower & higher 32-bit registers)
and last instruction jumps to next instruction in the BPF code.
extable 'insn' field contains relative offset of the instruction and
'fixup' field contains relative offset of the fixup entry. Example
layout of BPF program with extable present:

             +------------------+
             |                  |
             |                  |
   0x4020 -->| lwz   r28,4(r4)  |
             |                  |
             |                  |
   0x40ac -->| lwz  r3,0(r24)   |
             | lwz  r4,4(r24)   |
             |                  |
             |                  |
             |------------------|
   0x4278 -->| li  r28,0        |  \
             | li  r27,0        |  | fixup entry
             | b   0x4024       |  /
   0x4284 -->| li  r4,0         |
             | li  r3,0         |
             | b   0x40b4       |
             |------------------|
   0x4290 -->| insn=0xfffffd90  |  \ extable entry
             | fixup=0xffffffe4 |  /
   0x4298 -->| insn=0xfffffe14  |
             | fixup=0xffffffe8 |
             +------------------+

   (Addresses shown here are chosen random, not real)

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---

Changes in v4:
* Dropped explicit fallthrough statement for empty switch cases.


 arch/powerpc/net/bpf_jit.h        |  4 ++++
 arch/powerpc/net/bpf_jit_comp.c   |  2 ++
 arch/powerpc/net/bpf_jit_comp32.c | 30 ++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+)

diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index 444c9debce91..b20a2a83a6e7 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -153,7 +153,11 @@ struct codegen_context {
 	unsigned int exentry_idx;
 };
 
+#ifdef CONFIG_PPC32
+#define BPF_FIXUP_LEN	3 /* Three instructions => 12 bytes */
+#else
 #define BPF_FIXUP_LEN	2 /* Two instructions => 8 bytes */
+#endif
 
 static inline void bpf_flush_icache(void *start, void *end)
 {
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index f02457c6b54f..1a0041997050 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -297,6 +297,8 @@ int bpf_add_extable_entry(struct bpf_prog *fp, u32 *image, int pass, struct code
 		(ctx->exentry_idx * BPF_FIXUP_LEN * 4);
 
 	fixup[0] = PPC_RAW_LI(dst_reg, 0);
+	if (IS_ENABLED(CONFIG_PPC32))
+		fixup[1] = PPC_RAW_LI(dst_reg - 1, 0); /* clear higher 32-bit register too */
 
 	fixup[BPF_FIXUP_LEN - 1] =
 		PPC_RAW_BRANCH((long)(pc + jmp_off) - (long)&fixup[BPF_FIXUP_LEN - 1]);
diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c
index 54e7cef3e1f2..5dc45e393d1d 100644
--- a/arch/powerpc/net/bpf_jit_comp32.c
+++ b/arch/powerpc/net/bpf_jit_comp32.c
@@ -813,9 +813,13 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
 		 * BPF_LDX
 		 */
 		case BPF_LDX | BPF_MEM | BPF_B: /* dst = *(u8 *)(ul) (src + off) */
+		case BPF_LDX | BPF_PROBE_MEM | BPF_B:
 		case BPF_LDX | BPF_MEM | BPF_H: /* dst = *(u16 *)(ul) (src + off) */
+		case BPF_LDX | BPF_PROBE_MEM | BPF_H:
 		case BPF_LDX | BPF_MEM | BPF_W: /* dst = *(u32 *)(ul) (src + off) */
+		case BPF_LDX | BPF_PROBE_MEM | BPF_W:
 		case BPF_LDX | BPF_MEM | BPF_DW: /* dst = *(u64 *)(ul) (src + off) */
+		case BPF_LDX | BPF_PROBE_MEM | BPF_DW:
 			switch (size) {
 			case BPF_B:
 				EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
@@ -834,6 +838,32 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
 
 			if (size != BPF_DW && !fp->aux->verifier_zext)
 				EMIT(PPC_RAW_LI(dst_reg_h, 0));
+
+			if (BPF_MODE(code) == BPF_PROBE_MEM) {
+				int insn_idx = ctx->idx - 1;
+				int jmp_off = 4;
+
+				/*
+				 * In case of BPF_DW, two lwz instructions are emitted, one
+				 * for higher 32-bit and another for lower 32-bit. So, set
+				 * ex->insn to the first of the two and jump over both
+				 * instructions in fixup.
+				 *
+				 * Similarly, with !verifier_zext, two instructions are
+				 * emitted for BPF_B/H/W case. So, set ex->insn to the
+				 * instruction that could fault and skip over both
+				 * instructions.
+				 */
+				if (size == BPF_DW || !fp->aux->verifier_zext) {
+					insn_idx -= 1;
+					jmp_off += 4;
+				}
+
+				ret = bpf_add_extable_entry(fp, image, pass, ctx, insn_idx,
+							    jmp_off, dst_reg);
+				if (ret)
+					return ret;
+			}
 			break;
 
 		/*
-- 
2.31.1


^ permalink raw reply related

* [RESEND PATCH v4 8/8] bpf ppc32: Access only if addr is kernel address
From: Hari Bathini @ 2021-10-12 12:30 UTC (permalink / raw)
  To: naveen.n.rao, christophe.leroy, mpe, ast, daniel
  Cc: songliubraving, netdev, john.fastabend, andrii, kpsingh, paulus,
	yhs, bpf, linuxppc-dev, kafai, Hari Bathini
In-Reply-To: <20211012123056.485795-1-hbathini@linux.ibm.com>

With KUAP enabled, any kernel code which wants to access userspace
needs to be surrounded by disable-enable KUAP. But that is not
happening for BPF_PROBE_MEM load instruction. Though PPC32 does not
support read protection, considering the fact that PTR_TO_BTF_ID
(which uses BPF_PROBE_MEM mode) could either be a valid kernel pointer
or NULL but should never be a pointer to userspace address, execute
BPF_PROBE_MEM load only if addr is kernel address, otherwise set
dst_reg=0 and move on.

This will catch NULL, valid or invalid userspace pointers. Only bad
kernel pointer will be handled by BPF exception table.

[Alexei suggested for x86]
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---

Changes in v4:
* Adjusted the emit code to avoid using temporary reg.


 arch/powerpc/net/bpf_jit_comp32.c | 34 +++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c
index 5dc45e393d1d..d3a52cd42f53 100644
--- a/arch/powerpc/net/bpf_jit_comp32.c
+++ b/arch/powerpc/net/bpf_jit_comp32.c
@@ -820,6 +820,40 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context *
 		case BPF_LDX | BPF_PROBE_MEM | BPF_W:
 		case BPF_LDX | BPF_MEM | BPF_DW: /* dst = *(u64 *)(ul) (src + off) */
 		case BPF_LDX | BPF_PROBE_MEM | BPF_DW:
+			/*
+			 * As PTR_TO_BTF_ID that uses BPF_PROBE_MEM mode could either be a valid
+			 * kernel pointer or NULL but not a userspace address, execute BPF_PROBE_MEM
+			 * load only if addr is kernel address (see is_kernel_addr()), otherwise
+			 * set dst_reg=0 and move on.
+			 */
+			if (BPF_MODE(code) == BPF_PROBE_MEM) {
+				PPC_LI32(_R0, TASK_SIZE - off);
+				EMIT(PPC_RAW_CMPLW(src_reg, _R0));
+				PPC_BCC(COND_GT, (ctx->idx + 5) * 4);
+				EMIT(PPC_RAW_LI(dst_reg, 0));
+				/*
+				 * For BPF_DW case, "li reg_h,0" would be needed when
+				 * !fp->aux->verifier_zext. Emit NOP otherwise.
+				 *
+				 * Note that "li reg_h,0" is emitted for BPF_B/H/W case,
+				 * if necessary. So, jump there insted of emitting an
+				 * additional "li reg_h,0" instruction.
+				 */
+				if (size == BPF_DW && !fp->aux->verifier_zext)
+					EMIT(PPC_RAW_LI(dst_reg_h, 0));
+				else
+					EMIT(PPC_RAW_NOP());
+				/*
+				 * Need to jump two instructions instead of one for BPF_DW case
+				 * as there are two load instructions for dst_reg_h & dst_reg
+				 * respectively.
+				 */
+				if (size == BPF_DW)
+					PPC_JMP((ctx->idx + 3) * 4);
+				else
+					PPC_JMP((ctx->idx + 2) * 4);
+			}
+
 			switch (size) {
 			case BPF_B:
 				EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
-- 
2.31.1


^ permalink raw reply related

* Re: [PATCH 1/2] ftrace: disable preemption on the testing of recursion
From: Miroslav Benes @ 2021-10-12 12:24 UTC (permalink / raw)
  To: 王贇
  Cc: Peter Zijlstra (Intel), Paul Walmsley, James E.J. Bottomley,
	Guo Ren, Jisheng Zhang, H. Peter Anvin, live-patching,
	linux-riscv, Paul Mackerras, Joe Lawrence, Helge Deller, x86,
	linux-csky, Ingo Molnar, Petr Mladek, Albert Ou, Jiri Kosina,
	Steven Rostedt, Borislav Petkov, Nicholas Piggin, Josh Poimboeuf,
	Thomas Gleixner, linux-parisc, linux-kernel, Palmer Dabbelt,
	Masami Hiramatsu, Colin Ian King, linuxppc-dev
In-Reply-To: <a8756482-024c-c858-b3d1-1ffa9a5eb3f7@linux.alibaba.com>

> diff --git a/include/linux/trace_recursion.h b/include/linux/trace_recursion.h
> index a9f9c57..805f9c4 100644
> --- a/include/linux/trace_recursion.h
> +++ b/include/linux/trace_recursion.h
> @@ -214,7 +214,14 @@ static __always_inline void trace_clear_recursion(int bit)
>  static __always_inline int ftrace_test_recursion_trylock(unsigned long ip,
>  							 unsigned long parent_ip)
>  {
> -	return trace_test_and_set_recursion(ip, parent_ip, TRACE_FTRACE_START, TRACE_FTRACE_MAX);
> +	int bit;
> +
> +	preempt_disable_notrace();
> +	bit = trace_test_and_set_recursion(ip, parent_ip, TRACE_FTRACE_START, TRACE_FTRACE_MAX);
> +	if (bit < 0)
> +		preempt_enable_notrace();
> +
> +	return bit;
>  }
> 
>  /**
> @@ -226,6 +233,7 @@ static __always_inline int ftrace_test_recursion_trylock(unsigned long ip,
>  static __always_inline void ftrace_test_recursion_unlock(int bit)
>  {
>  	trace_clear_recursion(bit);
> +	preempt_enable_notrace();
>  }
> 
>  #endif /* CONFIG_TRACING */
> diff --git a/kernel/livepatch/patch.c b/kernel/livepatch/patch.c
> index e8029ae..6e66ccd 100644
> --- a/kernel/livepatch/patch.c
> +++ b/kernel/livepatch/patch.c
> @@ -52,11 +52,6 @@ static void notrace klp_ftrace_handler(unsigned long ip,
>  	bit = ftrace_test_recursion_trylock(ip, parent_ip);
>  	if (WARN_ON_ONCE(bit < 0))
>  		return;
> -	/*
> -	 * A variant of synchronize_rcu() is used to allow patching functions
> -	 * where RCU is not watching, see klp_synchronize_transition().
> -	 */
> -	preempt_disable_notrace();
> 
>  	func = list_first_or_null_rcu(&ops->func_stack, struct klp_func,
>  				      stack_node);
> @@ -120,7 +115,6 @@ static void notrace klp_ftrace_handler(unsigned long ip,
>  	klp_arch_set_pc(fregs, (unsigned long)func->new_func);
> 
>  unlock:
> -	preempt_enable_notrace();
>  	ftrace_test_recursion_unlock(bit);
>  }

I don't like this change much. We have preempt_disable there not because 
of ftrace_test_recursion, but because of RCU. ftrace_test_recursion was 
added later. Yes, it would work with the change, but it would also hide 
things which should not be hidden in my opinion.

Miroslav

^ permalink raw reply

* [RESEND PATCH v4 0/8] bpf powerpc: Add BPF_PROBE_MEM support in powerpc JIT compiler
From: Hari Bathini @ 2021-10-12 12:30 UTC (permalink / raw)
  To: naveen.n.rao, christophe.leroy, mpe, ast, daniel
  Cc: songliubraving, netdev, john.fastabend, andrii, kpsingh, paulus,
	yhs, bpf, linuxppc-dev, kafai, Hari Bathini

Patch #1 & #2 are simple cleanup patches. Patch #3 refactors JIT
compiler code with the aim to simplify adding BPF_PROBE_MEM support.
Patch #4 introduces PPC_RAW_BRANCH() macro instead of open coding
branch instruction. Patch #5 & #7 add BPF_PROBE_MEM support for PPC64
& PPC32 JIT compilers respectively. Patch #6 & #8 handle bad userspace
pointers for PPC64 & PPC32 cases respectively.


Resending v4 after rebasing the series on top of bpf fix patches
posted by Naveen:

  - https://patchwork.ozlabs.org/project/linuxppc-dev/cover/cover.1633464148.git.naveen.n.rao@linux.vnet.ibm.com/
    ("[v2,00/10] powerpc/bpf: Various fixes")

Also, added Reviewed-by tag from Christophe for patches #3, #5, #6, #7 & #8.


Hari Bathini (4):
  bpf powerpc: refactor JIT compiler code
  powerpc/ppc-opcode: introduce PPC_RAW_BRANCH() macro
  bpf ppc32: Add BPF_PROBE_MEM support for JIT
  bpf ppc32: Access only if addr is kernel address

Ravi Bangoria (4):
  bpf powerpc: Remove unused SEEN_STACK
  bpf powerpc: Remove extra_pass from bpf_jit_build_body()
  bpf ppc64: Add BPF_PROBE_MEM support for JIT
  bpf ppc64: Access only if addr is kernel address

 arch/powerpc/include/asm/ppc-opcode.h |   2 +
 arch/powerpc/net/bpf_jit.h            |  17 ++++-
 arch/powerpc/net/bpf_jit_comp.c       |  68 +++++++++++++++--
 arch/powerpc/net/bpf_jit_comp32.c     | 101 ++++++++++++++++++++++----
 arch/powerpc/net/bpf_jit_comp64.c     |  72 ++++++++++++++----
 5 files changed, 219 insertions(+), 41 deletions(-)

-- 
2.31.1


^ permalink raw reply

* Re: [PATCH 1/2] ftrace: disable preemption on the testing of recursion
From: Steven Rostedt @ 2021-10-12 12:43 UTC (permalink / raw)
  To: 王贇
  Cc: Peter Zijlstra (Intel), Paul Walmsley, James E.J. Bottomley,
	Guo Ren, Jisheng Zhang, H. Peter Anvin, live-patching,
	linux-riscv, Miroslav Benes, Paul Mackerras, Joe Lawrence,
	Helge Deller, x86, linux-csky, Ingo Molnar, Petr Mladek,
	Albert Ou, Jiri Kosina, Nicholas Piggin, Borislav Petkov,
	Josh Poimboeuf, Thomas Gleixner, linux-parisc, linux-kernel,
	Palmer Dabbelt, Masami Hiramatsu, Colin Ian King, linuxppc-dev
In-Reply-To: <a8756482-024c-c858-b3d1-1ffa9a5eb3f7@linux.alibaba.com>

On Tue, 12 Oct 2021 13:40:08 +0800
王贇 <yun.wang@linux.alibaba.com> wrote:

> --- a/include/linux/trace_recursion.h
> +++ b/include/linux/trace_recursion.h
> @@ -214,7 +214,14 @@ static __always_inline void trace_clear_recursion(int bit)
>  static __always_inline int ftrace_test_recursion_trylock(unsigned long ip,
>  							 unsigned long parent_ip)
>  {
> -	return trace_test_and_set_recursion(ip, parent_ip, TRACE_FTRACE_START, TRACE_FTRACE_MAX);
> +	int bit;
> +
> +	preempt_disable_notrace();

The recursion test does not require preemption disabled, it uses the task
struct, not per_cpu variables, so you should not disable it before the test.

	bit = trace_test_and_set_recursion(ip, parent_ip, TRACE_FTRACE_START, TRACE_FTRACE_MAX);
	if (bit >= 0)
		preempt_disable_notrace();

And if the bit is zero, it means a recursion check was already done by
another caller (ftrace handler does the check, followed by calling perf),
and you really don't even need to disable preemption in that case.

	if (bit > 0)
		preempt_disable_notrace();

And on the unlock, have:

 static __always_inline void ftrace_test_recursion_unlock(int bit)
 {
	if (bit)
		preempt_enable_notrace();
 	trace_clear_recursion(bit);
 }

But maybe that's over optimizing ;-)

-- Steve


> +	bit = trace_test_and_set_recursion(ip, parent_ip, TRACE_FTRACE_START, TRACE_FTRACE_MAX);
> +	if (bit < 0)
> +		preempt_enable_notrace();
> +
> +	return bit;
>  }


^ permalink raw reply

* [RESEND PATCH v4 1/8] bpf powerpc: Remove unused SEEN_STACK
From: Hari Bathini @ 2021-10-12 12:30 UTC (permalink / raw)
  To: naveen.n.rao, christophe.leroy, mpe, ast, daniel
  Cc: Ravi Bangoria, songliubraving, netdev, john.fastabend, andrii,
	kpsingh, paulus, yhs, bpf, linuxppc-dev, kafai
In-Reply-To: <20211012123056.485795-1-hbathini@linux.ibm.com>

From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>

SEEN_STACK is unused on PowerPC. Remove it. Also, have
SEEN_TAILCALL use 0x40000000.

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---

* No changes in v4.


 arch/powerpc/net/bpf_jit.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index 7e9b978b768e..89bd744c2bff 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -125,8 +125,7 @@
 #define COND_LE		(CR0_GT | COND_CMP_FALSE)
 
 #define SEEN_FUNC	0x20000000 /* might call external helpers */
-#define SEEN_STACK	0x40000000 /* uses BPF stack */
-#define SEEN_TAILCALL	0x80000000 /* uses tail calls */
+#define SEEN_TAILCALL	0x40000000 /* uses tail calls */
 
 #define SEEN_VREG_MASK	0x1ff80000 /* Volatile registers r3-r12 */
 #define SEEN_NVREG_MASK	0x0003ffff /* Non volatile registers r14-r31 */
-- 
2.31.1


^ permalink raw reply related

* Re: linux-next: build warnings in Linus' tree
From: Arnd Bergmann @ 2021-10-12 14:39 UTC (permalink / raw)
  To: Rob Herring
  Cc: Stephen Rothwell, Arnd Bergmann, Linux Kernel Mailing List,
	Linux Next Mailing List, Anatolij Gustschin, PowerPC
In-Reply-To: <CAL_JsqJE_GHnehBz-71BOGXfjm6q2p0u6FQA5KwO8zK_i1LpMQ@mail.gmail.com>

On Mon, Oct 11, 2021 at 10:42 PM Rob Herring <robh+dt@kernel.org> wrote:
> On Sun, Oct 10, 2021 at 4:27 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> FYI, u-boot removed mpc5xxx support in 2017, so maybe there's
> similarly not a need to keep them in the kernel? It does appear NXP
> will still sell you the parts though the last BSP was 2009.

Specifically, MPC5200B has a 15 year lifetime, which ends in
11 months from now. The original bplan/Genesi Efika 5K2 was
quite popular at the time it came out, and there are probably
still some of those hanging around, but they came with Open
Firmware rather than relying on the dts files that ship with the
kernel.

Grant Likely was the original maintainer for MPC52xx until 2011,
Anatolij Gustschin is still listed as maintainer since then but hasn't
been active in it for a while either. Anatolij can probably best judge
which of these boards are still in going to be used with future kernels,
but I suspect once you start removing bits from 52xx, the newer
but less common 512x platform can go away as well.

         Arnd

^ permalink raw reply

* Re: [PATCH] tpm: ibmvtpm: Make use of dma_alloc_coherent()
From: Jarkko Sakkinen @ 2021-10-12 15:29 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: linux-kernel, Jason Gunthorpe, Paul Mackerras, Peter Huewe,
	linuxppc-dev, linux-integrity
In-Reply-To: <20211010160147.590-1-caihuoqing@baidu.com>

On Mon, 2021-10-11 at 00:01 +0800, Cai Huoqing wrote:
> Replacing kmalloc/kfree/get_zeroed_page/free_page/dma_map_single/
  ~~~~~~~~~
  Replace

> dma_unmap_single() with dma_alloc_coherent/dma_free_coherent()
> helps to reduce code size, and simplify the code, and coherent
> DMA will not clear the cache every time.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>

If this does not do functionally anything useful, there's no
reason to apply this.

It is also missing information why the substitution is possible.

Field tested code is better than clean code, i.e. we don not
risk at having possible new regressions just for a bit nicer
layout...

/Jarkko



^ permalink raw reply

* [RFC PATCH] powerpc: dts: Remove MPC5xxx platforms
From: Rob Herring @ 2021-10-12 15:34 UTC (permalink / raw)
  To: Michael Ellerman, Anatolij Gustschin
  Cc: devicetree, Arnd Bergmann, Stephen Rothwell, linux-kernel,
	Paul Mackerras, linuxppc-dev

The mpc5xxx platforms have had dts warnings for some time which no one
seems to care to fix, so let's just remove the dts files.

According to Arnd:
"Specifically, MPC5200B has a 15 year lifetime, which ends in
11 months from now. The original bplan/Genesi Efika 5K2 was
quite popular at the time it came out, and there are probably
still some of those hanging around, but they came with Open
Firmware rather than relying on the dts files that ship with the
kernel.

Grant Likely was the original maintainer for MPC52xx until 2011,
Anatolij Gustschin is still listed as maintainer since then but hasn't
been active in it for a while either. Anatolij can probably best judge
which of these boards are still in going to be used with future kernels,
but I suspect once you start removing bits from 52xx, the newer
but less common 512x platform can go away as well."

Cc: Anatolij Gustschin <agust@denx.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
Sending this out as a feeler to see if anyone cares. If anyone does, 
please fix the warnings.

 arch/powerpc/boot/Makefile           |   5 -
 arch/powerpc/boot/dts/a3m071.dts     | 138 -------
 arch/powerpc/boot/dts/a4m072.dts     | 147 --------
 arch/powerpc/boot/dts/ac14xx.dts     | 395 --------------------
 arch/powerpc/boot/dts/cm5200.dts     |  85 -----
 arch/powerpc/boot/dts/lite5200b.dts  | 157 --------
 arch/powerpc/boot/dts/media5200.dts  | 142 --------
 arch/powerpc/boot/dts/motionpro.dts  | 132 -------
 arch/powerpc/boot/dts/mpc5121.dtsi   | 526 ---------------------------
 arch/powerpc/boot/dts/mpc5121ads.dts | 174 ---------
 arch/powerpc/boot/dts/mpc5125twr.dts | 293 ---------------
 arch/powerpc/boot/dts/mpc5200b.dtsi  | 288 ---------------
 arch/powerpc/boot/dts/mucmc52.dts    | 222 -----------
 arch/powerpc/boot/dts/o2d.dts        |  43 ---
 arch/powerpc/boot/dts/o2d.dtsi       | 118 ------
 arch/powerpc/boot/dts/o2d300.dts     |  48 ---
 arch/powerpc/boot/dts/o2dnt2.dts     |  44 ---
 arch/powerpc/boot/dts/o2i.dts        |  29 --
 arch/powerpc/boot/dts/o2mnt.dts      |  29 --
 arch/powerpc/boot/dts/o3dnt.dts      |  44 ---
 arch/powerpc/boot/dts/pcm030.dts     | 106 ------
 arch/powerpc/boot/dts/pcm032.dts     | 183 ----------
 arch/powerpc/boot/dts/pdm360ng.dts   | 195 ----------
 arch/powerpc/boot/dts/uc101.dts      | 152 --------
 24 files changed, 3695 deletions(-)
 delete mode 100644 arch/powerpc/boot/dts/a3m071.dts
 delete mode 100644 arch/powerpc/boot/dts/a4m072.dts
 delete mode 100644 arch/powerpc/boot/dts/ac14xx.dts
 delete mode 100644 arch/powerpc/boot/dts/cm5200.dts
 delete mode 100644 arch/powerpc/boot/dts/lite5200b.dts
 delete mode 100644 arch/powerpc/boot/dts/media5200.dts
 delete mode 100644 arch/powerpc/boot/dts/motionpro.dts
 delete mode 100644 arch/powerpc/boot/dts/mpc5121.dtsi
 delete mode 100644 arch/powerpc/boot/dts/mpc5121ads.dts
 delete mode 100644 arch/powerpc/boot/dts/mpc5125twr.dts
 delete mode 100644 arch/powerpc/boot/dts/mpc5200b.dtsi
 delete mode 100644 arch/powerpc/boot/dts/mucmc52.dts
 delete mode 100644 arch/powerpc/boot/dts/o2d.dts
 delete mode 100644 arch/powerpc/boot/dts/o2d.dtsi
 delete mode 100644 arch/powerpc/boot/dts/o2d300.dts
 delete mode 100644 arch/powerpc/boot/dts/o2dnt2.dts
 delete mode 100644 arch/powerpc/boot/dts/o2i.dts
 delete mode 100644 arch/powerpc/boot/dts/o2mnt.dts
 delete mode 100644 arch/powerpc/boot/dts/o3dnt.dts
 delete mode 100644 arch/powerpc/boot/dts/pcm030.dts
 delete mode 100644 arch/powerpc/boot/dts/pcm032.dts
 delete mode 100644 arch/powerpc/boot/dts/pdm360ng.dts
 delete mode 100644 arch/powerpc/boot/dts/uc101.dts

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 6900d0ac2421..15ee0c2c6a3e 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -308,11 +308,6 @@ image-$(CONFIG_PPC_EP88XC)		+= dtbImage.ep88xc
 image-$(CONFIG_PPC_ADDER875)		+= cuImage.adder875-uboot \
 					   dtbImage.adder875-redboot
 
-# Board ports in arch/powerpc/platform/52xx/Kconfig
-image-$(CONFIG_PPC_LITE5200)		+= cuImage.lite5200
-image-$(CONFIG_PPC_LITE5200)		+= cuImage.lite5200b
-image-$(CONFIG_PPC_MEDIA5200)		+= cuImage.media5200
-
 # Board ports in arch/powerpc/platform/82xx/Kconfig
 image-$(CONFIG_MPC8272_ADS)		+= cuImage.mpc8272ads
 image-$(CONFIG_PQ2FADS)			+= cuImage.pq2fads
diff --git a/arch/powerpc/boot/dts/a3m071.dts b/arch/powerpc/boot/dts/a3m071.dts
deleted file mode 100644
index 034cfd8aa95b..000000000000
--- a/arch/powerpc/boot/dts/a3m071.dts
+++ /dev/null
@@ -1,138 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * a3m071 board Device Tree Source
- *
- * Copyright 2012 Stefan Roese <sr@denx.de>
- *
- * Copyright (C) 2011 DENX Software Engineering GmbH
- * Heiko Schocher <hs@denx.de>
- *
- * Copyright (C) 2007 Semihalf
- * Marian Balakowicz <m8@semihalf.com>
- */
-
-/include/ "mpc5200b.dtsi"
-
-&gpt0 { fsl,has-wdt; };
-
-/ {
-	model = "anonymous,a3m071";
-	compatible = "anonymous,a3m071";
-
-	soc5200@f0000000 {
-		#address-cells = <1>;
-		#size-cells = <1>;
-		compatible = "fsl,mpc5200b-immr";
-		ranges = <0 0xf0000000 0x0000c000>;
-		reg = <0xf0000000 0x00000100>;
-		bus-frequency = <0>; /* From boot loader */
-		system-frequency = <0>; /* From boot loader */
-
-		spi@f00 {
-			status = "disabled";
-		};
-
-		usb: usb@1000 {
-			status = "disabled";
-		};
-
-		psc@2000 {
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-			reg = <0x2000 0x100>;
-			interrupts = <2 1 0>;
-		};
-
-		psc@2200 {
-			status = "disabled";
-		};
-
-		psc@2400 {
-			status = "disabled";
-		};
-
-		psc@2600 {
-			status = "disabled";
-		};
-
-		psc@2800 {
-			status = "disabled";
-		};
-
-		psc@2c00 {		// PSC6
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-			reg = <0x2c00 0x100>;
-			interrupts = <2 4 0>;
-		};
-
-		ethernet@3000 {
-			phy-handle = <&phy0>;
-		};
-
-		mdio@3000 {
-			phy0: ethernet-phy@3 {
-				reg = <0x03>;
-			};
-		};
-
-		ata@3a00 {
-			status = "disabled";
-		};
-
-		i2c@3d00 {
-			status = "disabled";
-		};
-
-		i2c@3d40 {
-			status = "disabled";
-		};
-	};
-
-	localbus {
-		compatible = "fsl,mpc5200b-lpb","simple-bus";
-		#address-cells = <2>;
-		#size-cells = <1>;
-		ranges = <0 0 0xfc000000 0x02000000
-			  3 0 0xe9000000 0x00080000
-			  5 0 0xe8000000 0x00010000>;
-
-		flash@0,0 {
-			#address-cells = <1>;
-			#size-cells = <1>;
-			reg = <0 0x0 0x02000000>;
-			compatible = "cfi-flash";
-			bank-width = <2>;
-			partition@0 {
-				label = "u-boot";
-				reg = <0x00000000 0x00040000>;
-				read-only;
-			};
-			partition@40000 {
-				label = "env";
-				reg = <0x00040000 0x00020000>;
-			};
-			partition@60000 {
-				label = "dtb";
-				reg = <0x00060000 0x00020000>;
-			};
-			partition@80000 {
-				label = "kernel";
-				reg = <0x00080000 0x00500000>;
-			};
-			partition@580000 {
-				label = "root";
-				reg = <0x00580000 0x00A80000>;
-			};
-		};
-
-		fpga@3,0 {
-			compatible = "anonymous,a3m071-fpga";
-			reg = <3 0x0 0x00080000
-			       5 0x0 0x00010000>;
-			interrupts = <0 0 3>;  /* level low */
-		};
-	};
-
-	pci@f0000d00 {
-		status = "disabled";
-	};
-};
diff --git a/arch/powerpc/boot/dts/a4m072.dts b/arch/powerpc/boot/dts/a4m072.dts
deleted file mode 100644
index a9cef5726422..000000000000
--- a/arch/powerpc/boot/dts/a4m072.dts
+++ /dev/null
@@ -1,147 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * a4m072 board Device Tree Source
- *
- * Copyright (C) 2011 DENX Software Engineering GmbH
- * Heiko Schocher <hs@denx.de>
- *
- * Copyright (C) 2007 Semihalf
- * Marian Balakowicz <m8@semihalf.com>
- */
-
-/include/ "mpc5200b.dtsi"
-
-&gpt0 { fsl,has-wdt; };
-&gpt3 { gpio-controller; };
-&gpt4 { gpio-controller; };
-&gpt5 { gpio-controller; };
-
-/ {
-	model = "anonymous,a4m072";
-	compatible = "anonymous,a4m072";
-
-	soc5200@f0000000 {
-		#address-cells = <1>;
-		#size-cells = <1>;
-		compatible = "fsl,mpc5200b-immr";
-		ranges = <0 0xf0000000 0x0000c000>;
-		reg = <0xf0000000 0x00000100>;
-		bus-frequency = <0>; /* From boot loader */
-		system-frequency = <0>; /* From boot loader */
-
-		cdm@200 {
-			fsl,init-ext-48mhz-en = <0x0>;
-			fsl,init-fd-enable = <0x01>;
-			fsl,init-fd-counters = <0x3333>;
-		};
-
-		spi@f00 {
-			status = "disabled";
-		};
-
-		psc@2000 {
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-			reg = <0x2000 0x100>;
-			interrupts = <2 1 0>;
-		};
-
-		psc@2200 {
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-			reg = <0x2200 0x100>;
-			interrupts = <2 2 0>;
-		};
-
-		psc@2400 {
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-			reg = <0x2400 0x100>;
-			interrupts = <2 3 0>;
-		};
-
-		psc@2600 {
-			status = "disabled";
-		};
-
-		psc@2800 {
-			status = "disabled";
-		};
-
-		psc@2c00 {
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-			reg = <0x2c00 0x100>;
-			interrupts = <2 4 0>;
-		};
-
-		ethernet@3000 {
-			phy-handle = <&phy0>;
-		};
-
-		mdio@3000 {
-			phy0: ethernet-phy@1f {
-				reg = <0x1f>;
-				interrupts = <1 2 0>; /* IRQ 2 active low */
-			};
-		};
-
-		i2c@3d00 {
-			status = "disabled";
-		};
-
-		i2c@3d40 {
-			hwmon@2e {
-				compatible = "nsc,lm87";
-				reg = <0x2e>;
-			};
-			rtc@51 {
-				compatible = "nxp,rtc8564";
-				reg = <0x51>;
-			};
-		};
-	};
-
-	localbus {
-		compatible = "fsl,mpc5200b-lpb","simple-bus";
-		#address-cells = <2>;
-		#size-cells = <1>;
-		ranges = <0 0 0xfe000000 0x02000000
-			  1 0 0x62000000 0x00400000
-			  2 0 0x64000000 0x00200000
-			  3 0 0x66000000 0x01000000
-			  6 0 0x68000000 0x01000000
-			  7 0 0x6a000000 0x00000004>;
-
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0 0x02000000>;
-			bank-width = <2>;
-			#size-cells = <1>;
-			#address-cells = <1>;
-		};
-		sram0@1,0 {
-			compatible = "mtd-ram";
-			reg = <1 0x00000 0x00400000>;
-			bank-width = <2>;
-		};
-	};
-
-	pci@f0000d00 {
-		#interrupt-cells = <1>;
-		#size-cells = <2>;
-		#address-cells = <3>;
-		device_type = "pci";
-		compatible = "fsl,mpc5200-pci";
-		reg = <0xf0000d00 0x100>;
-		interrupt-map-mask = <0xf800 0 0 7>;
-		interrupt-map = <
-				 /* IDSEL 0x16 */
-				 0xc000 0 0 1 &mpc5200_pic 1 3 3
-				 0xc000 0 0 2 &mpc5200_pic 1 3 3
-				 0xc000 0 0 3 &mpc5200_pic 1 3 3
-				 0xc000 0 0 4 &mpc5200_pic 1 3 3>;
-		clock-frequency = <0>; /* From boot loader */
-		interrupts = <2 8 0 2 9 0 2 10 0>;
-		bus-range = <0 0>;
-		ranges = <0x42000000 0 0x80000000 0x80000000 0 0x10000000
-			  0x02000000 0 0x90000000 0x90000000 0 0x10000000
-			  0x01000000 0 0x00000000 0xa0000000 0 0x01000000>;
-	};
-};
diff --git a/arch/powerpc/boot/dts/ac14xx.dts b/arch/powerpc/boot/dts/ac14xx.dts
deleted file mode 100644
index 5d8877e1f4ad..000000000000
--- a/arch/powerpc/boot/dts/ac14xx.dts
+++ /dev/null
@@ -1,395 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Device Tree Source for the MPC5121e based ac14xx board
- *
- * Copyright 2012 Anatolij Gustschin <agust@denx.de>
- */
-
-
-#include "mpc5121.dtsi"
-
-/ {
-	model = "ac14xx";
-	compatible = "ifm,ac14xx", "fsl,mpc5121";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	aliases {
-		serial0 = &serial0;
-		serial1 = &serial7;
-		spi4 = &spi4;
-		spi5 = &spi5;
-	};
-
-	cpus {
-		PowerPC,5121@0 {
-			timebase-frequency = <40000000>;	/*  40 MHz (csb/4) */
-			bus-frequency = <160000000>;		/* 160 MHz csb bus */
-			clock-frequency = <400000000>;		/* 400 MHz ppc core */
-		};
-	};
-
-	memory {
-		reg = <0x00000000 0x10000000>;			/* 256MB at 0 */
-	};
-
-	nfc@40000000 {
-		status = "disabled";
-	};
-
-	localbus@80000020 {
-		ranges = <0x0 0x0 0xfc000000 0x04000000	/* CS0: NOR flash */
-			  0x1 0x0 0xe0000000 0x00010000 /* CS1: FRAM */
-			  0x2 0x0 0xe0100000 0x00080000 /* CS2: asi1 */
-			  0x3 0x0 0xe0300000 0x00020000 /* CS3: comm */
-			  0x5 0x0 0xe0400000 0x00010000 /* CS5: safety */
-			  0x6 0x0 0xe0200000 0x00080000>; /* CS6: asi2 */
-
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0x00000000 0x04000000>;
-			#address-cells = <1>;
-			#size-cells = <1>;
-			bank-width = <2>;
-			device-width = <2>;
-
-			partition@0 {
-				label = "dtb-kernel-production";
-				reg = <0x00000000 0x00400000>;
-			};
-			partition@1 {
-				label = "filesystem-production";
-				reg = <0x00400000 0x03400000>;
-			};
-
-			partition@2 {
-				label = "recovery";
-				reg = <0x03800000 0x00700000>;
-			};
-
-			partition@3 {
-				label = "uboot-code";
-				reg = <0x03f00000 0x00040000>;
-			};
-			partition@4 {
-				label = "uboot-env1";
-				reg = <0x03f40000 0x00020000>;
-			};
-			partition@5 {
-				label = "uboot-env2";
-				reg = <0x03f60000 0x00020000>;
-			};
-		};
-
-		fram@1,0 {
-			compatible = "ifm,ac14xx-fram", "linux,uio-pdrv-genirq";
-			reg = <1 0x00000000 0x00010000>;
-		};
-
-		asi@2,0 {
-			/* masters mapping: CS, CS offset, size */
-			reg = <2 0x00000000 0x00080000
-			       6 0x00000000 0x00080000>;
-			#address-cells = <1>;
-			#size-cells = <1>;
-			compatible = "ifm,ac14xx-asi-fpga";
-			gpios = <
-				&gpio_pic 26 0	/* prog */
-				&gpio_pic 27 0	/* done */
-				&gpio_pic 10 0	/* reset */
-				>;
-
-			master@1 {
-				interrupts = <20 0x2>;
-				interrupt-parent = <&gpio_pic>;
-				chipselect = <2 0x00009000 0x00009100>;
-				label = "AS-i master 1";
-			};
-
-			master@2 {
-				interrupts = <21 0x2>;
-				interrupt-parent = <&gpio_pic>;
-				chipselect = <6 0x00009000 0x00009100>;
-				label = "AS-i master 2";
-			};
-		};
-
-		netx@3,0 {
-			compatible = "ifm,netx";
-			reg = <0x3 0x00000000 0x00020000>;
-			chipselect = <3 0x00101140 0x00203100>;
-			interrupts = <17 0x8>;
-			gpios = <&gpio_pic 15 0>;
-		};
-
-		safety@5,0 {
-			compatible = "ifm,safety";
-			reg = <0x5 0x00000000 0x00010000>;
-			chipselect = <5 0x00009000 0x00009100>;
-			interrupts = <22 0x2>;
-			interrupt-parent = <&gpio_pic>;
-			gpios = <
-				&gpio_pic 12 0	/* prog */
-				&gpio_pic 11 0	/* done */
-				>;
-		};
-	};
-
-	clocks {
-		osc {
-			clock-frequency = <25000000>;
-		};
-	};
-
-	soc@80000000 {
-		bus-frequency = <80000000>;	/* 80 MHz ips bus */
-
-		clock@f00 {
-			compatible = "fsl,mpc5121rev2-clock", "fsl,mpc5121-clock";
-		};
-
-		/*
-		 * GPIO PIC:
-		 * interrupts cell = <pin nr, sense>
-		 * sense == 8: Level, low assertion
-		 * sense == 2: Edge, high-to-low change
-		 */
-		gpio_pic: gpio@1100 {
-			gpio-controller;
-			#gpio-cells = <2>;
-			interrupt-controller;
-			#interrupt-cells = <2>;
-		};
-
-		sdhc@1500 {
-			cd-gpios = <&gpio_pic 23 0>;	/* card detect */
-			wp-gpios = <&gpio_pic 24 0>;	/* write protect */
-			wp-inverted;			/* WP active high */
-		};
-
-		i2c@1700 {
-			/* use Fast-mode */
-			clock-frequency = <400000>;
-
-			at24@30 {
-				compatible = "atmel,24c01";
-				reg = <0x30>;
-			};
-
-			at24@31 {
-				compatible = "atmel,24c01";
-				reg = <0x31>;
-			};
-
-			temp@48 {
-				compatible = "ad,ad7414";
-				reg = <0x48>;
-			};
-
-			at24@50 {
-				compatible = "atmel,24c01";
-				reg = <0x50>;
-			};
-
-			at24@51 {
-				compatible = "atmel,24c01";
-				reg = <0x51>;
-			};
-
-			at24@52 {
-				compatible = "atmel,24c01";
-				reg = <0x52>;
-			};
-
-			at24@53 {
-				compatible = "atmel,24c01";
-				reg = <0x53>;
-			};
-
-			at24@54 {
-				compatible = "atmel,24c01";
-				reg = <0x54>;
-			};
-
-			at24@55 {
-				compatible = "atmel,24c01";
-				reg = <0x55>;
-			};
-
-			at24@56 {
-				compatible = "atmel,24c01";
-				reg = <0x56>;
-			};
-
-			at24@57 {
-				compatible = "atmel,24c01";
-				reg = <0x57>;
-			};
-
-			rtc@68 {
-				compatible = "st,m41t00";
-				reg = <0x68>;
-			};
-		};
-
-		axe_pic: axe-base@2000 {
-			compatible = "fsl,mpc5121-axe-base";
-			reg = <0x2000 0x100>;
-			interrupts = <42 0x8>;
-			interrupt-controller;
-			#interrupt-cells = <2>;
-		};
-
-		axe-app {
-			compatible = "fsl,mpc5121-axe-app";
-			interrupt-parent = <&axe_pic>;
-			interrupts = <
-					/* soft interrupts */
-					0 0x0	1 0x0	2 0x0	3 0x0
-					4 0x0	5 0x0	6 0x0	7 0x0
-					/* fifo interrupts */
-					8 0x0	9 0x0	10 0x0	11 0x0
-				>;
-		};
-
-		display@2100 {
-			edid = [00 FF FF FF FF FF FF 00 14 94 00 00 00 00 00 00
-				0A 12 01 03 80 1C 23 78 CA 88 FF 94 52 54 8E 27
-				1E 4C 50 00 00 00 01 01 01 01 01 01 01 01 01 01
-				01 01 01 01 01 01 FB 00 B0 14 00 DC 05 00 08 04
-				21 00 1C 23 00 00 00 18 00 00 00 FD 00 38 3C 1F
-				3C 01 0A 20 20 20 20 20 20 20 00 00 00 FC 00 45
-				54 30 31 38 30 30 33 44 4D 55 0A 0A 00 00 00 10
-				00 41 30 30 30 30 30 30 30 30 30 30 30 31 00 D5];
-		};
-
-		can@2300 {
-			status = "disabled";
-		};
-
-		can@2380 {
-			status = "disabled";
-		};
-
-		viu@2400 {
-			status = "disabled";
-		};
-
-		mdio@2800 {
-			phy0: ethernet-phy@1f {
-				compatible = "smsc,lan8700";
-				reg = <0x1f>;
-			};
-		};
-
-		enet: ethernet@2800 {
-			phy-handle = <&phy0>;
-		};
-
-		usb@3000 {
-			status = "disabled";
-		};
-
-		usb@4000 {
-			status = "disabled";
-		};
-
-		/* PSC3 serial port A, aka ttyPSC0 */
-		serial0: psc@11300 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-			fsl,rx-fifo-size = <512>;
-			fsl,tx-fifo-size = <512>;
-		};
-
-		/* PSC4 in SPI mode */
-		spi4: psc@11400 {
-			compatible = "fsl,mpc5121-psc-spi", "fsl,mpc5121-psc";
-			fsl,rx-fifo-size = <768>;
-			fsl,tx-fifo-size = <768>;
-			#address-cells = <1>;
-			#size-cells = <0>;
-			num-cs = <1>;
-			cs-gpios = <&gpio_pic 25 0>;
-
-			flash: m25p128@0 {
-				compatible = "st,m25p128";
-				spi-max-frequency = <20000000>;
-				reg = <0>;
-				#address-cells = <1>;
-				#size-cells = <1>;
-
-				partition@0 {
-					label = "spi-flash0";
-					reg = <0x00000000 0x01000000>;
-				};
-			};
-		};
-
-		/* PSC5 in SPI mode */
-		spi5: psc@11500 {
-			compatible = "fsl,mpc5121-psc-spi", "fsl,mpc5121-psc";
-			fsl,mode = "spi-master";
-			fsl,rx-fifo-size = <128>;
-			fsl,tx-fifo-size = <128>;
-			#address-cells = <1>;
-			#size-cells = <0>;
-
-			lcd@0 {
-				compatible = "ilitek,ili922x";
-				reg = <0>;
-				spi-max-frequency = <100000>;
-				spi-cpol;
-				spi-cpha;
-			};
-		};
-
-		/* PSC7 serial port C, aka ttyPSC2 */
-		serial7: psc@11700 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-			fsl,rx-fifo-size = <512>;
-			fsl,tx-fifo-size = <512>;
-		};
-
-		matrix_keypad@0 {
-			compatible = "gpio-matrix-keypad";
-			debounce-delay-ms = <5>;
-			col-scan-delay-us = <1>;
-			gpio-activelow;
-			col-gpios-binary;
-			col-switch-delay-ms = <200>;
-
-			col-gpios = <&gpio_pic 1 0>;	/* pin1 */
-
-			row-gpios = <&gpio_pic 2 0	/* pin2 */
-				     &gpio_pic 3 0	/* pin3 */
-				     &gpio_pic 4 0>;	/* pin4 */
-
-			linux,keymap = <0x0000006e	/* FN LEFT */
-					0x01000067	/* UP */
-					0x02000066	/* FN RIGHT */
-					0x00010069	/* LEFT */
-					0x0101006a	/* DOWN */
-					0x0201006c>;	/* RIGHT */
-		};
-	};
-
-	leds {
-		compatible = "gpio-leds";
-
-		backlight {
-			label = "backlight";
-			gpios = <&gpio_pic 0 0>;
-			default-state = "keep";
-		};
-		green {
-			label = "green";
-			gpios = <&gpio_pic 18 0>;
-			default-state = "keep";
-		};
-		red {
-			label = "red";
-			gpios = <&gpio_pic 19 0>;
-			default-state = "keep";
-		};
-	};
-};
diff --git a/arch/powerpc/boot/dts/cm5200.dts b/arch/powerpc/boot/dts/cm5200.dts
deleted file mode 100644
index 66cae7be60c4..000000000000
--- a/arch/powerpc/boot/dts/cm5200.dts
+++ /dev/null
@@ -1,85 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * CM5200 board Device Tree Source
- *
- * Copyright (C) 2007 Semihalf
- * Marian Balakowicz <m8@semihalf.com>
- */
-
-/include/ "mpc5200b.dtsi"
-
-&gpt0 { fsl,has-wdt; };
-
-/ {
-	model = "schindler,cm5200";
-	compatible = "schindler,cm5200";
-
-	soc5200@f0000000 {
-		can@900 {
-			status = "disabled";
-		};
-
-		can@980 {
-			status = "disabled";
-		};
-
-		psc@2000 {		// PSC1
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		psc@2200 {		// PSC2
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		psc@2400 {		// PSC3
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		psc@2600 {		// PSC4
-			status = "disabled";
-		};
-
-		psc@2800 {		// PSC5
-			status = "disabled";
-		};
-
-		psc@2c00 {		// PSC6
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		ethernet@3000 {
-			phy-handle = <&phy0>;
-		};
-
-		mdio@3000 {
-			phy0: ethernet-phy@0 {
-				reg = <0>;
-			};
-		};
-
-		ata@3a00 {
-			status = "disabled";
-		};
-
-		i2c@3d00 {
-			status = "disabled";
-		};
-
-	};
-
-	pci@f0000d00 {
-		status = "disabled";
-	};
-
-	localbus {
-		// 16-bit flash device at LocalPlus Bus CS0
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0 0x2000000>;
-			bank-width = <2>;
-			device-width = <2>;
-			#size-cells = <1>;
-			#address-cells = <1>;
-		};
-	};
-};
diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts
deleted file mode 100644
index 2b86c81f9048..000000000000
--- a/arch/powerpc/boot/dts/lite5200b.dts
+++ /dev/null
@@ -1,157 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Lite5200B board Device Tree Source
- *
- * Copyright 2006-2007 Secret Lab Technologies Ltd.
- * Grant Likely <grant.likely@secretlab.ca>
- */
-
-/include/ "mpc5200b.dtsi"
-
-&gpt0 { fsl,has-wdt; };
-&gpt2 { gpio-controller; };
-&gpt3 { gpio-controller; };
-
-/ {
-	model = "fsl,lite5200b";
-	compatible = "fsl,lite5200b";
-
-	leds {
-		compatible = "gpio-leds";
-		tmr2 {
-			gpios = <&gpt2 0 1>;
-		};
-		tmr3 {
-			gpios = <&gpt3 0 1>;
-			linux,default-trigger = "heartbeat";
-		};
-		led1 { gpios = <&gpio_wkup 2 1>; };
-		led2 { gpios = <&gpio_simple 3 1>; };
-		led3 { gpios = <&gpio_wkup 3 1>; };
-		led4 { gpios = <&gpio_simple 2 1>; };
-	};
-
-	memory {
-		reg = <0x00000000 0x10000000>;	// 256MB
-	};
-
-	soc5200@f0000000 {
-		psc@2000 {		// PSC1
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-			cell-index = <0>;
-		};
-
-		psc@2200 {		// PSC2
-			status = "disabled";
-		};
-
-		psc@2400 {		// PSC3
-			status = "disabled";
-		};
-
-		psc@2600 {		// PSC4
-			status = "disabled";
-		};
-
-		psc@2800 {		// PSC5
-			status = "disabled";
-		};
-
-		psc@2c00 {		// PSC6
-			status = "disabled";
-		};
-
-		// PSC2 in ac97 mode example
-		//ac97@2200 {		// PSC2
-		//	compatible = "fsl,mpc5200b-psc-ac97","fsl,mpc5200-psc-ac97";
-		//	cell-index = <1>;
-		//};
-
-		// PSC3 in CODEC mode example
-		//i2s@2400 {		// PSC3
-		//	compatible = "fsl,mpc5200b-psc-i2s"; //not 5200 compatible
-		//	cell-index = <2>;
-		//};
-
-		// PSC6 in spi mode example
-		//spi@2c00 {		// PSC6
-		//	compatible = "fsl,mpc5200b-psc-spi","fsl,mpc5200-psc-spi";
-		//	cell-index = <5>;
-		//};
-
-		ethernet@3000 {
-			phy-handle = <&phy0>;
-		};
-
-		mdio@3000 {
-			phy0: ethernet-phy@0 {
-				reg = <0>;
-			};
-		};
-
-		i2c@3d40 {
-			eeprom@50 {
-				compatible = "atmel,24c02";
-				reg = <0x50>;
-			};
-		};
-
-		sram@8000 {
-			compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram";
-			reg = <0x8000 0x4000>;
-		};
-	};
-
-	pci@f0000d00 {
-		interrupt-map-mask = <0xf800 0 0 7>;
-		interrupt-map = <0xc000 0 0 1 &mpc5200_pic 0 0 3 // 1st slot
-				 0xc000 0 0 2 &mpc5200_pic 1 1 3
-				 0xc000 0 0 3 &mpc5200_pic 1 2 3
-				 0xc000 0 0 4 &mpc5200_pic 1 3 3
-
-				 0xc800 0 0 1 &mpc5200_pic 1 1 3 // 2nd slot
-				 0xc800 0 0 2 &mpc5200_pic 1 2 3
-				 0xc800 0 0 3 &mpc5200_pic 1 3 3
-				 0xc800 0 0 4 &mpc5200_pic 0 0 3>;
-		clock-frequency = <0>; // From boot loader
-		interrupts = <2 8 0 2 9 0 2 10 0>;
-		bus-range = <0 0>;
-		ranges = <0x42000000 0 0x80000000 0x80000000 0 0x20000000
-			  0x02000000 0 0xa0000000 0xa0000000 0 0x10000000
-			  0x01000000 0 0x00000000 0xb0000000 0 0x01000000>;
-	};
-
-	localbus {
-		ranges = <0 0 0xfe000000 0x02000000>;
-
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0 0x02000000>;
-			bank-width = <1>;
-			#size-cells = <1>;
-			#address-cells = <1>;
-
-			partition@0 {
-				label = "kernel";
-				reg = <0x00000000 0x00200000>;
-			};
-			partition@200000 {
-				label = "rootfs";
-				reg = <0x00200000 0x01d00000>;
-			};
-			partition@1f00000 {
-				label = "u-boot";
-				reg = <0x01f00000 0x00060000>;
-			};
-			partition@1f60000 {
-				label = "u-boot-env";
-				reg = <0x01f60000 0x00020000>;
-			};
-			partition@1f80000 {
-				label = "dtb";
-				reg = <0x01f80000 0x00080000>;
-			};
-		};
-	};
-
-};
diff --git a/arch/powerpc/boot/dts/media5200.dts b/arch/powerpc/boot/dts/media5200.dts
deleted file mode 100644
index 61cae9dcddef..000000000000
--- a/arch/powerpc/boot/dts/media5200.dts
+++ /dev/null
@@ -1,142 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Freescale Media5200 board Device Tree Source
- *
- * Copyright 2009 Secret Lab Technologies Ltd.
- * Grant Likely <grant.likely@secretlab.ca>
- * Steven Cavanagh <scavanagh@secretlab.ca>
- */
-
-/include/ "mpc5200b.dtsi"
-
-&gpt0 { fsl,has-wdt; };
-
-/ {
-	model = "fsl,media5200";
-	compatible = "fsl,media5200";
-
-	aliases {
-		console = &console;
-		ethernet0 = &eth0;
-	};
-
-	chosen {
-		stdout-path = &console;
-	};
-
-	cpus {
-		PowerPC,5200@0 {
-			timebase-frequency = <33000000>;	// 33 MHz, these were configured by U-Boot
-			bus-frequency = <132000000>;		// 132 MHz
-			clock-frequency = <396000000>;		// 396 MHz
-		};
-	};
-
-	memory {
-		reg = <0x00000000 0x08000000>;	// 128MB RAM
-	};
-
-	soc5200@f0000000 {
-		bus-frequency = <132000000>;// 132 MHz
-
-		psc@2000 {	// PSC1
-			status = "disabled";
-		};
-
-		psc@2200 {	// PSC2
-			status = "disabled";
-		};
-
-		psc@2400 {	// PSC3
-			status = "disabled";
-		};
-
-		psc@2600 {	// PSC4
-			status = "disabled";
-		};
-
-		psc@2800 {	// PSC5
-			status = "disabled";
-		};
-
-		// PSC6 in uart mode
-		console: psc@2c00 {		// PSC6
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		ethernet@3000 {
-			phy-handle = <&phy0>;
-		};
-
-		mdio@3000 {
-			phy0: ethernet-phy@0 {
-				reg = <0>;
-			};
-		};
-
-		usb@1000 {
-			reg = <0x1000 0x100>;
-		};
-	};
-
-	pci@f0000d00 {
-		interrupt-map-mask = <0xf800 0 0 7>;
-		interrupt-map = <0xc000 0 0 1 &media5200_fpga 0 2 // 1st slot
-				 0xc000 0 0 2 &media5200_fpga 0 3
-				 0xc000 0 0 3 &media5200_fpga 0 4
-				 0xc000 0 0 4 &media5200_fpga 0 5
-
-				 0xc800 0 0 1 &media5200_fpga 0 3 // 2nd slot
-				 0xc800 0 0 2 &media5200_fpga 0 4
-				 0xc800 0 0 3 &media5200_fpga 0 5
-				 0xc800 0 0 4 &media5200_fpga 0 2
-
-				 0xd000 0 0 1 &media5200_fpga 0 4 // miniPCI
-				 0xd000 0 0 2 &media5200_fpga 0 5
-
-				 0xe000 0 0 1 &media5200_fpga 0 5 // CoralIP
-				>;
-		ranges = <0x42000000 0 0x80000000 0x80000000 0 0x20000000
-			  0x02000000 0 0xa0000000 0xa0000000 0 0x10000000
-			  0x01000000 0 0x00000000 0xb0000000 0 0x01000000>;
-		interrupt-parent = <&mpc5200_pic>;
-	};
-
-	localbus {
-		ranges = < 0 0 0xfc000000 0x02000000
-			   1 0 0xfe000000 0x02000000
-			   2 0 0xf0010000 0x00010000
-			   3 0 0xf0020000 0x00010000 >;
-		flash@0,0 {
-			compatible = "amd,am29lv28ml", "cfi-flash";
-			reg = <0 0x0 0x2000000>;                // 32 MB
-			bank-width = <4>;                       // Width in bytes of the flash bank
-			device-width = <2>;                     // Two devices on each bank
-		};
-
-		flash@1,0 {
-			compatible = "amd,am29lv28ml", "cfi-flash";
-			reg = <1 0 0x2000000>;                  // 32 MB
-			bank-width = <4>;                       // Width in bytes of the flash bank
-			device-width = <2>;                     // Two devices on each bank
-		};
-
-		media5200_fpga: fpga@2,0 {
-			compatible = "fsl,media5200-fpga";
-			interrupt-controller;
-			#interrupt-cells = <2>;	// 0:bank 1:id; no type field
-			reg = <2 0 0x10000>;
-
-			interrupt-parent = <&mpc5200_pic>;
-			interrupts = <0 0 3	// IRQ bank 0
-			              1 1 3>;	// IRQ bank 1
-		};
-
-		uart@3,0 {
-			compatible = "ti,tl16c752bpt";
-			reg = <3 0 0x10000>;
-			interrupt-parent = <&media5200_fpga>;
-			interrupts = <0 0  0 1>; // 2 irqs
-		};
-	};
-};
diff --git a/arch/powerpc/boot/dts/motionpro.dts b/arch/powerpc/boot/dts/motionpro.dts
deleted file mode 100644
index c23676093da8..000000000000
--- a/arch/powerpc/boot/dts/motionpro.dts
+++ /dev/null
@@ -1,132 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Motion-PRO board Device Tree Source
- *
- * Copyright (C) 2007 Semihalf
- * Marian Balakowicz <m8@semihalf.com>
- */
-
-/include/ "mpc5200b.dtsi"
-
-&gpt0 { fsl,has-wdt; };
-&gpt6 { // Motion-PRO status LED
-	compatible = "promess,motionpro-led";
-	label = "motionpro-statusled";
-	blink-delay = <100>; // 100 msec
-};
-&gpt7 { // Motion-PRO ready LED
-	compatible = "promess,motionpro-led";
-	label = "motionpro-readyled";
-};
-
-/ {
-	model = "promess,motionpro";
-	compatible = "promess,motionpro";
-
-	soc5200@f0000000 {
-		can@900 {
-			status = "disabled";
-		};
-
-		psc@2000 {		// PSC1
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		// PSC2 in spi master mode 
-		psc@2200 {		// PSC2
-			compatible = "fsl,mpc5200b-psc-spi","fsl,mpc5200-psc-spi";
-			cell-index = <1>;
-		};
-
-		psc@2400 {		// PSC3
-			status = "disabled";
-		};
-
-		psc@2600 {		// PSC4
-			status = "disabled";
-		};
-
-		psc@2800 {		// PSC5
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		psc@2c00 {		// PSC6
-			status = "disabled";
-		};
-
-		ethernet@3000 {
-			phy-handle = <&phy0>;
-		};
-
-		mdio@3000 {
-			phy0: ethernet-phy@2 {
-				reg = <2>;
-			};
-		};
-
-		i2c@3d00 {
-			status = "disabled";
-		};
-
-		i2c@3d40 {
-			rtc@68 {
-				compatible = "dallas,ds1339";
-				reg = <0x68>;
-			};
-		};
-
-		sram@8000 {
-			compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram";
-			reg = <0x8000 0x4000>;
-		};
-	};
-
-	pci@f0000d00 {
-		status = "disabled";
-	};
-
-	localbus {
-		ranges = <0 0 0xff000000 0x01000000
-			  1 0 0x50000000 0x00010000
-			  2 0 0x50010000 0x00010000
-			  3 0 0x50020000 0x00010000>;
-
-		// 8-bit DualPort SRAM on LocalPlus Bus CS1
-		kollmorgen@1,0 {
-			compatible = "promess,motionpro-kollmorgen";
-			reg = <1 0 0x10000>;
-			interrupts = <1 1 0>;
-		};
-
-		// 8-bit board CPLD on LocalPlus Bus CS2
-		cpld@2,0 {
-			compatible = "promess,motionpro-cpld";
-			reg = <2 0 0x10000>;
-		};
-
-		// 8-bit custom Anybus Module on LocalPlus Bus CS3
-		anybus@3,0 {
-			compatible = "promess,motionpro-anybus";
-			reg = <3 0 0x10000>;
-		};
-		pro_module_general@3,0 {
-			compatible = "promess,pro_module_general";
-			reg = <3 0 3>;
-		};
-		pro_module_dio@3,800 {
-			compatible = "promess,pro_module_dio";
-			reg = <3 0x800 2>;
-		};
-
-		// 16-bit flash device at LocalPlus Bus CS0
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0 0x01000000>;
-			bank-width = <2>;
-			device-width = <2>;
-			#size-cells = <1>;
-			#address-cells = <1>;
-		};
-
-	};
-};
diff --git a/arch/powerpc/boot/dts/mpc5121.dtsi b/arch/powerpc/boot/dts/mpc5121.dtsi
deleted file mode 100644
index 3f66b91a8e3c..000000000000
--- a/arch/powerpc/boot/dts/mpc5121.dtsi
+++ /dev/null
@@ -1,526 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * base MPC5121 Device Tree Source
- *
- * Copyright 2007-2008 Freescale Semiconductor Inc.
- */
-
-#include <dt-bindings/clock/mpc512x-clock.h>
-
-/dts-v1/;
-
-/ {
-	model = "mpc5121";
-	compatible = "fsl,mpc5121";
-	#address-cells = <1>;
-	#size-cells = <1>;
-        interrupt-parent = <&ipic>;
-
-	aliases {
-		ethernet0 = &eth0;
-		pci = &pci;
-	};
-
-	cpus {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		PowerPC,5121@0 {
-			device_type = "cpu";
-			reg = <0>;
-			d-cache-line-size = <0x20>;	/* 32 bytes */
-			i-cache-line-size = <0x20>;	/* 32 bytes */
-			d-cache-size = <0x8000>;	/* L1, 32K */
-			i-cache-size = <0x8000>;	/* L1, 32K */
-			timebase-frequency = <49500000>;/* 49.5 MHz (csb/4) */
-			bus-frequency = <198000000>;	/* 198 MHz csb bus */
-			clock-frequency = <396000000>;	/* 396 MHz ppc core */
-		};
-	};
-
-	memory {
-		device_type = "memory";
-		reg = <0x00000000 0x10000000>;	/* 256MB at 0 */
-	};
-
-	mbx@20000000 {
-		compatible = "fsl,mpc5121-mbx";
-		reg = <0x20000000 0x4000>;
-		interrupts = <66 0x8>;
-		clocks = <&clks MPC512x_CLK_MBX_BUS>,
-			 <&clks MPC512x_CLK_MBX_3D>,
-			 <&clks MPC512x_CLK_MBX>;
-		clock-names = "mbx-bus", "mbx-3d", "mbx";
-	};
-
-	sram@30000000 {
-		compatible = "fsl,mpc5121-sram";
-		reg = <0x30000000 0x20000>;	/* 128K at 0x30000000 */
-	};
-
-	nfc@40000000 {
-		compatible = "fsl,mpc5121-nfc";
-		reg = <0x40000000 0x100000>;	/* 1M at 0x40000000 */
-		interrupts = <6 8>;
-		#address-cells = <1>;
-		#size-cells = <1>;
-		clocks = <&clks MPC512x_CLK_NFC>;
-		clock-names = "ipg";
-	};
-
-	localbus@80000020 {
-		compatible = "fsl,mpc5121-localbus";
-		#address-cells = <2>;
-		#size-cells = <1>;
-		reg = <0x80000020 0x40>;
-		ranges = <0x0 0x0 0xfc000000 0x04000000>;
-	};
-
-	clocks {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		osc: osc {
-			compatible = "fixed-clock";
-			#clock-cells = <0>;
-			clock-frequency = <33000000>;
-		};
-	};
-
-	soc@80000000 {
-		compatible = "fsl,mpc5121-immr";
-		#address-cells = <1>;
-		#size-cells = <1>;
-		ranges = <0x0 0x80000000 0x400000>;
-		reg = <0x80000000 0x400000>;
-		bus-frequency = <66000000>;	/* 66 MHz ips bus */
-
-
-		/*
-		 * IPIC
-		 * interrupts cell = <intr #, sense>
-		 * sense values match linux IORESOURCE_IRQ_* defines:
-		 * sense == 8: Level, low assertion
-		 * sense == 2: Edge, high-to-low change
-		 */
-		ipic: interrupt-controller@c00 {
-			compatible = "fsl,mpc5121-ipic", "fsl,ipic";
-			interrupt-controller;
-			#address-cells = <0>;
-			#interrupt-cells = <2>;
-			reg = <0xc00 0x100>;
-		};
-
-		/* Watchdog timer */
-		wdt@900 {
-			compatible = "fsl,mpc5121-wdt";
-			reg = <0x900 0x100>;
-		};
-
-		/* Real time clock */
-		rtc@a00 {
-			compatible = "fsl,mpc5121-rtc";
-			reg = <0xa00 0x100>;
-			interrupts = <79 0x8 80 0x8>;
-		};
-
-		/* Reset module */
-		reset@e00 {
-			compatible = "fsl,mpc5121-reset";
-			reg = <0xe00 0x100>;
-		};
-
-		/* Clock control */
-		clks: clock@f00 {
-			compatible = "fsl,mpc5121-clock";
-			reg = <0xf00 0x100>;
-			#clock-cells = <1>;
-			clocks = <&osc>;
-			clock-names = "osc";
-		};
-
-		/* Power Management Controller */
-		pmc@1000{
-			compatible = "fsl,mpc5121-pmc";
-			reg = <0x1000 0x100>;
-			interrupts = <83 0x8>;
-		};
-
-		gpio@1100 {
-			compatible = "fsl,mpc5121-gpio";
-			reg = <0x1100 0x100>;
-			interrupts = <78 0x8>;
-		};
-
-		can@1300 {
-			compatible = "fsl,mpc5121-mscan";
-			reg = <0x1300 0x80>;
-			interrupts = <12 0x8>;
-			clocks = <&clks MPC512x_CLK_BDLC>,
-				 <&clks MPC512x_CLK_IPS>,
-				 <&clks MPC512x_CLK_SYS>,
-				 <&clks MPC512x_CLK_REF>,
-				 <&clks MPC512x_CLK_MSCAN0_MCLK>;
-			clock-names = "ipg", "ips", "sys", "ref", "mclk";
-		};
-
-		can@1380 {
-			compatible = "fsl,mpc5121-mscan";
-			reg = <0x1380 0x80>;
-			interrupts = <13 0x8>;
-			clocks = <&clks MPC512x_CLK_BDLC>,
-				 <&clks MPC512x_CLK_IPS>,
-				 <&clks MPC512x_CLK_SYS>,
-				 <&clks MPC512x_CLK_REF>,
-				 <&clks MPC512x_CLK_MSCAN1_MCLK>;
-			clock-names = "ipg", "ips", "sys", "ref", "mclk";
-		};
-
-		sdhc@1500 {
-			compatible = "fsl,mpc5121-sdhc";
-			reg = <0x1500 0x100>;
-			interrupts = <8 0x8>;
-			dmas = <&dma0 30>;
-			dma-names = "rx-tx";
-			clocks = <&clks MPC512x_CLK_IPS>,
-				 <&clks MPC512x_CLK_SDHC>;
-			clock-names = "ipg", "per";
-		};
-
-		i2c@1700 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			compatible = "fsl,mpc5121-i2c", "fsl-i2c";
-			reg = <0x1700 0x20>;
-			interrupts = <9 0x8>;
-			clocks = <&clks MPC512x_CLK_I2C>;
-			clock-names = "ipg";
-		};
-
-		i2c@1720 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			compatible = "fsl,mpc5121-i2c", "fsl-i2c";
-			reg = <0x1720 0x20>;
-			interrupts = <10 0x8>;
-			clocks = <&clks MPC512x_CLK_I2C>;
-			clock-names = "ipg";
-		};
-
-		i2c@1740 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			compatible = "fsl,mpc5121-i2c", "fsl-i2c";
-			reg = <0x1740 0x20>;
-			interrupts = <11 0x8>;
-			clocks = <&clks MPC512x_CLK_I2C>;
-			clock-names = "ipg";
-		};
-
-		i2ccontrol@1760 {
-			compatible = "fsl,mpc5121-i2c-ctrl";
-			reg = <0x1760 0x8>;
-		};
-
-		axe@2000 {
-			compatible = "fsl,mpc5121-axe";
-			reg = <0x2000 0x100>;
-			interrupts = <42 0x8>;
-			clocks = <&clks MPC512x_CLK_AXE>;
-			clock-names = "ipg";
-		};
-
-		display@2100 {
-			compatible = "fsl,mpc5121-diu";
-			reg = <0x2100 0x100>;
-			interrupts = <64 0x8>;
-			clocks = <&clks MPC512x_CLK_DIU>;
-			clock-names = "ipg";
-		};
-
-		can@2300 {
-			compatible = "fsl,mpc5121-mscan";
-			reg = <0x2300 0x80>;
-			interrupts = <90 0x8>;
-			clocks = <&clks MPC512x_CLK_BDLC>,
-				 <&clks MPC512x_CLK_IPS>,
-				 <&clks MPC512x_CLK_SYS>,
-				 <&clks MPC512x_CLK_REF>,
-				 <&clks MPC512x_CLK_MSCAN2_MCLK>;
-			clock-names = "ipg", "ips", "sys", "ref", "mclk";
-		};
-
-		can@2380 {
-			compatible = "fsl,mpc5121-mscan";
-			reg = <0x2380 0x80>;
-			interrupts = <91 0x8>;
-			clocks = <&clks MPC512x_CLK_BDLC>,
-				 <&clks MPC512x_CLK_IPS>,
-				 <&clks MPC512x_CLK_SYS>,
-				 <&clks MPC512x_CLK_REF>,
-				 <&clks MPC512x_CLK_MSCAN3_MCLK>;
-			clock-names = "ipg", "ips", "sys", "ref", "mclk";
-		};
-
-		viu@2400 {
-			compatible = "fsl,mpc5121-viu";
-			reg = <0x2400 0x400>;
-			interrupts = <67 0x8>;
-			clocks = <&clks MPC512x_CLK_VIU>;
-			clock-names = "ipg";
-		};
-
-		mdio@2800 {
-			compatible = "fsl,mpc5121-fec-mdio";
-			reg = <0x2800 0x800>;
-			#address-cells = <1>;
-			#size-cells = <0>;
-			clocks = <&clks MPC512x_CLK_FEC>;
-			clock-names = "per";
-		};
-
-		eth0: ethernet@2800 {
-			device_type = "network";
-			compatible = "fsl,mpc5121-fec";
-			reg = <0x2800 0x800>;
-			local-mac-address = [ 00 00 00 00 00 00 ];
-			interrupts = <4 0x8>;
-			clocks = <&clks MPC512x_CLK_FEC>;
-			clock-names = "per";
-		};
-
-		/* USB1 using external ULPI PHY */
-		usb@3000 {
-			compatible = "fsl,mpc5121-usb2-dr";
-			reg = <0x3000 0x600>;
-			#address-cells = <1>;
-			#size-cells = <0>;
-			interrupts = <43 0x8>;
-			dr_mode = "otg";
-			phy_type = "ulpi";
-			clocks = <&clks MPC512x_CLK_USB1>;
-			clock-names = "ipg";
-		};
-
-		/* USB0 using internal UTMI PHY */
-		usb@4000 {
-			compatible = "fsl,mpc5121-usb2-dr";
-			reg = <0x4000 0x600>;
-			#address-cells = <1>;
-			#size-cells = <0>;
-			interrupts = <44 0x8>;
-			dr_mode = "otg";
-			phy_type = "utmi_wide";
-			clocks = <&clks MPC512x_CLK_USB2>;
-			clock-names = "ipg";
-		};
-
-		/* IO control */
-		ioctl@a000 {
-			compatible = "fsl,mpc5121-ioctl";
-			reg = <0xA000 0x1000>;
-		};
-
-		/* LocalPlus controller */
-		lpc@10000 {
-			compatible = "fsl,mpc5121-lpc";
-			reg = <0x10000 0x100>;
-		};
-
-		sclpc@10100 {
-			compatible = "fsl,mpc512x-lpbfifo";
-			reg = <0x10100 0x50>;
-			interrupts = <7 0x8>;
-			dmas = <&dma0 26>;
-			dma-names = "rx-tx";
-		};
-
-		pata@10200 {
-			compatible = "fsl,mpc5121-pata";
-			reg = <0x10200 0x100>;
-			interrupts = <5 0x8>;
-			clocks = <&clks MPC512x_CLK_PATA>;
-			clock-names = "ipg";
-		};
-
-		/* 512x PSCs are not 52xx PSC compatible */
-
-		/* PSC0 */
-		psc@11000 {
-			compatible = "fsl,mpc5121-psc";
-			reg = <0x11000 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC0>,
-				 <&clks MPC512x_CLK_PSC0_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		/* PSC1 */
-		psc@11100 {
-			compatible = "fsl,mpc5121-psc";
-			reg = <0x11100 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC1>,
-				 <&clks MPC512x_CLK_PSC1_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		/* PSC2 */
-		psc@11200 {
-			compatible = "fsl,mpc5121-psc";
-			reg = <0x11200 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC2>,
-				 <&clks MPC512x_CLK_PSC2_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		/* PSC3 */
-		psc@11300 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-			reg = <0x11300 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC3>,
-				 <&clks MPC512x_CLK_PSC3_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		/* PSC4 */
-		psc@11400 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-			reg = <0x11400 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC4>,
-				 <&clks MPC512x_CLK_PSC4_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		/* PSC5 */
-		psc@11500 {
-			compatible = "fsl,mpc5121-psc";
-			reg = <0x11500 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC5>,
-				 <&clks MPC512x_CLK_PSC5_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		/* PSC6 */
-		psc@11600 {
-			compatible = "fsl,mpc5121-psc";
-			reg = <0x11600 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC6>,
-				 <&clks MPC512x_CLK_PSC6_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		/* PSC7 */
-		psc@11700 {
-			compatible = "fsl,mpc5121-psc";
-			reg = <0x11700 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC7>,
-				 <&clks MPC512x_CLK_PSC7_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		/* PSC8 */
-		psc@11800 {
-			compatible = "fsl,mpc5121-psc";
-			reg = <0x11800 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC8>,
-				 <&clks MPC512x_CLK_PSC8_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		/* PSC9 */
-		psc@11900 {
-			compatible = "fsl,mpc5121-psc";
-			reg = <0x11900 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC9>,
-				 <&clks MPC512x_CLK_PSC9_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		/* PSC10 */
-		psc@11a00 {
-			compatible = "fsl,mpc5121-psc";
-			reg = <0x11a00 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC10>,
-				 <&clks MPC512x_CLK_PSC10_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		/* PSC11 */
-		psc@11b00 {
-			compatible = "fsl,mpc5121-psc";
-			reg = <0x11b00 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC11>,
-				 <&clks MPC512x_CLK_PSC11_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		pscfifo@11f00 {
-			compatible = "fsl,mpc5121-psc-fifo";
-			reg = <0x11f00 0x100>;
-			interrupts = <40 0x8>;
-			clocks = <&clks MPC512x_CLK_PSC_FIFO>;
-			clock-names = "ipg";
-		};
-
-		dma0: dma@14000 {
-			compatible = "fsl,mpc5121-dma";
-			reg = <0x14000 0x1800>;
-			interrupts = <65 0x8>;
-			#dma-cells = <1>;
-		};
-	};
-
-	pci: pci@80008500 {
-		compatible = "fsl,mpc5121-pci";
-		device_type = "pci";
-		interrupts = <1 0x8>;
-		clock-frequency = <0>;
-		#address-cells = <3>;
-		#size-cells = <2>;
-		#interrupt-cells = <1>;
-		clocks = <&clks MPC512x_CLK_PCI>;
-		clock-names = "ipg";
-
-		reg = <0x80008500 0x100	/* internal registers */
-		       0x80008300 0x8>;	/* config space access registers */
-		bus-range = <0x0 0x0>;
-		ranges = <0x42000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000
-			  0x02000000 0x0 0xb0000000 0xb0000000 0x0 0x10000000
-			  0x01000000 0x0 0x00000000 0x84000000 0x0 0x01000000>;
-	};
-};
diff --git a/arch/powerpc/boot/dts/mpc5121ads.dts b/arch/powerpc/boot/dts/mpc5121ads.dts
deleted file mode 100644
index b407a50ee622..000000000000
--- a/arch/powerpc/boot/dts/mpc5121ads.dts
+++ /dev/null
@@ -1,174 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * MPC5121E ADS Device Tree Source
- *
- * Copyright 2007-2008 Freescale Semiconductor Inc.
- */
-
-#include "mpc5121.dtsi"
-
-/ {
-	model = "mpc5121ads";
-	compatible = "fsl,mpc5121ads", "fsl,mpc5121";
-
-	nfc@40000000 {
-		/*
-		 * ADS has two Hynix 512MB Nand flash chips in a single
-		 * stacked package.
-		 */
-		chips = <2>;
-
-		nand@0 {
-			label = "nand";
-			reg = <0x00000000 0x40000000>;	/* 512MB + 512MB */
-		};
-	};
-
-	localbus@80000020 {
-		ranges = <0x0 0x0 0xfc000000 0x04000000
-			  0x2 0x0 0x82000000 0x00008000>;
-
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0x0 0x4000000>;
-			#address-cells = <1>;
-			#size-cells = <1>;
-			bank-width = <4>;
-			device-width = <2>;
-
-			protected@0 {
-				label = "protected";
-				reg = <0x00000000 0x00040000>;  // first sector is protected
-				read-only;
-			};
-			filesystem@40000 {
-				label = "filesystem";
-				reg = <0x00040000 0x03c00000>;  // 60M for filesystem
-			};
-			kernel@3c40000 {
-				label = "kernel";
-				reg = <0x03c40000 0x00280000>;  // 2.5M for kernel
-			};
-			device-tree@3ec0000 {
-				label = "device-tree";
-				reg = <0x03ec0000 0x00040000>;  // one sector for device tree
-			};
-			u-boot@3f00000 {
-				label = "u-boot";
-				reg = <0x03f00000 0x00100000>;  // 1M for u-boot
-				read-only;
-			};
-		};
-
-		board-control@2,0 {
-			compatible = "fsl,mpc5121ads-cpld";
-			reg = <0x2 0x0 0x8000>;
-		};
-
-		cpld_pic: pic@2,a {
-			compatible = "fsl,mpc5121ads-cpld-pic";
-			interrupt-controller;
-			#interrupt-cells = <2>;
-			reg = <0x2 0xa 0x5>;
-			/* irq routing:
-			 * all irqs but touch screen are routed to irq0 (ipic 48)
-			 * touch screen is statically routed to irq1 (ipic 17)
-			 * so don't use it here
-			 */
-			interrupts = <48 0x8>;
-		};
-	};
-
-	soc@80000000 {
-
-		i2c@1700 {
-			fsl,preserve-clocking;
-
-			hwmon@4a {
-				compatible = "adi,ad7414";
-				reg = <0x4a>;
-			};
-
-			eeprom@50 {
-				compatible = "atmel,24c32";
-				reg = <0x50>;
-			};
-
-			rtc@68 {
-				compatible = "st,m41t62";
-				reg = <0x68>;
-			};
-		};
-
-		eth0: ethernet@2800 {
-			phy-handle = <&phy0>;
-		};
-
-		can@2300 {
-			status = "disabled";
-		};
-
-		can@2380 {
-			status = "disabled";
-		};
-
-		viu@2400 {
-			status = "disabled";
-		};
-
-		mdio@2800 {
-			phy0: ethernet-phy@0 {
-				reg = <1>;
-			};
-		};
-
-		/* mpc5121ads only uses USB0 */
-		usb@3000 {
-			status = "disabled";
-		};
-
-		/* USB0 using internal UTMI PHY */
-		usb@4000 {
-			dr_mode = "host";
-			fsl,invert-drvvbus;
-			fsl,invert-pwr-fault;
-		};
-
-		/* PSC3 serial port A aka ttyPSC0 */
-		psc@11300 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-		};
-
-		/* PSC4 serial port B aka ttyPSC1 */
-		psc@11400 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-		};
-
-		/* PSC5 in ac97 mode */
-		ac97: psc@11500 {
-			compatible = "fsl,mpc5121-psc-ac97", "fsl,mpc5121-psc";
-			fsl,mode = "ac97-slave";
-			fsl,rx-fifo-size = <384>;
-			fsl,tx-fifo-size = <384>;
-		};
-	};
-
-	pci: pci@80008500 {
-		interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
-		interrupt-map = <
-				/* IDSEL 0x15 - Slot 1 PCI */
-				 0xa800 0x0 0x0 0x1 &cpld_pic 0x0 0x8
-				 0xa800 0x0 0x0 0x2 &cpld_pic 0x1 0x8
-				 0xa800 0x0 0x0 0x3 &cpld_pic 0x2 0x8
-				 0xa800 0x0 0x0 0x4 &cpld_pic 0x3 0x8
-
-				/* IDSEL 0x16 - Slot 2 MiniPCI */
-				 0xb000 0x0 0x0 0x1 &cpld_pic 0x4 0x8
-				 0xb000 0x0 0x0 0x2 &cpld_pic 0x5 0x8
-
-				/* IDSEL 0x17 - Slot 3 MiniPCI */
-				 0xb800 0x0 0x0 0x1 &cpld_pic 0x6 0x8
-				 0xb800 0x0 0x0 0x2 &cpld_pic 0x7 0x8
-				>;
-	};
-};
diff --git a/arch/powerpc/boot/dts/mpc5125twr.dts b/arch/powerpc/boot/dts/mpc5125twr.dts
deleted file mode 100644
index 0bd2acc0401d..000000000000
--- a/arch/powerpc/boot/dts/mpc5125twr.dts
+++ /dev/null
@@ -1,293 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * STx/Freescale ADS5125 MPC5125 silicon
- *
- * Copyright (C) 2009 Freescale Semiconductor Inc. All rights reserved.
- *
- * Reworked by Matteo Facchinetti (engineering@sirius-es.it)
- * Copyright (C) 2013 Sirius Electronic Systems
- */
-
-#include <dt-bindings/clock/mpc512x-clock.h>
-
-/dts-v1/;
-
-/ {
-	model = "mpc5125twr"; // In BSP "mpc5125ads"
-	compatible = "fsl,mpc5125ads", "fsl,mpc5125";
-	#address-cells = <1>;
-	#size-cells = <1>;
-	interrupt-parent = <&ipic>;
-
-	aliases {
-		gpio0 = &gpio0;
-		gpio1 = &gpio1;
-		ethernet0 = &eth0;
-	};
-
-	cpus {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		PowerPC,5125@0 {
-			device_type = "cpu";
-			reg = <0>;
-			d-cache-line-size = <0x20>;	// 32 bytes
-			i-cache-line-size = <0x20>;	// 32 bytes
-			d-cache-size = <0x8000>;	// L1, 32K
-			i-cache-size = <0x8000>;	// L1, 32K
-			timebase-frequency = <49500000>;// 49.5 MHz (csb/4)
-			bus-frequency = <198000000>;	// 198 MHz csb bus
-			clock-frequency = <396000000>;	// 396 MHz ppc core
-		};
-	};
-
-	memory {
-		device_type = "memory";
-		reg = <0x00000000 0x10000000>;	// 256MB at 0
-	};
-
-	sram@30000000 {
-		compatible = "fsl,mpc5121-sram";
-		reg = <0x30000000 0x08000>;		// 32K at 0x30000000
-	};
-
-	clocks {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		osc: osc {
-			compatible = "fixed-clock";
-			#clock-cells = <0>;
-			clock-frequency = <33000000>;
-		};
-	};
-
-	soc@80000000 {
-		compatible = "fsl,mpc5121-immr";
-		#address-cells = <1>;
-		#size-cells = <1>;
-		ranges = <0x0 0x80000000 0x400000>;
-		reg = <0x80000000 0x400000>;
-		bus-frequency = <66000000>;	// 66 MHz ips bus
-
-		// IPIC
-		// interrupts cell = <intr #, sense>
-		// sense values match linux IORESOURCE_IRQ_* defines:
-		// sense == 8: Level, low assertion
-		// sense == 2: Edge, high-to-low change
-		//
-		ipic: interrupt-controller@c00 {
-			compatible = "fsl,mpc5121-ipic", "fsl,ipic";
-			interrupt-controller;
-			#address-cells = <0>;
-			#interrupt-cells = <2>;
-			reg = <0xc00 0x100>;
-		};
-
-		rtc@a00 {	// Real time clock
-			compatible = "fsl,mpc5121-rtc";
-			reg = <0xa00 0x100>;
-			interrupts = <79 0x8 80 0x8>;
-		};
-
-		reset@e00 {	// Reset module
-			compatible = "fsl,mpc5125-reset";
-			reg = <0xe00 0x100>;
-		};
-
-		clks: clock@f00 {	// Clock control
-			compatible = "fsl,mpc5121-clock";
-			reg = <0xf00 0x100>;
-			#clock-cells = <1>;
-			clocks = <&osc>;
-			clock-names = "osc";
-		};
-
-		pmc@1000{  // Power Management Controller
-			compatible = "fsl,mpc5121-pmc";
-			reg = <0x1000 0x100>;
-			interrupts = <83 0x2>;
-		};
-
-		gpio0: gpio@1100 {
-			compatible = "fsl,mpc5125-gpio";
-			reg = <0x1100 0x080>;
-			interrupts = <78 0x8>;
-		};
-
-		gpio1: gpio@1180 {
-			compatible = "fsl,mpc5125-gpio";
-			reg = <0x1180 0x080>;
-			interrupts = <86 0x8>;
-		};
-
-		can@1300 { // CAN rev.2
-			compatible = "fsl,mpc5121-mscan";
-			interrupts = <12 0x8>;
-			reg = <0x1300 0x80>;
-			clocks = <&clks MPC512x_CLK_BDLC>,
-				 <&clks MPC512x_CLK_IPS>,
-				 <&clks MPC512x_CLK_SYS>,
-				 <&clks MPC512x_CLK_REF>,
-				 <&clks MPC512x_CLK_MSCAN0_MCLK>;
-			clock-names = "ipg", "ips", "sys", "ref", "mclk";
-		};
-
-		can@1380 {
-			compatible = "fsl,mpc5121-mscan";
-			interrupts = <13 0x8>;
-			reg = <0x1380 0x80>;
-			clocks = <&clks MPC512x_CLK_BDLC>,
-				 <&clks MPC512x_CLK_IPS>,
-				 <&clks MPC512x_CLK_SYS>,
-				 <&clks MPC512x_CLK_REF>,
-				 <&clks MPC512x_CLK_MSCAN1_MCLK>;
-			clock-names = "ipg", "ips", "sys", "ref", "mclk";
-		};
-
-		sdhc@1500 {
-			compatible = "fsl,mpc5121-sdhc";
-			interrupts = <8 0x8>;
-			reg = <0x1500 0x100>;
-			clocks = <&clks MPC512x_CLK_IPS>,
-				 <&clks MPC512x_CLK_SDHC>;
-			clock-names = "ipg", "per";
-		};
-
-		i2c@1700 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			compatible = "fsl,mpc5121-i2c", "fsl-i2c";
-			reg = <0x1700 0x20>;
-			interrupts = <0x9 0x8>;
-			clocks = <&clks MPC512x_CLK_I2C>;
-			clock-names = "ipg";
-		};
-
-		i2c@1720 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			compatible = "fsl,mpc5121-i2c", "fsl-i2c";
-			reg = <0x1720 0x20>;
-			interrupts = <0xa 0x8>;
-			clocks = <&clks MPC512x_CLK_I2C>;
-			clock-names = "ipg";
-		};
-
-		i2c@1740 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			compatible = "fsl,mpc5121-i2c", "fsl-i2c";
-			reg = <0x1740 0x20>;
-			interrupts = <0xb 0x8>;
-			clocks = <&clks MPC512x_CLK_I2C>;
-			clock-names = "ipg";
-		};
-
-		i2ccontrol@1760 {
-			compatible = "fsl,mpc5121-i2c-ctrl";
-			reg = <0x1760 0x8>;
-		};
-
-		diu@2100 {
-			compatible = "fsl,mpc5121-diu";
-			reg = <0x2100 0x100>;
-			interrupts = <64 0x8>;
-			clocks = <&clks MPC512x_CLK_DIU>;
-			clock-names = "ipg";
-		};
-
-		mdio@2800 {
-			compatible = "fsl,mpc5121-fec-mdio";
-			reg = <0x2800 0x800>;
-			#address-cells = <1>;
-			#size-cells = <0>;
-			phy0: ethernet-phy@0 {
-				reg = <1>;
-			};
-		};
-
-		eth0: ethernet@2800 {
-			compatible = "fsl,mpc5125-fec";
-			reg = <0x2800 0x800>;
-			local-mac-address = [ 00 00 00 00 00 00 ];
-			interrupts = <4 0x8>;
-			phy-handle = < &phy0 >;
-			phy-connection-type = "rmii";
-			clocks = <&clks MPC512x_CLK_FEC>;
-			clock-names = "per";
-		};
-
-		// IO control
-		ioctl@a000 {
-			compatible = "fsl,mpc5125-ioctl";
-			reg = <0xA000 0x1000>;
-		};
-
-		// disable USB1 port
-		// TODO:
-		// correct pinmux config and fix USB3320 ulpi dependency
-		// before re-enabling it
-		usb@3000 {
-			compatible = "fsl,mpc5121-usb2-dr";
-			reg = <0x3000 0x400>;
-			#address-cells = <1>;
-			#size-cells = <0>;
-			interrupts = <43 0x8>;
-			dr_mode = "host";
-			phy_type = "ulpi";
-			clocks = <&clks MPC512x_CLK_USB1>;
-			clock-names = "ipg";
-			status = "disabled";
-		};
-
-		sclpc@10100 {
-			compatible = "fsl,mpc512x-lpbfifo";
-			reg = <0x10100 0x50>;
-			interrupts = <7 0x8>;
-			dmas = <&dma0 26>;
-			dma-names = "rx-tx";
-		};
-
-		// 5125 PSCs are not 52xx or 5121 PSC compatible
-		// PSC1 uart0 aka ttyPSC0
-		serial@11100 {
-			compatible = "fsl,mpc5125-psc-uart", "fsl,mpc5125-psc";
-			reg = <0x11100 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC1>,
-				 <&clks MPC512x_CLK_PSC1_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		// PSC9 uart1 aka ttyPSC1
-		serial@11900 {
-			compatible = "fsl,mpc5125-psc-uart", "fsl,mpc5125-psc";
-			reg = <0x11900 0x100>;
-			interrupts = <40 0x8>;
-			fsl,rx-fifo-size = <16>;
-			fsl,tx-fifo-size = <16>;
-			clocks = <&clks MPC512x_CLK_PSC9>,
-				 <&clks MPC512x_CLK_PSC9_MCLK>;
-			clock-names = "ipg", "mclk";
-		};
-
-		pscfifo@11f00 {
-			compatible = "fsl,mpc5121-psc-fifo";
-			reg = <0x11f00 0x100>;
-			interrupts = <40 0x8>;
-			clocks = <&clks MPC512x_CLK_PSC_FIFO>;
-			clock-names = "ipg";
-		};
-
-		dma0: dma@14000 {
-			compatible = "fsl,mpc5121-dma"; // BSP name: "mpc512x-dma2"
-			reg = <0x14000 0x1800>;
-			interrupts = <65 0x8>;
-			#dma-cells = <1>;
-		};
-	};
-};
diff --git a/arch/powerpc/boot/dts/mpc5200b.dtsi b/arch/powerpc/boot/dts/mpc5200b.dtsi
deleted file mode 100644
index 648fe31795f4..000000000000
--- a/arch/powerpc/boot/dts/mpc5200b.dtsi
+++ /dev/null
@@ -1,288 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * base MPC5200b Device Tree Source
- *
- * Copyright (C) 2010 SecretLab
- * Grant Likely <grant@secretlab.ca>
- * John Bonesio <bones@secretlab.ca>
- */
-
-/dts-v1/;
-
-/ {
-	model = "fsl,mpc5200b";
-	compatible = "fsl,mpc5200b";
-	#address-cells = <1>;
-	#size-cells = <1>;
-	interrupt-parent = <&mpc5200_pic>;
-
-	cpus {
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		powerpc: PowerPC,5200@0 {
-			device_type = "cpu";
-			reg = <0>;
-			d-cache-line-size = <32>;
-			i-cache-line-size = <32>;
-			d-cache-size = <0x4000>;	// L1, 16K
-			i-cache-size = <0x4000>;	// L1, 16K
-			timebase-frequency = <0>;	// from bootloader
-			bus-frequency = <0>;		// from bootloader
-			clock-frequency = <0>;		// from bootloader
-		};
-	};
-
-	memory: memory {
-		device_type = "memory";
-		reg = <0x00000000 0x04000000>;	// 64MB
-	};
-
-	soc: soc5200@f0000000 {
-		#address-cells = <1>;
-		#size-cells = <1>;
-		compatible = "fsl,mpc5200b-immr";
-		ranges = <0 0xf0000000 0x0000c000>;
-		reg = <0xf0000000 0x00000100>;
-		bus-frequency = <0>;		// from bootloader
-		system-frequency = <0>;		// from bootloader
-
-		cdm@200 {
-			compatible = "fsl,mpc5200b-cdm","fsl,mpc5200-cdm";
-			reg = <0x200 0x38>;
-		};
-
-		mpc5200_pic: interrupt-controller@500 {
-			// 5200 interrupts are encoded into two levels;
-			interrupt-controller;
-			#interrupt-cells = <3>;
-			compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic";
-			reg = <0x500 0x80>;
-		};
-
-		gpt0: timer@600 {	// General Purpose Timer
-			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
-			#gpio-cells = <2>;  // Add 'gpio-controller;' to enable gpio mode
-			reg = <0x600 0x10>;
-			interrupts = <1 9 0>;
-			// add 'fsl,has-wdt' to enable watchdog
-		};
-
-		gpt1: timer@610 {	// General Purpose Timer
-			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
-			#gpio-cells = <2>;  // Add 'gpio-controller;' to enable gpio mode
-			reg = <0x610 0x10>;
-			interrupts = <1 10 0>;
-		};
-
-		gpt2: timer@620 {	// General Purpose Timer
-			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
-			#gpio-cells = <2>;  // Add 'gpio-controller;' to enable gpio mode
-			reg = <0x620 0x10>;
-			interrupts = <1 11 0>;
-		};
-
-		gpt3: timer@630 {	// General Purpose Timer
-			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
-			#gpio-cells = <2>;  // Add 'gpio-controller;' to enable gpio mode
-			reg = <0x630 0x10>;
-			interrupts = <1 12 0>;
-		};
-
-		gpt4: timer@640 {	// General Purpose Timer
-			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
-			#gpio-cells = <2>;  // Add 'gpio-controller;' to enable gpio mode
-			reg = <0x640 0x10>;
-			interrupts = <1 13 0>;
-		};
-
-		gpt5: timer@650 {	// General Purpose Timer
-			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
-			#gpio-cells = <2>;  // Add 'gpio-controller;' to enable gpio mode
-			reg = <0x650 0x10>;
-			interrupts = <1 14 0>;
-		};
-
-		gpt6: timer@660 {	// General Purpose Timer
-			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
-			#gpio-cells = <2>;  // Add 'gpio-controller;' to enable gpio mode
-			reg = <0x660 0x10>;
-			interrupts = <1 15 0>;
-		};
-
-		gpt7: timer@670 {	// General Purpose Timer
-			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
-			#gpio-cells = <2>;  // Add 'gpio-controller;' to enable gpio mode
-			reg = <0x670 0x10>;
-			interrupts = <1 16 0>;
-		};
-
-		rtc@800 {	// Real time clock
-			compatible = "fsl,mpc5200b-rtc","fsl,mpc5200-rtc";
-			reg = <0x800 0x100>;
-			interrupts = <1 5 0 1 6 0>;
-		};
-
-		can@900 {
-			compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan";
-			interrupts = <2 17 0>;
-			reg = <0x900 0x80>;
-		};
-
-		can@980 {
-			compatible = "fsl,mpc5200b-mscan","fsl,mpc5200-mscan";
-			interrupts = <2 18 0>;
-			reg = <0x980 0x80>;
-		};
-
-		gpio_simple: gpio@b00 {
-			compatible = "fsl,mpc5200b-gpio","fsl,mpc5200-gpio";
-			reg = <0xb00 0x40>;
-			interrupts = <1 7 0>;
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-
-		gpio_wkup: gpio@c00 {
-			compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup";
-			reg = <0xc00 0x40>;
-			interrupts = <1 8 0 0 3 0>;
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-
-		spi@f00 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi";
-			reg = <0xf00 0x20>;
-			interrupts = <2 13 0 2 14 0>;
-		};
-
-		usb: usb@1000 {
-			compatible = "fsl,mpc5200b-ohci","fsl,mpc5200-ohci","ohci-be";
-			reg = <0x1000 0xff>;
-			interrupts = <2 6 0>;
-		};
-
-		dma-controller@1200 {
-			compatible = "fsl,mpc5200b-bestcomm","fsl,mpc5200-bestcomm";
-			reg = <0x1200 0x80>;
-			interrupts = <3 0 0  3 1 0  3 2 0  3 3 0
-			              3 4 0  3 5 0  3 6 0  3 7 0
-			              3 8 0  3 9 0  3 10 0  3 11 0
-			              3 12 0  3 13 0  3 14 0  3 15 0>;
-		};
-
-		xlb@1f00 {
-			compatible = "fsl,mpc5200b-xlb","fsl,mpc5200-xlb";
-			reg = <0x1f00 0x100>;
-		};
-
-		psc1: psc@2000 {		// PSC1
-			compatible = "fsl,mpc5200b-psc","fsl,mpc5200-psc";
-			reg = <0x2000 0x100>;
-			interrupts = <2 1 0>;
-		};
-
-		psc2: psc@2200 {		// PSC2
-			compatible = "fsl,mpc5200b-psc","fsl,mpc5200-psc";
-			reg = <0x2200 0x100>;
-			interrupts = <2 2 0>;
-		};
-
-		psc3: psc@2400 {		// PSC3
-			compatible = "fsl,mpc5200b-psc","fsl,mpc5200-psc";
-			reg = <0x2400 0x100>;
-			interrupts = <2 3 0>;
-		};
-
-		psc4: psc@2600 {		// PSC4
-			compatible = "fsl,mpc5200b-psc","fsl,mpc5200-psc";
-			reg = <0x2600 0x100>;
-			interrupts = <2 11 0>;
-		};
-
-		psc5: psc@2800 {		// PSC5
-			compatible = "fsl,mpc5200b-psc","fsl,mpc5200-psc";
-			reg = <0x2800 0x100>;
-			interrupts = <2 12 0>;
-		};
-
-		psc6: psc@2c00 {		// PSC6
-			compatible = "fsl,mpc5200b-psc","fsl,mpc5200-psc";
-			reg = <0x2c00 0x100>;
-			interrupts = <2 4 0>;
-		};
-
-		eth0: ethernet@3000 {
-			compatible = "fsl,mpc5200b-fec","fsl,mpc5200-fec";
-			reg = <0x3000 0x400>;
-			local-mac-address = [ 00 00 00 00 00 00 ];
-			interrupts = <2 5 0>;
-		};
-
-		mdio@3000 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			compatible = "fsl,mpc5200b-mdio","fsl,mpc5200-mdio";
-			reg = <0x3000 0x400>;	// fec range, since we need to setup fec interrupts
-			interrupts = <2 5 0>;	// these are for "mii command finished", not link changes & co.
-		};
-
-		ata@3a00 {
-			compatible = "fsl,mpc5200b-ata","fsl,mpc5200-ata";
-			reg = <0x3a00 0x100>;
-			interrupts = <2 7 0>;
-		};
-
-		sclpc@3c00 {
-			compatible = "fsl,mpc5200-lpbfifo";
-			reg = <0x3c00 0x60>;
-			interrupts = <2 23 0>;
-		};
-
-		i2c@3d00 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
-			reg = <0x3d00 0x40>;
-			interrupts = <2 15 0>;
-		};
-
-		i2c@3d40 {
-			#address-cells = <1>;
-			#size-cells = <0>;
-			compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
-			reg = <0x3d40 0x40>;
-			interrupts = <2 16 0>;
-		};
-
-		sram@8000 {
-			compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram";
-			reg = <0x8000 0x4000>;
-		};
-	};
-
-	pci: pci@f0000d00 {
-		#interrupt-cells = <1>;
-		#size-cells = <2>;
-		#address-cells = <3>;
-		device_type = "pci";
-		compatible = "fsl,mpc5200b-pci","fsl,mpc5200-pci";
-		reg = <0xf0000d00 0x100>;
-		// interrupt-map-mask = need to add
-		// interrupt-map = need to add
-		clock-frequency = <0>; // From boot loader
-		interrupts = <2 8 0 2 9 0 2 10 0>;
-		bus-range = <0 0>;
-		// ranges = need to add
-	};
-
-	localbus: localbus {
-		compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus";
-		#address-cells = <2>;
-		#size-cells = <1>;
-		ranges = <0 0 0xfc000000 0x2000000>;
-	};
-};
diff --git a/arch/powerpc/boot/dts/mucmc52.dts b/arch/powerpc/boot/dts/mucmc52.dts
deleted file mode 100644
index c6c66306308d..000000000000
--- a/arch/powerpc/boot/dts/mucmc52.dts
+++ /dev/null
@@ -1,222 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Manroland mucmc52 board Device Tree Source
- *
- * Copyright (C) 2009 DENX Software Engineering GmbH
- * Heiko Schocher <hs@denx.de>
- * Copyright 2006-2007 Secret Lab Technologies Ltd.
- */
-
-/include/ "mpc5200b.dtsi"
-
-/* Timer pins that need to be in GPIO mode */
-&gpt0 { gpio-controller; };
-&gpt1 { gpio-controller; };
-&gpt2 { gpio-controller; };
-&gpt3 { gpio-controller; };
-
-/* Disabled timers */
-&gpt4 { status = "disabled"; };
-&gpt5 { status = "disabled"; };
-&gpt6 { status = "disabled"; };
-&gpt7 { status = "disabled"; };
-
-/ {
-	model = "manroland,mucmc52";
-	compatible = "manroland,mucmc52";
-
-	soc5200@f0000000 {
-		rtc@800 {
-			status = "disabled";
-		};
-
-		can@900 {
-			status = "disabled";
-		};
-
-		can@980 {
-			status = "disabled";
-		};
-
-		spi@f00 {
-			status = "disabled";
-		};
-
-		usb@1000 {
-			status = "disabled";
-		};
-
-		psc@2000 {		// PSC1
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		psc@2200 {		// PSC2
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		psc@2400 {		// PSC3
-			status = "disabled";
-		};
-
-		psc@2600 {		// PSC4
-			status = "disabled";
-		};
-
-		psc@2800 {		// PSC5
-			status = "disabled";
-		};
-
-		psc@2c00 {		// PSC6
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		ethernet@3000 {
-			phy-handle = <&phy0>;
-		};
-
-		mdio@3000 {
-			phy0: ethernet-phy@0 {
-				compatible = "intel,lxt971";
-				reg = <0>;
-			};
-		};
-
-		i2c@3d00 {
-			status = "disabled";
-		};
-
-		i2c@3d40 {
-			hwmon@2c {
-				compatible = "ad,adm9240";
-				reg = <0x2c>;
-			};
-			rtc@51 {
-				compatible = "nxp,pcf8563";
-				reg = <0x51>;
-			};
-		};
-	};
-
-	pci@f0000d00 {
-		interrupt-map-mask = <0xf800 0 0 7>;
-		interrupt-map = <
-				/* IDSEL 0x10 */
-				0x8000 0 0 1 &mpc5200_pic 0 3 3
-				0x8000 0 0 2 &mpc5200_pic 0 3 3
-				0x8000 0 0 3 &mpc5200_pic 0 2 3
-				0x8000 0 0 4 &mpc5200_pic 0 1 3
-				>;
-		ranges = <0x42000000 0 0x60000000 0x60000000 0 0x10000000
-			  0x02000000 0 0x90000000 0x90000000 0 0x10000000
-			  0x01000000 0 0x00000000 0xa0000000 0 0x01000000>;
-	};
-
-	localbus {
-		ranges = <0 0 0xff800000 0x00800000
-			  1 0 0x80000000 0x00800000
-			  3 0 0x80000000 0x00800000>;
-
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0 0x00800000>;
-			bank-width = <4>;
-			device-width = <2>;
-			#size-cells = <1>;
-			#address-cells = <1>;
-			partition@0 {
-				label = "DTS";
-				reg = <0x0 0x00100000>;
-			};
-			partition@100000 {
-				label = "Kernel";
-				reg = <0x100000 0x00200000>;
-			};
-			partition@300000 {
-				label = "RootFS";
-				reg = <0x00300000 0x00200000>;
-			};
-			partition@500000 {
-				label = "user";
-				reg = <0x00500000 0x00200000>;
-			};
-			partition@700000 {
-				label = "U-Boot";
-				reg = <0x00700000 0x00040000>;
-			};
-			partition@740000 {
-				label = "Env";
-				reg = <0x00740000 0x00020000>;
-			};
-			partition@760000 {
-				label = "red. Env";
-				reg = <0x00760000 0x00020000>;
-			};
-			partition@780000 {
-				label = "reserve";
-				reg = <0x00780000 0x00080000>;
-			};
-		};
-
-		simple100: gpio-controller-100@3,600100 {
-			compatible = "manroland,mucmc52-aux-gpio";
-			reg = <3 0x00600100 0x1>;
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-		simple104: gpio-controller-104@3,600104 {
-			compatible = "manroland,mucmc52-aux-gpio";
-			reg = <3 0x00600104 0x1>;
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-		simple200: gpio-controller-200@3,600200 {
-			compatible = "manroland,mucmc52-aux-gpio";
-			reg = <3 0x00600200 0x1>;
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-		simple201: gpio-controller-201@3,600201 {
-			compatible = "manroland,mucmc52-aux-gpio";
-			reg = <3 0x00600201 0x1>;
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-		simple202: gpio-controller-202@3,600202 {
-			compatible = "manroland,mucmc52-aux-gpio";
-			reg = <3 0x00600202 0x1>;
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-		simple203: gpio-controller-203@3,600203 {
-			compatible = "manroland,mucmc52-aux-gpio";
-			reg = <3 0x00600203 0x1>;
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-		simple204: gpio-controller-204@3,600204 {
-			compatible = "manroland,mucmc52-aux-gpio";
-			reg = <3 0x00600204 0x1>;
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-		simple206: gpio-controller-206@3,600206 {
-			compatible = "manroland,mucmc52-aux-gpio";
-			reg = <3 0x00600206 0x1>;
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-		simple207: gpio-controller-207@3,600207 {
-			compatible = "manroland,mucmc52-aux-gpio";
-			reg = <3 0x00600207 0x1>;
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-		simple20f: gpio-controller-20f@3,60020f {
-			compatible = "manroland,mucmc52-aux-gpio";
-			reg = <3 0x0060020f 0x1>;
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-
-	};
-};
diff --git a/arch/powerpc/boot/dts/o2d.dts b/arch/powerpc/boot/dts/o2d.dts
deleted file mode 100644
index 24a46f65e529..000000000000
--- a/arch/powerpc/boot/dts/o2d.dts
+++ /dev/null
@@ -1,43 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * O2D Device Tree Source
- *
- * Copyright (C) 2012 DENX Software Engineering
- * Anatolij Gustschin <agust@denx.de>
- */
-
-/include/ "o2d.dtsi"
-
-/ {
-	model = "ifm,o2d";
-	compatible = "ifm,o2d";
-
-	memory {
-		reg = <0x00000000 0x08000000>;  // 128MB
-	};
-
-	localbus {
-		ranges = <0 0 0xfc000000 0x02000000
-			  3 0 0xe3000000 0x00100000>;
-
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0 0x02000000>;
-			bank-width = <2>;
-			device-width = <2>;
-			#size-cells = <1>;
-			#address-cells = <1>;
-
-			partition@60000 {
-				label = "kernel";
-				reg = <0x00060000 0x00260000>;
-				read-only;
-			};
-			/* o2d specific partitions */
-			partition@2c0000 {
-				label = "o2d user defined";
-				reg = <0x002c0000 0x01d40000>;
-			};
-		};
-	};
-};
diff --git a/arch/powerpc/boot/dts/o2d.dtsi b/arch/powerpc/boot/dts/o2d.dtsi
deleted file mode 100644
index 6661955a2be4..000000000000
--- a/arch/powerpc/boot/dts/o2d.dtsi
+++ /dev/null
@@ -1,118 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * O2D base Device Tree Source
- *
- * Copyright (C) 2012 DENX Software Engineering
- * Anatolij Gustschin <agust@denx.de>
- */
-
-/include/ "mpc5200b.dtsi"
-
-&gpt0 {
-	gpio-controller;
-	fsl,has-wdt;
-	fsl,wdt-on-boot = <0>;
-};
-&gpt1 { gpio-controller; };
-
-/ {
-	model = "ifm,o2d";
-	compatible = "ifm,o2d";
-
-	memory {
-		reg = <0x00000000 0x04000000>;	// 64MB
-	};
-
-	soc5200@f0000000 {
-
-		rtc@800 {
-			status = "disabled";
-		};
-
-		psc@2000 {		// PSC1
-			compatible = "fsl,mpc5200b-psc-spi","fsl,mpc5200-psc-spi";
-			#address-cells = <1>;
-			#size-cells = <0>;
-			cell-index = <0>;
-
-			spidev@0 {
-				compatible = "spidev";
-				spi-max-frequency = <250000>;
-				reg = <0>;
-			};
-		};
-
-		psc@2200 {		// PSC2
-			status = "disabled";
-		};
-
-		psc@2400 {		// PSC3
-			status = "disabled";
-		};
-
-		psc@2600 {		// PSC4
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		psc@2800 {		// PSC5
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		psc@2c00 {		// PSC6
-			status = "disabled";
-		};
-
-		ethernet@3000 {
-			phy-handle = <&phy0>;
-		};
-
-		mdio@3000 {
-			phy0: ethernet-phy@0 {
-				reg = <0>;
-			};
-		};
-	};
-
-	localbus {
-		ranges = <0 0 0xff000000 0x01000000
-			  3 0 0xe3000000 0x00100000>;
-
-		// flash device at LocalPlus Bus CS0
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0 0x01000000>;
-			bank-width = <1>;
-			device-width = <2>;
-			#size-cells = <1>;
-			#address-cells = <1>;
-			no-unaligned-direct-access;
-
-			/* common layout for all machines */
-			partition@0 {
-				label = "u-boot";
-				reg = <0x00000000 0x00040000>;
-				read-only;
-			};
-			partition@40000 {
-				label = "env";
-				reg = <0x00040000 0x00020000>;
-				read-only;
-			};
-		};
-
-		csi@3,0 {
-			compatible = "ifm,o2d-csi";
-			reg = <3 0 0x00100000>;
-			ifm,csi-clk-handle = <&gpt7>;
-			gpios = <&gpio_simple 23 0	/* imag_capture */
-				 &gpio_simple 26 0	/* imag_reset */
-				 &gpio_simple 29 0>;	/* imag_master_en */
-
-			interrupts = <1 1 2>;		/* IRQ1, edge falling */
-
-			ifm,csi-addr-bus-width = <24>;
-			ifm,csi-data-bus-width = <8>;
-			ifm,csi-wait-cycles = <0>;
-		};
-	};
-};
diff --git a/arch/powerpc/boot/dts/o2d300.dts b/arch/powerpc/boot/dts/o2d300.dts
deleted file mode 100644
index 55a25b700bed..000000000000
--- a/arch/powerpc/boot/dts/o2d300.dts
+++ /dev/null
@@ -1,48 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * O2D300 Device Tree Source
- *
- * Copyright (C) 2012 DENX Software Engineering
- * Anatolij Gustschin <agust@denx.de>
- */
-
-/include/ "o2d.dtsi"
-
-/ {
-	model = "ifm,o2d300";
-	compatible = "ifm,o2d";
-
-	localbus {
-		ranges = <0 0 0xfc000000 0x02000000
-			  3 0 0xe3000000 0x00100000>;
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0 0x02000000>;
-			bank-width = <2>;
-			device-width = <2>;
-			#size-cells = <1>;
-			#address-cells = <1>;
-
-			partition@40000 {
-				label = "env_1";
-				reg = <0x00040000 0x00020000>;
-				read-only;
-			};
-			partition@60000 {
-				label = "env_2";
-				reg = <0x00060000 0x00020000>;
-				read-only;
-			};
-			partition@80000 {
-				label = "kernel";
-				reg = <0x00080000 0x00260000>;
-				read-only;
-			};
-			/* o2d300 specific partitions */
-			partition@2e0000 {
-				label = "o2d300 user defined";
-				reg = <0x002e0000 0x01d20000>;
-			};
-		};
-	};
-};
diff --git a/arch/powerpc/boot/dts/o2dnt2.dts b/arch/powerpc/boot/dts/o2dnt2.dts
deleted file mode 100644
index eeba7f5507d5..000000000000
--- a/arch/powerpc/boot/dts/o2dnt2.dts
+++ /dev/null
@@ -1,44 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * O2DNT2 Device Tree Source
- *
- * Copyright (C) 2012 DENX Software Engineering
- * Anatolij Gustschin <agust@denx.de>
- */
-
-/include/ "o2d.dtsi"
-
-/ {
-	model = "ifm,o2dnt2";
-	compatible = "ifm,o2d";
-
-	memory {
-		reg = <0x00000000 0x08000000>;  // 128MB
-	};
-
-	localbus {
-		ranges = <0 0 0xfc000000 0x02000000
-			  3 0 0xe3000000 0x00100000>;
-
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0 0x02000000>;
-			bank-width = <2>;
-			device-width = <2>;
-			#size-cells = <1>;
-			#address-cells = <1>;
-
-			partition@60000 {
-				label = "kernel";
-				reg = <0x00060000 0x00260000>;
-				read-only;
-			};
-
-			/* o2dnt2 specific partitions */
-			partition@2c0000 {
-				label = "o2dnt2 user defined";
-				reg = <0x002c0000 0x01d40000>;
-			};
-		};
-	};
-};
diff --git a/arch/powerpc/boot/dts/o2i.dts b/arch/powerpc/boot/dts/o2i.dts
deleted file mode 100644
index 3fb2e0ad7387..000000000000
--- a/arch/powerpc/boot/dts/o2i.dts
+++ /dev/null
@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * O2I Device Tree Source
- *
- * Copyright (C) 2012 DENX Software Engineering
- * Anatolij Gustschin <agust@denx.de>
- */
-
-/include/ "o2d.dtsi"
-
-/ {
-	model = "ifm,o2i";
-	compatible = "ifm,o2d";
-
-	localbus {
-		flash@0,0 {
-			partition@60000 {
-				label = "kernel";
-				reg = <0x00060000 0x00260000>;
-				read-only;
-			};
-			/* o2i specific partitions */
-			partition@2c0000 {
-				label = "o2i user defined";
-				reg = <0x002c0000 0x00d40000>;
-			};
-		};
-	};
-};
diff --git a/arch/powerpc/boot/dts/o2mnt.dts b/arch/powerpc/boot/dts/o2mnt.dts
deleted file mode 100644
index c5e0ba6e8f2b..000000000000
--- a/arch/powerpc/boot/dts/o2mnt.dts
+++ /dev/null
@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * O2MNT Device Tree Source
- *
- * Copyright (C) 2012 DENX Software Engineering
- * Anatolij Gustschin <agust@denx.de>
- */
-
-/include/ "o2d.dtsi"
-
-/ {
-	model = "ifm,o2mnt";
-	compatible = "ifm,o2d";
-
-	localbus {
-		flash@0,0 {
-			partition@60000 {
-				label = "kernel";
-				reg = <0x00060000 0x00260000>;
-				read-only;
-			};
-			/* add o2mnt specific partitions */
-			partition@2c0000 {
-				label = "o2mnt user defined";
-				reg = <0x002c0000 0x00d40000>;
-			};
-		};
-	};
-};
diff --git a/arch/powerpc/boot/dts/o3dnt.dts b/arch/powerpc/boot/dts/o3dnt.dts
deleted file mode 100644
index fd00396b0593..000000000000
--- a/arch/powerpc/boot/dts/o3dnt.dts
+++ /dev/null
@@ -1,44 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * O3DNT Device Tree Source
- *
- * Copyright (C) 2012 DENX Software Engineering
- * Anatolij Gustschin <agust@denx.de>
- */
-
-/include/ "o2d.dtsi"
-
-/ {
-	model = "ifm,o3dnt";
-	compatible = "ifm,o2d";
-
-	memory {
-		reg = <0x00000000 0x04000000>;  // 64MB
-	};
-
-	localbus {
-		ranges = <0 0 0xfc000000 0x01000000
-			  3 0 0xe3000000 0x00100000>;
-
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0 0x01000000>;
-			bank-width = <2>;
-			device-width = <2>;
-			#size-cells = <1>;
-			#address-cells = <1>;
-
-			partition@60000 {
-				label = "kernel";
-				reg = <0x00060000 0x00260000>;
-				read-only;
-			};
-
-			/* o3dnt specific partitions */
-			partition@2c0000 {
-				label = "o3dnt user defined";
-				reg = <0x002c0000 0x00d40000>;
-			};
-		};
-	};
-};
diff --git a/arch/powerpc/boot/dts/pcm030.dts b/arch/powerpc/boot/dts/pcm030.dts
deleted file mode 100644
index b1bc731f7afd..000000000000
--- a/arch/powerpc/boot/dts/pcm030.dts
+++ /dev/null
@@ -1,106 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * phyCORE-MPC5200B-tiny (pcm030) board Device Tree Source
- *
- * Copyright 2006 Pengutronix
- * Sascha Hauer <s.hauer@pengutronix.de>
- * Copyright 2007 Pengutronix
- * Juergen Beisert <j.beisert@pengutronix.de>
- */
-
-/include/ "mpc5200b.dtsi"
-
-&gpt0 { fsl,has-wdt; };
-&gpt2 { gpio-controller; };
-&gpt3 { gpio-controller; };
-&gpt4 { gpio-controller; };
-&gpt5 { gpio-controller; };
-&gpt6 { gpio-controller; };
-&gpt7 { gpio-controller; };
-
-/ {
-	model = "phytec,pcm030";
-	compatible = "phytec,pcm030";
-
-	soc5200@f0000000 {
-		audioplatform: psc@2000 { /* PSC1 in ac97 mode */
-			compatible = "mpc5200b-psc-ac97","fsl,mpc5200b-psc-ac97";
-			cell-index = <0>;
-		};
-
-		/* PSC2 port is used by CAN1/2 */
-		psc@2200 {
-			status = "disabled";
-		};
-
-		psc@2400 { /* PSC3 in UART mode */
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		/* PSC4 is ??? */
-		psc@2600 {
-			status = "disabled";
-		};
-
-		/* PSC5 is ??? */
-		psc@2800 {
-			status = "disabled";
-		};
-
-		psc@2c00 { /* PSC6 in UART mode */
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		ethernet@3000 {
-			phy-handle = <&phy0>;
-		};
-
-		mdio@3000 {
-			phy0: ethernet-phy@0 {
-				reg = <0>;
-			};
-		};
-
-		i2c@3d40 {
-			rtc@51 {
-				compatible = "nxp,pcf8563";
-				reg = <0x51>;
-			};
-			eeprom@52 {
-				compatible = "catalyst,24c32", "atmel,24c32";
-				reg = <0x52>;
-				pagesize = <32>;
-			};
-		};
-
-		sram@8000 {
-			compatible = "fsl,mpc5200b-sram","fsl,mpc5200-sram";
-			reg = <0x8000 0x4000>;
-		};
-	};
-
-	pci@f0000d00 {
-		interrupt-map-mask = <0xf800 0 0 7>;
-		interrupt-map = <0xc000 0 0 1 &mpc5200_pic 0 0 3 // 1st slot
-				 0xc000 0 0 2 &mpc5200_pic 1 1 3
-				 0xc000 0 0 3 &mpc5200_pic 1 2 3
-				 0xc000 0 0 4 &mpc5200_pic 1 3 3
-
-				 0xc800 0 0 1 &mpc5200_pic 1 1 3 // 2nd slot
-				 0xc800 0 0 2 &mpc5200_pic 1 2 3
-				 0xc800 0 0 3 &mpc5200_pic 1 3 3
-				 0xc800 0 0 4 &mpc5200_pic 0 0 3>;
-		ranges = <0x42000000 0 0x80000000 0x80000000 0 0x20000000
-			  0x02000000 0 0xa0000000 0xa0000000 0 0x10000000
-			  0x01000000 0 0x00000000 0xb0000000 0 0x01000000>;
-	};
-
-	localbus {
-		status = "disabled";
-	};
-
-	sound {
-		compatible = "phytec,pcm030-audio-fabric";
-		asoc-platform = <&audioplatform>;
-	};
-};
diff --git a/arch/powerpc/boot/dts/pcm032.dts b/arch/powerpc/boot/dts/pcm032.dts
deleted file mode 100644
index 780e13d99e7b..000000000000
--- a/arch/powerpc/boot/dts/pcm032.dts
+++ /dev/null
@@ -1,183 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * phyCORE-MPC5200B-IO (pcm032) board Device Tree Source
- *
- * Copyright (C) 2006-2009 Pengutronix
- * Sascha Hauer, Juergen Beisert, Wolfram Sang <kernel@pengutronix.de>
- */
-
-/include/ "mpc5200b.dtsi"
-
-&gpt0 { fsl,has-wdt; };
-&gpt2 { gpio-controller; };
-&gpt3 { gpio-controller; };
-&gpt4 { gpio-controller; };
-&gpt5 { gpio-controller; };
-&gpt6 { gpio-controller; };
-&gpt7 { gpio-controller; };
-
-/ {
-	model = "phytec,pcm032";
-	compatible = "phytec,pcm032";
-
-	memory {
-		reg = <0x00000000 0x08000000>;	// 128MB
-	};
-
-	soc5200@f0000000 {
-		psc@2000 {	/* PSC1 is ac97 */
-			compatible = "fsl,mpc5200b-psc-ac97","fsl,mpc5200-psc-ac97";
-			cell-index = <0>;
-		};
-
-		/* PSC2 port is used by CAN1/2 */
-		psc@2200 {
-			status = "disabled";
-		};
-
-		psc@2400 { /* PSC3 in UART mode */
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		/* PSC4 is ??? */
-		psc@2600 {
-			status = "disabled";
-		};
-
-		/* PSC5 is ??? */
-		psc@2800 {
-			status = "disabled";
-		};
-
-		psc@2c00 { /* PSC6 in UART mode */
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		ethernet@3000 {
-			phy-handle = <&phy0>;
-		};
-
-		mdio@3000 {
-			phy0: ethernet-phy@0 {
-				reg = <0>;
-			};
-		};
-
-		i2c@3d40 {
-			rtc@51 {
-				compatible = "nxp,pcf8563";
-				reg = <0x51>;
-			};
-			eeprom@52 {
-				compatible = "catalyst,24c32", "atmel,24c32";
-				reg = <0x52>;
-				pagesize = <32>;
-			};
-		};
-	};
-
-	pci@f0000d00 {
-		interrupt-map-mask = <0xf800 0 0 7>;
-		interrupt-map = <0xc000 0 0 1 &mpc5200_pic 0 0 3 // 1st slot
-				 0xc000 0 0 2 &mpc5200_pic 1 1 3
-				 0xc000 0 0 3 &mpc5200_pic 1 2 3
-				 0xc000 0 0 4 &mpc5200_pic 1 3 3
-
-				 0xc800 0 0 1 &mpc5200_pic 1 1 3 // 2nd slot
-				 0xc800 0 0 2 &mpc5200_pic 1 2 3
-				 0xc800 0 0 3 &mpc5200_pic 1 3 3
-				 0xc800 0 0 4 &mpc5200_pic 0 0 3>;
-		ranges = <0x42000000 0 0x80000000 0x80000000 0 0x20000000
-			  0x02000000 0 0xa0000000 0xa0000000 0 0x10000000
-			  0x01000000 0 0x00000000 0xb0000000 0 0x01000000>;
-	};
-
-	localbus {
-		ranges = <0 0 0xfe000000 0x02000000
-			  1 0 0xfc000000 0x02000000
-			  2 0 0xfbe00000 0x00200000
-			  3 0 0xf9e00000 0x02000000
-			  4 0 0xf7e00000 0x02000000
-			  5 0 0xe6000000 0x02000000
-			  6 0 0xe8000000 0x02000000
-			  7 0 0xea000000 0x02000000>;
-
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0 0x02000000>;
-			bank-width = <4>;
-			#size-cells = <1>;
-			#address-cells = <1>;
-
-			partition@0 {
-				label = "ubootl";
-				reg = <0x00000000 0x00040000>;
-			};
-			partition@40000 {
-				label = "kernel";
-				reg = <0x00040000 0x001c0000>;
-			};
-			partition@200000 {
-				label = "jffs2";
-				reg = <0x00200000 0x01d00000>;
-			};
-			partition@1f00000 {
-				label = "uboot";
-				reg = <0x01f00000 0x00040000>;
-			};
-			partition@1f40000 {
-				label = "env";
-				reg = <0x01f40000 0x00040000>;
-			};
-			partition@1f80000 {
-				label = "oftree";
-				reg = <0x01f80000 0x00040000>;
-			};
-			partition@1fc0000 {
-				label = "space";
-				reg = <0x01fc0000 0x00040000>;
-			};
-		};
-
-		sram@2,0 {
-			compatible = "mtd-ram";
-			reg = <2 0 0x00200000>;
-			bank-width = <2>;
-		};
-
-		/*
-		 * example snippets for FPGA
-		 *
-		 * fpga@3,0 {
-		 *	 compatible = "fpga_driver";
-		 *	 reg = <3 0 0x02000000>;
-		 *	 bank-width = <4>;
-		 * };
-		 *
-		 * fpga@4,0 {
-		 *	 compatible = "fpga_driver";
-		 *	 reg = <4 0 0x02000000>;
-		 *	 bank-width = <4>;
-		 * };
-		 */
-
-		/*
-		 * example snippets for free chipselects
-		 *
-		 * device@5,0 {
-		 *	 compatible = "custom_driver";
-		 *	 reg = <5 0 0x02000000>;
-		 * };
-		 *
-		 * device@6,0 {
-		 *	 compatible = "custom_driver";
-		 *	 reg = <6 0 0x02000000>;
-		 * };
-		 *
-		 * device@7,0 {
-		 *	 compatible = "custom_driver";
-		 *	 reg = <7 0 0x02000000>;
-		 * };
-		 */
-	};
-};
diff --git a/arch/powerpc/boot/dts/pdm360ng.dts b/arch/powerpc/boot/dts/pdm360ng.dts
deleted file mode 100644
index 67c3b9db75d7..000000000000
--- a/arch/powerpc/boot/dts/pdm360ng.dts
+++ /dev/null
@@ -1,195 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Device Tree Source for IFM PDM360NG.
- *
- * Copyright 2009 - 2010 DENX Software Engineering.
- * Anatolij Gustschin <agust@denx.de>
- *
- * Based on MPC5121E ADS dts.
- * Copyright 2008 Freescale Semiconductor Inc.
- */
-
-#include "mpc5121.dtsi"
-
-/ {
-	model = "pdm360ng";
-	compatible = "ifm,pdm360ng", "fsl,mpc5121";
-	#address-cells = <1>;
-	#size-cells = <1>;
-	interrupt-parent = <&ipic>;
-
-	memory {
-		device_type = "memory";
-		reg = <0x00000000 0x20000000>;	// 512MB at 0
-	};
-
-	nfc@40000000 {
-		bank-width = <0x1>;
-		chips = <0x1>;
-
-		partition@0 {
-			label = "nand0";
-			reg = <0x0 0x40000000>;
-		};
-	};
-
-	localbus@80000020 {
-		ranges = <0x0 0x0 0xf0000000 0x10000000   /* Flash */
-			  0x2 0x0 0x50040000 0x00020000>; /* CS2: MRAM */
-
-		flash@0,0 {
-			compatible = "amd,s29gl01gp", "cfi-flash";
-			reg = <0 0x00000000 0x08000000
-			       0 0x08000000 0x08000000>;
-			#address-cells = <1>;
-			#size-cells = <1>;
-			bank-width = <4>;
-			device-width = <2>;
-
-			partition@0 {
-				label = "u-boot";
-				reg = <0x00000000 0x00080000>;
-				read-only;
-			};
-			partition@80000 {
-				label = "environment";
-				reg = <0x00080000 0x00080000>;
-				read-only;
-			};
-			partition@100000 {
-				label = "splash-image";
-				reg = <0x00100000 0x00080000>;
-				read-only;
-			};
-			partition@180000 {
-				label = "device-tree";
-				reg = <0x00180000 0x00040000>;
-			};
-			partition@1c0000 {
-				label = "kernel";
-				reg = <0x001c0000 0x00500000>;
-			};
-			partition@6c0000 {
-				label = "filesystem";
-				reg = <0x006c0000 0x07940000>;
-			};
-		};
-
-		mram0@2,0 {
-			compatible = "mtd-ram";
-			reg = <2 0x00000 0x10000>;
-			bank-width = <2>;
-		};
-
-		mram1@2,10000 {
-			compatible = "mtd-ram";
-			reg = <2 0x010000 0x10000>;
-			bank-width = <2>;
-		};
-	};
-
-	soc@80000000 {
-
-		i2c@1700 {
-			fsl,preserve-clocking;
-
-			eeprom@50 {
-				compatible = "atmel,24c01";
-				reg = <0x50>;
-			};
-
-			rtc@68 {
-				compatible = "st,m41t00";
-				reg = <0x68>;
-			};
-		};
-
-		i2c@1720 {
-			status = "disabled";
-		};
-
-		i2c@1740 {
-			fsl,preserve-clocking;
-		};
-
-		ethernet@2800 {
-			phy-handle = <&phy0>;
-		};
-
-		mdio@2800 {
-			phy0: ethernet-phy@1f {
-				compatible = "smsc,lan8700";
-				reg = <0x1f>;
-			};
-		};
-
-		/* USB1 using external ULPI PHY */
-		usb@3000 {
-			dr_mode = "host";
-		};
-
-		/* USB0 using internal UTMI PHY */
-		usb@4000 {
-			fsl,invert-pwr-fault;
-		};
-
-		psc@11000 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-		};
-
-		psc@11100 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-		};
-
-		psc@11200 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-		};
-
-		psc@11300 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-		};
-
-		psc@11400 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-		};
-
-		psc@11500 {
-			status = "disabled";
-		};
-
-		psc@11600 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-		};
-
-		psc@11700 {
-			status = "disabled";
-		};
-
-		psc@11800 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-		};
-
-		psc@11900 {
-			compatible = "fsl,mpc5121-psc-spi", "fsl,mpc5121-psc";
-			#address-cells = <1>;
-			#size-cells = <0>;
-
-			/* ADS7845 touch screen controller */
-			ts@0 {
-				compatible = "ti,ads7846";
-				reg = <0x0>;
-				spi-max-frequency = <3000000>;
-				/* pen irq is GPIO25 */
-				interrupts = <78 0x8>;
-			};
-		};
-
-		psc@11a00 {
-			status = "disabled";
-		};
-
-		psc@11b00 {
-			compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
-		};
-	};
-};
diff --git a/arch/powerpc/boot/dts/uc101.dts b/arch/powerpc/boot/dts/uc101.dts
deleted file mode 100644
index 2e34d019178b..000000000000
--- a/arch/powerpc/boot/dts/uc101.dts
+++ /dev/null
@@ -1,152 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Manroland uc101 board Device Tree Source
- *
- * Copyright (C) 2009 DENX Software Engineering GmbH
- * Heiko Schocher <hs@denx.de>
- * Copyright 2006-2007 Secret Lab Technologies Ltd.
- */
-
-/include/ "mpc5200b.dtsi"
-
-&gpt0 { gpio-controller; };
-&gpt1 { gpio-controller; };
-&gpt2 { gpio-controller; };
-&gpt3 { gpio-controller; };
-&gpt4 { gpio-controller; };
-&gpt5 { gpio-controller; };
-&gpt6 { gpio-controller; };
-&gpt7 { gpio-controller; };
-
-/ {
-	model = "manroland,uc101";
-	compatible = "manroland,uc101";
-
-	soc5200@f0000000 {
-		rtc@800 {
-			status = "disabled";
-		};
-
-		can@900 {
-			status = "disabled";
-		};
-
-		can@980 {
-			status = "disabled";
-		};
-
-		spi@f00 {
-			status = "disabled";
-		};
-
-		usb@1000 {
-			status = "disabled";
-		};
-
-		psc@2000 {	// PSC1
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		psc@2200 {	// PSC2
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		psc@2400 {	// PSC3
-			status = "disabled";
-		};
-
-		psc@2600 {	// PSC4
-			status = "disabled";
-		};
-
-		psc@2800 {	// PSC5
-			status = "disabled";
-		};
-
-		psc@2c00 {	// PSC6
-			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
-		};
-
-		ethernet@3000 {
-			phy-handle = <&phy0>;
-		};
-
-		mdio@3000 {
-			phy0: ethernet-phy@0 {
-				compatible = "intel,lxt971";
-				reg = <0>;
-			};
-		};
-
-		i2c@3d00 {
-			status = "disabled";
-		};
-
-		i2c@3d40 {
-			fsl,preserve-clocking;
-			clock-frequency = <400000>;
-
-			hwmon@2c {
-				compatible = "ad,adm9240";
-				reg = <0x2c>;
-			};
-			rtc@51 {
-				compatible = "nxp,pcf8563";
-				reg = <0x51>;
-			};
-		};
-	};
-
-	pci@f0000d00 {
-		status = "disabled";
-	};
-
-	localbus {
-		ranges = <0 0 0xff800000 0x00800000
-			  1 0 0x80000000 0x00800000
-			  3 0 0x80000000 0x00800000>;
-
-		flash@0,0 {
-			compatible = "cfi-flash";
-			reg = <0 0 0x00800000>;
-			bank-width = <2>;
-			device-width = <2>;
-			#size-cells = <1>;
-			#address-cells = <1>;
-
-			partition@0 {
-				label = "DTS";
-				reg = <0x0 0x00100000>;
-			};
-			partition@100000 {
-				label = "Kernel";
-				reg = <0x100000 0x00200000>;
-			};
-			partition@300000 {
-				label = "RootFS";
-				reg = <0x00300000 0x00200000>;
-			};
-			partition@500000 {
-				label = "user";
-				reg = <0x00500000 0x00200000>;
-			};
-			partition@700000 {
-				label = "U-Boot";
-				reg = <0x00700000 0x00040000>;
-			};
-			partition@740000 {
-				label = "Env";
-				reg = <0x00740000 0x00010000>;
-			};
-			partition@750000 {
-				label = "red. Env";
-				reg = <0x00750000 0x00010000>;
-			};
-			partition@760000 {
-				label = "reserve";
-				reg = <0x00760000 0x000a0000>;
-			};
-		};
-
-	};
-};
-- 
2.30.2


^ permalink raw reply related

* Re: [PATCH] tpm: ibmvtpm: Make use of dma_alloc_coherent()
From: Jason Gunthorpe @ 2021-10-12 15:43 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: linux-kernel, Cai Huoqing, Paul Mackerras, Peter Huewe,
	linuxppc-dev, linux-integrity
In-Reply-To: <31619f2f192a4f1584e458f468422cf6e8f7542f.camel@kernel.org>

On Tue, Oct 12, 2021 at 06:29:58PM +0300, Jarkko Sakkinen wrote:
> On Mon, 2021-10-11 at 00:01 +0800, Cai Huoqing wrote:
> > Replacing kmalloc/kfree/get_zeroed_page/free_page/dma_map_single/
>   ~~~~~~~~~
>   Replace
> 
> > dma_unmap_single() with dma_alloc_coherent/dma_free_coherent()
> > helps to reduce code size, and simplify the code, and coherent
> > DMA will not clear the cache every time.
> > 
> > Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> 
> If this does not do functionally anything useful, there's no
> reason to apply this.

At least in this case it looks like the ibmvtpm is not using the DMA
API properly. There is no sync after each data transfer. Replacing
this wrong usage with the coherent API is reasonable.

Jason

^ permalink raw reply

* Re: [PATCH] powerpc: don't select KFENCE on platform PPC_FSL_BOOK3E
From: Christophe Leroy @ 2021-10-12 17:28 UTC (permalink / raw)
  To: Michael Ellerman, Liu Shixin, Marco Elver, Benjamin Herrenschmidt,
	Paul Mackerras
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <87bl3u7oay.fsf@mpe.ellerman.id.au>



Le 12/10/2021 à 08:24, Michael Ellerman a écrit :
> Liu Shixin <liushixin2@huawei.com> writes:
>> kindly ping.
> 
> I was under the impression you were trying to debug why it wasn't
> working with Christophe.

The investigation was a bit dormant to be honest since Liu confirmed 
that neither KFENCE not DEBUG_PAGEALLOC works.

I now looked at the effort to make it work, and it is not trivial.
At the time being, all linear space is mapped with pinned TLBs and 
everything is setup for space 0, with space 1 being used temporarily 
when doing heavy changes to space 0.

We can't use standard pages for linear space on space 0 because we need 
memory mapped at all time for exceptions (on booke exception run with 
MMU on in space 0).

In order to use standard pages, we'd need to reorganise the kernel to 
have it run mostly in space 1 (for data at least) where we would map 
almost everything with standard pages, and keep pinned TLB to map linear 
space on space 0 for TLB miss exceptions. Then we'd do more or less like 
book3s/32 and switch back into space 1 into other exceptions prolog.

That could be good to do it as we could maybe have more code in common 
with non booke 32 bits, but it is not a trivial job.

So I suggest that for now, we just make KFENCE and DEBUG_PAGEALLOC 
unselectable for booke/32 (e500 and 44x).

Christophe

> 
> cheers
> 
>> On 2021/9/24 14:39, Liu Shixin wrote:
>>> On platform PPC_FSL_BOOK3E, all lowmem is managed by tlbcam. That means
>>> we didn't really map the kfence pool with page granularity. Therefore,
>>> if KFENCE is enabled, the system will hit the following panic:
>>>
>>>      BUG: Kernel NULL pointer dereference on read at 0x00000000
>>>      Faulting instruction address: 0xc01de598
>>>      Oops: Kernel access of bad area, sig: 11 [#1]
>>>      BE PAGE_SIZE=4K SMP NR_CPUS=4 MPC8544 DS
>>>      Dumping ftrace buffer:
>>>         (ftrace buffer empty)
>>>      Modules linked in:
>>>      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.12.0-rc3+ #298
>>>      NIP:  c01de598 LR: c08ae9c4 CTR: 00000000
>>>      REGS: c0b4bea0 TRAP: 0300   Not tainted  (5.12.0-rc3+)
>>>      MSR:  00021000 <CE,ME>  CR: 24000228  XER: 20000000
>>>      DEAR: 00000000 ESR: 00000000
>>>      GPR00: c08ae9c4 c0b4bf60 c0ad64e0 ef720000 00021000 00000000 00000000 00000200
>>>      GPR08: c0ad5000 00000000 00000000 00000004 00000000 008fbb30 00000000 00000000
>>>      GPR16: 00000000 00000000 00000000 00000000 c0000000 00000000 00000000 00000000
>>>      GPR24: c08ca004 c08ca004 c0b6a0e0 c0b60000 c0b58f00 c0850000 c08ca000 ef720000
>>>      NIP [c01de598] kfence_protect+0x44/0x6c
>>>      LR [c08ae9c4] kfence_init+0xfc/0x2a4
>>>      Call Trace:
>>>      [c0b4bf60] [efffe160] 0xefffe160 (unreliable)
>>>      [c0b4bf70] [c08ae9c4] kfence_init+0xfc/0x2a4
>>>      [c0b4bfb0] [c0894d3c] start_kernel+0x3bc/0x574
>>>      [c0b4bff0] [c0000470] set_ivor+0x14c/0x188
>>>      Instruction dump:
>>>      7c0802a6 8109d594 546a653a 90010014 54630026 39200000 7d48502e 2c0a0000
>>>      41820010 554a0026 5469b53a 7d295214 <81490000> 38831000 554a003c 91490000
>>>      random: get_random_bytes called from print_oops_end_marker+0x40/0x78 with crng_init=0
>>>      ---[ end trace 0000000000000000 ]---
>>>
>>> Signed-off-by: Liu Shixin <liushixin2@huawei.com>
>>> ---
>>>   arch/powerpc/Kconfig | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>>> index d46db0bfb998..cffd57bcb5e4 100644
>>> --- a/arch/powerpc/Kconfig
>>> +++ b/arch/powerpc/Kconfig
>>> @@ -185,7 +185,7 @@ config PPC
>>>   	select HAVE_ARCH_KASAN			if PPC32 && PPC_PAGE_SHIFT <= 14
>>>   	select HAVE_ARCH_KASAN_VMALLOC		if PPC32 && PPC_PAGE_SHIFT <= 14
>>>   	select HAVE_ARCH_KGDB
>>> -	select HAVE_ARCH_KFENCE			if PPC32
>>> +	select HAVE_ARCH_KFENCE			if PPC32 && !PPC_FSL_BOOK3E
>>>   	select HAVE_ARCH_MMAP_RND_BITS
>>>   	select HAVE_ARCH_MMAP_RND_COMPAT_BITS	if COMPAT
>>>   	select HAVE_ARCH_NVRAM_OPS

^ permalink raw reply

* Re: [PATCH] tpm: ibmvtpm: Make use of dma_alloc_coherent()
From: Jarkko Sakkinen @ 2021-10-12 17:40 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: linux-kernel, Cai Huoqing, Paul Mackerras, Peter Huewe,
	linuxppc-dev, linux-integrity
In-Reply-To: <20211012154325.GI2688930@ziepe.ca>

On Tue, 2021-10-12 at 12:43 -0300, Jason Gunthorpe wrote:
> On Tue, Oct 12, 2021 at 06:29:58PM +0300, Jarkko Sakkinen wrote:
> > On Mon, 2021-10-11 at 00:01 +0800, Cai Huoqing wrote:
> > > Replacing kmalloc/kfree/get_zeroed_page/free_page/dma_map_single/
> >   ~~~~~~~~~
> >   Replace
> > 
> > > dma_unmap_single() with dma_alloc_coherent/dma_free_coherent()
> > > helps to reduce code size, and simplify the code, and coherent
> > > DMA will not clear the cache every time.
> > > 
> > > Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> > 
> > If this does not do functionally anything useful, there's no
> > reason to apply this.
> 
> At least in this case it looks like the ibmvtpm is not using the DMA
> API properly. There is no sync after each data transfer. Replacing
> this wrong usage with the coherent API is reasonable.

Thank you. As long as this is documented to the commit message,
I'm cool with the change itself.

E.g. something like this would be perfectly fine replacement for the
current commit message:

"The current usage pattern for the DMA API is inappropriate, as
data transfers are not synced. Replace the existing DMA code
with the coherent DMA API."

/Jarkko

^ permalink raw reply

* RE: [PATCH] tpm: ibmvtpm: Make use of dma_alloc_coherent()
From: David Laight @ 2021-10-12 21:01 UTC (permalink / raw)
  To: 'Jarkko Sakkinen', Jason Gunthorpe
  Cc: linux-kernel@vger.kernel.org, Cai Huoqing, Paul Mackerras,
	Peter Huewe, linuxppc-dev@lists.ozlabs.org,
	linux-integrity@vger.kernel.org
In-Reply-To: <c36327cce24449b3eb79209c374514e750b38eb4.camel@kernel.org>

From: Jarkko Sakkinen
> Sent: 12 October 2021 18:41
> 
> On Tue, 2021-10-12 at 12:43 -0300, Jason Gunthorpe wrote:
> > On Tue, Oct 12, 2021 at 06:29:58PM +0300, Jarkko Sakkinen wrote:
> > > On Mon, 2021-10-11 at 00:01 +0800, Cai Huoqing wrote:
> > > > Replacing kmalloc/kfree/get_zeroed_page/free_page/dma_map_single/
> > >   ~~~~~~~~~
> > >   Replace
> > >
> > > > dma_unmap_single() with dma_alloc_coherent/dma_free_coherent()
> > > > helps to reduce code size, and simplify the code, and coherent
> > > > DMA will not clear the cache every time.
> > > >
> > > > Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> > >
> > > If this does not do functionally anything useful, there's no
> > > reason to apply this.
> >
> > At least in this case it looks like the ibmvtpm is not using the DMA
> > API properly. There is no sync after each data transfer. Replacing
> > this wrong usage with the coherent API is reasonable.
> 
> Thank you. As long as this is documented to the commit message,
> I'm cool with the change itself.
> 
> E.g. something like this would be perfectly fine replacement for the
> current commit message:
> 
> "The current usage pattern for the DMA API is inappropriate, as
> data transfers are not synced. Replace the existing DMA code
> with the coherent DMA API."

Why not also say that the DMA access snoop the cache?
(I think that was mentioned earlier in the thread.)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

^ permalink raw reply

* Re: [PATCH v2] KVM: PPC: Defer vtime accounting 'til after IRQ handling
From: Michael Ellerman @ 2021-10-12 23:18 UTC (permalink / raw)
  To: Laurent Vivier, kvm-ppc
  Cc: Laurent Vivier, Greg Kurz, Nicholas Piggin, linux-kernel, stable,
	linuxppc-dev
In-Reply-To: <20211007142856.41205-1-lvivier@redhat.com>

Laurent Vivier <lvivier@redhat.com> writes:
> Commit 112665286d08 moved guest_exit() in the interrupt protected
> area to avoid wrong context warning (or worse), but the tick counter
> cannot be updated and the guest time is accounted to the system time.
>
> To fix the problem port to POWER the x86 fix
> 160457140187 ("Defer vtime accounting 'til after IRQ handling"):
>
> "Defer the call to account guest time until after servicing any IRQ(s)
>  that happened in the guest or immediately after VM-Exit.  Tick-based
>  accounting of vCPU time relies on PF_VCPU being set when the tick IRQ
>  handler runs, and IRQs are blocked throughout the main sequence of
>  vcpu_enter_guest(), including the call into vendor code to actually
>  enter and exit the guest."
>
> Fixes: 112665286d08 ("KVM: PPC: Book3S HV: Context tracking exit guest context before enabling irqs")
> Cc: npiggin@gmail.com
> Cc: <stable@vger.kernel.org> # 5.12
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>
> Notes:
>     v2: remove reference to commit 61bd0f66ff92
>         cc stable 5.12
>         add the same comment in the code as for x86
>
>  arch/powerpc/kvm/book3s_hv.c | 24 ++++++++++++++++++++----
>  1 file changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 2acb1c96cfaf..a694d1a8f6ce 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
...
> @@ -4506,13 +4514,21 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
>  
>  	srcu_read_unlock(&kvm->srcu, srcu_idx);
>  
> +	context_tracking_guest_exit();
> +
>  	set_irq_happened(trap);
>  
>  	kvmppc_set_host_core(pcpu);
>  
> -	guest_exit_irqoff();
> -
>  	local_irq_enable();
> +	/*
> +	 * Wait until after servicing IRQs to account guest time so that any
> +	 * ticks that occurred while running the guest are properly accounted
> +	 * to the guest.  Waiting until IRQs are enabled degrades the accuracy
> +	 * of accounting via context tracking, but the loss of accuracy is
> +	 * acceptable for all known use cases.
> +	 */
> +	vtime_account_guest_exit();

This pops a warning for me, running guest(s) on Power8:
 
  [  270.745303][T16661] ------------[ cut here ]------------
  [  270.745374][T16661] WARNING: CPU: 72 PID: 16661 at arch/powerpc/kernel/time.c:311 vtime_account_kernel+0xe0/0xf0
  [  270.745397][T16661] Modules linked in: nf_conntrack_netlink xfrm_user xfrm_algo xt_addrtype xt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp iptable_mangle iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nfnetlink ip6table_filter ip6_tables iptable_filter tun overlay fuse kvm_hv kvm binfmt_misc squashfs mlx4_ib dm_multipath scsi_dh_rdac ib_uverbs scsi_dh_alua mlx4_en ib_core sr_mod cdrom lpfc bnx2x sg mlx4_core mdio crc_t10dif crct10dif_generic scsi_transport_fc vmx_crypto gf128mul leds_powernv crct10dif_vpmsum powernv_rng led_class crct10dif_common powernv_op_panel rng_core crc32c_vpmsum sunrpc ip_tables x_tables autofs4
  [  270.745565][T16661] CPU: 72 PID: 16661 Comm: qemu-system-ppc Not tainted 5.15.0-rc5-01885-g5e96f0599cff #1
  [  270.745578][T16661] NIP:  c000000000027c20 LR: c00800000b6e9ca8 CTR: c000000000027b40
  [  270.745588][T16661] REGS: c00000081043f4f0 TRAP: 0700   Not tainted  (5.15.0-rc5-01885-g5e96f0599cff)
  [  270.745599][T16661] MSR:  900000000282b033 <SF,HV,VEC,VSX,EE,FP,ME,IR,DR,RI,LE>  CR: 22442222  XER: 20000000
  [  270.745635][T16661] CFAR: c000000000027b7c IRQMASK: 0
  [  270.745635][T16661] GPR00: c00800000b6e9ca8 c00000081043f790 c00000000248f900 c000000ffffda820
  [  270.745635][T16661] GPR04: c00000080b93b488 0000000000000006 00000000000f4240 c000001fffffc000
  [  270.745635][T16661] GPR08: 0000000ffa6f0000 0000000000000000 0000000000008002 c00800000b6ffba8
  [  270.745635][T16661] GPR12: c000000000027b40 c000000ffffd9e00 0000000000000001 0000000000000000
  [  270.745635][T16661] GPR16: 0000000000000000 c00000000254c0b0 0000000000000000 c000000941e84414
  [  270.745635][T16661] GPR20: 0000000000000001 0000000000000048 c00800000b710f0c 0000000000000001
  [  270.745635][T16661] GPR24: c000000941e90aa8 0000000000000000 c0000000024c6d60 0000000000000001
  [  270.745635][T16661] GPR28: c000000803222470 c00000080b93aa00 0000000000000008 c000000ffffd9e00
  [  270.745747][T16661] NIP [c000000000027c20] vtime_account_kernel+0xe0/0xf0
  [  270.745756][T16661] LR [c00800000b6e9ca8] kvmppc_run_core+0xda0/0x16c0 [kvm_hv]
  [  270.745773][T16661] Call Trace:
  [  270.745779][T16661] [c00000081043f790] [c00000081043f7d0] 0xc00000081043f7d0 (unreliable)
  [  270.745793][T16661] [c00000081043f7d0] [c00800000b6e9ca8] kvmppc_run_core+0xda0/0x16c0 [kvm_hv]
  [  270.745808][T16661] [c00000081043f950] [c00800000b6eee28] kvmppc_vcpu_run_hv+0x570/0xce0 [kvm_hv]
  [  270.745823][T16661] [c00000081043fa10] [c00800000b5d2afc] kvmppc_vcpu_run+0x34/0x48 [kvm]
  [  270.745847][T16661] [c00000081043fa30] [c00800000b5ce728] kvm_arch_vcpu_ioctl_run+0x340/0x450 [kvm]
  [  270.745870][T16661] [c00000081043fac0] [c00800000b5bc060] kvm_vcpu_ioctl+0x338/0x930 [kvm]
  [  270.745890][T16661] [c00000081043fca0] [c00000000050b7b4] sys_ioctl+0x6b4/0x13b0
  [  270.745901][T16661] [c00000081043fdb0] [c00000000002fa54] system_call_exception+0x184/0x330
  [  270.745912][T16661] [c00000081043fe10] [c00000000000c84c] system_call_common+0xec/0x268
  [  270.745923][T16661] --- interrupt: c00 at 0x7fff9eb9f010
  [  270.745930][T16661] NIP:  00007fff9eb9f010 LR: 0000000136aa3670 CTR: 0000000000000000
  [  270.745937][T16661] REGS: c00000081043fe80 TRAP: 0c00   Not tainted  (5.15.0-rc5-01885-g5e96f0599cff)
  [  270.745945][T16661] MSR:  900000000280f033 <SF,HV,VEC,VSX,EE,PR,FP,ME,IR,DR,RI,LE>  CR: 22444802  XER: 00000000
  [  270.745974][T16661] IRQMASK: 0
  [  270.745974][T16661] GPR00: 0000000000000036 00007fff9d5bdc30 00007fff9ec97100 000000000000000d
  [  270.745974][T16661] GPR04: 000000002000ae80 0000000000000000 0000000000000000 0000000000000000
  [  270.745974][T16661] GPR08: 000000000000000d 0000000000000000 0000000000000000 0000000000000000
  [  270.745974][T16661] GPR12: 0000000000000000 00007fff9d5c6290 00007fff9ece4410 0000000000000000
  [  270.745974][T16661] GPR16: 00007fff9f970000 00007fff9ece0320 00007fff9d5bebe0 00007fff9f8d0028
  [  270.745974][T16661] GPR20: 0000000000000000 0000000000000000 00000001370fd068 000000002000ae80
  [  270.745974][T16661] GPR24: 00007fff9d7100ae 0000000000000000 00007fff9d5bf290 00007fff9d720010
  [  270.745974][T16661] GPR28: 00000001376611c0 00007fff9d720010 0000000000000000 000000002000ae80
  [  270.746064][T16661] NIP [00007fff9eb9f010] 0x7fff9eb9f010
  [  270.746071][T16661] LR [0000000136aa3670] 0x136aa3670
  [  270.746078][T16661] --- interrupt: c00
  [  270.746083][T16661] Instruction dump:
  [  270.746090][T16661] 7c691a14 f89f0a40 f87f0a30 e8010010 eba1ffe8 ebc1fff0 ebe1fff8 7c0803a6
  [  270.746109][T16661] 4e800020 60000000 60000000 60420000 <0fe00000> 60000000 60000000 60420000
  [  270.746128][T16661] irq event stamp: 2118
  [  270.746133][T16661] hardirqs last  enabled at (2117): [<c00800000b6e9c8c>] kvmppc_run_core+0xd84/0x16c0 [kvm_hv]
  [  270.746146][T16661] hardirqs last disabled at (2118): [<c0000000000293dc>] interrupt_enter_prepare.constprop.0+0xfc/0x140
  [  270.746156][T16661] softirqs last  enabled at (1940): [<c000000000fd6b8c>] __do_softirq+0x5ec/0x658
  [  270.746166][T16661] softirqs last disabled at (1935): [<c00000000011a6e8>] __irq_exit_rcu+0x158/0x1c0
  [  270.746176][T16661] ---[ end trace b1b029e8dc7c2667 ]---


cheers

^ permalink raw reply

* Re: [PATCH v6 00/11] PCI: Drop duplicated tracking of a pci_dev's bound driver
From: Bjorn Helgaas @ 2021-10-12 23:32 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Giovanni Cabiddu, Mark Rutland, Sathya Prakash,
	Alexander Shishkin, linux-pci, Alexander Duyck, x86, qat-linux,
	oss-drivers, Oliver O'Halloran, H. Peter Anvin, Jiri Olsa,
	Thomas Gleixner, Marco Chiappero, Stefano Stabellini, Herbert Xu,
	linux-scsi, Rafał Miłecki, Jesse Brandeburg,
	Peter Zijlstra, Ingo Molnar, linux-wireless, Jakub Kicinski,
	Yisen Zhuang, Suganath Prabu Subramani, Fiona Trahe,
	Andrew Donnellan, Arnd Bergmann, Konrad Rzeszutek Wilk,
	Ido Schimmel, Simon Horman, linuxppc-dev,
	Arnaldo Carvalho de Melo, Jack Xu, Borislav Petkov,
	Michael Buesch, Jiri Pirko, Bjorn Helgaas, Namhyung Kim,
	Boris Ostrovsky, Andy Shevchenko, Juergen Gross, Salil Mehta,
	Sreekanth Reddy, xen-devel, Vadym Kochan, MPT-FusionLinux.pdl,
	Greg Kroah-Hartman, linux-usb, Wojciech Ziemba, linux-kernel,
	Mathias Nyman, Zhou Wang, linux-crypto, kernel, netdev,
	Frederic Barrat, Paul Mackerras, Tomaszx Kowalik, Taras Chornyi,
	David S. Miller, linux-perf-users
In-Reply-To: <20211004125935.2300113-1-u.kleine-koenig@pengutronix.de>

On Mon, Oct 04, 2021 at 02:59:24PM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> this is v6 of the quest to drop the "driver" member from struct pci_dev
> which tracks the same data (apart from a constant offset) as dev.driver.

I like this a lot and applied it to pci/driver for v5.16, thanks!

I split some of the bigger patches apart so they only touched one
driver or subsystem at a time.  I also updated to_pci_driver() so it
returns NULL when given NULL, which makes some of the validations
quite a bit simpler, especially in the PM code in pci-driver.c.

Full interdiff from this v6 series:

diff --git a/arch/x86/kernel/probe_roms.c b/arch/x86/kernel/probe_roms.c
index deaaef6efe34..36e84d904260 100644
--- a/arch/x86/kernel/probe_roms.c
+++ b/arch/x86/kernel/probe_roms.c
@@ -80,17 +80,15 @@ static struct resource video_rom_resource = {
  */
 static bool match_id(struct pci_dev *pdev, unsigned short vendor, unsigned short device)
 {
+	struct pci_driver *drv = to_pci_driver(pdev->dev.driver);
 	const struct pci_device_id *id;
 
 	if (pdev->vendor == vendor && pdev->device == device)
 		return true;
 
-	if (pdev->dev.driver) {
-		struct pci_driver *drv = to_pci_driver(pdev->dev.driver);
-		for (id = drv->id_table; id && id->vendor; id++)
-			if (id->vendor == vendor && id->device == device)
-				break;
-	}
+	for (id = drv ? drv->id_table : NULL; id && id->vendor; id++)
+		if (id->vendor == vendor && id->device == device)
+			break;
 
 	return id && id->vendor;
 }
diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
index d997c9c3ebb5..7eb3706cf42d 100644
--- a/drivers/misc/cxl/guest.c
+++ b/drivers/misc/cxl/guest.c
@@ -20,38 +20,38 @@ static void pci_error_handlers(struct cxl_afu *afu,
 				pci_channel_state_t state)
 {
 	struct pci_dev *afu_dev;
+	struct pci_driver *afu_drv;
+	struct pci_error_handlers *err_handler;
 
 	if (afu->phb == NULL)
 		return;
 
 	list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) {
-		struct pci_driver *afu_drv;
-
-		if (!afu_dev->dev.driver)
-			continue;
-
 		afu_drv = to_pci_driver(afu_dev->dev.driver);
+		if (!afu_drv)
+			continue;
 
+		err_handler = afu_drv->err_handler;
 		switch (bus_error_event) {
 		case CXL_ERROR_DETECTED_EVENT:
 			afu_dev->error_state = state;
 
-			if (afu_drv->err_handler &&
-			    afu_drv->err_handler->error_detected)
-				afu_drv->err_handler->error_detected(afu_dev, state);
-		break;
+			if (err_handler &&
+			    err_handler->error_detected)
+				err_handler->error_detected(afu_dev, state);
+			break;
 		case CXL_SLOT_RESET_EVENT:
 			afu_dev->error_state = state;
 
-			if (afu_drv->err_handler &&
-			    afu_drv->err_handler->slot_reset)
-				afu_drv->err_handler->slot_reset(afu_dev);
-		break;
+			if (err_handler &&
+			    err_handler->slot_reset)
+				err_handler->slot_reset(afu_dev);
+			break;
 		case CXL_RESUME_EVENT:
-			if (afu_drv->err_handler &&
-			    afu_drv->err_handler->resume)
-				afu_drv->err_handler->resume(afu_dev);
-		break;
+			if (err_handler &&
+			    err_handler->resume)
+				err_handler->resume(afu_dev);
+			break;
 		}
 	}
 }
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index 7e7545d01e27..08bd81854101 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -1795,6 +1795,8 @@ static pci_ers_result_t cxl_vphb_error_detected(struct cxl_afu *afu,
 						pci_channel_state_t state)
 {
 	struct pci_dev *afu_dev;
+	struct pci_driver *afu_drv;
+	struct pci_error_handlers *err_handler;
 	pci_ers_result_t result = PCI_ERS_RESULT_NEED_RESET;
 	pci_ers_result_t afu_result = PCI_ERS_RESULT_NEED_RESET;
 
@@ -1805,16 +1807,16 @@ static pci_ers_result_t cxl_vphb_error_detected(struct cxl_afu *afu,
 		return result;
 
 	list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) {
-		struct pci_driver *afu_drv;
-		if (!afu_dev->dev.driver)
-			continue;
-
 		afu_drv = to_pci_driver(afu_dev->dev.driver);
+		if (!afu_drv)
+			continue;
 
 		afu_dev->error_state = state;
 
-		if (afu_drv->err_handler)
-			afu_result = afu_drv->err_handler->error_detected(afu_dev, state);
+		err_handler = afu_drv->err_handler;
+		if (err_handler)
+			afu_result = err_handler->error_detected(afu_dev,
+								 state);
 		/* Disconnect trumps all, NONE trumps NEED_RESET */
 		if (afu_result == PCI_ERS_RESULT_DISCONNECT)
 			result = PCI_ERS_RESULT_DISCONNECT;
@@ -1974,6 +1976,8 @@ static pci_ers_result_t cxl_pci_slot_reset(struct pci_dev *pdev)
 	struct cxl_afu *afu;
 	struct cxl_context *ctx;
 	struct pci_dev *afu_dev;
+	struct pci_driver *afu_drv;
+	struct pci_error_handlers *err_handler;
 	pci_ers_result_t afu_result = PCI_ERS_RESULT_RECOVERED;
 	pci_ers_result_t result = PCI_ERS_RESULT_RECOVERED;
 	int i;
@@ -2005,8 +2009,6 @@ static pci_ers_result_t cxl_pci_slot_reset(struct pci_dev *pdev)
 			continue;
 
 		list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) {
-			struct pci_driver *afu_drv;
-
 			/* Reset the device context.
 			 * TODO: make this less disruptive
 			 */
@@ -2032,14 +2034,13 @@ static pci_ers_result_t cxl_pci_slot_reset(struct pci_dev *pdev)
 			 * shouldn't start new work until we call
 			 * their resume function.
 			 */
-			if (!afu_dev->dev.driver)
-				continue;
-
 			afu_drv = to_pci_driver(afu_dev->dev.driver);
+			if (!afu_drv)
+				continue;
 
-			if (afu_drv->err_handler &&
-			    afu_drv->err_handler->slot_reset)
-				afu_result = afu_drv->err_handler->slot_reset(afu_dev);
+			err_handler = afu_drv->err_handler;
+			if (err_handler && err_handler->slot_reset)
+				afu_result = err_handler->slot_reset(afu_dev);
 
 			if (afu_result == PCI_ERS_RESULT_DISCONNECT)
 				result = PCI_ERS_RESULT_DISCONNECT;
@@ -2066,6 +2067,8 @@ static void cxl_pci_resume(struct pci_dev *pdev)
 	struct cxl *adapter = pci_get_drvdata(pdev);
 	struct cxl_afu *afu;
 	struct pci_dev *afu_dev;
+	struct pci_driver *afu_drv;
+	struct pci_error_handlers *err_handler;
 	int i;
 
 	/* Everything is back now. Drivers should restart work now.
@@ -2080,11 +2083,13 @@ static void cxl_pci_resume(struct pci_dev *pdev)
 			continue;
 
 		list_for_each_entry(afu_dev, &afu->phb->bus->devices, bus_list) {
-			struct pci_driver *afu_drv;
-			if (afu_dev->dev.driver &&
-			    (afu_drv = to_pci_driver(afu_dev->dev.driver))->err_handler &&
-			    afu_drv->err_handler->resume)
-				afu_drv->err_handler->resume(afu_dev);
+			afu_drv = to_pci_driver(afu_dev->dev.driver);
+			if (!afu_drv)
+				continue;
+
+			err_handler = afu_drv->err_handler;
+			if (err_handler && err_handler->resume)
+				err_handler->resume(afu_dev);
 		}
 	}
 	spin_unlock(&adapter->afu_list_lock);
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 0d0a34347868..fa4b52bb1e05 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -168,11 +168,8 @@ static ssize_t sriov_vf_total_msix_show(struct device *dev,
 	u32 vf_total_msix = 0;
 
 	device_lock(dev);
-	if (!dev->driver)
-		goto unlock;
-
 	pdrv = to_pci_driver(dev->driver);
-	if (!pdrv->sriov_get_vf_total_msix)
+	if (!pdrv || !pdrv->sriov_get_vf_total_msix)
 		goto unlock;
 
 	vf_total_msix = pdrv->sriov_get_vf_total_msix(pdev);
@@ -199,19 +196,14 @@ static ssize_t sriov_vf_msix_count_store(struct device *dev,
 		return -EINVAL;
 
 	device_lock(&pdev->dev);
-	if (!pdev->dev.driver) {
-		ret = -EOPNOTSUPP;
-		goto err_pdev;
-	}
-
-	pdrv = to_pci_driver(pdev->dev.driver);
-	if (!pdrv->sriov_set_msix_vec_count) {
+	pdrv = to_pci_driver(dev->driver);
+	if (!pdrv || !pdrv->sriov_set_msix_vec_count) {
 		ret = -EOPNOTSUPP;
 		goto err_pdev;
 	}
 
 	device_lock(&vf_dev->dev);
-	if (vf_dev->dev.driver) {
+	if (to_pci_driver(vf_dev->dev.driver)) {
 		/*
 		 * A driver is already attached to this VF and has configured
 		 * itself based on the current MSI-X vector count. Changing
@@ -405,14 +397,13 @@ static ssize_t sriov_numvfs_store(struct device *dev,
 		goto exit;
 
 	/* is PF driver loaded */
-	if (!pdev->dev.driver) {
+	pdrv = to_pci_driver(dev->driver);
+	if (!pdrv) {
 		pci_info(pdev, "no driver bound to device; cannot configure SR-IOV\n");
 		ret = -ENOENT;
 		goto exit;
 	}
 
-	pdrv = to_pci_driver(pdev->dev.driver);
-
 	/* is PF driver loaded w/callback */
 	if (!pdrv->sriov_configure) {
 		pci_info(pdev, "driver does not support SR-IOV configuration via sysfs\n");
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index e94aa338bab4..3884a1542e86 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -454,7 +454,7 @@ static int pci_device_probe(struct device *dev)
 static void pci_device_remove(struct device *dev)
 {
 	struct pci_dev *pci_dev = to_pci_dev(dev);
-	struct pci_driver *drv = to_pci_driver(pci_dev->dev.driver);
+	struct pci_driver *drv = to_pci_driver(dev->driver);
 
 	if (drv->remove) {
 		pm_runtime_get_sync(dev);
@@ -489,15 +489,12 @@ static void pci_device_remove(struct device *dev)
 static void pci_device_shutdown(struct device *dev)
 {
 	struct pci_dev *pci_dev = to_pci_dev(dev);
+	struct pci_driver *drv = to_pci_driver(dev->driver);
 
 	pm_runtime_resume(dev);
 
-	if (pci_dev->dev.driver) {
-		struct pci_driver *drv = to_pci_driver(pci_dev->dev.driver);
-
-		if (drv->shutdown)
-			drv->shutdown(pci_dev);
-	}
+	if (drv && drv->shutdown)
+		drv->shutdown(pci_dev);
 
 	/*
 	 * If this is a kexec reboot, turn off Bus Master bit on the
@@ -588,25 +585,22 @@ static int pci_pm_reenable_device(struct pci_dev *pci_dev)
 static int pci_legacy_suspend(struct device *dev, pm_message_t state)
 {
 	struct pci_dev *pci_dev = to_pci_dev(dev);
+	struct pci_driver *drv = to_pci_driver(dev->driver);
 
-	if (dev->driver) {
-		struct pci_driver *drv = to_pci_driver(dev->driver);
+	if (drv && drv->suspend) {
+		pci_power_t prev = pci_dev->current_state;
+		int error;
 
-		if (drv->suspend) {
-			pci_power_t prev = pci_dev->current_state;
-			int error;
+		error = drv->suspend(pci_dev, state);
+		suspend_report_result(drv->suspend, error);
+		if (error)
+			return error;
 
-			error = drv->suspend(pci_dev, state);
-			suspend_report_result(drv->suspend, error);
-			if (error)
-				return error;
-
-			if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
-			    && pci_dev->current_state != PCI_UNKNOWN) {
-				pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev,
-					      "PCI PM: Device state not saved by %pS\n",
-					      drv->suspend);
-			}
+		if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
+		    && pci_dev->current_state != PCI_UNKNOWN) {
+			pci_WARN_ONCE(pci_dev, pci_dev->current_state != prev,
+				      "PCI PM: Device state not saved by %pS\n",
+				      drv->suspend);
 		}
 	}
 
@@ -632,17 +626,12 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
 static int pci_legacy_resume(struct device *dev)
 {
 	struct pci_dev *pci_dev = to_pci_dev(dev);
+	struct pci_driver *drv = to_pci_driver(dev->driver);
 
 	pci_fixup_device(pci_fixup_resume, pci_dev);
 
-	if (pci_dev->dev.driver) {
-		struct pci_driver *drv = to_pci_driver(pci_dev->dev.driver);
-
-		if (drv->resume)
-			return drv->resume(pci_dev);
-	}
-
-	return pci_pm_reenable_device(pci_dev);
+	return drv && drv->resume ?
+			drv->resume(pci_dev) : pci_pm_reenable_device(pci_dev);
 }
 
 /* Auxiliary functions used by the new power management framework */
@@ -656,14 +645,8 @@ static void pci_pm_default_suspend(struct pci_dev *pci_dev)
 
 static bool pci_has_legacy_pm_support(struct pci_dev *pci_dev)
 {
-	struct pci_driver *drv;
-	bool ret;
-
-	if (!pci_dev->dev.driver)
-		return false;
-
-	drv = to_pci_driver(pci_dev->dev.driver);
-	ret = drv && (drv->suspend || drv->resume);
+	struct pci_driver *drv = to_pci_driver(pci_dev->dev.driver);
+	bool ret = drv && (drv->suspend || drv->resume);
 
 	/*
 	 * Legacy PM support is used by default, so warn if the new framework is
@@ -1255,11 +1238,11 @@ static int pci_pm_runtime_suspend(struct device *dev)
 	int error;
 
 	/*
-	 * If pci_dev->dev.driver is not set (unbound), we leave the device in D0,
-	 * but it may go to D3cold when the bridge above it runtime suspends.
-	 * Save its config space in case that happens.
+	 * If the device has no driver, we leave it in D0, but it may go to
+	 * D3cold when the bridge above it runtime suspends.  Save its
+	 * config space in case that happens.
 	 */
-	if (!pci_dev->dev.driver) {
+	if (!to_pci_driver(dev->driver)) {
 		pci_save_state(pci_dev);
 		return 0;
 	}
@@ -1316,7 +1299,7 @@ static int pci_pm_runtime_resume(struct device *dev)
 	 */
 	pci_restore_standard_config(pci_dev);
 
-	if (!dev->driver)
+	if (!to_pci_driver(dev->driver))
 		return 0;
 
 	pci_fixup_device(pci_fixup_resume_early, pci_dev);
@@ -1335,13 +1318,14 @@ static int pci_pm_runtime_resume(struct device *dev)
 
 static int pci_pm_runtime_idle(struct device *dev)
 {
+	struct pci_dev *pci_dev = to_pci_dev(dev);
 	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
 
 	/*
-	 * If dev->driver is not set (unbound), the device should
-	 * always remain in D0 regardless of the runtime PM status
+	 * If the device has no driver, it should always remain in D0
+	 * regardless of the runtime PM status
 	 */
-	if (!dev->driver)
+	if (!to_pci_driver(dev->driver))
 		return 0;
 
 	if (!pm)
@@ -1448,8 +1432,10 @@ static struct pci_driver pci_compat_driver = {
  */
 struct pci_driver *pci_dev_driver(const struct pci_dev *dev)
 {
-	if (dev->dev.driver)
-		return to_pci_driver(dev->dev.driver);
+	struct pci_driver *drv = to_pci_driver(dev->dev.driver);
+
+	if (drv)
+		return drv;
 	else {
 		int i;
 		for (i = 0; i <= PCI_ROM_RESOURCE; i++)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index ccecf740de59..5298ce131f8c 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5088,13 +5088,14 @@ EXPORT_SYMBOL_GPL(pci_dev_unlock);
 
 static void pci_dev_save_and_disable(struct pci_dev *dev)
 {
+	struct pci_driver *drv = to_pci_driver(dev->dev.driver);
 	const struct pci_error_handlers *err_handler =
-			dev->dev.driver ? to_pci_driver(dev->dev.driver)->err_handler : NULL;
+			drv ? drv->err_handler : NULL;
 
 	/*
-	 * dev->driver->err_handler->reset_prepare() is protected against
-	 * races with ->remove() by the device lock, which must be held by
-	 * the caller.
+	 * drv->err_handler->reset_prepare() is protected against races
+	 * with ->remove() by the device lock, which must be held by the
+	 * caller.
 	 */
 	if (err_handler && err_handler->reset_prepare)
 		err_handler->reset_prepare(dev);
@@ -5119,15 +5120,15 @@ static void pci_dev_save_and_disable(struct pci_dev *dev)
 
 static void pci_dev_restore(struct pci_dev *dev)
 {
+	struct pci_driver *drv = to_pci_driver(dev->dev.driver);
 	const struct pci_error_handlers *err_handler =
-			dev->dev.driver ? to_pci_driver(dev->dev.driver)->err_handler : NULL;
+			drv ? drv->err_handler : NULL;
 
 	pci_restore_state(dev);
 
 	/*
-	 * dev->driver->err_handler->reset_done() is protected against
-	 * races with ->remove() by the device lock, which must be held by
-	 * the caller.
+	 * drv->err_handler->reset_done() is protected against races with
+	 * ->remove() by the device lock, which must be held by the caller.
 	 */
 	if (err_handler && err_handler->reset_done)
 		err_handler->reset_done(dev);
diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c
index b314b54f7821..42385fe6b7fa 100644
--- a/drivers/pci/pcie/err.c
+++ b/drivers/pci/pcie/err.c
@@ -54,9 +54,10 @@ static int report_error_detected(struct pci_dev *dev,
 	const struct pci_error_handlers *err_handler;
 
 	device_lock(&dev->dev);
+	pdrv = to_pci_driver(dev->dev.driver);
 	if (!pci_dev_set_io_state(dev, state) ||
-		!dev->dev.driver ||
-		!(pdrv = to_pci_driver(dev->dev.driver))->err_handler ||
+		!pdrv ||
+		!pdrv->err_handler ||
 		!pdrv->err_handler->error_detected) {
 		/*
 		 * If any device in the subtree does not have an error_detected
@@ -92,13 +93,14 @@ static int report_normal_detected(struct pci_dev *dev, void *data)
 
 static int report_mmio_enabled(struct pci_dev *dev, void *data)
 {
-	pci_ers_result_t vote, *result = data;
 	struct pci_driver *pdrv;
+	pci_ers_result_t vote, *result = data;
 	const struct pci_error_handlers *err_handler;
 
 	device_lock(&dev->dev);
-	if (!dev->dev.driver ||
-		!(pdrv = to_pci_driver(dev->dev.driver))->err_handler ||
+	pdrv = to_pci_driver(dev->dev.driver);
+	if (!pdrv ||
+		!pdrv->err_handler ||
 		!pdrv->err_handler->mmio_enabled)
 		goto out;
 
@@ -112,13 +114,14 @@ static int report_mmio_enabled(struct pci_dev *dev, void *data)
 
 static int report_slot_reset(struct pci_dev *dev, void *data)
 {
+	struct pci_driver *pdrv;
 	pci_ers_result_t vote, *result = data;
 	const struct pci_error_handlers *err_handler;
-	struct pci_driver *pdrv;
 
 	device_lock(&dev->dev);
-	if (!dev->dev.driver ||
-		!(pdrv = to_pci_driver(dev->dev.driver))->err_handler ||
+	pdrv = to_pci_driver(dev->dev.driver);
+	if (!pdrv ||
+		!pdrv->err_handler ||
 		!pdrv->err_handler->slot_reset)
 		goto out;
 
@@ -132,13 +135,14 @@ static int report_slot_reset(struct pci_dev *dev, void *data)
 
 static int report_resume(struct pci_dev *dev, void *data)
 {
-	const struct pci_error_handlers *err_handler;
 	struct pci_driver *pdrv;
+	const struct pci_error_handlers *err_handler;
 
 	device_lock(&dev->dev);
+	pdrv = dev->driver;
 	if (!pci_dev_set_io_state(dev, pci_channel_io_normal) ||
-		!dev->dev.driver ||
-		!(pdrv = to_pci_driver(dev->dev.driver))->err_handler ||
+		!pdrv ||
+		!pdrv->err_handler ||
 		!pdrv->err_handler->resume)
 		goto out;
 
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 73831fb87a1e..0ec76b4af16f 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -588,7 +588,6 @@ static pci_ers_result_t pcifront_common_process(int cmd,
 						struct pcifront_device *pdev,
 						pci_channel_state_t state)
 {
-	pci_ers_result_t result;
 	struct pci_driver *pdrv;
 	int bus = pdev->sh_info->aer_op.bus;
 	int devfn = pdev->sh_info->aer_op.devfn;
@@ -598,13 +597,12 @@ static pci_ers_result_t pcifront_common_process(int cmd,
 	dev_dbg(&pdev->xdev->dev,
 		"pcifront AER process: cmd %x (bus:%x, devfn%x)",
 		cmd, bus, devfn);
-	result = PCI_ERS_RESULT_NONE;
 
 	pcidev = pci_get_domain_bus_and_slot(domain, bus, devfn);
 	if (!pcidev || !pcidev->dev.driver) {
 		dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n");
 		pci_dev_put(pcidev);
-		return result;
+		return PCI_ERS_RESULT_NONE;
 	}
 	pdrv = to_pci_driver(pcidev->dev.driver);
 
@@ -612,27 +610,18 @@ static pci_ers_result_t pcifront_common_process(int cmd,
 		pci_dbg(pcidev, "trying to call AER service\n");
 		switch (cmd) {
 		case XEN_PCI_OP_aer_detected:
-			result = pdrv->err_handler->
-				 error_detected(pcidev, state);
-			break;
+			return pdrv->err_handler->error_detected(pcidev, state);
 		case XEN_PCI_OP_aer_mmio:
-			result = pdrv->err_handler->
-				 mmio_enabled(pcidev);
-			break;
+			return pdrv->err_handler->mmio_enabled(pcidev);
 		case XEN_PCI_OP_aer_slotreset:
-			result = pdrv->err_handler->
-				 slot_reset(pcidev);
-			break;
+			return pdrv->err_handler->slot_reset(pcidev);
 		case XEN_PCI_OP_aer_resume:
 			pdrv->err_handler->resume(pcidev);
-			break;
+			return PCI_ERS_RESULT_NONE;
 		default:
 			dev_err(&pdev->xdev->dev,
-				"bad request in aer recovery "
-				"operation!\n");
+				"bad request in AER recovery operation!\n");
 		}
-
-		return result;
 	}
 
 	return PCI_ERS_RESULT_NONE;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7c1ceb39035c..03bfdb25a55c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -899,7 +899,10 @@ struct pci_driver {
 	struct pci_dynids	dynids;
 };
 
-#define	to_pci_driver(drv) container_of(drv, struct pci_driver, driver)
+static inline struct pci_driver *to_pci_driver(struct device_driver *drv)
+{
+    return drv ? container_of(drv, struct pci_driver, driver) : NULL;
+}
 
 /**
  * PCI_DEVICE - macro used to describe a specific PCI device

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox