LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] powerpc: Remove flush_instruction_cache() on 8xx
From: Christophe Leroy @ 2020-08-14  5:49 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, hch
  Cc: linuxppc-dev, linux-kernel

flush_instruction_cache() is never used on 8xx, remove it.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v2: Becomes a standalone patch independant of the series dismantling the ASM flush_instruction_cache()
---
 arch/powerpc/mm/nohash/8xx.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/arch/powerpc/mm/nohash/8xx.c b/arch/powerpc/mm/nohash/8xx.c
index d2b37146ae6c..231ca95f9ffb 100644
--- a/arch/powerpc/mm/nohash/8xx.c
+++ b/arch/powerpc/mm/nohash/8xx.c
@@ -244,13 +244,6 @@ void set_context(unsigned long id, pgd_t *pgd)
 	mb();
 }
 
-void flush_instruction_cache(void)
-{
-	isync();
-	mtspr(SPRN_IC_CST, IDC_INVALL);
-	isync();
-}
-
 #ifdef CONFIG_PPC_KUEP
 void __init setup_kuep(bool disabled)
 {
-- 
2.25.0


^ permalink raw reply related

* Re: [PATCH 1/5] powerpc: Remove flush_instruction_cache for book3s/32
From: Christophe Leroy @ 2020-08-14  5:52 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linuxppc-dev, Paul Mackerras, linux-kernel
In-Reply-To: <20200813121403.GB16237@infradead.org>



Le 13/08/2020 à 14:14, Christoph Hellwig a écrit :
> On Thu, Aug 13, 2020 at 01:13:08PM +0100, Christoph Hellwig wrote:
>> On Thu, Aug 13, 2020 at 10:12:00AM +0000, Christophe Leroy wrote:
>>> -#ifndef CONFIG_PPC_8xx
>>> +#if !defined(CONFIG_PPC_8xx) && !defined(CONFIG_PPC_BOOK3S_32)
>>>   _GLOBAL(flush_instruction_cache)
>>>   #if defined(CONFIG_4xx)
>>>   	lis	r3, KERNELBASE@h
>>> @@ -290,18 +289,11 @@ _GLOBAL(flush_instruction_cache)
>>>   	mfspr	r3,SPRN_L1CSR1
>>>   	ori	r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR
>>>   	mtspr	SPRN_L1CSR1,r3
>>> -#elif defined(CONFIG_PPC_BOOK3S_601)
>>> -	blr			/* for 601, do nothing */
>>> -#else
>>> -	/* 603/604 processor - use invalidate-all bit in HID0 */
>>> -	mfspr	r3,SPRN_HID0
>>> -	ori	r3,r3,HID0_ICFI
>>> -	mtspr	SPRN_HID0,r3
>>>   #endif /* CONFIG_4xx */
>>>   	isync
>>>   	blr
>>>   EXPORT_SYMBOL(flush_instruction_cache)
>>> -#endif /* CONFIG_PPC_8xx */
>>> +#endif /* CONFIG_PPC_8xx || CONFIG_PPC_BOOK3S_32 */
>>
>> What about untangling this into entirely separate versions instead
>> of the ifdef mess?  Also the export does not seem to be needed at all.
> 
> Ok, I see that you do that later, sorry.
> 

In v2, I drop the untangling patch, because the series completely 
dismantles flush_instruction_cache() so there is no need for an 
ephemeral untanggled version of it.

Christophe

^ permalink raw reply

* [PATCH v2 3/4] powerpc: Rewrite 4xx flush_cache_instruction() in C
From: Christophe Leroy @ 2020-08-14  5:56 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, hch
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <50098f49877cea0f46730a9df82dcabf84160e4b.1597384512.git.christophe.leroy@csgroup.eu>

Nothing prevents flush_cache_instruction() from being writen in C.

Do it to improve readability and maintainability.

This function is very small and isn't called from assembly,
make it static inline in asm/cacheflush.h

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v2: Written as a static inline instead of adding a new C file for this function alone.
---
 arch/powerpc/include/asm/cacheflush.h | 8 ++++++++
 arch/powerpc/kernel/misc_32.S         | 7 +------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h
index 481877879fec..138e46d8c04e 100644
--- a/arch/powerpc/include/asm/cacheflush.h
+++ b/arch/powerpc/include/asm/cacheflush.h
@@ -98,7 +98,15 @@ static inline void invalidate_dcache_range(unsigned long start,
 	mb();	/* sync */
 }
 
+#ifdef CONFIG_4xx
+static inline void flush_instruction_cache(void)
+{
+	iccci((void *)KERNELBASE);
+	isync();
+}
+#else
 void flush_instruction_cache(void);
+#endif
 
 #include <asm-generic/cacheflush.h>
 
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 5c074c2ff5b5..1bda207459a8 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -272,12 +272,8 @@ _ASM_NOKPROBE_SYMBOL(real_writeb)
 /*
  * Flush instruction cache.
  */
-#if !defined(CONFIG_PPC_8xx) && !defined(CONFIG_PPC_BOOK3S_32)
+#ifdef CONFIG_FSL_BOOKE
 _GLOBAL(flush_instruction_cache)
-#if defined(CONFIG_4xx)
-	lis	r3, KERNELBASE@h
-	iccci	0,r3
-#elif defined(CONFIG_FSL_BOOKE)
 #ifdef CONFIG_E200
 	mfspr   r3,SPRN_L1CSR0
 	ori     r3,r3,L1CSR0_CFI|L1CSR0_CLFC
@@ -289,7 +285,6 @@ _GLOBAL(flush_instruction_cache)
 	mfspr	r3,SPRN_L1CSR1
 	ori	r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR
 	mtspr	SPRN_L1CSR1,r3
-#endif /* CONFIG_4xx */
 	isync
 	blr
 EXPORT_SYMBOL(flush_instruction_cache)
-- 
2.25.0


^ permalink raw reply related

* [PATCH v2 1/4] powerpc: Remove flush_instruction_cache for book3s/32
From: Christophe Leroy @ 2020-08-14  5:56 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, hch
  Cc: linuxppc-dev, linux-kernel

The only callers of flush_instruction_cache() are:

arch/powerpc/kernel/swsusp_booke.S:	bl flush_instruction_cache
arch/powerpc/mm/nohash/40x.c:	flush_instruction_cache();
arch/powerpc/mm/nohash/44x.c:	flush_instruction_cache();
arch/powerpc/mm/nohash/fsl_booke.c:	flush_instruction_cache();
arch/powerpc/platforms/44x/machine_check.c:			flush_instruction_cache();
arch/powerpc/platforms/44x/machine_check.c:		flush_instruction_cache();

This function is not used by book3s/32, drop it.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/kernel/misc_32.S | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index b24f866fef81..5c074c2ff5b5 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -271,9 +271,8 @@ _ASM_NOKPROBE_SYMBOL(real_writeb)
 
 /*
  * Flush instruction cache.
- * This is a no-op on the 601.
  */
-#ifndef CONFIG_PPC_8xx
+#if !defined(CONFIG_PPC_8xx) && !defined(CONFIG_PPC_BOOK3S_32)
 _GLOBAL(flush_instruction_cache)
 #if defined(CONFIG_4xx)
 	lis	r3, KERNELBASE@h
@@ -290,18 +289,11 @@ _GLOBAL(flush_instruction_cache)
 	mfspr	r3,SPRN_L1CSR1
 	ori	r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR
 	mtspr	SPRN_L1CSR1,r3
-#elif defined(CONFIG_PPC_BOOK3S_601)
-	blr			/* for 601, do nothing */
-#else
-	/* 603/604 processor - use invalidate-all bit in HID0 */
-	mfspr	r3,SPRN_HID0
-	ori	r3,r3,HID0_ICFI
-	mtspr	SPRN_HID0,r3
 #endif /* CONFIG_4xx */
 	isync
 	blr
 EXPORT_SYMBOL(flush_instruction_cache)
-#endif /* CONFIG_PPC_8xx */
+#endif
 
 /*
  * Copy a whole page.  We use the dcbz instruction on the destination
-- 
2.25.0


^ permalink raw reply related

* [PATCH v2 2/4] powerpc: Move flush_instruction_cache() prototype in asm/cacheflush.h
From: Christophe Leroy @ 2020-08-14  5:56 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, hch
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <50098f49877cea0f46730a9df82dcabf84160e4b.1597384512.git.christophe.leroy@csgroup.eu>

flush_instruction_cache() belongs to the cache flushing function
family.

Move its prototype in asm/cacheflush.h

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v2: new
---
 arch/powerpc/include/asm/cacheflush.h      | 2 ++
 arch/powerpc/include/asm/processor.h       | 1 -
 arch/powerpc/platforms/44x/machine_check.c | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h
index 54764c6e922d..481877879fec 100644
--- a/arch/powerpc/include/asm/cacheflush.h
+++ b/arch/powerpc/include/asm/cacheflush.h
@@ -98,6 +98,8 @@ static inline void invalidate_dcache_range(unsigned long start,
 	mb();	/* sync */
 }
 
+void flush_instruction_cache(void);
+
 #include <asm-generic/cacheflush.h>
 
 #endif /* _ASM_POWERPC_CACHEFLUSH_H */
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index ed0d633ab5aa..d828813e35de 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -435,7 +435,6 @@ extern void power7_idle_type(unsigned long type);
 extern void power9_idle_type(unsigned long stop_psscr_val,
 			      unsigned long stop_psscr_mask);
 
-extern void flush_instruction_cache(void);
 extern void hard_reset_now(void);
 extern void poweroff_now(void);
 extern int fix_alignment(struct pt_regs *);
diff --git a/arch/powerpc/platforms/44x/machine_check.c b/arch/powerpc/platforms/44x/machine_check.c
index 90ad6ac529d2..a5c898bb9bab 100644
--- a/arch/powerpc/platforms/44x/machine_check.c
+++ b/arch/powerpc/platforms/44x/machine_check.c
@@ -7,6 +7,7 @@
 #include <linux/ptrace.h>
 
 #include <asm/reg.h>
+#include <asm/cacheflush.h>
 
 int machine_check_440A(struct pt_regs *regs)
 {
-- 
2.25.0


^ permalink raw reply related

* [PATCH v2 4/4] powerpc: Rewrite FSL_BOOKE flush_cache_instruction() in C
From: Christophe Leroy @ 2020-08-14  5:56 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, hch
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <50098f49877cea0f46730a9df82dcabf84160e4b.1597384512.git.christophe.leroy@csgroup.eu>

Nothing prevents flush_cache_instruction() from being writen in C.

Do it to improve readability and maintainability.

This function is only use by low level callers, it is not
intended to be used by module. Don't export it.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/kernel/misc_32.S      | 22 ----------------------
 arch/powerpc/mm/nohash/fsl_booke.c | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 1bda207459a8..87717966f5cd 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -268,28 +268,6 @@ _ASM_NOKPROBE_SYMBOL(real_writeb)
 
 #endif /* CONFIG_40x */
 
-
-/*
- * Flush instruction cache.
- */
-#ifdef CONFIG_FSL_BOOKE
-_GLOBAL(flush_instruction_cache)
-#ifdef CONFIG_E200
-	mfspr   r3,SPRN_L1CSR0
-	ori     r3,r3,L1CSR0_CFI|L1CSR0_CLFC
-	/* msync; isync recommended here */
-	mtspr   SPRN_L1CSR0,r3
-	isync
-	blr
-#endif
-	mfspr	r3,SPRN_L1CSR1
-	ori	r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR
-	mtspr	SPRN_L1CSR1,r3
-	isync
-	blr
-EXPORT_SYMBOL(flush_instruction_cache)
-#endif
-
 /*
  * Copy a whole page.  We use the dcbz instruction on the destination
  * to reduce memory traffic (it eliminates the unnecessary reads of
diff --git a/arch/powerpc/mm/nohash/fsl_booke.c b/arch/powerpc/mm/nohash/fsl_booke.c
index 0c294827d6e5..36bda962d3b3 100644
--- a/arch/powerpc/mm/nohash/fsl_booke.c
+++ b/arch/powerpc/mm/nohash/fsl_booke.c
@@ -219,6 +219,22 @@ unsigned long __init mmu_mapin_ram(unsigned long base, unsigned long top)
 	return tlbcam_addrs[tlbcam_index - 1].limit - PAGE_OFFSET + 1;
 }
 
+void flush_instruction_cache(void)
+{
+	unsigned long tmp;
+
+	if (IS_ENABLED(CONFIG_E200)) {
+		tmp = mfspr(SPRN_L1CSR0);
+		tmp |= L1CSR0_CFI | L1CSR0_CLFC;
+		mtspr(SPRN_L1CSR0, tmp);
+	} else {
+		tmp = mfspr(SPRN_L1CSR1);
+		tmp |= L1CSR1_ICFI | L1CSR1_ICLFR;
+		mtspr(SPRN_L1CSR1, tmp);
+	}
+	isync();
+}
+
 /*
  * MMU_init_hw does the chip-specific initialization of the MMU hardware.
  */
-- 
2.25.0


^ permalink raw reply related

* Re: fsl_espi errors on v5.7.15
From: Heiner Kallweit @ 2020-08-14  6:19 UTC (permalink / raw)
  To: Chris Packham, broonie@kernel.org, mpe@ellerman.id.au,
	benh@kernel.crashing.org, paulus@samba.org,
	tiago.brusamarello@datacom.ind.br
  Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linux-spi@vger.kernel.org
In-Reply-To: <3f48e5fb-33c9-8046-0f80-236eed163c16@alliedtelesis.co.nz>

On 14.08.2020 04:48, Chris Packham wrote:
> Hi,
> 
> I'm seeing a problem with accessing spi-nor after upgrading a T2081 
> based system to linux v5.7.15
> 
> For this board u-boot and the u-boot environment live on spi-nor.
> 
> When I use fw_setenv from userspace I get the following kernel logs
> 
> # fw_setenv foo=1
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but SPIE_DON isn't set!
> fsl_espi ffe110000.spi: Transfer done but rx/tx fifo's aren't empty!
> fsl_espi ffe110000.spi: SPIE_RXCNT = 1, SPIE_TXCNT = 32
> fsl_espi ffe110000.spi: Transfer done but rx/tx fifo's aren't empty!
> fsl_espi ffe110000.spi: SPIE_RXCNT = 1, SPIE_TXCNT = 32
> fsl_espi ffe110000.spi: Transfer done but rx/tx fifo's aren't empty!
> fsl_espi ffe110000.spi: SPIE_RXCNT = 1, SPIE_TXCNT = 32
> ...
> 

This error reporting doesn't exist yet in 4.4. So you may have an issue
under 4.4 too, it's just not reported.
Did you verify that under 4.4 fw_setenv actually has an effect?

> If I run fw_printenv (before getting it into a bad state) it is able to 
> display the content of the boards u-boot environment.
> 

This might indicate an issue with spi being locked. I've seen related
questions, just use the search engine of your choice and check for
fw_setenv and locked.

> If been unsuccessful in producing a setup for bisecting the issue. I do 
> know the issue doesn't occur on the old 4.4.x based kernel but that's 
> probably not much help.
> 
> Any pointers on what the issue (and/or solution) might be.
> 
> Thanks,
> Chris
> 

Heiner

^ permalink raw reply

* Re: [PATCH] powerpc: Add POWER10 raw mode cputable entry
From: kernel test robot @ 2020-08-14  6:27 UTC (permalink / raw)
  To: Madhavan Srinivasan, mpe; +Cc: linuxppc-dev, Madhavan Srinivasan, kbuild-all
In-Reply-To: <20200814035903.3179314-1-maddy@linux.ibm.com>

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

Hi Madhavan,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on v5.8 next-20200814]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Madhavan-Srinivasan/powerpc-Add-POWER10-raw-mode-cputable-entry/20200814-120142
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

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

All errors (new ones prefixed by >>):

>> arch/powerpc/kernel/cputable.c:561:26: error: '__machine_check_early_realmode_p10' undeclared here (not in a function); did you mean '__machine_check_early_realmode_p9'?
     561 |   .machine_check_early = __machine_check_early_realmode_p10,
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                          __machine_check_early_realmode_p9

vim +561 arch/powerpc/kernel/cputable.c

   136	
   137	static struct cpu_spec __initdata cpu_specs[] = {
   138	#ifdef CONFIG_PPC_BOOK3S_64
   139		{	/* PPC970 */
   140			.pvr_mask		= 0xffff0000,
   141			.pvr_value		= 0x00390000,
   142			.cpu_name		= "PPC970",
   143			.cpu_features		= CPU_FTRS_PPC970,
   144			.cpu_user_features	= COMMON_USER_POWER4 |
   145				PPC_FEATURE_HAS_ALTIVEC_COMP,
   146			.mmu_features		= MMU_FTRS_PPC970,
   147			.icache_bsize		= 128,
   148			.dcache_bsize		= 128,
   149			.num_pmcs		= 8,
   150			.pmc_type		= PPC_PMC_IBM,
   151			.cpu_setup		= __setup_cpu_ppc970,
   152			.cpu_restore		= __restore_cpu_ppc970,
   153			.oprofile_cpu_type	= "ppc64/970",
   154			.oprofile_type		= PPC_OPROFILE_POWER4,
   155			.platform		= "ppc970",
   156		},
   157		{	/* PPC970FX */
   158			.pvr_mask		= 0xffff0000,
   159			.pvr_value		= 0x003c0000,
   160			.cpu_name		= "PPC970FX",
   161			.cpu_features		= CPU_FTRS_PPC970,
   162			.cpu_user_features	= COMMON_USER_POWER4 |
   163				PPC_FEATURE_HAS_ALTIVEC_COMP,
   164			.mmu_features		= MMU_FTRS_PPC970,
   165			.icache_bsize		= 128,
   166			.dcache_bsize		= 128,
   167			.num_pmcs		= 8,
   168			.pmc_type		= PPC_PMC_IBM,
   169			.cpu_setup		= __setup_cpu_ppc970,
   170			.cpu_restore		= __restore_cpu_ppc970,
   171			.oprofile_cpu_type	= "ppc64/970",
   172			.oprofile_type		= PPC_OPROFILE_POWER4,
   173			.platform		= "ppc970",
   174		},
   175		{	/* PPC970MP DD1.0 - no DEEPNAP, use regular 970 init */
   176			.pvr_mask		= 0xffffffff,
   177			.pvr_value		= 0x00440100,
   178			.cpu_name		= "PPC970MP",
   179			.cpu_features		= CPU_FTRS_PPC970,
   180			.cpu_user_features	= COMMON_USER_POWER4 |
   181				PPC_FEATURE_HAS_ALTIVEC_COMP,
   182			.mmu_features		= MMU_FTRS_PPC970,
   183			.icache_bsize		= 128,
   184			.dcache_bsize		= 128,
   185			.num_pmcs		= 8,
   186			.pmc_type		= PPC_PMC_IBM,
   187			.cpu_setup		= __setup_cpu_ppc970,
   188			.cpu_restore		= __restore_cpu_ppc970,
   189			.oprofile_cpu_type	= "ppc64/970MP",
   190			.oprofile_type		= PPC_OPROFILE_POWER4,
   191			.platform		= "ppc970",
   192		},
   193		{	/* PPC970MP */
   194			.pvr_mask		= 0xffff0000,
   195			.pvr_value		= 0x00440000,
   196			.cpu_name		= "PPC970MP",
   197			.cpu_features		= CPU_FTRS_PPC970,
   198			.cpu_user_features	= COMMON_USER_POWER4 |
   199				PPC_FEATURE_HAS_ALTIVEC_COMP,
   200			.mmu_features		= MMU_FTRS_PPC970,
   201			.icache_bsize		= 128,
   202			.dcache_bsize		= 128,
   203			.num_pmcs		= 8,
   204			.pmc_type		= PPC_PMC_IBM,
   205			.cpu_setup		= __setup_cpu_ppc970MP,
   206			.cpu_restore		= __restore_cpu_ppc970,
   207			.oprofile_cpu_type	= "ppc64/970MP",
   208			.oprofile_type		= PPC_OPROFILE_POWER4,
   209			.platform		= "ppc970",
   210		},
   211		{	/* PPC970GX */
   212			.pvr_mask		= 0xffff0000,
   213			.pvr_value		= 0x00450000,
   214			.cpu_name		= "PPC970GX",
   215			.cpu_features		= CPU_FTRS_PPC970,
   216			.cpu_user_features	= COMMON_USER_POWER4 |
   217				PPC_FEATURE_HAS_ALTIVEC_COMP,
   218			.mmu_features		= MMU_FTRS_PPC970,
   219			.icache_bsize		= 128,
   220			.dcache_bsize		= 128,
   221			.num_pmcs		= 8,
   222			.pmc_type		= PPC_PMC_IBM,
   223			.cpu_setup		= __setup_cpu_ppc970,
   224			.oprofile_cpu_type	= "ppc64/970",
   225			.oprofile_type		= PPC_OPROFILE_POWER4,
   226			.platform		= "ppc970",
   227		},
   228		{	/* Power5 GR */
   229			.pvr_mask		= 0xffff0000,
   230			.pvr_value		= 0x003a0000,
   231			.cpu_name		= "POWER5 (gr)",
   232			.cpu_features		= CPU_FTRS_POWER5,
   233			.cpu_user_features	= COMMON_USER_POWER5,
   234			.mmu_features		= MMU_FTRS_POWER5,
   235			.icache_bsize		= 128,
   236			.dcache_bsize		= 128,
   237			.num_pmcs		= 6,
   238			.pmc_type		= PPC_PMC_IBM,
   239			.oprofile_cpu_type	= "ppc64/power5",
   240			.oprofile_type		= PPC_OPROFILE_POWER4,
   241			/* SIHV / SIPR bits are implemented on POWER4+ (GQ)
   242			 * and above but only works on POWER5 and above
   243			 */
   244			.oprofile_mmcra_sihv	= MMCRA_SIHV,
   245			.oprofile_mmcra_sipr	= MMCRA_SIPR,
   246			.platform		= "power5",
   247		},
   248		{	/* Power5++ */
   249			.pvr_mask		= 0xffffff00,
   250			.pvr_value		= 0x003b0300,
   251			.cpu_name		= "POWER5+ (gs)",
   252			.cpu_features		= CPU_FTRS_POWER5,
   253			.cpu_user_features	= COMMON_USER_POWER5_PLUS,
   254			.mmu_features		= MMU_FTRS_POWER5,
   255			.icache_bsize		= 128,
   256			.dcache_bsize		= 128,
   257			.num_pmcs		= 6,
   258			.oprofile_cpu_type	= "ppc64/power5++",
   259			.oprofile_type		= PPC_OPROFILE_POWER4,
   260			.oprofile_mmcra_sihv	= MMCRA_SIHV,
   261			.oprofile_mmcra_sipr	= MMCRA_SIPR,
   262			.platform		= "power5+",
   263		},
   264		{	/* Power5 GS */
   265			.pvr_mask		= 0xffff0000,
   266			.pvr_value		= 0x003b0000,
   267			.cpu_name		= "POWER5+ (gs)",
   268			.cpu_features		= CPU_FTRS_POWER5,
   269			.cpu_user_features	= COMMON_USER_POWER5_PLUS,
   270			.mmu_features		= MMU_FTRS_POWER5,
   271			.icache_bsize		= 128,
   272			.dcache_bsize		= 128,
   273			.num_pmcs		= 6,
   274			.pmc_type		= PPC_PMC_IBM,
   275			.oprofile_cpu_type	= "ppc64/power5+",
   276			.oprofile_type		= PPC_OPROFILE_POWER4,
   277			.oprofile_mmcra_sihv	= MMCRA_SIHV,
   278			.oprofile_mmcra_sipr	= MMCRA_SIPR,
   279			.platform		= "power5+",
   280		},
   281		{	/* POWER6 in P5+ mode; 2.04-compliant processor */
   282			.pvr_mask		= 0xffffffff,
   283			.pvr_value		= 0x0f000001,
   284			.cpu_name		= "POWER5+",
   285			.cpu_features		= CPU_FTRS_POWER5,
   286			.cpu_user_features	= COMMON_USER_POWER5_PLUS,
   287			.mmu_features		= MMU_FTRS_POWER5,
   288			.icache_bsize		= 128,
   289			.dcache_bsize		= 128,
   290			.oprofile_cpu_type	= "ppc64/ibm-compat-v1",
   291			.oprofile_type		= PPC_OPROFILE_POWER4,
   292			.platform		= "power5+",
   293		},
   294		{	/* Power6 */
   295			.pvr_mask		= 0xffff0000,
   296			.pvr_value		= 0x003e0000,
   297			.cpu_name		= "POWER6 (raw)",
   298			.cpu_features		= CPU_FTRS_POWER6,
   299			.cpu_user_features	= COMMON_USER_POWER6 |
   300				PPC_FEATURE_POWER6_EXT,
   301			.mmu_features		= MMU_FTRS_POWER6,
   302			.icache_bsize		= 128,
   303			.dcache_bsize		= 128,
   304			.num_pmcs		= 6,
   305			.pmc_type		= PPC_PMC_IBM,
   306			.oprofile_cpu_type	= "ppc64/power6",
   307			.oprofile_type		= PPC_OPROFILE_POWER4,
   308			.oprofile_mmcra_sihv	= POWER6_MMCRA_SIHV,
   309			.oprofile_mmcra_sipr	= POWER6_MMCRA_SIPR,
   310			.oprofile_mmcra_clear	= POWER6_MMCRA_THRM |
   311				POWER6_MMCRA_OTHER,
   312			.platform		= "power6x",
   313		},
   314		{	/* 2.05-compliant processor, i.e. Power6 "architected" mode */
   315			.pvr_mask		= 0xffffffff,
   316			.pvr_value		= 0x0f000002,
   317			.cpu_name		= "POWER6 (architected)",
   318			.cpu_features		= CPU_FTRS_POWER6,
   319			.cpu_user_features	= COMMON_USER_POWER6,
   320			.mmu_features		= MMU_FTRS_POWER6,
   321			.icache_bsize		= 128,
   322			.dcache_bsize		= 128,
   323			.oprofile_cpu_type	= "ppc64/ibm-compat-v1",
   324			.oprofile_type		= PPC_OPROFILE_POWER4,
   325			.platform		= "power6",
   326		},
   327		{	/* 2.06-compliant processor, i.e. Power7 "architected" mode */
   328			.pvr_mask		= 0xffffffff,
   329			.pvr_value		= 0x0f000003,
   330			.cpu_name		= "POWER7 (architected)",
   331			.cpu_features		= CPU_FTRS_POWER7,
   332			.cpu_user_features	= COMMON_USER_POWER7,
   333			.cpu_user_features2	= COMMON_USER2_POWER7,
   334			.mmu_features		= MMU_FTRS_POWER7,
   335			.icache_bsize		= 128,
   336			.dcache_bsize		= 128,
   337			.oprofile_type		= PPC_OPROFILE_POWER4,
   338			.oprofile_cpu_type	= "ppc64/ibm-compat-v1",
   339			.cpu_setup		= __setup_cpu_power7,
   340			.cpu_restore		= __restore_cpu_power7,
   341			.machine_check_early	= __machine_check_early_realmode_p7,
   342			.platform		= "power7",
   343		},
   344		{	/* 2.07-compliant processor, i.e. Power8 "architected" mode */
   345			.pvr_mask		= 0xffffffff,
   346			.pvr_value		= 0x0f000004,
   347			.cpu_name		= "POWER8 (architected)",
   348			.cpu_features		= CPU_FTRS_POWER8,
   349			.cpu_user_features	= COMMON_USER_POWER8,
   350			.cpu_user_features2	= COMMON_USER2_POWER8,
   351			.mmu_features		= MMU_FTRS_POWER8,
   352			.icache_bsize		= 128,
   353			.dcache_bsize		= 128,
   354			.oprofile_type		= PPC_OPROFILE_INVALID,
   355			.oprofile_cpu_type	= "ppc64/ibm-compat-v1",
   356			.cpu_setup		= __setup_cpu_power8,
   357			.cpu_restore		= __restore_cpu_power8,
   358			.machine_check_early	= __machine_check_early_realmode_p8,
   359			.platform		= "power8",
   360		},
   361		{	/* 3.00-compliant processor, i.e. Power9 "architected" mode */
   362			.pvr_mask		= 0xffffffff,
   363			.pvr_value		= 0x0f000005,
   364			.cpu_name		= "POWER9 (architected)",
   365			.cpu_features		= CPU_FTRS_POWER9,
   366			.cpu_user_features	= COMMON_USER_POWER9,
   367			.cpu_user_features2	= COMMON_USER2_POWER9,
   368			.mmu_features		= MMU_FTRS_POWER9,
   369			.icache_bsize		= 128,
   370			.dcache_bsize		= 128,
   371			.oprofile_type		= PPC_OPROFILE_INVALID,
   372			.oprofile_cpu_type	= "ppc64/ibm-compat-v1",
   373			.cpu_setup		= __setup_cpu_power9,
   374			.cpu_restore		= __restore_cpu_power9,
   375			.platform		= "power9",
   376		},
   377		{	/* 3.1-compliant processor, i.e. Power10 "architected" mode */
   378			.pvr_mask		= 0xffffffff,
   379			.pvr_value		= 0x0f000006,
   380			.cpu_name		= "POWER10 (architected)",
   381			.cpu_features		= CPU_FTRS_POWER10,
   382			.cpu_user_features	= COMMON_USER_POWER10,
   383			.cpu_user_features2	= COMMON_USER2_POWER10,
   384			.mmu_features		= MMU_FTRS_POWER10,
   385			.icache_bsize		= 128,
   386			.dcache_bsize		= 128,
   387			.oprofile_type		= PPC_OPROFILE_INVALID,
   388			.oprofile_cpu_type	= "ppc64/ibm-compat-v1",
   389			.cpu_setup		= __setup_cpu_power10,
   390			.cpu_restore		= __restore_cpu_power10,
   391			.platform		= "power10",
   392		},
   393		{	/* Power7 */
   394			.pvr_mask		= 0xffff0000,
   395			.pvr_value		= 0x003f0000,
   396			.cpu_name		= "POWER7 (raw)",
   397			.cpu_features		= CPU_FTRS_POWER7,
   398			.cpu_user_features	= COMMON_USER_POWER7,
   399			.cpu_user_features2	= COMMON_USER2_POWER7,
   400			.mmu_features		= MMU_FTRS_POWER7,
   401			.icache_bsize		= 128,
   402			.dcache_bsize		= 128,
   403			.num_pmcs		= 6,
   404			.pmc_type		= PPC_PMC_IBM,
   405			.oprofile_cpu_type	= "ppc64/power7",
   406			.oprofile_type		= PPC_OPROFILE_POWER4,
   407			.cpu_setup		= __setup_cpu_power7,
   408			.cpu_restore		= __restore_cpu_power7,
   409			.machine_check_early	= __machine_check_early_realmode_p7,
   410			.platform		= "power7",
   411		},
   412		{	/* Power7+ */
   413			.pvr_mask		= 0xffff0000,
   414			.pvr_value		= 0x004A0000,
   415			.cpu_name		= "POWER7+ (raw)",
   416			.cpu_features		= CPU_FTRS_POWER7,
   417			.cpu_user_features	= COMMON_USER_POWER7,
   418			.cpu_user_features2	= COMMON_USER2_POWER7,
   419			.mmu_features		= MMU_FTRS_POWER7,
   420			.icache_bsize		= 128,
   421			.dcache_bsize		= 128,
   422			.num_pmcs		= 6,
   423			.pmc_type		= PPC_PMC_IBM,
   424			.oprofile_cpu_type	= "ppc64/power7",
   425			.oprofile_type		= PPC_OPROFILE_POWER4,
   426			.cpu_setup		= __setup_cpu_power7,
   427			.cpu_restore		= __restore_cpu_power7,
   428			.machine_check_early	= __machine_check_early_realmode_p7,
   429			.platform		= "power7+",
   430		},
   431		{	/* Power8E */
   432			.pvr_mask		= 0xffff0000,
   433			.pvr_value		= 0x004b0000,
   434			.cpu_name		= "POWER8E (raw)",
   435			.cpu_features		= CPU_FTRS_POWER8E,
   436			.cpu_user_features	= COMMON_USER_POWER8,
   437			.cpu_user_features2	= COMMON_USER2_POWER8,
   438			.mmu_features		= MMU_FTRS_POWER8,
   439			.icache_bsize		= 128,
   440			.dcache_bsize		= 128,
   441			.num_pmcs		= 6,
   442			.pmc_type		= PPC_PMC_IBM,
   443			.oprofile_cpu_type	= "ppc64/power8",
   444			.oprofile_type		= PPC_OPROFILE_INVALID,
   445			.cpu_setup		= __setup_cpu_power8,
   446			.cpu_restore		= __restore_cpu_power8,
   447			.machine_check_early	= __machine_check_early_realmode_p8,
   448			.platform		= "power8",
   449		},
   450		{	/* Power8NVL */
   451			.pvr_mask		= 0xffff0000,
   452			.pvr_value		= 0x004c0000,
   453			.cpu_name		= "POWER8NVL (raw)",
   454			.cpu_features		= CPU_FTRS_POWER8,
   455			.cpu_user_features	= COMMON_USER_POWER8,
   456			.cpu_user_features2	= COMMON_USER2_POWER8,
   457			.mmu_features		= MMU_FTRS_POWER8,
   458			.icache_bsize		= 128,
   459			.dcache_bsize		= 128,
   460			.num_pmcs		= 6,
   461			.pmc_type		= PPC_PMC_IBM,
   462			.oprofile_cpu_type	= "ppc64/power8",
   463			.oprofile_type		= PPC_OPROFILE_INVALID,
   464			.cpu_setup		= __setup_cpu_power8,
   465			.cpu_restore		= __restore_cpu_power8,
   466			.machine_check_early	= __machine_check_early_realmode_p8,
   467			.platform		= "power8",
   468		},
   469		{	/* Power8 */
   470			.pvr_mask		= 0xffff0000,
   471			.pvr_value		= 0x004d0000,
   472			.cpu_name		= "POWER8 (raw)",
   473			.cpu_features		= CPU_FTRS_POWER8,
   474			.cpu_user_features	= COMMON_USER_POWER8,
   475			.cpu_user_features2	= COMMON_USER2_POWER8,
   476			.mmu_features		= MMU_FTRS_POWER8,
   477			.icache_bsize		= 128,
   478			.dcache_bsize		= 128,
   479			.num_pmcs		= 6,
   480			.pmc_type		= PPC_PMC_IBM,
   481			.oprofile_cpu_type	= "ppc64/power8",
   482			.oprofile_type		= PPC_OPROFILE_INVALID,
   483			.cpu_setup		= __setup_cpu_power8,
   484			.cpu_restore		= __restore_cpu_power8,
   485			.machine_check_early	= __machine_check_early_realmode_p8,
   486			.platform		= "power8",
   487		},
   488		{	/* Power9 DD2.0 */
   489			.pvr_mask		= 0xffffefff,
   490			.pvr_value		= 0x004e0200,
   491			.cpu_name		= "POWER9 (raw)",
   492			.cpu_features		= CPU_FTRS_POWER9_DD2_0,
   493			.cpu_user_features	= COMMON_USER_POWER9,
   494			.cpu_user_features2	= COMMON_USER2_POWER9,
   495			.mmu_features		= MMU_FTRS_POWER9,
   496			.icache_bsize		= 128,
   497			.dcache_bsize		= 128,
   498			.num_pmcs		= 6,
   499			.pmc_type		= PPC_PMC_IBM,
   500			.oprofile_cpu_type	= "ppc64/power9",
   501			.oprofile_type		= PPC_OPROFILE_INVALID,
   502			.cpu_setup		= __setup_cpu_power9,
   503			.cpu_restore		= __restore_cpu_power9,
   504			.machine_check_early	= __machine_check_early_realmode_p9,
   505			.platform		= "power9",
   506		},
   507		{	/* Power9 DD 2.1 */
   508			.pvr_mask		= 0xffffefff,
   509			.pvr_value		= 0x004e0201,
   510			.cpu_name		= "POWER9 (raw)",
   511			.cpu_features		= CPU_FTRS_POWER9_DD2_1,
   512			.cpu_user_features	= COMMON_USER_POWER9,
   513			.cpu_user_features2	= COMMON_USER2_POWER9,
   514			.mmu_features		= MMU_FTRS_POWER9,
   515			.icache_bsize		= 128,
   516			.dcache_bsize		= 128,
   517			.num_pmcs		= 6,
   518			.pmc_type		= PPC_PMC_IBM,
   519			.oprofile_cpu_type	= "ppc64/power9",
   520			.oprofile_type		= PPC_OPROFILE_INVALID,
   521			.cpu_setup		= __setup_cpu_power9,
   522			.cpu_restore		= __restore_cpu_power9,
   523			.machine_check_early	= __machine_check_early_realmode_p9,
   524			.platform		= "power9",
   525		},
   526		{	/* Power9 DD2.2 or later */
   527			.pvr_mask		= 0xffff0000,
   528			.pvr_value		= 0x004e0000,
   529			.cpu_name		= "POWER9 (raw)",
   530			.cpu_features		= CPU_FTRS_POWER9_DD2_2,
   531			.cpu_user_features	= COMMON_USER_POWER9,
   532			.cpu_user_features2	= COMMON_USER2_POWER9,
   533			.mmu_features		= MMU_FTRS_POWER9,
   534			.icache_bsize		= 128,
   535			.dcache_bsize		= 128,
   536			.num_pmcs		= 6,
   537			.pmc_type		= PPC_PMC_IBM,
   538			.oprofile_cpu_type	= "ppc64/power9",
   539			.oprofile_type		= PPC_OPROFILE_INVALID,
   540			.cpu_setup		= __setup_cpu_power9,
   541			.cpu_restore		= __restore_cpu_power9,
   542			.machine_check_early	= __machine_check_early_realmode_p9,
   543			.platform		= "power9",
   544		},
   545		{	/* Power10 */
   546			.pvr_mask		= 0xffff0000,
   547			.pvr_value		= 0x00800000,
   548			.cpu_name		= "POWER10 (raw)",
   549			.cpu_features		= CPU_FTRS_POWER10,
   550			.cpu_user_features	= COMMON_USER_POWER10,
   551			.cpu_user_features2	= COMMON_USER2_POWER10,
   552			.mmu_features		= MMU_FTRS_POWER10,
   553			.icache_bsize		= 128,
   554			.dcache_bsize		= 128,
   555			.num_pmcs		= 6,
   556			.pmc_type		= PPC_PMC_IBM,
   557			.oprofile_cpu_type	= "ppc64/power10",
   558			.oprofile_type		= PPC_OPROFILE_INVALID,
   559			.cpu_setup		= __setup_cpu_power10,
   560			.cpu_restore		= __restore_cpu_power10,
 > 561			.machine_check_early	= __machine_check_early_realmode_p10,
   562			.platform		= "power10",
   563		},
   564		{	/* Cell Broadband Engine */
   565			.pvr_mask		= 0xffff0000,
   566			.pvr_value		= 0x00700000,
   567			.cpu_name		= "Cell Broadband Engine",
   568			.cpu_features		= CPU_FTRS_CELL,
   569			.cpu_user_features	= COMMON_USER_PPC64 |
   570				PPC_FEATURE_CELL | PPC_FEATURE_HAS_ALTIVEC_COMP |
   571				PPC_FEATURE_SMT,
   572			.mmu_features		= MMU_FTRS_CELL,
   573			.icache_bsize		= 128,
   574			.dcache_bsize		= 128,
   575			.num_pmcs		= 4,
   576			.pmc_type		= PPC_PMC_IBM,
   577			.oprofile_cpu_type	= "ppc64/cell-be",
   578			.oprofile_type		= PPC_OPROFILE_CELL,
   579			.platform		= "ppc-cell-be",
   580		},
   581		{	/* PA Semi PA6T */
   582			.pvr_mask		= 0x7fff0000,
   583			.pvr_value		= 0x00900000,
   584			.cpu_name		= "PA6T",
   585			.cpu_features		= CPU_FTRS_PA6T,
   586			.cpu_user_features	= COMMON_USER_PA6T,
   587			.mmu_features		= MMU_FTRS_PA6T,
   588			.icache_bsize		= 64,
   589			.dcache_bsize		= 64,
   590			.num_pmcs		= 6,
   591			.pmc_type		= PPC_PMC_PA6T,
   592			.cpu_setup		= __setup_cpu_pa6t,
   593			.cpu_restore		= __restore_cpu_pa6t,
   594			.oprofile_cpu_type	= "ppc64/pa6t",
   595			.oprofile_type		= PPC_OPROFILE_PA6T,
   596			.platform		= "pa6t",
   597		},
   598		{	/* default match */
   599			.pvr_mask		= 0x00000000,
   600			.pvr_value		= 0x00000000,
   601			.cpu_name		= "POWER5 (compatible)",
   602			.cpu_features		= CPU_FTRS_COMPATIBLE,
   603			.cpu_user_features	= COMMON_USER_PPC64,
   604			.mmu_features		= MMU_FTRS_POWER,
   605			.icache_bsize		= 128,
   606			.dcache_bsize		= 128,
   607			.num_pmcs		= 6,
   608			.pmc_type		= PPC_PMC_IBM,
   609			.platform		= "power5",
   610		}
   611	#endif	/* CONFIG_PPC_BOOK3S_64 */
   612	

---
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: 26274 bytes --]

^ permalink raw reply

* [PATCH v2] powerpc: Drop _nmask_and_or_msr()
From: Christophe Leroy @ 2020-08-14  6:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linuxppc-dev, linux-kernel

_nmask_and_or_msr() is only used at two places to set MSR_IP.

The SYNC is unnecessary as the users are not PowerPC 601.

Can be easily writen in C.

Do it, and drop _nmask_and_or_msr()

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v2: Removed the prototype in asm/processor.h
---
 arch/powerpc/include/asm/processor.h              |  1 -
 arch/powerpc/kernel/misc_32.S                     | 13 -------------
 arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c |  3 ++-
 arch/powerpc/platforms/embedded6xx/storcenter.c   |  3 ++-
 4 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index ed0d633ab5aa..5f6b3ee84dd1 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -441,7 +441,6 @@ extern void poweroff_now(void);
 extern int fix_alignment(struct pt_regs *);
 extern void cvt_fd(float *from, double *to);
 extern void cvt_df(double *from, float *to);
-extern void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
 
 #ifdef CONFIG_PPC64
 /*
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index b24f866fef81..8d9cb5df580e 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -215,19 +215,6 @@ _GLOBAL(low_choose_7447a_dfs)
 
 #endif /* CONFIG_CPU_FREQ_PMAC && CONFIG_PPC_BOOK3S_32 */
 
-/*
- * complement mask on the msr then "or" some values on.
- *     _nmask_and_or_msr(nmask, value_to_or)
- */
-_GLOBAL(_nmask_and_or_msr)
-	mfmsr	r0		/* Get current msr */
-	andc	r0,r0,r3	/* And off the bits set in r3 (first parm) */
-	or	r0,r0,r4	/* Or on the bits in r4 (second parm) */
-	SYNC			/* Some chip revs have problems here... */
-	mtmsr	r0		/* Update machine state */
-	isync
-	blr			/* Done */
-
 #ifdef CONFIG_40x
 
 /*
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
index 15437abe1f6d..b95c3380d2b5 100644
--- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
@@ -147,7 +147,8 @@ static void __noreturn mpc7448_hpc2_restart(char *cmd)
 	local_irq_disable();
 
 	/* Set exception prefix high - to the firmware */
-	_nmask_and_or_msr(0, MSR_IP);
+	mtmsr(mfmsr() | MSR_IP);
+	isync();
 
 	for (;;) ;		/* Spin until reset happens */
 }
diff --git a/arch/powerpc/platforms/embedded6xx/storcenter.c b/arch/powerpc/platforms/embedded6xx/storcenter.c
index ed1914dd34bb..e346ddcef45e 100644
--- a/arch/powerpc/platforms/embedded6xx/storcenter.c
+++ b/arch/powerpc/platforms/embedded6xx/storcenter.c
@@ -101,7 +101,8 @@ static void __noreturn storcenter_restart(char *cmd)
 	local_irq_disable();
 
 	/* Set exception prefix high - to the firmware */
-	_nmask_and_or_msr(0, MSR_IP);
+	mtmsr(mfmsr() | MSR_IP);
+	isync();
 
 	/* Wait for reset to happen */
 	for (;;) ;
-- 
2.25.0


^ permalink raw reply related

* Re: [PATCH] powerpc: Add POWER10 raw mode cputable entry
From: Madhavan Srinivasan @ 2020-08-14  7:20 UTC (permalink / raw)
  To: kernel test robot, mpe; +Cc: linuxppc-dev, kbuild-all
In-Reply-To: <202008141438.ZTQh1pcI%lkp@intel.com>



On 8/14/20 11:57 AM, kernel test robot wrote:
> Hi Madhavan,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on powerpc/next]
> [also build test ERROR on v5.8 next-20200814]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:    https://github.com/0day-ci/linux/commits/Madhavan-Srinivasan/powerpc-Add-POWER10-raw-mode-cputable-entry/20200814-120142
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
> config: powerpc-defconfig (attached as .config)
> compiler: powerpc64-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # save the attached .config to linux build tree
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
>>> arch/powerpc/kernel/cputable.c:561:26: error: '__machine_check_early_realmode_p10' undeclared here (not in a function); did you mean '__machine_check_early_realmode_p9'?
>       561 |   .machine_check_early = __machine_check_early_realmode_p10,
>           |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>           |                          __machine_check_early_realmode_p9

Yes, i did hit this in my compile check and i added the below line,

diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index b4066354f073..b22216db5c71 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -75,6 +75,7 @@ extern void __restore_cpu_power10(void);
  extern long __machine_check_early_realmode_p7(struct pt_regs *regs);
  extern long __machine_check_early_realmode_p8(struct pt_regs *regs);
  extern long __machine_check_early_realmode_p9(struct pt_regs *regs);
+extern long __machine_check_early_realmode_p10(struct pt_regs *regs);
  #endif /* CONFIG_PPC64 */
  #if defined(CONFIG_E500)
  extern void __setup_cpu_e5500(unsigned long offset, struct cpu_spec* 
spec);


but my bad, i sent the one i internally reviewed which did not have it.
I will send again. Sorry

Maddy

> vim +561 arch/powerpc/kernel/cputable.c
>
>     136	
>     137	static struct cpu_spec __initdata cpu_specs[] = {
>     138	#ifdef CONFIG_PPC_BOOK3S_64
>     139		{	/* PPC970 */
>     140			.pvr_mask		= 0xffff0000,
>     141			.pvr_value		= 0x00390000,
>     142			.cpu_name		= "PPC970",
>     143			.cpu_features		= CPU_FTRS_PPC970,
>     144			.cpu_user_features	= COMMON_USER_POWER4 |
>     145				PPC_FEATURE_HAS_ALTIVEC_COMP,
>     146			.mmu_features		= MMU_FTRS_PPC970,
>     147			.icache_bsize		= 128,
>     148			.dcache_bsize		= 128,
>     149			.num_pmcs		= 8,
>     150			.pmc_type		= PPC_PMC_IBM,
>     151			.cpu_setup		= __setup_cpu_ppc970,
>     152			.cpu_restore		= __restore_cpu_ppc970,
>     153			.oprofile_cpu_type	= "ppc64/970",
>     154			.oprofile_type		= PPC_OPROFILE_POWER4,
>     155			.platform		= "ppc970",
>     156		},
>     157		{	/* PPC970FX */
>     158			.pvr_mask		= 0xffff0000,
>     159			.pvr_value		= 0x003c0000,
>     160			.cpu_name		= "PPC970FX",
>     161			.cpu_features		= CPU_FTRS_PPC970,
>     162			.cpu_user_features	= COMMON_USER_POWER4 |
>     163				PPC_FEATURE_HAS_ALTIVEC_COMP,
>     164			.mmu_features		= MMU_FTRS_PPC970,
>     165			.icache_bsize		= 128,
>     166			.dcache_bsize		= 128,
>     167			.num_pmcs		= 8,
>     168			.pmc_type		= PPC_PMC_IBM,
>     169			.cpu_setup		= __setup_cpu_ppc970,
>     170			.cpu_restore		= __restore_cpu_ppc970,
>     171			.oprofile_cpu_type	= "ppc64/970",
>     172			.oprofile_type		= PPC_OPROFILE_POWER4,
>     173			.platform		= "ppc970",
>     174		},
>     175		{	/* PPC970MP DD1.0 - no DEEPNAP, use regular 970 init */
>     176			.pvr_mask		= 0xffffffff,
>     177			.pvr_value		= 0x00440100,
>     178			.cpu_name		= "PPC970MP",
>     179			.cpu_features		= CPU_FTRS_PPC970,
>     180			.cpu_user_features	= COMMON_USER_POWER4 |
>     181				PPC_FEATURE_HAS_ALTIVEC_COMP,
>     182			.mmu_features		= MMU_FTRS_PPC970,
>     183			.icache_bsize		= 128,
>     184			.dcache_bsize		= 128,
>     185			.num_pmcs		= 8,
>     186			.pmc_type		= PPC_PMC_IBM,
>     187			.cpu_setup		= __setup_cpu_ppc970,
>     188			.cpu_restore		= __restore_cpu_ppc970,
>     189			.oprofile_cpu_type	= "ppc64/970MP",
>     190			.oprofile_type		= PPC_OPROFILE_POWER4,
>     191			.platform		= "ppc970",
>     192		},
>     193		{	/* PPC970MP */
>     194			.pvr_mask		= 0xffff0000,
>     195			.pvr_value		= 0x00440000,
>     196			.cpu_name		= "PPC970MP",
>     197			.cpu_features		= CPU_FTRS_PPC970,
>     198			.cpu_user_features	= COMMON_USER_POWER4 |
>     199				PPC_FEATURE_HAS_ALTIVEC_COMP,
>     200			.mmu_features		= MMU_FTRS_PPC970,
>     201			.icache_bsize		= 128,
>     202			.dcache_bsize		= 128,
>     203			.num_pmcs		= 8,
>     204			.pmc_type		= PPC_PMC_IBM,
>     205			.cpu_setup		= __setup_cpu_ppc970MP,
>     206			.cpu_restore		= __restore_cpu_ppc970,
>     207			.oprofile_cpu_type	= "ppc64/970MP",
>     208			.oprofile_type		= PPC_OPROFILE_POWER4,
>     209			.platform		= "ppc970",
>     210		},
>     211		{	/* PPC970GX */
>     212			.pvr_mask		= 0xffff0000,
>     213			.pvr_value		= 0x00450000,
>     214			.cpu_name		= "PPC970GX",
>     215			.cpu_features		= CPU_FTRS_PPC970,
>     216			.cpu_user_features	= COMMON_USER_POWER4 |
>     217				PPC_FEATURE_HAS_ALTIVEC_COMP,
>     218			.mmu_features		= MMU_FTRS_PPC970,
>     219			.icache_bsize		= 128,
>     220			.dcache_bsize		= 128,
>     221			.num_pmcs		= 8,
>     222			.pmc_type		= PPC_PMC_IBM,
>     223			.cpu_setup		= __setup_cpu_ppc970,
>     224			.oprofile_cpu_type	= "ppc64/970",
>     225			.oprofile_type		= PPC_OPROFILE_POWER4,
>     226			.platform		= "ppc970",
>     227		},
>     228		{	/* Power5 GR */
>     229			.pvr_mask		= 0xffff0000,
>     230			.pvr_value		= 0x003a0000,
>     231			.cpu_name		= "POWER5 (gr)",
>     232			.cpu_features		= CPU_FTRS_POWER5,
>     233			.cpu_user_features	= COMMON_USER_POWER5,
>     234			.mmu_features		= MMU_FTRS_POWER5,
>     235			.icache_bsize		= 128,
>     236			.dcache_bsize		= 128,
>     237			.num_pmcs		= 6,
>     238			.pmc_type		= PPC_PMC_IBM,
>     239			.oprofile_cpu_type	= "ppc64/power5",
>     240			.oprofile_type		= PPC_OPROFILE_POWER4,
>     241			/* SIHV / SIPR bits are implemented on POWER4+ (GQ)
>     242			 * and above but only works on POWER5 and above
>     243			 */
>     244			.oprofile_mmcra_sihv	= MMCRA_SIHV,
>     245			.oprofile_mmcra_sipr	= MMCRA_SIPR,
>     246			.platform		= "power5",
>     247		},
>     248		{	/* Power5++ */
>     249			.pvr_mask		= 0xffffff00,
>     250			.pvr_value		= 0x003b0300,
>     251			.cpu_name		= "POWER5+ (gs)",
>     252			.cpu_features		= CPU_FTRS_POWER5,
>     253			.cpu_user_features	= COMMON_USER_POWER5_PLUS,
>     254			.mmu_features		= MMU_FTRS_POWER5,
>     255			.icache_bsize		= 128,
>     256			.dcache_bsize		= 128,
>     257			.num_pmcs		= 6,
>     258			.oprofile_cpu_type	= "ppc64/power5++",
>     259			.oprofile_type		= PPC_OPROFILE_POWER4,
>     260			.oprofile_mmcra_sihv	= MMCRA_SIHV,
>     261			.oprofile_mmcra_sipr	= MMCRA_SIPR,
>     262			.platform		= "power5+",
>     263		},
>     264		{	/* Power5 GS */
>     265			.pvr_mask		= 0xffff0000,
>     266			.pvr_value		= 0x003b0000,
>     267			.cpu_name		= "POWER5+ (gs)",
>     268			.cpu_features		= CPU_FTRS_POWER5,
>     269			.cpu_user_features	= COMMON_USER_POWER5_PLUS,
>     270			.mmu_features		= MMU_FTRS_POWER5,
>     271			.icache_bsize		= 128,
>     272			.dcache_bsize		= 128,
>     273			.num_pmcs		= 6,
>     274			.pmc_type		= PPC_PMC_IBM,
>     275			.oprofile_cpu_type	= "ppc64/power5+",
>     276			.oprofile_type		= PPC_OPROFILE_POWER4,
>     277			.oprofile_mmcra_sihv	= MMCRA_SIHV,
>     278			.oprofile_mmcra_sipr	= MMCRA_SIPR,
>     279			.platform		= "power5+",
>     280		},
>     281		{	/* POWER6 in P5+ mode; 2.04-compliant processor */
>     282			.pvr_mask		= 0xffffffff,
>     283			.pvr_value		= 0x0f000001,
>     284			.cpu_name		= "POWER5+",
>     285			.cpu_features		= CPU_FTRS_POWER5,
>     286			.cpu_user_features	= COMMON_USER_POWER5_PLUS,
>     287			.mmu_features		= MMU_FTRS_POWER5,
>     288			.icache_bsize		= 128,
>     289			.dcache_bsize		= 128,
>     290			.oprofile_cpu_type	= "ppc64/ibm-compat-v1",
>     291			.oprofile_type		= PPC_OPROFILE_POWER4,
>     292			.platform		= "power5+",
>     293		},
>     294		{	/* Power6 */
>     295			.pvr_mask		= 0xffff0000,
>     296			.pvr_value		= 0x003e0000,
>     297			.cpu_name		= "POWER6 (raw)",
>     298			.cpu_features		= CPU_FTRS_POWER6,
>     299			.cpu_user_features	= COMMON_USER_POWER6 |
>     300				PPC_FEATURE_POWER6_EXT,
>     301			.mmu_features		= MMU_FTRS_POWER6,
>     302			.icache_bsize		= 128,
>     303			.dcache_bsize		= 128,
>     304			.num_pmcs		= 6,
>     305			.pmc_type		= PPC_PMC_IBM,
>     306			.oprofile_cpu_type	= "ppc64/power6",
>     307			.oprofile_type		= PPC_OPROFILE_POWER4,
>     308			.oprofile_mmcra_sihv	= POWER6_MMCRA_SIHV,
>     309			.oprofile_mmcra_sipr	= POWER6_MMCRA_SIPR,
>     310			.oprofile_mmcra_clear	= POWER6_MMCRA_THRM |
>     311				POWER6_MMCRA_OTHER,
>     312			.platform		= "power6x",
>     313		},
>     314		{	/* 2.05-compliant processor, i.e. Power6 "architected" mode */
>     315			.pvr_mask		= 0xffffffff,
>     316			.pvr_value		= 0x0f000002,
>     317			.cpu_name		= "POWER6 (architected)",
>     318			.cpu_features		= CPU_FTRS_POWER6,
>     319			.cpu_user_features	= COMMON_USER_POWER6,
>     320			.mmu_features		= MMU_FTRS_POWER6,
>     321			.icache_bsize		= 128,
>     322			.dcache_bsize		= 128,
>     323			.oprofile_cpu_type	= "ppc64/ibm-compat-v1",
>     324			.oprofile_type		= PPC_OPROFILE_POWER4,
>     325			.platform		= "power6",
>     326		},
>     327		{	/* 2.06-compliant processor, i.e. Power7 "architected" mode */
>     328			.pvr_mask		= 0xffffffff,
>     329			.pvr_value		= 0x0f000003,
>     330			.cpu_name		= "POWER7 (architected)",
>     331			.cpu_features		= CPU_FTRS_POWER7,
>     332			.cpu_user_features	= COMMON_USER_POWER7,
>     333			.cpu_user_features2	= COMMON_USER2_POWER7,
>     334			.mmu_features		= MMU_FTRS_POWER7,
>     335			.icache_bsize		= 128,
>     336			.dcache_bsize		= 128,
>     337			.oprofile_type		= PPC_OPROFILE_POWER4,
>     338			.oprofile_cpu_type	= "ppc64/ibm-compat-v1",
>     339			.cpu_setup		= __setup_cpu_power7,
>     340			.cpu_restore		= __restore_cpu_power7,
>     341			.machine_check_early	= __machine_check_early_realmode_p7,
>     342			.platform		= "power7",
>     343		},
>     344		{	/* 2.07-compliant processor, i.e. Power8 "architected" mode */
>     345			.pvr_mask		= 0xffffffff,
>     346			.pvr_value		= 0x0f000004,
>     347			.cpu_name		= "POWER8 (architected)",
>     348			.cpu_features		= CPU_FTRS_POWER8,
>     349			.cpu_user_features	= COMMON_USER_POWER8,
>     350			.cpu_user_features2	= COMMON_USER2_POWER8,
>     351			.mmu_features		= MMU_FTRS_POWER8,
>     352			.icache_bsize		= 128,
>     353			.dcache_bsize		= 128,
>     354			.oprofile_type		= PPC_OPROFILE_INVALID,
>     355			.oprofile_cpu_type	= "ppc64/ibm-compat-v1",
>     356			.cpu_setup		= __setup_cpu_power8,
>     357			.cpu_restore		= __restore_cpu_power8,
>     358			.machine_check_early	= __machine_check_early_realmode_p8,
>     359			.platform		= "power8",
>     360		},
>     361		{	/* 3.00-compliant processor, i.e. Power9 "architected" mode */
>     362			.pvr_mask		= 0xffffffff,
>     363			.pvr_value		= 0x0f000005,
>     364			.cpu_name		= "POWER9 (architected)",
>     365			.cpu_features		= CPU_FTRS_POWER9,
>     366			.cpu_user_features	= COMMON_USER_POWER9,
>     367			.cpu_user_features2	= COMMON_USER2_POWER9,
>     368			.mmu_features		= MMU_FTRS_POWER9,
>     369			.icache_bsize		= 128,
>     370			.dcache_bsize		= 128,
>     371			.oprofile_type		= PPC_OPROFILE_INVALID,
>     372			.oprofile_cpu_type	= "ppc64/ibm-compat-v1",
>     373			.cpu_setup		= __setup_cpu_power9,
>     374			.cpu_restore		= __restore_cpu_power9,
>     375			.platform		= "power9",
>     376		},
>     377		{	/* 3.1-compliant processor, i.e. Power10 "architected" mode */
>     378			.pvr_mask		= 0xffffffff,
>     379			.pvr_value		= 0x0f000006,
>     380			.cpu_name		= "POWER10 (architected)",
>     381			.cpu_features		= CPU_FTRS_POWER10,
>     382			.cpu_user_features	= COMMON_USER_POWER10,
>     383			.cpu_user_features2	= COMMON_USER2_POWER10,
>     384			.mmu_features		= MMU_FTRS_POWER10,
>     385			.icache_bsize		= 128,
>     386			.dcache_bsize		= 128,
>     387			.oprofile_type		= PPC_OPROFILE_INVALID,
>     388			.oprofile_cpu_type	= "ppc64/ibm-compat-v1",
>     389			.cpu_setup		= __setup_cpu_power10,
>     390			.cpu_restore		= __restore_cpu_power10,
>     391			.platform		= "power10",
>     392		},
>     393		{	/* Power7 */
>     394			.pvr_mask		= 0xffff0000,
>     395			.pvr_value		= 0x003f0000,
>     396			.cpu_name		= "POWER7 (raw)",
>     397			.cpu_features		= CPU_FTRS_POWER7,
>     398			.cpu_user_features	= COMMON_USER_POWER7,
>     399			.cpu_user_features2	= COMMON_USER2_POWER7,
>     400			.mmu_features		= MMU_FTRS_POWER7,
>     401			.icache_bsize		= 128,
>     402			.dcache_bsize		= 128,
>     403			.num_pmcs		= 6,
>     404			.pmc_type		= PPC_PMC_IBM,
>     405			.oprofile_cpu_type	= "ppc64/power7",
>     406			.oprofile_type		= PPC_OPROFILE_POWER4,
>     407			.cpu_setup		= __setup_cpu_power7,
>     408			.cpu_restore		= __restore_cpu_power7,
>     409			.machine_check_early	= __machine_check_early_realmode_p7,
>     410			.platform		= "power7",
>     411		},
>     412		{	/* Power7+ */
>     413			.pvr_mask		= 0xffff0000,
>     414			.pvr_value		= 0x004A0000,
>     415			.cpu_name		= "POWER7+ (raw)",
>     416			.cpu_features		= CPU_FTRS_POWER7,
>     417			.cpu_user_features	= COMMON_USER_POWER7,
>     418			.cpu_user_features2	= COMMON_USER2_POWER7,
>     419			.mmu_features		= MMU_FTRS_POWER7,
>     420			.icache_bsize		= 128,
>     421			.dcache_bsize		= 128,
>     422			.num_pmcs		= 6,
>     423			.pmc_type		= PPC_PMC_IBM,
>     424			.oprofile_cpu_type	= "ppc64/power7",
>     425			.oprofile_type		= PPC_OPROFILE_POWER4,
>     426			.cpu_setup		= __setup_cpu_power7,
>     427			.cpu_restore		= __restore_cpu_power7,
>     428			.machine_check_early	= __machine_check_early_realmode_p7,
>     429			.platform		= "power7+",
>     430		},
>     431		{	/* Power8E */
>     432			.pvr_mask		= 0xffff0000,
>     433			.pvr_value		= 0x004b0000,
>     434			.cpu_name		= "POWER8E (raw)",
>     435			.cpu_features		= CPU_FTRS_POWER8E,
>     436			.cpu_user_features	= COMMON_USER_POWER8,
>     437			.cpu_user_features2	= COMMON_USER2_POWER8,
>     438			.mmu_features		= MMU_FTRS_POWER8,
>     439			.icache_bsize		= 128,
>     440			.dcache_bsize		= 128,
>     441			.num_pmcs		= 6,
>     442			.pmc_type		= PPC_PMC_IBM,
>     443			.oprofile_cpu_type	= "ppc64/power8",
>     444			.oprofile_type		= PPC_OPROFILE_INVALID,
>     445			.cpu_setup		= __setup_cpu_power8,
>     446			.cpu_restore		= __restore_cpu_power8,
>     447			.machine_check_early	= __machine_check_early_realmode_p8,
>     448			.platform		= "power8",
>     449		},
>     450		{	/* Power8NVL */
>     451			.pvr_mask		= 0xffff0000,
>     452			.pvr_value		= 0x004c0000,
>     453			.cpu_name		= "POWER8NVL (raw)",
>     454			.cpu_features		= CPU_FTRS_POWER8,
>     455			.cpu_user_features	= COMMON_USER_POWER8,
>     456			.cpu_user_features2	= COMMON_USER2_POWER8,
>     457			.mmu_features		= MMU_FTRS_POWER8,
>     458			.icache_bsize		= 128,
>     459			.dcache_bsize		= 128,
>     460			.num_pmcs		= 6,
>     461			.pmc_type		= PPC_PMC_IBM,
>     462			.oprofile_cpu_type	= "ppc64/power8",
>     463			.oprofile_type		= PPC_OPROFILE_INVALID,
>     464			.cpu_setup		= __setup_cpu_power8,
>     465			.cpu_restore		= __restore_cpu_power8,
>     466			.machine_check_early	= __machine_check_early_realmode_p8,
>     467			.platform		= "power8",
>     468		},
>     469		{	/* Power8 */
>     470			.pvr_mask		= 0xffff0000,
>     471			.pvr_value		= 0x004d0000,
>     472			.cpu_name		= "POWER8 (raw)",
>     473			.cpu_features		= CPU_FTRS_POWER8,
>     474			.cpu_user_features	= COMMON_USER_POWER8,
>     475			.cpu_user_features2	= COMMON_USER2_POWER8,
>     476			.mmu_features		= MMU_FTRS_POWER8,
>     477			.icache_bsize		= 128,
>     478			.dcache_bsize		= 128,
>     479			.num_pmcs		= 6,
>     480			.pmc_type		= PPC_PMC_IBM,
>     481			.oprofile_cpu_type	= "ppc64/power8",
>     482			.oprofile_type		= PPC_OPROFILE_INVALID,
>     483			.cpu_setup		= __setup_cpu_power8,
>     484			.cpu_restore		= __restore_cpu_power8,
>     485			.machine_check_early	= __machine_check_early_realmode_p8,
>     486			.platform		= "power8",
>     487		},
>     488		{	/* Power9 DD2.0 */
>     489			.pvr_mask		= 0xffffefff,
>     490			.pvr_value		= 0x004e0200,
>     491			.cpu_name		= "POWER9 (raw)",
>     492			.cpu_features		= CPU_FTRS_POWER9_DD2_0,
>     493			.cpu_user_features	= COMMON_USER_POWER9,
>     494			.cpu_user_features2	= COMMON_USER2_POWER9,
>     495			.mmu_features		= MMU_FTRS_POWER9,
>     496			.icache_bsize		= 128,
>     497			.dcache_bsize		= 128,
>     498			.num_pmcs		= 6,
>     499			.pmc_type		= PPC_PMC_IBM,
>     500			.oprofile_cpu_type	= "ppc64/power9",
>     501			.oprofile_type		= PPC_OPROFILE_INVALID,
>     502			.cpu_setup		= __setup_cpu_power9,
>     503			.cpu_restore		= __restore_cpu_power9,
>     504			.machine_check_early	= __machine_check_early_realmode_p9,
>     505			.platform		= "power9",
>     506		},
>     507		{	/* Power9 DD 2.1 */
>     508			.pvr_mask		= 0xffffefff,
>     509			.pvr_value		= 0x004e0201,
>     510			.cpu_name		= "POWER9 (raw)",
>     511			.cpu_features		= CPU_FTRS_POWER9_DD2_1,
>     512			.cpu_user_features	= COMMON_USER_POWER9,
>     513			.cpu_user_features2	= COMMON_USER2_POWER9,
>     514			.mmu_features		= MMU_FTRS_POWER9,
>     515			.icache_bsize		= 128,
>     516			.dcache_bsize		= 128,
>     517			.num_pmcs		= 6,
>     518			.pmc_type		= PPC_PMC_IBM,
>     519			.oprofile_cpu_type	= "ppc64/power9",
>     520			.oprofile_type		= PPC_OPROFILE_INVALID,
>     521			.cpu_setup		= __setup_cpu_power9,
>     522			.cpu_restore		= __restore_cpu_power9,
>     523			.machine_check_early	= __machine_check_early_realmode_p9,
>     524			.platform		= "power9",
>     525		},
>     526		{	/* Power9 DD2.2 or later */
>     527			.pvr_mask		= 0xffff0000,
>     528			.pvr_value		= 0x004e0000,
>     529			.cpu_name		= "POWER9 (raw)",
>     530			.cpu_features		= CPU_FTRS_POWER9_DD2_2,
>     531			.cpu_user_features	= COMMON_USER_POWER9,
>     532			.cpu_user_features2	= COMMON_USER2_POWER9,
>     533			.mmu_features		= MMU_FTRS_POWER9,
>     534			.icache_bsize		= 128,
>     535			.dcache_bsize		= 128,
>     536			.num_pmcs		= 6,
>     537			.pmc_type		= PPC_PMC_IBM,
>     538			.oprofile_cpu_type	= "ppc64/power9",
>     539			.oprofile_type		= PPC_OPROFILE_INVALID,
>     540			.cpu_setup		= __setup_cpu_power9,
>     541			.cpu_restore		= __restore_cpu_power9,
>     542			.machine_check_early	= __machine_check_early_realmode_p9,
>     543			.platform		= "power9",
>     544		},
>     545		{	/* Power10 */
>     546			.pvr_mask		= 0xffff0000,
>     547			.pvr_value		= 0x00800000,
>     548			.cpu_name		= "POWER10 (raw)",
>     549			.cpu_features		= CPU_FTRS_POWER10,
>     550			.cpu_user_features	= COMMON_USER_POWER10,
>     551			.cpu_user_features2	= COMMON_USER2_POWER10,
>     552			.mmu_features		= MMU_FTRS_POWER10,
>     553			.icache_bsize		= 128,
>     554			.dcache_bsize		= 128,
>     555			.num_pmcs		= 6,
>     556			.pmc_type		= PPC_PMC_IBM,
>     557			.oprofile_cpu_type	= "ppc64/power10",
>     558			.oprofile_type		= PPC_OPROFILE_INVALID,
>     559			.cpu_setup		= __setup_cpu_power10,
>     560			.cpu_restore		= __restore_cpu_power10,
>   > 561			.machine_check_early	= __machine_check_early_realmode_p10,
>     562			.platform		= "power10",
>     563		},
>     564		{	/* Cell Broadband Engine */
>     565			.pvr_mask		= 0xffff0000,
>     566			.pvr_value		= 0x00700000,
>     567			.cpu_name		= "Cell Broadband Engine",
>     568			.cpu_features		= CPU_FTRS_CELL,
>     569			.cpu_user_features	= COMMON_USER_PPC64 |
>     570				PPC_FEATURE_CELL | PPC_FEATURE_HAS_ALTIVEC_COMP |
>     571				PPC_FEATURE_SMT,
>     572			.mmu_features		= MMU_FTRS_CELL,
>     573			.icache_bsize		= 128,
>     574			.dcache_bsize		= 128,
>     575			.num_pmcs		= 4,
>     576			.pmc_type		= PPC_PMC_IBM,
>     577			.oprofile_cpu_type	= "ppc64/cell-be",
>     578			.oprofile_type		= PPC_OPROFILE_CELL,
>     579			.platform		= "ppc-cell-be",
>     580		},
>     581		{	/* PA Semi PA6T */
>     582			.pvr_mask		= 0x7fff0000,
>     583			.pvr_value		= 0x00900000,
>     584			.cpu_name		= "PA6T",
>     585			.cpu_features		= CPU_FTRS_PA6T,
>     586			.cpu_user_features	= COMMON_USER_PA6T,
>     587			.mmu_features		= MMU_FTRS_PA6T,
>     588			.icache_bsize		= 64,
>     589			.dcache_bsize		= 64,
>     590			.num_pmcs		= 6,
>     591			.pmc_type		= PPC_PMC_PA6T,
>     592			.cpu_setup		= __setup_cpu_pa6t,
>     593			.cpu_restore		= __restore_cpu_pa6t,
>     594			.oprofile_cpu_type	= "ppc64/pa6t",
>     595			.oprofile_type		= PPC_OPROFILE_PA6T,
>     596			.platform		= "pa6t",
>     597		},
>     598		{	/* default match */
>     599			.pvr_mask		= 0x00000000,
>     600			.pvr_value		= 0x00000000,
>     601			.cpu_name		= "POWER5 (compatible)",
>     602			.cpu_features		= CPU_FTRS_COMPATIBLE,
>     603			.cpu_user_features	= COMMON_USER_PPC64,
>     604			.mmu_features		= MMU_FTRS_POWER,
>     605			.icache_bsize		= 128,
>     606			.dcache_bsize		= 128,
>     607			.num_pmcs		= 6,
>     608			.pmc_type		= PPC_PMC_IBM,
>     609			.platform		= "power5",
>     610		}
>     611	#endif	/* CONFIG_PPC_BOOK3S_64 */
>     612	
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


^ permalink raw reply related

* [PATCH v2] powerpc: Add POWER10 raw mode cputable entry
From: Madhavan Srinivasan @ 2020-08-14  7:45 UTC (permalink / raw)
  To: mpe; +Cc: Madhavan Srinivasan, linuxppc-dev

Add a raw mode cputable entry for POWER10. Copies most of the fields
from commit a3ea40d5c736 ("powerpc: Add POWER10 architected mode")
except for oprofile_cpu_type, machine_check_early, pvr_mask and pvr_mask
fields. On bare metal systems we use DT CPU features, which doesn't need a
cputable entry. But in VMs we still rely on the raw cputable entry to
set the correct values for the PMU related fields.

Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
---
Changelog v1:
- Fixed function undeclared compiler error.

 arch/powerpc/kernel/cputable.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index b4066354f0730..bb0c7f43a8283 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -75,6 +75,7 @@ extern void __restore_cpu_power10(void);
 extern long __machine_check_early_realmode_p7(struct pt_regs *regs);
 extern long __machine_check_early_realmode_p8(struct pt_regs *regs);
 extern long __machine_check_early_realmode_p9(struct pt_regs *regs);
+extern long __machine_check_early_realmode_p10(struct pt_regs *regs);
 #endif /* CONFIG_PPC64 */
 #if defined(CONFIG_E500)
 extern void __setup_cpu_e5500(unsigned long offset, struct cpu_spec* spec);
@@ -541,6 +542,25 @@ static struct cpu_spec __initdata cpu_specs[] = {
 		.machine_check_early	= __machine_check_early_realmode_p9,
 		.platform		= "power9",
 	},
+	{	/* Power10 */
+		.pvr_mask		= 0xffff0000,
+		.pvr_value		= 0x00800000,
+		.cpu_name		= "POWER10 (raw)",
+		.cpu_features		= CPU_FTRS_POWER10,
+		.cpu_user_features	= COMMON_USER_POWER10,
+		.cpu_user_features2	= COMMON_USER2_POWER10,
+		.mmu_features		= MMU_FTRS_POWER10,
+		.icache_bsize		= 128,
+		.dcache_bsize		= 128,
+		.num_pmcs		= 6,
+		.pmc_type		= PPC_PMC_IBM,
+		.oprofile_cpu_type	= "ppc64/power10",
+		.oprofile_type		= PPC_OPROFILE_INVALID,
+		.cpu_setup		= __setup_cpu_power10,
+		.cpu_restore		= __restore_cpu_power10,
+		.machine_check_early	= __machine_check_early_realmode_p10,
+		.platform		= "power10",
+	},
 	{	/* Cell Broadband Engine */
 		.pvr_mask		= 0xffff0000,
 		.pvr_value		= 0x00700000,
-- 
2.26.2


^ permalink raw reply related

* [PATCH net 1/5] ibmvnic: print caller in several error messages
From: Lijun Pan @ 2020-08-14  7:59 UTC (permalink / raw)
  To: netdev; +Cc: Lijun Pan, linuxppc-dev
In-Reply-To: <20200814075921.88745-1-ljp@linux.ibm.com>

The error messages in the changed functions are exactly the same.
In order to differentiate them and make debugging easier,
we print the function names in the error messages.

Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 5afb3c9c52d2..aba1cd9862ac 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1864,7 +1864,7 @@ static int do_change_param_reset(struct ibmvnic_adapter *adapter,
 
 	if (rc) {
 		netdev_err(adapter->netdev,
-			   "Couldn't initialize crq. rc=%d\n", rc);
+			   "%s: Couldn't initialize crq. rc=%d\n", __func__, rc);
 		return rc;
 	}
 
@@ -2089,7 +2089,7 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter,
 	rc = init_crq_queue(adapter);
 	if (rc) {
 		netdev_err(adapter->netdev,
-			   "Couldn't initialize crq. rc=%d\n", rc);
+			   "%s: Couldn't initialize crq. rc=%d\n", __func__, rc);
 		return rc;
 	}
 
@@ -2912,7 +2912,7 @@ static struct ibmvnic_sub_crq_queue *init_sub_crq_queue(struct ibmvnic_adapter
 		rc = ibmvnic_reset_crq(adapter);
 
 	if (rc == H_CLOSED) {
-		dev_warn(dev, "Partner adapter not ready, waiting.\n");
+		dev_warn(dev, "%s: Partner adapter not ready, waiting.\n", __func__);
 	} else if (rc) {
 		dev_warn(dev, "Error %d registering sub-crq\n", rc);
 		goto reg_failed;
@@ -4865,7 +4865,7 @@ static int ibmvnic_reset_crq(struct ibmvnic_adapter *adapter)
 
 	if (rc == H_CLOSED)
 		/* Adapter is good, but other end is not ready */
-		dev_warn(dev, "Partner adapter not ready\n");
+		dev_warn(dev, "%s: Partner adapter not ready\n", __func__);
 	else if (rc != 0)
 		dev_warn(dev, "Couldn't register crq (rc=%d)\n", rc);
 
@@ -4926,7 +4926,7 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter)
 	retrc = rc;
 
 	if (rc == H_CLOSED) {
-		dev_warn(dev, "Partner adapter not ready\n");
+		dev_warn(dev, "%s: Partner adapter not ready\n", __func__);
 	} else if (rc) {
 		dev_warn(dev, "Error %d opening adapter\n", rc);
 		goto reg_crq_failed;
@@ -5129,8 +5129,8 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
 	do {
 		rc = init_crq_queue(adapter);
 		if (rc) {
-			dev_err(&dev->dev, "Couldn't initialize crq. rc=%d\n",
-				rc);
+			dev_err(&dev->dev, "%s: Couldn't initialize crq. rc=%d\n",
+				__func__, rc);
 			goto ibmvnic_init_fail;
 		}
 
-- 
2.23.0


^ permalink raw reply related

* [PATCH net 3/5] ibmvnic: improve ibmvnic_init and ibmvnic_reset_init
From: Lijun Pan @ 2020-08-14  7:59 UTC (permalink / raw)
  To: netdev; +Cc: Lijun Pan, linuxppc-dev
In-Reply-To: <20200814075921.88745-1-ljp@linux.ibm.com>

When H_SEND_CRQ command returns with H_CLOSED, it means the
server's CRQ is not ready yet. Instead of resetting immediately,
we wait for the server to launch passive init.
ibmvnic_init() and ibmvnic_reset_init() should also return the
error code from ibmvnic_send_crq_init() call.

Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 50e86e65961e..e366fd42a8c4 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -3568,8 +3568,7 @@ static int ibmvnic_send_crq(struct ibmvnic_adapter *adapter,
 	if (rc) {
 		if (rc == H_CLOSED) {
 			dev_warn(dev, "CRQ Queue closed\n");
-			if (test_bit(0, &adapter->resetting))
-				ibmvnic_reset(adapter, VNIC_RESET_FATAL);
+			/* do not reset, report the fail, wait for passive init from server */
 		}
 
 		dev_warn(dev, "Send error (rc=%d)\n", rc);
@@ -4985,7 +4984,12 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter)
 
 	reinit_completion(&adapter->init_done);
 	adapter->init_done_rc = 0;
-	ibmvnic_send_crq_init(adapter);
+	rc = ibmvnic_send_crq_init(adapter);
+	if (rc) {
+		dev_err(dev, "%s: Send crq init failed with error %d\n", __func__, rc);
+		return rc;
+	}
+
 	if (!wait_for_completion_timeout(&adapter->init_done, timeout)) {
 		dev_err(dev, "Initialization sequence timed out\n");
 		return -1;
@@ -5039,7 +5043,12 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)
 	adapter->from_passive_init = false;
 
 	adapter->init_done_rc = 0;
-	ibmvnic_send_crq_init(adapter);
+	rc = ibmvnic_send_crq_init(adapter);
+	if (rc) {
+		dev_err(dev, "%s: Send crq init failed with error %d\n", __func__, rc);
+		return rc;
+	}
+
 	if (!wait_for_completion_timeout(&adapter->init_done, timeout)) {
 		dev_err(dev, "Initialization sequence timed out\n");
 		return -1;
-- 
2.23.0


^ permalink raw reply related

* [PATCH net 2/5] ibmvnic: compare adapter->init_done_rc with more readable ibmvnic_rc_codes
From: Lijun Pan @ 2020-08-14  7:59 UTC (permalink / raw)
  To: netdev; +Cc: Lijun Pan, linuxppc-dev
In-Reply-To: <20200814075921.88745-1-ljp@linux.ibm.com>

Instead of comparing (adapter->init_done_rc == 1), let it
be (adapter->init_done_rc == PARTIALSUCCESS).

Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index aba1cd9862ac..50e86e65961e 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -974,7 +974,7 @@ static int set_link_state(struct ibmvnic_adapter *adapter, u8 link_state)
 			return -1;
 		}
 
-		if (adapter->init_done_rc == 1) {
+		if (adapter->init_done_rc == PARTIALSUCCESS) {
 			/* Partuial success, delay and re-send */
 			mdelay(1000);
 			resend = true;
-- 
2.23.0


^ permalink raw reply related

* [PATCH net 4/5] ibmvnic: remove never executed if statement
From: Lijun Pan @ 2020-08-14  7:59 UTC (permalink / raw)
  To: netdev; +Cc: Lijun Pan, linuxppc-dev
In-Reply-To: <20200814075921.88745-1-ljp@linux.ibm.com>

At the beginning of the function, from_passive_init is set false by
"adapter->from_passive_init = false;",
hence the if statement will never run.

Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index e366fd42a8c4..280358dce8ba 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -5000,12 +5000,6 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter)
 		return adapter->init_done_rc;
 	}
 
-	if (adapter->from_passive_init) {
-		adapter->state = VNIC_OPEN;
-		adapter->from_passive_init = false;
-		return -1;
-	}
-
 	if (test_bit(0, &adapter->resetting) && !adapter->wait_for_reset &&
 	    adapter->reset_reason != VNIC_RESET_MOBILITY) {
 		if (adapter->req_rx_queues != old_num_rx_queues ||
@@ -5059,12 +5053,6 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)
 		return adapter->init_done_rc;
 	}
 
-	if (adapter->from_passive_init) {
-		adapter->state = VNIC_OPEN;
-		adapter->from_passive_init = false;
-		return -1;
-	}
-
 	rc = init_sub_crqs(adapter);
 	if (rc) {
 		dev_err(dev, "Initialization of sub crqs failed\n");
-- 
2.23.0


^ permalink raw reply related

* [PATCH net 0/5] refactoring of ibmvnic code
From: Lijun Pan @ 2020-08-14  7:59 UTC (permalink / raw)
  To: netdev; +Cc: Lijun Pan, linuxppc-dev

This patch series refactor reset_init and init functions,
improve the debugging messages, and make some other cosmetic changes
to make the code easier to read and debug.

Lijun Pan (5):
  ibmvnic: print caller in several error messages
  ibmvnic: compare adapter->init_done_rc with more readable
    ibmvnic_rc_codes
  ibmvnic: improve ibmvnic_init and ibmvnic_reset_init
  ibmvnic: remove never executed if statement
  ibmvnic: merge ibmvnic_reset_init and ibmvnic_init

 drivers/net/ethernet/ibm/ibmvnic.c | 98 +++++++++---------------------
 1 file changed, 28 insertions(+), 70 deletions(-)

-- 
2.23.0


^ permalink raw reply

* [PATCH net 5/5] ibmvnic: merge ibmvnic_reset_init and ibmvnic_init
From: Lijun Pan @ 2020-08-14  7:59 UTC (permalink / raw)
  To: netdev; +Cc: Lijun Pan, linuxppc-dev
In-Reply-To: <20200814075921.88745-1-ljp@linux.ibm.com>

These two functions share the majority of the code, hence merge
them together. In the meanwhile, add a reset pass-in parameter
to differentiate them. Thus, the code is easier to read and to tell
the difference between reset_init and regular init.

Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 65 ++++++------------------------
 1 file changed, 13 insertions(+), 52 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 280358dce8ba..c92615b74833 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -104,8 +104,7 @@ static int send_login(struct ibmvnic_adapter *adapter);
 static void send_cap_queries(struct ibmvnic_adapter *adapter);
 static int init_sub_crqs(struct ibmvnic_adapter *);
 static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter);
-static int ibmvnic_init(struct ibmvnic_adapter *);
-static int ibmvnic_reset_init(struct ibmvnic_adapter *);
+static int ibmvnic_reset_init(struct ibmvnic_adapter *, bool reset);
 static void release_crq_queue(struct ibmvnic_adapter *);
 static int __ibmvnic_set_mac(struct net_device *, u8 *);
 static int init_crq_queue(struct ibmvnic_adapter *adapter);
@@ -1868,7 +1867,7 @@ static int do_change_param_reset(struct ibmvnic_adapter *adapter,
 		return rc;
 	}
 
-	rc = ibmvnic_reset_init(adapter);
+	rc = ibmvnic_reset_init(adapter, true);
 	if (rc)
 		return IBMVNIC_INIT_FAILED;
 
@@ -1986,7 +1985,7 @@ static int do_reset(struct ibmvnic_adapter *adapter,
 			goto out;
 		}
 
-		rc = ibmvnic_reset_init(adapter);
+		rc = ibmvnic_reset_init(adapter, true);
 		if (rc) {
 			rc = IBMVNIC_INIT_FAILED;
 			goto out;
@@ -2093,7 +2092,7 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter,
 		return rc;
 	}
 
-	rc = ibmvnic_init(adapter);
+	rc = ibmvnic_reset_init(adapter, false);
 	if (rc)
 		return rc;
 
@@ -4970,7 +4969,7 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter)
 	return retrc;
 }
 
-static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter)
+static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter, bool reset)
 {
 	struct device *dev = &adapter->vdev->dev;
 	unsigned long timeout = msecs_to_jiffies(30000);
@@ -4979,10 +4978,12 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter)
 
 	adapter->from_passive_init = false;
 
-	old_num_rx_queues = adapter->req_rx_queues;
-	old_num_tx_queues = adapter->req_tx_queues;
+	if (reset) {
+		old_num_rx_queues = adapter->req_rx_queues;
+		old_num_tx_queues = adapter->req_tx_queues;
+		reinit_completion(&adapter->init_done);
+	}
 
-	reinit_completion(&adapter->init_done);
 	adapter->init_done_rc = 0;
 	rc = ibmvnic_send_crq_init(adapter);
 	if (rc) {
@@ -5000,7 +5001,8 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter)
 		return adapter->init_done_rc;
 	}
 
-	if (test_bit(0, &adapter->resetting) && !adapter->wait_for_reset &&
+	if (reset &&
+	    test_bit(0, &adapter->resetting) && !adapter->wait_for_reset &&
 	    adapter->reset_reason != VNIC_RESET_MOBILITY) {
 		if (adapter->req_rx_queues != old_num_rx_queues ||
 		    adapter->req_tx_queues != old_num_tx_queues) {
@@ -5028,47 +5030,6 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter)
 	return rc;
 }
 
-static int ibmvnic_init(struct ibmvnic_adapter *adapter)
-{
-	struct device *dev = &adapter->vdev->dev;
-	unsigned long timeout = msecs_to_jiffies(30000);
-	int rc;
-
-	adapter->from_passive_init = false;
-
-	adapter->init_done_rc = 0;
-	rc = ibmvnic_send_crq_init(adapter);
-	if (rc) {
-		dev_err(dev, "%s: Send crq init failed with error %d\n", __func__, rc);
-		return rc;
-	}
-
-	if (!wait_for_completion_timeout(&adapter->init_done, timeout)) {
-		dev_err(dev, "Initialization sequence timed out\n");
-		return -1;
-	}
-
-	if (adapter->init_done_rc) {
-		release_crq_queue(adapter);
-		return adapter->init_done_rc;
-	}
-
-	rc = init_sub_crqs(adapter);
-	if (rc) {
-		dev_err(dev, "Initialization of sub crqs failed\n");
-		release_crq_queue(adapter);
-		return rc;
-	}
-
-	rc = init_sub_crq_irqs(adapter);
-	if (rc) {
-		dev_err(dev, "Failed to initialize sub crq irqs\n");
-		release_crq_queue(adapter);
-	}
-
-	return rc;
-}
-
 static struct device_attribute dev_attr_failover;
 
 static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
@@ -5131,7 +5092,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
 			goto ibmvnic_init_fail;
 		}
 
-		rc = ibmvnic_init(adapter);
+		rc = ibmvnic_reset_init(adapter, false);
 		if (rc && rc != EAGAIN)
 			goto ibmvnic_init_fail;
 	} while (rc == EAGAIN);
-- 
2.23.0


^ permalink raw reply related

* Re: [PATCH 16/16] debug_vm_pgtable/ppc64: Add a variant of pfn_pte/pmd
From: Anshuman Khandual @ 2020-08-14  8:29 UTC (permalink / raw)
  To: Aneesh Kumar K.V, linux-mm, akpm; +Cc: linuxppc-dev
In-Reply-To: <b42822c9-f8b6-55cf-7bc6-6def2faeb378@linux.ibm.com>



On 08/13/2020 12:07 PM, Aneesh Kumar K.V wrote:
> On 8/13/20 11:00 AM, Anshuman Khandual wrote:
>>
>> On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote:
>>> The tests do expect _PAGE_PTE bit set by different page table accessors.
>>> This is not true for the kernel. Within the kernel, _PAGE_PTE bits are
>>> usually set by set_pte_at(). To make the below tests work correctly add test
>>> specific pfn_pte/pmd helpers that set _PAGE_PTE bit.
>>>
>>> pte_t pte = pfn_pte(pfn, prot);
>>> WARN_ON(!pte_devmap(pte_mkdevmap(pte)));
>>> WARN_ON(!pte_savedwrite(pte_mk_savedwrite(pte_clear_savedwrite(pte))));
>>>
>>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>>> ---
>>>   mm/debug_vm_pgtable.c | 65 +++++++++++++++++++++++++++----------------
>>>   1 file changed, 41 insertions(+), 24 deletions(-)
>>>
>>> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
>>> index eea62d5e503b..153c925b5273 100644
>>> --- a/mm/debug_vm_pgtable.c
>>> +++ b/mm/debug_vm_pgtable.c
>>> @@ -31,6 +31,23 @@
>>>   #include <asm/pgalloc.h>
>>>   #include <asm/tlbflush.h>
>>>   +#ifdef CONFIG_PPC_BOOK3S_64
>>> +static inline pte_t debug_vm_pfn_pte(unsigned long pfn, pgprot_t pgprot)
>>> +{
>>> +    pte_t pte = pfn_pte(pfn, pgprot);
>>> +    return __pte(pte_val(pte) | _PAGE_PTE);
>>> +
>>> +}
>>> +static inline pmd_t debug_vm_pfn_pmd(unsigned long pfn, pgprot_t pgprot)
>>> +{
>>> +    pmd_t pmd = pfn_pmd(pfn, pgprot);
>>> +    return __pmd(pmd_val(pmd) | _PAGE_PTE);
>>> +}
>>> +#else
>>> +#define debug_vm_pfn_pte(pfn, pgprot) pfn_pte(pfn, pgprot)
>>> +#define debug_vm_pfn_pmd(pfn, pgprot) pfn_pmd(pfn, pgprot)
>>> +#endif
>>
>> Again, no platform specific constructs please. This defeats the whole purpose of
>> this test. If __PAGE_PTE is required for the helpers, then pfn_pmd/pte() could
>> be modified to accommodate that. We dont see similar issues on other platforms,
>> hence could you please explain why ppc64 is different here.
>>
> 
> It is not platform specific. set_pte_at is the one that set the _PAGE_PTE bit. We don't call that in the test.  The test seems to make the assumption that pfn_pte returns a proper pte which is not true.

'#ifdef CONFIG_PPC_BOOK3S_64' definitely makes it platform specific. Here is how
set_pte_at() updates an entry on other platforms without changing the pte value.
_PAGE_PTE bit update during set_pte_at() on ppc64 seems to be a deviation.

1. set_pte_at() on arm64 directly update the entry after TLB, cache maintenance
2. set_pte_at() on s390 directly updates the entry for !CONFIG_PGSTE
3. set_pte_at() on arc directly updates the entry via set_pte()
4. set_pte_at() on x86 directly update the entry via native_set_pte()

set_pte_at() does take a pte created with pfn_pte().

As an example do_anonymous_page() does the same.

......
entry = mk_pte(page, vma->vm_page_prot);	/* Call pfn_pte() */
entry = pte_sw_mkyoung(entry);
if (vma->vm_flags & VM_WRITE)
	entry = pte_mkwrite(pte_mkdirty(entry));
.....
set_pte_at(vma->vm_mm, vmf->address, vmf->pte, entry);
.....

^ permalink raw reply

* Re: [PATCH 14/16] debug_vm_pgtable/hugetlb: Disable hugetlb test on ppc64
From: Anshuman Khandual @ 2020-08-14  8:43 UTC (permalink / raw)
  To: Aneesh Kumar K.V, linux-mm, akpm; +Cc: linuxppc-dev
In-Reply-To: <535169b9-f4f0-57ce-0c2b-30afc237d4bd@linux.ibm.com>



On 08/12/2020 07:22 PM, Aneesh Kumar K.V wrote:
> On 8/12/20 7:04 PM, Anshuman Khandual wrote:
>>
>>
>> On 08/12/2020 06:46 PM, Aneesh Kumar K.V wrote:
>>> On 8/12/20 6:33 PM, Anshuman Khandual wrote:
>>>>
>>>>
>>>> On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote:
>>>>> The seems to be missing quite a lot of details w.r.t allocating
>>>>> the correct pgtable_t page (huge_pte_alloc()), holding the right
>>>>> lock (huge_pte_lock()) etc. The vma used is also not a hugetlb VMA.
>>>>>
>>>>> ppc64 do have runtime checks within CONFIG_DEBUG_VM for most of these.
>>>>> Hence disable the test on ppc64.
>>>>
>>>> This test is free from any platform specific #ifdefs which should
>>>> never be broken. If hugetlb_advanced_tests() does not work or is
>>>> not detailed enough for ppc64, then it would be great if you could
>>>> suggest some improvements so that it works for all enabled platforms.
>>>>
>>>>
>>>
>>> As mentioned the test is broken. For hugetlb, the pgtable_t pages should be allocated by huge_pte_alloc(). We need to hold huget_pte_lock() before  updating huge tlb pte. That takes hugepage size, which is mostly derived out of vma. Hence vma need to be a hugetlb vma. Some of the functions also depend on hstate. Also we should use set_huge_pte_at() when setting up hugetlb pte entries. I was tempted to remove that test completely marking it broken. But avoided that by marking it broken on only PPC64.
>>
>> The test is not broken, hugetlb helpers on multiple platforms dont complain about
>> this at all. The tests here emulate 'enough' MM objects required for the helpers
>> on enabled platforms, to perform the primary task i.e page table transformation it
>> is expected to do. The test does not claim to emulate a perfect MM environment for
>> a given subsystem's (like HugeTLB) arch helpers. Now in this case, the MM objects
>> being emulated for the HugeTLB advanced tests does not seem to be sufficient for
>> ppc64 but it can be improved. But that does not mean it is broken in it's current
>> form for other platforms.
>>
> 
> There is nothing ppc64 specific here. It is just that we have CONFIG_DEBUG_VM based checks for different possibly wrong usages of these functions. This was done because we have different page sizes, two different translations to support and we want to avoid any wrong usage. IMHO expecting hugetlb page table helpers to work with a non hugetlb VMA and  without holding hugeTLB pte lock is a clear violation of hugetlb interface.

Do you have a modified version of the test with HugeTLB marked VMA and with pte lock
held, which works on ppc664 ?

^ permalink raw reply

* Re: [PATCH v2] powerpc: Add POWER10 raw mode cputable entry
From: Christophe Leroy @ 2020-08-14  9:14 UTC (permalink / raw)
  To: Madhavan Srinivasan, mpe; +Cc: linuxppc-dev
In-Reply-To: <20200814074520.3667973-1-maddy@linux.ibm.com>



Le 14/08/2020 à 09:45, Madhavan Srinivasan a écrit :
> Add a raw mode cputable entry for POWER10. Copies most of the fields
> from commit a3ea40d5c736 ("powerpc: Add POWER10 architected mode")
> except for oprofile_cpu_type, machine_check_early, pvr_mask and pvr_mask
> fields. On bare metal systems we use DT CPU features, which doesn't need a
> cputable entry. But in VMs we still rely on the raw cputable entry to
> set the correct values for the PMU related fields.
> 
> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
> ---
> Changelog v1:
> - Fixed function undeclared compiler error.
> 
>   arch/powerpc/kernel/cputable.c | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
> index b4066354f0730..bb0c7f43a8283 100644
> --- a/arch/powerpc/kernel/cputable.c
> +++ b/arch/powerpc/kernel/cputable.c
> @@ -75,6 +75,7 @@ extern void __restore_cpu_power10(void);
>   extern long __machine_check_early_realmode_p7(struct pt_regs *regs);
>   extern long __machine_check_early_realmode_p8(struct pt_regs *regs);
>   extern long __machine_check_early_realmode_p9(struct pt_regs *regs);
> +extern long __machine_check_early_realmode_p10(struct pt_regs *regs);

'extern' keyword is useless and deprecated for function declaration. 
Please don't add new prototypes with that keyword.

Also, when you check arch/powerpc/kernel/mce_power.o with sparse, you 
get the following issues:

   CHECK   arch/powerpc/kernel/mce_power.c
arch/powerpc/kernel/mce_power.c:709:6: warning: symbol 
'__machine_check_early_realmode_p7' was not declared. Should it be static?
arch/powerpc/kernel/mce_power.c:717:6: warning: symbol 
'__machine_check_early_realmode_p8' was not declared. Should it be static?
arch/powerpc/kernel/mce_power.c:722:6: warning: symbol 
'__machine_check_early_realmode_p9' was not declared. Should it be static?
arch/powerpc/kernel/mce_power.c:740:6: warning: symbol 
'__machine_check_early_realmode_p10' was not declared. Should it be static?

This needs to be fixed by declaring the functions in a .h file that you 
include in both arch/powerpc/kernel/mce_power.c and 
arch/powerpc/kernel/cputable.c

Christophe

>   #endif /* CONFIG_PPC64 */
>   #if defined(CONFIG_E500)
>   extern void __setup_cpu_e5500(unsigned long offset, struct cpu_spec* spec);
> @@ -541,6 +542,25 @@ static struct cpu_spec __initdata cpu_specs[] = {
>   		.machine_check_early	= __machine_check_early_realmode_p9,
>   		.platform		= "power9",
>   	},
> +	{	/* Power10 */
> +		.pvr_mask		= 0xffff0000,
> +		.pvr_value		= 0x00800000,
> +		.cpu_name		= "POWER10 (raw)",
> +		.cpu_features		= CPU_FTRS_POWER10,
> +		.cpu_user_features	= COMMON_USER_POWER10,
> +		.cpu_user_features2	= COMMON_USER2_POWER10,
> +		.mmu_features		= MMU_FTRS_POWER10,
> +		.icache_bsize		= 128,
> +		.dcache_bsize		= 128,
> +		.num_pmcs		= 6,
> +		.pmc_type		= PPC_PMC_IBM,
> +		.oprofile_cpu_type	= "ppc64/power10",
> +		.oprofile_type		= PPC_OPROFILE_INVALID,
> +		.cpu_setup		= __setup_cpu_power10,
> +		.cpu_restore		= __restore_cpu_power10,
> +		.machine_check_early	= __machine_check_early_realmode_p10,
> +		.platform		= "power10",
> +	},
>   	{	/* Cell Broadband Engine */
>   		.pvr_mask		= 0xffff0000,
>   		.pvr_value		= 0x00700000,
> 

^ permalink raw reply

* Re: [PATCH 2/4] powerpc: Introduce asm-prototypes.h
From: Christophe Leroy @ 2020-08-14  9:34 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev
In-Reply-To: <1463534212-4879-2-git-send-email-dja@axtens.net>



Le 18/05/2016 à 03:16, Daniel Axtens a écrit :
> Sparse picked up a number of functions that are implemented in C and
> then only referred to in asm code.
> 
> This introduces asm-prototypes.h, which provides a place for
> prototypes of these functions.

It looks like this is a mis-use of asm-prototypes.h

On other architectures, asm-prototypes.h is there to allow MODVERSION to 
sent versions for exported assembly functions (I checked history of that 
file in x86 and arm64).

It looks like you have used it on the other way round, you have declared 
in it C functions used by ASM functions, whereas it is supposed to be 
dedicated to declaring exported ASM functions used by C functions.

Any plan to fix that ?

Christophe

> 
> This silences some sparse warnings.
> 
> Signed-off-by: Daniel Axtens <dja@axtens.net>
> ---
>   arch/powerpc/include/asm/asm-prototypes.h         | 79 +++++++++++++++++++++++
>   arch/powerpc/kernel/machine_kexec_64.c            |  1 +
>   arch/powerpc/kernel/smp.c                         |  1 +
>   arch/powerpc/kernel/traps.c                       |  1 +
>   arch/powerpc/lib/vmx-helper.c                     |  1 +
>   arch/powerpc/platforms/powernv/opal-tracepoints.c |  1 +
>   arch/powerpc/platforms/pseries/lpar.c             |  1 +
>   7 files changed, 85 insertions(+)
>   create mode 100644 arch/powerpc/include/asm/asm-prototypes.h
> 
> diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h
> new file mode 100644
> index 000000000000..6ee0a9d80bbc
> --- /dev/null
> +++ b/arch/powerpc/include/asm/asm-prototypes.h
> @@ -0,0 +1,79 @@
> +/*
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License, version 2, as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * Copyright IBM Corp. 2016
> + *
> + * Authors: Daniel Axtens <dja@axtens.net>
> + */
> +
> +/*
> + * This file is for prototypes of C functions that are only called
> + * from asm, and any associated variables.
> + */
> +
> +#include <linux/threads.h>
> +#include <linux/kprobes.h>
> +
> +/* SMP */
> +extern struct thread_info *current_set[NR_CPUS];
> +extern struct thread_info *secondary_ti;
> +void start_secondary(void *unused);
> +
> +/* kexec */
> +struct paca_struct;
> +struct kimage;
> +extern struct paca_struct kexec_paca;
> +void kexec_copy_flush(struct kimage *image);
> +
> +/* pSeries hcall tracing */
> +extern struct static_key hcall_tracepoint_key;
> +void __trace_hcall_entry(unsigned long opcode, unsigned long *args);
> +void __trace_hcall_exit(long opcode, unsigned long retval,
> +			unsigned long *retbuf);
> +/* OPAL tracing */
> +#ifdef HAVE_JUMP_LABEL
> +extern struct static_key opal_tracepoint_key;
> +#endif
> +
> +void __trace_opal_entry(unsigned long opcode, unsigned long *args);
> +void __trace_opal_exit(long opcode, unsigned long retval);
> +
> +/* VMX copying */
> +int enter_vmx_usercopy(void);
> +int exit_vmx_usercopy(void);
> +int enter_vmx_copy(void);
> +void * exit_vmx_copy(void *dest);
> +
> +/* Traps */
> +long machine_check_early(struct pt_regs *regs);
> +long hmi_exception_realmode(struct pt_regs *regs);
> +void SMIException(struct pt_regs *regs);
> +void handle_hmi_exception(struct pt_regs *regs);
> +void instruction_breakpoint_exception(struct pt_regs *regs);
> +void RunModeException(struct pt_regs *regs);
> +void __kprobes single_step_exception(struct pt_regs *regs);
> +void __kprobes program_check_exception(struct pt_regs *regs);
> +void alignment_exception(struct pt_regs *regs);
> +void StackOverflow(struct pt_regs *regs);
> +void nonrecoverable_exception(struct pt_regs *regs);
> +void kernel_fp_unavailable_exception(struct pt_regs *regs);
> +void altivec_unavailable_exception(struct pt_regs *regs);
> +void vsx_unavailable_exception(struct pt_regs *regs);
> +void fp_unavailable_tm(struct pt_regs *regs);
> +void altivec_unavailable_tm(struct pt_regs *regs);
> +void vsx_unavailable_tm(struct pt_regs *regs);
> +void facility_unavailable_exception(struct pt_regs *regs);
> +void TAUException(struct pt_regs *regs);
> +void altivec_assist_exception(struct pt_regs *regs);
> +void unrecoverable_exception(struct pt_regs *regs);
> +void kernel_bad_stack(struct pt_regs *regs);
> +void system_reset_exception(struct pt_regs *regs);
> +void machine_check_exception(struct pt_regs *regs);
> +void __kprobes emulation_assist_interrupt(struct pt_regs *regs);
> diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
> index b8c202d63ecb..50bf55135ef8 100644
> --- a/arch/powerpc/kernel/machine_kexec_64.c
> +++ b/arch/powerpc/kernel/machine_kexec_64.c
> @@ -29,6 +29,7 @@
>   #include <asm/prom.h>
>   #include <asm/smp.h>
>   #include <asm/hw_breakpoint.h>
> +#include <asm/asm-prototypes.h>
>   
>   #ifdef CONFIG_PPC_BOOK3E
>   int default_machine_kexec_prepare(struct kimage *image)
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index 55c924b65f71..f1adc3c4f4ca 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -53,6 +53,7 @@
>   #include <asm/vdso.h>
>   #include <asm/debug.h>
>   #include <asm/kexec.h>
> +#include <asm/asm-prototypes.h>
>   
>   #ifdef DEBUG
>   #include <asm/udbg.h>
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index 9229ba63c370..11d15e7270e0 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -60,6 +60,7 @@
>   #include <asm/switch_to.h>
>   #include <asm/tm.h>
>   #include <asm/debug.h>
> +#include <asm/asm-prototypes.h>
>   #include <sysdev/fsl_pci.h>
>   
>   #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
> diff --git a/arch/powerpc/lib/vmx-helper.c b/arch/powerpc/lib/vmx-helper.c
> index b27e030fc9f8..bf925cdcaca9 100644
> --- a/arch/powerpc/lib/vmx-helper.c
> +++ b/arch/powerpc/lib/vmx-helper.c
> @@ -21,6 +21,7 @@
>   #include <linux/uaccess.h>
>   #include <linux/hardirq.h>
>   #include <asm/switch_to.h>
> +#include <asm/asm-prototypes.h>
>   
>   int enter_vmx_usercopy(void)
>   {
> diff --git a/arch/powerpc/platforms/powernv/opal-tracepoints.c b/arch/powerpc/platforms/powernv/opal-tracepoints.c
> index e11273b2386d..1e496b780efd 100644
> --- a/arch/powerpc/platforms/powernv/opal-tracepoints.c
> +++ b/arch/powerpc/platforms/powernv/opal-tracepoints.c
> @@ -1,6 +1,7 @@
>   #include <linux/percpu.h>
>   #include <linux/jump_label.h>
>   #include <asm/trace.h>
> +#include <asm/asm-prototypes.h>
>   
>   #ifdef HAVE_JUMP_LABEL
>   struct static_key opal_tracepoint_key = STATIC_KEY_INIT;
> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
> index 7f6100d91b4b..03ff9867a610 100644
> --- a/arch/powerpc/platforms/pseries/lpar.c
> +++ b/arch/powerpc/platforms/pseries/lpar.c
> @@ -45,6 +45,7 @@
>   #include <asm/plpar_wrappers.h>
>   #include <asm/kexec.h>
>   #include <asm/fadump.h>
> +#include <asm/asm-prototypes.h>
>   
>   #include "pseries.h"
>   
> 

^ permalink raw reply

* Re: [PATCH 2/4] powerpc: Introduce asm-prototypes.h
From: Daniel Axtens @ 2020-08-14  9:53 UTC (permalink / raw)
  To: Christophe Leroy, linuxppc-dev
In-Reply-To: <b50b9bdd-b731-44ed-435b-e3e4b179a89a@csgroup.eu>

Christophe Leroy <christophe.leroy@csgroup.eu> writes:

> Le 18/05/2016 à 03:16, Daniel Axtens a écrit :
>> Sparse picked up a number of functions that are implemented in C and
>> then only referred to in asm code.
>> 
>> This introduces asm-prototypes.h, which provides a place for
>> prototypes of these functions.
>
> It looks like this is a mis-use of asm-prototypes.h
>
> On other architectures, asm-prototypes.h is there to allow MODVERSION to 
> sent versions for exported assembly functions (I checked history of that 
> file in x86 and arm64).

Hmm, I was young(er) and (more) inexperienced 4 years ago and wouldn't
have thought to check x86 and arm64.

> It looks like you have used it on the other way round, you have declared 
> in it C functions used by ASM functions, whereas it is supposed to be 
> dedicated to declaring exported ASM functions used by C functions.
>
> Any plan to fix that ?

What should we call it?

Kind regards,
Daniel
>
> Christophe
>
>> 
>> This silences some sparse warnings.
>> 
>> Signed-off-by: Daniel Axtens <dja@axtens.net>
>> ---
>>   arch/powerpc/include/asm/asm-prototypes.h         | 79 +++++++++++++++++++++++
>>   arch/powerpc/kernel/machine_kexec_64.c            |  1 +
>>   arch/powerpc/kernel/smp.c                         |  1 +
>>   arch/powerpc/kernel/traps.c                       |  1 +
>>   arch/powerpc/lib/vmx-helper.c                     |  1 +
>>   arch/powerpc/platforms/powernv/opal-tracepoints.c |  1 +
>>   arch/powerpc/platforms/pseries/lpar.c             |  1 +
>>   7 files changed, 85 insertions(+)
>>   create mode 100644 arch/powerpc/include/asm/asm-prototypes.h
>> 
>> diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h
>> new file mode 100644
>> index 000000000000..6ee0a9d80bbc
>> --- /dev/null
>> +++ b/arch/powerpc/include/asm/asm-prototypes.h
>> @@ -0,0 +1,79 @@
>> +/*
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License, version 2, as
>> + * published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + *
>> + * Copyright IBM Corp. 2016
>> + *
>> + * Authors: Daniel Axtens <dja@axtens.net>
>> + */
>> +
>> +/*
>> + * This file is for prototypes of C functions that are only called
>> + * from asm, and any associated variables.
>> + */
>> +
>> +#include <linux/threads.h>
>> +#include <linux/kprobes.h>
>> +
>> +/* SMP */
>> +extern struct thread_info *current_set[NR_CPUS];
>> +extern struct thread_info *secondary_ti;
>> +void start_secondary(void *unused);
>> +
>> +/* kexec */
>> +struct paca_struct;
>> +struct kimage;
>> +extern struct paca_struct kexec_paca;
>> +void kexec_copy_flush(struct kimage *image);
>> +
>> +/* pSeries hcall tracing */
>> +extern struct static_key hcall_tracepoint_key;
>> +void __trace_hcall_entry(unsigned long opcode, unsigned long *args);
>> +void __trace_hcall_exit(long opcode, unsigned long retval,
>> +			unsigned long *retbuf);
>> +/* OPAL tracing */
>> +#ifdef HAVE_JUMP_LABEL
>> +extern struct static_key opal_tracepoint_key;
>> +#endif
>> +
>> +void __trace_opal_entry(unsigned long opcode, unsigned long *args);
>> +void __trace_opal_exit(long opcode, unsigned long retval);
>> +
>> +/* VMX copying */
>> +int enter_vmx_usercopy(void);
>> +int exit_vmx_usercopy(void);
>> +int enter_vmx_copy(void);
>> +void * exit_vmx_copy(void *dest);
>> +
>> +/* Traps */
>> +long machine_check_early(struct pt_regs *regs);
>> +long hmi_exception_realmode(struct pt_regs *regs);
>> +void SMIException(struct pt_regs *regs);
>> +void handle_hmi_exception(struct pt_regs *regs);
>> +void instruction_breakpoint_exception(struct pt_regs *regs);
>> +void RunModeException(struct pt_regs *regs);
>> +void __kprobes single_step_exception(struct pt_regs *regs);
>> +void __kprobes program_check_exception(struct pt_regs *regs);
>> +void alignment_exception(struct pt_regs *regs);
>> +void StackOverflow(struct pt_regs *regs);
>> +void nonrecoverable_exception(struct pt_regs *regs);
>> +void kernel_fp_unavailable_exception(struct pt_regs *regs);
>> +void altivec_unavailable_exception(struct pt_regs *regs);
>> +void vsx_unavailable_exception(struct pt_regs *regs);
>> +void fp_unavailable_tm(struct pt_regs *regs);
>> +void altivec_unavailable_tm(struct pt_regs *regs);
>> +void vsx_unavailable_tm(struct pt_regs *regs);
>> +void facility_unavailable_exception(struct pt_regs *regs);
>> +void TAUException(struct pt_regs *regs);
>> +void altivec_assist_exception(struct pt_regs *regs);
>> +void unrecoverable_exception(struct pt_regs *regs);
>> +void kernel_bad_stack(struct pt_regs *regs);
>> +void system_reset_exception(struct pt_regs *regs);
>> +void machine_check_exception(struct pt_regs *regs);
>> +void __kprobes emulation_assist_interrupt(struct pt_regs *regs);
>> diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
>> index b8c202d63ecb..50bf55135ef8 100644
>> --- a/arch/powerpc/kernel/machine_kexec_64.c
>> +++ b/arch/powerpc/kernel/machine_kexec_64.c
>> @@ -29,6 +29,7 @@
>>   #include <asm/prom.h>
>>   #include <asm/smp.h>
>>   #include <asm/hw_breakpoint.h>
>> +#include <asm/asm-prototypes.h>
>>   
>>   #ifdef CONFIG_PPC_BOOK3E
>>   int default_machine_kexec_prepare(struct kimage *image)
>> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
>> index 55c924b65f71..f1adc3c4f4ca 100644
>> --- a/arch/powerpc/kernel/smp.c
>> +++ b/arch/powerpc/kernel/smp.c
>> @@ -53,6 +53,7 @@
>>   #include <asm/vdso.h>
>>   #include <asm/debug.h>
>>   #include <asm/kexec.h>
>> +#include <asm/asm-prototypes.h>
>>   
>>   #ifdef DEBUG
>>   #include <asm/udbg.h>
>> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
>> index 9229ba63c370..11d15e7270e0 100644
>> --- a/arch/powerpc/kernel/traps.c
>> +++ b/arch/powerpc/kernel/traps.c
>> @@ -60,6 +60,7 @@
>>   #include <asm/switch_to.h>
>>   #include <asm/tm.h>
>>   #include <asm/debug.h>
>> +#include <asm/asm-prototypes.h>
>>   #include <sysdev/fsl_pci.h>
>>   
>>   #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
>> diff --git a/arch/powerpc/lib/vmx-helper.c b/arch/powerpc/lib/vmx-helper.c
>> index b27e030fc9f8..bf925cdcaca9 100644
>> --- a/arch/powerpc/lib/vmx-helper.c
>> +++ b/arch/powerpc/lib/vmx-helper.c
>> @@ -21,6 +21,7 @@
>>   #include <linux/uaccess.h>
>>   #include <linux/hardirq.h>
>>   #include <asm/switch_to.h>
>> +#include <asm/asm-prototypes.h>
>>   
>>   int enter_vmx_usercopy(void)
>>   {
>> diff --git a/arch/powerpc/platforms/powernv/opal-tracepoints.c b/arch/powerpc/platforms/powernv/opal-tracepoints.c
>> index e11273b2386d..1e496b780efd 100644
>> --- a/arch/powerpc/platforms/powernv/opal-tracepoints.c
>> +++ b/arch/powerpc/platforms/powernv/opal-tracepoints.c
>> @@ -1,6 +1,7 @@
>>   #include <linux/percpu.h>
>>   #include <linux/jump_label.h>
>>   #include <asm/trace.h>
>> +#include <asm/asm-prototypes.h>
>>   
>>   #ifdef HAVE_JUMP_LABEL
>>   struct static_key opal_tracepoint_key = STATIC_KEY_INIT;
>> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
>> index 7f6100d91b4b..03ff9867a610 100644
>> --- a/arch/powerpc/platforms/pseries/lpar.c
>> +++ b/arch/powerpc/platforms/pseries/lpar.c
>> @@ -45,6 +45,7 @@
>>   #include <asm/plpar_wrappers.h>
>>   #include <asm/kexec.h>
>>   #include <asm/fadump.h>
>> +#include <asm/asm-prototypes.h>
>>   
>>   #include "pseries.h"
>>   
>> 

^ permalink raw reply

* Re: [PATCH 2/4] powerpc: Introduce asm-prototypes.h
From: Christophe Leroy @ 2020-08-14 10:41 UTC (permalink / raw)
  To: Daniel Axtens, linuxppc-dev
In-Reply-To: <87sgcpmu4j.fsf@dja-thinkpad.axtens.net>



On 08/14/2020 09:53 AM, Daniel Axtens wrote:
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> 
>> Le 18/05/2016 à 03:16, Daniel Axtens a écrit :
>>> Sparse picked up a number of functions that are implemented in C and
>>> then only referred to in asm code.
>>>
>>> This introduces asm-prototypes.h, which provides a place for
>>> prototypes of these functions.
>>
>> It looks like this is a mis-use of asm-prototypes.h
>>
>> On other architectures, asm-prototypes.h is there to allow MODVERSION to
>> sent versions for exported assembly functions (I checked history of that
>> file in x86 and arm64).
> 
> Hmm, I was young(er) and (more) inexperienced 4 years ago and wouldn't
> have thought to check x86 and arm64.
> 
>> It looks like you have used it on the other way round, you have declared
>> in it C functions used by ASM functions, whereas it is supposed to be
>> dedicated to declaring exported ASM functions used by C functions.
>>
>> Any plan to fix that ?
> 
> What should we call it?

I don't know but that's for sure more complex than just a rename.

Because after you created the file, people have started using it for 
what it is, see for instance following commits:
- 9e5f68842276 ("powerpc: Fix missing CRCs, add more asm-prototypes.h 
declarations") or commit
- 99ad503287da ("powerpc: Add a prototype for mcount() so it can be 
versioned")
- 43a8888f0a70 ("powerpc: Fix missing CRCs, add more asm-prototypes.h 
declarations")

But for instance, for function kexec_copy_flush(), I'd have included it 
is asm/kexec.c
For function __trace_opal_entry() and __trace_opal_exit(), I would have 
added them in asm/opal.h
Etc ...

Christophe


> 
> Kind regards,
> Daniel
>>
>> Christophe
>>
>>>
>>> This silences some sparse warnings.
>>>
>>> Signed-off-by: Daniel Axtens <dja@axtens.net>
>>> ---
>>>    arch/powerpc/include/asm/asm-prototypes.h         | 79 +++++++++++++++++++++++
>>>    arch/powerpc/kernel/machine_kexec_64.c            |  1 +
>>>    arch/powerpc/kernel/smp.c                         |  1 +
>>>    arch/powerpc/kernel/traps.c                       |  1 +
>>>    arch/powerpc/lib/vmx-helper.c                     |  1 +
>>>    arch/powerpc/platforms/powernv/opal-tracepoints.c |  1 +
>>>    arch/powerpc/platforms/pseries/lpar.c             |  1 +
>>>    7 files changed, 85 insertions(+)
>>>    create mode 100644 arch/powerpc/include/asm/asm-prototypes.h
>>>
>>> diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h
>>> new file mode 100644
>>> index 000000000000..6ee0a9d80bbc
>>> --- /dev/null
>>> +++ b/arch/powerpc/include/asm/asm-prototypes.h
>>> @@ -0,0 +1,79 @@
>>> +/*
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU General Public License, version 2, as
>>> + * published by the Free Software Foundation.
>>> + *
>>> + * This program is distributed in the hope that it will be useful,
>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>> + * GNU General Public License for more details.
>>> + *
>>> + * Copyright IBM Corp. 2016
>>> + *
>>> + * Authors: Daniel Axtens <dja@axtens.net>
>>> + */
>>> +
>>> +/*
>>> + * This file is for prototypes of C functions that are only called
>>> + * from asm, and any associated variables.
>>> + */
>>> +
>>> +#include <linux/threads.h>
>>> +#include <linux/kprobes.h>
>>> +
>>> +/* SMP */
>>> +extern struct thread_info *current_set[NR_CPUS];
>>> +extern struct thread_info *secondary_ti;
>>> +void start_secondary(void *unused);
>>> +
>>> +/* kexec */
>>> +struct paca_struct;
>>> +struct kimage;
>>> +extern struct paca_struct kexec_paca;
>>> +void kexec_copy_flush(struct kimage *image);
>>> +
>>> +/* pSeries hcall tracing */
>>> +extern struct static_key hcall_tracepoint_key;
>>> +void __trace_hcall_entry(unsigned long opcode, unsigned long *args);
>>> +void __trace_hcall_exit(long opcode, unsigned long retval,
>>> +			unsigned long *retbuf);
>>> +/* OPAL tracing */
>>> +#ifdef HAVE_JUMP_LABEL
>>> +extern struct static_key opal_tracepoint_key;
>>> +#endif
>>> +
>>> +void __trace_opal_entry(unsigned long opcode, unsigned long *args);
>>> +void __trace_opal_exit(long opcode, unsigned long retval);
>>> +
>>> +/* VMX copying */
>>> +int enter_vmx_usercopy(void);
>>> +int exit_vmx_usercopy(void);
>>> +int enter_vmx_copy(void);
>>> +void * exit_vmx_copy(void *dest);
>>> +
>>> +/* Traps */
>>> +long machine_check_early(struct pt_regs *regs);
>>> +long hmi_exception_realmode(struct pt_regs *regs);
>>> +void SMIException(struct pt_regs *regs);
>>> +void handle_hmi_exception(struct pt_regs *regs);
>>> +void instruction_breakpoint_exception(struct pt_regs *regs);
>>> +void RunModeException(struct pt_regs *regs);
>>> +void __kprobes single_step_exception(struct pt_regs *regs);
>>> +void __kprobes program_check_exception(struct pt_regs *regs);
>>> +void alignment_exception(struct pt_regs *regs);
>>> +void StackOverflow(struct pt_regs *regs);
>>> +void nonrecoverable_exception(struct pt_regs *regs);
>>> +void kernel_fp_unavailable_exception(struct pt_regs *regs);
>>> +void altivec_unavailable_exception(struct pt_regs *regs);
>>> +void vsx_unavailable_exception(struct pt_regs *regs);
>>> +void fp_unavailable_tm(struct pt_regs *regs);
>>> +void altivec_unavailable_tm(struct pt_regs *regs);
>>> +void vsx_unavailable_tm(struct pt_regs *regs);
>>> +void facility_unavailable_exception(struct pt_regs *regs);
>>> +void TAUException(struct pt_regs *regs);
>>> +void altivec_assist_exception(struct pt_regs *regs);
>>> +void unrecoverable_exception(struct pt_regs *regs);
>>> +void kernel_bad_stack(struct pt_regs *regs);
>>> +void system_reset_exception(struct pt_regs *regs);
>>> +void machine_check_exception(struct pt_regs *regs);
>>> +void __kprobes emulation_assist_interrupt(struct pt_regs *regs);
>>> diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
>>> index b8c202d63ecb..50bf55135ef8 100644
>>> --- a/arch/powerpc/kernel/machine_kexec_64.c
>>> +++ b/arch/powerpc/kernel/machine_kexec_64.c
>>> @@ -29,6 +29,7 @@
>>>    #include <asm/prom.h>
>>>    #include <asm/smp.h>
>>>    #include <asm/hw_breakpoint.h>
>>> +#include <asm/asm-prototypes.h>
>>>    
>>>    #ifdef CONFIG_PPC_BOOK3E
>>>    int default_machine_kexec_prepare(struct kimage *image)
>>> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
>>> index 55c924b65f71..f1adc3c4f4ca 100644
>>> --- a/arch/powerpc/kernel/smp.c
>>> +++ b/arch/powerpc/kernel/smp.c
>>> @@ -53,6 +53,7 @@
>>>    #include <asm/vdso.h>
>>>    #include <asm/debug.h>
>>>    #include <asm/kexec.h>
>>> +#include <asm/asm-prototypes.h>
>>>    
>>>    #ifdef DEBUG
>>>    #include <asm/udbg.h>
>>> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
>>> index 9229ba63c370..11d15e7270e0 100644
>>> --- a/arch/powerpc/kernel/traps.c
>>> +++ b/arch/powerpc/kernel/traps.c
>>> @@ -60,6 +60,7 @@
>>>    #include <asm/switch_to.h>
>>>    #include <asm/tm.h>
>>>    #include <asm/debug.h>
>>> +#include <asm/asm-prototypes.h>
>>>    #include <sysdev/fsl_pci.h>
>>>    
>>>    #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
>>> diff --git a/arch/powerpc/lib/vmx-helper.c b/arch/powerpc/lib/vmx-helper.c
>>> index b27e030fc9f8..bf925cdcaca9 100644
>>> --- a/arch/powerpc/lib/vmx-helper.c
>>> +++ b/arch/powerpc/lib/vmx-helper.c
>>> @@ -21,6 +21,7 @@
>>>    #include <linux/uaccess.h>
>>>    #include <linux/hardirq.h>
>>>    #include <asm/switch_to.h>
>>> +#include <asm/asm-prototypes.h>
>>>    
>>>    int enter_vmx_usercopy(void)
>>>    {
>>> diff --git a/arch/powerpc/platforms/powernv/opal-tracepoints.c b/arch/powerpc/platforms/powernv/opal-tracepoints.c
>>> index e11273b2386d..1e496b780efd 100644
>>> --- a/arch/powerpc/platforms/powernv/opal-tracepoints.c
>>> +++ b/arch/powerpc/platforms/powernv/opal-tracepoints.c
>>> @@ -1,6 +1,7 @@
>>>    #include <linux/percpu.h>
>>>    #include <linux/jump_label.h>
>>>    #include <asm/trace.h>
>>> +#include <asm/asm-prototypes.h>
>>>    
>>>    #ifdef HAVE_JUMP_LABEL
>>>    struct static_key opal_tracepoint_key = STATIC_KEY_INIT;
>>> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
>>> index 7f6100d91b4b..03ff9867a610 100644
>>> --- a/arch/powerpc/platforms/pseries/lpar.c
>>> +++ b/arch/powerpc/platforms/pseries/lpar.c
>>> @@ -45,6 +45,7 @@
>>>    #include <asm/plpar_wrappers.h>
>>>    #include <asm/kexec.h>
>>>    #include <asm/fadump.h>
>>> +#include <asm/asm-prototypes.h>
>>>    
>>>    #include "pseries.h"
>>>    
>>>

^ permalink raw reply

* [GIT PULL] Please pull powerpc/linux.git powerpc-5.9-2 tag
From: Michael Ellerman @ 2020-08-14 12:56 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: aneesh.kumar, linuxppc-dev, linux-kernel, Christian Zigotzky

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Linus,

Please pull a powerpc fix for 5.9:

The following changes since commit 7b9de97711225559af213dc52b6ea883ef1ea7a8:

  powerpc/ptrace: Fix build error in pkey_get() (2020-08-07 18:27:26 -0700)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.9-2

for you to fetch changes up to 6553fb799f601497ca0703682e2aff131197dc5c:

  powerpc/pkeys: Fix boot failures with Nemo board (A-EON AmigaOne X1000) (2020-08-10 23:07:21 +1000)

- ------------------------------------------------------------------
powerpc fixes for 5.9 #2

One fix for a boot crash on some platforms introduced by the recent pkey
refactoring.

Thanks to:
  Christian Zigotzky, Aneesh Kumar K.V.

- ------------------------------------------------------------------
Aneesh Kumar K.V (1):
      powerpc/pkeys: Fix boot failures with Nemo board (A-EON AmigaOne X1000)


 arch/powerpc/mm/book3s64/hash_utils.c |  5 ++---
 arch/powerpc/mm/book3s64/pkeys.c      | 12 ++++++------
 2 files changed, 8 insertions(+), 9 deletions(-)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAl82iYIACgkQUevqPMjh
pYAlBQ/7BXZI6UMWb9QS4QDu3CaBEEmVtnOnHmN1OsLnyjWArf+MLkipuoEiNeBc
bZIr7Zah2tE4/ZpOEaELu4Vgr+AAk2HGzRw19eYHMewgjfdO1n1jmORrGnfECkKL
0ygQv/g7rKTpSDoK3qNT0n0BRMCzmdlzsdhE9Oj4gMSTy+ThJnakS7Js79aqHaFz
obZbytwDDE2jSoKl4T+AlokDDiXpUm9OXIxSuyzGSrljm/vwQxGI7TH7IjZUwE9v
rPtxPJyvEkmXa4cVrTrY7AxP3yMvoJTd4EMISxtrqKSghSpVjAmm0Ie2fa6+8yCB
aI7nRp4fIoTKr8o7rjBwraNNQejq8aFE/EHBKPamgZ7F+yNqenNJREjPTJpC2RKF
N33aX6hqK2vuL2KRN5KPAaSDys1TsMot0Xlghvu/hzopVGGnNkP03jBLT6uFk1aD
tEW3ZModf/SJoXb88Y5+oWvgSbzheWv+DlnfLKZ5Uvuf/dOlUWOmcElC/rD99SMz
IFEW3XarOcMBcpFLF1+ZTCRzgkmYyLyJh3mK/4ykxm8XP9bi8Yv3VqPEEUk4tPWj
BUoviQHDgJ8TUgkAqmecJQDi0iYmQwUe3CfQb8FB5k7itQawWuK+exdqZhJpbPLO
mdM8+/RyjPfYSRvrtBRcWOAkxGrzC/eT7eLAEwQFIYhLDJL2rYI=
=Rgq5
-----END PGP SIGNATURE-----

^ permalink raw reply

* Re: [PATCH 2/4] powerpc: Introduce asm-prototypes.h
From: Michael Ellerman @ 2020-08-14 13:04 UTC (permalink / raw)
  To: Christophe Leroy, Daniel Axtens, linuxppc-dev
In-Reply-To: <b50b9bdd-b731-44ed-435b-e3e4b179a89a@csgroup.eu>

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 18/05/2016 à 03:16, Daniel Axtens a écrit :
>> Sparse picked up a number of functions that are implemented in C and
>> then only referred to in asm code.
>> 
>> This introduces asm-prototypes.h, which provides a place for
>> prototypes of these functions.
>
> It looks like this is a mis-use of asm-prototypes.h
>
> On other architectures, asm-prototypes.h is there to allow MODVERSION to 
> sent versions for exported assembly functions (I checked history of that 
> file in x86 and arm64).

Look closer :)

42f5b4cacd78 ("powerpc: Introduce asm-prototypes.h") (Jun 2016)
334bb7738764 ("x86/kbuild: enable modversions for symbols exported from asm") (Dec 2016)
c3296a1391cb ("arm64: add <asm/asm-prototypes.h>") (Dec 2018)

> It looks like you have used it on the other way round, you have declared 
> in it C functions used by ASM functions, whereas it is supposed to be 
> dedicated to declaring exported ASM functions used by C functions.

But yes, it's since been co-opted for the modversions stuff.

I guess the contents should be split out into appropriate headers
depending on what the prototypes are for.

chers

^ 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