* [PATCH] ASoC: imx-audmix: register the card on a proper dev
From: Shengjiu Wang @ 2019-08-27 15:55 UTC (permalink / raw)
To: timur, nicoleotsuka, Xiubo.Lee, festevam, broonie, lgirdwood,
perex, tiwai, shawnguo, s.hauer, kernel, alsa-devel, viorel.suman
Cc: linuxppc-dev, linux-imx, linux-arm-kernel, linux-kernel
This platform device is registered from "fsl_audmix", which is
its parent device. If use pdev->dev.parent for the priv->card.dev,
the value set by dev_set_drvdata in parent device will be covered
by the value in child device.
Fixes: b86ef5367761 ("ASoC: fsl: Add Audio Mixer machine driver")
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
sound/soc/fsl/imx-audmix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/fsl/imx-audmix.c b/sound/soc/fsl/imx-audmix.c
index 9e1cb18859ce..71590ca6394b 100644
--- a/sound/soc/fsl/imx-audmix.c
+++ b/sound/soc/fsl/imx-audmix.c
@@ -325,14 +325,14 @@ static int imx_audmix_probe(struct platform_device *pdev)
priv->card.num_configs = priv->num_dai_conf;
priv->card.dapm_routes = priv->dapm_routes;
priv->card.num_dapm_routes = priv->num_dapm_routes;
- priv->card.dev = pdev->dev.parent;
+ priv->card.dev = &pdev->dev;
priv->card.owner = THIS_MODULE;
priv->card.name = "imx-audmix";
platform_set_drvdata(pdev, &priv->card);
snd_soc_card_set_drvdata(&priv->card, priv);
- ret = devm_snd_soc_register_card(pdev->dev.parent, &priv->card);
+ ret = devm_snd_soc_register_card(&pdev->dev, &priv->card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed\n");
return ret;
--
2.21.0
^ permalink raw reply related
* Re: [PATCH kernel v2 4/4] powerpc/powernv/ioda: Remove obsolete iommu_table_ops::exchange callbacks
From: Michael Ellerman @ 2019-08-27 4:48 UTC (permalink / raw)
To: Alexey Kardashevskiy, linuxppc-dev
Cc: kvm, Alexey Kardashevskiy, Alistair Popple, kvm-ppc,
Alex Williamson, David Gibson
In-Reply-To: <20190826061705.92048-5-aik@ozlabs.ru>
Alexey Kardashevskiy <aik@ozlabs.ru> writes:
> As now we have xchg_no_kill/tce_kill, these are not used anymore so
> remove them.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> arch/powerpc/include/asm/iommu.h | 10 -----
> arch/powerpc/kernel/iommu.c | 26 +-----------
> arch/powerpc/platforms/powernv/pci-ioda.c | 50 -----------------------
> 3 files changed, 1 insertion(+), 85 deletions(-)
This doesn't build:
arch/powerpc/platforms/pseries/iommu.c:652:3: error: 'struct iommu_table_ops' has no member named 'exchange'
.exchange = tce_exchange_pseries,
^~~~~~~~
arch/powerpc/platforms/pseries/iommu.c:652:14: error: initialization of 'int (*)(struct iommu_table *, long int, long unsigned int *, enum dma_data_direction *, bool)' {aka 'int (*)(struct iommu_table *, long int, long unsigned int *, enum dma_data_direction *, _Bool)'} from incompatible pointer type 'int (*)(struct iommu_table *, long int, long unsigned int *, enum dma_data_direction *)' [-Werror=incompatible-pointer-types]
.exchange = tce_exchange_pseries,
^~~~~~~~~~~~~~~~~~~~
cheers
^ permalink raw reply
* [PATCH] powerpc: Perform a bounds check in arch_add_memory
From: Alastair D'Silva @ 2019-08-27 5:20 UTC (permalink / raw)
To: alastair
Cc: Michal Hocko, David Hildenbrand, linux-kernel, Mike Rapoport,
Paul Mackerras, Aneesh Kumar K.V, Andrew Morton, linuxppc-dev
From: Alastair D'Silva <alastair@d-silva.org>
It is possible for firmware to allocate memory ranges outside
the range of physical memory that we support (MAX_PHYSMEM_BITS).
This patch adds a bounds check to ensure that any hotplugged
memory is addressable.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
arch/powerpc/mm/mem.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 9191a66b3bc5..de18fb73de30 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -111,6 +111,9 @@ int __ref arch_add_memory(int nid, u64 start, u64 size,
unsigned long nr_pages = size >> PAGE_SHIFT;
int rc;
+ if ((start + size - 1) >> MAX_PHYSMEM_BITS)
+ return -EINVAL;
+
resize_hpt_for_hotplug(memblock_phys_mem_size());
start = (unsigned long)__va(start);
--
2.21.0
^ permalink raw reply related
* Re: [PATCH v3] powerpc/fadump: sysfs for fadump memory reservation
From: Hari Bathini @ 2019-08-27 6:02 UTC (permalink / raw)
To: Michael Ellerman, Sourabh Jain
Cc: linux-doc, mahesh, corbet, linux-kernel, gregkh, linuxppc-dev
In-Reply-To: <87sgpn2t2w.fsf@concordia.ellerman.id.au>
On 27/08/19 8:49 AM, Michael Ellerman wrote:
> Hari Bathini <hbathini@linux.ibm.com> writes:
>> On 26/08/19 4:14 PM, Sourabh Jain wrote:
>>> On 8/26/19 3:46 PM, Sourabh Jain wrote:
>>>> On 8/26/19 3:29 PM, Hari Bathini wrote:
>>>>> On 10/08/19 11:29 PM, Sourabh Jain wrote:
>>>>>> Add a sys interface to allow querying the memory reserved by
>>>>>> fadump for saving the crash dump.
>>>>>>
>>>>>> Add an ABI doc entry for new sysfs interface.
>>>>>> - /sys/kernel/fadump_mem_reserved
>>>>>>
>>>>>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>>>>>> ---
>>>>>> Changelog:
>>>>>> v1 -> v2:
>>>>>> - Added ABI doc for new sysfs interface.
>>>>>>
>>>>>> v2 -> v3:
>>>>>> - Updated the ABI documentation.
>>>>>> ---
>>>>>>
>>>>>> Documentation/ABI/testing/sysfs-kernel-fadump | 6 ++++++
>>>>>
>>>>> Shouldn't this be Documentation/ABI/testing/sysfs-kernel-fadump_mem_reserved?
>>>
>>> How about documenting fadump_mem_reserved and other sysfs attributes suggested
>>> by you in a single file Documentation/ABI/testing/sysfs-kernel-fadump?
>>
>> I wouldn't mind that but please do check if it is breaking a convention..
>
> AIUI a file named like that would hold the documentation for the files
> inside a directory called /sys/kernel/fadump.
>
> And in fact that's probably where these files should live, rather than
> just dropped directly into /sys/kernel.
Michael, could that be corrected now by introducing new sysfs files for FADump in
/sys/kernel/fadump/.
Also, duplicating current /sys/kernel/fadump_* files as /sys/kernel/fadump/* files
& eventually dropping /sys/kernel/fadump_* files sometime later..
- Hari
^ permalink raw reply
* Re: [PATCH 1/4] powerpc: convert to copy_thread_tls
From: Christophe Leroy @ 2019-08-27 6:07 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev
In-Reply-To: <20190827033010.28090-2-npiggin@gmail.com>
Le 27/08/2019 à 05:30, Nicholas Piggin a écrit :
> Commit 3033f14ab78c3 ("clone: support passing tls argument via C rather
> than pt_regs magic") introduced the HAVE_COPY_THREAD_TLS option. Use it
> to avoid a subtle assumption about the argument ordering of clone type
> syscalls.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/kernel/process.c | 9 +++++----
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index d8dcd8820369..7477a3263225 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -182,6 +182,7 @@ config PPC
> select HAVE_STACKPROTECTOR if PPC64 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r13)
> select HAVE_STACKPROTECTOR if PPC32 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r2)
> select HAVE_CONTEXT_TRACKING if PPC64
> + select HAVE_COPY_THREAD_TLS
> select HAVE_DEBUG_KMEMLEAK
> select HAVE_DEBUG_STACKOVERFLOW
> select HAVE_DYNAMIC_FTRACE
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 8fc4de0d22b4..24621e7e5033 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -1600,8 +1600,9 @@ static void setup_ksp_vsid(struct task_struct *p, unsigned long sp)
> /*
> * Copy architecture-specific thread state
> */
> -int copy_thread(unsigned long clone_flags, unsigned long usp,
> - unsigned long kthread_arg, struct task_struct *p)
> +int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
> + unsigned long kthread_arg, struct task_struct *p,
> + unsigned long tls)
> {
> struct pt_regs *childregs, *kregs;
> extern void ret_from_fork(void);
> @@ -1642,10 +1643,10 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
> if (clone_flags & CLONE_SETTLS) {
> #ifdef CONFIG_PPC64
is_32bit_task() exists and always returns 1 on PPC32 so this gross ifdef
in the middle of an if/else is pointless, it should be dropped.
> if (!is_32bit_task())
> - childregs->gpr[13] = childregs->gpr[6];
> + childregs->gpr[13] = tls;
> else
> #endif
> - childregs->gpr[2] = childregs->gpr[6];
> + childregs->gpr[2] = tls;
> }
>
> f = ret_from_fork;
>
Christophe
^ permalink raw reply
* Re: [PATCH 2/4] powerpc/64: remove support for kernel-mode syscalls
From: Christophe Leroy @ 2019-08-27 6:13 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev
In-Reply-To: <20190827033010.28090-3-npiggin@gmail.com>
Le 27/08/2019 à 05:30, Nicholas Piggin a écrit :
> There is support for the kernel to execute the 'sc 0' instruction and
> make a system call to itself. This is a relic that is unused in the
> tree, therefore untested. It's also highly questionable for modules to
> be doing this.
I like it.
I dropped support for that in PPC32 when I added fast-path syscalls.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/kernel/entry_64.S | 21 ++++++---------------
> arch/powerpc/kernel/exceptions-64s.S | 2 --
> 2 files changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
> index 0a0b5310f54a..6467bdab8d40 100644
> --- a/arch/powerpc/kernel/entry_64.S
> +++ b/arch/powerpc/kernel/entry_64.S
> @@ -69,24 +69,20 @@ BEGIN_FTR_SECTION
> bne .Ltabort_syscall
> END_FTR_SECTION_IFSET(CPU_FTR_TM)
> #endif
> - andi. r10,r12,MSR_PR
> mr r10,r1
> - addi r1,r1,-INT_FRAME_SIZE
> - beq- 1f
> ld r1,PACAKSAVE(r13)
> -1: std r10,0(r1)
> + std r10,0(r1)
> std r11,_NIP(r1)
> std r12,_MSR(r1)
> std r0,GPR0(r1)
> std r10,GPR1(r1)
> - beq 2f /* if from kernel mode */
> #ifdef CONFIG_PPC_FSL_BOOK3E
> START_BTB_FLUSH_SECTION
> BTB_FLUSH(r10)
> END_BTB_FLUSH_SECTION
> #endif
> ACCOUNT_CPU_USER_ENTRY(r13, r10, r11)
> -2: std r2,GPR2(r1)
> + std r2,GPR2(r1)
> std r3,GPR3(r1)
> mfcr r2
> std r4,GPR4(r1)
> @@ -122,14 +118,13 @@ END_BTB_FLUSH_SECTION
>
> #if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE) && defined(CONFIG_PPC_SPLPAR)
> BEGIN_FW_FTR_SECTION
> - beq 33f
> - /* if from user, see if there are any DTL entries to process */
> + /* see if there are any DTL entries to process */
> ld r10,PACALPPACAPTR(r13) /* get ptr to VPA */
> ld r11,PACA_DTL_RIDX(r13) /* get log read index */
> addi r10,r10,LPPACA_DTLIDX
> LDX_BE r10,0,r10 /* get log write index */
> - cmpd cr1,r11,r10
> - beq+ cr1,33f
> + cmpd r11,r10
> + beq+ 33f
Any need to do this change ? Why not keep it as is ?
Christophe
> bl accumulate_stolen_time
> REST_GPR(0,r1)
> REST_4GPRS(3,r1)
> @@ -203,6 +198,7 @@ system_call: /* label this so stack traces look sane */
> mtctr r12
> bctrl /* Call handler */
>
> + /* syscall_exit can exit to kernel mode, via ret_from_kernel_thread */
> .Lsyscall_exit:
> std r3,RESULT(r1)
>
> @@ -216,11 +212,6 @@ system_call: /* label this so stack traces look sane */
> ld r12, PACA_THREAD_INFO(r13)
>
> ld r8,_MSR(r1)
> -#ifdef CONFIG_PPC_BOOK3S
> - /* No MSR:RI on BookE */
> - andi. r10,r8,MSR_RI
> - beq- .Lunrecov_restore
> -#endif
>
> /*
> * This is a few instructions into the actual syscall exit path (which actually
> diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
> index 6ba3cc2ef8ab..768f133de4f1 100644
> --- a/arch/powerpc/kernel/exceptions-64s.S
> +++ b/arch/powerpc/kernel/exceptions-64s.S
> @@ -1521,8 +1521,6 @@ EXC_COMMON(trap_0b_common, 0xb00, unknown_exception)
> * system call / hypercall (0xc00, 0x4c00)
> *
> * The system call exception is invoked with "sc 0" and does not alter HV bit.
> - * There is support for kernel code to invoke system calls but there are no
> - * in-tree users.
> *
> * The hypercall is invoked with "sc 1" and sets HV=1.
> *
>
^ permalink raw reply
* Re: [PATCH 2/4] powerpc/64s: remove support for kernel-mode syscalls
From: Christophe Leroy @ 2019-08-27 6:14 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev
In-Reply-To: <20190827033010.28090-4-npiggin@gmail.com>
Euh ... That's a duplicate of [PATCH 2/4] "powerpc/64: remove support
for kernel-mode syscalls" ?
Le 27/08/2019 à 05:30, Nicholas Piggin a écrit :
> There is support for the kernel to execute the 'sc 0' instruction and
> make a system call to itself. This is a relic that is unused in the
> tree, therefore untested. It's also highly questionable for modules to
> be doing this.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/kernel/entry_64.S | 21 ++++++---------------
> arch/powerpc/kernel/exceptions-64s.S | 2 --
> 2 files changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
> index 0a0b5310f54a..6467bdab8d40 100644
> --- a/arch/powerpc/kernel/entry_64.S
> +++ b/arch/powerpc/kernel/entry_64.S
> @@ -69,24 +69,20 @@ BEGIN_FTR_SECTION
> bne .Ltabort_syscall
> END_FTR_SECTION_IFSET(CPU_FTR_TM)
> #endif
> - andi. r10,r12,MSR_PR
> mr r10,r1
> - addi r1,r1,-INT_FRAME_SIZE
> - beq- 1f
> ld r1,PACAKSAVE(r13)
> -1: std r10,0(r1)
> + std r10,0(r1)
> std r11,_NIP(r1)
> std r12,_MSR(r1)
> std r0,GPR0(r1)
> std r10,GPR1(r1)
> - beq 2f /* if from kernel mode */
> #ifdef CONFIG_PPC_FSL_BOOK3E
> START_BTB_FLUSH_SECTION
> BTB_FLUSH(r10)
> END_BTB_FLUSH_SECTION
> #endif
> ACCOUNT_CPU_USER_ENTRY(r13, r10, r11)
> -2: std r2,GPR2(r1)
> + std r2,GPR2(r1)
> std r3,GPR3(r1)
> mfcr r2
> std r4,GPR4(r1)
> @@ -122,14 +118,13 @@ END_BTB_FLUSH_SECTION
>
> #if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE) && defined(CONFIG_PPC_SPLPAR)
> BEGIN_FW_FTR_SECTION
> - beq 33f
> - /* if from user, see if there are any DTL entries to process */
> + /* see if there are any DTL entries to process */
> ld r10,PACALPPACAPTR(r13) /* get ptr to VPA */
> ld r11,PACA_DTL_RIDX(r13) /* get log read index */
> addi r10,r10,LPPACA_DTLIDX
> LDX_BE r10,0,r10 /* get log write index */
> - cmpd cr1,r11,r10
> - beq+ cr1,33f
> + cmpd r11,r10
> + beq+ 33f
> bl accumulate_stolen_time
> REST_GPR(0,r1)
> REST_4GPRS(3,r1)
> @@ -203,6 +198,7 @@ system_call: /* label this so stack traces look sane */
> mtctr r12
> bctrl /* Call handler */
>
> + /* syscall_exit can exit to kernel mode, via ret_from_kernel_thread */
> .Lsyscall_exit:
> std r3,RESULT(r1)
>
> @@ -216,11 +212,6 @@ system_call: /* label this so stack traces look sane */
> ld r12, PACA_THREAD_INFO(r13)
>
> ld r8,_MSR(r1)
> -#ifdef CONFIG_PPC_BOOK3S
> - /* No MSR:RI on BookE */
> - andi. r10,r8,MSR_RI
> - beq- .Lunrecov_restore
> -#endif
>
> /*
> * This is a few instructions into the actual syscall exit path (which actually
> diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
> index 6ba3cc2ef8ab..768f133de4f1 100644
> --- a/arch/powerpc/kernel/exceptions-64s.S
> +++ b/arch/powerpc/kernel/exceptions-64s.S
> @@ -1521,8 +1521,6 @@ EXC_COMMON(trap_0b_common, 0xb00, unknown_exception)
> * system call / hypercall (0xc00, 0x4c00)
> *
> * The system call exception is invoked with "sc 0" and does not alter HV bit.
> - * There is support for kernel code to invoke system calls but there are no
> - * in-tree users.
> *
> * The hypercall is invoked with "sc 1" and sets HV=1.
> *
>
^ permalink raw reply
* Re: [PATCH v2] powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB
From: Greg Kroah-Hartman @ 2019-08-27 6:18 UTC (permalink / raw)
To: Christophe Leroy
Cc: Alastair D'Silva, linux-kernel, stable, Paul Mackerras,
alastair, Thomas Gleixner, linuxppc-dev, Allison Randal
In-Reply-To: <bae6de93-f135-68c5-9118-a0732e6de301@c-s.fr>
On Mon, Aug 26, 2019 at 10:08:26PM +0200, Christophe Leroy wrote:
>
>
> Le 26/08/2019 à 18:50, Greg Kroah-Hartman a écrit :
> > On Wed, Aug 21, 2019 at 10:19:27AM +1000, Alastair D'Silva wrote:
> > > From: Alastair D'Silva <alastair@d-silva.org>
> > >
> > > The upstream commit:
> > > 22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()")
> > > has a similar effect, but since it is a rewrite of the assembler to C, is
> > > too invasive for stable. This patch is a minimal fix to address the issue in
> > > assembler.
> > >
> > > This patch applies cleanly to v5.2, v4.19 & v4.14.
> > >
> > > When calling flush_(inval_)dcache_range with a size >4GB, we were masking
> > > off the upper 32 bits, so we would incorrectly flush a range smaller
> > > than intended.
> > >
> > > This patch replaces the 32 bit shifts with 64 bit ones, so that
> > > the full size is accounted for.
> > >
> > > Changelog:
> > > v2
> > > - Add related upstream commit
> > >
> > > Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> > > ---
> > > arch/powerpc/kernel/misc_64.S | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
> > > index 1ad4089dd110..d4d096f80f4b 100644
> > > --- a/arch/powerpc/kernel/misc_64.S
> > > +++ b/arch/powerpc/kernel/misc_64.S
> > > @@ -130,7 +130,7 @@ _GLOBAL_TOC(flush_dcache_range)
> > > subf r8,r6,r4 /* compute length */
> > > add r8,r8,r5 /* ensure we get enough */
> > > lwz r9,DCACHEL1LOGBLOCKSIZE(r10) /* Get log-2 of dcache block size */
> > > - srw. r8,r8,r9 /* compute line count */
> > > + srd. r8,r8,r9 /* compute line count */
> > > beqlr /* nothing to do? */
> > > mtctr r8
> > > 0: dcbst 0,r6
> > > @@ -148,7 +148,7 @@ _GLOBAL(flush_inval_dcache_range)
> > > subf r8,r6,r4 /* compute length */
> > > add r8,r8,r5 /* ensure we get enough */
> > > lwz r9,DCACHEL1LOGBLOCKSIZE(r10)/* Get log-2 of dcache block size */
> > > - srw. r8,r8,r9 /* compute line count */
> > > + srd. r8,r8,r9 /* compute line count */
> > > beqlr /* nothing to do? */
> > > sync
> > > isync
> >
> > I need an ack from the powerpc maintainer(s) before I can take this.
>
> I think you already got an ack (on v1). See
> https://patchwork.ozlabs.org/patch/1147403/#2239663
How am I supposed to remember that? :)
greg k-h
^ permalink raw reply
* Patch "powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB" has been added to the 4.14-stable tree
From: gregkh @ 2019-08-27 6:19 UTC (permalink / raw)
To: alastair, alastair, allison, benh, gregkh, linuxppc-dev, mpe,
paulus, tglx
Cc: stable-commits
In-Reply-To: <20190821001929.4253-1-alastair@au1.ibm.com>
This is a note to let you know that I've just added the patch titled
powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
powerpc-allow-flush_-inval_-dcache_range-to-work-across-ranges-4gb.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From alastair@au1.ibm.com Tue Aug 27 08:18:42 2019
From: "Alastair D'Silva" <alastair@au1.ibm.com>
Date: Wed, 21 Aug 2019 10:19:27 +1000
Subject: powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB
To: alastair@d-silva.org
Cc: stable@vger.kernel.org, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Paul Mackerras <paulus@samba.org>, Michael Ellerman <mpe@ellerman.id.au>, Thomas Gleixner <tglx@linutronix.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Allison Randal <allison@lohutok.net>, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Message-ID: <20190821001929.4253-1-alastair@au1.ibm.com>
From: Alastair D'Silva <alastair@d-silva.org>
The upstream commit:
22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()")
has a similar effect, but since it is a rewrite of the assembler to C, is
too invasive for stable. This patch is a minimal fix to address the issue in
assembler.
This patch applies cleanly to v5.2, v4.19 & v4.14.
When calling flush_(inval_)dcache_range with a size >4GB, we were masking
off the upper 32 bits, so we would incorrectly flush a range smaller
than intended.
This patch replaces the 32 bit shifts with 64 bit ones, so that
the full size is accounted for.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kernel/misc_64.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -134,7 +134,7 @@ _GLOBAL_TOC(flush_dcache_range)
subf r8,r6,r4 /* compute length */
add r8,r8,r5 /* ensure we get enough */
lwz r9,DCACHEL1LOGBLOCKSIZE(r10) /* Get log-2 of dcache block size */
- srw. r8,r8,r9 /* compute line count */
+ srd. r8,r8,r9 /* compute line count */
beqlr /* nothing to do? */
mtctr r8
0: dcbst 0,r6
@@ -190,7 +190,7 @@ _GLOBAL(flush_inval_dcache_range)
subf r8,r6,r4 /* compute length */
add r8,r8,r5 /* ensure we get enough */
lwz r9,DCACHEL1LOGBLOCKSIZE(r10)/* Get log-2 of dcache block size */
- srw. r8,r8,r9 /* compute line count */
+ srd. r8,r8,r9 /* compute line count */
beqlr /* nothing to do? */
sync
isync
Patches currently in stable-queue which might be from alastair@au1.ibm.com are
queue-4.14/powerpc-allow-flush_-inval_-dcache_range-to-work-across-ranges-4gb.patch
^ permalink raw reply
* Re: [PATCH v2] powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB
From: Greg Kroah-Hartman @ 2019-08-27 6:19 UTC (permalink / raw)
To: Alastair D'Silva
Cc: alastair, linux-kernel, stable, Paul Mackerras, Thomas Gleixner,
linuxppc-dev, Allison Randal
In-Reply-To: <20190821001929.4253-1-alastair@au1.ibm.com>
On Wed, Aug 21, 2019 at 10:19:27AM +1000, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
>
> The upstream commit:
> 22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()")
> has a similar effect, but since it is a rewrite of the assembler to C, is
> too invasive for stable. This patch is a minimal fix to address the issue in
> assembler.
>
> This patch applies cleanly to v5.2, v4.19 & v4.14.
>
> When calling flush_(inval_)dcache_range with a size >4GB, we were masking
> off the upper 32 bits, so we would incorrectly flush a range smaller
> than intended.
>
> This patch replaces the 32 bit shifts with 64 bit ones, so that
> the full size is accounted for.
>
> Changelog:
> v2
> - Add related upstream commit
Now applied, thanks.
greg k-h
^ permalink raw reply
* Patch "powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB" has been added to the 4.19-stable tree
From: gregkh @ 2019-08-27 6:19 UTC (permalink / raw)
To: alastair, alastair, allison, benh, gregkh, linuxppc-dev, mpe,
paulus, tglx
Cc: stable-commits
In-Reply-To: <20190821001929.4253-1-alastair@au1.ibm.com>
This is a note to let you know that I've just added the patch titled
powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB
to the 4.19-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
powerpc-allow-flush_-inval_-dcache_range-to-work-across-ranges-4gb.patch
and it can be found in the queue-4.19 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From alastair@au1.ibm.com Tue Aug 27 08:18:42 2019
From: "Alastair D'Silva" <alastair@au1.ibm.com>
Date: Wed, 21 Aug 2019 10:19:27 +1000
Subject: powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB
To: alastair@d-silva.org
Cc: stable@vger.kernel.org, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Paul Mackerras <paulus@samba.org>, Michael Ellerman <mpe@ellerman.id.au>, Thomas Gleixner <tglx@linutronix.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Allison Randal <allison@lohutok.net>, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Message-ID: <20190821001929.4253-1-alastair@au1.ibm.com>
From: Alastair D'Silva <alastair@d-silva.org>
The upstream commit:
22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()")
has a similar effect, but since it is a rewrite of the assembler to C, is
too invasive for stable. This patch is a minimal fix to address the issue in
assembler.
This patch applies cleanly to v5.2, v4.19 & v4.14.
When calling flush_(inval_)dcache_range with a size >4GB, we were masking
off the upper 32 bits, so we would incorrectly flush a range smaller
than intended.
This patch replaces the 32 bit shifts with 64 bit ones, so that
the full size is accounted for.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kernel/misc_64.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -135,7 +135,7 @@ _GLOBAL_TOC(flush_dcache_range)
subf r8,r6,r4 /* compute length */
add r8,r8,r5 /* ensure we get enough */
lwz r9,DCACHEL1LOGBLOCKSIZE(r10) /* Get log-2 of dcache block size */
- srw. r8,r8,r9 /* compute line count */
+ srd. r8,r8,r9 /* compute line count */
beqlr /* nothing to do? */
mtctr r8
0: dcbst 0,r6
@@ -153,7 +153,7 @@ _GLOBAL(flush_inval_dcache_range)
subf r8,r6,r4 /* compute length */
add r8,r8,r5 /* ensure we get enough */
lwz r9,DCACHEL1LOGBLOCKSIZE(r10)/* Get log-2 of dcache block size */
- srw. r8,r8,r9 /* compute line count */
+ srd. r8,r8,r9 /* compute line count */
beqlr /* nothing to do? */
sync
isync
Patches currently in stable-queue which might be from alastair@au1.ibm.com are
queue-4.19/powerpc-allow-flush_-inval_-dcache_range-to-work-across-ranges-4gb.patch
^ permalink raw reply
* Patch "powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB" has been added to the 5.2-stable tree
From: gregkh @ 2019-08-27 6:20 UTC (permalink / raw)
To: alastair, alastair, allison, benh, gregkh, linuxppc-dev, mpe,
paulus, tglx
Cc: stable-commits
In-Reply-To: <20190821001929.4253-1-alastair@au1.ibm.com>
This is a note to let you know that I've just added the patch titled
powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB
to the 5.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
powerpc-allow-flush_-inval_-dcache_range-to-work-across-ranges-4gb.patch
and it can be found in the queue-5.2 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From alastair@au1.ibm.com Tue Aug 27 08:18:42 2019
From: "Alastair D'Silva" <alastair@au1.ibm.com>
Date: Wed, 21 Aug 2019 10:19:27 +1000
Subject: powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB
To: alastair@d-silva.org
Cc: stable@vger.kernel.org, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Paul Mackerras <paulus@samba.org>, Michael Ellerman <mpe@ellerman.id.au>, Thomas Gleixner <tglx@linutronix.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Allison Randal <allison@lohutok.net>, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Message-ID: <20190821001929.4253-1-alastair@au1.ibm.com>
From: Alastair D'Silva <alastair@d-silva.org>
The upstream commit:
22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()")
has a similar effect, but since it is a rewrite of the assembler to C, is
too invasive for stable. This patch is a minimal fix to address the issue in
assembler.
This patch applies cleanly to v5.2, v4.19 & v4.14.
When calling flush_(inval_)dcache_range with a size >4GB, we were masking
off the upper 32 bits, so we would incorrectly flush a range smaller
than intended.
This patch replaces the 32 bit shifts with 64 bit ones, so that
the full size is accounted for.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/kernel/misc_64.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -130,7 +130,7 @@ _GLOBAL_TOC(flush_dcache_range)
subf r8,r6,r4 /* compute length */
add r8,r8,r5 /* ensure we get enough */
lwz r9,DCACHEL1LOGBLOCKSIZE(r10) /* Get log-2 of dcache block size */
- srw. r8,r8,r9 /* compute line count */
+ srd. r8,r8,r9 /* compute line count */
beqlr /* nothing to do? */
mtctr r8
0: dcbst 0,r6
@@ -148,7 +148,7 @@ _GLOBAL(flush_inval_dcache_range)
subf r8,r6,r4 /* compute length */
add r8,r8,r5 /* ensure we get enough */
lwz r9,DCACHEL1LOGBLOCKSIZE(r10)/* Get log-2 of dcache block size */
- srw. r8,r8,r9 /* compute line count */
+ srd. r8,r8,r9 /* compute line count */
beqlr /* nothing to do? */
sync
isync
Patches currently in stable-queue which might be from alastair@au1.ibm.com are
queue-5.2/powerpc-allow-flush_-inval_-dcache_range-to-work-across-ranges-4gb.patch
^ permalink raw reply
* Re: [PATCH] powerpc: Perform a bounds check in arch_add_memory
From: Michal Hocko @ 2019-08-27 6:28 UTC (permalink / raw)
To: Alastair D'Silva
Cc: David Hildenbrand, alastair, linux-kernel, Mike Rapoport,
Paul Mackerras, Aneesh Kumar K.V, Andrew Morton, linuxppc-dev
In-Reply-To: <20190827052047.31547-1-alastair@au1.ibm.com>
On Tue 27-08-19 15:20:46, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
>
> It is possible for firmware to allocate memory ranges outside
> the range of physical memory that we support (MAX_PHYSMEM_BITS).
Doesn't that count as a FW bug? Do you have any evidence of that in the
field? Just wondering...
> This patch adds a bounds check to ensure that any hotplugged
> memory is addressable.
>
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> ---
> arch/powerpc/mm/mem.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index 9191a66b3bc5..de18fb73de30 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -111,6 +111,9 @@ int __ref arch_add_memory(int nid, u64 start, u64 size,
> unsigned long nr_pages = size >> PAGE_SHIFT;
> int rc;
>
> + if ((start + size - 1) >> MAX_PHYSMEM_BITS)
> + return -EINVAL;
> +
> resize_hpt_for_hotplug(memblock_phys_mem_size());
>
> start = (unsigned long)__va(start);
> --
> 2.21.0
--
Michal Hocko
SUSE Labs
^ permalink raw reply
* Re: [PATCH] powerpc: Perform a bounds check in arch_add_memory
From: Alastair D'Silva @ 2019-08-27 6:39 UTC (permalink / raw)
To: Michal Hocko
Cc: David Hildenbrand, linux-kernel, Mike Rapoport, Paul Mackerras,
Aneesh Kumar K.V, Andrew Morton, linuxppc-dev
In-Reply-To: <20190827062844.GQ7538@dhcp22.suse.cz>
On Tue, 2019-08-27 at 08:28 +0200, Michal Hocko wrote:
> On Tue 27-08-19 15:20:46, Alastair D'Silva wrote:
> > From: Alastair D'Silva <alastair@d-silva.org>
> >
> > It is possible for firmware to allocate memory ranges outside
> > the range of physical memory that we support (MAX_PHYSMEM_BITS).
>
> Doesn't that count as a FW bug? Do you have any evidence of that in
> the
> field? Just wondering...
>
Not outside our lab, but OpenCAPI attached LPC memory is assigned
addresses based on the slot/NPU it is connected to. These addresses
prior to:
4ffe713b7587 ("powerpc/mm: Increase the max addressable memory to 2PB")
were inaccessible and resulted in bogus sections - see our discussion
on 'mm: Trigger bug on if a section is not found in __section_nr'.
Doing this check here was your suggestion :)
It's entirely possible that a similar problem will occur in the future,
and it's cheap to guard against, which is why I've added this.
--
Alastair D'Silva
Open Source Developer
Linux Technology Centre, IBM Australia
mob: 0423 762 819
^ permalink raw reply
* Re: [PATCH 4/4] powerpc/64: system call implement the bulk of the logic in C
From: Christophe Leroy @ 2019-08-27 6:46 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev
In-Reply-To: <20190827033010.28090-6-npiggin@gmail.com>
Le 27/08/2019 à 05:30, Nicholas Piggin a écrit :
> System call entry and particularly exit code is beyond the limit of what
> is reasonable to implement in asm.
>
> This conversion moves all conditional branches out of the asm code,
> except a relatively simple test to see whether all GPRs should be
> restored at exit time.
>
> Null syscall test is about 5% faster after this patch, because the exit
> work is handled under local_irq_disable, and the hard mask and pending
> interrupt replay is handled after that, which avoids games with MSR.
Interesting optimisation.
>
> The asm instruction scheduling has not really been analysed and
> optimised yet, as there are higher level features and improvements to
> add first.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/include/asm/asm-prototypes.h | 11 -
> arch/powerpc/include/asm/ptrace.h | 3 +
> arch/powerpc/include/asm/signal.h | 2 +
> arch/powerpc/include/asm/switch_to.h | 4 +
> arch/powerpc/include/asm/time.h | 3 +
> arch/powerpc/kernel/Makefile | 3 +-
> arch/powerpc/kernel/entry_64.S | 343 ++++------------------
> arch/powerpc/kernel/process.c | 6 +-
> arch/powerpc/kernel/signal.h | 2 -
> arch/powerpc/kernel/syscall_64.c | 202 +++++++++++++
> 10 files changed, 271 insertions(+), 308 deletions(-)
> create mode 100644 arch/powerpc/kernel/syscall_64.c
>
[...]
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 24621e7e5033..f444525da9ce 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -1609,7 +1609,6 @@ int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
> extern void ret_from_kernel_thread(void);
> void (*f)(void);
> unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
> - struct thread_info *ti = task_thread_info(p);
>
> klp_init_thread_info(p);
>
> @@ -1617,6 +1616,8 @@ int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
> sp -= sizeof(struct pt_regs);
> childregs = (struct pt_regs *) sp;
> if (unlikely(p->flags & PF_KTHREAD)) {
> + struct thread_info *ti = task_thread_info(p);
> +
> /* kernel thread */
> memset(childregs, 0, sizeof(struct pt_regs));
> childregs->gpr[1] = sp + sizeof(struct pt_regs);
> @@ -1634,12 +1635,13 @@ int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
> } else {
> /* user thread */
> struct pt_regs *regs = current_pt_regs();
> +
> CHECK_FULL_REGS(regs);
> *childregs = *regs;
> if (usp)
> childregs->gpr[1] = usp;
> p->thread.regs = childregs;
> - childregs->gpr[3] = 0; /* Result from fork() */
> + /* ret_from_fork sets fork() result to 0 */
Does PPC32 ret_from_fork() do it as well ?
> if (clone_flags & CLONE_SETTLS) {
> #ifdef CONFIG_PPC64
> if (!is_32bit_task())
> diff --git a/arch/powerpc/kernel/signal.h b/arch/powerpc/kernel/signal.h
> index 800433685888..d396efca4068 100644
> --- a/arch/powerpc/kernel/signal.h
> +++ b/arch/powerpc/kernel/signal.h
> @@ -10,8 +10,6 @@
> #ifndef _POWERPC_ARCH_SIGNAL_H
> #define _POWERPC_ARCH_SIGNAL_H
>
> -extern void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags);
> -
> extern void __user *get_sigframe(struct ksignal *ksig, unsigned long sp,
> size_t frame_size, int is_32);
>
> diff --git a/arch/powerpc/kernel/syscall_64.c b/arch/powerpc/kernel/syscall_64.c
> new file mode 100644
> index 000000000000..98ed970796d5
> --- /dev/null
> +++ b/arch/powerpc/kernel/syscall_64.c
> @@ -0,0 +1,202 @@
> +#include <linux/err.h>
> +#include <asm/hw_irq.h>
> +#include <asm/paca.h>
> +#include <asm/ptrace.h>
> +#include <asm/reg.h>
> +#include <asm/signal.h>
> +#include <asm/switch_to.h>
> +#include <asm/syscall.h>
> +#include <asm/time.h>
> +
> +extern void __noreturn tabort_syscall(void);
> +
> +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
> +static inline void account_cpu_user_entry(void)
> +{
> + unsigned long tb = mftb();
> +
> + local_paca->accounting.utime += (tb - local_paca->accounting.starttime_user);
> + local_paca->accounting.starttime = tb;
> +}
> +static inline void account_cpu_user_exit(void)
> +{
> + unsigned long tb = mftb();
> +
> + local_paca->accounting.stime += (tb - local_paca->accounting.starttime);
> + local_paca->accounting.starttime_user = tb;
> +}
> +#else
> +static inline void account_cpu_user_entry(void)
> +{
> +}
> +static inline void account_cpu_user_exit(void)
> +{
> +}
> +#endif
I think this block should go in arch/powerpc/include/asm/cputime.h, we
should limit #ifdefs as much as possible in C files.
And use get_accounting() instead of local_paca->accounting in order to
be usable on PPC32 as well
> +
> +typedef long (*syscall_fn)(long, long, long, long, long, long);
> +
> +long system_call_exception(long r3, long r4, long r5, long r6, long r7, long r8, unsigned long r0, struct pt_regs *regs)
> +{
> + unsigned long ti_flags;
> + syscall_fn f;
> +
> + BUG_ON(!(regs->msr & MSR_PR));
> +
> +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
> + if (unlikely(regs->msr & MSR_TS_T))
> + tabort_syscall();
> +#endif
MSR_TS_T and tabort_syscall() are declared regardless of
CONFIG_PPC_TRANSACTIONAL_MEM so IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM)
should be used instead of #ifdef
> +
> + account_cpu_user_entry();
> +
> +#if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE) && defined(CONFIG_PPC_SPLPAR)
> + if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
> + struct lppaca *lp = get_lppaca();
> +
> + if (unlikely(local_paca->dtl_ridx != lp->dtl_idx))
> + accumulate_stolen_time();
> + }
> +#endif
Same here, I think everything is available so IS_ENABLED() should be
used instead of #if
> +
> +#ifdef CONFIG_PPC_KUAP_DEBUG
> + if (mmu_has_feature(MMU_FTR_RADIX_KUAP))
> + WARN_ON_ONCE(mfspr(SPRN_AMR) != AMR_KUAP_BLOCKED);
> +#endif
This should go in a helper in one of the kup/kuap header files.
> +
> + /*
> + * A syscall should always be called with interrupts enabled
> + * so we just unconditionally hard-enable here. When some kind
> + * of irq tracing is used, we additionally check that condition
> + * is correct
> + */
> +#if defined(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)
> + WARN_ON(irq_soft_mask_return() != IRQS_ENABLED);
> + WARN_ON(local_paca->irq_happened);
> +#endif
Can we use IS_ENABLED() here as well ?
> +
> + __hard_irq_enable();
> +
> + /*
> + * We do need to set SOFTE in the stack frame or the return
> + * from interrupt will be painful
> + */
> + regs->softe = IRQS_ENABLED;
> +
> + ti_flags = current_thread_info()->flags;
> + if (unlikely(ti_flags & _TIF_SYSCALL_DOTRACE)) {
> + /*
> + * We use the return value of do_syscall_trace_enter() as the
> + * syscall number. If the syscall was rejected for any reason
> + * do_syscall_trace_enter() returns an invalid syscall number
> + * and the test below against NR_syscalls will fail.
> + */
> + r0 = do_syscall_trace_enter(regs);
> + }
> +
> + if (unlikely(r0 >= NR_syscalls))
> + return -ENOSYS;
> +
> + /* May be faster to do array_index_nospec? */
> + barrier_nospec();
> +
> + if (unlikely(ti_flags & _TIF_32BIT)) {
> + f = (void *)compat_sys_call_table[r0];
> +
> + r3 &= 0x00000000ffffffffULL;
> + r4 &= 0x00000000ffffffffULL;
> + r5 &= 0x00000000ffffffffULL;
> + r6 &= 0x00000000ffffffffULL;
> + r7 &= 0x00000000ffffffffULL;
> + r8 &= 0x00000000ffffffffULL;
> +
> + } else {
> + f = (void *)sys_call_table[r0];
> + }
> +
> + return f(r3, r4, r5, r6, r7, r8);
> +}
> +
> +unsigned long syscall_exit_prepare(unsigned long r3, struct pt_regs *regs)
> +{
> + unsigned long *ti_flagsp = ¤t_thread_info()->flags;
> + unsigned long ti_flags;
> + unsigned long ret = 0;
> +
> + regs->result = r3;
> +
> + /* Check whether the syscall is issued inside a restartable sequence */
> + rseq_syscall(regs);
> +
> + ti_flags = *ti_flagsp;
> + if (unlikely(ti_flags & _TIF_SYSCALL_DOTRACE))
> + do_syscall_trace_leave(regs);
> +
> + if (unlikely(r3 >= (unsigned long)-MAX_ERRNO)) {
> + if (likely(!(ti_flags & (_TIF_NOERROR | _TIF_RESTOREALL)))) {
> + r3 = -r3;
> + regs->ccr |= 0x10000000; /* Set SO bit in CR */
> + }
> + }
> +
> + if (unlikely(ti_flags & _TIF_PERSYSCALL_MASK)) {
> + if (ti_flags & _TIF_RESTOREALL)
> + ret = _TIF_RESTOREALL;
> + else
> + regs->gpr[3] = r3;
> + clear_bits(_TIF_PERSYSCALL_MASK, ti_flagsp);
> + } else {
> + regs->gpr[3] = r3;
> + }
> +
> +again:
> + local_irq_disable();
> + ti_flags = READ_ONCE(*ti_flagsp);
> + while (unlikely(ti_flags & _TIF_USER_WORK_MASK)) {
> + local_irq_enable();
> + if (ti_flags & _TIF_NEED_RESCHED) {
> + schedule();
> + } else {
> + /*
> + * SIGPENDING must restore signal handler function
> + * argument GPRs, and some non-volatiles (e.g., r1).
> + * Restore all for now. This could be made lighter.
> + */
> + if (ti_flags & _TIF_SIGPENDING)
> + ret |= _TIF_RESTOREALL;
> + do_notify_resume(regs, ti_flags);
> + }
> + local_irq_disable();
> + ti_flags = READ_ONCE(*ti_flagsp);
> + }
> +
> +#ifdef CONFIG_ALTIVEC
> + if ((regs->msr & (MSR_FP|MSR_VEC)) != (MSR_FP|MSR_VEC))
> +#else
> + if ((regs->msr & MSR_FP) != MSR_FP)
> +#endif
Use 'if (IS_ENABLED(CONFIG_ALTIVEC)) / else' instead of an
#ifdef/#else/#endif
> + restore_math(regs);
> +
> + /* This pattern matches prep_irq_for_idle */
> + __mtmsrd(0, 1); /* Disable MSR_EE and MSR_RI */
> + if (unlikely(lazy_irq_pending())) {
> + __mtmsrd(MSR_RI, 1);
> + local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
> + local_irq_enable();
> + /* Took an interrupt which may have more exit work to do. */
> + goto again;
> + }
> + trace_hardirqs_on();
> + local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS;
> + irq_soft_mask_set(IRQS_ENABLED);
> +
> + account_cpu_user_exit();
> +
> +#ifdef CONFIG_PPC_KUAP_DEBUG
> + if (mmu_has_feature(MMU_FTR_RADIX_KUAP))
> + WARN_ON_ONCE(mfspr(SPRN_AMR) != AMR_KUAP_BLOCKED);
> +#endif
Same, define a helper in the kuap header files to avoid the #ifdefs and
platform specif stuff here.
> +
> + return ret;
> +}
> +
>
Christophe
^ permalink raw reply
* Re: [PATCH 2/3] powerpc/numa: Early request for home node associativity
From: Srikar Dronamraju @ 2019-08-27 6:57 UTC (permalink / raw)
To: Satheesh Rajendran; +Cc: Nathan Lynch, linuxppc-dev, Nicholas Piggin
In-Reply-To: <20190823071632.GA10037@sathnaga86>
Hi Satheesh,
> > Currently the kernel detects if its running on a shared lpar platform
> > and requests home node associativity before the scheduler sched_domains
> > are setup. However between the time NUMA setup is initialized and the
> > request for home node associativity, workqueue initializes its per node
> > cpumask. The per node workqueue possible cpumask may turn invalid
> > after home node associativity resulting in weird situations like
> > workqueue possible cpumask being a subset of workqueue online cpumask.
>
> Env:
> HW: Power8
> Host/Guest Kernel: 5.3.0-rc5-00172-g13e3f1076e29 (linux master + this series)
> Qemu: 4.0.90 (v4.1.0-rc3)
>
> Guest Config:
> ..
> <vcpu placement='static' current='2'>4</vcpu>
> ...
> <kernel>/home/kvmci/linux/vmlinux</kernel>
> <cmdline>root=/dev/sda2 rw console=tty0 console=ttyS0,115200 init=/sbin/init initcall_debug numa=debug crashkernel=1024M selinux=0</cmdline>
> ...
> <topology sockets='1' cores='2' threads='2'/>
> <numa>
> <cell id='0' cpus='0-1' memory='2097152' unit='KiB'/>
> <cell id='1' cpus='2-3' memory='2097152' unit='KiB'/>
> </numa>
>
> Event:
> vcpu hotplug
>
> [root@atest-guest ~]# [ 41.447170] random: crng init done
> [ 41.448153] random: 7 urandom warning(s) missed due to ratelimiting
> [ 51.727256] VPHN hcall succeeded. Reset polling...
> [ 51.826301] adding cpu 2 to node 1
> [ 51.856238] WARNING: workqueue cpumask: online intersect > possible intersect
> [ 51.916297] VPHN hcall succeeded. Reset polling...
> [ 52.036272] adding cpu 3 to node 1
>
Thanks for testing.
The fix for this patch series was to make sure per node workqueue possible
cpus is updated correctly at boot. However Node hotplug on KVM guests and
dlpar on PowerVM lpars aren't covered by this patch series. On systems that
support shared processor, the associativity of the possible cpus is not
known at boot time. Hence we will not be able to update the per node
workquque possible cpumask.
--
Thanks and Regards
Srikar Dronamraju
^ permalink raw reply
* Re: [PATCH] powerpc: Perform a bounds check in arch_add_memory
From: David Hildenbrand @ 2019-08-27 7:13 UTC (permalink / raw)
To: Alastair D'Silva, Michal Hocko
Cc: linux-kernel, Mike Rapoport, Paul Mackerras, Aneesh Kumar K.V,
Andrew Morton, linuxppc-dev
In-Reply-To: <ea9e43fff6b6531af0620f9df62e015af66d4535.camel@au1.ibm.com>
On 27.08.19 08:39, Alastair D'Silva wrote:
> On Tue, 2019-08-27 at 08:28 +0200, Michal Hocko wrote:
>> On Tue 27-08-19 15:20:46, Alastair D'Silva wrote:
>>> From: Alastair D'Silva <alastair@d-silva.org>
>>>
>>> It is possible for firmware to allocate memory ranges outside
>>> the range of physical memory that we support (MAX_PHYSMEM_BITS).
>>
>> Doesn't that count as a FW bug? Do you have any evidence of that in
>> the
>> field? Just wondering...
>>
>
> Not outside our lab, but OpenCAPI attached LPC memory is assigned
> addresses based on the slot/NPU it is connected to. These addresses
> prior to:
> 4ffe713b7587 ("powerpc/mm: Increase the max addressable memory to 2PB")
> were inaccessible and resulted in bogus sections - see our discussion
> on 'mm: Trigger bug on if a section is not found in __section_nr'.
> Doing this check here was your suggestion :)
>
> It's entirely possible that a similar problem will occur in the future,
> and it's cheap to guard against, which is why I've added this.
>
If you keep it here, I guess this should be wrapped by a WARN_ON_ONCE().
If we move it to common code (e.g., __add_pages() or add_memory()), then
probably not. I can see that s390x allows to configure MAX_PHYSMEM_BITS,
so the check could actually make sense.
--
Thanks,
David / dhildenb
^ permalink raw reply
* [PATCH] perf arch powerpc: Sync powerpc syscall.tbl
From: Naveen N. Rao @ 2019-08-27 7:14 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ravi Bangoria, linuxppc-dev, linux-kernel, Nicholas Piggin
Copy over powerpc syscall.tbl to grab changes from the below commits:
commit cee3536d24a1 ("powerpc: Wire up clone3 syscall")
commit 1a271a68e030 ("arch: mark syscall number 435 reserved for clone3")
commit 7615d9e1780e ("arch: wire-up pidfd_open()")
commit d8076bdb56af ("uapi: Wire up the mount API syscalls on non-x86 arches [ver #2]")
commit 39036cd27273 ("arch: add pidfd and io_uring syscalls everywhere")
commit 48166e6ea47d ("y2038: add 64-bit time_t syscalls to all 32-bit architectures")
commit d33c577cccd0 ("y2038: rename old time and utime syscalls")
commit 00bf25d693e7 ("y2038: use time32 syscall names on 32-bit")
commit 8dabe7245bbc ("y2038: syscalls: rename y2038 compat syscalls")
commit 0d6040d46817 ("arch: add split IPC system calls where needed")
Reported-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
.../arch/powerpc/entry/syscalls/syscall.tbl | 146 ++++++++++++++----
1 file changed, 119 insertions(+), 27 deletions(-)
diff --git a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
index db3bbb8744af..43f736ed47f2 100644
--- a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
+++ b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
@@ -20,7 +20,9 @@
10 common unlink sys_unlink
11 nospu execve sys_execve compat_sys_execve
12 common chdir sys_chdir
-13 common time sys_time compat_sys_time
+13 32 time sys_time32
+13 64 time sys_time
+13 spu time sys_time
14 common mknod sys_mknod
15 common chmod sys_chmod
16 common lchown sys_lchown
@@ -36,14 +38,17 @@
22 spu umount sys_ni_syscall
23 common setuid sys_setuid
24 common getuid sys_getuid
-25 common stime sys_stime compat_sys_stime
+25 32 stime sys_stime32
+25 64 stime sys_stime
+25 spu stime sys_stime
26 nospu ptrace sys_ptrace compat_sys_ptrace
27 common alarm sys_alarm
28 32 oldfstat sys_fstat sys_ni_syscall
28 64 oldfstat sys_ni_syscall
28 spu oldfstat sys_ni_syscall
29 nospu pause sys_pause
-30 nospu utime sys_utime compat_sys_utime
+30 32 utime sys_utime32
+30 64 utime sys_utime
31 common stty sys_ni_syscall
32 common gtty sys_ni_syscall
33 common access sys_access
@@ -157,7 +162,9 @@
121 common setdomainname sys_setdomainname
122 common uname sys_newuname
123 common modify_ldt sys_ni_syscall
-124 common adjtimex sys_adjtimex compat_sys_adjtimex
+124 32 adjtimex sys_adjtimex_time32
+124 64 adjtimex sys_adjtimex
+124 spu adjtimex sys_adjtimex
125 common mprotect sys_mprotect
126 32 sigprocmask sys_sigprocmask compat_sys_sigprocmask
126 64 sigprocmask sys_ni_syscall
@@ -198,8 +205,12 @@
158 common sched_yield sys_sched_yield
159 common sched_get_priority_max sys_sched_get_priority_max
160 common sched_get_priority_min sys_sched_get_priority_min
-161 common sched_rr_get_interval sys_sched_rr_get_interval compat_sys_sched_rr_get_interval
-162 common nanosleep sys_nanosleep compat_sys_nanosleep
+161 32 sched_rr_get_interval sys_sched_rr_get_interval_time32
+161 64 sched_rr_get_interval sys_sched_rr_get_interval
+161 spu sched_rr_get_interval sys_sched_rr_get_interval
+162 32 nanosleep sys_nanosleep_time32
+162 64 nanosleep sys_nanosleep
+162 spu nanosleep sys_nanosleep
163 common mremap sys_mremap
164 common setresuid sys_setresuid
165 common getresuid sys_getresuid
@@ -213,7 +224,8 @@
173 nospu rt_sigaction sys_rt_sigaction compat_sys_rt_sigaction
174 nospu rt_sigprocmask sys_rt_sigprocmask compat_sys_rt_sigprocmask
175 nospu rt_sigpending sys_rt_sigpending compat_sys_rt_sigpending
-176 nospu rt_sigtimedwait sys_rt_sigtimedwait compat_sys_rt_sigtimedwait
+176 32 rt_sigtimedwait sys_rt_sigtimedwait_time32 compat_sys_rt_sigtimedwait_time32
+176 64 rt_sigtimedwait sys_rt_sigtimedwait
177 nospu rt_sigqueueinfo sys_rt_sigqueueinfo compat_sys_rt_sigqueueinfo
178 nospu rt_sigsuspend sys_rt_sigsuspend compat_sys_rt_sigsuspend
179 common pread64 sys_pread64 compat_sys_pread64
@@ -260,7 +272,9 @@
218 common removexattr sys_removexattr
219 common lremovexattr sys_lremovexattr
220 common fremovexattr sys_fremovexattr
-221 common futex sys_futex compat_sys_futex
+221 32 futex sys_futex_time32
+221 64 futex sys_futex
+221 spu futex sys_futex
222 common sched_setaffinity sys_sched_setaffinity compat_sys_sched_setaffinity
223 common sched_getaffinity sys_sched_getaffinity compat_sys_sched_getaffinity
# 224 unused
@@ -268,7 +282,9 @@
226 32 sendfile64 sys_sendfile64 compat_sys_sendfile64
227 common io_setup sys_io_setup compat_sys_io_setup
228 common io_destroy sys_io_destroy
-229 common io_getevents sys_io_getevents compat_sys_io_getevents
+229 32 io_getevents sys_io_getevents_time32
+229 64 io_getevents sys_io_getevents
+229 spu io_getevents sys_io_getevents
230 common io_submit sys_io_submit compat_sys_io_submit
231 common io_cancel sys_io_cancel
232 nospu set_tid_address sys_set_tid_address
@@ -280,19 +296,33 @@
238 common epoll_wait sys_epoll_wait
239 common remap_file_pages sys_remap_file_pages
240 common timer_create sys_timer_create compat_sys_timer_create
-241 common timer_settime sys_timer_settime compat_sys_timer_settime
-242 common timer_gettime sys_timer_gettime compat_sys_timer_gettime
+241 32 timer_settime sys_timer_settime32
+241 64 timer_settime sys_timer_settime
+241 spu timer_settime sys_timer_settime
+242 32 timer_gettime sys_timer_gettime32
+242 64 timer_gettime sys_timer_gettime
+242 spu timer_gettime sys_timer_gettime
243 common timer_getoverrun sys_timer_getoverrun
244 common timer_delete sys_timer_delete
-245 common clock_settime sys_clock_settime compat_sys_clock_settime
-246 common clock_gettime sys_clock_gettime compat_sys_clock_gettime
-247 common clock_getres sys_clock_getres compat_sys_clock_getres
-248 common clock_nanosleep sys_clock_nanosleep compat_sys_clock_nanosleep
+245 32 clock_settime sys_clock_settime32
+245 64 clock_settime sys_clock_settime
+245 spu clock_settime sys_clock_settime
+246 32 clock_gettime sys_clock_gettime32
+246 64 clock_gettime sys_clock_gettime
+246 spu clock_gettime sys_clock_gettime
+247 32 clock_getres sys_clock_getres_time32
+247 64 clock_getres sys_clock_getres
+247 spu clock_getres sys_clock_getres
+248 32 clock_nanosleep sys_clock_nanosleep_time32
+248 64 clock_nanosleep sys_clock_nanosleep
+248 spu clock_nanosleep sys_clock_nanosleep
249 32 swapcontext ppc_swapcontext ppc32_swapcontext
249 64 swapcontext ppc64_swapcontext
249 spu swapcontext sys_ni_syscall
250 common tgkill sys_tgkill
-251 common utimes sys_utimes compat_sys_utimes
+251 32 utimes sys_utimes_time32
+251 64 utimes sys_utimes
+251 spu utimes sys_utimes
252 common statfs64 sys_statfs64 compat_sys_statfs64
253 common fstatfs64 sys_fstatfs64 compat_sys_fstatfs64
254 32 fadvise64_64 ppc_fadvise64_64
@@ -308,8 +338,10 @@
261 nospu set_mempolicy sys_set_mempolicy compat_sys_set_mempolicy
262 nospu mq_open sys_mq_open compat_sys_mq_open
263 nospu mq_unlink sys_mq_unlink
-264 nospu mq_timedsend sys_mq_timedsend compat_sys_mq_timedsend
-265 nospu mq_timedreceive sys_mq_timedreceive compat_sys_mq_timedreceive
+264 32 mq_timedsend sys_mq_timedsend_time32
+264 64 mq_timedsend sys_mq_timedsend
+265 32 mq_timedreceive sys_mq_timedreceive_time32
+265 64 mq_timedreceive sys_mq_timedreceive
266 nospu mq_notify sys_mq_notify compat_sys_mq_notify
267 nospu mq_getsetattr sys_mq_getsetattr compat_sys_mq_getsetattr
268 nospu kexec_load sys_kexec_load compat_sys_kexec_load
@@ -324,8 +356,10 @@
277 nospu inotify_rm_watch sys_inotify_rm_watch
278 nospu spu_run sys_spu_run
279 nospu spu_create sys_spu_create
-280 nospu pselect6 sys_pselect6 compat_sys_pselect6
-281 nospu ppoll sys_ppoll compat_sys_ppoll
+280 32 pselect6 sys_pselect6_time32 compat_sys_pselect6_time32
+280 64 pselect6 sys_pselect6
+281 32 ppoll sys_ppoll_time32 compat_sys_ppoll_time32
+281 64 ppoll sys_ppoll
282 common unshare sys_unshare
283 common splice sys_splice
284 common tee sys_tee
@@ -334,7 +368,9 @@
287 common mkdirat sys_mkdirat
288 common mknodat sys_mknodat
289 common fchownat sys_fchownat
-290 common futimesat sys_futimesat compat_sys_futimesat
+290 32 futimesat sys_futimesat_time32
+290 64 futimesat sys_futimesat
+290 spu utimesat sys_futimesat
291 32 fstatat64 sys_fstatat64
291 64 newfstatat sys_newfstatat
291 spu newfstatat sys_newfstatat
@@ -350,15 +386,21 @@
301 common move_pages sys_move_pages compat_sys_move_pages
302 common getcpu sys_getcpu
303 nospu epoll_pwait sys_epoll_pwait compat_sys_epoll_pwait
-304 common utimensat sys_utimensat compat_sys_utimensat
+304 32 utimensat sys_utimensat_time32
+304 64 utimensat sys_utimensat
+304 spu utimensat sys_utimensat
305 common signalfd sys_signalfd compat_sys_signalfd
306 common timerfd_create sys_timerfd_create
307 common eventfd sys_eventfd
308 common sync_file_range2 sys_sync_file_range2 compat_sys_sync_file_range2
309 nospu fallocate sys_fallocate compat_sys_fallocate
310 nospu subpage_prot sys_subpage_prot
-311 common timerfd_settime sys_timerfd_settime compat_sys_timerfd_settime
-312 common timerfd_gettime sys_timerfd_gettime compat_sys_timerfd_gettime
+311 32 timerfd_settime sys_timerfd_settime32
+311 64 timerfd_settime sys_timerfd_settime
+311 spu timerfd_settime sys_timerfd_settime
+312 32 timerfd_gettime sys_timerfd_gettime32
+312 64 timerfd_gettime sys_timerfd_gettime
+312 spu timerfd_gettime sys_timerfd_gettime
313 common signalfd4 sys_signalfd4 compat_sys_signalfd4
314 common eventfd2 sys_eventfd2
315 common epoll_create1 sys_epoll_create1
@@ -389,11 +431,15 @@
340 common getsockopt sys_getsockopt compat_sys_getsockopt
341 common sendmsg sys_sendmsg compat_sys_sendmsg
342 common recvmsg sys_recvmsg compat_sys_recvmsg
-343 common recvmmsg sys_recvmmsg compat_sys_recvmmsg
+343 32 recvmmsg sys_recvmmsg_time32 compat_sys_recvmmsg_time32
+343 64 recvmmsg sys_recvmmsg
+343 spu recvmmsg sys_recvmmsg
344 common accept4 sys_accept4
345 common name_to_handle_at sys_name_to_handle_at
346 common open_by_handle_at sys_open_by_handle_at compat_sys_open_by_handle_at
-347 common clock_adjtime sys_clock_adjtime compat_sys_clock_adjtime
+347 32 clock_adjtime sys_clock_adjtime32
+347 64 clock_adjtime sys_clock_adjtime
+347 spu clock_adjtime sys_clock_adjtime
348 common syncfs sys_syncfs
349 common sendmmsg sys_sendmmsg compat_sys_sendmmsg
350 common setns sys_setns
@@ -414,6 +460,7 @@
363 spu switch_endian sys_ni_syscall
364 common userfaultfd sys_userfaultfd
365 common membarrier sys_membarrier
+# 366-377 originally left for IPC, now unused
378 nospu mlock2 sys_mlock2
379 nospu copy_file_range sys_copy_file_range
380 common preadv2 sys_preadv2 compat_sys_preadv2
@@ -424,4 +471,49 @@
385 nospu pkey_free sys_pkey_free
386 nospu pkey_mprotect sys_pkey_mprotect
387 nospu rseq sys_rseq
-388 nospu io_pgetevents sys_io_pgetevents compat_sys_io_pgetevents
+388 32 io_pgetevents sys_io_pgetevents_time32 compat_sys_io_pgetevents
+388 64 io_pgetevents sys_io_pgetevents
+# room for arch specific syscalls
+392 64 semtimedop sys_semtimedop
+393 common semget sys_semget
+394 common semctl sys_semctl compat_sys_semctl
+395 common shmget sys_shmget
+396 common shmctl sys_shmctl compat_sys_shmctl
+397 common shmat sys_shmat compat_sys_shmat
+398 common shmdt sys_shmdt
+399 common msgget sys_msgget
+400 common msgsnd sys_msgsnd compat_sys_msgsnd
+401 common msgrcv sys_msgrcv compat_sys_msgrcv
+402 common msgctl sys_msgctl compat_sys_msgctl
+403 32 clock_gettime64 sys_clock_gettime sys_clock_gettime
+404 32 clock_settime64 sys_clock_settime sys_clock_settime
+405 32 clock_adjtime64 sys_clock_adjtime sys_clock_adjtime
+406 32 clock_getres_time64 sys_clock_getres sys_clock_getres
+407 32 clock_nanosleep_time64 sys_clock_nanosleep sys_clock_nanosleep
+408 32 timer_gettime64 sys_timer_gettime sys_timer_gettime
+409 32 timer_settime64 sys_timer_settime sys_timer_settime
+410 32 timerfd_gettime64 sys_timerfd_gettime sys_timerfd_gettime
+411 32 timerfd_settime64 sys_timerfd_settime sys_timerfd_settime
+412 32 utimensat_time64 sys_utimensat sys_utimensat
+413 32 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64
+414 32 ppoll_time64 sys_ppoll compat_sys_ppoll_time64
+416 32 io_pgetevents_time64 sys_io_pgetevents sys_io_pgetevents
+417 32 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64
+418 32 mq_timedsend_time64 sys_mq_timedsend sys_mq_timedsend
+419 32 mq_timedreceive_time64 sys_mq_timedreceive sys_mq_timedreceive
+420 32 semtimedop_time64 sys_semtimedop sys_semtimedop
+421 32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64
+422 32 futex_time64 sys_futex sys_futex
+423 32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval
+424 common pidfd_send_signal sys_pidfd_send_signal
+425 common io_uring_setup sys_io_uring_setup
+426 common io_uring_enter sys_io_uring_enter
+427 common io_uring_register sys_io_uring_register
+428 common open_tree sys_open_tree
+429 common move_mount sys_move_mount
+430 common fsopen sys_fsopen
+431 common fsconfig sys_fsconfig
+432 common fsmount sys_fsmount
+433 common fspick sys_fspick
+434 common pidfd_open sys_pidfd_open
+435 nospu clone3 ppc_clone3
--
2.23.0
^ permalink raw reply related
* Re: [PATCH] powerpc: Perform a bounds check in arch_add_memory
From: Michal Hocko @ 2019-08-27 7:18 UTC (permalink / raw)
To: Alastair D'Silva
Cc: David Hildenbrand, linux-kernel, Mike Rapoport, Paul Mackerras,
Aneesh Kumar K.V, Andrew Morton, linuxppc-dev
In-Reply-To: <ea9e43fff6b6531af0620f9df62e015af66d4535.camel@au1.ibm.com>
On Tue 27-08-19 16:39:56, Alastair D'Silva wrote:
> On Tue, 2019-08-27 at 08:28 +0200, Michal Hocko wrote:
> > On Tue 27-08-19 15:20:46, Alastair D'Silva wrote:
> > > From: Alastair D'Silva <alastair@d-silva.org>
> > >
> > > It is possible for firmware to allocate memory ranges outside
> > > the range of physical memory that we support (MAX_PHYSMEM_BITS).
> >
> > Doesn't that count as a FW bug? Do you have any evidence of that in
> > the
> > field? Just wondering...
> >
>
> Not outside our lab, but OpenCAPI attached LPC memory is assigned
> addresses based on the slot/NPU it is connected to. These addresses
> prior to:
> 4ffe713b7587 ("powerpc/mm: Increase the max addressable memory to 2PB")
> were inaccessible and resulted in bogus sections - see our discussion
> on 'mm: Trigger bug on if a section is not found in __section_nr'.
Please document this in the changelog
--
Michal Hocko
SUSE Labs
^ permalink raw reply
* Re: [PATCH] ASoC: imx-audmix: register the card on a proper dev
From: Daniel Baluta @ 2019-08-27 7:44 UTC (permalink / raw)
To: timur@kernel.org, Xiubo.Lee@gmail.com, nicoleotsuka@gmail.com,
festevam@gmail.com, broonie@kernel.org, tiwai@suse.com,
lgirdwood@gmail.com, shawnguo@kernel.org, S.j. Wang, Viorel Suman,
perex@perex.cz, kernel@pengutronix.de,
alsa-devel@alsa-project.org, s.hauer@pengutronix.de
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, dl-linux-imx
In-Reply-To: <1566921315-23402-1-git-send-email-shengjiu.wang@nxp.com>
On Tue, 2019-08-27 at 11:55 -0400, Shengjiu Wang wrote:
> This platform device is registered from "fsl_audmix", which is
> its parent device. If use pdev->dev.parent for the priv->card.dev,
> the value set by dev_set_drvdata in parent device will be covered
> by the value in child device.
>
> Fixes: b86ef5367761 ("ASoC: fsl: Add Audio Mixer machine driver")
> Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Thanks Shengjiu for the fix!
> ---
> sound/soc/fsl/imx-audmix.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/fsl/imx-audmix.c b/sound/soc/fsl/imx-audmix.c
> index 9e1cb18859ce..71590ca6394b 100644
> --- a/sound/soc/fsl/imx-audmix.c
> +++ b/sound/soc/fsl/imx-audmix.c
> @@ -325,14 +325,14 @@ static int imx_audmix_probe(struct
> platform_device *pdev)
> priv->card.num_configs = priv->num_dai_conf;
> priv->card.dapm_routes = priv->dapm_routes;
> priv->card.num_dapm_routes = priv->num_dapm_routes;
> - priv->card.dev = pdev->dev.parent;
> + priv->card.dev = &pdev->dev;
> priv->card.owner = THIS_MODULE;
> priv->card.name = "imx-audmix";
>
> platform_set_drvdata(pdev, &priv->card);
> snd_soc_card_set_drvdata(&priv->card, priv);
>
> - ret = devm_snd_soc_register_card(pdev->dev.parent, &priv-
> >card);
> + ret = devm_snd_soc_register_card(&pdev->dev, &priv->card);
> if (ret) {
> dev_err(&pdev->dev, "snd_soc_register_card failed\n");
> return ret;
^ permalink raw reply
* Re: [PATCH 3/4] powerpc/64: system call remove non-volatile GPR save optimisation
From: Segher Boessenkool @ 2019-08-27 8:10 UTC (permalink / raw)
To: Nicholas Piggin; +Cc: linuxppc-dev
In-Reply-To: <20190827033010.28090-5-npiggin@gmail.com>
On Tue, Aug 27, 2019 at 01:30:09PM +1000, Nicholas Piggin wrote:
> -435 nospu clone3 ppc_clone3
> +435 32 clone3 ppc_clone3 sys_clone3
> +435 64 clone3 sys_clone3
> +435 nospu clone3 sys_ni_syscall
s/no// on that last line. Rest looks good to me :-)
Segher
^ permalink raw reply
* [PATCH 2/2] powerpc: cleanup hw_irq.h
From: Christophe Leroy @ 2019-08-27 8:13 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <0f7e164afb5d1b022441559fe5a999bb6d3c0a23.1566893505.git.christophe.leroy@c-s.fr>
SET_MSR_EE() is just use in this file and doesn't provide
any added value compared to mtmsr(). Drop it.
Add macros to use wrtee/wrteei insn.
Replace #ifdefs by IS_ENABLED()
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
arch/powerpc/include/asm/hw_irq.h | 57 ++++++++++++++++++---------------------
arch/powerpc/include/asm/reg.h | 2 ++
2 files changed, 28 insertions(+), 31 deletions(-)
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 32a18f2f49bc..c25d57f25a8b 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -226,8 +226,8 @@ static inline bool arch_irqs_disabled(void)
#endif /* CONFIG_PPC_BOOK3S */
#ifdef CONFIG_PPC_BOOK3E
-#define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory")
-#define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory")
+#define __hard_irq_enable() wrteei(1)
+#define __hard_irq_disable() wrteei(0)
#else
#define __hard_irq_enable() __mtmsrd(MSR_EE|MSR_RI, 1)
#define __hard_irq_disable() __mtmsrd(MSR_RI, 1)
@@ -280,8 +280,6 @@ extern void force_external_irq_replay(void);
#else /* CONFIG_PPC64 */
-#define SET_MSR_EE(x) mtmsr(x)
-
static inline unsigned long arch_local_save_flags(void)
{
return mfmsr();
@@ -289,47 +287,44 @@ static inline unsigned long arch_local_save_flags(void)
static inline void arch_local_irq_restore(unsigned long flags)
{
-#if defined(CONFIG_BOOKE)
- asm volatile("wrtee %0" : : "r" (flags) : "memory");
-#else
- mtmsr(flags);
-#endif
+ if (IS_ENABLED(CONFIG_BOOKE))
+ wrtee(flags);
+ else
+ mtmsr(flags);
}
static inline unsigned long arch_local_irq_save(void)
{
unsigned long flags = arch_local_save_flags();
-#ifdef CONFIG_BOOKE
- asm volatile("wrteei 0" : : : "memory");
-#elif defined(CONFIG_PPC_8xx)
- wrtspr(SPRN_EID);
-#else
- SET_MSR_EE(flags & ~MSR_EE);
-#endif
+
+ if (IS_ENABLED(CONFIG_BOOKE))
+ wrteei(0);
+ else if (IS_ENABLED(CONFIG_PPC_8xx))
+ wrtspr(SPRN_EID);
+ else
+ mtmsr(flags & ~MSR_EE);
+
return flags;
}
static inline void arch_local_irq_disable(void)
{
-#ifdef CONFIG_BOOKE
- asm volatile("wrteei 0" : : : "memory");
-#elif defined(CONFIG_PPC_8xx)
- wrtspr(SPRN_EID);
-#else
- arch_local_irq_save();
-#endif
+ if (IS_ENABLED(CONFIG_BOOKE))
+ wrteei(0);
+ else if (IS_ENABLED(CONFIG_PPC_8xx))
+ wrtspr(SPRN_EID);
+ else
+ mtmsr(mfmsr() & ~MSR_EE);
}
static inline void arch_local_irq_enable(void)
{
-#ifdef CONFIG_BOOKE
- asm volatile("wrteei 1" : : : "memory");
-#elif defined(CONFIG_PPC_8xx)
- wrtspr(SPRN_EIE);
-#else
- unsigned long msr = mfmsr();
- SET_MSR_EE(msr | MSR_EE);
-#endif
+ if (IS_ENABLED(CONFIG_BOOKE))
+ wrteei(1);
+ else if (IS_ENABLED(CONFIG_PPC_8xx))
+ wrtspr(SPRN_EIE);
+ else
+ mtmsr(mfmsr() | MSR_EE);
}
static inline bool arch_irqs_disabled_flags(unsigned long flags)
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index b17ee25df226..04896dd09455 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1361,6 +1361,8 @@ static inline void mtmsr_isync(unsigned long val)
#endif
#define wrtspr(rn) asm volatile("mtspr " __stringify(rn) ",0" : \
: : "memory")
+#define wrtee(val) asm volatile("wrtee %0" : : "r" (val) : "memory")
+#define wrteei(val) asm volatile("wrteei %0" : : "i" (val) : "memory")
extern unsigned long msr_check_and_set(unsigned long bits);
extern bool strict_msr_control;
--
2.13.3
^ permalink raw reply related
* [PATCH 1/2] powerpc: permanently include 8xx registers in reg.h
From: Christophe Leroy @ 2019-08-27 8:13 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
Most 8xx registers have specific names, so just include
reg_8xx.h all the time in reg.h in order to have them defined
even when CONFIG_PPC_8xx is not selected. This will avoid
the need for #ifdefs in C code.
Guard SPRN_ICTRL in an #ifdef CONFIG_PPC_8xx as this register
has same name but different meaning and different spr number as
another register in the mpc7450.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
arch/powerpc/include/asm/reg.h | 2 --
arch/powerpc/include/asm/reg_8xx.h | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 10caa145f98b..b17ee25df226 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -25,9 +25,7 @@
#include <asm/reg_fsl_emb.h>
#endif
-#ifdef CONFIG_PPC_8xx
#include <asm/reg_8xx.h>
-#endif /* CONFIG_PPC_8xx */
#define MSR_SF_LG 63 /* Enable 64 bit mode */
#define MSR_ISF_LG 61 /* Interrupt 64b mode valid on 630 */
diff --git a/arch/powerpc/include/asm/reg_8xx.h b/arch/powerpc/include/asm/reg_8xx.h
index 7192eece6c3e..abc663c0f1db 100644
--- a/arch/powerpc/include/asm/reg_8xx.h
+++ b/arch/powerpc/include/asm/reg_8xx.h
@@ -38,7 +38,9 @@
#define SPRN_CMPF 153
#define SPRN_LCTRL1 156
#define SPRN_LCTRL2 157
+#ifdef CONFIG_PPC_8xx
#define SPRN_ICTRL 158
+#endif
#define SPRN_BAR 159
/* Commands. Only the first few are available to the instruction cache.
--
2.13.3
^ permalink raw reply related
* Re: [PATCH 1/3] powerpc/64: __ioremap_at clean up in the error case
From: Nicholas Piggin @ 2019-08-27 8:16 UTC (permalink / raw)
To: Christophe Leroy, linuxppc-dev
In-Reply-To: <c11ab8b7-86ef-c5c6-1392-b5c20fc8e185@c-s.fr>
Christophe Leroy's on August 20, 2019 5:44 pm:
> Hi Nick,
>
> Le 10/06/2019 à 05:08, Nicholas Piggin a écrit :
>> __ioremap_at error handling is wonky, it requires caller to clean up
>> after it. Implement a helper that does the map and error cleanup and
>> remove the requirement from the caller.
>>
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>> ---
>>
>> This series is a different approach to the problem, using the generic
>> ioremap_page_range directly which reduces added code, and moves
>> the radix specific code into radix files. Thanks to Christophe for
>> pointing out various problems with the previous patch.
>>
>> arch/powerpc/mm/pgtable_64.c | 27 ++++++++++++++++++++-------
>> 1 file changed, 20 insertions(+), 7 deletions(-)
>>
>> diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
>> index d2d976ff8a0e..6bd3660388aa 100644
>> --- a/arch/powerpc/mm/pgtable_64.c
>> +++ b/arch/powerpc/mm/pgtable_64.c
>
> [...]
>
>> @@ -182,8 +197,6 @@ void __iomem * __ioremap_caller(phys_addr_t addr, unsigned long size,
>>
>> area->phys_addr = paligned;
>> ret = __ioremap_at(paligned, area->addr, size, prot);
>> - if (!ret)
>> - vunmap(area->addr);
>
> AFAICS, ioremap_range() calls unmap_kernel_range() in the error case,
> but I can't see that that function does the vunmap(), does it ?. If not,
> who frees the area allocated by __get_vm_area_caller() ?
Oh good catch, I guess we need to keep a free_vm_area here.
Thanks,
Nick
^ permalink raw reply
* [PATCH 1/2] powerpc/82xx: Delete an unnecessary of_node_put() call in pq2ads_pci_init_irq()
From: Markus Elfring @ 2019-08-27 8:26 UTC (permalink / raw)
To: linuxppc-dev, Benjamin Herrenschmidt, Greg Kroah-Hartman,
Enrico Weigelt, Kate Stewart, Michael Ellerman, Paul Mackerras,
Thomas Gleixner
Cc: kernel-janitors, LKML
In-Reply-To: <6dc7d70e-8a40-46ab-897b-d2eaf9a87d77@web.de>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 27 Aug 2019 08:44:20 +0200
A null pointer would be passed to a call of the function “of_node_put”
immediately after a call of the function “of_find_compatible_node” failed
at one place.
Remove this superfluous function call.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/powerpc/platforms/82xx/pq2ads-pci-pic.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
index 096cc0d59fd8..6cc054db7043 100644
--- a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
+++ b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
@@ -123,7 +123,6 @@ int __init pq2ads_pci_init_irq(void)
np = of_find_compatible_node(NULL, NULL, "fsl,pq2ads-pci-pic");
if (!np) {
printk(KERN_ERR "No pci pic node in device tree.\n");
- of_node_put(np);
goto out;
}
--
2.23.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox