LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 5/6] audit: Declare ppc32_classify_syscall()
From: Christophe Leroy @ 2021-08-19 18:36 UTC (permalink / raw)
  To: Cédric Le Goater, linuxppc-dev; +Cc: Christophe Leroy
In-Reply-To: <d268f141-4ec3-eb1d-a6c1-4cd5f535ea49@csgroup.eu>



Le 19/08/2021 à 16:56, Christophe Leroy a écrit :
> 
> 
> Le 19/08/2021 à 14:56, Cédric Le Goater a écrit :
>> This fixes a compile error with W=1.
>>
>> Cc: Christophe Leroy <christophe.leroy@c-s.fr>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>
>>   I don't think this is correct. Which file could we use ?
> 
> I think you can completely remove ppc32_classify_syscall(), and instead add the following in the 
> default case in audit_classify_syscall():
> 
>       default:
> +        if (IS_ENABLED(CONFIG_PPC64) && abi == AUDIT_ARCH_PPC)
> +            return 1;
>           return 0;
> 

After looking more in details, in fact I think we should convert powerpc to 
CONFIG_AUDIT_ARCH_COMPAT_GENERIC

> 
>>
>>   arch/powerpc/include/asm/unistd.h | 3 +++
>>   arch/powerpc/kernel/audit.c       | 1 -
>>   2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
>> index b541c690a31c..d9025a7e973c 100644
>> --- a/arch/powerpc/include/asm/unistd.h
>> +++ b/arch/powerpc/include/asm/unistd.h
>> @@ -47,6 +47,9 @@
>>   #define __ARCH_WANT_SYS_UTIME
>>   #define __ARCH_WANT_SYS_NEWFSTATAT
>>   #define __ARCH_WANT_COMPAT_SYS_SENDFILE
>> +#ifdef CONFIG_AUDIT
>> +extern int ppc32_classify_syscall(unsigned int syscall);
>> +#endif
>>   #endif
>>   #define __ARCH_WANT_SYS_FORK
>>   #define __ARCH_WANT_SYS_VFORK
>> diff --git a/arch/powerpc/kernel/audit.c b/arch/powerpc/kernel/audit.c
>> index a2dddd7f3d09..c3c6c6a1069b 100644
>> --- a/arch/powerpc/kernel/audit.c
>> +++ b/arch/powerpc/kernel/audit.c
>> @@ -41,7 +41,6 @@ int audit_classify_arch(int arch)
>>   int audit_classify_syscall(int abi, unsigned syscall)
>>   {
>>   #ifdef CONFIG_PPC64
>> -    extern int ppc32_classify_syscall(unsigned);
>>       if (abi == AUDIT_ARCH_PPC)
>>           return ppc32_classify_syscall(syscall);
>>   #endif
>>

^ permalink raw reply

* Re: [PATCH v2 04/12] powerpc/pseries/svm: Add a powerpc version of prot_guest_has()
From: Tom Lendacky @ 2021-08-19 18:34 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Sathyanarayanan Kuppuswamy, linux-efi, Brijesh Singh, kvm,
	dri-devel, platform-driver-x86, Paul Mackerras, linux-s390,
	Andi Kleen, Joerg Roedel, x86, amd-gfx, linux-graphics-maintainer,
	Tianyu Lan, Borislav Petkov, kexec, linux-kernel, iommu,
	linux-fsdevel, linuxppc-dev
In-Reply-To: <YR4qfZdkv+91zNZk@infradead.org>

On 8/19/21 4:55 AM, Christoph Hellwig wrote:
> On Fri, Aug 13, 2021 at 11:59:23AM -0500, Tom Lendacky wrote:
>> +static inline bool prot_guest_has(unsigned int attr)
> 
> No reall need to have this inline.  In fact I'd suggest we havea the
> prototype in a common header so that everyone must implement it out
> of line.

I'll do the same thing I end up doing for x86.

Thanks,
Tom

> 

^ permalink raw reply

* Re: [PATCH v2 03/12] x86/sev: Add an x86 version of prot_guest_has()
From: Tom Lendacky @ 2021-08-19 18:33 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Sathyanarayanan Kuppuswamy, linux-efi, Brijesh Singh, kvm,
	Peter Zijlstra, Dave Hansen, dri-devel, platform-driver-x86,
	linux-s390, Andi Kleen, Joerg Roedel, x86, amd-gfx, Ingo Molnar,
	linux-graphics-maintainer, Joerg Roedel, Tianyu Lan,
	Borislav Petkov, Andy Lutomirski, Thomas Gleixner, kexec,
	linux-kernel, iommu, linux-fsdevel, linuxppc-dev
In-Reply-To: <YR4p9TqKTLdN1A96@infradead.org>

On 8/19/21 4:52 AM, Christoph Hellwig wrote:
> On Fri, Aug 13, 2021 at 11:59:22AM -0500, Tom Lendacky wrote:
>> While the name suggests this is intended mainly for guests, it will
>> also be used for host memory encryption checks in place of sme_active().
> 
> Which suggest that the name is not good to start with.  Maybe protected
> hardware, system or platform might be a better choice?
> 
>> +static inline bool prot_guest_has(unsigned int attr)
>> +{
>> +#ifdef CONFIG_AMD_MEM_ENCRYPT
>> +	if (sme_me_mask)
>> +		return amd_prot_guest_has(attr);
>> +#endif
>> +
>> +	return false;
>> +}
> 
> Shouldn't this be entirely out of line?

I did it as inline originally because the presence of the function will be
decided based on the ARCH_HAS_PROTECTED_GUEST config. For now, that is
only selected by the AMD memory encryption support, so if I went out of
line I could put in mem_encrypt.c. But with TDX wanting to also use it, it
would have to be in an always built file with some #ifdefs or in its own
file that is conditionally built based on the ARCH_HAS_PROTECTED_GUEST
setting (they've already tried building with ARCH_HAS_PROTECTED_GUEST=y
and AMD_MEM_ENCRYPT not set).

To take it out of line, I'm leaning towards the latter, creating a new
file that is built based on the ARCH_HAS_PROTECTED_GUEST setting.

> 
>> +/* 0x800 - 0x8ff reserved for AMD */
>> +#define PATTR_SME			0x800
>> +#define PATTR_SEV			0x801
>> +#define PATTR_SEV_ES			0x802
> 
> Why do we need reservations for a purely in-kernel namespace?
> 
> And why are you overoading a brand new generic API with weird details
> of a specific implementation like this?

There was some talk about this on the mailing list where TDX and SEV may
need to be differentiated, so we wanted to reserve a range of values per
technology. I guess I can remove them until they are actually needed.

Thanks,
Tom

> 

^ permalink raw reply

* Re: [PATCH v2 03/12] x86/sev: Add an x86 version of prot_guest_has()
From: Borislav Petkov @ 2021-08-19 17:26 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Sathyanarayanan Kuppuswamy, linux-efi, Brijesh Singh, kvm,
	Peter Zijlstra, Dave Hansen, dri-devel, platform-driver-x86,
	linux-s390, Andi Kleen, Joerg Roedel, x86, amd-gfx, Ingo Molnar,
	linux-graphics-maintainer, Tom Lendacky, Joerg Roedel, Tianyu Lan,
	Andy Lutomirski, Thomas Gleixner, kexec, linux-kernel, iommu,
	linux-fsdevel, linuxppc-dev
In-Reply-To: <YR4p9TqKTLdN1A96@infradead.org>

On Thu, Aug 19, 2021 at 10:52:53AM +0100, Christoph Hellwig wrote:
> Which suggest that the name is not good to start with.  Maybe protected
> hardware, system or platform might be a better choice?

Yah, coming up with a proper name here hasn't been easy.
prot_guest_has() is not the first variant.

From all three things you suggest above, I guess calling it a "platform"
is the closest. As in, this is a confidential computing platform which
provides host and guest facilities etc.

So calling it

confidential_computing_platform_has()

is obviously too long.

ccp_has() clashes with the namespace of drivers/crypto/ccp/ which is
used by the technology too.

coco_platform_has() is too unserious.

So I guess

cc_platform_has()

ain't all that bad.

Unless you have a better idea, ofc.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply

* Re: [PATCH v2 02/12] mm: Introduce a function to check for virtualization protection features
From: Tom Lendacky @ 2021-08-19 16:39 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-s390, Sathyanarayanan Kuppuswamy, linux-efi, Brijesh Singh,
	kvm, Tianyu Lan, Joerg Roedel, x86, kexec, linux-kernel, amd-gfx,
	platform-driver-x86, iommu, Andi Kleen, linux-graphics-maintainer,
	dri-devel, Joerg Roedel, linux-fsdevel, Borislav Petkov,
	linuxppc-dev
In-Reply-To: <YR4ohWC4/cLsuCvv@infradead.org>

On 8/19/21 4:46 AM, Christoph Hellwig wrote:
> On Fri, Aug 13, 2021 at 11:59:21AM -0500, Tom Lendacky wrote:
>> +#define PATTR_MEM_ENCRYPT		0	/* Encrypted memory */
>> +#define PATTR_HOST_MEM_ENCRYPT		1	/* Host encrypted memory */
>> +#define PATTR_GUEST_MEM_ENCRYPT		2	/* Guest encrypted memory */
>> +#define PATTR_GUEST_PROT_STATE		3	/* Guest encrypted state */
> 
> Please write an actual detailed explanaton of what these mean, that
> is what implications it has on the kernel.

Will do.

Thanks,
Tom

> 

^ permalink raw reply

* [PATCH v2 3/3] powerpc: Define and use MSR_RI only on non booke/40x
From: Christophe Leroy @ 2021-08-19 15:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, npiggin
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <385ead49ccb66a259b25fee3eebf0bd4094068f3.1629386461.git.christophe.leroy@csgroup.eu>

40x and BOOKE don't have MSR_RI.

Define MSR_RI only for platforms where it exists. For the other ones,
defines it as BUILD_BUG for C and do not define it for ASM.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/include/asm/reg.h       | 4 ++++
 arch/powerpc/include/asm/reg_booke.h | 6 +++---
 arch/powerpc/kernel/head_32.h        | 4 ++++
 arch/powerpc/kernel/process.c        | 2 +-
 arch/powerpc/lib/sstep.c             | 2 +-
 5 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index be85cf156a1f..656a9aaa1e8e 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -109,7 +109,11 @@
 #ifndef MSR_PMM
 #define MSR_PMM		__MASK(MSR_PMM_LG)	/* Performance monitor */
 #endif
+#if !defined(CONFIG_BOOKE) && !defined(CONFIG_40x)
 #define MSR_RI		__MASK(MSR_RI_LG)	/* Recoverable Exception */
+#elif !defined(__ASSEMBLY__)
+#define MSR_RI		({BUILD_BUG(); 0; })
+#endif
 #define MSR_LE		__MASK(MSR_LE_LG)	/* Little Endian */
 
 #define MSR_TM		__MASK(MSR_TM_LG)	/* Transactional Mem Available */
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index 17b8dcd9a40d..6f40a8420ad0 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -38,15 +38,15 @@
 #if defined(CONFIG_PPC_BOOK3E_64)
 #define MSR_64BIT	MSR_CM
 
-#define MSR_		(MSR_ME | MSR_RI | MSR_CE)
+#define MSR_		(MSR_ME | MSR_CE)
 #define MSR_KERNEL	(MSR_ | MSR_64BIT)
 #define MSR_USER32	(MSR_ | MSR_PR | MSR_EE)
 #define MSR_USER64	(MSR_USER32 | MSR_64BIT)
 #elif defined (CONFIG_40x)
-#define MSR_KERNEL	(MSR_ME|MSR_RI|MSR_IR|MSR_DR|MSR_CE)
+#define MSR_KERNEL	(MSR_ME|MSR_IR|MSR_DR|MSR_CE)
 #define MSR_USER	(MSR_KERNEL|MSR_PR|MSR_EE)
 #else
-#define MSR_KERNEL	(MSR_ME|MSR_RI|MSR_CE)
+#define MSR_KERNEL	(MSR_ME|MSR_CE)
 #define MSR_USER	(MSR_KERNEL|MSR_PR|MSR_EE)
 #endif
 
diff --git a/arch/powerpc/kernel/head_32.h b/arch/powerpc/kernel/head_32.h
index 6b1ec9e3541b..6c5f4183dc8e 100644
--- a/arch/powerpc/kernel/head_32.h
+++ b/arch/powerpc/kernel/head_32.h
@@ -63,7 +63,11 @@
 	mtspr	SPRN_DAR, r11	/* Tag DAR, to be used in DTLB Error */
 	.endif
 #endif
+#ifdef CONFIG_40x
+	LOAD_REG_IMMEDIATE(r11, MSR_KERNEL) /* re-enable MMU */
+#else
 	LOAD_REG_IMMEDIATE(r11, MSR_KERNEL & ~MSR_RI) /* re-enable MMU */
+#endif
 	mtspr	SPRN_SRR1, r11
 	lis	r11, 1f@h
 	ori	r11, r11, 1f@l
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 185beb290580..5ba72e31de28 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1420,7 +1420,7 @@ static struct regbit msr_bits[] = {
 	{MSR_IR,	"IR"},
 	{MSR_DR,	"DR"},
 	{MSR_PMM,	"PMM"},
-#ifndef CONFIG_BOOKE
+#if !defined(CONFIG_BOOKE) && !defined(CONFIG_40x)
 	{MSR_RI,	"RI"},
 	{MSR_LE,	"LE"},
 #endif
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index d8d5f901cee1..357cc1fb4f67 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -3559,7 +3559,7 @@ int emulate_step(struct pt_regs *regs, struct ppc_inst instr)
 
 	case MTMSR:
 		val = regs->gpr[op.reg];
-		if ((val & MSR_RI) == 0)
+		if (cpu_has_msr_ri() && (val & MSR_RI) == 0)
 			/* can't step mtmsr[d] that would clear MSR_RI */
 			return -1;
 		/* here op.val is the mask of bits to change */
-- 
2.25.0


^ permalink raw reply related

* [PATCH v2 2/3] powerpc: Refactor verification of MSR_RI
From: Christophe Leroy @ 2021-08-19 15:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, npiggin
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <385ead49ccb66a259b25fee3eebf0bd4094068f3.1629386461.git.christophe.leroy@csgroup.eu>

40x and BOOKE don't have MSR_RI therefore all tests involving
MSR_RI may be problematic on those plateforms.

Create helpers to check or set MSR_RI in regs, and use them
in common code.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v2: Remove superflous {
---
 arch/powerpc/include/asm/ptrace.h             | 23 +++++++++++++++++++
 arch/powerpc/kernel/interrupt.c               |  9 +++-----
 arch/powerpc/kernel/traps.c                   |  8 +++----
 arch/powerpc/mm/book3s64/slb.c                |  2 +-
 arch/powerpc/platforms/embedded6xx/holly.c    |  2 +-
 .../platforms/embedded6xx/mpc7448_hpc2.c      |  2 +-
 arch/powerpc/platforms/pasemi/idle.c          |  2 +-
 arch/powerpc/platforms/powernv/opal.c         |  2 +-
 arch/powerpc/platforms/pseries/ras.c          |  2 +-
 arch/powerpc/sysdev/fsl_rio.c                 |  2 +-
 arch/powerpc/xmon/xmon.c                      | 16 +++----------
 11 files changed, 40 insertions(+), 30 deletions(-)

diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index fd60538737a0..0cdb7b9c2c9c 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -22,6 +22,7 @@
 #include <linux/err.h>
 #include <uapi/asm/ptrace.h>
 #include <asm/asm-const.h>
+#include <asm/reg.h>
 
 #ifndef __ASSEMBLY__
 struct pt_regs
@@ -282,6 +283,28 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
 	regs->gpr[3] = rc;
 }
 
+static inline bool cpu_has_msr_ri(void)
+{
+	return !IS_ENABLED(CONFIG_BOOKE) && !IS_ENABLED(CONFIG_40x);
+}
+
+static inline bool regs_is_unrecoverable(struct pt_regs *regs)
+{
+	return unlikely(cpu_has_msr_ri() && !(regs->msr & MSR_RI));
+}
+
+static inline void regs_set_recoverable(struct pt_regs *regs)
+{
+	if (cpu_has_msr_ri())
+		regs_set_return_msr(regs, regs->msr | MSR_RI);
+}
+
+static inline void regs_set_unrecoverable(struct pt_regs *regs)
+{
+	if (cpu_has_msr_ri())
+		regs_set_return_msr(regs, regs->msr & ~MSR_RI);
+}
+
 #define arch_has_single_step()	(1)
 #define arch_has_block_step()	(true)
 #define ARCH_HAS_USER_SINGLE_STEP_REPORT
diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
index f26caf911ab5..f06c38e8fe36 100644
--- a/arch/powerpc/kernel/interrupt.c
+++ b/arch/powerpc/kernel/interrupt.c
@@ -93,8 +93,7 @@ notrace long system_call_exception(long r3, long r4, long r5,
 	CT_WARN_ON(ct_state() == CONTEXT_KERNEL);
 	user_exit_irqoff();
 
-	if (!IS_ENABLED(CONFIG_BOOKE) && !IS_ENABLED(CONFIG_40x))
-		BUG_ON(!(regs->msr & MSR_RI));
+	BUG_ON(regs_is_unrecoverable(regs));
 	BUG_ON(!(regs->msr & MSR_PR));
 	BUG_ON(arch_irq_disabled_regs(regs));
 
@@ -463,8 +462,7 @@ notrace unsigned long interrupt_exit_user_prepare(struct pt_regs *regs)
 {
 	unsigned long ret;
 
-	if (!IS_ENABLED(CONFIG_BOOKE) && !IS_ENABLED(CONFIG_40x))
-		BUG_ON(!(regs->msr & MSR_RI));
+	BUG_ON(regs_is_unrecoverable(regs));
 	BUG_ON(arch_irq_disabled_regs(regs));
 	CT_WARN_ON(ct_state() == CONTEXT_USER);
 
@@ -495,8 +493,7 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs)
 	bool stack_store = current_thread_info()->flags &
 						_TIF_EMULATE_STACK_STORE;
 
-	if (!IS_ENABLED(CONFIG_BOOKE) && !IS_ENABLED(CONFIG_40x) &&
-	    unlikely(!(regs->msr & MSR_RI)))
+	if (regs_is_unrecoverable(regs))
 		unrecoverable_exception(regs);
 	/*
 	 * CT_WARN_ON comes here via program_check_exception,
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 3e2adb3487e7..8310147b5e7b 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -428,7 +428,7 @@ void hv_nmi_check_nonrecoverable(struct pt_regs *regs)
 	return;
 
 nonrecoverable:
-	regs_set_return_msr(regs, regs->msr & ~MSR_RI);
+	regs_set_unrecoverable(regs);
 #endif
 }
 DEFINE_INTERRUPT_HANDLER_NMI(system_reset_exception)
@@ -498,7 +498,7 @@ DEFINE_INTERRUPT_HANDLER_NMI(system_reset_exception)
 		die("Unrecoverable nested System Reset", regs, SIGABRT);
 #endif
 	/* Must die if the interrupt is not recoverable */
-	if (!(regs->msr & MSR_RI)) {
+	if (regs_is_unrecoverable(regs)) {
 		/* For the reason explained in die_mce, nmi_exit before die */
 		nmi_exit();
 		die("Unrecoverable System Reset", regs, SIGABRT);
@@ -550,7 +550,7 @@ static inline int check_io_access(struct pt_regs *regs)
 			printk(KERN_DEBUG "%s bad port %lx at %p\n",
 			       (*nip & 0x100)? "OUT to": "IN from",
 			       regs->gpr[rb] - _IO_BASE, nip);
-			regs_set_return_msr(regs, regs->msr | MSR_RI);
+			regs_set_recoverable(regs);
 			regs_set_return_ip(regs, extable_fixup(entry));
 			return 1;
 		}
@@ -840,7 +840,7 @@ DEFINE_INTERRUPT_HANDLER_NMI(machine_check_exception)
 
 bail:
 	/* Must die if the interrupt is not recoverable */
-	if (!(regs->msr & MSR_RI))
+	if (regs_is_unrecoverable(regs))
 		die_mce("Unrecoverable Machine check", regs, SIGBUS);
 
 #ifdef CONFIG_PPC_BOOK3S_64
diff --git a/arch/powerpc/mm/book3s64/slb.c b/arch/powerpc/mm/book3s64/slb.c
index c91bd85eb90e..f0037bcc47a0 100644
--- a/arch/powerpc/mm/book3s64/slb.c
+++ b/arch/powerpc/mm/book3s64/slb.c
@@ -822,7 +822,7 @@ DEFINE_INTERRUPT_HANDLER_RAW(do_slb_fault)
 	/* IRQs are not reconciled here, so can't check irqs_disabled */
 	VM_WARN_ON(mfmsr() & MSR_EE);
 
-	if (unlikely(!(regs->msr & MSR_RI)))
+	if (regs_is_unrecoverable(regs))
 		return -EINVAL;
 
 	/*
diff --git a/arch/powerpc/platforms/embedded6xx/holly.c b/arch/powerpc/platforms/embedded6xx/holly.c
index 85521b3e7098..7a85b117f7a4 100644
--- a/arch/powerpc/platforms/embedded6xx/holly.c
+++ b/arch/powerpc/platforms/embedded6xx/holly.c
@@ -251,7 +251,7 @@ static int ppc750_machine_check_exception(struct pt_regs *regs)
 	/* Are we prepared to handle this fault */
 	if ((entry = search_exception_tables(regs->nip)) != NULL) {
 		tsi108_clear_pci_cfg_error();
-		regs_set_return_msr(regs, regs->msr | MSR_RI);
+		regs_set_recoverable(regs);
 		regs_set_return_ip(regs, extable_fixup(entry));
 		return 1;
 	}
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
index d8da6a483e59..9eb9abb5bce2 100644
--- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
@@ -173,7 +173,7 @@ static int mpc7448_machine_check_exception(struct pt_regs *regs)
 	/* Are we prepared to handle this fault */
 	if ((entry = search_exception_tables(regs->nip)) != NULL) {
 		tsi108_clear_pci_cfg_error();
-		regs_set_return_msr(regs, regs->msr | MSR_RI);
+		regs_set_recoverable(regs);
 		regs_set_return_ip(regs, extable_fixup(entry));
 		return 1;
 	}
diff --git a/arch/powerpc/platforms/pasemi/idle.c b/arch/powerpc/platforms/pasemi/idle.c
index 534b0317fc15..6087c70ed2ef 100644
--- a/arch/powerpc/platforms/pasemi/idle.c
+++ b/arch/powerpc/platforms/pasemi/idle.c
@@ -59,7 +59,7 @@ static int pasemi_system_reset_exception(struct pt_regs *regs)
 	restore_astate(hard_smp_processor_id());
 
 	/* everything handled */
-	regs_set_return_msr(regs, regs->msr | MSR_RI);
+	regs_set_recoverable(regs);
 	return 1;
 }
 
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 2835376e61a4..e9d18519e650 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -588,7 +588,7 @@ static int opal_recover_mce(struct pt_regs *regs,
 {
 	int recovered = 0;
 
-	if (!(regs->msr & MSR_RI)) {
+	if (regs_is_unrecoverable(regs)) {
 		/* If MSR_RI isn't set, we cannot recover */
 		pr_err("Machine check interrupt unrecoverable: MSR(RI=0)\n");
 		recovered = 0;
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 167f2e1b8d39..56092dccfdb8 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -783,7 +783,7 @@ static int recover_mce(struct pt_regs *regs, struct machine_check_event *evt)
 {
 	int recovered = 0;
 
-	if (!(regs->msr & MSR_RI)) {
+	if (regs_is_unrecoverable(regs)) {
 		/* If MSR_RI isn't set, we cannot recover */
 		pr_err("Machine check interrupt unrecoverable: MSR(RI=0)\n");
 		recovered = 0;
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 5a95b8ea23d8..ff7906b48ca1 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -108,7 +108,7 @@ int fsl_rio_mcheck_exception(struct pt_regs *regs)
 				 __func__);
 			out_be32((u32 *)(rio_regs_win + RIO_LTLEDCSR),
 				 0);
-			regs_set_return_msr(regs, regs->msr | MSR_RI);
+			regs_set_recoverable(regs);
 			regs_set_return_ip(regs, extable_fixup(entry));
 			return 1;
 		}
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index ead460b80905..dd8241c009e5 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -482,16 +482,6 @@ static inline void get_output_lock(void) {}
 static inline void release_output_lock(void) {}
 #endif
 
-static inline int unrecoverable_excp(struct pt_regs *regs)
-{
-#if defined(CONFIG_4xx) || defined(CONFIG_PPC_BOOK3E)
-	/* We have no MSR_RI bit on 4xx or Book3e, so we simply return false */
-	return 0;
-#else
-	return ((regs->msr & MSR_RI) == 0);
-#endif
-}
-
 static void xmon_touch_watchdogs(void)
 {
 	touch_softlockup_watchdog_sync();
@@ -565,7 +555,7 @@ static int xmon_core(struct pt_regs *regs, volatile int fromipi)
 	bp = NULL;
 	if ((regs->msr & (MSR_IR|MSR_PR|MSR_64BIT)) == (MSR_IR|MSR_64BIT))
 		bp = at_breakpoint(regs->nip);
-	if (bp || unrecoverable_excp(regs))
+	if (bp || regs_is_unrecoverable(regs))
 		fromipi = 0;
 
 	if (!fromipi) {
@@ -577,7 +567,7 @@ static int xmon_core(struct pt_regs *regs, volatile int fromipi)
 			       cpu, BP_NUM(bp));
 			xmon_print_symbol(regs->nip, " ", ")\n");
 		}
-		if (unrecoverable_excp(regs))
+		if (regs_is_unrecoverable(regs))
 			printf("WARNING: exception is not recoverable, "
 			       "can't continue\n");
 		release_output_lock();
@@ -693,7 +683,7 @@ static int xmon_core(struct pt_regs *regs, volatile int fromipi)
 			printf("Stopped at breakpoint %tx (", BP_NUM(bp));
 			xmon_print_symbol(regs->nip, " ", ")\n");
 		}
-		if (unrecoverable_excp(regs))
+		if (regs_is_unrecoverable(regs))
 			printf("WARNING: exception is not recoverable, "
 			       "can't continue\n");
 		remove_bpts();
-- 
2.25.0


^ permalink raw reply related

* [PATCH v2 1/3] powerpc: Remove MSR_PR check in interrupt_exit_{user/kernel}_prepare()
From: Christophe Leroy @ 2021-08-19 15:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, npiggin
  Cc: linuxppc-dev, linux-kernel

In those hot functions that are called at every interrupt, any saved
cycle is worth it.

interrupt_exit_user_prepare() and interrupt_exit_kernel_prepare() are
called from three places:
- From entry_32.S
- From interrupt_64.S
- From interrupt_exit_user_restart() and interrupt_exit_kernel_restart()

In entry_32.S, there are inambiguously called based on MSR_PR:

	interrupt_return:
		lwz	r4,_MSR(r1)
		addi	r3,r1,STACK_FRAME_OVERHEAD
		andi.	r0,r4,MSR_PR
		beq	.Lkernel_interrupt_return
		bl	interrupt_exit_user_prepare
	...
	.Lkernel_interrupt_return:
		bl	interrupt_exit_kernel_prepare

In interrupt_64.S, that's similar:

	interrupt_return_\srr\():
		ld	r4,_MSR(r1)
		andi.	r0,r4,MSR_PR
		beq	interrupt_return_\srr\()_kernel
	interrupt_return_\srr\()_user: /* make backtraces match the _kernel variant */
		addi	r3,r1,STACK_FRAME_OVERHEAD
		bl	interrupt_exit_user_prepare
	...
	interrupt_return_\srr\()_kernel:
		addi	r3,r1,STACK_FRAME_OVERHEAD
		bl	interrupt_exit_kernel_prepare

In interrupt_exit_user_restart() and interrupt_exit_kernel_restart(),
MSR_PR is verified respectively by BUG_ON(!user_mode(regs)) and
BUG_ON(user_mode(regs)) prior to calling interrupt_exit_user_prepare()
and interrupt_exit_kernel_prepare().

The verification in interrupt_exit_user_prepare() and
interrupt_exit_kernel_prepare() are therefore useless and can be removed.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/interrupt.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
index 21bbd615ca41..f26caf911ab5 100644
--- a/arch/powerpc/kernel/interrupt.c
+++ b/arch/powerpc/kernel/interrupt.c
@@ -465,7 +465,6 @@ notrace unsigned long interrupt_exit_user_prepare(struct pt_regs *regs)
 
 	if (!IS_ENABLED(CONFIG_BOOKE) && !IS_ENABLED(CONFIG_40x))
 		BUG_ON(!(regs->msr & MSR_RI));
-	BUG_ON(!(regs->msr & MSR_PR));
 	BUG_ON(arch_irq_disabled_regs(regs));
 	CT_WARN_ON(ct_state() == CONTEXT_USER);
 
@@ -499,7 +498,6 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs)
 	if (!IS_ENABLED(CONFIG_BOOKE) && !IS_ENABLED(CONFIG_40x) &&
 	    unlikely(!(regs->msr & MSR_RI)))
 		unrecoverable_exception(regs);
-	BUG_ON(regs->msr & MSR_PR);
 	/*
 	 * CT_WARN_ON comes here via program_check_exception,
 	 * so avoid recursion.
-- 
2.25.0


^ permalink raw reply related

* Re: [PATCH 5/6] audit: Declare ppc32_classify_syscall()
From: Christophe Leroy @ 2021-08-19 14:56 UTC (permalink / raw)
  To: Cédric Le Goater, linuxppc-dev; +Cc: Christophe Leroy
In-Reply-To: <20210819125656.14498-6-clg@kaod.org>



Le 19/08/2021 à 14:56, Cédric Le Goater a écrit :
> This fixes a compile error with W=1.
> 
> Cc: Christophe Leroy <christophe.leroy@c-s.fr>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> 
>   I don't think this is correct. Which file could we use ?

I think you can completely remove ppc32_classify_syscall(), and instead add the following in the 
default case in audit_classify_syscall():

  	default:
+		if (IS_ENABLED(CONFIG_PPC64) && abi == AUDIT_ARCH_PPC)
+			return 1;
  		return 0;


> 
>   arch/powerpc/include/asm/unistd.h | 3 +++
>   arch/powerpc/kernel/audit.c       | 1 -
>   2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
> index b541c690a31c..d9025a7e973c 100644
> --- a/arch/powerpc/include/asm/unistd.h
> +++ b/arch/powerpc/include/asm/unistd.h
> @@ -47,6 +47,9 @@
>   #define __ARCH_WANT_SYS_UTIME
>   #define __ARCH_WANT_SYS_NEWFSTATAT
>   #define __ARCH_WANT_COMPAT_SYS_SENDFILE
> +#ifdef CONFIG_AUDIT
> +extern int ppc32_classify_syscall(unsigned int syscall);
> +#endif
>   #endif
>   #define __ARCH_WANT_SYS_FORK
>   #define __ARCH_WANT_SYS_VFORK
> diff --git a/arch/powerpc/kernel/audit.c b/arch/powerpc/kernel/audit.c
> index a2dddd7f3d09..c3c6c6a1069b 100644
> --- a/arch/powerpc/kernel/audit.c
> +++ b/arch/powerpc/kernel/audit.c
> @@ -41,7 +41,6 @@ int audit_classify_arch(int arch)
>   int audit_classify_syscall(int abi, unsigned syscall)
>   {
>   #ifdef CONFIG_PPC64
> -	extern int ppc32_classify_syscall(unsigned);
>   	if (abi == AUDIT_ARCH_PPC)
>   		return ppc32_classify_syscall(syscall);
>   #endif
> 

^ permalink raw reply

* Re: [PATCH 3/6] KVM: PPC: Book3S PR: Declare kvmppc_handle_exit_pr()
From: Christophe Leroy @ 2021-08-19 14:44 UTC (permalink / raw)
  To: Cédric Le Goater, linuxppc-dev; +Cc: Christophe Leroy
In-Reply-To: <20210819125656.14498-4-clg@kaod.org>



Le 19/08/2021 à 14:56, Cédric Le Goater a écrit :
> This fixes a compile error with W=1.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>   arch/powerpc/kvm/book3s.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/powerpc/kvm/book3s.h b/arch/powerpc/kvm/book3s.h
> index 740e51def5a5..c08f93b7f523 100644
> --- a/arch/powerpc/kvm/book3s.h
> +++ b/arch/powerpc/kvm/book3s.h
> @@ -24,6 +24,7 @@ extern int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu,
>   					int sprn, ulong *spr_val);
>   extern int kvmppc_book3s_init_pr(void);
>   extern void kvmppc_book3s_exit_pr(void);
> +extern int kvmppc_handle_exit_pr(struct kvm_vcpu *vcpu, unsigned int exit_nr);

Don't add new 'extern' keywords, they are useless and pointless for functions prototypes.

>   
>   #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
>   extern void kvmppc_emulate_tabort(struct kvm_vcpu *vcpu, int ra_val);
> 

^ permalink raw reply

* Re: [PATCH 1/6] powerpc/prom: Introduce early_reserve_mem_old()
From: Christophe Leroy @ 2021-08-19 14:42 UTC (permalink / raw)
  To: Cédric Le Goater, linuxppc-dev; +Cc: Christophe Leroy
In-Reply-To: <20210819125656.14498-2-clg@kaod.org>



Le 19/08/2021 à 14:56, Cédric Le Goater a écrit :
> and condition its call with IS_ENABLED(CONFIG_PPC32). This fixes a
> compile error with W=1.
> 
> arch/powerpc/kernel/prom.c: In function ‘early_reserve_mem’:
> arch/powerpc/kernel/prom.c:625:10: error: variable ‘reserve_map’ set but not used [-Werror=unused-but-set-variable]
>    __be64 *reserve_map;
>            ^~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> Cc: Christophe Leroy <christophe.leroy@c-s.fr>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> 
>   Christophe, I think you had comments on this one ? Yes, I am being a bit lazy.


Yeah, my comment was to leave thing almost as is, just drop the #ifdef CONFIG_PPC32 and instead put 
something like:

	if (!IS_ENABLED(CONFIG_PPC32))
		return;

> 
>   arch/powerpc/kernel/prom.c | 37 ++++++++++++++++++++-----------------
>   1 file changed, 20 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index f620e04dc9bf..52869d12bc1d 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -621,27 +621,14 @@ static void __init early_reserve_mem_dt(void)
>   	}
>   }
>   
> -static void __init early_reserve_mem(void)
> +static void __init early_reserve_mem_old(void)

Why old ? Because ppc32 ?

I think that's more changes than needed.



>   {
>   	__be64 *reserve_map;
>   
>   	reserve_map = (__be64 *)(((unsigned long)initial_boot_params) +
>   			fdt_off_mem_rsvmap(initial_boot_params));
>   
> -	/* Look for the new "reserved-regions" property in the DT */
> -	early_reserve_mem_dt();
> -
> -#ifdef CONFIG_BLK_DEV_INITRD
> -	/* Then reserve the initrd, if any */
> -	if (initrd_start && (initrd_end > initrd_start)) {
> -		memblock_reserve(ALIGN_DOWN(__pa(initrd_start), PAGE_SIZE),
> -			ALIGN(initrd_end, PAGE_SIZE) -
> -			ALIGN_DOWN(initrd_start, PAGE_SIZE));
> -	}
> -#endif /* CONFIG_BLK_DEV_INITRD */
> -
> -#ifdef CONFIG_PPC32
> -	/*
> +	/*
>   	 * Handle the case where we might be booting from an old kexec
>   	 * image that setup the mem_rsvmap as pairs of 32-bit values
>   	 */
> @@ -659,9 +646,25 @@ static void __init early_reserve_mem(void)
>   			DBG("reserving: %x -> %x\n", base_32, size_32);
>   			memblock_reserve(base_32, size_32);
>   		}
> -		return;
>   	}
> -#endif
> +}
> +
> +static void __init early_reserve_mem(void)
> +{
> +	/* Look for the new "reserved-regions" property in the DT */
> +	early_reserve_mem_dt();
> +
> +#ifdef CONFIG_BLK_DEV_INITRD
> +	/* Then reserve the initrd, if any */
> +	if (initrd_start && (initrd_end > initrd_start)) {
> +		memblock_reserve(ALIGN_DOWN(__pa(initrd_start), PAGE_SIZE),
> +			ALIGN(initrd_end, PAGE_SIZE) -
> +			ALIGN_DOWN(initrd_start, PAGE_SIZE));
> +	}
> +#endif /* CONFIG_BLK_DEV_INITRD */
> +
> +	if (IS_ENABLED(CONFIG_PPC32))
> +		early_reserve_mem_old();
>   }
>   
>   #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
> 

^ permalink raw reply

* Re: [PATCH 2/3] powerpc: Refactor verification of MSR_RI
From: kernel test robot @ 2021-08-19 13:23 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, npiggin
  Cc: linuxppc-dev, kbuild-all, linux-kernel
In-Reply-To: <9501b17c057151484d5e9efa8a2fbd2953792ee4.1629354625.git.christophe.leroy@csgroup.eu>

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

Hi Christophe,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on v5.14-rc6 next-20210819]
[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/Christophe-Leroy/powerpc-Remove-MSR_PR-check-in-interrupt_exit_-user-kernel-_prepare/20210819-143251
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 11.2.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
        # https://github.com/0day-ci/linux/commit/797b527549df3f1f8e4d9f2bafeb5fe5ec810409
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Christophe-Leroy/powerpc-Remove-MSR_PR-check-in-interrupt_exit_-user-kernel-_prepare/20210819-143251
        git checkout 797b527549df3f1f8e4d9f2bafeb5fe5ec810409
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.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 warnings (new ones prefixed by >>):

   In file included from arch/powerpc/mm/book3s64/slb.c:13:
   arch/powerpc/mm/book3s64/slb.c: In function '____do_slb_fault':
   arch/powerpc/include/asm/interrupt.h:398:29: error: invalid storage class for function '____do_bad_slb_fault'
     398 | static __always_inline void ____##func(struct pt_regs *regs);           \
         |                             ^~~~
   arch/powerpc/mm/book3s64/slb.c:872:1: note: in expansion of macro 'DEFINE_INTERRUPT_HANDLER'
     872 | DEFINE_INTERRUPT_HANDLER(do_bad_slb_fault)
         | ^~~~~~~~~~~~~~~~~~~~~~~~
>> arch/powerpc/include/asm/interrupt.h:398:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     398 | static __always_inline void ____##func(struct pt_regs *regs);           \
         | ^~~~~~
   arch/powerpc/mm/book3s64/slb.c:872:1: note: in expansion of macro 'DEFINE_INTERRUPT_HANDLER'
     872 | DEFINE_INTERRUPT_HANDLER(do_bad_slb_fault)
         | ^~~~~~~~~~~~~~~~~~~~~~~~
>> arch/powerpc/include/asm/interrupt.h:400:36: warning: 'externally_visible' attribute have effect only on public objects [-Wattributes]
     400 | interrupt_handler void func(struct pt_regs *regs)                       \
         |                                    ^~~~~~~
   arch/powerpc/mm/book3s64/slb.c:872:1: note: in expansion of macro 'DEFINE_INTERRUPT_HANDLER'
     872 | DEFINE_INTERRUPT_HANDLER(do_bad_slb_fault)
         | ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/mm/book3s64/slb.c: In function 'do_bad_slb_fault':
   arch/powerpc/include/asm/interrupt.h:406:9: error: implicit declaration of function '____do_bad_slb_fault'; did you mean 'do_bad_slb_fault'? [-Werror=implicit-function-declaration]
     406 |         ____##func (regs);                                              \
         |         ^~~~
   arch/powerpc/mm/book3s64/slb.c:872:1: note: in expansion of macro 'DEFINE_INTERRUPT_HANDLER'
     872 | DEFINE_INTERRUPT_HANDLER(do_bad_slb_fault)
         | ^~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/powerpc/include/asm/kprobes.h:5,
                    from arch/powerpc/include/asm/interrupt.h:73,
                    from arch/powerpc/mm/book3s64/slb.c:13:
   arch/powerpc/mm/book3s64/slb.c: In function '____do_slb_fault':
   include/asm-generic/kprobes.h:14:29: error: initializer element is not constant
      14 |         _kbl_addr_##fname = (unsigned long)fname;
         |                             ^
   include/asm-generic/kprobes.h:15:33: note: in expansion of macro '__NOKPROBE_SYMBOL'
      15 | # define NOKPROBE_SYMBOL(fname) __NOKPROBE_SYMBOL(fname)
         |                                 ^~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/interrupt.h:410:1: note: in expansion of macro 'NOKPROBE_SYMBOL'
     410 | NOKPROBE_SYMBOL(func);                                                  \
         | ^~~~~~~~~~~~~~~
   arch/powerpc/mm/book3s64/slb.c:872:1: note: in expansion of macro 'DEFINE_INTERRUPT_HANDLER'
     872 | DEFINE_INTERRUPT_HANDLER(do_bad_slb_fault)
         | ^~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/powerpc/mm/book3s64/slb.c:13:
   arch/powerpc/include/asm/interrupt.h:412:29: error: invalid storage class for function '____do_bad_slb_fault'
     412 | static __always_inline void ____##func(struct pt_regs *regs)
         |                             ^~~~
   arch/powerpc/mm/book3s64/slb.c:872:1: note: in expansion of macro 'DEFINE_INTERRUPT_HANDLER'
     872 | DEFINE_INTERRUPT_HANDLER(do_bad_slb_fault)
         | ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/interrupt.h:412:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     412 | static __always_inline void ____##func(struct pt_regs *regs)
         | ^~~~~~
   arch/powerpc/mm/book3s64/slb.c:872:1: note: in expansion of macro 'DEFINE_INTERRUPT_HANDLER'
     872 | DEFINE_INTERRUPT_HANDLER(do_bad_slb_fault)
         | ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/mm/book3s64/slb.c:886:1: error: expected declaration or statement at end of input
     886 | }
         | ^
   arch/powerpc/mm/book3s64/slb.c:887: error: control reaches end of non-void function [-Werror=return-type]
   cc1: some warnings being treated as errors


vim +398 arch/powerpc/include/asm/interrupt.h

8d41fc618ab804 Nicholas Piggin 2021-01-30  380  
8d41fc618ab804 Nicholas Piggin 2021-01-30  381  /**
8d41fc618ab804 Nicholas Piggin 2021-01-30  382   * DECLARE_INTERRUPT_HANDLER - Declare synchronous interrupt handler function
8d41fc618ab804 Nicholas Piggin 2021-01-30  383   * @func:	Function name of the entry point
8d41fc618ab804 Nicholas Piggin 2021-01-30  384   */
8d41fc618ab804 Nicholas Piggin 2021-01-30  385  #define DECLARE_INTERRUPT_HANDLER(func)					\
8d41fc618ab804 Nicholas Piggin 2021-01-30  386  	__visible void func(struct pt_regs *regs)
8d41fc618ab804 Nicholas Piggin 2021-01-30  387  
8d41fc618ab804 Nicholas Piggin 2021-01-30  388  /**
8d41fc618ab804 Nicholas Piggin 2021-01-30  389   * DEFINE_INTERRUPT_HANDLER - Define synchronous interrupt handler function
8d41fc618ab804 Nicholas Piggin 2021-01-30  390   * @func:	Function name of the entry point
8d41fc618ab804 Nicholas Piggin 2021-01-30  391   *
8d41fc618ab804 Nicholas Piggin 2021-01-30  392   * @func is called from ASM entry code.
8d41fc618ab804 Nicholas Piggin 2021-01-30  393   *
8d41fc618ab804 Nicholas Piggin 2021-01-30  394   * The macro is written so it acts as function definition. Append the
8d41fc618ab804 Nicholas Piggin 2021-01-30  395   * body with a pair of curly brackets.
8d41fc618ab804 Nicholas Piggin 2021-01-30  396   */
8d41fc618ab804 Nicholas Piggin 2021-01-30  397  #define DEFINE_INTERRUPT_HANDLER(func)					\
8d41fc618ab804 Nicholas Piggin 2021-01-30 @398  static __always_inline void ____##func(struct pt_regs *regs);		\
8d41fc618ab804 Nicholas Piggin 2021-01-30  399  									\
e4bb64c7a42e61 Nicholas Piggin 2021-02-11 @400  interrupt_handler void func(struct pt_regs *regs)			\
8d41fc618ab804 Nicholas Piggin 2021-01-30  401  {									\
25b7e6bb743ca5 Nicholas Piggin 2021-01-30  402  	struct interrupt_state state;					\
25b7e6bb743ca5 Nicholas Piggin 2021-01-30  403  									\
25b7e6bb743ca5 Nicholas Piggin 2021-01-30  404  	interrupt_enter_prepare(regs, &state);				\
25b7e6bb743ca5 Nicholas Piggin 2021-01-30  405  									\
8d41fc618ab804 Nicholas Piggin 2021-01-30  406  	____##func (regs);						\
25b7e6bb743ca5 Nicholas Piggin 2021-01-30  407  									\
25b7e6bb743ca5 Nicholas Piggin 2021-01-30  408  	interrupt_exit_prepare(regs, &state);				\
8d41fc618ab804 Nicholas Piggin 2021-01-30  409  }									\
e4bb64c7a42e61 Nicholas Piggin 2021-02-11  410  NOKPROBE_SYMBOL(func);							\
8d41fc618ab804 Nicholas Piggin 2021-01-30  411  									\
8d41fc618ab804 Nicholas Piggin 2021-01-30  412  static __always_inline void ____##func(struct pt_regs *regs)
8d41fc618ab804 Nicholas Piggin 2021-01-30  413  

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

^ permalink raw reply

* [PATCH 4/6] KVM: PPC: Book3S PR: Remove unused variable
From: Cédric Le Goater @ 2021-08-19 12:56 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Christophe Leroy, Cédric Le Goater
In-Reply-To: <20210819125656.14498-1-clg@kaod.org>

This fixes a compile error with W=1.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

 May be, this was sent already ? 

 arch/powerpc/kvm/book3s_64_mmu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c
index 26b8b27a3755..feee40cb2ba1 100644
--- a/arch/powerpc/kvm/book3s_64_mmu.c
+++ b/arch/powerpc/kvm/book3s_64_mmu.c
@@ -196,7 +196,7 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
 	hva_t ptegp;
 	u64 pteg[16];
 	u64 avpn = 0;
-	u64 v, r;
+	u64 r;
 	u64 v_val, v_mask;
 	u64 eaddr_mask;
 	int i;
@@ -285,7 +285,6 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
 		goto do_second;
 	}
 
-	v = be64_to_cpu(pteg[i]);
 	r = be64_to_cpu(pteg[i+1]);
 	pp = (r & HPTE_R_PP) | key;
 	if (r & HPTE_R_PP0)
-- 
2.31.1


^ permalink raw reply related

* [PATCH 0/6] W=1 fixes
From: Cédric Le Goater @ 2021-08-19 12:56 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Christophe Leroy, Cédric Le Goater

Hello,

With this small series, I could compile the ppc kernel with W=1. There
are certainly other configs which will need more fixes but it's a good
start. 

The last 2 patches look hacky. Christophe, could you help with these
to find a better place to include the declarations ?

Thanks,

C.

Cédric Le Goater (6):
  powerpc/prom: Introduce early_reserve_mem_old()
  powerpc/pseries/vas: Declare pseries_vas_fault_thread_fn() as static
  KVM: PPC: Book3S PR: Declare kvmppc_handle_exit_pr()
  KVM: PPC: Book3S PR: Remove unused variable
  audit: Declare ppc32_classify_syscall()
  powerpc/compat_sys: Declare syscalls

 arch/powerpc/include/asm/syscalls.h  | 31 +++++++++++++++++++++++
 arch/powerpc/include/asm/unistd.h    |  3 +++
 arch/powerpc/kvm/book3s.h            |  1 +
 arch/powerpc/kernel/audit.c          |  1 -
 arch/powerpc/kernel/prom.c           | 37 +++++++++++++++-------------
 arch/powerpc/kvm/book3s_64_mmu.c     |  3 +--
 arch/powerpc/platforms/pseries/vas.c |  2 +-
 7 files changed, 57 insertions(+), 21 deletions(-)

-- 
2.31.1


^ permalink raw reply

* [PATCH 2/6] powerpc/pseries/vas: Declare pseries_vas_fault_thread_fn() as static
From: Cédric Le Goater @ 2021-08-19 12:56 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Christophe Leroy, Haren Myneni, Cédric Le Goater
In-Reply-To: <20210819125656.14498-1-clg@kaod.org>

This fixes a compile error with W=1.

Fixes: 6d0aaf5e0de0 ("powerpc/pseries/vas: Setup IRQ and fault handling")
Cc: Haren Myneni <haren@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 arch/powerpc/platforms/pseries/vas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c
index b5c1cf1bc64d..b043e3936d21 100644
--- a/arch/powerpc/platforms/pseries/vas.c
+++ b/arch/powerpc/platforms/pseries/vas.c
@@ -184,7 +184,7 @@ static int h_get_nx_fault(u32 winid, u64 buffer)
  * Note: The hypervisor forwards an interrupt for each fault request.
  *	So one fault CRB to process for each H_GET_NX_FAULT hcall.
  */
-irqreturn_t pseries_vas_fault_thread_fn(int irq, void *data)
+static irqreturn_t pseries_vas_fault_thread_fn(int irq, void *data)
 {
 	struct pseries_vas_window *txwin = data;
 	struct coprocessor_request_block crb;
-- 
2.31.1


^ permalink raw reply related

* [PATCH 5/6] audit: Declare ppc32_classify_syscall()
From: Cédric Le Goater @ 2021-08-19 12:56 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Christophe Leroy, Cédric Le Goater
In-Reply-To: <20210819125656.14498-1-clg@kaod.org>

This fixes a compile error with W=1.

Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

 I don't think this is correct. Which file could we use ? 

 arch/powerpc/include/asm/unistd.h | 3 +++
 arch/powerpc/kernel/audit.c       | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index b541c690a31c..d9025a7e973c 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -47,6 +47,9 @@
 #define __ARCH_WANT_SYS_UTIME
 #define __ARCH_WANT_SYS_NEWFSTATAT
 #define __ARCH_WANT_COMPAT_SYS_SENDFILE
+#ifdef CONFIG_AUDIT
+extern int ppc32_classify_syscall(unsigned int syscall);
+#endif
 #endif
 #define __ARCH_WANT_SYS_FORK
 #define __ARCH_WANT_SYS_VFORK
diff --git a/arch/powerpc/kernel/audit.c b/arch/powerpc/kernel/audit.c
index a2dddd7f3d09..c3c6c6a1069b 100644
--- a/arch/powerpc/kernel/audit.c
+++ b/arch/powerpc/kernel/audit.c
@@ -41,7 +41,6 @@ int audit_classify_arch(int arch)
 int audit_classify_syscall(int abi, unsigned syscall)
 {
 #ifdef CONFIG_PPC64
-	extern int ppc32_classify_syscall(unsigned);
 	if (abi == AUDIT_ARCH_PPC)
 		return ppc32_classify_syscall(syscall);
 #endif
-- 
2.31.1


^ permalink raw reply related

* [PATCH 6/6] powerpc/compat_sys: Declare syscalls
From: Cédric Le Goater @ 2021-08-19 12:56 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Christophe Leroy, Cédric Le Goater
In-Reply-To: <20210819125656.14498-1-clg@kaod.org>

This fixes a compile error with W=1.

Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 arch/powerpc/include/asm/syscalls.h | 31 +++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h
index 398171fdcd9f..1d5f2abaa38a 100644
--- a/arch/powerpc/include/asm/syscalls.h
+++ b/arch/powerpc/include/asm/syscalls.h
@@ -6,6 +6,7 @@
 #include <linux/compiler.h>
 #include <linux/linkage.h>
 #include <linux/types.h>
+#include <linux/compat.h>
 
 struct rtas_args;
 
@@ -18,5 +19,35 @@ asmlinkage long sys_mmap2(unsigned long addr, size_t len,
 asmlinkage long ppc64_personality(unsigned long personality);
 asmlinkage long sys_rtas(struct rtas_args __user *uargs);
 
+#ifdef CONFIG_COMPAT
+unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
+			       unsigned long prot, unsigned long flags,
+			       unsigned long fd, unsigned long pgoff);
+
+compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_size_t count,
+				  u32 reg6, u32 pos1, u32 pos2);
+
+compat_ssize_t compat_sys_pwrite64(unsigned int fd, const char __user *ubuf, compat_size_t count,
+				   u32 reg6, u32 pos1, u32 pos2);
+
+compat_ssize_t compat_sys_readahead(int fd, u32 r4, u32 offset1, u32 offset2, u32 count);
+
+asmlinkage int compat_sys_truncate64(const char __user *path, u32 reg4,
+				     unsigned long len1, unsigned long len2);
+
+asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offset1, u32 offset2,
+				     u32 len1, u32 len2);
+
+asmlinkage int compat_sys_ftruncate64(unsigned int fd, u32 reg4, unsigned long len1,
+				      unsigned long len2);
+
+long ppc32_fadvise64(int fd, u32 unused, u32 offset1, u32 offset2,
+		     size_t len, int advice);
+
+asmlinkage long compat_sys_sync_file_range2(int fd, unsigned int flags,
+					    unsigned int offset1, unsigned int offset2,
+					    unsigned int nbytes1, unsigned int nbytes2);
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* __ASM_POWERPC_SYSCALLS_H */
-- 
2.31.1


^ permalink raw reply related

* [PATCH 3/6] KVM: PPC: Book3S PR: Declare kvmppc_handle_exit_pr()
From: Cédric Le Goater @ 2021-08-19 12:56 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Christophe Leroy, Cédric Le Goater
In-Reply-To: <20210819125656.14498-1-clg@kaod.org>

This fixes a compile error with W=1.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 arch/powerpc/kvm/book3s.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kvm/book3s.h b/arch/powerpc/kvm/book3s.h
index 740e51def5a5..c08f93b7f523 100644
--- a/arch/powerpc/kvm/book3s.h
+++ b/arch/powerpc/kvm/book3s.h
@@ -24,6 +24,7 @@ extern int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu,
 					int sprn, ulong *spr_val);
 extern int kvmppc_book3s_init_pr(void);
 extern void kvmppc_book3s_exit_pr(void);
+extern int kvmppc_handle_exit_pr(struct kvm_vcpu *vcpu, unsigned int exit_nr);
 
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 extern void kvmppc_emulate_tabort(struct kvm_vcpu *vcpu, int ra_val);
-- 
2.31.1


^ permalink raw reply related

* [PATCH 1/6] powerpc/prom: Introduce early_reserve_mem_old()
From: Cédric Le Goater @ 2021-08-19 12:56 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Christophe Leroy, Cédric Le Goater
In-Reply-To: <20210819125656.14498-1-clg@kaod.org>

and condition its call with IS_ENABLED(CONFIG_PPC32). This fixes a
compile error with W=1.

arch/powerpc/kernel/prom.c: In function ‘early_reserve_mem’:
arch/powerpc/kernel/prom.c:625:10: error: variable ‘reserve_map’ set but not used [-Werror=unused-but-set-variable]
  __be64 *reserve_map;
          ^~~~~~~~~~~
cc1: all warnings being treated as errors

Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

 Christophe, I think you had comments on this one ? Yes, I am being a bit lazy.

 arch/powerpc/kernel/prom.c | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index f620e04dc9bf..52869d12bc1d 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -621,27 +621,14 @@ static void __init early_reserve_mem_dt(void)
 	}
 }
 
-static void __init early_reserve_mem(void)
+static void __init early_reserve_mem_old(void)
 {
 	__be64 *reserve_map;
 
 	reserve_map = (__be64 *)(((unsigned long)initial_boot_params) +
 			fdt_off_mem_rsvmap(initial_boot_params));
 
-	/* Look for the new "reserved-regions" property in the DT */
-	early_reserve_mem_dt();
-
-#ifdef CONFIG_BLK_DEV_INITRD
-	/* Then reserve the initrd, if any */
-	if (initrd_start && (initrd_end > initrd_start)) {
-		memblock_reserve(ALIGN_DOWN(__pa(initrd_start), PAGE_SIZE),
-			ALIGN(initrd_end, PAGE_SIZE) -
-			ALIGN_DOWN(initrd_start, PAGE_SIZE));
-	}
-#endif /* CONFIG_BLK_DEV_INITRD */
-
-#ifdef CONFIG_PPC32
-	/* 
+	/*
 	 * Handle the case where we might be booting from an old kexec
 	 * image that setup the mem_rsvmap as pairs of 32-bit values
 	 */
@@ -659,9 +646,25 @@ static void __init early_reserve_mem(void)
 			DBG("reserving: %x -> %x\n", base_32, size_32);
 			memblock_reserve(base_32, size_32);
 		}
-		return;
 	}
-#endif
+}
+
+static void __init early_reserve_mem(void)
+{
+	/* Look for the new "reserved-regions" property in the DT */
+	early_reserve_mem_dt();
+
+#ifdef CONFIG_BLK_DEV_INITRD
+	/* Then reserve the initrd, if any */
+	if (initrd_start && (initrd_end > initrd_start)) {
+		memblock_reserve(ALIGN_DOWN(__pa(initrd_start), PAGE_SIZE),
+			ALIGN(initrd_end, PAGE_SIZE) -
+			ALIGN_DOWN(initrd_start, PAGE_SIZE));
+	}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
+	if (IS_ENABLED(CONFIG_PPC32))
+		early_reserve_mem_old();
 }
 
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
-- 
2.31.1


^ permalink raw reply related

* Re: [PATCH v2 0/2] Kconfig symbol fixes on powerpc
From: Christophe Leroy @ 2021-08-19 11:50 UTC (permalink / raw)
  To: Lukas Bulwahn, Paul Mackerras, Michael Ellerman,
	Benjamin Herrenschmidt, Michael Neuling, Anshuman Khandual,
	kvm-ppc, linuxppc-dev
  Cc: kernel-janitors, linux-kernel, stable
In-Reply-To: <20210819113954.17515-1-lukas.bulwahn@gmail.com>



Le 19/08/2021 à 13:39, Lukas Bulwahn a écrit :
> Dear powerpc maintainers,
> 
> The script ./scripts/checkkconfigsymbols.py warns on invalid references to
> Kconfig symbols (often, minor typos, name confusions or outdated references).
> 
> This patch series addresses all issues reported by
> ./scripts/checkkconfigsymbols.py in ./drivers/usb/ for Kconfig and Makefile
> files. Issues in the Kconfig and Makefile files indicate some shortcomings in
> the overall build definitions, and often are true actionable issues to address.
> 
> These issues can be identified and filtered by:
> 
>    ./scripts/checkkconfigsymbols.py | grep -E "arch/powerpc/.*(Kconfig|Makefile)" -B 1 -A 1
> 
> After applying this patch series on linux-next (next-20210817), the command
> above yields just two false positives (SHELL, r13) due to tool shortcomings.
> 
> As these two patches are fixes, please consider if they are suitable for
> backporting to stable.
> 
> v1 -> v2:
>    Followed Christophe Leroy's comment and drop the obsolete select.
> 


No need to change anything now, but as your two patches are completely independent, you could have 
submitted them separately. That would have avoided to resend both when changing the first one only.

^ permalink raw reply

* [PATCH v2 2/2] powerpc: rectify selection to ARCH_ENABLE_SPLIT_PMD_PTLOCK
From: Lukas Bulwahn @ 2021-08-19 11:39 UTC (permalink / raw)
  To: Paul Mackerras, Michael Ellerman, Benjamin Herrenschmidt,
	Michael Neuling, Anshuman Khandual, kvm-ppc, linuxppc-dev
  Cc: Lukas Bulwahn, kernel-janitors, stable, linux-kernel
In-Reply-To: <20210819113954.17515-1-lukas.bulwahn@gmail.com>

Commit 66f24fa766e3 ("mm: drop redundant ARCH_ENABLE_SPLIT_PMD_PTLOCK")
selects the non-existing config ARCH_ENABLE_PMD_SPLIT_PTLOCK in
./arch/powerpc/platforms/Kconfig.cputype, but clearly it intends to select
ARCH_ENABLE_SPLIT_PMD_PTLOCK here (notice the word swapping!), as this
commit does select that for all other architectures.

Rectify selection to ARCH_ENABLE_SPLIT_PMD_PTLOCK instead.

Fixes: 66f24fa766e3 ("mm: drop redundant ARCH_ENABLE_SPLIT_PMD_PTLOCK")
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
 arch/powerpc/platforms/Kconfig.cputype | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 6794145603de..a208997ade88 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -98,7 +98,7 @@ config PPC_BOOK3S_64
 	select PPC_HAVE_PMU_SUPPORT
 	select HAVE_ARCH_TRANSPARENT_HUGEPAGE
 	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
-	select ARCH_ENABLE_PMD_SPLIT_PTLOCK
+	select ARCH_ENABLE_SPLIT_PMD_PTLOCK
 	select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
 	select ARCH_SUPPORTS_HUGETLBFS
 	select ARCH_SUPPORTS_NUMA_BALANCING
-- 
2.26.2


^ permalink raw reply related

* [PATCH v2 0/2] Kconfig symbol fixes on powerpc
From: Lukas Bulwahn @ 2021-08-19 11:39 UTC (permalink / raw)
  To: Paul Mackerras, Michael Ellerman, Benjamin Herrenschmidt,
	Michael Neuling, Anshuman Khandual, kvm-ppc, linuxppc-dev
  Cc: Lukas Bulwahn, kernel-janitors, stable, linux-kernel

Dear powerpc maintainers,

The script ./scripts/checkkconfigsymbols.py warns on invalid references to
Kconfig symbols (often, minor typos, name confusions or outdated references).

This patch series addresses all issues reported by
./scripts/checkkconfigsymbols.py in ./drivers/usb/ for Kconfig and Makefile
files. Issues in the Kconfig and Makefile files indicate some shortcomings in
the overall build definitions, and often are true actionable issues to address.

These issues can be identified and filtered by:

  ./scripts/checkkconfigsymbols.py | grep -E "arch/powerpc/.*(Kconfig|Makefile)" -B 1 -A 1

After applying this patch series on linux-next (next-20210817), the command
above yields just two false positives (SHELL, r13) due to tool shortcomings.

As these two patches are fixes, please consider if they are suitable for
backporting to stable.

v1 -> v2:
  Followed Christophe Leroy's comment and drop the obsolete select.


Lukas

Lukas Bulwahn (2):
  powerpc: kvm: remove obsolete and unneeded select
  powerpc: rectify selection to ARCH_ENABLE_SPLIT_PMD_PTLOCK

 arch/powerpc/kvm/Kconfig               | 1 -
 arch/powerpc/platforms/Kconfig.cputype | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

-- 
2.26.2


^ permalink raw reply

* [PATCH v2 1/2] powerpc: kvm: remove obsolete and unneeded select
From: Lukas Bulwahn @ 2021-08-19 11:39 UTC (permalink / raw)
  To: Paul Mackerras, Michael Ellerman, Benjamin Herrenschmidt,
	Michael Neuling, Anshuman Khandual, kvm-ppc, linuxppc-dev
  Cc: Lukas Bulwahn, kernel-janitors, stable, linux-kernel
In-Reply-To: <20210819113954.17515-1-lukas.bulwahn@gmail.com>

Commit a278e7ea608b ("powerpc: Fix compile issue with force DAWR")
selects the non-existing config PPC_DAWR_FORCE_ENABLE for config
KVM_BOOK3S_64_HANDLER. As this commit also introduces a config PPC_DAWR
and this config PPC_DAWR is selected with PPC if PPC64, there is no
need for any further select in the KVM_BOOK3S_64_HANDLER.

Remove an obsolete and unneeded select in config KVM_BOOK3S_64_HANDLER.

The issue was identified with ./scripts/checkkconfigsymbols.py.

Fixes: a278e7ea608b ("powerpc: Fix compile issue with force DAWR")
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
 arch/powerpc/kvm/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index e45644657d49..ff581d70f20c 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -38,7 +38,6 @@ config KVM_BOOK3S_32_HANDLER
 config KVM_BOOK3S_64_HANDLER
 	bool
 	select KVM_BOOK3S_HANDLER
-	select PPC_DAWR_FORCE_ENABLE
 
 config KVM_BOOK3S_PR_POSSIBLE
 	bool
-- 
2.26.2


^ permalink raw reply related

* Re: [PATCH v2 04/12] powerpc/pseries/svm: Add a powerpc version of prot_guest_has()
From: Christoph Hellwig @ 2021-08-19  9:55 UTC (permalink / raw)
  To: Tom Lendacky
  Cc: Sathyanarayanan Kuppuswamy, linux-efi, Brijesh Singh, kvm,
	dri-devel, platform-driver-x86, Paul Mackerras, linux-s390,
	Andi Kleen, Joerg Roedel, x86, amd-gfx, linux-graphics-maintainer,
	Tianyu Lan, Borislav Petkov, kexec, linux-kernel, iommu,
	linux-fsdevel, linuxppc-dev
In-Reply-To: <000f627ce20c6504dd8d118d85bd69e7717b752f.1628873970.git.thomas.lendacky@amd.com>

On Fri, Aug 13, 2021 at 11:59:23AM -0500, Tom Lendacky wrote:
> +static inline bool prot_guest_has(unsigned int attr)

No reall need to have this inline.  In fact I'd suggest we havea the
prototype in a common header so that everyone must implement it out
of line.

^ permalink raw reply

* Re: [PATCH 2/2] powerpc: rectify selection to ARCH_ENABLE_SPLIT_PMD_PTLOCK
From: Anshuman Khandual @ 2021-08-19  9:56 UTC (permalink / raw)
  To: Lukas Bulwahn, Paul Mackerras, Michael Ellerman,
	Benjamin Herrenschmidt, Michael Neuling, kvm-ppc, linuxppc-dev
  Cc: kernel-janitors, linux-kernel, stable
In-Reply-To: <20210819093226.13955-3-lukas.bulwahn@gmail.com>



On 8/19/21 3:02 PM, Lukas Bulwahn wrote:
> Commit 66f24fa766e3 ("mm: drop redundant ARCH_ENABLE_SPLIT_PMD_PTLOCK")
> selects the non-existing config ARCH_ENABLE_PMD_SPLIT_PTLOCK in
> ./arch/powerpc/platforms/Kconfig.cputype, but clearly it intends to select
> ARCH_ENABLE_SPLIT_PMD_PTLOCK here (notice the word swapping!), as this
> commit does select that for all other architectures.

Right, indeed the words here got swapped. They look very similar and also
a cross compile would not even detect the problem because the non-existent
config option would simply evaluate to 0. Thanks for catching this.

> 
> Rectify selection to ARCH_ENABLE_SPLIT_PMD_PTLOCK instead.
> 
> Fixes: 66f24fa766e3 ("mm: drop redundant ARCH_ENABLE_SPLIT_PMD_PTLOCK")
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> ---
>  arch/powerpc/platforms/Kconfig.cputype | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
> index 6794145603de..a208997ade88 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -98,7 +98,7 @@ config PPC_BOOK3S_64
>  	select PPC_HAVE_PMU_SUPPORT
>  	select HAVE_ARCH_TRANSPARENT_HUGEPAGE
>  	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
> -	select ARCH_ENABLE_PMD_SPLIT_PTLOCK
> +	select ARCH_ENABLE_SPLIT_PMD_PTLOCK
>  	select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
>  	select ARCH_SUPPORTS_HUGETLBFS
>  	select ARCH_SUPPORTS_NUMA_BALANCING
> 

^ 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