LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v3 3/3] powerpc: Define and use MSR_RI only on non booke/40x
From: Christophe Leroy @ 2021-08-25  6:21 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras, npiggin
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <8735qyceev.fsf@mpe.ellerman.id.au>



Le 25/08/2021 à 06:54, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> 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>
>> ---
>> v3: Fixes kvm_emul.S and include <linux/bug.h> in <asm/reg.h>
>> ---
>>   arch/powerpc/include/asm/reg.h       |  5 +++++
>>   arch/powerpc/include/asm/reg_booke.h |  6 +++---
>>   arch/powerpc/kernel/head_32.h        |  4 ++++
>>   arch/powerpc/kernel/kvm_emul.S       | 13 +++++++++++++
>>   arch/powerpc/kernel/process.c        |  2 +-
>>   arch/powerpc/lib/sstep.c             |  2 +-
>>   6 files changed, 27 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
>> index be85cf156a1f..b270b570fb51 100644
>> --- a/arch/powerpc/include/asm/reg.h
>> +++ b/arch/powerpc/include/asm/reg.h
>> @@ -109,7 +109,12 @@
>>   #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 */
> 
> This breaks 64-bit BookE, which is using MSR_RI in bookehv_interrupts.S.
> 
> eg. ppc64_book3e_allmodconfig gives:
> 
>    arch/powerpc/kvm/bookehv_interrupts.S: Assembler messages:
>    arch/powerpc/kvm/bookehv_interrupts.S:221: Error: invalid operands (*ABS* and *UND* sections) for `|'
>    etc.

Oops, I missed that one. Should be easy to fix though as this file is dedicated to BOOKE we can just 
remove MSR_RI from there.

> 
> ISA v2.07B says MSR_RI is Book3S only, but looking at the e500mc manual
> it does have bit 62 defined as RI.

Oh !

So it makes the story different, even different than what we have in kernel today where everything 
is more or less based on CONFIG_BOOKE or CONFIG_40x.

> 
> I can fix it with:
> 
> +#if !(defined(CONFIG_BOOKE) && !defined(CONFIG_PPC_BOOK3E)) && !defined(CONFIG_40x)
>   #define MSR_RI         __MASK(MSR_RI_LG)       /* Recoverable Exception */

Why CONFIG_PPC_BOOK3E ? Shouldn't it be CONFIG_PPC_E500MC instead ?

> 
> 
> But that's getting really ugly, and we'd have to repeat it elsewhere.
> 
> I think we need a kconfig symbol that captures which platforms should
> use MSR_RI, something like:
> 
>    CONFIG PPC_MSR_RI
>      def_bool y
>      depends on !40x && (!BOOKE || PPC_BOOK3E)


Yes I think that would be the best.


> 
> 
> Or maybe we should just define MSR_RI to 0 for platforms that don't use
> it, to avoid so much ifdefing?
> 

Well, I tried to take the same approach as Ben in the original patch 
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/61ad3646674e6bf541a8f7fb420cdf556d0b2152.camel@kernel.crashing.org/
but with a smoother approach for C files to avoid ifdefs there.

However for ASM it is different, we can't use tricks like BUILD_BUG. When we had MSR_RI completely 
undefined on all booke it was rather easy, only a few #ifdefs needed in parts common to 3S and 3E. 
But if we bring back MSR_RI on the e500mc that becomes more complex, and I agree with you too many 
#ifdefs will be unfriendly.

On the other hand, setting MSR_RI to 0 will make all tests that check msr & MSR_RI fails during run. 
Isn't it worse than what we have today ?

Maybe the way out is to carrefully look at the situations where e500mc uses MSR_RI, because 
according to the reference manual it is limited to a few situations:

4.4 Recoverability and MSR[RI]
MSR[RI] is an MSR (and save/restore register) storage bit for compatibility with pre-Book E PowerPC
processors. When an interrupt occurs, the recoverable interrupt bit, MSR[RI] is unchanged by the 
interrupt
mechanism when a new MSR is established; however, when a machine check, error report or NMI
interrupt occurs, MSR[RI] is cleared.
If used properly, RI determines whether an interrupt that is taken at the machine check interrupt 
vector can
be safely returned from (that is, that architected state set by the interrupt mechanism has been 
safely stored
by software). RI should be set by software when all MSR values are first established. When an interrupt
occurs that is taken at the machine check interrupt vector, software should set RI when it has 
safely stored
MCSRR0 and MCSRR1. The associated MCSRR1 bit should be checked to determine whether the
interrupt occurred when another machine check interrupt was being processed and before state was
successfully saved. If MCSRR1[RI] is set, it is safe to return when processing is complete.

So, let's think about it.

By the way patch 2 of the series could go now, it doesn't introduces anything new, it only cleans up 
things a bit.

Christophe

^ permalink raw reply

* [PATCH linux-next] drivers:smu: fix warning comparing pointer to 0
From: CGEL @ 2021-08-25  6:18 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Jing Yangyang, Wang Wensheng, linux-kernel, Qinglang Miao,
	linuxppc-dev, Zeal Robot

From: Jing Yangyang <jing.yangyang@zte.com.cn>

Fix the following coccicheck warning:
./drivers/macintosh/smu.c:1089: 11-12:
 WARNING comparing pointer to 0, suggest !E
./drivers/macintosh/smu.c:1256:11-12:
WARNING comparing pointer to 0

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
---
 drivers/macintosh/smu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 94fb63a..6cd0fef 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -1086,7 +1086,7 @@ static int smu_open(struct inode *inode, struct file *file)
 	unsigned long flags;
 
 	pp = kzalloc(sizeof(struct smu_private), GFP_KERNEL);
-	if (pp == 0)
+	if (!pp)
 		return -ENOMEM;
 	spin_lock_init(&pp->lock);
 	pp->mode = smu_file_commands;
@@ -1253,7 +1253,7 @@ static __poll_t smu_fpoll(struct file *file, poll_table *wait)
 	__poll_t mask = 0;
 	unsigned long flags;
 
-	if (pp == 0)
+	if (!pp)
 		return 0;
 
 	if (pp->mode == smu_file_commands) {
@@ -1276,7 +1276,7 @@ static int smu_release(struct inode *inode, struct file *file)
 	unsigned long flags;
 	unsigned int busy;
 
-	if (pp == 0)
+	if (!pp)
 		return 0;
 
 	file->private_data = NULL;
-- 
1.8.3.1



^ permalink raw reply related

* Re: [PATCH v3 1/3] powerpc: Remove MSR_PR check in interrupt_exit_{user/kernel}_prepare()
From: Christophe Leroy @ 2021-08-25  5:45 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras, npiggin
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <87zgt6aybp.fsf@mpe.ellerman.id.au>



Le 25/08/2021 à 07:27, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> 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(-)
> 
> I'll pick this one up independent of the other two patches.
> 

Second patch should be ok as well, no ?

Christophe

^ permalink raw reply

* Re: [PATCH v3 1/3] powerpc: Remove MSR_PR check in interrupt_exit_{user/kernel}_prepare()
From: Michael Ellerman @ 2021-08-25  5:27 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras, npiggin
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <385ead49ccb66a259b25fee3eebf0bd4094068f3.1629707037.git.christophe.leroy@csgroup.eu>

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> 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(-)

I'll pick this one up independent of the other two patches.

cheers

^ permalink raw reply

* Re: [PATCH v3 3/3] powerpc: Define and use MSR_RI only on non booke/40x
From: Michael Ellerman @ 2021-08-25  4:54 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras, npiggin
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <627ead32d40c840f9e8a329b60647b649eceb2aa.1629707037.git.christophe.leroy@csgroup.eu>

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> 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>
> ---
> v3: Fixes kvm_emul.S and include <linux/bug.h> in <asm/reg.h>
> ---
>  arch/powerpc/include/asm/reg.h       |  5 +++++
>  arch/powerpc/include/asm/reg_booke.h |  6 +++---
>  arch/powerpc/kernel/head_32.h        |  4 ++++
>  arch/powerpc/kernel/kvm_emul.S       | 13 +++++++++++++
>  arch/powerpc/kernel/process.c        |  2 +-
>  arch/powerpc/lib/sstep.c             |  2 +-
>  6 files changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
> index be85cf156a1f..b270b570fb51 100644
> --- a/arch/powerpc/include/asm/reg.h
> +++ b/arch/powerpc/include/asm/reg.h
> @@ -109,7 +109,12 @@
>  #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 */

This breaks 64-bit BookE, which is using MSR_RI in bookehv_interrupts.S.

eg. ppc64_book3e_allmodconfig gives:

  arch/powerpc/kvm/bookehv_interrupts.S: Assembler messages:
  arch/powerpc/kvm/bookehv_interrupts.S:221: Error: invalid operands (*ABS* and *UND* sections) for `|'
  etc.

ISA v2.07B says MSR_RI is Book3S only, but looking at the e500mc manual
it does have bit 62 defined as RI.

I can fix it with:

+#if !(defined(CONFIG_BOOKE) && !defined(CONFIG_PPC_BOOK3E)) && !defined(CONFIG_40x)
 #define MSR_RI         __MASK(MSR_RI_LG)       /* Recoverable Exception */


But that's getting really ugly, and we'd have to repeat it elsewhere.

I think we need a kconfig symbol that captures which platforms should
use MSR_RI, something like:

  CONFIG PPC_MSR_RI
    def_bool y
    depends on !40x && (!BOOKE || PPC_BOOK3E)


Or maybe we should just define MSR_RI to 0 for platforms that don't use
it, to avoid so much ifdefing?

cheers

^ permalink raw reply

* Re: [PATCH 2/3] trace: refactor TRACE_IRQFLAGS_SUPPORT in Kconfig
From: Palmer Dabbelt @ 2021-08-25  3:49 UTC (permalink / raw)
  To: masahiroy
  Cc: mark.rutland, dalias, linux-sh, peterz, catalin.marinas,
	linus.walleij, viresh.kumar, linux-kernel, James.Bottomley,
	jcmvbkbc, guoren, linux-csky, hpa, sparclinux, linux-riscv,
	deanbo422, will, ardb, paulus, anton.ivanov, jonas, linux-s390,
	gor, ysato, krzysztof.kozlowski, yifeifz2, richard, masahiroy,
	x86, linux, ley.foon.tan, borntraeger, mingo, geert, linux-parisc,
	samitolvanen, u.kleine-koenig, shorne, linux-snps-arc, jdike,
	linux-xtensa, aou, keescook, Arnd Bergmann, anshuman.khandual,
	hca, linux-um, rostedt, stefan.kristiansson, openrisc, bp,
	green.hu, Paul Walmsley, tglx, linux-arm-kernel, andreyknvl,
	chris, monstr, tsbogend, bcain, nickhu, vgupta, npiggin,
	linux-mips, davem, frederic, linux-hexagon, colin.king, akpm,
	linuxppc-dev, deller, rppt
In-Reply-To: <20210731052233.4703-2-masahiroy@kernel.org>

On Fri, 30 Jul 2021 22:22:32 PDT (-0700), masahiroy@kernel.org wrote:
> Make architectures select TRACE_IRQFLAGS_SUPPORT instead of
> having many defines.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
>  arch/riscv/Kconfig            | 4 +---

Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>

Thanks!

^ permalink raw reply

* [PATCH] powerpc/doc: Fix htmldocs errors
From: Aneesh Kumar K.V @ 2021-08-25  4:24 UTC (permalink / raw)
  To: linuxppc-dev, mpe; +Cc: Aneesh Kumar K.V, Stephen Rothwell, Jonathan Corbet

Fix make htmldocs related errors with the newly added associativity.rst
doc file.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 Documentation/powerpc/associativity.rst | 29 +++++++++++++------------
 Documentation/powerpc/index.rst         |  1 +
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/Documentation/powerpc/associativity.rst b/Documentation/powerpc/associativity.rst
index 07e7dd3d6c87..4d01c7368561 100644
--- a/Documentation/powerpc/associativity.rst
+++ b/Documentation/powerpc/associativity.rst
@@ -1,6 +1,6 @@
 ============================
 NUMA resource associativity
-=============================
+============================
 
 Associativity represents the groupings of the various platform resources into
 domains of substantially similar mean performance relative to resources outside
@@ -20,11 +20,11 @@ A value of 1 indicates the usage of Form 1 associativity. For Form 2 associativi
 bit 2 of byte 5 in the "ibm,architecture-vec-5" property is used.
 
 Form 0
------
+------
 Form 0 associativity supports only two NUMA distances (LOCAL and REMOTE).
 
 Form 1
------
+------
 With Form 1 a combination of ibm,associativity-reference-points, and ibm,associativity
 device tree properties are used to determine the NUMA distance between resource groups/domains.
 
@@ -78,17 +78,18 @@ numa-lookup-index-table.
 
 For ex:
 ibm,numa-lookup-index-table = <3 0 8 40>;
-ibm,numa-distace-table = <9>, /bits/ 8 < 10  20  80
-					 20  10 160
-					 80 160  10>;
-  | 0    8   40
---|------------
-  |
-0 | 10   20  80
-  |
-8 | 20   10  160
-  |
-40| 80   160  10
+ibm,numa-distace-table = <9>, /bits/ 8 < 10  20  80 20  10 160 80 160  10>;
+
+::
+
+	  | 0    8   40
+	--|------------
+	  |
+	0 | 10   20  80
+	  |
+	8 | 20   10  160
+	  |
+	40| 80   160  10
 
 A possible "ibm,associativity" property for resources in node 0, 8 and 40
 
diff --git a/Documentation/powerpc/index.rst b/Documentation/powerpc/index.rst
index bf5f1a2bdbdf..0f7d3c495693 100644
--- a/Documentation/powerpc/index.rst
+++ b/Documentation/powerpc/index.rst
@@ -7,6 +7,7 @@ powerpc
 .. toctree::
     :maxdepth: 1
 
+    associativity
     booting
     bootwrapper
     cpu_families
-- 
2.31.1


^ permalink raw reply related

* Re: [PATCH] arch: vdso: remove if-conditionals of $(c-gettimeofday-y)
From: Palmer Dabbelt @ 2021-08-25  3:49 UTC (permalink / raw)
  To: masahiroy
  Cc: tsbogend, masahiroy, linuxppc-dev, linux-kernel, linux-mips,
	Paul Walmsley, aou, paulus, luto, catalin.marinas, linux, tglx,
	vincenzo.frascino, will, linux-riscv, linux-arm-kernel
In-Reply-To: <20210731055733.12332-1-masahiroy@kernel.org>

On Fri, 30 Jul 2021 22:57:33 PDT (-0700), masahiroy@kernel.org wrote:
> arm, arm64, mips, powerpc always select GENERIC_GETTIMEOFDAY, hence
> $(gettimeofday-y) never becomes empty.
>
> riscv conditionally selects GENERIC_GETTIMEOFDAY when MMU=y && 64BIT=y,
> but arch/riscv/kernel/vdso/vgettimeofday.o is built only under that
> condition. So, you can always define CFLAGS_vgettimeofday.o
>
> Remove all the meaningless conditionals.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
>  arch/riscv/kernel/vdso/Makefile     |  5 +----

Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>

^ permalink raw reply

* Re: [PATCH v2 RESEND] powerpc/audit: Convert powerpc to AUDIT_ARCH_COMPAT_GENERIC
From: Paul Moore @ 2021-08-24 23:01 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: linux-kernel, Eric Paris, linux-audit, Paul Mackerras,
	linuxppc-dev
In-Reply-To: <5a2692b6-5077-21b4-8ebf-73b1c2b83a40@csgroup.eu>

On Tue, Aug 24, 2021 at 1:11 PM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
> Le 24/08/2021 à 16:47, Paul Moore a écrit :
> > On Tue, Aug 24, 2021 at 9:36 AM Christophe Leroy
> > <christophe.leroy@csgroup.eu> wrote:
> >>
> >> Commit e65e1fc2d24b ("[PATCH] syscall class hookup for all normal
> >> targets") added generic support for AUDIT but that didn't include
> >> support for bi-arch like powerpc.
> >>
> >> Commit 4b58841149dc ("audit: Add generic compat syscall support")
> >> added generic support for bi-arch.
> >>
> >> Convert powerpc to that bi-arch generic audit support.
> >>
> >> Cc: Paul Moore <paul@paul-moore.com>
> >> Cc: Eric Paris <eparis@redhat.com>
> >> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> >> ---
> >> Resending v2 with Audit people in Cc
> >>
> >> v2:
> >> - Missing 'git add' for arch/powerpc/include/asm/unistd32.h
> >> - Finalised commit description
> >> ---
> >>   arch/powerpc/Kconfig                |  5 +-
> >>   arch/powerpc/include/asm/unistd32.h |  7 +++
> >>   arch/powerpc/kernel/Makefile        |  3 --
> >>   arch/powerpc/kernel/audit.c         | 84 -----------------------------
> >>   arch/powerpc/kernel/compat_audit.c  | 44 ---------------
> >>   5 files changed, 8 insertions(+), 135 deletions(-)
> >>   create mode 100644 arch/powerpc/include/asm/unistd32.h
> >>   delete mode 100644 arch/powerpc/kernel/audit.c
> >>   delete mode 100644 arch/powerpc/kernel/compat_audit.c
> >
> > Can you explain, in detail please, the testing you have done to verify
> > this patch?
> >
>
> I built ppc64_defconfig and checked that the generated code is functionnaly equivalent.
>
> ppc32_classify_syscall() is exactly the same as audit_classify_compat_syscall() except that the
> later takes the syscall as second argument (ie in r4) whereas the former takes it as first argument
> (ie in r3).
>
> audit_classify_arch() and powerpc audit_classify_syscall() are slightly different between the
> powerpc version and the generic version because the powerpc version checks whether it is
> AUDIT_ARCH_PPC or not (ie value 20), while the generic one checks whether it has bit
> __AUDIT_ARCH_64BIT set or not (__AUDIT_ARCH_64BIT is the sign bit of a word), but taking into
> account that the abi is either AUDIT_ARCH_PPC, AUDIT_ARCH_PPC64 or AUDIT_ARCH_PPC64LE, the result is
> the same.
>
> If you are asking I guess you saw something wrong ?

I was asking because I didn't see any mention of testing, and when you
are enabling something significant like this it is nice to see that it
has been verified to work :)

While binary dumps and comparisons are nice, it is always good to see
verification from a test suite.  I don't have access to the necessary
hardware to test this, but could you verify that the audit-testsuite
passes on your test system with your patches applied?

 * https://github.com/linux-audit/audit-testsuite

-- 
paul moore
www.paul-moore.com

^ permalink raw reply

* Re: [PATCH v2 1/3] powerpc/pseries: Parse control memory access error
From: Segher Boessenkool @ 2021-08-24 21:24 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, mikey, Ganesh Goudar, mahesh, npiggin
In-Reply-To: <87eeajcpmq.fsf@mpe.ellerman.id.au>

On Tue, Aug 24, 2021 at 04:39:57PM +1000, Michael Ellerman wrote:
> > +		case MC_ERROR_CTRL_MEM_ACCESS_PTABLE_WALK:
> > +			mce_err.u.ra_error_type =
> > +				MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN;
> 
> That name is ridiculously long, but I guess that's not your fault :)
> We can fix it up in a later patch.

It also has surprisingly little information content for the 47 chars
length it has :-)  What does this even mean?!


Segher

^ permalink raw reply

* [GIT PULL] retire legacy WR sbc8548 and sbc8641 platforms
From: Paul Gortmaker @ 2021-08-24 17:42 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Scott Wood, Paul Mackerras, linuxppc-dev, linux-kernel

This is unchanged from the original wr_sbc-delete branch sent in January,
other than to add the Acks from Scott in July, and update the baseline.

Built with ppc64 defconfig and mpc85xx_cds_defconfig and mpc86xx_defconfig
just to make sure I didn't fat finger anything in the baseline update.

Original v1 text follows below, from:

https://lore.kernel.org/lkml/20210111082823.99562-1-paul.gortmaker@windriver.com

It would be nice to get this in and off our collective to-do list.

Thanks,
Paul.

  ---

In v2.6.27 (2008, 917f0af9e5a9) the sbc8260 support was implicitly
retired by not being carried forward through the ppc --> powerpc
device tree transition.

Then, in v3.6 (2012, b048b4e17cbb) we retired the support for the
sbc8560 boards.

Next, in v4.18 (2017, 3bc6cf5a86e5) we retired the support for the
2006 vintage sbc834x boards.

The sbc8548 and sbc8641d boards were maybe 1-2 years newer than the
sbc834x boards, but it is also 3+ years later, so it makes sense to
now retire them as well - which is what is done here.

These two remaining WR boards were based on the Freescale MPC8548-CDS
and the MPC8641D-HPCN reference board implementations.  Having had the
chance to use these and many other Fsl ref boards, I know this:  The
Freescale reference boards were typically produced in limited quantity
and primarily available to BSP developers and hardware designers, and
not likely to have found a 2nd life with hobbyists and/or collectors.

It was good to have that BSP code subjected to mainline review and
hence also widely available back in the day. But given the above, we
should probably also be giving serious consideration to retiring
additional similar age/type reference board platforms as well.

I've always felt it is important for us to be proactive in retiring
old code, since it has a genuine non-zero carrying cost, as described
in the 930d52c012b8 merge log.  But for the here and now, we just
clean up the remaining BSP code that I had added for SBC platforms.

--- 

The following changes since commit e22ce8eb631bdc47a4a4ea7ecf4e4ba499db4f93:

  Linux 5.14-rc7 (2021-08-22 14:24:56 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux.git wr_sbc-delete-v2

for you to fetch changes up to d44e2dc12ea2112e74cdd25090eeda2727ed09cc:

  MAINTAINERS: update for Paul Gortmaker (2021-08-24 08:19:01 -0400)

----------------------------------------------------------------
Paul Gortmaker (3):
      powerpc: retire sbc8548 board support
      powerpc: retire sbc8641d board support
      MAINTAINERS: update for Paul Gortmaker

 MAINTAINERS                                 |   1 -
 arch/powerpc/boot/Makefile                  |   1 -
 arch/powerpc/boot/dts/fsl/sbc8641d.dts      | 176 -----------------
 arch/powerpc/boot/dts/sbc8548-altflash.dts  | 111 -----------
 arch/powerpc/boot/dts/sbc8548-post.dtsi     | 289 ----------------------------
 arch/powerpc/boot/dts/sbc8548-pre.dtsi      |  48 -----
 arch/powerpc/boot/dts/sbc8548.dts           | 106 ----------
 arch/powerpc/boot/wrapper                   |   2 +-
 arch/powerpc/configs/85xx/sbc8548_defconfig |  50 -----
 arch/powerpc/configs/mpc85xx_base.config    |   1 -
 arch/powerpc/configs/mpc86xx_base.config    |   1 -
 arch/powerpc/configs/ppc6xx_defconfig       |   1 -
 arch/powerpc/platforms/85xx/Kconfig         |   6 -
 arch/powerpc/platforms/85xx/Makefile        |   1 -
 arch/powerpc/platforms/85xx/sbc8548.c       | 134 -------------
 arch/powerpc/platforms/86xx/Kconfig         |   8 +-
 arch/powerpc/platforms/86xx/Makefile        |   1 -
 arch/powerpc/platforms/86xx/sbc8641d.c      |  87 ---------
 18 files changed, 2 insertions(+), 1022 deletions(-)
 delete mode 100644 arch/powerpc/boot/dts/fsl/sbc8641d.dts
 delete mode 100644 arch/powerpc/boot/dts/sbc8548-altflash.dts
 delete mode 100644 arch/powerpc/boot/dts/sbc8548-post.dtsi
 delete mode 100644 arch/powerpc/boot/dts/sbc8548-pre.dtsi
 delete mode 100644 arch/powerpc/boot/dts/sbc8548.dts
 delete mode 100644 arch/powerpc/configs/85xx/sbc8548_defconfig
 delete mode 100644 arch/powerpc/platforms/85xx/sbc8548.c
 delete mode 100644 arch/powerpc/platforms/86xx/sbc8641d.c

^ permalink raw reply

* Re: [PATCH v3] powerpc/booke: Avoid link stack corruption in several places
From: Segher Boessenkool @ 2021-08-24 17:15 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: Paul Mackerras, linuxppc-dev, linux-kernel
In-Reply-To: <e9fbc285eceb720e6c0e032ef47fe8b05f669b48.1629791751.git.christophe.leroy@csgroup.eu>

Hi!

On Tue, Aug 24, 2021 at 07:56:26AM +0000, Christophe Leroy wrote:
> Use bcl 20,31,+4 instead of bl in order to preserve link stack.

You use $+4 actually, which is clearer than .+4 or just +4 (and I am
surprised that the latter even works btw, I never knew :-) -- either
way it looks like a typo).

> -	bl	invstr				/* Find our address */
> +	bcl	20,31,$+4			/* Find our address */
>  invstr:	mflr	r6				/* Make it accessible */

You can remove the label now.  This isn't true in all cases, but here
you can (all times it is called "invstr").

> @@ -85,7 +85,7 @@ skpinv:	addi	r6,r6,1				/* Increment */
>  	addi	r6,r6,10
>  	slw	r6,r8,r6	/* convert to mask */
>  
> -	bl	1f		/* Find our address */
> +	bcl	20,31,$+4	/* Find our address */
>  1:	mflr	r7

Here, too.

> @@ -1045,7 +1045,7 @@ head_start_47x:
>  	sync
>  
>  	/* Find the entry we are running from */
> -	bl	1f
> +	bcl	20,31,$+4
>  1:	mflr	r23
>  	tlbsx	r23,0,r23
>  	tlbre	r24,r23,0

And here.

> @@ -1132,7 +1132,7 @@ _GLOBAL(switch_to_as1)
>  	bne	1b
>  
>  	/* Get the tlb entry used by the current running code */
> -	bl	0f
> +	bcl	20,31,$+4
>  0:	mflr	r4
>  	tlbsx	0,r4

> @@ -1166,7 +1166,7 @@ _GLOBAL(switch_to_as1)
>  _GLOBAL(restore_to_as0)
>  	mflr	r0
>  
> -	bl	0f
> +	bcl	20,31,$+4
>  0:	mflr	r9
>  	addi	r9,r9,1f - 0b

And these.

> --- a/arch/powerpc/mm/nohash/tlb_low.S
> +++ b/arch/powerpc/mm/nohash/tlb_low.S
> @@ -199,7 +199,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_476_DD2)
>   * Touch enough instruction cache lines to ensure cache hits
>   */
>  1:	mflr	r9
> -	bl	2f
> +	bcl	20,31,$+4
>  2:	mflr	r6
>  	li	r7,32
>  	PPC_ICBT(0,R6,R7)		/* touch next cache line */
> @@ -414,7 +414,7 @@ _GLOBAL(loadcam_multi)
>  	 * Set up temporary TLB entry that is the same as what we're
>  	 * running from, but in AS=1.
>  	 */
> -	bl	1f
> +	bcl	20,31,$+4
>  1:	mflr	r6
>  	tlbsx	0,r8
>  	mfspr	r6,SPRN_MAS1

And these too.

There does not see to be a warning for usused local labels, it would be
useful in this case :-)


Segher

^ permalink raw reply

* Re: [PATCH v2 RESEND] powerpc/audit: Convert powerpc to AUDIT_ARCH_COMPAT_GENERIC
From: Christophe Leroy @ 2021-08-24 17:11 UTC (permalink / raw)
  To: Paul Moore
  Cc: linux-kernel, Eric Paris, linux-audit, Paul Mackerras,
	linuxppc-dev
In-Reply-To: <CAHC9VhR3E6=5HmRaWMWbp4WHsua02niwnzaRGM3tLqd4Y4LA6w@mail.gmail.com>



Le 24/08/2021 à 16:47, Paul Moore a écrit :
> On Tue, Aug 24, 2021 at 9:36 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>>
>> Commit e65e1fc2d24b ("[PATCH] syscall class hookup for all normal
>> targets") added generic support for AUDIT but that didn't include
>> support for bi-arch like powerpc.
>>
>> Commit 4b58841149dc ("audit: Add generic compat syscall support")
>> added generic support for bi-arch.
>>
>> Convert powerpc to that bi-arch generic audit support.
>>
>> Cc: Paul Moore <paul@paul-moore.com>
>> Cc: Eric Paris <eparis@redhat.com>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>> Resending v2 with Audit people in Cc
>>
>> v2:
>> - Missing 'git add' for arch/powerpc/include/asm/unistd32.h
>> - Finalised commit description
>> ---
>>   arch/powerpc/Kconfig                |  5 +-
>>   arch/powerpc/include/asm/unistd32.h |  7 +++
>>   arch/powerpc/kernel/Makefile        |  3 --
>>   arch/powerpc/kernel/audit.c         | 84 -----------------------------
>>   arch/powerpc/kernel/compat_audit.c  | 44 ---------------
>>   5 files changed, 8 insertions(+), 135 deletions(-)
>>   create mode 100644 arch/powerpc/include/asm/unistd32.h
>>   delete mode 100644 arch/powerpc/kernel/audit.c
>>   delete mode 100644 arch/powerpc/kernel/compat_audit.c
> 
> Can you explain, in detail please, the testing you have done to verify
> this patch?
> 

I built ppc64_defconfig and checked that the generated code is functionnaly equivalent.

ppc32_classify_syscall() is exactly the same as audit_classify_compat_syscall() except that the 
later takes the syscall as second argument (ie in r4) whereas the former takes it as first argument 
(ie in r3).

audit_classify_arch() and powerpc audit_classify_syscall() are slightly different between the 
powerpc version and the generic version because the powerpc version checks whether it is 
AUDIT_ARCH_PPC or not (ie value 20), while the generic one checks whether it has bit 
__AUDIT_ARCH_64BIT set or not (__AUDIT_ARCH_64BIT is the sign bit of a word), but taking into 
account that the abi is either AUDIT_ARCH_PPC, AUDIT_ARCH_PPC64 or AUDIT_ARCH_PPC64LE, the result is 
the same.

If you are asking I guess you saw something wrong ?


arch/powerpc/kernel/compat_audit.o:     file format elf64-powerpc


Disassembly of section .text:

0000000000000000 <.ppc32_classify_syscall>:
    0:	28 03 00 66 	cmplwi  r3,102
    4:	7c 69 1b 78 	mr      r9,r3
    8:	41 82 00 48 	beq     50 <.ppc32_classify_syscall+0x50>
    c:	41 81 00 24 	bgt     30 <.ppc32_classify_syscall+0x30>
   10:	28 03 00 05 	cmplwi  r3,5
   14:	38 60 00 02 	li      r3,2
   18:	4d 82 00 20 	beqlr
   1c:	28 09 00 0b 	cmplwi  r9,11
   20:	40 82 00 38 	bne     58 <.ppc32_classify_syscall+0x58>
   24:	38 60 00 05 	li      r3,5
   28:	4e 80 00 20 	blr
   2c:	60 00 00 00 	nop
   30:	28 03 01 1e 	cmplwi  r3,286
   34:	38 60 00 01 	li      r3,1
   38:	4c 82 00 20 	bnelr
   3c:	38 60 00 03 	li      r3,3
   40:	4e 80 00 20 	blr
   44:	60 00 00 00 	nop
   48:	60 00 00 00 	nop
   4c:	60 00 00 00 	nop
   50:	38 60 00 04 	li      r3,4
   54:	4e 80 00 20 	blr
   58:	38 60 00 01 	li      r3,1
   5c:	4e 80 00 20 	blr


lib/compat_audit.o:     file format elf64-powerpc


Disassembly of section .text:

0000000000000000 <.audit_classify_compat_syscall>:
    0:	28 04 00 66 	cmplwi  r4,102
    4:	41 82 00 4c 	beq     50 <.audit_classify_compat_syscall+0x50>
    8:	41 81 00 28 	bgt     30 <.audit_classify_compat_syscall+0x30>
    c:	28 04 00 05 	cmplwi  r4,5
   10:	38 60 00 02 	li      r3,2
   14:	4d 82 00 20 	beqlr
   18:	28 04 00 0b 	cmplwi  r4,11
   1c:	40 82 00 3c 	bne     58 <.audit_classify_compat_syscall+0x58>
   20:	38 60 00 05 	li      r3,5
   24:	4e 80 00 20 	blr
   28:	60 00 00 00 	nop
   2c:	60 00 00 00 	nop
   30:	28 04 01 1e 	cmplwi  r4,286
   34:	38 60 00 01 	li      r3,1
   38:	4c 82 00 20 	bnelr
   3c:	38 60 00 03 	li      r3,3
   40:	4e 80 00 20 	blr
   44:	60 00 00 00 	nop
   48:	60 00 00 00 	nop
   4c:	60 00 00 00 	nop
   50:	38 60 00 04 	li      r3,4
   54:	4e 80 00 20 	blr
   58:	38 60 00 01 	li      r3,1
   5c:	4e 80 00 20 	blr


arch/powerpc/kernel/audit.o:     file format elf64-powerpc


Disassembly of section .text:

0000000000000000 <.audit_classify_arch>:
    0:	68 63 00 14 	xori    r3,r3,20
    4:	7c 63 00 34 	cntlzw  r3,r3
    8:	54 63 d9 7e 	rlwinm  r3,r3,27,5,31
    c:	4e 80 00 20 	blr

0000000000000010 <.audit_classify_syscall>:
   10:	2c 03 00 14 	cmpwi   r3,20
   14:	41 82 00 5c 	beq     70 <.audit_classify_syscall+0x60>
   18:	28 04 00 66 	cmplwi  r4,102
   1c:	41 82 00 44 	beq     60 <.audit_classify_syscall+0x50>
   20:	41 81 00 20 	bgt     40 <.audit_classify_syscall+0x30>
   24:	28 04 00 05 	cmplwi  r4,5
   28:	38 60 00 02 	li      r3,2
   2c:	4d 82 00 20 	beqlr
   30:	28 04 00 0b 	cmplwi  r4,11
   34:	40 82 00 64 	bne     98 <.audit_classify_syscall+0x88>
   38:	38 60 00 05 	li      r3,5
   3c:	4e 80 00 20 	blr
   40:	28 04 01 1e 	cmplwi  r4,286
   44:	38 60 00 00 	li      r3,0
   48:	4c 82 00 20 	bnelr
   4c:	38 60 00 03 	li      r3,3
   50:	4e 80 00 20 	blr
   54:	60 00 00 00 	nop
   58:	60 00 00 00 	nop
   5c:	60 00 00 00 	nop
   60:	38 60 00 04 	li      r3,4
   64:	4e 80 00 20 	blr
   68:	60 00 00 00 	nop
   6c:	60 00 00 00 	nop
   70:	7c 08 02 a6 	mflr    r0
   74:	7c 83 23 78 	mr      r3,r4
   78:	f8 01 00 10 	std     r0,16(r1)
   7c:	f8 21 ff 91 	stdu    r1,-112(r1)
   80:	48 00 00 01 	bl      80 <.audit_classify_syscall+0x70>
			80: R_PPC64_REL24	.ppc32_classify_syscall
   84:	60 00 00 00 	nop
   88:	38 21 00 70 	addi    r1,r1,112
   8c:	e8 01 00 10 	ld      r0,16(r1)
   90:	7c 08 03 a6 	mtlr    r0
   94:	4e 80 00 20 	blr
   98:	38 60 00 00 	li      r3,0
   9c:	4e 80 00 20 	blr

Disassembly of section .init.text:

0000000000000000 <.audit_classes_init>:
    0:	7c 08 02 a6 	mflr    r0
    4:	fb e1 ff f8 	std     r31,-8(r1)
    8:	3d 22 00 00 	addis   r9,r2,0
			a: R_PPC64_TOC16_HA	.toc
    c:	38 60 00 07 	li      r3,7
   10:	e8 89 00 00 	ld      r4,0(r9)
			12: R_PPC64_TOC16_LO_DS	.toc
   14:	3f e2 00 00 	addis   r31,r2,0
			16: R_PPC64_TOC16_HA	.data
   18:	3b ff 00 00 	addi    r31,r31,0
			1a: R_PPC64_TOC16_LO	.data
   1c:	f8 01 00 10 	std     r0,16(r1)
   20:	f8 21 ff 81 	stdu    r1,-128(r1)
   24:	48 00 00 01 	bl      24 <.audit_classes_init+0x24>
			24: R_PPC64_REL24	.audit_register_class
   28:	60 00 00 00 	nop
   2c:	3d 22 00 00 	addis   r9,r2,0
			2e: R_PPC64_TOC16_HA	.toc+0x8
   30:	38 60 00 05 	li      r3,5
   34:	e8 89 00 00 	ld      r4,0(r9)
			36: R_PPC64_TOC16_LO_DS	.toc+0x8
   38:	48 00 00 01 	bl      38 <.audit_classes_init+0x38>
			38: R_PPC64_REL24	.audit_register_class
   3c:	60 00 00 00 	nop
   40:	3d 22 00 00 	addis   r9,r2,0
			42: R_PPC64_TOC16_HA	.toc+0x10
   44:	38 60 00 01 	li      r3,1
   48:	e8 89 00 00 	ld      r4,0(r9)
			4a: R_PPC64_TOC16_LO_DS	.toc+0x10
   4c:	48 00 00 01 	bl      4c <.audit_classes_init+0x4c>
			4c: R_PPC64_REL24	.audit_register_class
   50:	60 00 00 00 	nop
   54:	3d 22 00 00 	addis   r9,r2,0
			56: R_PPC64_TOC16_HA	.toc+0x18
   58:	38 60 00 03 	li      r3,3
   5c:	e8 89 00 00 	ld      r4,0(r9)
			5e: R_PPC64_TOC16_LO_DS	.toc+0x18
   60:	48 00 00 01 	bl      60 <.audit_classes_init+0x60>
			60: R_PPC64_REL24	.audit_register_class
   64:	60 00 00 00 	nop
   68:	3d 22 00 00 	addis   r9,r2,0
			6a: R_PPC64_TOC16_HA	.toc+0x20
   6c:	38 60 00 09 	li      r3,9
   70:	e8 89 00 00 	ld      r4,0(r9)
			72: R_PPC64_TOC16_LO_DS	.toc+0x20
   74:	48 00 00 01 	bl      74 <.audit_classes_init+0x74>
			74: R_PPC64_REL24	.audit_register_class
   78:	60 00 00 00 	nop
   7c:	7f e4 fb 78 	mr      r4,r31
   80:	38 60 00 06 	li      r3,6
   84:	48 00 00 01 	bl      84 <.audit_classes_init+0x84>
			84: R_PPC64_REL24	.audit_register_class
   88:	60 00 00 00 	nop
   8c:	38 9f 00 5c 	addi    r4,r31,92
   90:	38 60 00 04 	li      r3,4
   94:	48 00 00 01 	bl      94 <.audit_classes_init+0x94>
			94: R_PPC64_REL24	.audit_register_class
   98:	60 00 00 00 	nop
   9c:	38 9f 00 84 	addi    r4,r31,132
   a0:	38 60 00 00 	li      r3,0
   a4:	48 00 00 01 	bl      a4 <.audit_classes_init+0xa4>
			a4: R_PPC64_REL24	.audit_register_class
   a8:	60 00 00 00 	nop
   ac:	38 9f 00 c4 	addi    r4,r31,196
   b0:	38 60 00 02 	li      r3,2
   b4:	48 00 00 01 	bl      b4 <.audit_classes_init+0xb4>
			b4: R_PPC64_REL24	.audit_register_class
   b8:	60 00 00 00 	nop
   bc:	38 9f 01 04 	addi    r4,r31,260
   c0:	38 60 00 08 	li      r3,8
   c4:	48 00 00 01 	bl      c4 <.audit_classes_init+0xc4>
			c4: R_PPC64_REL24	.audit_register_class
   c8:	60 00 00 00 	nop
   cc:	38 60 00 00 	li      r3,0
   d0:	38 21 00 80 	addi    r1,r1,128
   d4:	e8 01 00 10 	ld      r0,16(r1)
   d8:	eb e1 ff f8 	ld      r31,-8(r1)
   dc:	7c 08 03 a6 	mtlr    r0
   e0:	4e 80 00 20 	blr


lib/audit.o:     file format elf64-powerpc


Disassembly of section .text:

0000000000000000 <.audit_classify_arch>:
    0:	7c 63 18 f8 	not     r3,r3
    4:	54 63 0f fe 	rlwinm  r3,r3,1,31,31
    8:	4e 80 00 20 	blr
    c:	60 00 00 00 	nop

0000000000000010 <.audit_classify_syscall>:
   10:	2c 03 00 00 	cmpwi   r3,0
   14:	40 80 00 4c 	bge     60 <.audit_classify_syscall+0x50>
   18:	28 04 00 66 	cmplwi  r4,102
   1c:	41 82 00 74 	beq     90 <.audit_classify_syscall+0x80>
   20:	41 81 00 20 	bgt     40 <.audit_classify_syscall+0x30>
   24:	28 04 00 05 	cmplwi  r4,5
   28:	38 60 00 02 	li      r3,2
   2c:	4d 82 00 20 	beqlr
   30:	28 04 00 0b 	cmplwi  r4,11
   34:	41 82 00 20 	beq     54 <.audit_classify_syscall+0x44>
   38:	38 60 00 00 	li      r3,0
   3c:	4e 80 00 20 	blr
   40:	28 04 01 1e 	cmplwi  r4,286
   44:	38 60 00 03 	li      r3,3
   48:	4d 82 00 20 	beqlr
   4c:	28 04 01 6a 	cmplwi  r4,362
   50:	40 82 ff e8 	bne     38 <.audit_classify_syscall+0x28>
   54:	38 60 00 05 	li      r3,5
   58:	4e 80 00 20 	blr
   5c:	60 00 00 00 	nop
   60:	7c 08 02 a6 	mflr    r0
   64:	f8 01 00 10 	std     r0,16(r1)
   68:	f8 21 ff 91 	stdu    r1,-112(r1)
   6c:	48 00 00 01 	bl      6c <.audit_classify_syscall+0x5c>
			6c: R_PPC64_REL24	.audit_classify_compat_syscall
   70:	60 00 00 00 	nop
   74:	38 21 00 70 	addi    r1,r1,112
   78:	e8 01 00 10 	ld      r0,16(r1)
   7c:	7c 08 03 a6 	mtlr    r0
   80:	4e 80 00 20 	blr
   84:	60 00 00 00 	nop
   88:	60 00 00 00 	nop
   8c:	60 00 00 00 	nop
   90:	38 60 00 04 	li      r3,4
   94:	4e 80 00 20 	blr

Disassembly of section .init.text:

0000000000000000 <.audit_classes_init>:
    0:	7c 08 02 a6 	mflr    r0
    4:	fb e1 ff f8 	std     r31,-8(r1)
    8:	3d 22 00 00 	addis   r9,r2,0
			a: R_PPC64_TOC16_HA	.toc
    c:	38 60 00 07 	li      r3,7
   10:	e8 89 00 00 	ld      r4,0(r9)
			12: R_PPC64_TOC16_LO_DS	.toc
   14:	3f e2 00 00 	addis   r31,r2,0
			16: R_PPC64_TOC16_HA	.data
   18:	3b ff 00 00 	addi    r31,r31,0
			1a: R_PPC64_TOC16_LO	.data
   1c:	f8 01 00 10 	std     r0,16(r1)
   20:	f8 21 ff 81 	stdu    r1,-128(r1)
   24:	48 00 00 01 	bl      24 <.audit_classes_init+0x24>
			24: R_PPC64_REL24	.audit_register_class
   28:	60 00 00 00 	nop
   2c:	3d 22 00 00 	addis   r9,r2,0
			2e: R_PPC64_TOC16_HA	.toc+0x8
   30:	38 60 00 05 	li      r3,5
   34:	e8 89 00 00 	ld      r4,0(r9)
			36: R_PPC64_TOC16_LO_DS	.toc+0x8
   38:	48 00 00 01 	bl      38 <.audit_classes_init+0x38>
			38: R_PPC64_REL24	.audit_register_class
   3c:	60 00 00 00 	nop
   40:	3d 22 00 00 	addis   r9,r2,0
			42: R_PPC64_TOC16_HA	.toc+0x10
   44:	38 60 00 01 	li      r3,1
   48:	e8 89 00 00 	ld      r4,0(r9)
			4a: R_PPC64_TOC16_LO_DS	.toc+0x10
   4c:	48 00 00 01 	bl      4c <.audit_classes_init+0x4c>
			4c: R_PPC64_REL24	.audit_register_class
   50:	60 00 00 00 	nop
   54:	3d 22 00 00 	addis   r9,r2,0
			56: R_PPC64_TOC16_HA	.toc+0x18
   58:	38 60 00 03 	li      r3,3
   5c:	e8 89 00 00 	ld      r4,0(r9)
			5e: R_PPC64_TOC16_LO_DS	.toc+0x18
   60:	48 00 00 01 	bl      60 <.audit_classes_init+0x60>
			60: R_PPC64_REL24	.audit_register_class
   64:	60 00 00 00 	nop
   68:	3d 22 00 00 	addis   r9,r2,0
			6a: R_PPC64_TOC16_HA	.toc+0x20
   6c:	38 60 00 09 	li      r3,9
   70:	e8 89 00 00 	ld      r4,0(r9)
			72: R_PPC64_TOC16_LO_DS	.toc+0x20
   74:	48 00 00 01 	bl      74 <.audit_classes_init+0x74>
			74: R_PPC64_REL24	.audit_register_class
   78:	60 00 00 00 	nop
   7c:	7f e4 fb 78 	mr      r4,r31
   80:	38 60 00 06 	li      r3,6
   84:	48 00 00 01 	bl      84 <.audit_classes_init+0x84>
			84: R_PPC64_REL24	.audit_register_class
   88:	60 00 00 00 	nop
   8c:	38 9f 00 5c 	addi    r4,r31,92
   90:	38 60 00 04 	li      r3,4
   94:	48 00 00 01 	bl      94 <.audit_classes_init+0x94>
			94: R_PPC64_REL24	.audit_register_class
   98:	60 00 00 00 	nop
   9c:	38 9f 00 84 	addi    r4,r31,132
   a0:	38 60 00 00 	li      r3,0
   a4:	48 00 00 01 	bl      a4 <.audit_classes_init+0xa4>
			a4: R_PPC64_REL24	.audit_register_class
   a8:	60 00 00 00 	nop
   ac:	38 9f 00 c4 	addi    r4,r31,196
   b0:	38 60 00 02 	li      r3,2
   b4:	48 00 00 01 	bl      b4 <.audit_classes_init+0xb4>
			b4: R_PPC64_REL24	.audit_register_class
   b8:	60 00 00 00 	nop
   bc:	38 9f 01 04 	addi    r4,r31,260
   c0:	38 60 00 08 	li      r3,8
   c4:	48 00 00 01 	bl      c4 <.audit_classes_init+0xc4>
			c4: R_PPC64_REL24	.audit_register_class
   c8:	60 00 00 00 	nop
   cc:	38 60 00 00 	li      r3,0
   d0:	38 21 00 80 	addi    r1,r1,128
   d4:	e8 01 00 10 	ld      r0,16(r1)
   d8:	eb e1 ff f8 	ld      r31,-8(r1)
   dc:	7c 08 03 a6 	mtlr    r0
   e0:	4e 80 00 20 	blr

^ permalink raw reply

* Re: [PATCH linux-next] selftests/powerpc: remove duplicate include
From: Shuah Khan @ 2021-08-24 16:42 UTC (permalink / raw)
  To: Christophe Leroy, CGEL, Michael Ellerman
  Cc: Shuah Khan, Zeal Robot, linux-kernel, Changcheng Deng,
	Paul Mackerras, linux-kselftest, Shuah Khan, linuxppc-dev
In-Reply-To: <e59721c8-fe59-cafe-01a3-8c7d74f2583d@csgroup.eu>

On 8/24/21 10:35 AM, Christophe Leroy wrote:
> 
> 
> Le 24/08/2021 à 16:41, Shuah Khan a écrit :
>> On 8/23/21 9:05 PM, CGEL wrote:
>>> From: Changcheng Deng <deng.changcheng@zte.com.cn>
>>>
>>> Clean up the following includecheck warning:
>>>
>>> ./tools/testing/selftests/powerpc/tm/tm-poison.c: inttypes.h is included
>>> more than once.
>>>
>>> No functional change.
>>>
>>> Reported-by: Zeal Robot <zealci@zte.com.cn>
>>> Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
>>> ---
>>>   tools/testing/selftests/powerpc/tm/tm-poison.c | 1 -
>>>   1 file changed, 1 deletion(-)
>>>
>>> diff --git a/tools/testing/selftests/powerpc/tm/tm-poison.c b/tools/testing/selftests/powerpc/tm/tm-poison.c
>>> index 29e5f26..27c083a 100644
>>> --- a/tools/testing/selftests/powerpc/tm/tm-poison.c
>>> +++ b/tools/testing/selftests/powerpc/tm/tm-poison.c
>>> @@ -20,7 +20,6 @@
>>>   #include <sched.h>
>>>   #include <sys/types.h>
>>>   #include <signal.h>
>>> -#include <inttypes.h>
>>>   #include "tm.h"
>>>
>>
>> We can't accept this patch. The from and Signed-off-by don't match.
> 
> As far as I can see they match:
> 
> From: Changcheng Deng <deng.changcheng@zte.com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
> 

Yeah. My bad.

thanks,
-- Shuah


^ permalink raw reply

* Re: [PATCH linux-next] selftests/powerpc: remove duplicate include
From: Christophe Leroy @ 2021-08-24 16:35 UTC (permalink / raw)
  To: Shuah Khan, CGEL, Michael Ellerman
  Cc: Shuah Khan, Zeal Robot, linux-kernel, Changcheng Deng,
	Paul Mackerras, linux-kselftest, linuxppc-dev
In-Reply-To: <9096738b-7e57-418d-6253-16a107789dac@linuxfoundation.org>



Le 24/08/2021 à 16:41, Shuah Khan a écrit :
> On 8/23/21 9:05 PM, CGEL wrote:
>> From: Changcheng Deng <deng.changcheng@zte.com.cn>
>>
>> Clean up the following includecheck warning:
>>
>> ./tools/testing/selftests/powerpc/tm/tm-poison.c: inttypes.h is included
>> more than once.
>>
>> No functional change.
>>
>> Reported-by: Zeal Robot <zealci@zte.com.cn>
>> Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
>> ---
>>   tools/testing/selftests/powerpc/tm/tm-poison.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/powerpc/tm/tm-poison.c 
>> b/tools/testing/selftests/powerpc/tm/tm-poison.c
>> index 29e5f26..27c083a 100644
>> --- a/tools/testing/selftests/powerpc/tm/tm-poison.c
>> +++ b/tools/testing/selftests/powerpc/tm/tm-poison.c
>> @@ -20,7 +20,6 @@
>>   #include <sched.h>
>>   #include <sys/types.h>
>>   #include <signal.h>
>> -#include <inttypes.h>
>>   #include "tm.h"
>>
> 
> We can't accept this patch. The from and Signed-off-by don't match.

As far as I can see they match:

From: Changcheng Deng <deng.changcheng@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>

Christophe

^ permalink raw reply

* Re: [PATCH linux-next] powerpc/tm: remove duplicate include in tm-poison.c
From: Christophe Leroy @ 2021-08-24 16:34 UTC (permalink / raw)
  To: Shuah Khan, cgel.zte, mpe
  Cc: yong.yiran, shuah, Zeal Robot, linux-kernel, paulus,
	linux-kselftest, linuxppc-dev
In-Reply-To: <c5e9900b-1c2d-8e72-ad83-a6024b876fd2@linuxfoundation.org>



Le 24/08/2021 à 16:40, Shuah Khan a écrit :
> On 8/5/21 12:52 AM, cgel.zte@gmail.com wrote:
>> From: yong yiran <yong.yiran@zte.com.cn>
>>
>> 'inttypes.h' included in 'tm-poison.c' is duplicated.
>> Remove all but the first include of inttypes.h from tm-poison.c.
>>
>> Reported-by: Zeal Robot <zealci@zte.com.cn>
>> Signed-off-by: yong yiran <yong.yiran@zte.com.cn>
>> ---
>>   tools/testing/selftests/powerpc/tm/tm-poison.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/powerpc/tm/tm-poison.c 
>> b/tools/testing/selftests/powerpc/tm/tm-poison.c
>> index 29e5f26af7b9..27c083a03d1f 100644
>> --- a/tools/testing/selftests/powerpc/tm/tm-poison.c
>> +++ b/tools/testing/selftests/powerpc/tm/tm-poison.c
>> @@ -20,7 +20,6 @@
>>   #include <sched.h>
>>   #include <sys/types.h>
>>   #include <signal.h>
>> -#include <inttypes.h>
>>   #include "tm.h"
>>
> 
> We can't accept this patch. The from and Signed-off-by don't match.
> 

As far as I can see they match. You have:

From: yong yiran <yong.yiran@zte.com.cn>
Signed-off-by: yong yiran <yong.yiran@zte.com.cn>


^ permalink raw reply

* Re: [PATCH] powerpc/32: Don't use lmw/stmw for saving/restoring non volatile regs
From: Segher Boessenkool @ 2021-08-24 15:28 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: linuxppc-dev, Paul Mackerras, linux-kernel
In-Reply-To: <20210824131600.GF1583@gate.crashing.org>

On Tue, Aug 24, 2021 at 08:16:00AM -0500, Segher Boessenkool wrote:
> On Tue, Aug 24, 2021 at 07:54:22AM +0200, Christophe Leroy wrote:
> > >On mpccore both lmw and stmw are only N+1 btw.  But the serialization
> > >might cost another cycle here?
> > 
> > That coherent on MPC8xx, that's only 2 cycles.
> > But on the mpc832x which has a e300c2 core, it looks like I have 10 cycles 
> > difference. Is anything wrong ?
> 
> I don't know that core very well, I'll have a look.

So, I don't see any difference between e300c2 and e300c1 (which is 603
basically, for this) that is significant here.  The e300c2 has two
integer units instead of just one, but it still has only one load/store
unit, and I don't see anything else that could matter either.  Huh.


Segher

^ permalink raw reply

* Re: [PATCH v2 RESEND] powerpc/audit: Convert powerpc to AUDIT_ARCH_COMPAT_GENERIC
From: Paul Moore @ 2021-08-24 14:47 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: linux-kernel, Eric Paris, linux-audit, Paul Mackerras,
	linuxppc-dev
In-Reply-To: <a4b3951d1191d4183d92a07a6097566bde60d00a.1629812058.git.christophe.leroy@csgroup.eu>

On Tue, Aug 24, 2021 at 9:36 AM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
> Commit e65e1fc2d24b ("[PATCH] syscall class hookup for all normal
> targets") added generic support for AUDIT but that didn't include
> support for bi-arch like powerpc.
>
> Commit 4b58841149dc ("audit: Add generic compat syscall support")
> added generic support for bi-arch.
>
> Convert powerpc to that bi-arch generic audit support.
>
> Cc: Paul Moore <paul@paul-moore.com>
> Cc: Eric Paris <eparis@redhat.com>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> Resending v2 with Audit people in Cc
>
> v2:
> - Missing 'git add' for arch/powerpc/include/asm/unistd32.h
> - Finalised commit description
> ---
>  arch/powerpc/Kconfig                |  5 +-
>  arch/powerpc/include/asm/unistd32.h |  7 +++
>  arch/powerpc/kernel/Makefile        |  3 --
>  arch/powerpc/kernel/audit.c         | 84 -----------------------------
>  arch/powerpc/kernel/compat_audit.c  | 44 ---------------
>  5 files changed, 8 insertions(+), 135 deletions(-)
>  create mode 100644 arch/powerpc/include/asm/unistd32.h
>  delete mode 100644 arch/powerpc/kernel/audit.c
>  delete mode 100644 arch/powerpc/kernel/compat_audit.c

Can you explain, in detail please, the testing you have done to verify
this patch?

-- 
paul moore
www.paul-moore.com

^ permalink raw reply

* Re: [PATCH linux-next] selftests/powerpc: remove duplicate include
From: Shuah Khan @ 2021-08-24 14:41 UTC (permalink / raw)
  To: CGEL, Michael Ellerman
  Cc: Zeal Robot, linuxppc-dev, linux-kernel, Paul Mackerras,
	linux-kselftest, Shuah Khan, Changcheng Deng, Shuah Khan
In-Reply-To: <20210824030550.57467-1-deng.changcheng@zte.com.cn>

On 8/23/21 9:05 PM, CGEL wrote:
> From: Changcheng Deng <deng.changcheng@zte.com.cn>
> 
> Clean up the following includecheck warning:
> 
> ./tools/testing/selftests/powerpc/tm/tm-poison.c: inttypes.h is included
> more than once.
> 
> No functional change.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
> ---
>   tools/testing/selftests/powerpc/tm/tm-poison.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/powerpc/tm/tm-poison.c b/tools/testing/selftests/powerpc/tm/tm-poison.c
> index 29e5f26..27c083a 100644
> --- a/tools/testing/selftests/powerpc/tm/tm-poison.c
> +++ b/tools/testing/selftests/powerpc/tm/tm-poison.c
> @@ -20,7 +20,6 @@
>   #include <sched.h>
>   #include <sys/types.h>
>   #include <signal.h>
> -#include <inttypes.h>
>   
>   #include "tm.h"
>   
> 

We can't accept this patch. The from and Signed-off-by don't match.

thanks,
-- Shuah

^ permalink raw reply

* Re: [PATCH linux-next] powerpc/tm: remove duplicate include in tm-poison.c
From: Shuah Khan @ 2021-08-24 14:40 UTC (permalink / raw)
  To: cgel.zte, mpe
  Cc: yong.yiran, Zeal Robot, linuxppc-dev, linux-kernel, paulus,
	linux-kselftest, shuah
In-Reply-To: <20210805065255.628170-1-yong.yiran@zte.com.cn>

On 8/5/21 12:52 AM, cgel.zte@gmail.com wrote:
> From: yong yiran <yong.yiran@zte.com.cn>
> 
> 'inttypes.h' included in 'tm-poison.c' is duplicated.
> Remove all but the first include of inttypes.h from tm-poison.c.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: yong yiran <yong.yiran@zte.com.cn>
> ---
>   tools/testing/selftests/powerpc/tm/tm-poison.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/powerpc/tm/tm-poison.c b/tools/testing/selftests/powerpc/tm/tm-poison.c
> index 29e5f26af7b9..27c083a03d1f 100644
> --- a/tools/testing/selftests/powerpc/tm/tm-poison.c
> +++ b/tools/testing/selftests/powerpc/tm/tm-poison.c
> @@ -20,7 +20,6 @@
>   #include <sched.h>
>   #include <sys/types.h>
>   #include <signal.h>
> -#include <inttypes.h>
>   
>   #include "tm.h"
>   
> 

We can't accept this patch. The from and Signed-off-by don't match.

thanks,
-- Shuah

^ permalink raw reply

* Re: [PATCH v15 10/12] swiotlb: Add restricted DMA pool initialization
From: Guenter Roeck @ 2021-08-24 14:26 UTC (permalink / raw)
  To: Claire Chang
  Cc: heikki.krogerus, thomas.hellstrom, peterz, joonas.lahtinen,
	dri-devel, chris, grant.likely, paulus, Frank Rowand, mingo,
	Marek Szyprowski, sstabellini, Saravana Kannan, Joerg Roedel,
	Rafael J . Wysocki, Christoph Hellwig, Bartosz Golaszewski,
	bskeggs, linux-pci, xen-devel, Thierry Reding, intel-gfx,
	matthew.auld, linux-devicetree, jxgao, daniel, Will Deacon,
	Konrad Rzeszutek Wilk, maarten.lankhorst, airlied, Dan Williams,
	linuxppc-dev, jani.nikula, Rob Herring, rodrigo.vivi, bhelgaas,
	boris.ostrovsky, Andy Shevchenko, jgross, Nicolas Boichat,
	Greg KH, Randy Dunlap, quic_qiancai, lkml, tfiga,
	list@263.net:IOMMU DRIVERS, Jim Quinlan, xypron.glpk,
	thomas.lendacky, Robin Murphy, bauerman
In-Reply-To: <20210624155526.2775863-11-tientzu@chromium.org>

Hi Claire,

On Thu, Jun 24, 2021 at 11:55:24PM +0800, Claire Chang wrote:
> Add the initialization function to create restricted DMA pools from
> matching reserved-memory nodes.
> 
> Regardless of swiotlb setting, the restricted DMA pool is preferred if
> available.
> 
> The restricted DMA pools provide a basic level of protection against the
> DMA overwriting buffer contents at unexpected times. However, to protect
> against general data leakage and system memory corruption, the system
> needs to provide a way to lock down the memory access, e.g., MPU.
> 
> Signed-off-by: Claire Chang <tientzu@chromium.org>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Tested-by: Stefano Stabellini <sstabellini@kernel.org>
> Tested-by: Will Deacon <will@kernel.org>
> ---
>  include/linux/swiotlb.h |  3 +-
>  kernel/dma/Kconfig      | 14 ++++++++
>  kernel/dma/swiotlb.c    | 76 +++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 92 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
> index 3b9454d1e498..39284ff2a6cd 100644
> --- a/include/linux/swiotlb.h
> +++ b/include/linux/swiotlb.h
> @@ -73,7 +73,8 @@ extern enum swiotlb_force swiotlb_force;
>   *		range check to see if the memory was in fact allocated by this
>   *		API.
>   * @nslabs:	The number of IO TLB blocks (in groups of 64) between @start and
> - *		@end. This is command line adjustable via setup_io_tlb_npages.
> + *		@end. For default swiotlb, this is command line adjustable via
> + *		setup_io_tlb_npages.
>   * @used:	The number of used IO TLB block.
>   * @list:	The free list describing the number of free entries available
>   *		from each index.
> diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> index 77b405508743..3e961dc39634 100644
> --- a/kernel/dma/Kconfig
> +++ b/kernel/dma/Kconfig
> @@ -80,6 +80,20 @@ config SWIOTLB
>  	bool
>  	select NEED_DMA_MAP_STATE
>  
> +config DMA_RESTRICTED_POOL
> +	bool "DMA Restricted Pool"
> +	depends on OF && OF_RESERVED_MEM
> +	select SWIOTLB

This makes SWIOTLB user configurable, which in turn results in

mips64-linux-ld: arch/mips/kernel/setup.o: in function `arch_mem_init':
setup.c:(.init.text+0x19c8): undefined reference to `plat_swiotlb_setup'
make[1]: *** [Makefile:1280: vmlinux] Error 1

when building mips:allmodconfig.

Should this possibly be "depends on SWIOTLB" ?

Thanks,
Guenter

^ permalink raw reply

* Re: linux-next: build warning after merge of the powerpc tree
From: Jonathan Corbet @ 2021-08-24 13:46 UTC (permalink / raw)
  To: Aneesh Kumar K.V, Stephen Rothwell, Michael Ellerman, PowerPC
  Cc: Daniel Henrique Barboza, Linux Next Mailing List,
	Linux Kernel Mailing List
In-Reply-To: <87v93ve7yg.fsf@linux.ibm.com>

"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:


> Thanks for looking into this. I guess we also need to format the below table?
>
>   | 0    8   40
> --|------------
>   |
> 0 | 10   20  80
>   |
> 8 | 20   10  160
>   |
> 40| 80   160  10
>
>
> I don't know how to represent that in the documentation file. A table is
> probably not the right one?

The cheap way out is to put it in a literal block, of course.  Sphinx
makes tables pretty easy, though:

  https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#tables

jon

^ permalink raw reply

* [PATCH v2 RESEND] powerpc/audit: Convert powerpc to AUDIT_ARCH_COMPAT_GENERIC
From: Christophe Leroy @ 2021-08-24 13:36 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linux-audit, linuxppc-dev, linux-kernel, Eric Paris, Paul Moore

Commit e65e1fc2d24b ("[PATCH] syscall class hookup for all normal
targets") added generic support for AUDIT but that didn't include
support for bi-arch like powerpc.

Commit 4b58841149dc ("audit: Add generic compat syscall support")
added generic support for bi-arch.

Convert powerpc to that bi-arch generic audit support.

Cc: Paul Moore <paul@paul-moore.com>
Cc: Eric Paris <eparis@redhat.com>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
Resending v2 with Audit people in Cc

v2:
- Missing 'git add' for arch/powerpc/include/asm/unistd32.h
- Finalised commit description
---
 arch/powerpc/Kconfig                |  5 +-
 arch/powerpc/include/asm/unistd32.h |  7 +++
 arch/powerpc/kernel/Makefile        |  3 --
 arch/powerpc/kernel/audit.c         | 84 -----------------------------
 arch/powerpc/kernel/compat_audit.c  | 44 ---------------
 5 files changed, 8 insertions(+), 135 deletions(-)
 create mode 100644 arch/powerpc/include/asm/unistd32.h
 delete mode 100644 arch/powerpc/kernel/audit.c
 delete mode 100644 arch/powerpc/kernel/compat_audit.c

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 663766fbf505..5472358609d2 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -163,6 +163,7 @@ config PPC
 	select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
 	select ARCH_WANT_LD_ORPHAN_WARN
 	select ARCH_WEAK_RELEASE_ACQUIRE
+	select AUDIT_ARCH_COMPAT_GENERIC
 	select BINFMT_ELF
 	select BUILDTIME_TABLE_SORT
 	select CLONE_BACKWARDS
@@ -316,10 +317,6 @@ config GENERIC_TBSYNC
 	bool
 	default y if PPC32 && SMP
 
-config AUDIT_ARCH
-	bool
-	default y
-
 config GENERIC_BUG
 	bool
 	default y
diff --git a/arch/powerpc/include/asm/unistd32.h b/arch/powerpc/include/asm/unistd32.h
new file mode 100644
index 000000000000..07689897d206
--- /dev/null
+++ b/arch/powerpc/include/asm/unistd32.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef _ASM_POWERPC_UNISTD32_H_
+#define _ASM_POWERPC_UNISTD32_H_
+
+#include <asm/unistd_32.h>
+
+#endif /* _ASM_POWERPC_UNISTD32_H_ */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 7be36c1e1db6..825121eba3c2 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -125,9 +125,6 @@ obj-$(CONFIG_PCI)		+= pci_$(BITS).o $(pci64-y) \
 				   pci-common.o pci_of_scan.o
 obj-$(CONFIG_PCI_MSI)		+= msi.o
 
-obj-$(CONFIG_AUDIT)		+= audit.o
-obj64-$(CONFIG_AUDIT)		+= compat_audit.o
-
 obj-$(CONFIG_PPC_IO_WORKAROUNDS)	+= io-workarounds.o
 
 obj-y				+= trace/
diff --git a/arch/powerpc/kernel/audit.c b/arch/powerpc/kernel/audit.c
deleted file mode 100644
index a2dddd7f3d09..000000000000
--- a/arch/powerpc/kernel/audit.c
+++ /dev/null
@@ -1,84 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/audit.h>
-#include <asm/unistd.h>
-
-static unsigned dir_class[] = {
-#include <asm-generic/audit_dir_write.h>
-~0U
-};
-
-static unsigned read_class[] = {
-#include <asm-generic/audit_read.h>
-~0U
-};
-
-static unsigned write_class[] = {
-#include <asm-generic/audit_write.h>
-~0U
-};
-
-static unsigned chattr_class[] = {
-#include <asm-generic/audit_change_attr.h>
-~0U
-};
-
-static unsigned signal_class[] = {
-#include <asm-generic/audit_signal.h>
-~0U
-};
-
-int audit_classify_arch(int arch)
-{
-#ifdef CONFIG_PPC64
-	if (arch == AUDIT_ARCH_PPC)
-		return 1;
-#endif
-	return 0;
-}
-
-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
-	switch(syscall) {
-	case __NR_open:
-		return 2;
-	case __NR_openat:
-		return 3;
-	case __NR_socketcall:
-		return 4;
-	case __NR_execve:
-		return 5;
-	default:
-		return 0;
-	}
-}
-
-static int __init audit_classes_init(void)
-{
-#ifdef CONFIG_PPC64
-	extern __u32 ppc32_dir_class[];
-	extern __u32 ppc32_write_class[];
-	extern __u32 ppc32_read_class[];
-	extern __u32 ppc32_chattr_class[];
-	extern __u32 ppc32_signal_class[];
-	audit_register_class(AUDIT_CLASS_WRITE_32, ppc32_write_class);
-	audit_register_class(AUDIT_CLASS_READ_32, ppc32_read_class);
-	audit_register_class(AUDIT_CLASS_DIR_WRITE_32, ppc32_dir_class);
-	audit_register_class(AUDIT_CLASS_CHATTR_32, ppc32_chattr_class);
-	audit_register_class(AUDIT_CLASS_SIGNAL_32, ppc32_signal_class);
-#endif
-	audit_register_class(AUDIT_CLASS_WRITE, write_class);
-	audit_register_class(AUDIT_CLASS_READ, read_class);
-	audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class);
-	audit_register_class(AUDIT_CLASS_CHATTR, chattr_class);
-	audit_register_class(AUDIT_CLASS_SIGNAL, signal_class);
-	return 0;
-}
-
-__initcall(audit_classes_init);
diff --git a/arch/powerpc/kernel/compat_audit.c b/arch/powerpc/kernel/compat_audit.c
deleted file mode 100644
index 55c6ccda0a85..000000000000
--- a/arch/powerpc/kernel/compat_audit.c
+++ /dev/null
@@ -1,44 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#undef __powerpc64__
-#include <asm/unistd.h>
-
-unsigned ppc32_dir_class[] = {
-#include <asm-generic/audit_dir_write.h>
-~0U
-};
-
-unsigned ppc32_chattr_class[] = {
-#include <asm-generic/audit_change_attr.h>
-~0U
-};
-
-unsigned ppc32_write_class[] = {
-#include <asm-generic/audit_write.h>
-~0U
-};
-
-unsigned ppc32_read_class[] = {
-#include <asm-generic/audit_read.h>
-~0U
-};
-
-unsigned ppc32_signal_class[] = {
-#include <asm-generic/audit_signal.h>
-~0U
-};
-
-int ppc32_classify_syscall(unsigned syscall)
-{
-	switch(syscall) {
-	case __NR_open:
-		return 2;
-	case __NR_openat:
-		return 3;
-	case __NR_socketcall:
-		return 4;
-	case __NR_execve:
-		return 5;
-	default:
-		return 1;
-	}
-}
-- 
2.25.0


^ permalink raw reply related

* Re: [PATCH v2] powerpc/audit: Convert powerpc to AUDIT_ARCH_COMPAT_GENERIC
From: Christophe Leroy @ 2021-08-24 13:26 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <877dgbc6vx.fsf@mpe.ellerman.id.au>



Le 24/08/2021 à 15:24, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> Commit e65e1fc2d24b ("[PATCH] syscall class hookup for all normal
>> targets") added generic support for AUDIT but that didn't include
>> support for bi-arch like powerpc.
>>
>> Commit 4b58841149dc ("audit: Add generic compat syscall support")
>> added generic support for bi-arch.
>>
>> Convert powerpc to that bi-arch generic audit support.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>> v2:
>> - Missing 'git add' for arch/powerpc/include/asm/unistd32.h
>> - Finalised commit description
>> ---
>>   arch/powerpc/Kconfig                |  5 +-
>>   arch/powerpc/include/asm/unistd32.h |  7 +++
>>   arch/powerpc/kernel/Makefile        |  3 --
>>   arch/powerpc/kernel/audit.c         | 84 -----------------------------
>>   arch/powerpc/kernel/compat_audit.c  | 44 ---------------
>>   5 files changed, 8 insertions(+), 135 deletions(-)
>>   create mode 100644 arch/powerpc/include/asm/unistd32.h
>>   delete mode 100644 arch/powerpc/kernel/audit.c
>>   delete mode 100644 arch/powerpc/kernel/compat_audit.c
> 
> This looks OK, but I don't know much about audit.
> 
> Can you resend with the audit maintainers on Cc?
> 

Sure.

^ permalink raw reply

* Re: [PATCH v2] powerpc/audit: Convert powerpc to AUDIT_ARCH_COMPAT_GENERIC
From: Michael Ellerman @ 2021-08-24 13:24 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <dc14509a28a993738b1325211f412be72a4f9b1e.1629701132.git.christophe.leroy@csgroup.eu>

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Commit e65e1fc2d24b ("[PATCH] syscall class hookup for all normal
> targets") added generic support for AUDIT but that didn't include
> support for bi-arch like powerpc.
>
> Commit 4b58841149dc ("audit: Add generic compat syscall support")
> added generic support for bi-arch.
>
> Convert powerpc to that bi-arch generic audit support.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> v2:
> - Missing 'git add' for arch/powerpc/include/asm/unistd32.h
> - Finalised commit description
> ---
>  arch/powerpc/Kconfig                |  5 +-
>  arch/powerpc/include/asm/unistd32.h |  7 +++
>  arch/powerpc/kernel/Makefile        |  3 --
>  arch/powerpc/kernel/audit.c         | 84 -----------------------------
>  arch/powerpc/kernel/compat_audit.c  | 44 ---------------
>  5 files changed, 8 insertions(+), 135 deletions(-)
>  create mode 100644 arch/powerpc/include/asm/unistd32.h
>  delete mode 100644 arch/powerpc/kernel/audit.c
>  delete mode 100644 arch/powerpc/kernel/compat_audit.c

This looks OK, but I don't know much about audit.

Can you resend with the audit maintainers on Cc?

cheers

^ 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