Re: [PATCH v7 3/6] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-05-05 Thread Nicholas Piggin
Excerpts from Bharata B Rao's message of May 6, 2021 1:46 am: > H_RPT_INVALIDATE does two types of TLB invalidations: > > 1. Process-scoped invalidations for guests when LPCR[GTSE]=0. >This is currently not used in KVM as GTSE is not usually >disabled in KVM. > 2. Partition-scoped

Re: [PATCH] powerpc/papr_scm: Make 'perf_stats' invisible if perf-stats unavailable

2021-05-05 Thread Aneesh Kumar K.V
Vaibhav Jain writes: > In case performance stats for an nvdimm are not available, reading the > 'perf_stats' sysfs file returns an -ENOENT error. A better approach is > to make the 'perf_stats' file entirely invisible to indicate that > performance stats for an nvdimm are unavailable. > > So

Re: [PATCH v2] powerpc/papr_scm: Reduce error severity if nvdimm stats inaccessible

2021-05-05 Thread Ira Weiny
On Thu, May 06, 2021 at 12:46:06AM +0530, Vaibhav Jain wrote: > Currently drc_pmem_qeury_stats() generates a dev_err in case > "Enable Performance Information Collection" feature is disabled from > HMC or performance stats are not available for an nvdimm. The error is > of the form below: > >

Re: [PATCH] KVM: PPC: Book3S HV: Fix conversion to gfn-based MMU notifier callbacks

2021-05-05 Thread Nicholas Piggin
Excerpts from Sean Christopherson's message of May 6, 2021 1:52 am: > On Wed, May 05, 2021, Nicholas Piggin wrote: >> Commit b1c5356e873c ("KVM: PPC: Convert to the gfn-based MMU notifier >> callbacks") causes unmap_gfn_range and age_gfn callbacks to only work >> on the first gfn in the range. It

[PATCH v2 1/2] powerpc/64s: Fix crashes when toggling stf barrier

2021-05-05 Thread Michael Ellerman
The STF (store-to-load forwarding) barrier mitigation can be enabled/disabled at runtime via a debugfs file (stf_barrier), which causes the kernel to patch itself to enable/disable the relevant mitigations. However depending on which mitigation we're using, it may not be safe to do that patching

[PATCH v2 2/2] powerpc/64s: Fix crashes when toggling entry flush barrier

2021-05-05 Thread Michael Ellerman
The entry flush mitigation can be enabled/disabled at runtime via a debugfs file (entry_flush), which causes the kernel to patch itself to enable/disable the relevant mitigations. However depending on which mitigation we're using, it may not be safe to do that patching while other CPUs are

[RESEND PATCH v4 00/11] Use per-CPU temporary mappings for patching

2021-05-05 Thread Christopher M. Riedl
When compiled with CONFIG_STRICT_KERNEL_RWX, the kernel must create temporary mappings when patching itself. These mappings temporarily override the strict RWX text protections to permit a write. Currently, powerpc allocates a per-CPU VM area for patching. Patching occurs as follows: 1.

[RESEND PATCH v4 11/11] powerpc: Use patch_instruction_unlocked() in loops

2021-05-05 Thread Christopher M. Riedl
Now that patching requires a lock to prevent concurrent access to patching_mm, every call to patch_instruction() acquires and releases a spinlock. There are several places where patch_instruction() is called in a loop. Convert these to acquire the lock once before the loop, call

[RESEND PATCH v4 06/11] powerpc: Introduce temporary mm

2021-05-05 Thread Christopher M. Riedl
x86 supports the notion of a temporary mm which restricts access to temporary PTEs to a single CPU. A temporary mm is useful for situations where a CPU needs to perform sensitive operations (such as patching a STRICT_KERNEL_RWX kernel) requiring temporary mappings without exposing said mappings to

[RESEND PATCH v4 07/11] powerpc/64s: Make slb_allocate_user() non-static

2021-05-05 Thread Christopher M. Riedl
With Book3s64 Hash translation, manually inserting a PTE requires updating the Linux PTE, inserting a SLB entry, and inserting the hashed page. The first is handled via the usual kernel abstractions, the second requires slb_allocate_user() which is currently 'static', and the third is available

[RESEND PATCH v4 10/11] powerpc: Protect patching_mm with a lock

2021-05-05 Thread Christopher M. Riedl
Powerpc allows for multiple CPUs to patch concurrently. When patching with STRICT_KERNEL_RWX a single patching_mm is allocated for use by all CPUs for the few times that patching occurs. Use a spinlock to protect the patching_mm from concurrent use. Modify patch_instruction() to acquire the lock,

[RESEND PATCH v4 08/11] powerpc: Initialize and use a temporary mm for patching

2021-05-05 Thread Christopher M. Riedl
When code patching a STRICT_KERNEL_RWX kernel the page containing the address to be patched is temporarily mapped as writeable. Currently, a per-cpu vmalloc patch area is used for this purpose. While the patch area is per-cpu, the temporary page mapping is inserted into the kernel page tables for

[RESEND PATCH v4 04/11] lkdtm/x86_64: Add test to hijack a patch mapping

2021-05-05 Thread Christopher M. Riedl
A previous commit implemented an LKDTM test on powerpc to exploit the temporary mapping established when patching code with STRICT_KERNEL_RWX enabled. Extend the test to work on x86_64 as well. Signed-off-by: Christopher M. Riedl --- drivers/misc/lkdtm/perms.c | 29 ++---

[RESEND PATCH v4 05/11] powerpc/64s: Add ability to skip SLB preload

2021-05-05 Thread Christopher M. Riedl
Switching to a different mm with Hash translation causes SLB entries to be preloaded from the current thread_info. This reduces SLB faults, for example when threads share a common mm but operate on different address ranges. Preloading entries from the thread_info struct may not always be

[RESEND PATCH v4 01/11] powerpc: Add LKDTM accessor for patching addr

2021-05-05 Thread Christopher M. Riedl
When live patching with STRICT_KERNEL_RWX a mapping is installed at a "patching address" with temporary write permissions. Provide a LKDTM-only accessor function for this address in preparation for a LKDTM test which attempts to "hijack" this mapping by writing to it from another CPU.

[RESEND PATCH v4 09/11] lkdtm/powerpc: Fix code patching hijack test

2021-05-05 Thread Christopher M. Riedl
Code patching on powerpc with a STRICT_KERNEL_RWX uses a userspace address in a temporary mm now. Use __put_user() to avoid write failures due to KUAP when attempting a "hijack" on the patching address. Signed-off-by: Christopher M. Riedl --- drivers/misc/lkdtm/perms.c | 9 - 1 file

[RESEND PATCH v4 02/11] lkdtm/powerpc: Add test to hijack a patch mapping

2021-05-05 Thread Christopher M. Riedl
When live patching with STRICT_KERNEL_RWX the CPU doing the patching must temporarily remap the page(s) containing the patch site with +W permissions. While this temporary mapping is in use, another CPU could write to the same mapping and maliciously alter kernel text. Implement a LKDTM test to

[RESEND PATCH v4 03/11] x86_64: Add LKDTM accessor for patching addr

2021-05-05 Thread Christopher M. Riedl
When live patching with STRICT_KERNEL_RWX a mapping is installed at a "patching address" with temporary write permissions. Provide a LKDTM-only accessor function for this address in preparation for a LKDTM test which attempts to "hijack" this mapping by writing to it from another CPU.

Re: [PATCH] ASoC: fsl_xcvr: Remove unneeded semicolon

2021-05-05 Thread Shengjiu Wang
On Thu, May 6, 2021 at 10:26 AM Wan Jiabing wrote: > > Fix the following coccicheck warning: > > ./sound/soc/fsl/fsl_xcvr.c:739:2-3: Unneeded semicolon > > Signed-off-by: Wan Jiabing Acked-by: Shengjiu Wang > --- > sound/soc/fsl/fsl_xcvr.c | 2 +- > 1 file changed, 1 insertion(+), 1

[PATCH v12 8/8] powerpc/32: use set_memory_attr()

2021-05-05 Thread Jordan Niethe
From: Christophe Leroy Use set_memory_attr() instead of the PPC32 specific change_page_attr() change_page_attr() was checking that the address was not mapped by blocks and was handling highmem, but that's unneeded because the affected pages can't be in highmem and block mapping verification is

[PATCH v12 7/8] powerpc/mm: implement set_memory_attr()

2021-05-05 Thread Jordan Niethe
From: Christophe Leroy In addition to the set_memory_xx() functions which allows to change the memory attributes of not (yet) used memory regions, implement a set_memory_attr() function to: - set the final memory protection after init on currently used kernel regions. - enable/disable kernel

[PATCH v12 6/8] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2021-05-05 Thread Jordan Niethe
From: Russell Currey To enable strict module RWX on powerpc, set: CONFIG_STRICT_MODULE_RWX=y You should also have CONFIG_STRICT_KERNEL_RWX=y set to have any real security benefit. ARCH_HAS_STRICT_MODULE_RWX is set to require ARCH_HAS_STRICT_KERNEL_RWX. This is due to a quirk in

[PATCH v12 5/8] powerpc/bpf: Write protect JIT code

2021-05-05 Thread Jordan Niethe
Add the necessary call to bpf_jit_binary_lock_ro() to remove write and add exec permissions to the JIT image after it has finished being written. Without CONFIG_STRICT_MODULE_RWX the image will be writable and executable until the call to bpf_jit_binary_lock_ro(). Signed-off-by: Jordan Niethe

[PATCH v12 4/8] powerpc/bpf: Remove bpf_jit_free()

2021-05-05 Thread Jordan Niethe
Commit 74451e66d516 ("bpf: make jited programs visible in traces") added a default bpf_jit_free() implementation. Powerpc did not use the default bpf_jit_free() as powerpc did not set the images read-only. The default bpf_jit_free() called bpf_jit_binary_unlock_ro() is why it could not be used for

[PATCH v12 3/8] powerpc/kprobes: Mark newly allocated probes as ROX

2021-05-05 Thread Jordan Niethe
From: Russell Currey Add the arch specific insn page allocator for powerpc. This allocates ROX pages if STRICT_KERNEL_RWX is enabled. These pages are only written to with patch_instruction() which is able to write RO pages. Reviewed-by: Daniel Axtens Signed-off-by: Russell Currey

[PATCH v12 2/8] powerpc/lib/code-patching: Set up Strict RWX patching earlier

2021-05-05 Thread Jordan Niethe
setup_text_poke_area() is a late init call so it runs before mark_rodata_ro() and after the init calls. This lets all the init code patching simply write to their locations. In the future, kprobes is going to allocate its instruction pages RO which means they will need setup_text__poke_area() to

[PATCH v12 1/8] powerpc/mm: Implement set_memory() routines

2021-05-05 Thread Jordan Niethe
From: Russell Currey The set_memory_{ro/rw/nx/x}() functions are required for STRICT_MODULE_RWX, and are generally useful primitives to have. This implementation is designed to be generic across powerpc's many MMUs. It's possible that this could be optimised to be faster for specific MMUs.

[PATCH v12 0/8] powerpc: Further Strict RWX support

2021-05-05 Thread Jordan Niethe
Adding more Strict RWX support on powerpc, in particular Strict Module RWX. Thanks for all of the feedback everyone. It is now rebased on linux-next + powerpc/64s/radix: Enable huge vmalloc mappings (https://lore.kernel.org/linuxppc-dev/20210503091755.613393-1-npig...@gmail.com/) For reference

Re: [PATCH] cxl: Fix an error message

2021-05-05 Thread Andrew Donnellan
On 6/5/21 5:38 am, Christophe JAILLET wrote: 'rc' is known to be 0 here. Initialize 'rc' with the expected error code before using it. I would prefer: "In cxl_add_chardev(), if the call to device_create() fails, we print the error message before 'rc' is set correctly, and therefore always

[PATCH] ASoC: fsl_xcvr: Remove unneeded semicolon

2021-05-05 Thread Wan Jiabing
Fix the following coccicheck warning: ./sound/soc/fsl/fsl_xcvr.c:739:2-3: Unneeded semicolon Signed-off-by: Wan Jiabing --- sound/soc/fsl/fsl_xcvr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c index

[PATCH 2/3] powerpc/fsl: set fsl, i2c-erratum-a004447 flag for P2041 i2c controllers

2021-05-05 Thread Chris Packham
The i2c controllers on the P2040/P2041 have an erratum where the documented scheme for i2c bus recovery will not work (A-004447). A different mechanism is needed which is documented in the P2040 Chip Errata Rev Q (latest available at the time of writing). Signed-off-by: Chris Packham ---

[PATCH 3/3] i2c: mpc: implement erratum A-004447 workaround

2021-05-05 Thread Chris Packham
The P2040/P2041 has an erratum where the normal i2c recovery mechanism does not work. Implement the alternative recovery mechanism documented in the P2040 Chip Errata Rev Q. Signed-off-by: Chris Packham --- drivers/i2c/busses/i2c-mpc.c | 88 +++- 1 file changed,

[PATCH 0/3] P2040/P2041 i2c recovery erratum

2021-05-05 Thread Chris Packham
The P2040/P2041 has an erratum where the i2c recovery scheme documented in the reference manual (and currently implemented in the i2c-mpc.c driver) does not work. The errata document provides an alternative that does work. This series implements that alternative and uses a property in the

[PATCH 1/3] dt-bindings: i2c: mpc: Add fsl,i2c-erratum-a004447 flag

2021-05-05 Thread Chris Packham
Document the fsl,i2c-erratum-a004447 flag which indicates the presence of an i2c erratum on some QorIQ SoCs. Signed-off-by: Chris Packham --- Documentation/devicetree/bindings/i2c/i2c-mpc.yaml | 7 +++ 1 file changed, 7 insertions(+) diff --git

Re: linux-next: manual merge of the akpm-current tree with the powerpc tree

2021-05-05 Thread Stephen Rothwell
Hi all, On Wed, 5 May 2021 11:39:59 +1000 Stephen Rothwell wrote: > > Today's linux-next merge of the akpm-current tree got a conflict in: > > arch/powerpc/Kconfig > > between commit: > > c6b05f4e233c ("powerpc/kconfig: Restore alphabetic order of the selects > under CONFIG_PPC") > >

Re: [PATCH] powerpc/papr_scm: Make 'perf_stats' invisible if perf-stats unavailable

2021-05-05 Thread kernel test robot
Hi Vaibhav, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on powerpc/next] [also build test WARNING on v5.12 next-20210505] [cannot apply to scottwood/next mpe/next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting

[PATCH] cxl: Fix an error message

2021-05-05 Thread Christophe JAILLET
'rc' is known to be 0 here. Initialize 'rc' with the expected error code before using it. While at it, avoid the affectation of 'rc' in a 'if' to make things more obvious and linux style. Fixes: f204e0b8ce ("cxl: Driver code for powernv PCIe based cards for userspace access") Signed-off-by:

[PATCH] powerpc/papr_scm: Make 'perf_stats' invisible if perf-stats unavailable

2021-05-05 Thread Vaibhav Jain
In case performance stats for an nvdimm are not available, reading the 'perf_stats' sysfs file returns an -ENOENT error. A better approach is to make the 'perf_stats' file entirely invisible to indicate that performance stats for an nvdimm are unavailable. So this patch updates

[PATCH v2] powerpc/papr_scm: Reduce error severity if nvdimm stats inaccessible

2021-05-05 Thread Vaibhav Jain
Currently drc_pmem_qeury_stats() generates a dev_err in case "Enable Performance Information Collection" feature is disabled from HMC or performance stats are not available for an nvdimm. The error is of the form below: papr_scm ibm,persistent-memory:ibm,pmemory@44104001: Failed to query

Re: [PATCH] kbuild: replace LANG=C with LC_ALL=C

2021-05-05 Thread Masahiro Yamada
On Tue, Apr 27, 2021 at 4:30 AM Matthieu Baerts wrote: > > Hi, > > Thank you for the patch! > > On 24/04/2021 13:48, Masahiro Yamada wrote: > > LANG gives a weak default to each LC_* in case it is not explicitly > > defined. LC_ALL, if set, overrides all other LC_* variables. > > > > LANG <

[PATCH AUTOSEL 4.4 19/19] powerpc/iommu: Annotate nested lock for lockdep

2021-05-05 Thread Sasha Levin
From: Alexey Kardashevskiy [ Upstream commit cc7130bf119add37f36238343a593b71ef6ecc1e ] The IOMMU table is divided into pools for concurrent mappings and each pool has a separate spinlock. When taking the ownership of an IOMMU group to pass through a device to a VM, we lock these spinlocks

[PATCH AUTOSEL 4.9 21/22] powerpc/iommu: Annotate nested lock for lockdep

2021-05-05 Thread Sasha Levin
From: Alexey Kardashevskiy [ Upstream commit cc7130bf119add37f36238343a593b71ef6ecc1e ] The IOMMU table is divided into pools for concurrent mappings and each pool has a separate spinlock. When taking the ownership of an IOMMU group to pass through a device to a VM, we lock these spinlocks

[PATCH AUTOSEL 4.9 18/22] powerpc/pseries: Stop calling printk in rtas_stop_self()

2021-05-05 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit ed8029d7b472369a010a1901358567ca3b6dbb0d ] RCU complains about us calling printk() from an offline CPU: = WARNING: suspicious RCU usage 5.12.0-rc7-02874-g7cf90e481cb8 #1 Not tainted -

[PATCH AUTOSEL 4.14 24/25] powerpc/iommu: Annotate nested lock for lockdep

2021-05-05 Thread Sasha Levin
From: Alexey Kardashevskiy [ Upstream commit cc7130bf119add37f36238343a593b71ef6ecc1e ] The IOMMU table is divided into pools for concurrent mappings and each pool has a separate spinlock. When taking the ownership of an IOMMU group to pass through a device to a VM, we lock these spinlocks

[PATCH AUTOSEL 4.14 21/25] powerpc/pseries: Stop calling printk in rtas_stop_self()

2021-05-05 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit ed8029d7b472369a010a1901358567ca3b6dbb0d ] RCU complains about us calling printk() from an offline CPU: = WARNING: suspicious RCU usage 5.12.0-rc7-02874-g7cf90e481cb8 #1 Not tainted -

[PATCH AUTOSEL 4.14 18/25] powerpc/smp: Set numa node before updating mask

2021-05-05 Thread Sasha Levin
From: Srikar Dronamraju [ Upstream commit 6980d13f0dd189846887bbbfa43793d9a41768d3 ] Geethika reported a trace when doing a dlpar CPU add. [ cut here ] WARNING: CPU: 152 PID: 1134 at kernel/sched/topology.c:2057 CPU: 152 PID: 1134 Comm: kworker/152:1 Not tainted

[PATCH AUTOSEL 4.19 27/32] powerpc/pseries: Stop calling printk in rtas_stop_self()

2021-05-05 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit ed8029d7b472369a010a1901358567ca3b6dbb0d ] RCU complains about us calling printk() from an offline CPU: = WARNING: suspicious RCU usage 5.12.0-rc7-02874-g7cf90e481cb8 #1 Not tainted -

[PATCH AUTOSEL 4.19 30/32] powerpc/iommu: Annotate nested lock for lockdep

2021-05-05 Thread Sasha Levin
From: Alexey Kardashevskiy [ Upstream commit cc7130bf119add37f36238343a593b71ef6ecc1e ] The IOMMU table is divided into pools for concurrent mappings and each pool has a separate spinlock. When taking the ownership of an IOMMU group to pass through a device to a VM, we lock these spinlocks

[PATCH AUTOSEL 4.19 23/32] powerpc/smp: Set numa node before updating mask

2021-05-05 Thread Sasha Levin
From: Srikar Dronamraju [ Upstream commit 6980d13f0dd189846887bbbfa43793d9a41768d3 ] Geethika reported a trace when doing a dlpar CPU add. [ cut here ] WARNING: CPU: 152 PID: 1134 at kernel/sched/topology.c:2057 CPU: 152 PID: 1134 Comm: kworker/152:1 Not tainted

[PATCH AUTOSEL 5.4 42/46] powerpc/iommu: Annotate nested lock for lockdep

2021-05-05 Thread Sasha Levin
From: Alexey Kardashevskiy [ Upstream commit cc7130bf119add37f36238343a593b71ef6ecc1e ] The IOMMU table is divided into pools for concurrent mappings and each pool has a separate spinlock. When taking the ownership of an IOMMU group to pass through a device to a VM, we lock these spinlocks

[PATCH AUTOSEL 5.4 37/46] powerpc/pseries: Stop calling printk in rtas_stop_self()

2021-05-05 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit ed8029d7b472369a010a1901358567ca3b6dbb0d ] RCU complains about us calling printk() from an offline CPU: = WARNING: suspicious RCU usage 5.12.0-rc7-02874-g7cf90e481cb8 #1 Not tainted -

[PATCH AUTOSEL 5.4 32/46] powerpc/smp: Set numa node before updating mask

2021-05-05 Thread Sasha Levin
From: Srikar Dronamraju [ Upstream commit 6980d13f0dd189846887bbbfa43793d9a41768d3 ] Geethika reported a trace when doing a dlpar CPU add. [ cut here ] WARNING: CPU: 152 PID: 1134 at kernel/sched/topology.c:2057 CPU: 152 PID: 1134 Comm: kworker/152:1 Not tainted

[PATCH AUTOSEL 5.10 74/85] powerpc/iommu: Annotate nested lock for lockdep

2021-05-05 Thread Sasha Levin
From: Alexey Kardashevskiy [ Upstream commit cc7130bf119add37f36238343a593b71ef6ecc1e ] The IOMMU table is divided into pools for concurrent mappings and each pool has a separate spinlock. When taking the ownership of an IOMMU group to pass through a device to a VM, we lock these spinlocks

[PATCH AUTOSEL 5.10 65/85] powerpc/pseries: Stop calling printk in rtas_stop_self()

2021-05-05 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit ed8029d7b472369a010a1901358567ca3b6dbb0d ] RCU complains about us calling printk() from an offline CPU: = WARNING: suspicious RCU usage 5.12.0-rc7-02874-g7cf90e481cb8 #1 Not tainted -

[PATCH AUTOSEL 5.10 60/85] powerpc/smp: Set numa node before updating mask

2021-05-05 Thread Sasha Levin
From: Srikar Dronamraju [ Upstream commit 6980d13f0dd189846887bbbfa43793d9a41768d3 ] Geethika reported a trace when doing a dlpar CPU add. [ cut here ] WARNING: CPU: 152 PID: 1134 at kernel/sched/topology.c:2057 CPU: 152 PID: 1134 Comm: kworker/152:1 Not tainted

[PATCH AUTOSEL 5.10 48/85] powerpc/mm: Add cond_resched() while removing hpte mappings

2021-05-05 Thread Sasha Levin
From: Vaibhav Jain [ Upstream commit a5d6a3e73acbd619dd5b7b831762b755f9e2db80 ] While removing large number of mappings from hash page tables for large memory systems as soft-lockup is reported because of the time spent inside htap_remove_mapping() like one below: watchdog: BUG: soft lockup -

[PATCH AUTOSEL 5.10 25/85] powerpc/32: Statically initialise first emergency context

2021-05-05 Thread Sasha Levin
From: Christophe Leroy [ Upstream commit a4719f5bb6d7dc220bffdc1b9f5ce5eaa5543581 ] The check of the emergency context initialisation in vmap_stack_overflow is buggy for the SMP case, as it compares r1 with 0 while in the SMP case r1 is offseted by the CPU id. Instead of fixing it, just

[PATCH AUTOSEL 5.10 24/85] selftests/powerpc: Fix L1D flushing tests for Power10

2021-05-05 Thread Sasha Levin
From: Russell Currey [ Upstream commit 3a72c94ebfb1f171eba0715998010678a09ec796 ] The rfi_flush and entry_flush selftests work by using the PM_LD_MISS_L1 perf event to count L1D misses. The value of this event has changed over time: - Power7 uses 0x400f0 - Power8 and Power9 use both 0x400f0

[PATCH AUTOSEL 5.11 093/104] powerpc/iommu: Annotate nested lock for lockdep

2021-05-05 Thread Sasha Levin
From: Alexey Kardashevskiy [ Upstream commit cc7130bf119add37f36238343a593b71ef6ecc1e ] The IOMMU table is divided into pools for concurrent mappings and each pool has a separate spinlock. When taking the ownership of an IOMMU group to pass through a device to a VM, we lock these spinlocks

[PATCH AUTOSEL 5.11 084/104] powerpc/pseries: Stop calling printk in rtas_stop_self()

2021-05-05 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit ed8029d7b472369a010a1901358567ca3b6dbb0d ] RCU complains about us calling printk() from an offline CPU: = WARNING: suspicious RCU usage 5.12.0-rc7-02874-g7cf90e481cb8 #1 Not tainted -

[PATCH AUTOSEL 5.11 077/104] powerpc/smp: Set numa node before updating mask

2021-05-05 Thread Sasha Levin
From: Srikar Dronamraju [ Upstream commit 6980d13f0dd189846887bbbfa43793d9a41768d3 ] Geethika reported a trace when doing a dlpar CPU add. [ cut here ] WARNING: CPU: 152 PID: 1134 at kernel/sched/topology.c:2057 CPU: 152 PID: 1134 Comm: kworker/152:1 Not tainted

[PATCH AUTOSEL 5.11 076/104] powerpc/xive: Use the "ibm, chip-id" property only under PowerNV

2021-05-05 Thread Sasha Levin
From: Cédric Le Goater [ Upstream commit e9e16917bc388846163b8566a298a291d71e44c9 ] The 'chip_id' field of the XIVE CPU structure is used to choose a target for a source located on the same chip. For that, the XIVE driver queries the chip identifier from the "ibm,chip-id" property and compares

[PATCH AUTOSEL 5.11 064/104] powerpc/mm: Add cond_resched() while removing hpte mappings

2021-05-05 Thread Sasha Levin
From: Vaibhav Jain [ Upstream commit a5d6a3e73acbd619dd5b7b831762b755f9e2db80 ] While removing large number of mappings from hash page tables for large memory systems as soft-lockup is reported because of the time spent inside htap_remove_mapping() like one below: watchdog: BUG: soft lockup -

[PATCH AUTOSEL 5.11 030/104] powerpc/32: Statically initialise first emergency context

2021-05-05 Thread Sasha Levin
From: Christophe Leroy [ Upstream commit a4719f5bb6d7dc220bffdc1b9f5ce5eaa5543581 ] The check of the emergency context initialisation in vmap_stack_overflow is buggy for the SMP case, as it compares r1 with 0 while in the SMP case r1 is offseted by the CPU id. Instead of fixing it, just

[PATCH AUTOSEL 5.11 029/104] selftests/powerpc: Fix L1D flushing tests for Power10

2021-05-05 Thread Sasha Levin
From: Russell Currey [ Upstream commit 3a72c94ebfb1f171eba0715998010678a09ec796 ] The rfi_flush and entry_flush selftests work by using the PM_LD_MISS_L1 perf event to count L1D misses. The value of this event has changed over time: - Power7 uses 0x400f0 - Power8 and Power9 use both 0x400f0

[PATCH AUTOSEL 5.12 103/116] powerpc/iommu: Annotate nested lock for lockdep

2021-05-05 Thread Sasha Levin
From: Alexey Kardashevskiy [ Upstream commit cc7130bf119add37f36238343a593b71ef6ecc1e ] The IOMMU table is divided into pools for concurrent mappings and each pool has a separate spinlock. When taking the ownership of an IOMMU group to pass through a device to a VM, we lock these spinlocks

[PATCH AUTOSEL 5.12 094/116] powerpc/pseries: Stop calling printk in rtas_stop_self()

2021-05-05 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit ed8029d7b472369a010a1901358567ca3b6dbb0d ] RCU complains about us calling printk() from an offline CPU: = WARNING: suspicious RCU usage 5.12.0-rc7-02874-g7cf90e481cb8 #1 Not tainted -

[PATCH AUTOSEL 5.12 087/116] powerpc/smp: Set numa node before updating mask

2021-05-05 Thread Sasha Levin
From: Srikar Dronamraju [ Upstream commit 6980d13f0dd189846887bbbfa43793d9a41768d3 ] Geethika reported a trace when doing a dlpar CPU add. [ cut here ] WARNING: CPU: 152 PID: 1134 at kernel/sched/topology.c:2057 CPU: 152 PID: 1134 Comm: kworker/152:1 Not tainted

[PATCH AUTOSEL 5.12 086/116] powerpc/xive: Use the "ibm, chip-id" property only under PowerNV

2021-05-05 Thread Sasha Levin
From: Cédric Le Goater [ Upstream commit e9e16917bc388846163b8566a298a291d71e44c9 ] The 'chip_id' field of the XIVE CPU structure is used to choose a target for a source located on the same chip. For that, the XIVE driver queries the chip identifier from the "ibm,chip-id" property and compares

[PATCH AUTOSEL 5.12 072/116] powerpc/mm: Add cond_resched() while removing hpte mappings

2021-05-05 Thread Sasha Levin
From: Vaibhav Jain [ Upstream commit a5d6a3e73acbd619dd5b7b831762b755f9e2db80 ] While removing large number of mappings from hash page tables for large memory systems as soft-lockup is reported because of the time spent inside htap_remove_mapping() like one below: watchdog: BUG: soft lockup -

[PATCH AUTOSEL 5.12 031/116] powerpc/32: Statically initialise first emergency context

2021-05-05 Thread Sasha Levin
From: Christophe Leroy [ Upstream commit a4719f5bb6d7dc220bffdc1b9f5ce5eaa5543581 ] The check of the emergency context initialisation in vmap_stack_overflow is buggy for the SMP case, as it compares r1 with 0 while in the SMP case r1 is offseted by the CPU id. Instead of fixing it, just

[PATCH AUTOSEL 5.12 029/116] selftests/powerpc: Fix L1D flushing tests for Power10

2021-05-05 Thread Sasha Levin
From: Russell Currey [ Upstream commit 3a72c94ebfb1f171eba0715998010678a09ec796 ] The rfi_flush and entry_flush selftests work by using the PM_LD_MISS_L1 perf event to count L1D misses. The value of this event has changed over time: - Power7 uses 0x400f0 - Power8 and Power9 use both 0x400f0

Re: [PATCH] KVM: PPC: Book3S HV: Fix conversion to gfn-based MMU notifier callbacks

2021-05-05 Thread Paolo Bonzini
On 05/05/21 14:15, Nicholas Piggin wrote: Commit b1c5356e873c ("KVM: PPC: Convert to the gfn-based MMU notifier callbacks") causes unmap_gfn_range and age_gfn callbacks to only work on the first gfn in the range. It also makes the aging callbacks call into both radix and hash aging functions for

Re: [PATCH v3] powerpc/64: Option to use ELFv2 ABI for big-endian kernels

2021-05-05 Thread Michal Suchánek
On Wed, May 05, 2021 at 05:23:37PM +0200, Michal Suchánek wrote: > Hello, > > looks like the ABI flags are not correctly applied when cross-compiling. > > While building natively success of BTFIDS depends on the kernel ABI but > when cross-compiling success of BTFIDS depends on the default

[PATCH v7 6/6] KVM: PPC: Book3S HV: Use H_RPT_INVALIDATE in nested KVM

2021-05-05 Thread Bharata B Rao
In the nested KVM case, replace H_TLB_INVALIDATE by the new hcall H_RPT_INVALIDATE if available. The availability of this hcall is determined from "hcall-rpt-invalidate" string in ibm,hypertas-functions DT property. Signed-off-by: Bharata B Rao Reviewed-by: Fabiano Rosas Reviewed-by: David

[PATCH v7 5/6] KVM: PPC: Book3S HV: Add KVM_CAP_PPC_RPT_INVALIDATE capability

2021-05-05 Thread Bharata B Rao
Now that we have H_RPT_INVALIDATE fully implemented, enable support for the same via KVM_CAP_PPC_RPT_INVALIDATE KVM capability Signed-off-by: Bharata B Rao Reviewed-by: David Gibson --- Documentation/virt/kvm/api.rst | 18 ++ arch/powerpc/kvm/powerpc.c | 3 +++

[PATCH v7 3/6] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE

2021-05-05 Thread Bharata B Rao
H_RPT_INVALIDATE does two types of TLB invalidations: 1. Process-scoped invalidations for guests when LPCR[GTSE]=0. This is currently not used in KVM as GTSE is not usually disabled in KVM. 2. Partition-scoped invalidations that an L1 hypervisor does on behalf of an L2 guest. This is

[PATCH v7 4/6] KVM: PPC: Book3S HV: Nested support in H_RPT_INVALIDATE

2021-05-05 Thread Bharata B Rao
Enable support for process-scoped invalidations from nested guests and partition-scoped invalidations for nested guests. Process-scoped invalidations for any level of nested guests are handled by implementing H_RPT_INVALIDATE handler in the nested guest exit path in L0. Partition-scoped

[PATCH v7 2/6] powerpc/book3s64/radix: Add H_RPT_INVALIDATE pgsize encodings to mmu_psize_def

2021-05-05 Thread Bharata B Rao
Add a field to mmu_psize_def to store the page size encodings of H_RPT_INVALIDATE hcall. Initialize this while scanning the radix AP encodings. This will be used when invalidating with required page size encoding in the hcall. Signed-off-by: Bharata B Rao Reviewed-by: David Gibson ---

[PATCH v7 0/6] Support for H_RPT_INVALIDATE in PowerPC KVM

2021-05-05 Thread Bharata B Rao
This patchset adds support for the new hcall H_RPT_INVALIDATE and replaces the nested tlb flush calls with this new hcall if support for the same exists. Changes in v7: - - Fixed a bug where LPID of nested guest was being fetched wrongly in the process scoped invalidation part of

[PATCH v7 1/6] KVM: PPC: Book3S HV: Fix comments of H_RPT_INVALIDATE arguments

2021-05-05 Thread Bharata B Rao
From: "Aneesh Kumar K.V" The type values H_RPTI_TYPE_PRT and H_RPTI_TYPE_PAT indicate invalidating the caching of process and partition scoped entries respectively. Signed-off-by: Aneesh Kumar K.V Signed-off-by: Bharata B Rao Reviewed-by: David Gibson --- arch/powerpc/include/asm/hvcall.h |

Re: [PATCH v3] powerpc/64: Option to use ELFv2 ABI for big-endian kernels

2021-05-05 Thread Michal Suchánek
Hello, looks like the ABI flags are not correctly applied when cross-compiling. While building natively success of BTFIDS depends on the kernel ABI but when cross-compiling success of BTFIDS depends on the default toolchain ABI. It's problem independent of this patch - the problem exists both

Re: [PATCH v4] pseries/drmem: update LMBs after LPM

2021-05-05 Thread Laurent Dufour
Le 05/05/2021 à 00:30, Nathan Lynch a écrit : Hi Laurent, Hi Nathan, Thanks for your review. Bear with me while I work through the commit message: Laurent Dufour writes: After a LPM, the device tree node ibm,dynamic-reconfiguration-memory may be updated by the hypervisor in the case the

[PATCH v2 2/2] powerpc/paca: Remove mm_ctx_id and mm_ctx_slb_addr_limit

2021-05-05 Thread Christophe Leroy
mm_ctx_id and mm_ctx_slb_addr_limit are not used anymore. Remove them. Reviewed-by: Nicholas Piggin Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/paca.h | 2 -- arch/powerpc/kernel/paca.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/arch/powerpc/include/asm/paca.h

[PATCH v2 1/2] powerpc/asm-offset: Remove unused items

2021-05-05 Thread Christophe Leroy
Following PACA related items are not used anymore by ASM code: PACA_SIZE, PACACONTEXTID, PACALOWSLICESPSIZE, PACAHIGHSLICEPSIZE, PACA_SLB_ADDR_LIMIT, MMUPSIZEDEFSIZE, PACASLBCACHE, PACASLBCACHEPTR, PACASTABRR, PACAVMALLOCSLLP, MMUPSIZESLLP, PACACONTEXTSLLP, PACALPPACAPTR, LPPACA_DTLIDX and

Re: [PATCH v3] powerpc/64: Option to use ELFv2 ABI for big-endian kernels

2021-05-05 Thread Michal Suchánek
On Wed, May 05, 2021 at 10:07:29PM +1000, Michael Ellerman wrote: > Michal Suchánek writes: > > On Mon, May 03, 2021 at 01:37:57PM +0200, Andreas Schwab wrote: > >> Should this add a tag to the module vermagic? > > > > Would the modues link even if the vermagic was not changed? > > Most modules

Re: [FSL P50x0] Xorg always restarts again and again after the the PowerPC updates 5.13-1

2021-05-05 Thread Christian Zigotzky
On 04 May 2021 at 05:17pm, Christophe Leroy wrote: Le 04/05/2021 à 16:59, Christian Zigotzky a écrit : On 04 May 2021 at 04:41pm Christophe Leroy wrote: Le 04/05/2021 à 13:02, Christian Zigotzky a écrit : On 04 May 2021 at 12:07pm, Christian Zigotzky wrote: On 04 May 2021 at 11:49am,

Re: [PATCH v2] powerpc/64: BE option to use ELFv2 ABI for big endian kernels

2021-05-05 Thread Segher Boessenkool
On Tue, May 04, 2021 at 10:15:34PM +1000, Michael Ellerman wrote: > Segher Boessenkool writes: > > On Mon, May 03, 2021 at 10:51:41AM +1000, Nicholas Piggin wrote: > >> then ELF ABIv2 is more explanatory about it being an abi change > >> rather than base elf change, even if it's not the "correct"

[PATCH] KVM: PPC: Book3S HV: Fix conversion to gfn-based MMU notifier callbacks

2021-05-05 Thread Nicholas Piggin
Commit b1c5356e873c ("KVM: PPC: Convert to the gfn-based MMU notifier callbacks") causes unmap_gfn_range and age_gfn callbacks to only work on the first gfn in the range. It also makes the aging callbacks call into both radix and hash aging functions for radix guests. Fix this. Add warnings for

Re: [PATCH v3] powerpc/64: Option to use ELFv2 ABI for big-endian kernels

2021-05-05 Thread Michael Ellerman
Michal Suchánek writes: > On Mon, May 03, 2021 at 01:37:57PM +0200, Andreas Schwab wrote: >> Should this add a tag to the module vermagic? > > Would the modues link even if the vermagic was not changed? Most modules will require some symbols from the kernel, and those will be dot symbols, which

[PATCH 2/2] powerpc/32s: Convert switch_mmu_context() to C

2021-05-05 Thread Christophe Leroy
switch_mmu_context() does things that can easily be done in C. For updating user segments, we have update_user_segments(). As mentionned in commit b5efec00b671 ("powerpc/32s: Move KUEP locking/unlocking in C"), update_user_segments() has the loop unrolled which is a significant performance gain.

[PATCH 1/2] powerpc/32s: Refactor update of user segment registers

2021-05-05 Thread Christophe Leroy
KUEP implements the update of user segment registers. Move it into mmu-hash.h in order to use it from other places. And inline kuep_lock() and kuep_unlock() and remove kuep.c Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/mmu-hash.h | 27 +