Re: [PATCH 1/2] genirq: add an affinity parameter to irq_create_mapping()

2020-11-24 Thread Laurent Vivier
On 24/11/2020 23:19, Thomas Gleixner wrote: > On Tue, Nov 24 2020 at 21:03, Laurent Vivier wrote: >> This parameter is needed to pass it to irq_domain_alloc_descs(). >> >> This seems to have been missed by >> o06ee6d571f0e ("genirq: Add affinity hint to irq allocation") > > No, this has not been m

[PATCH V2] powerpc/perf: Exclude kernel samples while counting events in user space.

2020-11-24 Thread Athira Rajeev
Perf event attritube supports exclude_kernel flag to avoid sampling/profiling in supervisor state (kernel). Based on this event attr flag, Monitor Mode Control Register bit is set to freeze on supervisor state. But sometime (due to hardware limitation), Sampled Instruction Address Register (SIAR) l

Re: [PATCH v4] dt-bindings: misc: convert fsl,qoriq-mc from txt to YAML

2020-11-24 Thread Ioana Ciornei
On Mon, Nov 23, 2020 at 11:00:35AM +0200, Laurentiu Tudor wrote: > From: Ionut-robert Aron > > Convert fsl,qoriq-mc to YAML in order to automate the verification > process of dts files. In addition, update MAINTAINERS accordingly > and, while at it, add some missing files. > > Signed-off-by: Ion

[PATCH v1 8/8] powerpc/32: Use SPRN_SPRG_SCRATCH2 in exception prologs

2020-11-24 Thread Christophe Leroy
Use SPRN_SPRG_SCRATCH2 as a third scratch register in exception prologs in order to simplify them and avoid data going back and forth from/to CR. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_32.h | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff

[PATCH v1 7/8] powerpc/32s: Use SPRN_SPRG_SCRATCH2 in DSI prolog

2020-11-24 Thread Christophe Leroy
Use SPRN_SPRG_SCRATCH2 as an alternative scratch register in the early part of DSI prolog in order to avoid clobbering SPRN_SPRG_SCRATCH0/1 used by other prologs. The 603 doesn't like a jump from DataLoadTLBMiss to the 10 nops that are now in the beginning of DSI exception as a result of the featu

[PATCH v1 6/8] powerpc/32: Simplify EXCEPTION_PROLOG_1 macro

2020-11-24 Thread Christophe Leroy
Make code more readable with a clear CONFIG_VMAP_STACK section and a clear non CONFIG_VMAP_STACK section. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_32.h | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/head_32.h b/arch/powerpc/

[PATCH v1 5/8] powerpc/603: Use SPRN_SDR1 to store the pgdir phys address

2020-11-24 Thread Christophe Leroy
On the 603, SDR1 is not used. In order to free SPRN_SPRG2, use SPRN_SDR1 to store the pgdir phys addr. But only some bits of SDR1 can be used (0x01ff). As the pgdir is 4k aligned, rotate it by 4 bits to the left. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/reg.h | 1

[PATCH v1 2/8] powerpc/32s: Don't hash_preload() kernel text

2020-11-24 Thread Christophe Leroy
We now always map kernel text with BATs. Neither need to preload hash with kernel text addresses nor ensure they are never evicted. This is more or less a revert of commit ee4f2ea48674 ("[POWERPC] Fix 32-bit mm operations when not using BATs") Signed-off-by: Christophe Leroy --- arch/powerpc/mm

[PATCH v1 3/8] powerpc/32s: Fix an FTR_SECTION_ELSE

2020-11-24 Thread Christophe Leroy
An FTR_SECTION_ELSE is in the middle of BEGIN_MMU_FTR_SECTION/ALT_MMU_FTR_SECTION_END_IFSET Change it to MMU_FTR_SECTION_ELSE Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_book3s_32.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/head_boo

[PATCH v1 4/8] powerpc/32s: Don't use SPRN_SPRG_PGDIR in hash_page

2020-11-24 Thread Christophe Leroy
SPRN_SPRG_PGDIR is there mainly to speedup SW TLB miss handlers for powerpc 603. We need to free SPRN_SPRG2 to reduce the mess with CONFIG_VMAP_STACK. In hash_page(), reading PGDIR from thread_struct will be in the noise performance wise. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/boo

[PATCH v1 1/8] powerpc/32s: Always map kernel text and rodata with BATs

2020-11-24 Thread Christophe Leroy
Since commit 2b279c0348af ("powerpc/32s: Allow mapping with BATs with DEBUG_PAGEALLOC"), there is no real situation where mapping without BATs is required. In order to simplify memory handling, always map kernel text and rodata with BATs even when "nobats" kernel parameter is set. Also fix the 60

Re: [PATCH 0/2] powerpc: Remove support for ppc405/440 Xilinx platforms

2020-11-24 Thread Christophe Leroy
Le 21/05/2020 à 12:38, Christophe Leroy a écrit : Le 21/05/2020 à 09:02, Michael Ellerman a écrit : Arnd Bergmann writes: +On Wed, Apr 8, 2020 at 2:04 PM Michael Ellerman wrote: Benjamin Herrenschmidt writes: On Fri, 2020-04-03 at 15:59 +1100, Michael Ellerman wrote: Benjamin Herrens

Re: [PATCH net 1/2] ibmvnic: Ensure that SCRQ entry reads are correctly ordered

2020-11-24 Thread Michael Ellerman
Thomas Falcon writes: > Ensure that received Subordinate Command-Response Queue (SCRQ) > entries are properly read in order by the driver. These queues > are used in the ibmvnic device to process RX buffer and TX completion > descriptors. dma_rmb barriers have been added after checking for a > pen

[PATCH v6 22/22] powerpc/book3s64/pkeys: Optimize FTR_KUAP and FTR_KUEP disabled case

2020-11-24 Thread Aneesh Kumar K.V
If FTR_KUAP is disabled kernel will continue to run with the same AMR value with which it was entered. Hence there is a high chance that we can return without restoring the AMR value. This also helps the case when applications are not using the pkey feature. In this case, different applications wil

[PATCH v6 21/22] powerpc/book3s64/hash/kup: Don't hardcode kup key

2020-11-24 Thread Aneesh Kumar K.V
Make KUAP/KUEP key a variable and also check whether the platform limit the max key such that we can't use the key for KUAP/KEUP. Signed-off-by: Aneesh Kumar K.V --- .../powerpc/include/asm/book3s/64/hash-pkey.h | 22 +--- arch/powerpc/include/asm/book3s/64/pkeys.h| 1 + arch/powerpc/mm

[PATCH v6 20/22] powerpc/book3s64/hash/kuep: Enable KUEP on hash

2020-11-24 Thread Aneesh Kumar K.V
Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/pkeys.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c index 84f8664ffc47..f029e7bf5ca2 100644 --- a/arch/powerpc/

[PATCH v6 19/22] powerpc/book3s64/hash/kuap: Enable kuap on hash

2020-11-24 Thread Aneesh Kumar K.V
Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/pkeys.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c index f747d66cc87d..84f8664ffc47 100644 --- a/arch/powerpc/

[PATCH v6 18/22] powerpc/book3s64/kuep: Use Key 3 to implement KUEP with hash translation.

2020-11-24 Thread Aneesh Kumar K.V
Radix use IAMR Key 0 and hash translation use IAMR key 3. Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/book3s/64/kup.h b/arch/powerpc/include/a

[PATCH v6 17/22] powerpc/book3s64/kuap: Use Key 3 to implement KUAP with hash translation.

2020-11-24 Thread Aneesh Kumar K.V
Radix use AMR Key 0 and hash translation use AMR key 3. Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/kup.h b/arch/powerpc/in

[PATCH v6 16/22] powerpc/book3s64/kuap: Improve error reporting with KUAP

2020-11-24 Thread Aneesh Kumar K.V
With hash translation use DSISR_KEYFAULT to identify a wrong access. With Radix we look at the AMR value and type of fault. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/32/kup.h | 4 +-- arch/powerpc/include/asm/book3s/64/kup.h | 27 arch/powe

[PATCH v6 15/22] powerpc/book3s64/kuap: Restrict access to userspace based on userspace AMR

2020-11-24 Thread Aneesh Kumar K.V
If an application has configured address protection such that read/write is denied using pkey even the kernel should receive a FAULT on accessing the same. This patch use user AMR value stored in pt_regs.amr to achieve the same. Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arc

[PATCH v6 14/22] powerpc/book3s64/pkeys: Don't update SPRN_AMR when in kernel mode.

2020-11-24 Thread Aneesh Kumar K.V
Now that kernel correctly store/restore userspace AMR/IAMR values, avoid manipulating AMR and IAMR from the kernel on behalf of userspace. Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 21 + arch/powerpc/include/asm/processor.h

[PATCH v6 13/22] powerpc/ptrace-view: Use pt_regs values instead of thread_struct based one.

2020-11-24 Thread Aneesh Kumar K.V
We will remove thread.amr/iamr/uamor in a later patch Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kernel/ptrace/ptrace-view.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/ptrace/ptrace-view.c b/arch/powerpc/kernel/ptrace/ptrace-view.c index

[PATCH v6 12/22] powerpc/book3s64/pkeys: Reset userspace AMR correctly on exec

2020-11-24 Thread Aneesh Kumar K.V
On fork, we inherit from the parent and on exec, we should switch to default_amr values. Also, avoid changing the AMR register value within the kernel. The kernel now runs with different AMR values. Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s

[PATCH v6 11/22] powerpc/book3s64/pkeys: Inherit correctly on fork.

2020-11-24 Thread Aneesh Kumar K.V
Child thread.kuap value is inherited from the parent in copy_thread_tls. We still need to make sure when the child returns from a fork in the kernel we start with the kernel default AMR value. Reviewed-by: Sandipan Das Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/kernel/process.c | 11 +++

[PATCH v6 10/22] powerpc/book3s64/pkeys: Store/restore userspace AMR/IAMR correctly on entry and exit from kernel

2020-11-24 Thread Aneesh Kumar K.V
This prepare kernel to operate with a different value than userspace AMR/IAMR. For this, AMR/IAMR need to be saved and restored on entry and return from the kernel. With KUAP we modify kernel AMR when accessing user address from the kernel via copy_to/from_user interfaces. We don't need to modify

[PATCH v6 09/22] powerpc/exec: Set thread.regs early during exec

2020-11-24 Thread Aneesh Kumar K.V
In later patches during exec, we would like to access default regs.amr to control access to the user mapping. Having thread.regs set early makes the code changes simpler. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/thread_info.h | 2 -- arch/powerpc/kernel/process.c |

[PATCH v6 08/22] powerpc/book3s64/kuap: Use Key 3 for kernel mapping with hash translation

2020-11-24 Thread Aneesh Kumar K.V
This patch updates kernel hash page table entries to use storage key 3 for its mapping. This implies all kernel access will now use key 3 to control READ/WRITE. The patch also prevents the allocation of key 3 from userspace and UAMOR value is updated such that userspace cannot modify key 3. Review

[PATCH v6 07/22] powerpc/book3s64/kuap: Rename MMU_FTR_RADIX_KUAP to MMU_FTR_KUAP

2020-11-24 Thread Aneesh Kumar K.V
This is in preparate to adding support for kuap with hash translation. In preparation for that rename/move kuap related functions to non radix names. Also move the feature bit closer to MMU_FTR_KUEP. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 18 +-

[PATCH v6 06/22] powerpc/book3s64/kuep: Move KUEP related function outside radix

2020-11-24 Thread Aneesh Kumar K.V
The next set of patches adds support for kuep with hash translation. In preparation for that rename/move kuap related functions to non radix names. Also set MMU_FTR_KUEP and add the missing isync(). Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/kup.h | 1 + arch/powerp

[PATCH v6 05/22] powerpc/book3s64/kuap: Move KUAP related function outside radix

2020-11-24 Thread Aneesh Kumar K.V
The next set of patches adds support for kuap with hash translation. In preparation for that rename/move kuap related functions to non radix names. Signed-off-by: Aneesh Kumar K.V --- .../asm/book3s/64/{kup-radix.h => kup.h} | 6 ++--- arch/powerpc/include/asm/kup.h| 4 +++

[PATCH v6 04/22] powerpc/book3s64/kuap/kuep: Move uamor setup to pkey init

2020-11-24 Thread Aneesh Kumar K.V
This patch consolidates UAMOR update across pkey, kuap and kuep features. The boot cpu initialize UAMOR via pkey init and both radix/hash do the secondary cpu UAMOR init in early_init_mmu_secondary. We don't check for mmu_feature in radix secondary init because UAMOR is a supported SPRN with all C

[PATCH v6 03/22] powerpc/book3s64/kuap/kuep: Make KUAP and KUEP a subfeature of PPC_MEM_KEYS

2020-11-24 Thread Aneesh Kumar K.V
The next set of patches adds support for kuap with hash translation. Hence make KUAP a BOOK3S_64 feature. Also make it a subfeature of PPC_MEM_KEYS. Hash translation is going to use pkeys to support KUAP/KUEP. Adding this dependency reduces the code complexity and enables us to move some of the ini

[PATCH v6 00/22] Kernel userspace access/execution prevention with hash translation

2020-11-24 Thread Aneesh Kumar K.V
This patch series implements KUAP and KUEP with hash translation mode using memory keys. The kernel now uses memory protection key 3 to control access to the kernel. Kernel page table entries are now configured with key 3. Access to locations configured with any other key value is denied when in ke

[PATCH v6 02/22] KVM: PPC: BOOK3S: PR: Ignore UAMOR SPR

2020-11-24 Thread Aneesh Kumar K.V
With power7 and above we expect the cpu to support keys. The number of keys are firmware controlled based on device tree. PR KVM do not expose key details via device tree. Hence when running with PR KVM we do run with MMU_FTR_KEY support disabled. But we can still get updates on UAMOR. Hence ignore

[PATCH v6 01/22] powerpc: Add new macro to handle NESTED_IFCLR

2020-11-24 Thread Aneesh Kumar K.V
This will be used by the following patches Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/feature-fixups.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/include/asm/feature-fixups.h b/arch/powerpc/include/asm/feature-fixups.h index fbd406cd6916..5cdba929a8ae

Re: [PATCH 2/3] powerpc: Make NUMA default y for powernv

2020-11-24 Thread Srikar Dronamraju
* Michael Ellerman [2020-11-24 23:05:46]: > Our NUMA option is default y for pseries, but not powernv. The bulk of > powernv systems are NUMA, so make NUMA default y for powernv also. > > Signed-off-by: Michael Ellerman Looks good to me. Reviewed-by: Srikar Dronamraju > --- > arch/powerpc/K

Re: [PATCH 1/3] powerpc: Make NUMA depend on SMP

2020-11-24 Thread Srikar Dronamraju
* Michael Ellerman [2020-11-24 23:05:45]: > Our Kconfig allows NUMA to be enabled without SMP, but none of > our defconfigs use that combination. This means it can easily be > broken inadvertently by code changes, which has happened recently. > > Although it's theoretically possible to have a ma

[PATCH] powerpc/configs: Add ppc64le_allnoconfig target

2020-11-24 Thread Michael Ellerman
Add a phony target for ppc64le_allnoconfig, which tests some combinations of CONFIG symbols that aren't covered by any of our defconfigs. Signed-off-by: Michael Ellerman --- arch/powerpc/Makefile | 5 + arch/powerpc/configs/ppc64le.config | 2 ++ 2 files changed, 7 insertions(+

Re: linux-next: build failure in Linus' tree

2020-11-24 Thread Michael Ellerman
Daniel Axtens writes: > Thanks sfr and mpe. > >> Applied to powerpc/fixes. >> >> [1/1] powerpc/64s: Fix allnoconfig build since uaccess flush >> >> https://git.kernel.org/powerpc/c/b6b79dd53082db11070b4368d85dd6699ff0b063 > > We also needed a similar fix for stable, which has also been appl

Re: C vdso

2020-11-24 Thread Michael Ellerman
Christophe Leroy writes: > Le 03/11/2020 à 19:13, Christophe Leroy a écrit : >> Le 23/10/2020 à 15:24, Michael Ellerman a écrit : >>> Christophe Leroy writes: Le 24/09/2020 à 15:17, Christophe Leroy a écrit : > Le 17/09/2020 à 14:33, Michael Ellerman a écrit : >> Christophe Leroy wr

Re: [PATCH] net/ethernet/freescale: Fix incorrect IS_ERR_VALUE macro usages

2020-11-24 Thread liwei (GF)
Hi Yang, On 2020/11/25 6:13, Li Yang wrote: > On Tue, Nov 24, 2020 at 3:44 PM Li Yang wrote: >> >> On Tue, Nov 24, 2020 at 12:24 AM Wei Li wrote: >>> >>> IS_ERR_VALUE macro should be used only with unsigned long type. >>> Especially it works incorrectly with unsigned shorter types on >>> 64bit m

Re: [PATCH 1/2] genirq: add an affinity parameter to irq_create_mapping()

2020-11-24 Thread kernel test robot
Hi Laurent, Thank you for the patch! Yet something to improve: [auto build test ERROR on gpio/for-next] [also build test ERROR on linus/master v5.10-rc5 next-20201124] [cannot apply to powerpc/next tip/irq/core] [If your patch is applied to the wrong git tree, kindly drop us a note. And when

Re: [PATCH 1/2] genirq: add an affinity parameter to irq_create_mapping()

2020-11-24 Thread kernel test robot
Hi Laurent, Thank you for the patch! Yet something to improve: [auto build test ERROR on gpio/for-next] [also build test ERROR on linus/master v5.10-rc5 next-20201124] [cannot apply to powerpc/next tip/irq/core] [If your patch is applied to the wrong git tree, kindly drop us a note. And when

Re: [PATCH 2/2] powerpc/pseries: pass MSI affinity to irq_create_mapping()

2020-11-24 Thread Thomas Gleixner
On Tue, Nov 24 2020 at 21:03, Laurent Vivier wrote: > With virtio multiqueue, normally each queue IRQ is mapped to a CPU. > > This problem cannot be shown on x86_64 for two reasons: There is only _ONE_ reason why this is not a problem on x86. x86 uses the generic PCI/MSI domain which supports this

Re: [PATCH v2 2/2] kbuild: Disable CONFIG_LD_ORPHAN_WARN for ld.lld 10.0.1

2020-11-24 Thread Kees Cook
On Thu, Nov 19, 2020 at 01:13:27PM -0800, Nick Desaulniers wrote: > On Thu, Nov 19, 2020 at 12:57 PM Nathan Chancellor > wrote: > > > > ld.lld 10.0.1 spews a bunch of various warnings about .rela sections, > > along with a few others. Newer versions of ld.lld do not have these > > warnings. As a r

Re: [PATCH 1/2] genirq: add an affinity parameter to irq_create_mapping()

2020-11-24 Thread Thomas Gleixner
On Tue, Nov 24 2020 at 21:03, Laurent Vivier wrote: > This parameter is needed to pass it to irq_domain_alloc_descs(). > > This seems to have been missed by > o06ee6d571f0e ("genirq: Add affinity hint to irq allocation") No, this has not been missed at all. There was and is no reason to do this.

Re: [PATCH] net/ethernet/freescale: Fix incorrect IS_ERR_VALUE macro usages

2020-11-24 Thread Li Yang
On Tue, Nov 24, 2020 at 3:44 PM Li Yang wrote: > > On Tue, Nov 24, 2020 at 12:24 AM Wei Li wrote: > > > > IS_ERR_VALUE macro should be used only with unsigned long type. > > Especially it works incorrectly with unsigned shorter types on > > 64bit machines. > > This is truly a problem for the driv

Re: [PATCH] net/ethernet/freescale: Fix incorrect IS_ERR_VALUE macro usages

2020-11-24 Thread Li Yang
On Tue, Nov 24, 2020 at 12:24 AM Wei Li wrote: > > IS_ERR_VALUE macro should be used only with unsigned long type. > Especially it works incorrectly with unsigned shorter types on > 64bit machines. This is truly a problem for the driver to run on 64-bit architectures. But from an earlier discussi

Re: [PATCH 0/2] powerpc/pseries: fix MSI/X IRQ affinity on pseries

2020-11-24 Thread Michael S. Tsirkin
On Tue, Nov 24, 2020 at 09:03:06PM +0100, Laurent Vivier wrote: > With virtio, in multiqueue case, each queue IRQ is normally > bound to a different CPU using the affinity mask. > > This works fine on x86_64 but totally ignored on pseries. > > This is not obvious at first look because irqbalance

Re: [PATCH V2 4/5] ocxl: Add mmu notifier

2020-11-24 Thread Christophe Lombard
Le 24/11/2020 à 14:45, Jason Gunthorpe a écrit : On Tue, Nov 24, 2020 at 09:17:38AM +, Christoph Hellwig wrote: @@ -470,6 +487,26 @@ void ocxl_link_release(struct pci_dev *dev, void *link_handle) } EXPORT_SYMBOL_GPL(ocxl_link_release); +static void invalidate_range(struct mmu_notif

[PATCH 2/2] powerpc/pseries: pass MSI affinity to irq_create_mapping()

2020-11-24 Thread Laurent Vivier
With virtio multiqueue, normally each queue IRQ is mapped to a CPU. But since commit 0d9f0a52c8b9f ("virtio_scsi: use virtio IRQ affinity") this is broken on pseries. The affinity is correctly computed in msi_desc but this is not applied to the system IRQs. It appears the affinity is correctly p

[PATCH 0/2] powerpc/pseries: fix MSI/X IRQ affinity on pseries

2020-11-24 Thread Laurent Vivier
With virtio, in multiqueue case, each queue IRQ is normally bound to a different CPU using the affinity mask. This works fine on x86_64 but totally ignored on pseries. This is not obvious at first look because irqbalance is doing some balancing to improve that. It appears that the "managed" flag

[PATCH 1/2] genirq: add an affinity parameter to irq_create_mapping()

2020-11-24 Thread Laurent Vivier
This parameter is needed to pass it to irq_domain_alloc_descs(). This seems to have been missed by o06ee6d571f0e ("genirq: Add affinity hint to irq allocation") This is needed to implement proper support for multiqueue with pseries. All irq_create_mapping() callers have been updated with the hel

[PATCH v1 3/3] powerpc/32s: Cleanup around PTE_FLAGS_OFFSET in hash_low.S

2020-11-24 Thread Christophe Leroy
PTE_FLAGS_OFFSET is defined in asm/page_32.h and used only in hash_low.S And PTE_FLAGS_OFFSET nullity depends on CONFIG_PTE_64BIT Instead of tests like #if (PTE_FLAGS_OFFSET != 0), use CONFIG_PTE_64BIT related code. Also move the definition of PTE_FLAGS_OFFSET into hash_low.S directly, that impr

[PATCH v1 1/3] powerpc/32s: Remove unused counters incremented by create_hpte()

2020-11-24 Thread Christophe Leroy
primary_pteg_full and htab_hash_searches are not used. Remove them. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/book3s32/hash_low.S | 15 --- 1 file changed, 15 deletions(-) diff --git a/arch/powerpc/mm/book3s32/hash_low.S b/arch/powerpc/mm/book3s32/hash_low.S index 9a56ba

[PATCH v1 2/3] powerpc/32s: In add_hash_page(), calculate VSID later

2020-11-24 Thread Christophe Leroy
VSID is only for create_hpte(). When _PAGE_HASHPTE is already set, add_hash_page() bails out without calling create_hpte() and doesn't need the value of VSID. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/book3s32/hash_low.S | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-

Re: eBPF on powerpc

2020-11-24 Thread Naveen N. Rao
Christophe Leroy wrote: Le 24/11/2020 à 17:35, Naveen N. Rao a écrit : Hi Christophe, Christophe Leroy wrote: Hi Naveen, Few years ago, you implemented eBPF on PPC64. Is there any reason for implementing it for PPC64 only ? I focused on ppc64 since eBPF is a 64-bit VM and it was more str

Re: [PATCH 3/3] powerpc: Update NUMA Kconfig description & help text

2020-11-24 Thread Randy Dunlap
On 11/24/20 4:05 AM, Michael Ellerman wrote: > Update the NUMA Kconfig description to match other architectures, and > add some help text. Shamelessly borrowed from x86/arm64. > > Signed-off-by: Michael Ellerman Reviewed-by: Randy Dunlap Thanks. > --- > arch/powerpc/Kconfig | 8 +++- > 1

Re: [PATCH 1/3] powerpc: Make NUMA depend on SMP

2020-11-24 Thread Randy Dunlap
On 11/24/20 4:05 AM, Michael Ellerman wrote: > Our Kconfig allows NUMA to be enabled without SMP, but none of > our defconfigs use that combination. This means it can easily be > broken inadvertently by code changes, which has happened recently. > > Although it's theoretically possible to have a m

Re: eBPF on powerpc

2020-11-24 Thread Christophe Leroy
Le 24/11/2020 à 17:35, Naveen N. Rao a écrit : Hi Christophe, Christophe Leroy wrote: Hi Naveen, Few years ago, you implemented eBPF on PPC64. Is there any reason for implementing it for PPC64 only ? I focused on ppc64 since eBPF is a 64-bit VM and it was more straight-forward to target

Re: [PATCH kernel v4 1/8] genirq/ipi: Simplify irq_reserve_ipi

2020-11-24 Thread Cédric Le Goater
On 11/24/20 7:17 AM, Alexey Kardashevskiy wrote: > __irq_domain_alloc_irqs() can already handle virq==-1 and free > descriptors if it failed allocating hardware interrupts so let's skip > this extra step. > > Signed-off-by: Alexey Kardashevskiy LGTM, Reviewed-by: Cédric Le Goater Copying the

[PATCH net 2/2] ibmvnic: Fix TX completion error handling

2020-11-24 Thread Thomas Falcon
TX completions received with an error return code are not being processed properly. When an error code is seen, do not proceed to the next completion before cleaning up the existing entry's data structures. Fixes: 032c5e828 ("Driver for IBM System i/p VNIC protocol") Signed-off-by: Thomas Falcon

[PATCH net 1/2] ibmvnic: Ensure that SCRQ entry reads are correctly ordered

2020-11-24 Thread Thomas Falcon
Ensure that received Subordinate Command-Response Queue (SCRQ) entries are properly read in order by the driver. These queues are used in the ibmvnic device to process RX buffer and TX completion descriptors. dma_rmb barriers have been added after checking for a pending descriptor to ensure the cor

[PATCH net 0/2] ibmvnic: Bug fixes for queue descriptor processing

2020-11-24 Thread Thomas Falcon
This series resolves a few issues in the ibmvnic driver's RX buffer and TX completion processing. The first patch includes memory barriers to synchronize queue descriptor reads. The second patch fixes a memory leak that could occur if the device returns a TX completion with an error code in the des

eBPF on powerpc

2020-11-24 Thread Naveen N. Rao
Hi Christophe, Christophe Leroy wrote: Hi Naveen, Few years ago, you implemented eBPF on PPC64. Is there any reason for implementing it for PPC64 only ? I focused on ppc64 since eBPF is a 64-bit VM and it was more straight-forward to target. Is there something that makes it impossible to

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-24 Thread Liang, Kan
On 11/24/2020 12:42 AM, Madhavan Srinivasan wrote: On 11/24/20 10:21 AM, Namhyung Kim wrote: Hello, On Mon, Nov 23, 2020 at 8:00 PM Michael Ellerman wrote: Namhyung Kim writes: Hi Peter and Kan, (Adding PPC folks) On Tue, Nov 17, 2020 at 2:01 PM Namhyung Kim wrote: Hello, On Thu,

[PATCH v1 6/6] powerpc/ppc-opcode: Add PPC_RAW_MFSPR()

2020-11-24 Thread Christophe Leroy
Add PPC_RAW_MFSPR() to replace open coding done in 8xx-pmu.c Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/ppc-opcode.h | 3 ++- arch/powerpc/perf/8xx-pmu.c | 5 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b

[PATCH v1 5/6] powerpc/8xx: Use SPRN_SPRG_SCRATCH2 in DTLB miss exception

2020-11-24 Thread Christophe Leroy
Use SPRN_SPRG_SCRATCH2 in DTLB miss exception instead of DAR in order to be similar to ITLB miss exception. This also simplifies mpc8xx_pmu_del() Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_8xx.S | 9 - arch/powerpc/perf/8xx-pmu.c| 19 +++ 2 files c

[PATCH v1 2/6] powerpc/8xx: Always pin kernel text TLB

2020-11-24 Thread Christophe Leroy
There is no big poing in not pinning kernel text anymore, as now we can keep pinned TLB even with things like DEBUG_PAGEALLOC. Remove CONFIG_PIN_TLB_TEXT, making it always right. Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 3 +-- arch/powerpc/kernel/head_8xx.S

[PATCH v1 4/6] powerpc/8xx: Use SPRN_SPRG_SCRATCH2 in ITLB miss exception

2020-11-24 Thread Christophe Leroy
In order to re-enable MMU earlier, ensure ITLB miss exception cannot clobber SPRN_SPRG_SCRATCH0 and SPRN_SPRG_SCRATCH1. Do so by using SPRN_SPRG_SCRATCH2 and SPRN_M_TW instead, like the DTLB miss exception. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_8xx.S | 12 ++-- arc

[PATCH v1 1/6] powerpc/8xx: DEBUG_PAGEALLOC doesn't require an ITLB miss exception handler

2020-11-24 Thread Christophe Leroy
Since commit e611939fc8ec ("powerpc/mm: Ensure change_page_attr() doesn't invalidate pinned TLBs"), pinned TLBs are not anymore invalidated by __kernel_map_pages() when CONFIG_DEBUG_PAGEALLOC is selected. Remove the dependency on CONFIG_DEBUG_PAGEALLOC. Signed-off-by: Christophe Leroy --- arch/

[PATCH v1 3/6] powerpc/8xx: Simplify INVALIDATE_ADJACENT_PAGES_CPU15

2020-11-24 Thread Christophe Leroy
We now have r11 available as a scratch register so INVALIDATE_ADJACENT_PAGES_CPU15() can be simplified. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_8xx.S | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/pow

eBPF on powerpc

2020-11-24 Thread Christophe Leroy
Hi Naveen, Few years ago, you implemented eBPF on PPC64. Is there any reason for implementing it for PPC64 only ? Is there something that makes it impossible to have eBPF for PPC32 as well ? Thanks Christophe

Re: [PATCH] tpm: ibmvtpm: fix error return code in tpm_ibmvtpm_probe()

2020-11-24 Thread Stefan Berger
On 11/24/20 8:52 AM, Wang Hai wrote: Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: d8d74ea3c002 ("tpm: ibmvtpm: Wait for buffer to be set before proceeding") Reported-by: Hulk Robot Signed-off-by: Wang Hai --- drive

[PATCH] ASoC: fsl_xcvr: fix potential resource leak

2020-11-24 Thread Viorel Suman (OSS)
From: Viorel Suman "fw" variable must be relased before return. Signed-off-by: Viorel Suman --- sound/soc/fsl/fsl_xcvr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c index 2a28810d0e29..3d58c88ea603 100644 --- a/sound/soc/fsl/fsl_xcvr.

[PATCH] tpm: ibmvtpm: fix error return code in tpm_ibmvtpm_probe()

2020-11-24 Thread Wang Hai
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: d8d74ea3c002 ("tpm: ibmvtpm: Wait for buffer to be set before proceeding") Reported-by: Hulk Robot Signed-off-by: Wang Hai --- drivers/char/tpm/tpm_ibmvtpm.c | 1 + 1 file

Re: [PATCH V2 4/5] ocxl: Add mmu notifier

2020-11-24 Thread Jason Gunthorpe
On Tue, Nov 24, 2020 at 09:17:38AM +, Christoph Hellwig wrote: > > @@ -470,6 +487,26 @@ void ocxl_link_release(struct pci_dev *dev, void > > *link_handle) > > } > > EXPORT_SYMBOL_GPL(ocxl_link_release); > > > > +static void invalidate_range(struct mmu_notifier *mn, > > +

[PATCH 2/3] powerpc: Make NUMA default y for powernv

2020-11-24 Thread Michael Ellerman
Our NUMA option is default y for pseries, but not powernv. The bulk of powernv systems are NUMA, so make NUMA default y for powernv also. Signed-off-by: Michael Ellerman --- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/power

[PATCH 3/3] powerpc: Update NUMA Kconfig description & help text

2020-11-24 Thread Michael Ellerman
Update the NUMA Kconfig description to match other architectures, and add some help text. Shamelessly borrowed from x86/arm64. Signed-off-by: Michael Ellerman --- arch/powerpc/Kconfig | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/K

[PATCH 1/3] powerpc: Make NUMA depend on SMP

2020-11-24 Thread Michael Ellerman
Our Kconfig allows NUMA to be enabled without SMP, but none of our defconfigs use that combination. This means it can easily be broken inadvertently by code changes, which has happened recently. Although it's theoretically possible to have a machine with a single CPU and multiple memory nodes, I c

Re: [PATCH 3/3] selftests/powerpc: Add VF recovery tests

2020-11-24 Thread Oliver O'Halloran
On Tue, Nov 24, 2020 at 9:14 PM Frederic Barrat wrote: > > Is it possible to run those tests on pseries? I haven't managed to set > up a LPAR with a physical function which would let me enable a virtual > function. All I could do is assign a virtual function to a LPAR. When > assigning a physical

[PATCH v2 4/4] KVM: PPC: Introduce new capability for 2nd DAWR

2020-11-24 Thread Ravi Bangoria
Introduce KVM_CAP_PPC_DAWR1 which can be used by Qemu to query whether kvm supports 2nd DAWR or not. Signed-off-by: Ravi Bangoria --- arch/powerpc/kvm/powerpc.c | 3 +++ include/uapi/linux/kvm.h | 1 + 2 files changed, 4 insertions(+) diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm

[PATCH v2 0/4] KVM: PPC: Power10 2nd DAWR enablement

2020-11-24 Thread Ravi Bangoria
Enable p10 2nd DAWR feature for Book3S kvm guest. DAWR is a hypervisor resource and thus H_SET_MODE hcall is used to set/unset it. A new case H_SET_MODE_RESOURCE_SET_DAWR1 is introduced in H_SET_MODE hcall for setting/unsetting 2nd DAWR. Also, new capability KVM_CAP_PPC_DAWR1 has been added to quer

[PATCH v2 1/4] KVM: PPC: Allow nested guest creation when L0 hv_guest_state > L1

2020-11-24 Thread Ravi Bangoria
On powerpc, L1 hypervisor takes help of L0 using H_ENTER_NESTED hcall to load L2 guest state in cpu. L1 hypervisor prepares the L2 state in struct hv_guest_state and passes a pointer to it via hcall. Using that pointer, L0 reads/writes that state directly from/to L1 memory. Thus L0 must be aware of

[PATCH v2 3/4] KVM: PPC: Add infrastructure to support 2nd DAWR

2020-11-24 Thread Ravi Bangoria
kvm code assumes single DAWR everywhere. Add code to support 2nd DAWR. DAWR is a hypervisor resource and thus H_SET_MODE hcall is used to set/ unset it. Introduce new case H_SET_MODE_RESOURCE_SET_DAWR1 for 2nd DAWR. Also, kvm will support 2nd DAWR only if CPU_FTR_DAWR1 is set. Signed-off-by: Ravi

[PATCH v2 2/4] KVM: PPC: Rename current DAWR macros and variables

2020-11-24 Thread Ravi Bangoria
Power10 is introducing second DAWR. Use real register names (with suffix 0) from ISA for current macros and variables used by kvm. One exception is KVM_REG_PPC_DAWR. Keep it as it is because it's uapi so changing it will break userspace. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/asm/

Re: [PATCH kernel v4 2/8] genirq/irqdomain: Clean legacy IRQ allocation

2020-11-24 Thread Alexey Kardashevskiy
On 11/24/20 8:19 PM, Andy Shevchenko wrote: On Tue, Nov 24, 2020 at 8:20 AM Alexey Kardashevskiy wrote: There are 10 users of __irq_domain_alloc_irqs() and only one - IOAPIC - passes realloc==true. There is no obvious reason for handling this specific case in the generic code. This splits

Re: [PATCH 3/3] selftests/powerpc: Add VF recovery tests

2020-11-24 Thread Frederic Barrat
On 03/11/2020 05:45, Oliver O'Halloran wrote: --- a/tools/testing/selftests/powerpc/eeh/eeh-functions.sh +++ b/tools/testing/selftests/powerpc/eeh/eeh-functions.sh @@ -135,3 +135,111 @@ eeh_one_dev() { return 0; } +eeh_has_driver() { + test -e /sys/bus/pci/devices/$1/drive

Re: C vdso

2020-11-24 Thread Christophe Leroy
Hi Michael, Le 03/11/2020 à 19:13, Christophe Leroy a écrit : Le 23/10/2020 à 15:24, Michael Ellerman a écrit : Christophe Leroy writes: Le 24/09/2020 à 15:17, Christophe Leroy a écrit : Le 17/09/2020 à 14:33, Michael Ellerman a écrit : Christophe Leroy writes: What is the status with

[PATCH V3 5/5] ocxl: Add new kernel traces

2020-11-24 Thread Christophe Lombard
Add specific kernel traces which provide information on mmu notifier and on pages range. Signed-off-by: Christophe Lombard --- drivers/misc/ocxl/link.c | 4 +++ drivers/misc/ocxl/trace.h | 64 +++ 2 files changed, 68 insertions(+) diff --git a/drivers/misc/

[PATCH V3 1/5] ocxl: Assign a register set to a Logical Partition

2020-11-24 Thread Christophe Lombard
Platform specific function to assign a register set to a Logical Partition. The "ibm,mmio-atsd" property, provided by the firmware, contains the 16 base ATSD physical addresses (ATSD0 through ATSD15) of the set of MMIO registers (XTS MMIO ATSDx LPARID/AVA/launch/status register). For the time bein

[PATCH V3 0/5] ocxl: Mmio invalidation support

2020-11-24 Thread Christophe Lombard
OpenCAPI 4.0/5.0 with TLBI/SLBI Snooping, is not used due to performance problems caused by the PAU having to process all incoming TLBI/SLBI commands which will cause them to back up on the PowerBus. When the Address Translation Mode requires TLB operations to be initiated using MMIO registers, a

[PATCH V3 2/5] ocxl: Initiate a TLB invalidate command

2020-11-24 Thread Christophe Lombard
When a TLB Invalidate is required for the Logical Partition, the following sequence has to be performed: 1. Load MMIO ATSD AVA register with the necessary value, if required. 2. Write the MMIO ATSD launch register to initiate the TLB Invalidate command. 3. Poll the MMIO ATSD status register to det

[PATCH V3 4/5] ocxl: Add mmu notifier

2020-11-24 Thread Christophe Lombard
Add invalidate_range mmu notifier, when required (ATSD access of MMIO registers is available), to initiate TLB invalidation commands. For the time being, the ATSD0 set of registers is used by default. The pasid and bdf values have to be configured in the Process Element Entry. The PEE must be set

[PATCH V3 3/5] ocxl: Update the Process Element Entry

2020-11-24 Thread Christophe Lombard
To complete the MMIO based mechanism, the fields: PASID, bus, device and function of the Process Element Entry have to be filled. (See OpenCAPI Power Platform Architecture document) Hypervisor Process Element Entry Word 0 1 7 8 .. 12 13 ..15 16 19 20 ..

Re: [PATCH v1 0/2] Use H_RPT_INVALIDATE for nested guest

2020-11-24 Thread Bharata B Rao
Hi, Any comments on this patchset? Anything specific to be addressed before it could be considered for inclusion? Regards, Bharata. On Mon, Oct 19, 2020 at 04:56:40PM +0530, Bharata B Rao wrote: > This patchset adds support for the new hcall H_RPT_INVALIDATE > (currently handles nested case only

Re: [PATCH kernel v4 2/8] genirq/irqdomain: Clean legacy IRQ allocation

2020-11-24 Thread Andy Shevchenko
On Tue, Nov 24, 2020 at 8:20 AM Alexey Kardashevskiy wrote: > > There are 10 users of __irq_domain_alloc_irqs() and only one - IOAPIC - > passes realloc==true. There is no obvious reason for handling this > specific case in the generic code. > > This splits out __irq_domain_alloc_irqs_data() to ma

Re: [PATCH V2 4/5] ocxl: Add mmu notifier

2020-11-24 Thread Christoph Hellwig
You probably want to add Jason for an audit of new notifier uses. On Fri, Nov 20, 2020 at 06:32:40PM +0100, Christophe Lombard wrote: > Add invalidate_range mmu notifier, when required (ATSD access of MMIO > registers is available), to initiate TLB invalidation commands. > For the time being, the