Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-02 Thread Christoph Hellwig
On Fri, Aug 02, 2019 at 11:38:03AM +0100, Will Deacon wrote: > > So this boils down to a terminology mismatch. The Arm architecture doesn't > have > anything called "write combine", so in Linux we instead provide what the Arm > architecture calls "Normal non-cacheable" memory for pgprot_writecomb

[PATCH v2 1/3] powerpc/rtas: use device model APIs and serialization during LPM

2019-08-02 Thread Nathan Lynch
The LPAR migration implementation and userspace-initiated cpu hotplug can interleave their executions like so: 1. Set cpu 7 offline via sysfs. 2. Begin a partition migration, whose implementation requires the OS to ensure all present cpus are online; cpu 7 is onlined: rtas_ibm_suspend_me

[PATCH v2 2/3] powerpc/rtas: allow rescheduling while changing cpu states

2019-08-02 Thread Nathan Lynch
rtas_cpu_state_change_mask() potentially operates on scores of cpus, so explicitly allow rescheduling in the loop body. Signed-off-by: Nathan Lynch --- arch/powerpc/kernel/rtas.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 0

[PATCH v2 0/3] more migration vs CPU hotplug fixes etc

2019-08-02 Thread Nathan Lynch
Despite recent fixes, userspace-initiated CPU hotplug still can destructively race with the migration code's CPU state manipulations. And parts of the LPM implementation have potentially long-running code, especially on larger systems, that ties up the CPU causing RCU stalls etc. Changes since v1:

[PATCH v2 3/3] powerpc/pseries/mobility: use cond_resched when updating device tree

2019-08-02 Thread Nathan Lynch
After a partition migration, pseries_devicetree_update() processes changes to the device tree communicated from the platform to Linux. This is a relatively heavyweight operation, with multiple device tree searches, memory allocations, and conversations with partition firmware. There's a few levels

Re: [PATCH v2 3/3] powerpc/spinlocks: Fix oops in shared-processor spinlocks

2019-08-02 Thread Christopher M Riedl
> On August 2, 2019 at 6:38 AM Michael Ellerman wrote: > > > "Christopher M. Riedl" writes: > > diff --git a/arch/powerpc/include/asm/spinlock.h > > b/arch/powerpc/include/asm/spinlock.h > > index 0a8270183770..6aed8a83b180 100644 > > --- a/arch/powerpc/include/asm/spinlock.h > > +++ b/arch/

Re: [PATCH 1/1] pseries/hotplug-memory.c: Change rc variable to bool

2019-08-02 Thread Leonardo Bras
On Fri, 2019-08-02 at 09:23 +0200, David Hildenbrand wrote: > subtle changes in a "Change rc variable to bool" > patch should be avoided. You are right. If it was a valid change, I should give it a patch for itself. I will keep that in mind next time. Thanks for helping! signature.asc Descript

Re: [PATCH v2 1/1] powerpc/pseries/hotplug-memory.c: Change rc variable to bool

2019-08-02 Thread David Hildenbrand
On 02.08.19 15:39, Leonardo Bras wrote: > Changes the return variable to bool (as the return value) and > avoids doing a ternary operation before returning. > > Signed-off-by: Leonardo Bras > --- > Changes in v2: > - Restore previous and-ing logic on rc. > > arch/powerpc/platforms/pseries/hot

[PATCH v2 1/1] powerpc/pseries/hotplug-memory.c: Change rc variable to bool

2019-08-02 Thread Leonardo Bras
Changes the return variable to bool (as the return value) and avoids doing a ternary operation before returning. Signed-off-by: Leonardo Bras --- Changes in v2: - Restore previous and-ing logic on rc. arch/powerpc/platforms/pseries/hotplug-memory.c | 6 +++--- 1 file changed, 3 insertions(+),

[PATCH AUTOSEL 4.4 15/17] scsi: ibmvfc: fix WARN_ON during event pool release

2019-08-02 Thread Sasha Levin
From: Tyrel Datwyler [ Upstream commit 5578257ca0e21056821e6481bd534ba267b84e58 ] While removing an ibmvfc client adapter a WARN_ON like the following WARN_ON is seen in the kernel log: WARNING: CPU: 6 PID: 5421 at ./include/linux/dma-mapping.h:541 ibmvfc_free_event_pool+0x12c/0x1f0 [ibmvfc] CP

[PATCH AUTOSEL 4.4 07/17] cpufreq/pasemi: fix use-after-free in pas_cpufreq_cpu_init()

2019-08-02 Thread Sasha Levin
From: Wen Yang [ Upstream commit e0a12445d1cb186d875410d093a00d215bec6a89 ] The cpu variable is still being used in the of_get_property() call after the of_node_put() call, which may result in use-after-free. Fixes: a9acc26b75f6 ("cpufreq/pasemi: fix possible object reference leak") Signed-off-

[PATCH AUTOSEL 4.9 19/22] scsi: ibmvfc: fix WARN_ON during event pool release

2019-08-02 Thread Sasha Levin
From: Tyrel Datwyler [ Upstream commit 5578257ca0e21056821e6481bd534ba267b84e58 ] While removing an ibmvfc client adapter a WARN_ON like the following WARN_ON is seen in the kernel log: WARNING: CPU: 6 PID: 5421 at ./include/linux/dma-mapping.h:541 ibmvfc_free_event_pool+0x12c/0x1f0 [ibmvfc] CP

[PATCH AUTOSEL 4.9 08/22] cpufreq/pasemi: fix use-after-free in pas_cpufreq_cpu_init()

2019-08-02 Thread Sasha Levin
From: Wen Yang [ Upstream commit e0a12445d1cb186d875410d093a00d215bec6a89 ] The cpu variable is still being used in the of_get_property() call after the of_node_put() call, which may result in use-after-free. Fixes: a9acc26b75f6 ("cpufreq/pasemi: fix possible object reference leak") Signed-off-

[PATCH AUTOSEL 4.14 25/30] scsi: ibmvfc: fix WARN_ON during event pool release

2019-08-02 Thread Sasha Levin
From: Tyrel Datwyler [ Upstream commit 5578257ca0e21056821e6481bd534ba267b84e58 ] While removing an ibmvfc client adapter a WARN_ON like the following WARN_ON is seen in the kernel log: WARNING: CPU: 6 PID: 5421 at ./include/linux/dma-mapping.h:541 ibmvfc_free_event_pool+0x12c/0x1f0 [ibmvfc] CP

[PATCH AUTOSEL 4.14 13/30] cpufreq/pasemi: fix use-after-free in pas_cpufreq_cpu_init()

2019-08-02 Thread Sasha Levin
From: Wen Yang [ Upstream commit e0a12445d1cb186d875410d093a00d215bec6a89 ] The cpu variable is still being used in the of_get_property() call after the of_node_put() call, which may result in use-after-free. Fixes: a9acc26b75f6 ("cpufreq/pasemi: fix possible object reference leak") Signed-off-

[PATCH AUTOSEL 4.19 35/42] scsi: ibmvfc: fix WARN_ON during event pool release

2019-08-02 Thread Sasha Levin
From: Tyrel Datwyler [ Upstream commit 5578257ca0e21056821e6481bd534ba267b84e58 ] While removing an ibmvfc client adapter a WARN_ON like the following WARN_ON is seen in the kernel log: WARNING: CPU: 6 PID: 5421 at ./include/linux/dma-mapping.h:541 ibmvfc_free_event_pool+0x12c/0x1f0 [ibmvfc] CP

[PATCH AUTOSEL 4.19 21/42] cpufreq/pasemi: fix use-after-free in pas_cpufreq_cpu_init()

2019-08-02 Thread Sasha Levin
From: Wen Yang [ Upstream commit e0a12445d1cb186d875410d093a00d215bec6a89 ] The cpu variable is still being used in the of_get_property() call after the of_node_put() call, which may result in use-after-free. Fixes: a9acc26b75f6 ("cpufreq/pasemi: fix possible object reference leak") Signed-off-

[PATCH AUTOSEL 5.2 65/76] scsi: ibmvfc: fix WARN_ON during event pool release

2019-08-02 Thread Sasha Levin
From: Tyrel Datwyler [ Upstream commit 5578257ca0e21056821e6481bd534ba267b84e58 ] While removing an ibmvfc client adapter a WARN_ON like the following WARN_ON is seen in the kernel log: WARNING: CPU: 6 PID: 5421 at ./include/linux/dma-mapping.h:541 ibmvfc_free_event_pool+0x12c/0x1f0 [ibmvfc] CP

[PATCH AUTOSEL 5.2 46/76] cpufreq/pasemi: fix use-after-free in pas_cpufreq_cpu_init()

2019-08-02 Thread Sasha Levin
From: Wen Yang [ Upstream commit e0a12445d1cb186d875410d093a00d215bec6a89 ] The cpu variable is still being used in the of_get_property() call after the of_node_put() call, which may result in use-after-free. Fixes: a9acc26b75f6 ("cpufreq/pasemi: fix possible object reference leak") Signed-off-

[PATCH AUTOSEL 5.2 37/76] powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails

2019-08-02 Thread Sasha Levin
From: Vaibhav Jain [ Upstream commit 3a855b7ac7d5021674aa3e1cc9d3bfd6b604e9c0 ] In some cases initial bind of scm memory for an lpar can fail if previously it wasn't released using a scm-unbind hcall. This situation can arise due to panic of the previous kernel or forced lpar fadump. In such cas

[PATCH AUTOSEL 5.2 01/76] powerpc: fix off by one in max_zone_pfn initialization for ZONE_DMA

2019-08-02 Thread Sasha Levin
From: Andrea Arcangeli [ Upstream commit 03800e0526ee25ed7c843ca1e57b69ac2a5af642 ] 25078dc1f74be16b858e914f52cc8f4d03c2271a first introduced an off by one error in the ZONE_DMA initialization of PPC_BOOK3E_64=y and since 9739ab7eda459f0669ec9807e0d9be5020bab88c the off by one applies to PPC32=y

Re: [PATCH 1/1] pseries/hotplug-memory.c: Replace nested ifs by switch-case

2019-08-02 Thread Leonardo Bras
On Fri, 2019-08-02 at 22:26 +1000, Michael Ellerman wrote: > Leonardo Bras writes: > > I noticed these nested ifs can be easily replaced by switch-cases, > > which can improve readability. > > > > Signed-off-by: Leonardo Bras > > --- > > .../platforms/pseries/hotplug-memory.c| 26 ++

Re: [PATCH 1/1] pseries/hotplug-memory.c: Replace nested ifs by switch-case

2019-08-02 Thread Michael Ellerman
Leonardo Bras writes: > I noticed these nested ifs can be easily replaced by switch-cases, > which can improve readability. > > Signed-off-by: Leonardo Bras > --- > .../platforms/pseries/hotplug-memory.c| 26 +-- > 1 file changed, 18 insertions(+), 8 deletions(-) Thanks,

Re: [PATCH v2] PCI: rpaphp: Avoid a sometimes-uninitialized warning

2019-08-02 Thread Michael Ellerman
Bjorn Helgaas writes: > On Mon, Jul 22, 2019 at 02:05:12PM +1000, Michael Ellerman wrote: >> Nathan Chancellor writes: >> > On Mon, Jun 03, 2019 at 03:11:58PM -0700, Nathan Chancellor wrote: >> >> When building with -Wsometimes-uninitialized, clang warns: >> >> >> >> drivers/pci/hotplug/rpaphp_c

Re: [RFC PATCH] powerpc: Add the ppc_capabilities ELF note

2019-08-02 Thread Michael Ellerman
Hi Claudio, Claudio Carvalho writes: > Add the ppc_capabilities ELF note to the powerpc kernel binary. It is a > bitmap that can be used to advertise kernel capabilities to userland. > > This patch also defines PPCCAP_ULTRAVISOR_BIT as being the bit zero. Apologies for the slow review. I think

Re: [PATCH v2 3/3] powerpc/spinlocks: Fix oops in shared-processor spinlocks

2019-08-02 Thread Michael Ellerman
"Christopher M. Riedl" writes: > diff --git a/arch/powerpc/include/asm/spinlock.h > b/arch/powerpc/include/asm/spinlock.h > index 0a8270183770..6aed8a83b180 100644 > --- a/arch/powerpc/include/asm/spinlock.h > +++ b/arch/powerpc/include/asm/spinlock.h > @@ -124,6 +122,22 @@ static inline bool is_

[PATCH v2 44/44] powerpc/64s/exception: Remove old INT_KVM_HANDLER

2019-08-02 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 57 ++-- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 5b43cd201cdd..f2883e7d9abb 100644 --- a/arc

[PATCH v2 43/44] powerpc/64s/exception: Remove old INT_COMMON macro

2019-08-02 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 51 +--- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index ffa9f5eb054b..5b43cd201cdd 100644 --- a/arc

[PATCH v2 41/44] powerpc/64s/exception: Move all interrupt handlers to new style code gen macros

2019-08-02 Thread Nicholas Piggin
Aside from label names and BUG line numbers, the generated code change is an additional HMI KVM handler added for the "late" KVM handler, because early and late HMI generation is achieved by defining two different interrupt types. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions

[PATCH v2 42/44] powerpc/64s/exception: Remove old INT_ENTRY macro

2019-08-02 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 76 +--- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 3e57b5861695..ffa9f5eb054b 100644 --- a/arc

[PATCH v2 40/44] powerpc/64s/exception: Expand EXC_COMMON and EXC_COMMON_ASYNC macros

2019-08-02 Thread Nicholas Piggin
These don't provide a large amount of code sharing. Removing them makes code easier to shuffle around. For example, some of the common instructions will be moved into the common code gen macro. No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 1

[PATCH v2 39/44] powerpc/64s/exception: Add GEN_KVM macro that uses INT_DEFINE parameters

2019-08-02 Thread Nicholas Piggin
No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 9d52ba7800e9..4e475e33b14a 100644

[PATCH v2 38/44] powerpc/64s/exception: Add GEN_COMMON macro that uses INT_DEFINE parameters

2019-08-02 Thread Nicholas Piggin
No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 10d706f67a53..9d52

[PATCH v2 37/44] powerpc/64s/exception: Introduce INT_DEFINE parameter block for code generation

2019-08-02 Thread Nicholas Piggin
The code generation macro arguments are difficult to read, and defaults can't easily be used. This introduces a block where parameters can be set for interrupt handler code generation by the subsequent macros, and adds the first generation macro for interrupt entry. One interrupt handler is conve

[PATCH v2 36/44] powerpc/64s/exception: reduce page fault unnecessary loads

2019-08-02 Thread Nicholas Piggin
This avoids 3 loads in the radix page fault case, 1 load in the hash fault case, and 2 loads in the hash miss page fault case. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 38 --- arch/powerpc/mm/book3s64/hash_utils.c | 4 +-- 2 files change

[PATCH v2 35/44] powerpc/64s/exception: Remove pointless KVM handler name bifurcation

2019-08-02 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 102 --- 1 file changed, 44 insertions(+), 58 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 3ebb39a4b9fa..908c8003f063 100644 --- a/arc

[PATCH v2 34/44] powerpc/64s/exception: program check handler do not branch into a macro

2019-08-02 Thread Nicholas Piggin
It is clever, but the small code saving is not worth the spaghetti of jumping to a label in an expanded macro, particularly when the label is just a number rather than a descriptive name. So expand the INT_COMMON macro twice, once for the stack and no stack cases, and branch to those. The slight c

[PATCH v2 33/44] powerpc/64s/exception: move interrupt entry code above the common handler

2019-08-02 Thread Nicholas Piggin
This better reflects the order in which the code is executed. No generated code change except BUG line number constants. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 450 +-- 1 file changed, 225 insertions(+), 225 deletions(-) diff --git a/a

[PATCH v2 32/44] powerpc/64s/exception: INT_COMMON add DAR, DSISR, reconcile options

2019-08-02 Thread Nicholas Piggin
Move DAR and DSISR saving to pt_regs into INT_COMMON. Also add an option to expand RECONCILE_IRQ_STATE. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 111 --- 1 file changed, 51 insertions(+), 60 deletions(-) diff --git a/arch/powerpc/kernel/e

[PATCH v2 31/44] powerpc/64s/exception: Expand EXCEPTION_PROLOG_COMMON_1 and 2 into caller

2019-08-02 Thread Nicholas Piggin
No generated code change except BUG line number constants. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 85 +--- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/except

[PATCH v2 30/44] powerpc/64s/exception: Expand EXCEPTION_COMMON macro into caller

2019-08-02 Thread Nicholas Piggin
No generated code change except BUG line number constants. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 54 ++-- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/except

[PATCH v2 29/44] powerpc/64s/exception: Add INT_COMMON gas macro to generate common exception code

2019-08-02 Thread Nicholas Piggin
No generated code change except BUG line number constants. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 52 +--- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/except

[PATCH v2 28/44] powerpc/64s/exception: Merge EXCEPTION_PROLOG_COMMON_2/3

2019-08-02 Thread Nicholas Piggin
Merge EXCEPTION_PROLOG_COMMON_3 into EXCEPTION_PROLOG_COMMON_2. No generated code change except BUG line number constants. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/arch/powerpc

[PATCH v2 27/44] powerpc/64s/exception: KVM_HANDLER reorder arguments to match other macros

2019-08-02 Thread Nicholas Piggin
Also change argument name (n -> vec) to match others. No generated code change. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kerne

[PATCH v2 26/44] powerpc/64s/exception: Add INT_KVM_HANDLER gas macro

2019-08-02 Thread Nicholas Piggin
Replace the 4 variants of cpp macros with one gas macro. No generated code change except BUG line number constants. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 99 +++- 1 file changed, 40 insertions(+), 59 deletions(-) diff --git a/arch/pow

[PATCH v2 25/44] powerpc/64s/exception: INT_HANDLER support HDAR/HDSISR and use it in HDSI

2019-08-02 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 45e9f8bd551d..c7fb9366ac5a 100644 --- a/arch/powerpc/ker

[PATCH v2 24/44] powerpc/64s/exception: Add the virt variant of the denorm interrupt handler

2019-08-02 Thread Nicholas Piggin
All other virt handlers have the prolog code in the virt vector rather than branch to the real vector. Follow this pattern in the denorm virt handler. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/

[PATCH v2 23/44] powerpc/64s/exception: remove EXCEPTION_PROLOG_0/1, rename _2

2019-08-02 Thread Nicholas Piggin
EXCEPTION_PROLOG_0 and _1 have only a single caller, so expand them into it. Rename EXCEPTION_PROLOG_2_REAL to INT_SAVE_SRR_AND_JUMP and EXCEPTION_PROLOG_2_VIRT to INT_VIRT_SAVE_SRR_AND_JUMP, which are more descriptive. No generated code change except BUG line number constants. Signed-off-by: Ni

[PATCH v2 22/44] powerpc/64s/exception: Replace PROLOG macros and EXC helpers with a gas macro

2019-08-02 Thread Nicholas Piggin
This creates a single macro that generates the exception prolog code, with variants specified by arguments, rather than assorted nested macros for different variants. The increasing length of macro argument list is not nice to read or modify, but this is a temporary condition that will be improved

[PATCH v2 21/44] powerpc/64s/exception: remove 0xb00 handler

2019-08-02 Thread Nicholas Piggin
This vector is not used by any supported processor, and has been implemented as an unknown exception going back to 2.6. There is nothing special about 0xb00, so remove it like other unused vectors. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 6 ++ 1 file changed

[PATCH v2 20/44] powerpc/64s/exception: Fix performance monitor virt handler

2019-08-02 Thread Nicholas Piggin
The perf virt handler uses EXCEPTION_PROLOG_2_REAL rather than _VIRT. In practice this is okay because the _REAL variant is usable by virt mode interrupts, but should be fixed (and is a performance win). Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 2 +- 1 file chang

[PATCH v2 19/44] powerpc/64s/exception: Add EXC_HV_OR_STD, which selects HSRR if HVMODE

2019-08-02 Thread Nicholas Piggin
Add EXC_HV_OR_STD and use it to consolidate the 0x500 external interrupt. Executed code is unchanged. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 102 +-- 1 file changed, 79 insertions(+), 23 deletions(-) diff --git a/arch/powerpc/kernel/ex

[PATCH v2 18/44] powerpc/64s/exception: move head-64.h exception code to exception-64s.S

2019-08-02 Thread Nicholas Piggin
The head-64.h code should deal only with the head code sections and offset calculations. No generated code change except BUG line number constants. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/head-64.h | 41 arch/powerpc/kernel/exceptions-64s.S | 4

[PATCH v2 17/44] powerpc/64s/exception: Fix DAR load for handle_page_fault error case

2019-08-02 Thread Nicholas Piggin
This buglet goes back to before the 64/32 arch merge, but it does not seem to have had practical consequences because bad_page_fault does not use the 2nd argument, but rather regs->dar/nip. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 2 +- 1 file changed, 1 insertio

[PATCH v2 16/44] powerpc/64s/exception: machine check improve labels and comments

2019-08-02 Thread Nicholas Piggin
Short forward and backward branches can be given number labels, but larger significant divergences in code path a more readable if they're given descriptive names. Also adjusts a comment to account for guest delivery. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 14

[PATCH v2 15/44] powerpc/64s/exception: untangle early machine check handler branch

2019-08-02 Thread Nicholas Piggin
machine_check_early_common now branches to machine_check_handle_early which is its only caller. Move interleaving code out of the way, and remove the branch. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 129 +-- 1 file changed, 62 insertions(

[PATCH v2 14/44] powerpc/64s/exception: machine check move unrecoverable handling out of line

2019-08-02 Thread Nicholas Piggin
Similarly to the previous change, all callers of the unrecoverable handler run relocated so can reach it with a direct branch. This makes it easy to move out of line, which makes the "normal" path less cluttered and easier to follow. MSR[ME] manipulation still requires the rfi, so that is moved ou

[PATCH v2 13/44] powerpc/64s/exception: simplify machine check early path

2019-08-02 Thread Nicholas Piggin
machine_check_handle_early_common can reach machine_check_handle_early directly now that it runs at the relocated address, so just branch directly. The rfi sequence is required to enable MSR[ME] but that step is moved into a helper function, making the code easier to follow. Signed-off-by: Nichol

[PATCH v2 12/44] powerpc/64s/exception: machine check move tramp code

2019-08-02 Thread Nicholas Piggin
Following convention, move the tramp code (unrelocated) above the common handlers (relocated). Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S

[PATCH v2 11/44] powerpc/64s/exception: machine check restructure to reuse common macros

2019-08-02 Thread Nicholas Piggin
Follow the pattern of sreset and HMI handlers more closely: use EXCEPTION_PROLOG_COMMON_1 rather than open-coding it, and run the handler at the relocated location. This helps later simplification and code sharing. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 71 +++

[PATCH v2 10/44] powerpc/64s/exception: machine check pseries should skip the late handler for kernel MCEs

2019-08-02 Thread Nicholas Piggin
The powernv machine check handler copes with taking a MCE from one of three contexts, guest, kernel, and user. In each case the early handler runs first on a special stack, then: - The guest case branches to the KVM interrupt handler (via standard interrupt macros). - The user case will run the

[PATCH v2 09/44] powerpc/64s/pseries: machine check convert to use common event code

2019-08-02 Thread Nicholas Piggin
The common machine_check_event data structures and queues are mostly platform independent, with powernv decoding SRR1/DSISR/etc., into machine_check_event objects. This patch converts pseries to use this infrastructure by decoding fwnmi/rtas data into machine_check_event objects. This allows queu

[PATCH v2 08/44] powerpc/64s/powernv: machine check dump SLB contents

2019-08-02 Thread Nicholas Piggin
Re-use the code introduced in pseries to save and dump the contents of the SLB in the case of an SLB involved machine check exception. This patch also avoids allocating the SLB save array on pseries radix. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/mce.c | 6 ++ ar

[PATCH v2 07/44] powerpc/64s/exception: machine check use correct cfar for late handler

2019-08-02 Thread Nicholas Piggin
Bare metal machine checks run an "early" handler in real mode before running the main handler which reports the event. The main handler runs exactly as a normal interrupt handler, after the "windup" which sets registers back as they were at interrupt entry. CFAR does not get restored by the windup

[PATCH v2 06/44] powerpc/64s/exception: machine check remove machine_check_pSeries_0 branch

2019-08-02 Thread Nicholas Piggin
This label has only one caller, so unwind the branch and move it inline. The location of the comment is adjusted to match similar one in system reset. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 23 ++- 1 file changed, 10 insertions(+), 13 deleti

[PATCH v2 05/44] powerpc/64s/exception: machine check pseries should always run the early handler

2019-08-02 Thread Nicholas Piggin
Now that pseries with fwnmi registered runs the early machine check handler, there is no good reason to special case the non-fwnmi case and skip the early handler. Reducing the code and number of paths is a top priority for asm code, it's better to handle this in C where possible (and the pseries e

[PATCH v2 04/44] powerpc/64s/exception: machine check adjust RFI target

2019-08-02 Thread Nicholas Piggin
The host kernel delivery case for powernv does RFI_TO_USER_OR_KERNEL, but should just use RFI_TO_KERNEL which makes it clear this is not a user case. This is not a bug because RFI_TO_USER_OR_KERNEL deals with kernel returns just fine. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/excep

[PATCH v2 03/44] powerpc/64s/exception: machine check fix KVM guest test

2019-08-02 Thread Nicholas Piggin
The machine_check_handle_early hypervisor guest test is skipped if !HVMODE or MSR[HV]=0, which is wrong for PR or nested hypervisors that could be running a guest in this state. Test HSTATE_IN_GUEST up front and use that to branch out to the KVM handler, then MSR[PR] alone can test for this kernel

[PATCH v2 02/44] powerpc/64s/exception: machine check remove bitrotted comment

2019-08-02 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 4 1 file changed, 4 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index f30eb1df7443..6d8d21fa935f 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch

[PATCH v2 01/44] powerpc/64s/exception: machine check fwnmi remove HV case

2019-08-02 Thread Nicholas Piggin
fwnmi does not trigger in HV mode, so remove always-true feature test. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index

[PATCH v2 00/44] powerpc/64s/exception: cleanup and macrofiy,

2019-08-02 Thread Nicholas Piggin
This series is the combined outstanding series posted previously, plus a change to a new way to define parameters for interrupt code generation macros (which is a bit clunky but works better than alternatives). This is mostly the end result. There is still a few minor things that could be done, an

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-02 Thread Will Deacon
On Fri, Aug 02, 2019 at 10:14:41AM +0200, Christoph Hellwig wrote: > On Thu, Aug 01, 2019 at 05:44:12PM +0100, Will Deacon wrote: > > > > Although arch_dma_mmap_pgprot() is a bit of a misnomer now that it only > > > > gets involved in the non-coherent case. > > > > > > A better name is welcome. >

Re: [PATCH v3 00/10] implement KASLR for powerpc/fsl_booke/32

2019-08-02 Thread Diana Madalina Craciun
Except for one comment in patch 06/10: Reviewed-by: Diana Craciun And also: Tested-by: Diana Craciun Regards, Diana On 7/31/2019 12:26 PM, Jason Yan wrote: > This series implements KASLR for powerpc/fsl_booke/32, as a security > feature that deters exploit attempts relying on knowledge of the l

Re: [PATCH v3 06/10] powerpc/fsl_booke/32: implement KASLR infrastructure

2019-08-02 Thread Diana Madalina Craciun
On 7/31/2019 12:27 PM, Jason Yan wrote: > This patch add support to boot kernel from places other than KERNELBASE. > Since CONFIG_RELOCATABLE has already supported, what we need to do is > map or copy kernel to a proper place and relocate. Freescale Book-E > parts expect lowmem to be mapped by fixe

Re: [PATCH 5/5] dma-mapping: remove ARCH_NO_COHERENT_DMA_MMAP

2019-08-02 Thread Takashi Iwai
On Fri, 02 Aug 2019 09:03:54 +0200, Christoph Hellwig wrote: > > Takashi, > > any comments on the sounds/ side of this? I wasn't careful enough to look at that change, sorry. The code there tries to check whether dma_mmap_coherent() would always fail on some platforms. Then the driver clears t

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-02 Thread Christoph Hellwig
On Thu, Aug 01, 2019 at 05:44:12PM +0100, Will Deacon wrote: > > > Although arch_dma_mmap_pgprot() is a bit of a misnomer now that it only > > > gets involved in the non-coherent case. > > > > A better name is welcome. > > How about arch_dma_noncoherent_mmap_pgprot() ? Too long? Sounds a little

Re: [PATCH 1/1] pseries/hotplug-memory.c: Change rc variable to bool

2019-08-02 Thread David Hildenbrand
On 02.08.19 09:18, David Hildenbrand wrote: > On 02.08.19 01:10, Leonardo Bras wrote: >> Changes the return variable to bool (as the return value) and >> avoids doing a ternary operation before returning. >> >> Also, since rc will always be true, there is no need to do >> rc &= bool, as (true && X)

Re: [PATCH 1/1] pseries/hotplug-memory.c: Replace nested ifs by switch-case

2019-08-02 Thread David Hildenbrand
On 02.08.19 00:52, Leonardo Bras wrote: > I noticed these nested ifs can be easily replaced by switch-cases, > which can improve readability. > > Signed-off-by: Leonardo Bras > --- > .../platforms/pseries/hotplug-memory.c| 26 +-- > 1 file changed, 18 insertions(+), 8 del

Re: [PATCH 1/1] pseries/hotplug-memory.c: Change rc variable to bool

2019-08-02 Thread David Hildenbrand
On 02.08.19 01:10, Leonardo Bras wrote: > Changes the return variable to bool (as the return value) and > avoids doing a ternary operation before returning. > > Also, since rc will always be true, there is no need to do > rc &= bool, as (true && X) will result in X. > > Signed-off-by: Leonardo Br

Re: [PATCH 5/5] dma-mapping: remove ARCH_NO_COHERENT_DMA_MMAP

2019-08-02 Thread Christoph Hellwig
Takashi, any comments on the sounds/ side of this? On Thu, Jul 25, 2019 at 08:34:01AM +0200, Christoph Hellwig wrote: > Now that we never use a default ->mmap implementation, and non-coherent > architectures can control the presence of ->mmap support by enabling > ARCH_HAS_DMA_COHERENT_TO_PFN for