LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v1 1/1] kernel.h: Split out panic and oops helpers
From: Andy Shevchenko @ 2021-04-09  8:22 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Corey Minyard, Linux on Hyper-V List, Tetsuo Handa,
	linux-remoteproc, Michael Kelley, Paul Mackerras, H. Peter Anvin,
	Joel Fernandes, K. Y. Srinivasan, Thomas Gleixner, Linux-Arch,
	Wei Liu, Stephen Hemminger, Corey Minyard,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT), Ingo Molnar,
	Iurii Zaikin, Ohad Ben-Cohen, Joerg Roedel, Kees Cook,
	Paul E. McKenney, Lai Jiangshan, Haiyang Zhang, Josh Triplett,
	Steven Rostedt (VMware), rcu, Borislav Petkov, openipmi-developer,
	Bjorn Andersson, Vlastimil Babka, Mathieu Poirier, kexec,
	Linux Kernel Mailing List, Luis Chamberlain, Arnd Bergmann,
	Eric Biederman, Linux FS Devel, Mathieu Desnoyers,
	open list:LINUX FOR POWERPC PA SEMI PWRFICIENT, Mike Rapoport
In-Reply-To: <20210408232303.453749e0e6fb0adfa8545440@linux-foundation.org>

On Thu, Apr 08, 2021 at 11:23:03PM -0700, Andrew Morton wrote:
> On Wed, 7 Apr 2021 11:46:37 +0300 Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> 
> > On Wed, Apr 7, 2021 at 11:17 AM Kees Cook <keescook@chromium.org> wrote:
> > >
> > > On Tue, Apr 06, 2021 at 04:31:58PM +0300, Andy Shevchenko wrote:
> > > > kernel.h is being used as a dump for all kinds of stuff for a long time.
> > > > Here is the attempt to start cleaning it up by splitting out panic and
> > > > oops helpers.
> > > >
> > > > At the same time convert users in header and lib folder to use new header.
> > > > Though for time being include new header back to kernel.h to avoid twisted
> > > > indirected includes for existing users.
> > > >
> > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > >
> > > I like it! Do you have a multi-arch CI to do allmodconfig builds to
> > > double-check this?
> > 
> > Unfortunately no, I rely on plenty of bots that are harvesting mailing lists.
> > 
> > But I will appreciate it if somebody can run this through various build tests.
> > 
> 
> um, did you try x86_64 allmodconfig?
> 
> I'm up to
> kernelh-split-out-panic-and-oops-helpers-fix-fix-fix-fix-fix-fix-fix.patch
> and counting.


I will try on my side and will fix those, thanks!

> and.... drivers/leds/trigger/ledtrig-heartbeat.c as well.
> 
> I'll drop it.

No problem, thanks for the report.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply

* [PATCH] [V2]powerpc/dts: fix not include DTC_FLAGS
From: Youlin Song @ 2021-04-09  8:51 UTC (permalink / raw)
  To: robh+dt, mpe, benh, paulus
  Cc: devicetree, linuxppc-dev, linux-kernel, Youlin Song

A central rule exists to create `$(obj)/%.dtb` from
`$(src)/%.dts`,DTC_FLAGS flag must be used with it.
See other architecture and Documentation:
arch/microblaze/boot/dts/Makefile
Documentation/kbuild/makefiles.rst +1433

Signed-off-by: Youlin Song <syl.loop@gmail.com>
---
 arch/powerpc/boot/Makefile     | 2 --
 arch/powerpc/boot/dts/Makefile | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 2b8da923ceca..a3bc3aec3c0c 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -72,8 +72,6 @@ endif
 
 BOOTCFLAGS	+= -I$(objtree)/$(obj) -I$(srctree)/$(obj)
 
-DTC_FLAGS	?= -p 1024
-
 $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
 $(obj)/ebony.o: BOOTCFLAGS += -mcpu=440
 $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405
diff --git a/arch/powerpc/boot/dts/Makefile b/arch/powerpc/boot/dts/Makefile
index fb335d05aae8..c21165c0cd76 100644
--- a/arch/powerpc/boot/dts/Makefile
+++ b/arch/powerpc/boot/dts/Makefile
@@ -2,5 +2,6 @@
 
 subdir-y += fsl
 
+DTC_FLAGS   ?= -p 1024
 dtstree		:= $(srctree)/$(src)
 dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
-- 
2.25.1


^ permalink raw reply related

* Re: [PATCH v6 32/48] KVM: PPC: Book3S HV P9: Read machine check registers while MSR[RI] is 0
From: Alexey Kardashevskiy @ 2021-04-09  8:55 UTC (permalink / raw)
  To: Nicholas Piggin, kvm-ppc; +Cc: linuxppc-dev
In-Reply-To: <20210405011948.675354-33-npiggin@gmail.com>



On 05/04/2021 11:19, Nicholas Piggin wrote:
> SRR0/1, DAR, DSISR must all be protected from machine check which can
> clobber them. Ensure MSR[RI] is clear while they are live.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>   arch/powerpc/kvm/book3s_hv.c           | 11 +++++++--
>   arch/powerpc/kvm/book3s_hv_interrupt.c | 33 +++++++++++++++++++++++---
>   arch/powerpc/kvm/book3s_hv_ras.c       |  2 ++
>   3 files changed, 41 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index d6eecedaa5a5..5f0ac6567a06 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -3567,11 +3567,16 @@ static int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
>   	mtspr(SPRN_BESCR, vcpu->arch.bescr);
>   	mtspr(SPRN_WORT, vcpu->arch.wort);
>   	mtspr(SPRN_TIDR, vcpu->arch.tid);
> -	mtspr(SPRN_DAR, vcpu->arch.shregs.dar);
> -	mtspr(SPRN_DSISR, vcpu->arch.shregs.dsisr);
>   	mtspr(SPRN_AMR, vcpu->arch.amr);
>   	mtspr(SPRN_UAMOR, vcpu->arch.uamor);
>   
> +	/*
> +	 * DAR, DSISR, and for nested HV, SPRGs must be set with MSR[RI]
> +	 * clear (or hstate set appropriately to catch those registers
> +	 * being clobbered if we take a MCE or SRESET), so those are done
> +	 * later.
> +	 */
> +
>   	if (!(vcpu->arch.ctrl & 1))
>   		mtspr(SPRN_CTRLT, mfspr(SPRN_CTRLF) & ~1);
>   
> @@ -3614,6 +3619,8 @@ static int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
>   			hvregs.vcpu_token = vcpu->vcpu_id;
>   		}
>   		hvregs.hdec_expiry = time_limit;
> +		mtspr(SPRN_DAR, vcpu->arch.shregs.dar);
> +		mtspr(SPRN_DSISR, vcpu->arch.shregs.dsisr);
>   		trap = plpar_hcall_norets(H_ENTER_NESTED, __pa(&hvregs),
>   					  __pa(&vcpu->arch.regs));
>   		kvmhv_restore_hv_return_state(vcpu, &hvregs);
> diff --git a/arch/powerpc/kvm/book3s_hv_interrupt.c b/arch/powerpc/kvm/book3s_hv_interrupt.c
> index 6fdd93936e16..e93d2a6456ff 100644
> --- a/arch/powerpc/kvm/book3s_hv_interrupt.c
> +++ b/arch/powerpc/kvm/book3s_hv_interrupt.c
> @@ -132,6 +132,7 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   	s64 hdec;
>   	u64 tb, purr, spurr;
>   	u64 *exsave;
> +	bool ri_set;
>   	unsigned long msr = mfmsr();
>   	int trap;
>   	unsigned long host_hfscr = mfspr(SPRN_HFSCR);
> @@ -203,9 +204,6 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   	 */
>   	mtspr(SPRN_HDEC, hdec);
>   
> -	mtspr(SPRN_SRR0, vcpu->arch.shregs.srr0);
> -	mtspr(SPRN_SRR1, vcpu->arch.shregs.srr1);
> -
>   	start_timing(vcpu, &vcpu->arch.rm_entry);
>   
>   	vcpu->arch.ceded = 0;
> @@ -231,6 +229,13 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   	 */
>   	mtspr(SPRN_HDSISR, HDSISR_CANARY);
>   
> +	__mtmsrd(0, 1); /* clear RI */
> +
> +	mtspr(SPRN_DAR, vcpu->arch.shregs.dar);
> +	mtspr(SPRN_DSISR, vcpu->arch.shregs.dsisr);
> +	mtspr(SPRN_SRR0, vcpu->arch.shregs.srr0);
> +	mtspr(SPRN_SRR1, vcpu->arch.shregs.srr1);
> +
>   	accumulate_time(vcpu, &vcpu->arch.guest_time);
>   
>   	local_paca->kvm_hstate.in_guest = KVM_GUEST_MODE_GUEST_HV_FAST;
> @@ -248,7 +253,13 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   
>   	/* 0x2 bit for HSRR is only used by PR and P7/8 HV paths, clear it */
>   	trap = local_paca->kvm_hstate.scratch0 & ~0x2;
> +
> +	/* HSRR interrupts leave MSR[RI] unchanged, SRR interrupts clear it. */
> +	ri_set = false;
>   	if (likely(trap > BOOK3S_INTERRUPT_MACHINE_CHECK)) {
> +		if (trap != BOOK3S_INTERRUPT_SYSCALL &&
> +				(vcpu->arch.shregs.msr & MSR_RI))
> +			ri_set = true;
>   		exsave = local_paca->exgen;
>   	} else if (trap == BOOK3S_INTERRUPT_SYSTEM_RESET) {
>   		exsave = local_paca->exnmi;
> @@ -258,6 +269,22 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   
>   	vcpu->arch.regs.gpr[1] = local_paca->kvm_hstate.scratch1;
>   	vcpu->arch.regs.gpr[3] = local_paca->kvm_hstate.scratch2;
> +
> +	/*
> +	 * Only set RI after reading machine check regs (DAR, DSISR, SRR0/1)
> +	 * and hstate scratch (which we need to move into exsave to make
> +	 * re-entrant vs SRESET/MCE)
> +	 */
> +	if (ri_set) {
> +		if (unlikely(!(mfmsr() & MSR_RI))) {
> +			__mtmsrd(MSR_RI, 1);
> +			WARN_ON_ONCE(1);
> +		}
> +	} else {
> +		WARN_ON_ONCE(mfmsr() & MSR_RI);
> +		__mtmsrd(MSR_RI, 1);
> +	}
> +
>   	vcpu->arch.regs.gpr[9] = exsave[EX_R9/sizeof(u64)];
>   	vcpu->arch.regs.gpr[10] = exsave[EX_R10/sizeof(u64)];
>   	vcpu->arch.regs.gpr[11] = exsave[EX_R11/sizeof(u64)];
> diff --git a/arch/powerpc/kvm/book3s_hv_ras.c b/arch/powerpc/kvm/book3s_hv_ras.c
> index d4bca93b79f6..8d8a4d5f0b55 100644
> --- a/arch/powerpc/kvm/book3s_hv_ras.c
> +++ b/arch/powerpc/kvm/book3s_hv_ras.c
> @@ -199,6 +199,8 @@ static void kvmppc_tb_resync_done(void)
>    * know about the exact state of the TB value. Resync TB call will
>    * restore TB to host timebase.
>    *
> + * This could use the new OPAL_HANDLE_HMI2 to avoid resyncing TB every time.


Educating myself - is it because OPAL_HANDLE_HMI2 tells if it is TB/TOD 
which is the problem so we can avoid calling opal_resync_timebase() if 
it is not TB? OPAL_HANDLE_HMI2 does not seem to resync TB itself. The 
comment just does not seem related to the rest of the patch.

Otherwise, looks good.

Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>


> + *
>    * Things to consider:
>    * - On TB error, HMI interrupt is reported on all the threads of the core
>    *   that has encountered TB error irrespective of split-core mode.
> 

-- 
Alexey

^ permalink raw reply

* [PATCH -next] powerpc/pseries: Make symbol '__pcpu_scope_hcall_stats' static
From: Bixuan Cui @ 2021-04-09  9:01 UTC (permalink / raw)
  To: cuibixuan, Michael Ellerman, Liu Shixin
  Cc: kernel-janitors, linuxppc-dev, linux-kernel

The sparse tool complains as follows:

arch/powerpc/platforms/pseries/hvCall_inst.c:29:1: warning:
 symbol '__pcpu_scope_hcall_stats' was not declared. Should it be static?

This symbol is not used outside of hvCall_inst.c, so this
commit marks it static.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
 arch/powerpc/platforms/pseries/hvCall_inst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c
index 2c59b4986ea5..3a50612a78db 100644
--- a/arch/powerpc/platforms/pseries/hvCall_inst.c
+++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
@@ -26,7 +26,7 @@ struct hcall_stats {
 };
 #define HCALL_STAT_ARRAY_SIZE	((MAX_HCALL_OPCODE >> 2) + 1)
 
-DEFINE_PER_CPU(struct hcall_stats[HCALL_STAT_ARRAY_SIZE], hcall_stats);
+static DEFINE_PER_CPU(struct hcall_stats[HCALL_STAT_ARRAY_SIZE], hcall_stats);
 
 /*
  * Routines for displaying the statistics in debugfs


^ permalink raw reply related

* [PATCH -next] powerpc/pseries/pmem: Make symbol 'drc_pmem_match' static
From: Bixuan Cui @ 2021-04-09  9:01 UTC (permalink / raw)
  To: cuibixuan, Michael Ellerman, Gautham R. Shenoy, Nathan Lynch,
	Aneesh Kumar K.V
  Cc: kernel-janitors, linuxppc-dev, linux-kernel

The sparse tool complains as follows:

arch/powerpc/platforms/pseries/pmem.c:142:27: warning:
 symbol 'drc_pmem_match' was not declared. Should it be static?

This symbol is not used outside of pmem.c, so this
commit marks it static.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
 arch/powerpc/platforms/pseries/pmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/pmem.c b/arch/powerpc/platforms/pseries/pmem.c
index e1dc5d3254df..439ac72c2470 100644
--- a/arch/powerpc/platforms/pseries/pmem.c
+++ b/arch/powerpc/platforms/pseries/pmem.c
@@ -139,7 +139,7 @@ int dlpar_hp_pmem(struct pseries_hp_errorlog *hp_elog)
 	return rc;
 }
 
-const struct of_device_id drc_pmem_match[] = {
+static const struct of_device_id drc_pmem_match[] = {
 	{ .type = "ibm,persistent-memory", },
 	{}
 };


^ permalink raw reply related

* [PATCH -next] powerpc/perf: Make symbol 'isa207_pmu_format_attr' static
From: Bixuan Cui @ 2021-04-09  9:01 UTC (permalink / raw)
  To: cuibixuan, Michael Ellerman, Athira Rajeev, Madhavan Srinivasan,
	Kajol Jain
  Cc: kernel-janitors, linuxppc-dev, linux-kernel

The sparse tool complains as follows:

arch/powerpc/perf/isa207-common.c:24:18: warning:
 symbol 'isa207_pmu_format_attr' was not declared. Should it be static?

This symbol is not used outside of isa207-common.c, so this
commit marks it static.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
 arch/powerpc/perf/isa207-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c
index e4f577da33d8..487f9e914b5c 100644
--- a/arch/powerpc/perf/isa207-common.c
+++ b/arch/powerpc/perf/isa207-common.c
@@ -21,7 +21,7 @@ PMU_FORMAT_ATTR(thresh_stop,	"config:32-35");
 PMU_FORMAT_ATTR(thresh_start,	"config:36-39");
 PMU_FORMAT_ATTR(thresh_cmp,	"config:40-49");
 
-struct attribute *isa207_pmu_format_attr[] = {
+static struct attribute *isa207_pmu_format_attr[] = {
 	&format_attr_event.attr,
 	&format_attr_pmcxsel.attr,
 	&format_attr_mark.attr,


^ permalink raw reply related

* [PATCH -next] powerpc/perf/hv-24x7: Make some symbols static
From: Bixuan Cui @ 2021-04-09  9:01 UTC (permalink / raw)
  To: cuibixuan, Michael Ellerman, Kajol Jain, Gautham R. Shenoy,
	Madhavan Srinivasan
  Cc: kernel-janitors, linuxppc-dev, linux-kernel

The sparse tool complains as follows:

arch/powerpc/perf/hv-24x7.c:229:1: warning:
 symbol '__pcpu_scope_hv_24x7_txn_flags' was not declared. Should it be static?
arch/powerpc/perf/hv-24x7.c:230:1: warning:
 symbol '__pcpu_scope_hv_24x7_txn_err' was not declared. Should it be static?
arch/powerpc/perf/hv-24x7.c:236:1: warning:
 symbol '__pcpu_scope_hv_24x7_hw' was not declared. Should it be static?
arch/powerpc/perf/hv-24x7.c:244:1: warning:
 symbol '__pcpu_scope_hv_24x7_reqb' was not declared. Should it be static?
arch/powerpc/perf/hv-24x7.c:245:1: warning:
 symbol '__pcpu_scope_hv_24x7_resb' was not declared. Should it be static?

This symbol is not used outside of hv-24x7.c, so this
commit marks it static.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
 arch/powerpc/perf/hv-24x7.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index e5eb33255066..1816f560a465 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -226,14 +226,14 @@ static struct attribute_group event_long_desc_group = {
 
 static struct kmem_cache *hv_page_cache;
 
-DEFINE_PER_CPU(int, hv_24x7_txn_flags);
-DEFINE_PER_CPU(int, hv_24x7_txn_err);
+static DEFINE_PER_CPU(int, hv_24x7_txn_flags);
+static DEFINE_PER_CPU(int, hv_24x7_txn_err);
 
 struct hv_24x7_hw {
 	struct perf_event *events[255];
 };
 
-DEFINE_PER_CPU(struct hv_24x7_hw, hv_24x7_hw);
+static DEFINE_PER_CPU(struct hv_24x7_hw, hv_24x7_hw);
 
 /*
  * request_buffer and result_buffer are not required to be 4k aligned,
@@ -241,8 +241,8 @@ DEFINE_PER_CPU(struct hv_24x7_hw, hv_24x7_hw);
  * the simplest way to ensure that.
  */
 #define H24x7_DATA_BUFFER_SIZE	4096
-DEFINE_PER_CPU(char, hv_24x7_reqb[H24x7_DATA_BUFFER_SIZE]) __aligned(4096);
-DEFINE_PER_CPU(char, hv_24x7_resb[H24x7_DATA_BUFFER_SIZE]) __aligned(4096);
+static DEFINE_PER_CPU(char, hv_24x7_reqb[H24x7_DATA_BUFFER_SIZE]) __aligned(4096);
+static DEFINE_PER_CPU(char, hv_24x7_resb[H24x7_DATA_BUFFER_SIZE]) __aligned(4096);
 
 static unsigned int max_num_requests(int interface_version)
 {


^ permalink raw reply related

* Re: [PATCH v3 4/9] powerpc/mm/book3s64: Fix possible build error
From: Christophe Leroy @ 2021-04-09  9:15 UTC (permalink / raw)
  To: Aneesh Kumar K.V, linux-mm, akpm; +Cc: joel, linuxppc-dev, npiggin, kaleshsingh
In-Reply-To: <20210330060752.592769-5-aneesh.kumar@linux.ibm.com>



Le 30/03/2021 à 08:07, Aneesh Kumar K.V a écrit :
> Update _tlbiel_pid() such that we can avoid build errors like below when
> using this function in other places.
> 
> arch/powerpc/mm/book3s64/radix_tlb.c: In function ‘__radix__flush_tlb_range_psize’:
> arch/powerpc/mm/book3s64/radix_tlb.c:114:2: warning: ‘asm’ operand 3 probably does not match constraints
>    114 |  asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
>        |  ^~~
> arch/powerpc/mm/book3s64/radix_tlb.c:114:2: error: impossible constraint in ‘asm’
> make[4]: *** [scripts/Makefile.build:271: arch/powerpc/mm/book3s64/radix_tlb.o] Error 1
> m
> 
> With this fix, we can also drop the __always_inline in __radix_flush_tlb_range_psize
> which was added by commit e12d6d7d46a6 ("powerpc/mm/radix: mark __radix__flush_tlb_range_psize() as __always_inline")
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
>   arch/powerpc/mm/book3s64/radix_tlb.c | 26 +++++++++++++++++---------
>   1 file changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
> index 409e61210789..817a02ef6032 100644
> --- a/arch/powerpc/mm/book3s64/radix_tlb.c
> +++ b/arch/powerpc/mm/book3s64/radix_tlb.c
> @@ -291,22 +291,30 @@ static inline void fixup_tlbie_lpid(unsigned long lpid)
>   /*
>    * We use 128 set in radix mode and 256 set in hpt mode.
>    */
> -static __always_inline void _tlbiel_pid(unsigned long pid, unsigned long ric)
> +static inline void _tlbiel_pid(unsigned long pid, unsigned long ric)
>   {
>   	int set;
>   
>   	asm volatile("ptesync": : :"memory");
>   
> -	/*
> -	 * Flush the first set of the TLB, and if we're doing a RIC_FLUSH_ALL,
> -	 * also flush the entire Page Walk Cache.
> -	 */
> -	__tlbiel_pid(pid, 0, ric);
> +	switch (ric) {
> +	case RIC_FLUSH_PWC:
>   
> -	/* For PWC, only one flush is needed */
> -	if (ric == RIC_FLUSH_PWC) {
> +		/* For PWC, only one flush is needed */
> +		__tlbiel_pid(pid, 0, RIC_FLUSH_PWC);
>   		ppc_after_tlbiel_barrier();
>   		return;
> +	case RIC_FLUSH_TLB:
> +		__tlbiel_pid(pid, 0, RIC_FLUSH_TLB);
> +		break;
> +	case RIC_FLUSH_ALL:
> +	default:
> +		/*
> +		 * Flush the first set of the TLB, and if
> +		 * we're doing a RIC_FLUSH_ALL, also flush
> +		 * the entire Page Walk Cache.
> +		 */
> +		__tlbiel_pid(pid, 0, RIC_FLUSH_ALL);
>   	}
>   
>   	if (!cpu_has_feature(CPU_FTR_ARCH_31)) {
> @@ -1176,7 +1184,7 @@ void radix__tlb_flush(struct mmu_gather *tlb)
>   	}
>   }
>   
> -static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
> +static void __radix__flush_tlb_range_psize(struct mm_struct *mm,
>   				unsigned long start, unsigned long end,
>   				int psize, bool also_pwc)
>   {
> 

^ permalink raw reply

* Re: [PATCH v3 5/9] powerpc/mm/book3s64: Update tlb flush routines to take a page walk cache flush argument
From: Christophe Leroy @ 2021-04-09  9:18 UTC (permalink / raw)
  To: Aneesh Kumar K.V, linux-mm, akpm; +Cc: joel, linuxppc-dev, npiggin, kaleshsingh
In-Reply-To: <20210330060752.592769-6-aneesh.kumar@linux.ibm.com>



Le 30/03/2021 à 08:07, Aneesh Kumar K.V a écrit :
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>   .../include/asm/book3s/64/tlbflush-radix.h    | 19 ++++++++-------
>   arch/powerpc/include/asm/book3s/64/tlbflush.h | 23 +++++++++++++++----
>   arch/powerpc/mm/book3s64/radix_hugetlbpage.c  |  4 ++--
>   arch/powerpc/mm/book3s64/radix_tlb.c          | 23 ++++++++-----------
>   4 files changed, 42 insertions(+), 27 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> index 8b33601cdb9d..90c91f7b526f 100644
> --- a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> @@ -56,15 +56,18 @@ static inline void radix__flush_all_lpid_guest(unsigned int lpid)
>   }
>   #endif
>   
> -extern void radix__flush_hugetlb_tlb_range(struct vm_area_struct *vma,
> -					   unsigned long start, unsigned long end);
> -extern void radix__flush_tlb_range_psize(struct mm_struct *mm, unsigned long start,
> -					 unsigned long end, int psize);
> -extern void radix__flush_pmd_tlb_range(struct vm_area_struct *vma,
> -				       unsigned long start, unsigned long end);
> -extern void radix__flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
> +void radix__flush_hugetlb_tlb_range(struct vm_area_struct *vma,
> +				    unsigned long start, unsigned long end,
> +				    bool also_pwc);

No sure 'also_pwc' is a nice name.

What about 'flush_pwc' ?


> +void radix__flush_pmd_tlb_range(struct vm_area_struct *vma,
> +				unsigned long start, unsigned long end,
> +				bool also_pwc);
> +void radix__flush_tlb_pwc_range_psize(struct mm_struct *mm, unsigned long start,
> +				      unsigned long end, int psize, bool also_pwc);
> +void radix__flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
>   			    unsigned long end);
> -extern void radix__flush_tlb_kernel_range(unsigned long start, unsigned long end);
> +void radix__flush_tlb_kernel_range(unsigned long start, unsigned long end);
> +
>   
>   extern void radix__local_flush_tlb_mm(struct mm_struct *mm);
>   extern void radix__local_flush_all_mm(struct mm_struct *mm);
> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush.h b/arch/powerpc/include/asm/book3s/64/tlbflush.h
> index 215973b4cb26..efe5336e2b6f 100644
> --- a/arch/powerpc/include/asm/book3s/64/tlbflush.h
> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush.h
> @@ -45,13 +45,30 @@ static inline void tlbiel_all_lpid(bool radix)
>   		hash__tlbiel_all(TLB_INVAL_SCOPE_LPID);
>   }
>   
> +static inline void flush_pmd_tlb_pwc_range(struct vm_area_struct *vma,
> +					   unsigned long start,
> +					   unsigned long end,
> +					   bool also_pwc)
> +{
> +	if (radix_enabled())
> +		return radix__flush_pmd_tlb_range(vma, start, end, also_pwc);
> +	return hash__flush_tlb_range(vma, start, end);
> +}
>   
>   #define __HAVE_ARCH_FLUSH_PMD_TLB_RANGE
>   static inline void flush_pmd_tlb_range(struct vm_area_struct *vma,
>   				       unsigned long start, unsigned long end)
> +{
> +	return flush_pmd_tlb_pwc_range(vma, start, end, false);
> +}
> +
> +static inline void flush_hugetlb_tlb_pwc_range(struct vm_area_struct *vma,
> +					       unsigned long start,
> +					       unsigned long end,
> +					       bool also_pwc)
>   {
>   	if (radix_enabled())
> -		return radix__flush_pmd_tlb_range(vma, start, end);
> +		return radix__flush_hugetlb_tlb_range(vma, start, end, also_pwc);
>   	return hash__flush_tlb_range(vma, start, end);
>   }
>   
> @@ -60,9 +77,7 @@ static inline void flush_hugetlb_tlb_range(struct vm_area_struct *vma,
>   					   unsigned long start,
>   					   unsigned long end)
>   {
> -	if (radix_enabled())
> -		return radix__flush_hugetlb_tlb_range(vma, start, end);
> -	return hash__flush_tlb_range(vma, start, end);
> +	return flush_hugetlb_tlb_pwc_range(vma, start, end, false);
>   }
>   
>   static inline void flush_tlb_range(struct vm_area_struct *vma,
> diff --git a/arch/powerpc/mm/book3s64/radix_hugetlbpage.c b/arch/powerpc/mm/book3s64/radix_hugetlbpage.c
> index cb91071eef52..55c5c9c39ae2 100644
> --- a/arch/powerpc/mm/book3s64/radix_hugetlbpage.c
> +++ b/arch/powerpc/mm/book3s64/radix_hugetlbpage.c
> @@ -26,13 +26,13 @@ void radix__local_flush_hugetlb_page(struct vm_area_struct *vma, unsigned long v
>   }
>   
>   void radix__flush_hugetlb_tlb_range(struct vm_area_struct *vma, unsigned long start,
> -				   unsigned long end)
> +				    unsigned long end, bool also_pwc)
>   {
>   	int psize;
>   	struct hstate *hstate = hstate_file(vma->vm_file);
>   
>   	psize = hstate_get_psize(hstate);
> -	radix__flush_tlb_range_psize(vma->vm_mm, start, end, psize);
> +	radix__flush_tlb_pwc_range_psize(vma->vm_mm, start, end, psize, also_pwc);
>   }
>   
>   /*
> diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
> index 817a02ef6032..416fe9b48e14 100644
> --- a/arch/powerpc/mm/book3s64/radix_tlb.c
> +++ b/arch/powerpc/mm/book3s64/radix_tlb.c
> @@ -1090,7 +1090,7 @@ void radix__flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
>   {
>   #ifdef CONFIG_HUGETLB_PAGE
>   	if (is_vm_hugetlb_page(vma))
> -		return radix__flush_hugetlb_tlb_range(vma, start, end);
> +		return radix__flush_hugetlb_tlb_range(vma, start, end, false);
>   #endif
>   
>   	__radix__flush_tlb_range(vma->vm_mm, start, end);
> @@ -1151,9 +1151,6 @@ void radix__flush_all_lpid_guest(unsigned int lpid)
>   	_tlbie_lpid_guest(lpid, RIC_FLUSH_ALL);
>   }
>   
> -static void radix__flush_tlb_pwc_range_psize(struct mm_struct *mm, unsigned long start,
> -				  unsigned long end, int psize);
> -
>   void radix__tlb_flush(struct mmu_gather *tlb)
>   {
>   	int psize = 0;
> @@ -1177,10 +1174,8 @@ void radix__tlb_flush(struct mmu_gather *tlb)
>   		else
>   			radix__flush_all_mm(mm);
>   	} else {
> -		if (!tlb->freed_tables)
> -			radix__flush_tlb_range_psize(mm, start, end, psize);
> -		else
> -			radix__flush_tlb_pwc_range_psize(mm, start, end, psize);
> +		radix__flush_tlb_pwc_range_psize(mm, start,
> +						 end, psize, tlb->freed_tables);
>   	}
>   }
>   
> @@ -1260,10 +1255,10 @@ void radix__flush_tlb_range_psize(struct mm_struct *mm, unsigned long start,
>   	return __radix__flush_tlb_range_psize(mm, start, end, psize, false);
>   }
>   
> -static void radix__flush_tlb_pwc_range_psize(struct mm_struct *mm, unsigned long start,
> -				  unsigned long end, int psize)
> +void radix__flush_tlb_pwc_range_psize(struct mm_struct *mm, unsigned long start,
> +				      unsigned long end, int psize, bool also_pwc)
>   {
> -	__radix__flush_tlb_range_psize(mm, start, end, psize, true);
> +	__radix__flush_tlb_range_psize(mm, start, end, psize, also_pwc);
>   }
>   
>   #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> @@ -1315,9 +1310,11 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
>   #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
>   
>   void radix__flush_pmd_tlb_range(struct vm_area_struct *vma,
> -				unsigned long start, unsigned long end)
> +				unsigned long start, unsigned long end,
> +				bool also_pwc)
>   {
> -	radix__flush_tlb_range_psize(vma->vm_mm, start, end, MMU_PAGE_2M);
> +	__radix__flush_tlb_range_psize(vma->vm_mm, start,
> +				       end, MMU_PAGE_2M, also_pwc);
>   }
>   EXPORT_SYMBOL(radix__flush_pmd_tlb_range);
>   
> 

^ permalink raw reply

* Re: [PATCH v3 8/9] mm/mremap: Allow arch runtime override
From: Christophe Leroy @ 2021-04-09  9:35 UTC (permalink / raw)
  To: Aneesh Kumar K.V, linux-mm, akpm; +Cc: joel, linuxppc-dev, npiggin, kaleshsingh
In-Reply-To: <20210330060752.592769-9-aneesh.kumar@linux.ibm.com>



Le 30/03/2021 à 08:07, Aneesh Kumar K.V a écrit :
> Architectures like ppc64 can only support faster mremap only with radix

... only .... only ...

> translation. Hence allow a runtime check w.r.t support for fast mremap.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>   arch/arc/include/asm/tlb.h     |  5 +++++
>   arch/arm64/include/asm/tlb.h   |  6 ++++++
>   arch/powerpc/include/asm/tlb.h |  6 ++++++
>   arch/x86/include/asm/tlb.h     |  5 +++++
>   mm/mremap.c                    | 14 +++++++++++++-
>   5 files changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arc/include/asm/tlb.h b/arch/arc/include/asm/tlb.h
> index 975b35d3738d..22b8cfb46cbf 100644
> --- a/arch/arc/include/asm/tlb.h
> +++ b/arch/arc/include/asm/tlb.h
> @@ -9,4 +9,9 @@
>   #include <linux/pagemap.h>
>   #include <asm-generic/tlb.h>
>   
> +#define arch_supports_page_tables_move arch_supports_page_tables_move
> +static inline bool arch_supports_page_tables_move(void)
> +{
> +	return true;
> +}

I can't see why ARC arch needs that. It neither selects CONFIG_HAVE_MOVE_PMD nor CONFIG_HAVE_MOVE_PUD.


>   #endif /* _ASM_ARC_TLB_H */
> diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h
> index 61c97d3b58c7..fe209efc6a10 100644
> --- a/arch/arm64/include/asm/tlb.h
> +++ b/arch/arm64/include/asm/tlb.h
> @@ -94,4 +94,10 @@ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp,
>   }
>   #endif
>   
> +#define arch_supports_page_tables_move arch_supports_page_tables_move
> +static inline bool arch_supports_page_tables_move(void)
> +{
> +	return true;
> +}
> +
>   #endif
> diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/asm/tlb.h
> index 160422a439aa..058918a7cd3c 100644
> --- a/arch/powerpc/include/asm/tlb.h
> +++ b/arch/powerpc/include/asm/tlb.h
> @@ -83,5 +83,11 @@ static inline int mm_is_thread_local(struct mm_struct *mm)
>   }
>   #endif
>   
> +#define arch_supports_page_tables_move arch_supports_page_tables_move
> +static inline bool arch_supports_page_tables_move(void)
> +{
> +	return radix_enabled();
> +}
> +
>   #endif /* __KERNEL__ */
>   #endif /* __ASM_POWERPC_TLB_H */
> diff --git a/arch/x86/include/asm/tlb.h b/arch/x86/include/asm/tlb.h
> index 1bfe979bb9bc..62915238bb36 100644
> --- a/arch/x86/include/asm/tlb.h
> +++ b/arch/x86/include/asm/tlb.h
> @@ -37,4 +37,9 @@ static inline void __tlb_remove_table(void *table)
>   	free_page_and_swap_cache(table);
>   }
>   
> +#define arch_supports_page_tables_move arch_supports_page_tables_move
> +static inline bool arch_supports_page_tables_move(void)
> +{
> +	return true;
> +}
>   #endif /* _ASM_X86_TLB_H */
> diff --git a/mm/mremap.c b/mm/mremap.c
> index 7ac1df8e6d51..4d812af3e44b 100644
> --- a/mm/mremap.c
> +++ b/mm/mremap.c
> @@ -25,7 +25,7 @@
>   #include <linux/userfaultfd_k.h>
>   
>   #include <asm/cacheflush.h>
> -#include <asm/tlbflush.h>
> +#include <asm/tlb.h>
>   #include <asm/pgalloc.h>
>   
>   #include "internal.h"
> @@ -221,6 +221,14 @@ static inline void flush_pte_tlb_pwc_range(struct vm_area_struct *vma,
>   }
>   #endif
>   
> +#ifndef arch_supports_page_tables_move
> +#define arch_supports_page_tables_move arch_supports_page_tables_move
> +static inline bool arch_supports_page_tables_move(void)
> +{
> +	return false;

Can you do

	return IS_ENABLED(CONFIG_HAVE_MOVE_PMD) || IS_ENABLED(CONFIG_HAVE_MOVE_PUD);

And then remove the arch_supports_page_tables_move() you have added for arc, arm64 and x86 ?

> +}
> +#endif
> +
>   #ifdef CONFIG_HAVE_MOVE_PMD

Next step could be remove that #ifdef and the content of the matching #else
For that we'd just need a stub version of set_pmd_at() and set_pud_at().

>   static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr,
>   		  unsigned long new_addr, pmd_t *old_pmd, pmd_t *new_pmd)
> @@ -229,6 +237,8 @@ static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr,
>   	struct mm_struct *mm = vma->vm_mm;
>   	pmd_t pmd;
>   
> +	if (!arch_supports_page_tables_move())
> +		return false;
>   	/*
>   	 * The destination pmd shouldn't be established, free_pgtables()
>   	 * should have released it.
> @@ -295,6 +305,8 @@ static bool move_normal_pud(struct vm_area_struct *vma, unsigned long old_addr,
>   	struct mm_struct *mm = vma->vm_mm;
>   	pud_t pud;
>   
> +	if (!arch_supports_page_tables_move())
> +		return false;
>   	/*
>   	 * The destination pud shouldn't be established, free_pgtables()
>   	 * should have released it.
> 

^ permalink raw reply

* Re: [PATCH v6 33/48] KVM: PPC: Book3S HV P9: Improve exit timing accounting coverage
From: Alexey Kardashevskiy @ 2021-04-09  9:40 UTC (permalink / raw)
  To: Nicholas Piggin, kvm-ppc; +Cc: linuxppc-dev
In-Reply-To: <20210405011948.675354-34-npiggin@gmail.com>



On 05/04/2021 11:19, Nicholas Piggin wrote:
> The C conversion caused exit timing to become a bit cramped. Expand it
> to cover more of the entry and exit code.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>


Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>

> ---
>   arch/powerpc/kvm/book3s_hv_interrupt.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_hv_interrupt.c b/arch/powerpc/kvm/book3s_hv_interrupt.c
> index e93d2a6456ff..44c77f907f91 100644
> --- a/arch/powerpc/kvm/book3s_hv_interrupt.c
> +++ b/arch/powerpc/kvm/book3s_hv_interrupt.c
> @@ -154,6 +154,8 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   	if (hdec < 0)
>   		return BOOK3S_INTERRUPT_HV_DECREMENTER;
>   
> +	start_timing(vcpu, &vcpu->arch.rm_entry);
> +
>   	if (vc->tb_offset) {
>   		u64 new_tb = tb + vc->tb_offset;
>   		mtspr(SPRN_TBU40, new_tb);
> @@ -204,8 +206,6 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   	 */
>   	mtspr(SPRN_HDEC, hdec);
>   
> -	start_timing(vcpu, &vcpu->arch.rm_entry);
> -
>   	vcpu->arch.ceded = 0;
>   
>   	WARN_ON_ONCE(vcpu->arch.shregs.msr & MSR_HV);
> @@ -349,8 +349,6 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   
>   	accumulate_time(vcpu, &vcpu->arch.rm_exit);
>   
> -	end_timing(vcpu);
> -
>   	/* Advance host PURR/SPURR by the amount used by guest */
>   	purr = mfspr(SPRN_PURR);
>   	spurr = mfspr(SPRN_SPURR);
> @@ -415,6 +413,8 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   
>   	switch_mmu_to_host_radix(kvm, host_pidr);
>   
> +	end_timing(vcpu);
> +
>   	return trap;
>   }
>   EXPORT_SYMBOL_GPL(kvmhv_vcpu_entry_p9);
> 

-- 
Alexey

^ permalink raw reply

* [PATCH -next] macintosh/via-pmu: Use DEFINE_SPINLOCK() for spinlock
From: Ye Bin @ 2021-04-09  9:51 UTC (permalink / raw)
  To: yebin10, Benjamin Herrenschmidt, Andrew Morton, Mike Rapoport,
	Al Viro
  Cc: kernel-janitors, linuxppc-dev, linux-kernel, Hulk Robot

spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
 drivers/macintosh/via-pmu.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 73e6ae88fafd..bab913e3541a 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -161,7 +161,7 @@ static unsigned char __iomem *gpio_reg;
 static int gpio_irq = 0;
 static int gpio_irq_enabled = -1;
 static volatile int pmu_suspended;
-static spinlock_t pmu_lock;
+static DEFINE_SPINLOCK(pmu_lock);
 static u8 pmu_intr_mask;
 static int pmu_version;
 static int drop_interrupts;
@@ -306,8 +306,6 @@ int __init find_via_pmu(void)
 		goto fail;
 	}
 
-	spin_lock_init(&pmu_lock);
-
 	pmu_has_adb = 1;
 
 	pmu_intr_mask =	PMU_INT_PCEJECT |
@@ -389,8 +387,6 @@ int __init find_via_pmu(void)
 
 	pmu_kind = PMU_UNKNOWN;
 
-	spin_lock_init(&pmu_lock);
-
 	pmu_has_adb = 1;
 
 	pmu_intr_mask =	PMU_INT_PCEJECT |


^ permalink raw reply related

* [PATCH -next] soc: fsl: qe: use DEFINE_SPINLOCK() for spinlock
From: Ye Bin @ 2021-04-09  9:51 UTC (permalink / raw)
  To: yebin10, Qiang Zhao, Li Yang
  Cc: kernel-janitors, linuxppc-dev, linux-kernel, linux-arm-kernel,
	Hulk Robot

spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
 drivers/soc/fsl/qe/qe_common.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c
index 654e9246ce6b..a0cb8e746879 100644
--- a/drivers/soc/fsl/qe/qe_common.c
+++ b/drivers/soc/fsl/qe/qe_common.c
@@ -26,7 +26,7 @@
 #include <soc/fsl/qe/qe.h>
 
 static struct gen_pool *muram_pool;
-static spinlock_t cpm_muram_lock;
+static DEFINE_SPINLOCK(cpm_muram_lock);
 static void __iomem *muram_vbase;
 static phys_addr_t muram_pbase;
 
@@ -54,7 +54,6 @@ int cpm_muram_init(void)
 	if (muram_pbase)
 		return 0;
 
-	spin_lock_init(&cpm_muram_lock);
 	np = of_find_compatible_node(NULL, NULL, "fsl,cpm-muram-data");
 	if (!np) {
 		/* try legacy bindings */


^ permalink raw reply related

* Re: [PATCH -next] [POWERPC] Rename get_property to of_get_property: use DEFINE_SPINLOCK() for spinlock
From: weiyongjun (A) @ 2021-04-09  9:47 UTC (permalink / raw)
  To: Ye Bin, Benjamin Herrenschmidt
  Cc: kernel-janitors, linuxppc-dev, linux-kernel, Hulk Robot
In-Reply-To: <20210409095148.2294319-1-yebin10@huawei.com>

Rename get_property to of_get_property: use DEFINE_SPINLOCK() for spinlock

~~~~~~~~~~~~~

这是啥模块名?


在 2021/4/9 17:51, Ye Bin 写道:
> spinlock can be initialized automatically with DEFINE_SPINLOCK()
> rather than explicitly calling spin_lock_init().
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
>   drivers/macintosh/via-pmu-led.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c
> index ae067ab2373d..2502119cff42 100644
> --- a/drivers/macintosh/via-pmu-led.c
> +++ b/drivers/macintosh/via-pmu-led.c
> @@ -27,7 +27,7 @@
>   #include <linux/pmu.h>
>   #include <asm/prom.h>
>   
> -static spinlock_t pmu_blink_lock;
> +static DEFINE_SPINLOCK(pmu_blink_lock);
>   static struct adb_request pmu_blink_req;
>   /* -1: no change, 0: request off, 1: request on */
>   static int requested_change;
> @@ -105,8 +105,6 @@ static int __init via_pmu_led_init(void)
>   		return -ENODEV;
>   	}
>   	of_node_put(dt);
> -
> -	spin_lock_init(&pmu_blink_lock);
>   	/* no outstanding req */
>   	pmu_blink_req.complete = 1;
>   	pmu_blink_req.done = pmu_req_done;
>

^ permalink raw reply

* Re: [PATCH -next] [POWERPC] Rename get_property to of_get_property: use DEFINE_SPINLOCK() for spinlock
From: weiyongjun (A) @ 2021-04-09  9:52 UTC (permalink / raw)
  To: Ye Bin, Benjamin Herrenschmidt
  Cc: kernel-janitors, linuxppc-dev, linux-kernel, Hulk Robot
In-Reply-To: <4b0b16f3-bb06-3a90-5148-ea8302bb3a58@huawei.com>


Rename get_property to of_get_property: use DEFINE_SPINLOCK() for spinlock

^^^^^^^^^

Please fix the module name in the patch subject.


> spinlock can be initialized automatically with DEFINE_SPINLOCK()
>
>> rather than explicitly calling spin_lock_init().
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Ye Bin <yebin10@huawei.com>
>> ---
>>   drivers/macintosh/via-pmu-led.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/macintosh/via-pmu-led.c 
>> b/drivers/macintosh/via-pmu-led.c
>> index ae067ab2373d..2502119cff42 100644
>> --- a/drivers/macintosh/via-pmu-led.c
>> +++ b/drivers/macintosh/via-pmu-led.c
>> @@ -27,7 +27,7 @@
>>   #include <linux/pmu.h>
>>   #include <asm/prom.h>
>>   -static spinlock_t pmu_blink_lock;
>> +static DEFINE_SPINLOCK(pmu_blink_lock);
>>   static struct adb_request pmu_blink_req;
>>   /* -1: no change, 0: request off, 1: request on */
>>   static int requested_change;
>> @@ -105,8 +105,6 @@ static int __init via_pmu_led_init(void)
>>           return -ENODEV;
>>       }
>>       of_node_put(dt);
>> -
>> -    spin_lock_init(&pmu_blink_lock);
>>       /* no outstanding req */
>>       pmu_blink_req.complete = 1;
>>       pmu_blink_req.done = pmu_req_done;
>>

^ permalink raw reply

* [PATCH -next] powerpc/pmac: remove not use symbol
From: Zucheng Zheng @ 2021-04-09  9:35 UTC (permalink / raw)
  To: benh, mpe, paulus, oohall, akpm, rppt, christophe.leroy
  Cc: linuxppc-dev, linux-kernel

sccdbg symbol is not used, so remove it

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zucheng Zheng <zhengzucheng@huawei.com>
---
 arch/powerpc/platforms/powermac/setup.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index db5107c80485..df9ea37d5708 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -83,10 +83,6 @@ extern struct machdep_calls pmac_md;
 
 #define DEFAULT_ROOT_DEVICE Root_SDA1	/* sda1 - slightly silly choice */
 
-#ifdef CONFIG_PPC64
-int sccdbg;
-#endif
-
 sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
 EXPORT_SYMBOL(sys_ctrler);
 
-- 
2.17.1


^ permalink raw reply related

* [PATCH -next] powerpc/pmac: Make some symbols static
From: Zucheng Zheng @ 2021-04-09  9:38 UTC (permalink / raw)
  To: benh, mpe, paulus, rppt, christophe.leroy, akpm, oohall
  Cc: linuxppc-dev, linux-kernel

ppc_override_l2cr/ppc_override_l2cr_value/has_l2cache symbol is not used
outside of setup.c, so commit marks it static.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zucheng Zheng <zhengzucheng@huawei.com>
---
 arch/powerpc/platforms/powermac/setup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 86aee3f2483f..db5107c80485 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -71,9 +71,9 @@
 
 #undef SHOW_GATWICK_IRQS
 
-int ppc_override_l2cr = 0;
-int ppc_override_l2cr_value;
-int has_l2cache = 0;
+static int ppc_override_l2cr;
+static int ppc_override_l2cr_value;
+static int has_l2cache;
 
 int pmac_newworld;
 
-- 
2.17.1


^ permalink raw reply related

* [PATCH -next] [POWERPC] Rename get_property to of_get_property: use DEFINE_SPINLOCK() for spinlock
From: Ye Bin @ 2021-04-09  9:51 UTC (permalink / raw)
  To: yebin10, Benjamin Herrenschmidt
  Cc: kernel-janitors, linuxppc-dev, linux-kernel, Hulk Robot

spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
 drivers/macintosh/via-pmu-led.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c
index ae067ab2373d..2502119cff42 100644
--- a/drivers/macintosh/via-pmu-led.c
+++ b/drivers/macintosh/via-pmu-led.c
@@ -27,7 +27,7 @@
 #include <linux/pmu.h>
 #include <asm/prom.h>
 
-static spinlock_t pmu_blink_lock;
+static DEFINE_SPINLOCK(pmu_blink_lock);
 static struct adb_request pmu_blink_req;
 /* -1: no change, 0: request off, 1: request on */
 static int requested_change;
@@ -105,8 +105,6 @@ static int __init via_pmu_led_init(void)
 		return -ENODEV;
 	}
 	of_node_put(dt);
-
-	spin_lock_init(&pmu_blink_lock);
 	/* no outstanding req */
 	pmu_blink_req.complete = 1;
 	pmu_blink_req.done = pmu_req_done;


^ permalink raw reply related

* Re: [PATCH 1/1] powerpc/smp: Set numa node before updating mask
From: Srikar Dronamraju @ 2021-04-09 10:14 UTC (permalink / raw)
  To: Nathan Lynch
  Cc: Gautham R Shenoy, Peter Zijlstra, Scott Cheloha,
	Geetika Moolchandani, Valentin Schneider, Laurent Dufour,
	linuxppc-dev, Ingo Molnar
In-Reply-To: <87czvdbova.fsf@linux.ibm.com>

Hey Nathan,

>
> Regardless of your change: at boot time, this set of calls to
> set_numa_node() and set_numa_mem() is redundant, right? Because
> smp_prepare_cpus() has:
>
> 	for_each_possible_cpu(cpu) {
> 		...
> 		if (cpu_present(cpu)) {
> 			set_cpu_numa_node(cpu, numa_cpu_lookup_table[cpu]);
> 			set_cpu_numa_mem(cpu,
> 				local_memory_node(numa_cpu_lookup_table[cpu]));
> 		}
>
> I would rather that, when onlining a CPU that happens to have been
> dynamically added after boot, we enter start_secondary() with conditions
> equivalent to those at boot time. Or as close to that as is practical.
>
> So I'd suggest that pseries_add_processor() be made to update
> these things when the CPUs are marked present, before onlining them.

I did try updating at pseries_add_processor when things were being marked as
present. But looks like the zonelists may not be updated at that time.
I saw couple of crashes in local_memory_node() when dplar adding CPUs.
(Appending the patch that causes these crash to this mail for your reference)

[  293.669901] Kernel attempted to read user page (1508) - exploit attempt? (uid: 0)                                                                                                                     [1309/17174]
[  293.669925] BUG: Kernel NULL pointer dereference on read at 0x00001508
[  293.669935] Faulting instruction address: 0xc000000000484ae0
[  293.669947] Oops: Kernel access of bad area, sig: 11 [#1]
[  293.669956] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
[  293.669969] Modules linked in: nft_counter nft_compat rpadlpar_io rpaphp
mptcp_diag xsk_diag tcp_diag udp_diag raw_diag inet_diag unix_diag
af_packet_diag netlink_diag bonding tls nft_fib_inet nft_fib_ipv4 nft_ fib_ipv6
nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct
nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 rfkill ip_set
nf_tables nfnetlink dm_multipath pseries_rng xts vmx_c rypto uio_pdrv_genirq
uio binfmt_misc ip_tables xfs libcrc32c sd_mod t10_pi sg ibmvscsi ibmveth
scsi_transport_srp dm_mirror dm_region_hash dm_log dm_mod fuse
[  293.670101] CPU: 17 PID: 3183 Comm: drmgr Not tainted 5.12.0-rc5-master+ #2
[  293.670113] NIP:  c000000000484ae0 LR: c00000000010a548 CTR: 00000000006dd130
[  293.670121] REGS: c0000025a9997160 TRAP: 0300   Not tainted  (5.12.0-rc5-master+)
[  293.670131] MSR:  8000000000009033 <SF,EE,ME,IR,DR,RI,LE>  CR: 48008422  XER: 00000008
[  293.670155] CFAR: c00000000010a544 DAR: 0000000000001508 DSISR: 40000000 IRQMASK: 0
[  293.670155] GPR00: c00000000010a548 c0000025a9997400 c000000001f55500 0000000000000000
[  293.670155] GPR04: c000000001a3c598 0000000000000006 0000000000000027 c0000035873b8018
[  293.670155] GPR08: 0000000000000023 c0000000020464f8 00000035894d0000 c000003584c8ffe8
[  293.670155] GPR12: 0000000028008424 c0000035bf22ce80 0000000000000000 0000000000000000
[  293.670155] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  293.670155] GPR20: 0000000000000000 0000000000000000 0000000000000000 c000000001fbc160
[  293.670155] GPR24: 0000000000000002 0000000000000200 c000000001fc04c8 0000000000000001
[  293.670155] GPR28: c0000000010c6fc8 c000000001fc08a0 c000002f8fb99e60 0000000000000040
[  293.670263] NIP [c000000000484ae0] local_memory_node+0x20/0x80
[  293.670281] LR [c00000000010a548] pseries_add_processor+0x368/0x3b0
[  293.670292] Call Trace:
[  293.670297] [c0000025a9997400] [c00000000010a524] pseries_add_processor+0x344/0x3b0 (unreliable)
[  293.670311] [c0000025a99976c0] [c00000000010a790] pseries_smp_notifier+0x200/0x2a0
[  293.670322] [c0000025a9997780] [c000000000197288] blocking_notifier_call_chain+0xa8/0x110
[  293.670335] [c0000025a99977d0] [c000000000b27010] of_attach_node+0xc0/0x110
[  293.670347] [c0000025a9997830] [c0000000001032a0] dlpar_attach_node+0x30/0x70
[  293.670358] [c0000025a99978a0] [c000000000109ac0] dlpar_cpu_add+0x1d0/0x510
[  293.670368] [c0000025a9997980] [c00000000010a898] dlpar_cpu+0x68/0x6e0
[  293.670377] [c0000025a9997a80] [c0000000001036b8] handle_dlpar_errorlog+0xf8/0x190
[  293.670388] [c0000025a9997af0] [c000000000103928] dlpar_store+0x178/0x4a0
[  293.670396] [c0000025a9997bb0] [c0000000007df050] kobj_attr_store+0x30/0x50
[  293.670408] [c0000025a9997bd0] [c00000000062f0b0] sysfs_kf_write+0x70/0xb0
[  293.670421] [c0000025a9997c10] [c00000000062d4e0] kernfs_fop_write_iter+0x1d0/0x280
[  293.670432] [c0000025a9997c60] [c00000000051673c] new_sync_write+0x14c/0x1d0
[  293.670445] [c0000025a9997d00] [c000000000519df4] vfs_write+0x264/0x380
[  293.670455] [c0000025a9997d60] [c00000000051a0ec] ksys_write+0x7c/0x140
[  293.670464] [c0000025a9997db0] [c000000000032af0] system_call_exception+0x150/0x290
[  293.670475] [c0000025a9997e10] [c00000000000d45c] system_call_common+0xec/0x278
[  293.670486] --- interrupt: c00 at 0x20000025bd74

That leaves us with just 2 options for now.
1. Update numa_mem later and only update numa_node here.
- Over a longer period of time, this would be more confusing since we
may lose track of why we are splitting the set of numa_node and numa_mem.

or
2. Use my earlier patch.

My choice would be to go with my earlier patch.
Please do let me know your thoughts on the same.

-- 
Thanks and Regards
Srikar Dronamraju

diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 3beeb030cd78..1cdd83703f93 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -44,6 +44,7 @@ extern void __init dump_numa_cpu_topology(void);
 
 extern int sysfs_add_device_to_node(struct device *dev, int nid);
 extern void sysfs_remove_device_from_node(struct device *dev, int nid);
+extern int numa_setup_cpu(unsigned long cpu);
 
 static inline void update_numa_cpu_lookup_table(unsigned int cpu, int node)
 {
@@ -81,6 +82,11 @@ static inline void sysfs_remove_device_from_node(struct device *dev,
 {
 }
 
+static int numa_setup_cpu(unsigned long cpu)
+{
+	return first_online_node;
+}
+
 static inline void update_numa_cpu_lookup_table(unsigned int cpu, int node) {}
 
 static inline int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 5a4d59a1070d..0d0c71ba4672 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1539,9 +1539,6 @@ void start_secondary(void *unused)
 			shared_caches = true;
 	}
 
-	set_numa_node(numa_cpu_lookup_table[cpu]);
-	set_numa_mem(local_memory_node(numa_cpu_lookup_table[cpu]));
-
 	smp_wmb();
 	notify_cpu_starting(cpu);
 	set_cpu_online(cpu, true);
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f2bf98bdcea2..11914a28db67 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -501,7 +501,7 @@ static int vphn_get_nid(long unused)
  * Figure out to which domain a cpu belongs and stick it there.
  * Return the id of the domain used.
  */
-static int numa_setup_cpu(unsigned long lcpu)
+int numa_setup_cpu(unsigned long lcpu)
 {
 	struct device_node *cpu;
 	int fcpu = cpu_first_thread_sibling(lcpu);
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 12cbffd3c2e3..311fbe916d5b 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -198,9 +198,14 @@ static int pseries_add_processor(struct device_node *np)
 	}
 
 	for_each_cpu(cpu, tmp) {
+		int nid;
+
 		BUG_ON(cpu_present(cpu));
 		set_cpu_present(cpu, true);
 		set_hard_smp_processor_id(cpu, be32_to_cpu(*intserv++));
+		nid = numa_setup_cpu(cpu);
+		set_cpu_numa_node(cpu, nid);
+		set_cpu_numa_mem(cpu, local_memory_node(nid));
 	}
 	err = 0;
 out_unlock:


^ permalink raw reply related

* Re: [PATCH v4 18/20] x86: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-09 10:20 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-arch, arnd, microblaze, daniel, devicetree, linux-sh,
	linuxppc-dev, linux-xtensa, x86, linux-kernel, nios2, linux-mips,
	linux-mm, openrisc, linux-hexagon, sparclinux, akpm, will,
	linux-riscv, linux-arm-kernel, danielwa
In-Reply-To: <20210408194148.GB1724284@robh.at.kernel.org>



Le 08/04/2021 à 21:41, Rob Herring a écrit :
> On Fri, Apr 02, 2021 at 03:18:20PM +0000, Christophe Leroy wrote:
>> This converts the architecture to GENERIC_CMDLINE.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>>   arch/x86/Kconfig        | 45 ++---------------------------------------
>>   arch/x86/kernel/setup.c | 17 ++--------------
>>   2 files changed, 4 insertions(+), 58 deletions(-)
>>
>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>> index a20684d56b4b..66b384228ca3 100644
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -104,6 +104,7 @@ config X86
>>   	select ARCH_USE_QUEUED_SPINLOCKS
>>   	select ARCH_USE_SYM_ANNOTATIONS
>>   	select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
>> +	select ARCH_WANT_CMDLINE_PREPEND_BY_DEFAULT
> 
> Seems to be non-existent kconfig option.

Oops. Added in v5.

>> @@ -883,18 +881,7 @@ void __init setup_arch(char **cmdline_p)
>>   	bss_resource.start = __pa_symbol(__bss_start);
>>   	bss_resource.end = __pa_symbol(__bss_stop)-1;
>>   
>> -#ifdef CONFIG_CMDLINE_BOOL
>> -#ifdef CONFIG_CMDLINE_FORCE
>> -	strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
>> -#else
>> -	if (builtin_cmdline[0]) {
>> -		/* append boot loader cmdline to builtin */
>> -		strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
>> -		strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
>> -		strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
>> -	}
>> -#endif
>> -#endif
>> +	cmdline_build(boot_command_line, boot_command_line);
>>   
>>   	strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
>>   	*cmdline_p = command_line;
> 
> Once this is all done, I wonder if we can get rid of the strlcpy and
> perhaps also cmdline_p.
> 

It seems rather complicated, in init/main.c you have heavy manipulations of command lines which 
seems to be done in setup_command_line() which seems to add stuff in front of command lines, at the 
end we end up with several command lines:

/* Untouched saved command line (eg. for /proc) */
char *saved_command_line;
/* Command line for parameter parsing */
static char *static_command_line;
/* Untouched extra command line */
static char *extra_command_line;

Some of them come from the cmdline_p which others are from boot_command_line.

I think a cleanup on all that stuff would be worth it as a further step.

^ permalink raw reply

* [PATCH RESEND v8 3/7] powerpc: dts: akebono: Harmonize EHCI/OHCI DT nodes name
From: Serge Semin @ 2021-04-09 11:30 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Felipe Balbi, Michael Ellerman,
	Vladimir Zapolskiy, Alexey Brodkin, Vineet Gupta, Rob Herring,
	Greg Kroah-Hartman, Krzysztof Kozlowski, linux-usb,
	Benjamin Herrenschmidt, Paul Mackerras
  Cc: Serge Semin, devicetree, linuxppc-dev, linux-kernel, Serge Semin
In-Reply-To: <20210409113029.7144-1-Sergey.Semin@baikalelectronics.ru>

In accordance with the Generic EHCI/OHCI bindings the corresponding node
name is suppose to comply with the Generic USB HCD DT schema, which
requires the USB nodes to have the name acceptable by the regexp:
"^usb(@.*)?" . Make sure the "generic-ehci" and "generic-ohci"-compatible
nodes are correctly named.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 arch/powerpc/boot/dts/akebono.dts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/boot/dts/akebono.dts b/arch/powerpc/boot/dts/akebono.dts
index df18f8dc4642..343326c30380 100644
--- a/arch/powerpc/boot/dts/akebono.dts
+++ b/arch/powerpc/boot/dts/akebono.dts
@@ -126,7 +126,7 @@ SATA0: sata@30000010000 {
 			interrupts = <93 2>;
 		};
 
-		EHCI0: ehci@30010000000 {
+		EHCI0: usb@30010000000 {
 			compatible = "ibm,476gtr-ehci", "generic-ehci";
 			reg = <0x300 0x10000000 0x0 0x10000>;
 			interrupt-parent = <&MPIC>;
@@ -140,14 +140,14 @@ SD0: sd@30000000000 {
 			interrupt-parent = <&MPIC>;
 		};
 
-		OHCI0: ohci@30010010000 {
+		OHCI0: usb@30010010000 {
 			compatible = "ibm,476gtr-ohci", "generic-ohci";
 			reg = <0x300 0x10010000 0x0 0x10000>;
 			interrupt-parent = <&MPIC>;
 			interrupts = <89 1>;
 			};
 
-		OHCI1: ohci@30010020000 {
+		OHCI1: usb@30010020000 {
 			compatible = "ibm,476gtr-ohci", "generic-ohci";
 			reg = <0x300 0x10020000 0x0 0x10000>;
 			interrupt-parent = <&MPIC>;
-- 
2.30.1


^ permalink raw reply related

* [PATCH RESEND v8 0/7] dt-bindings: usb: Harmonize xHCI/EHCI/OHCI/DWC3 nodes name
From: Serge Semin @ 2021-04-09 11:30 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Felipe Balbi, Michael Ellerman,
	Vladimir Zapolskiy, Alexey Brodkin, Vineet Gupta, Rob Herring,
	Greg Kroah-Hartman, Krzysztof Kozlowski, linux-usb
  Cc: devicetree, Khuong Dinh, Patrice Chotard, Serge Semin,
	linux-kernel, Serge Semin, Paul Mackerras, linux-arm-msm,
	linux-snps-arc, linuxppc-dev, linux-arm-kernel

As the subject states this series is an attempt to harmonize the xHCI,
EHCI, OHCI and DWC USB3 DT nodes with the DT schema introduced in the
framework of the patchset [1].

Firstly as Krzysztof suggested we've deprecated a support of DWC USB3
controllers with "synopsys,"-vendor prefix compatible string in favor of
the ones with valid "snps,"-prefix. It's done in all the DTS files,
which have been unfortunate to define such nodes.

Secondly we suggest to fix the snps,quirk-frame-length-adjustment property
declaration in the Amlogic meson-g12-common.dtsi DTS file, since it has
been erroneously declared as boolean while having uint32 type. Neil said
it was ok to init that property with 0x20 value.

Thirdly the main part of the patchset concern fixing the xHCI, EHCI/OHCI
and DWC USB3 DT nodes name as in accordance with their DT schema the
corresponding node name is suppose to comply with the Generic USB HCD DT
schema, which requires the USB nodes to have the name acceptable by the
regexp: "^usb(@.*)?". Such requirement had been applicable even before we
introduced the new DT schema in [1], but as we can see it hasn't been
strictly implemented for a lot the DTS files. Since DT schema is now
available the automated DTS validation shall make sure that the rule isn't
violated.

Note most of these patches have been a part of the last three patches of
[1]. But since there is no way to have them merged in in a combined
manner, I had to move them to the dedicated series and split them up so to
be accepted by the corresponding subsystem maintainers one-by-one.

[1] Link: https://lore.kernel.org/linux-usb/20201014101402.18271-1-Sergey.Semin@baikalelectronics.ru/
Changelog v1:
- As Krzysztof suggested I've created a script which checked whether the
  node names had been also updated in all the depended dts files. As a
  result I found two more files which should have been also modified:
  arch/arc/boot/dts/{axc003.dtsi,axc003_idu.dtsi}
- Correct the USB DWC3 nodes name found in
  arch/arm64/boot/dts/apm/{apm-storm.dtsi,apm-shadowcat.dtsi} too.

Link: https://lore.kernel.org/linux-usb/20201020115959.2658-1-Sergey.Semin@baikalelectronics.ru
Changelog v2:
- Drop the patch:
  [PATCH 01/29] usb: dwc3: Discard synopsys,dwc3 compatibility string
  and get back the one which marks the "synopsys,dwc3" compatible string
  as deprecated into the DT schema related series.
- Drop the patches:
  [PATCH 03/29] arm: dts: am437x: Correct DWC USB3 compatible string
  [PATCH 04/29] arm: dts: exynos: Correct DWC USB3 compatible string
  [PATCH 07/29] arm: dts: bcm53x: Harmonize EHCI/OHCI DT nodes name
  [PATCH 08/29] arm: dts: stm32: Harmonize EHCI/OHCI DT nodes name
  [PATCH 16/29] arm: dts: bcm5301x: Harmonize xHCI DT nodes name
  [PATCH 19/29] arm: dts: exynos: Harmonize DWC USB3 DT nodes name
  [PATCH 21/29] arm: dts: ls1021a: Harmonize DWC USB3 DT nodes name
  [PATCH 22/29] arm: dts: omap5: Harmonize DWC USB3 DT nodes name
  [PATCH 24/29] arm64: dts: allwinner: h6: Harmonize DWC USB3 DT nodes name
  [PATCH 26/29] arm64: dts: exynos: Harmonize DWC USB3 DT nodes name
  [PATCH 27/29] arm64: dts: layerscape: Harmonize DWC USB3 DT nodes name
  since they have been applied to the corresponding maintainers repos.
- Fix drivers/usb/dwc3/dwc3-qcom.c to be looking for the "usb@"-prefixed
  sub-node and falling back to the "dwc3@"-prefixed one on failure.

Link: https://lore.kernel.org/linux-usb/20201111091552.15593-1-Sergey.Semin@baikalelectronics.ru
Changelog v3:
- Drop the patches:
  [PATCH v2 04/18] arm: dts: hisi-x5hd2: Harmonize EHCI/OHCI DT nodes name
  [PATCH v2 06/18] arm64: dts: hisi: Harmonize EHCI/OHCI DT nodes name
  [PATCH v2 07/18] mips: dts: jz47x: Harmonize EHCI/OHCI DT nodes name
  [PATCH v2 08/18] mips: dts: sead3: Harmonize EHCI/OHCI DT nodes name
  [PATCH v2 09/18] mips: dts: ralink: mt7628a: Harmonize EHCI/OHCI DT nodes name
  [PATCH v2 11/18] arm64: dts: marvell: cp11x: Harmonize xHCI DT nodes name
  [PATCH v2 12/18] arm: dts: marvell: armada-375: Harmonize DWC USB3 DT nodes name
  [PATCH v2 16/18] arm64: dts: hi3660: Harmonize DWC USB3 DT nodes name
  since they have been applied to the corresponding maintainers repos.

Link: https://lore.kernel.org/linux-usb/20201205155621.3045-1-Sergey.Semin@baikalelectronics.ru
Changelog v4:
- Just resend.

Link: https://lore.kernel.org/linux-usb/20201210091756.18057-1-Sergey.Semin@baikalelectronics.ru/
Changelog v5:
- Drop the patch:
  [PATCH v4 02/10] arm64: dts: amlogic: meson-g12: Set FL-adj property value
  since it has been applied to the corresponding maintainers repos.
- Get back the patch:
  [PATCH 21/29] arm: dts: ls1021a: Harmonize DWC USB3 DT nodes name
  as it has been missing in the kernel 5.11-rc7
- Rebase onto the kernel 5.11-rc7.

Link: https://lore.kernel.org/lkml/20210208135154.6645-1-Sergey.Semin@baikalelectronics.ru/
Changelog v6:
- Just resend and add linux-usb.vger.kernel.org to the list of Ccecipients.

Link: https://lore.kernel.org/linux-usb/20210210172850.20849-1-Sergey.Semin@baikalelectronics.ru
Link: https://lore.kernel.org/linux-usb/20210212205521.14280-1-Sergey.Semin@baikalelectronics.ru
Changelog v7:
- Replace "of_get_child_by_name(np, "usb") ?: of_get_child_by_name(np, "dwc3");"
  pattern with using of_get_compatible_child() method in the Qcom DWC3 driver.
- Drop the patches:
  [PATCH v6 01/10] arm: dts: ls1021a: Harmonize DWC USB3 DT nodes name
  [PATCH v6 02/10] arm: dts: keystone: Correct DWC USB3 compatible string
  [PATCH v6 06/10] arm: dts: keystone: Harmonize DWC USB3 DT nodes name
  since they have been applied to the corresponding maintainers repos.
- Cleanup the list of recipients.
- Rebase onto kernel 5.12-rc4.

Link: https://lore.kernel.org/lkml/20210324204836.29668-1-Sergey.Semin@baikalelectronics.ru/
Changelog v8:
- Just resend.

Cc: Khuong Dinh <khuong@os.amperecomputing.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-snps-arc@lists.infradead.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Serge Semin (7):
  arc: dts: Harmonize EHCI/OHCI DT nodes name
  arm: dts: lpc18xx: Harmonize EHCI/OHCI DT nodes name
  powerpc: dts: akebono: Harmonize EHCI/OHCI DT nodes name
  arm: dts: stih407-family: Harmonize DWC USB3 DT nodes name
  arm64: dts: apm: Harmonize DWC USB3 DT nodes name
  usb: dwc3: qcom: Detect DWC3 DT-nodes using compatible string
  arm64: dts: qcom: Harmonize DWC USB3 DT nodes name

 arch/arc/boot/dts/axc003.dtsi                | 4 ++--
 arch/arc/boot/dts/axc003_idu.dtsi            | 4 ++--
 arch/arc/boot/dts/axs10x_mb.dtsi             | 4 ++--
 arch/arc/boot/dts/hsdk.dts                   | 4 ++--
 arch/arc/boot/dts/vdk_axs10x_mb.dtsi         | 2 +-
 arch/arm/boot/dts/lpc18xx.dtsi               | 4 ++--
 arch/arm/boot/dts/stih407-family.dtsi        | 2 +-
 arch/arm64/boot/dts/apm/apm-shadowcat.dtsi   | 4 ++--
 arch/arm64/boot/dts/apm/apm-storm.dtsi       | 6 +++---
 arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi | 4 ++--
 arch/arm64/boot/dts/qcom/ipq8074.dtsi        | 4 ++--
 arch/arm64/boot/dts/qcom/msm8996.dtsi        | 4 ++--
 arch/arm64/boot/dts/qcom/msm8998.dtsi        | 2 +-
 arch/arm64/boot/dts/qcom/qcs404-evb.dtsi     | 2 +-
 arch/arm64/boot/dts/qcom/qcs404.dtsi         | 4 ++--
 arch/arm64/boot/dts/qcom/sc7180.dtsi         | 2 +-
 arch/arm64/boot/dts/qcom/sdm845.dtsi         | 4 ++--
 arch/arm64/boot/dts/qcom/sm8150.dtsi         | 2 +-
 arch/powerpc/boot/dts/akebono.dts            | 6 +++---
 drivers/usb/dwc3/dwc3-qcom.c                 | 2 +-
 20 files changed, 35 insertions(+), 35 deletions(-)

-- 
2.30.1


^ permalink raw reply

* [kbuild] Re: [PATCH net-next v2 1/2] of: net: pass the dst buffer to of_get_mac_address()
From: Dan Carpenter @ 2021-04-09  9:06 UTC (permalink / raw)
  To: kbuild, Michael Walle, ath9k-devel, UNGLinuxDriver,
	linux-arm-kernel, linux-kernel, linuxppc-dev, netdev,
	linux-mediatek, linux-renesas-soc, linux-stm32, linux-amlogic
  Cc: kbuild-all, lkp
In-Reply-To: <20210406153725.10059-2-michael@walle.cc>

[-- Attachment #1: Type: text/plain, Size: 21168 bytes --]

Hi Michael,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Michael-Walle/of-net-support-non-platform-devices-in-of_get_mac_address/20210406-234030 
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git  cc0626c2aaed8e475efdd85fa374b497a7192e35
config: x86_64-randconfig-m001-20210406 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/net/ethernet/xilinx/xilinx_axienet_main.c:2069 axienet_probe() warn: passing a valid pointer to 'PTR_ERR'

vim +/PTR_ERR +2069 drivers/net/ethernet/xilinx/xilinx_axienet_main.c

2be586205ca2b8 Srikanth Thokala    2015-05-05  1832  static int axienet_probe(struct platform_device *pdev)
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1833  {
8495659bf93c8e Srikanth Thokala    2015-05-05  1834  	int ret;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1835  	struct device_node *np;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1836  	struct axienet_local *lp;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1837  	struct net_device *ndev;
28ef9ebdb64c6f Robert Hancock      2019-06-06  1838  	struct resource *ethres;
411b125c6ace1f Michael Walle       2021-04-06  1839  	u8 mac_addr[ETH_ALEN];
                                                        ^^^^^^^^^^^^^^^^^^^^^^

5fff0151b3244d Andre Przywara      2020-03-24  1840  	int addr_width = 32;
8495659bf93c8e Srikanth Thokala    2015-05-05  1841  	u32 value;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1842  
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1843  	ndev = alloc_etherdev(sizeof(*lp));
41de8d4cff21a2 Joe Perches         2012-01-29  1844  	if (!ndev)
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1845  		return -ENOMEM;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1846  
95219aa538e11d Srikanth Thokala    2015-05-05  1847  	platform_set_drvdata(pdev, ndev);
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1848  
95219aa538e11d Srikanth Thokala    2015-05-05  1849  	SET_NETDEV_DEV(ndev, &pdev->dev);
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1850  	ndev->flags &= ~IFF_MULTICAST;  /* clear multicast */
28e24c62ab3062 Eric Dumazet        2013-12-02  1851  	ndev->features = NETIF_F_SG;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1852  	ndev->netdev_ops = &axienet_netdev_ops;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1853  	ndev->ethtool_ops = &axienet_ethtool_ops;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1854  
d894be57ca92c8 Jarod Wilson        2016-10-20  1855  	/* MTU range: 64 - 9000 */
d894be57ca92c8 Jarod Wilson        2016-10-20  1856  	ndev->min_mtu = 64;
d894be57ca92c8 Jarod Wilson        2016-10-20  1857  	ndev->max_mtu = XAE_JUMBO_MTU;
d894be57ca92c8 Jarod Wilson        2016-10-20  1858  
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1859  	lp = netdev_priv(ndev);
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1860  	lp->ndev = ndev;
95219aa538e11d Srikanth Thokala    2015-05-05  1861  	lp->dev = &pdev->dev;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1862  	lp->options = XAE_OPTION_DEFAULTS;
8b09ca823ffb4e Robert Hancock      2019-06-06  1863  	lp->rx_bd_num = RX_BD_NUM_DEFAULT;
8b09ca823ffb4e Robert Hancock      2019-06-06  1864  	lp->tx_bd_num = TX_BD_NUM_DEFAULT;
57baf8cc70ea4c Robert Hancock      2021-02-12  1865  
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1866  	lp->axi_clk = devm_clk_get_optional(&pdev->dev, "s_axi_lite_clk");
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1867  	if (!lp->axi_clk) {
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1868  		/* For backward compatibility, if named AXI clock is not present,
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1869  		 * treat the first clock specified as the AXI clock.
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1870  		 */
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1871  		lp->axi_clk = devm_clk_get_optional(&pdev->dev, NULL);
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1872  	}
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1873  	if (IS_ERR(lp->axi_clk)) {
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1874  		ret = PTR_ERR(lp->axi_clk);
57baf8cc70ea4c Robert Hancock      2021-02-12  1875  		goto free_netdev;
57baf8cc70ea4c Robert Hancock      2021-02-12  1876  	}
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1877  	ret = clk_prepare_enable(lp->axi_clk);
57baf8cc70ea4c Robert Hancock      2021-02-12  1878  	if (ret) {
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1879  		dev_err(&pdev->dev, "Unable to enable AXI clock: %d\n", ret);
57baf8cc70ea4c Robert Hancock      2021-02-12  1880  		goto free_netdev;
57baf8cc70ea4c Robert Hancock      2021-02-12  1881  	}
57baf8cc70ea4c Robert Hancock      2021-02-12  1882  
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1883  	lp->misc_clks[0].id = "axis_clk";
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1884  	lp->misc_clks[1].id = "ref_clk";
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1885  	lp->misc_clks[2].id = "mgt_clk";
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1886  
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1887  	ret = devm_clk_bulk_get_optional(&pdev->dev, XAE_NUM_MISC_CLOCKS, lp->misc_clks);
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1888  	if (ret)
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1889  		goto cleanup_clk;
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1890  
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1891  	ret = clk_bulk_prepare_enable(XAE_NUM_MISC_CLOCKS, lp->misc_clks);
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1892  	if (ret)
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1893  		goto cleanup_clk;
b11bfb9a19f9d7 Robert Hancock      2021-03-25  1894  
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1895  	/* Map device registers */
46aa27df885321 Srikanth Thokala    2015-05-05  1896  	ethres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
46aa27df885321 Srikanth Thokala    2015-05-05  1897  	lp->regs = devm_ioremap_resource(&pdev->dev, ethres);
fcc028c106e575 Krzysztof Kozlowski 2015-07-09  1898  	if (IS_ERR(lp->regs)) {
fcc028c106e575 Krzysztof Kozlowski 2015-07-09  1899  		ret = PTR_ERR(lp->regs);
59cd4f19267a0a Robert Hancock      2021-03-11  1900  		goto cleanup_clk;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1901  	}
7fa0043d5c74c6 Robert Hancock      2019-06-11  1902  	lp->regs_start = ethres->start;
46aa27df885321 Srikanth Thokala    2015-05-05  1903  
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1904  	/* Setup checksum offload, but default to off if not specified */
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1905  	lp->features = 0;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1906  
8495659bf93c8e Srikanth Thokala    2015-05-05  1907  	ret = of_property_read_u32(pdev->dev.of_node, "xlnx,txcsum", &value);
8495659bf93c8e Srikanth Thokala    2015-05-05  1908  	if (!ret) {
8495659bf93c8e Srikanth Thokala    2015-05-05  1909  		switch (value) {
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1910  		case 1:
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1911  			lp->csum_offload_on_tx_path =
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1912  				XAE_FEATURE_PARTIAL_TX_CSUM;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1913  			lp->features |= XAE_FEATURE_PARTIAL_TX_CSUM;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1914  			/* Can checksum TCP/UDP over IPv4. */
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1915  			ndev->features |= NETIF_F_IP_CSUM;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1916  			break;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1917  		case 2:
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1918  			lp->csum_offload_on_tx_path =
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1919  				XAE_FEATURE_FULL_TX_CSUM;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1920  			lp->features |= XAE_FEATURE_FULL_TX_CSUM;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1921  			/* Can checksum TCP/UDP over IPv4. */
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1922  			ndev->features |= NETIF_F_IP_CSUM;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1923  			break;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1924  		default:
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1925  			lp->csum_offload_on_tx_path = XAE_NO_CSUM_OFFLOAD;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1926  		}
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1927  	}
8495659bf93c8e Srikanth Thokala    2015-05-05  1928  	ret = of_property_read_u32(pdev->dev.of_node, "xlnx,rxcsum", &value);
8495659bf93c8e Srikanth Thokala    2015-05-05  1929  	if (!ret) {
8495659bf93c8e Srikanth Thokala    2015-05-05  1930  		switch (value) {
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1931  		case 1:
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1932  			lp->csum_offload_on_rx_path =
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1933  				XAE_FEATURE_PARTIAL_RX_CSUM;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1934  			lp->features |= XAE_FEATURE_PARTIAL_RX_CSUM;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1935  			break;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1936  		case 2:
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1937  			lp->csum_offload_on_rx_path =
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1938  				XAE_FEATURE_FULL_RX_CSUM;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1939  			lp->features |= XAE_FEATURE_FULL_RX_CSUM;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1940  			break;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1941  		default:
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1942  			lp->csum_offload_on_rx_path = XAE_NO_CSUM_OFFLOAD;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1943  		}
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1944  	}
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1945  	/* For supporting jumbo frames, the Axi Ethernet hardware must have
f080a8c35d8932 Srikanth Thokala    2015-05-05  1946  	 * a larger Rx/Tx Memory. Typically, the size must be large so that
f080a8c35d8932 Srikanth Thokala    2015-05-05  1947  	 * we can enable jumbo option and start supporting jumbo frames.
f080a8c35d8932 Srikanth Thokala    2015-05-05  1948  	 * Here we check for memory allocated for Rx/Tx in the hardware from
f080a8c35d8932 Srikanth Thokala    2015-05-05  1949  	 * the device-tree and accordingly set flags.
f080a8c35d8932 Srikanth Thokala    2015-05-05  1950  	 */
8495659bf93c8e Srikanth Thokala    2015-05-05  1951  	of_property_read_u32(pdev->dev.of_node, "xlnx,rxmem", &lp->rxmem);
ee06b1728b9564 Alvaro G. M         2017-07-17  1952  
6c8f06bb2e5147 Robert Hancock      2021-02-12  1953  	lp->switch_x_sgmii = of_property_read_bool(pdev->dev.of_node,
6c8f06bb2e5147 Robert Hancock      2021-02-12  1954  						   "xlnx,switch-x-sgmii");
6c8f06bb2e5147 Robert Hancock      2021-02-12  1955  
ee06b1728b9564 Alvaro G. M         2017-07-17  1956  	/* Start with the proprietary, and broken phy_type */
ee06b1728b9564 Alvaro G. M         2017-07-17  1957  	ret = of_property_read_u32(pdev->dev.of_node, "xlnx,phy-type", &value);
ee06b1728b9564 Alvaro G. M         2017-07-17  1958  	if (!ret) {
ee06b1728b9564 Alvaro G. M         2017-07-17  1959  		netdev_warn(ndev, "Please upgrade your device tree binary blob to use phy-mode");
ee06b1728b9564 Alvaro G. M         2017-07-17  1960  		switch (value) {
ee06b1728b9564 Alvaro G. M         2017-07-17  1961  		case XAE_PHY_TYPE_MII:
ee06b1728b9564 Alvaro G. M         2017-07-17  1962  			lp->phy_mode = PHY_INTERFACE_MODE_MII;
ee06b1728b9564 Alvaro G. M         2017-07-17  1963  			break;
ee06b1728b9564 Alvaro G. M         2017-07-17  1964  		case XAE_PHY_TYPE_GMII:
ee06b1728b9564 Alvaro G. M         2017-07-17  1965  			lp->phy_mode = PHY_INTERFACE_MODE_GMII;
ee06b1728b9564 Alvaro G. M         2017-07-17  1966  			break;
ee06b1728b9564 Alvaro G. M         2017-07-17  1967  		case XAE_PHY_TYPE_RGMII_2_0:
ee06b1728b9564 Alvaro G. M         2017-07-17  1968  			lp->phy_mode = PHY_INTERFACE_MODE_RGMII_ID;
ee06b1728b9564 Alvaro G. M         2017-07-17  1969  			break;
ee06b1728b9564 Alvaro G. M         2017-07-17  1970  		case XAE_PHY_TYPE_SGMII:
ee06b1728b9564 Alvaro G. M         2017-07-17  1971  			lp->phy_mode = PHY_INTERFACE_MODE_SGMII;
ee06b1728b9564 Alvaro G. M         2017-07-17  1972  			break;
ee06b1728b9564 Alvaro G. M         2017-07-17  1973  		case XAE_PHY_TYPE_1000BASE_X:
ee06b1728b9564 Alvaro G. M         2017-07-17  1974  			lp->phy_mode = PHY_INTERFACE_MODE_1000BASEX;
ee06b1728b9564 Alvaro G. M         2017-07-17  1975  			break;
ee06b1728b9564 Alvaro G. M         2017-07-17  1976  		default:
ee06b1728b9564 Alvaro G. M         2017-07-17  1977  			ret = -EINVAL;
59cd4f19267a0a Robert Hancock      2021-03-11  1978  			goto cleanup_clk;
ee06b1728b9564 Alvaro G. M         2017-07-17  1979  		}
ee06b1728b9564 Alvaro G. M         2017-07-17  1980  	} else {
0c65b2b90d13c1 Andrew Lunn         2019-11-04  1981  		ret = of_get_phy_mode(pdev->dev.of_node, &lp->phy_mode);
0c65b2b90d13c1 Andrew Lunn         2019-11-04  1982  		if (ret)
59cd4f19267a0a Robert Hancock      2021-03-11  1983  			goto cleanup_clk;
ee06b1728b9564 Alvaro G. M         2017-07-17  1984  	}
6c8f06bb2e5147 Robert Hancock      2021-02-12  1985  	if (lp->switch_x_sgmii && lp->phy_mode != PHY_INTERFACE_MODE_SGMII &&
6c8f06bb2e5147 Robert Hancock      2021-02-12  1986  	    lp->phy_mode != PHY_INTERFACE_MODE_1000BASEX) {
6c8f06bb2e5147 Robert Hancock      2021-02-12  1987  		dev_err(&pdev->dev, "xlnx,switch-x-sgmii only supported with SGMII or 1000BaseX\n");
6c8f06bb2e5147 Robert Hancock      2021-02-12  1988  		ret = -EINVAL;
59cd4f19267a0a Robert Hancock      2021-03-11  1989  		goto cleanup_clk;
6c8f06bb2e5147 Robert Hancock      2021-02-12  1990  	}
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1991  
8a3b7a252dca9f Daniel Borkmann     2012-01-19  1992  	/* Find the DMA node, map the DMA registers, and decode the DMA IRQs */
95219aa538e11d Srikanth Thokala    2015-05-05  1993  	np = of_parse_phandle(pdev->dev.of_node, "axistream-connected", 0);
28ef9ebdb64c6f Robert Hancock      2019-06-06  1994  	if (np) {
28ef9ebdb64c6f Robert Hancock      2019-06-06  1995  		struct resource dmares;
28ef9ebdb64c6f Robert Hancock      2019-06-06  1996  
46aa27df885321 Srikanth Thokala    2015-05-05  1997  		ret = of_address_to_resource(np, 0, &dmares);
46aa27df885321 Srikanth Thokala    2015-05-05  1998  		if (ret) {
28ef9ebdb64c6f Robert Hancock      2019-06-06  1999  			dev_err(&pdev->dev,
28ef9ebdb64c6f Robert Hancock      2019-06-06  2000  				"unable to get DMA resource\n");
fa3a419d2f674b Wen Yang            2019-03-22  2001  			of_node_put(np);
59cd4f19267a0a Robert Hancock      2021-03-11  2002  			goto cleanup_clk;
46aa27df885321 Srikanth Thokala    2015-05-05  2003  		}
28ef9ebdb64c6f Robert Hancock      2019-06-06  2004  		lp->dma_regs = devm_ioremap_resource(&pdev->dev,
28ef9ebdb64c6f Robert Hancock      2019-06-06  2005  						     &dmares);
28ef9ebdb64c6f Robert Hancock      2019-06-06  2006  		lp->rx_irq = irq_of_parse_and_map(np, 1);
28ef9ebdb64c6f Robert Hancock      2019-06-06  2007  		lp->tx_irq = irq_of_parse_and_map(np, 0);
28ef9ebdb64c6f Robert Hancock      2019-06-06  2008  		of_node_put(np);
d6349e3e14c7f7 Andre Przywara      2020-03-24  2009  		lp->eth_irq = platform_get_irq_optional(pdev, 0);
28ef9ebdb64c6f Robert Hancock      2019-06-06  2010  	} else {
28ef9ebdb64c6f Robert Hancock      2019-06-06  2011  		/* Check for these resources directly on the Ethernet node. */
28ef9ebdb64c6f Robert Hancock      2019-06-06  2012  		struct resource *res = platform_get_resource(pdev,
28ef9ebdb64c6f Robert Hancock      2019-06-06  2013  							     IORESOURCE_MEM, 1);
28ef9ebdb64c6f Robert Hancock      2019-06-06  2014  		lp->dma_regs = devm_ioremap_resource(&pdev->dev, res);
28ef9ebdb64c6f Robert Hancock      2019-06-06  2015  		lp->rx_irq = platform_get_irq(pdev, 1);
28ef9ebdb64c6f Robert Hancock      2019-06-06  2016  		lp->tx_irq = platform_get_irq(pdev, 0);
d6349e3e14c7f7 Andre Przywara      2020-03-24  2017  		lp->eth_irq = platform_get_irq_optional(pdev, 2);
28ef9ebdb64c6f Robert Hancock      2019-06-06  2018  	}
fcc028c106e575 Krzysztof Kozlowski 2015-07-09  2019  	if (IS_ERR(lp->dma_regs)) {
46aa27df885321 Srikanth Thokala    2015-05-05  2020  		dev_err(&pdev->dev, "could not map DMA regs\n");
fcc028c106e575 Krzysztof Kozlowski 2015-07-09  2021  		ret = PTR_ERR(lp->dma_regs);
59cd4f19267a0a Robert Hancock      2021-03-11  2022  		goto cleanup_clk;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  2023  	}
cb59c87dbc8be2 Michal Simek        2013-01-10  2024  	if ((lp->rx_irq <= 0) || (lp->tx_irq <= 0)) {
95219aa538e11d Srikanth Thokala    2015-05-05  2025  		dev_err(&pdev->dev, "could not determine irqs\n");
8a3b7a252dca9f Daniel Borkmann     2012-01-19  2026  		ret = -ENOMEM;
59cd4f19267a0a Robert Hancock      2021-03-11  2027  		goto cleanup_clk;
8a3b7a252dca9f Daniel Borkmann     2012-01-19  2028  	}
8a3b7a252dca9f Daniel Borkmann     2012-01-19  2029  
f735c40ed93cca Andre Przywara      2020-03-24  2030  	/* Autodetect the need for 64-bit DMA pointers.
f735c40ed93cca Andre Przywara      2020-03-24  2031  	 * When the IP is configured for a bus width bigger than 32 bits,
f735c40ed93cca Andre Przywara      2020-03-24  2032  	 * writing the MSB registers is mandatory, even if they are all 0.
f735c40ed93cca Andre Przywara      2020-03-24  2033  	 * We can detect this case by writing all 1's to one such register
f735c40ed93cca Andre Przywara      2020-03-24  2034  	 * and see if that sticks: when the IP is configured for 32 bits
f735c40ed93cca Andre Przywara      2020-03-24  2035  	 * only, those registers are RES0.
f735c40ed93cca Andre Przywara      2020-03-24  2036  	 * Those MSB registers were introduced in IP v7.1, which we check first.
f735c40ed93cca Andre Przywara      2020-03-24  2037  	 */
f735c40ed93cca Andre Przywara      2020-03-24  2038  	if ((axienet_ior(lp, XAE_ID_OFFSET) >> 24) >= 0x9) {
f735c40ed93cca Andre Przywara      2020-03-24  2039  		void __iomem *desc = lp->dma_regs + XAXIDMA_TX_CDESC_OFFSET + 4;
f735c40ed93cca Andre Przywara      2020-03-24  2040  
f735c40ed93cca Andre Przywara      2020-03-24  2041  		iowrite32(0x0, desc);
f735c40ed93cca Andre Przywara      2020-03-24  2042  		if (ioread32(desc) == 0) {	/* sanity check */
f735c40ed93cca Andre Przywara      2020-03-24  2043  			iowrite32(0xffffffff, desc);
f735c40ed93cca Andre Przywara      2020-03-24  2044  			if (ioread32(desc) > 0) {
f735c40ed93cca Andre Przywara      2020-03-24  2045  				lp->features |= XAE_FEATURE_DMA_64BIT;
5fff0151b3244d Andre Przywara      2020-03-24  2046  				addr_width = 64;
f735c40ed93cca Andre Przywara      2020-03-24  2047  				dev_info(&pdev->dev,
f735c40ed93cca Andre Przywara      2020-03-24  2048  					 "autodetected 64-bit DMA range\n");
f735c40ed93cca Andre Przywara      2020-03-24  2049  			}
f735c40ed93cca Andre Przywara      2020-03-24  2050  			iowrite32(0x0, desc);
f735c40ed93cca Andre Przywara      2020-03-24  2051  		}
f735c40ed93cca Andre Przywara      2020-03-24  2052  	}
f735c40ed93cca Andre Przywara      2020-03-24  2053  
5fff0151b3244d Andre Przywara      2020-03-24  2054  	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(addr_width));
5fff0151b3244d Andre Przywara      2020-03-24  2055  	if (ret) {
5fff0151b3244d Andre Przywara      2020-03-24  2056  		dev_err(&pdev->dev, "No suitable DMA available\n");
59cd4f19267a0a Robert Hancock      2021-03-11  2057  		goto cleanup_clk;
5fff0151b3244d Andre Przywara      2020-03-24  2058  	}
5fff0151b3244d Andre Przywara      2020-03-24  2059  
522856cefaf09d Robert Hancock      2019-06-06  2060  	/* Check for Ethernet core IRQ (optional) */
522856cefaf09d Robert Hancock      2019-06-06  2061  	if (lp->eth_irq <= 0)
522856cefaf09d Robert Hancock      2019-06-06  2062  		dev_info(&pdev->dev, "Ethernet core IRQ not defined\n");
522856cefaf09d Robert Hancock      2019-06-06  2063  
8a3b7a252dca9f Daniel Borkmann     2012-01-19  2064  	/* Retrieve the MAC address */
411b125c6ace1f Michael Walle       2021-04-06  2065  	ret = of_get_mac_address(pdev->dev.of_node, mac_addr);
411b125c6ace1f Michael Walle       2021-04-06  2066  	if (!ret) {
411b125c6ace1f Michael Walle       2021-04-06  2067  		axienet_set_mac_address(ndev, mac_addr);
411b125c6ace1f Michael Walle       2021-04-06  2068  	} else {
d05a9ed5c3a773 Robert Hancock      2019-06-06 @2069  		dev_warn(&pdev->dev, "could not find MAC address property: %ld\n",
d05a9ed5c3a773 Robert Hancock      2019-06-06  2070  			 PTR_ERR(mac_addr));
                                                                         ^^^^^^^^^^^^^^^^^
mac_addr isn't an error pointer.

411b125c6ace1f Michael Walle       2021-04-06  2071  		axienet_set_mac_address(ndev, NULL);
8a3b7a252dca9f Daniel Borkmann     2012-01-19  2072  	}
8a3b7a252dca9f Daniel Borkmann     2012-01-19  2073  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org 

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31129 bytes --]

[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org

^ permalink raw reply

* Re: [PATCH v3 8/9] mm/mremap: Allow arch runtime override
From: Aneesh Kumar K.V @ 2021-04-09 11:59 UTC (permalink / raw)
  To: Christophe Leroy, linux-mm, akpm; +Cc: joel, linuxppc-dev, npiggin, kaleshsingh
In-Reply-To: <c421c3cb-6e9a-6db0-9e4b-f7a7e9a6c1cc@csgroup.eu>

On 4/9/21 3:05 PM, Christophe Leroy wrote:
> 
> 
> Le 30/03/2021 à 08:07, Aneesh Kumar K.V a écrit :
>> Architectures like ppc64 can only support faster mremap only with radix
> 
> ... only .... only ...
> 
>> translation. Hence allow a runtime check w.r.t support for fast mremap.
>>

will fix that

>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>>   arch/arc/include/asm/tlb.h     |  5 +++++
>>   arch/arm64/include/asm/tlb.h   |  6 ++++++
>>   arch/powerpc/include/asm/tlb.h |  6 ++++++
>>   arch/x86/include/asm/tlb.h     |  5 +++++
>>   mm/mremap.c                    | 14 +++++++++++++-
>>   5 files changed, 35 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arc/include/asm/tlb.h b/arch/arc/include/asm/tlb.h
>> index 975b35d3738d..22b8cfb46cbf 100644
>> --- a/arch/arc/include/asm/tlb.h
>> +++ b/arch/arc/include/asm/tlb.h
>> @@ -9,4 +9,9 @@
>>   #include <linux/pagemap.h>
>>   #include <asm-generic/tlb.h>
>> +#define arch_supports_page_tables_move arch_supports_page_tables_move
>> +static inline bool arch_supports_page_tables_move(void)
>> +{
>> +    return true;
>> +}
> 
> I can't see why ARC arch needs that. It neither selects 
> CONFIG_HAVE_MOVE_PMD nor CONFIG_HAVE_MOVE_PUD.
> 
>

ok will fix that (I confused arch/Kconfig with arc/Kconfig )



>>   #endif /* _ASM_ARC_TLB_H */
>> diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h
>> index 61c97d3b58c7..fe209efc6a10 100644
>> --- a/arch/arm64/include/asm/tlb.h
>> +++ b/arch/arm64/include/asm/tlb.h
>> @@ -94,4 +94,10 @@ static inline void __pud_free_tlb(struct mmu_gather 
>> *tlb, pud_t *pudp,
>>   }
>>   #endif
>> +#define arch_supports_page_tables_move arch_supports_page_tables_move
>> +static inline bool arch_supports_page_tables_move(void)
>> +{
>> +    return true;
>> +}
>> +
>>   #endif
>> diff --git a/arch/powerpc/include/asm/tlb.h 
>> b/arch/powerpc/include/asm/tlb.h
>> index 160422a439aa..058918a7cd3c 100644
>> --- a/arch/powerpc/include/asm/tlb.h
>> +++ b/arch/powerpc/include/asm/tlb.h
>> @@ -83,5 +83,11 @@ static inline int mm_is_thread_local(struct 
>> mm_struct *mm)
>>   }
>>   #endif
>> +#define arch_supports_page_tables_move arch_supports_page_tables_move
>> +static inline bool arch_supports_page_tables_move(void)
>> +{
>> +    return radix_enabled();
>> +}
>> +
>>   #endif /* __KERNEL__ */
>>   #endif /* __ASM_POWERPC_TLB_H */
>> diff --git a/arch/x86/include/asm/tlb.h b/arch/x86/include/asm/tlb.h
>> index 1bfe979bb9bc..62915238bb36 100644
>> --- a/arch/x86/include/asm/tlb.h
>> +++ b/arch/x86/include/asm/tlb.h
>> @@ -37,4 +37,9 @@ static inline void __tlb_remove_table(void *table)
>>       free_page_and_swap_cache(table);
>>   }
>> +#define arch_supports_page_tables_move arch_supports_page_tables_move
>> +static inline bool arch_supports_page_tables_move(void)
>> +{
>> +    return true;
>> +}
>>   #endif /* _ASM_X86_TLB_H */
>> diff --git a/mm/mremap.c b/mm/mremap.c
>> index 7ac1df8e6d51..4d812af3e44b 100644
>> --- a/mm/mremap.c
>> +++ b/mm/mremap.c
>> @@ -25,7 +25,7 @@
>>   #include <linux/userfaultfd_k.h>
>>   #include <asm/cacheflush.h>
>> -#include <asm/tlbflush.h>
>> +#include <asm/tlb.h>
>>   #include <asm/pgalloc.h>
>>   #include "internal.h"
>> @@ -221,6 +221,14 @@ static inline void flush_pte_tlb_pwc_range(struct 
>> vm_area_struct *vma,
>>   }
>>   #endif
>> +#ifndef arch_supports_page_tables_move
>> +#define arch_supports_page_tables_move arch_supports_page_tables_move
>> +static inline bool arch_supports_page_tables_move(void)
>> +{
>> +    return false;
> 
> Can you do
> 
>      return IS_ENABLED(CONFIG_HAVE_MOVE_PMD) || 
> IS_ENABLED(CONFIG_HAVE_MOVE_PUD);
> 
> And then remove the arch_supports_page_tables_move() you have added for 
> arc, arm64 and x86 ?
> 


something like below?

#ifndef arch_supports_page_tables_move
#define arch_supports_page_tables_move arch_supports_page_tables_move
static inline bool arch_supports_page_tables_move(void)
{
	return IS_ENABLED(CONFIG_HAVE_MOVE_PMD) ||
		IS_ENABLED(CONFIG_HAVE_MOVE_PUD);
}
#endif

are remove those from those arch headers.





>> +}
>> +#endif
>> +
>>   #ifdef CONFIG_HAVE_MOVE_PMD
> 
> Next step could be remove that #ifdef and the content of the matching #else
> For that we'd just need a stub version of set_pmd_at() and set_pud_at().
> 
>>   static bool move_normal_pmd(struct vm_area_struct *vma, unsigned 
>> long old_addr,
>>             unsigned long new_addr, pmd_t *old_pmd, pmd_t *new_pmd)
>> @@ -229,6 +237,8 @@ static bool move_normal_pmd(struct vm_area_struct 
>> *vma, unsigned long old_addr,
>>       struct mm_struct *mm = vma->vm_mm;
>>       pmd_t pmd;
>> +    if (!arch_supports_page_tables_move())
>> +        return false;
>>       /*
>>        * The destination pmd shouldn't be established, free_pgtables()
>>        * should have released it.
>> @@ -295,6 +305,8 @@ static bool move_normal_pud(struct vm_area_struct 
>> *vma, unsigned long old_addr,
>>       struct mm_struct *mm = vma->vm_mm;
>>       pud_t pud;
>> +    if (!arch_supports_page_tables_move())
>> +        return false;
>>       /*
>>        * The destination pud shouldn't be established, free_pgtables()
>>        * should have released it.
>>


^ permalink raw reply

* Re: [PATCH 2/2] powerpc: make 'boot_text_mapped' static
From: Segher Boessenkool @ 2021-04-09 12:02 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: Yu Kuai, yi.zhang, linuxppc-dev, linux-kernel
In-Reply-To: <5b91cd3f-d171-f510-7dae-8cbabb13b23c@csgroup.eu>

Hi!

On Thu, Apr 08, 2021 at 07:04:35AM +0200, Christophe Leroy wrote:
> Le 08/04/2021 à 03:18, Yu Kuai a écrit :
> >-int boot_text_mapped __force_data = 0;
> >+static int boot_text_mapped __force_data;
> 
> Are you sure the initialisation to 0 can be removed ? Usually 
> initialisation to 0 is not needed because not initialised variables go in 
> the BSS section which is zeroed at startup. But here the variable is 
> flagged with __force_data so it is not going in the BSS section.

Any non-automatic (i.e. function-scope, not static) variable is
initialised to 0.  See e.g. C11 6.7.9/10 (this has been like that since
times immemorial, C90 anyway).


Segher

^ permalink raw reply


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