[PATCH v2] powerpc: Avoid code patching freed init sections

2018-09-11 Thread Michael Neuling
This stops us from doing code patching in init sections after they've been freed. In this chain: kvm_guest_init() -> kvm_use_magic_page() -> fault_in_pages_readable() -> __get_user() -> __get_user_nocheck() -> barrier_nospec(); We have a code patching

[PATCH 00/14] EEH refactoring 3

2018-09-11 Thread Sam Bobroff
Hello everyone, Here is another set of minor fixes and cleanups for the EEH code. There should be no significant changes in behaviour. I'm not sure if all of these are worth doing, and I don't want to add unnecessary churn so please comment if you have an opinion or better approach. The set is

[PATCH 13/14] powerpc/eeh: Cleanup eeh_ops.wait_state()

2018-09-11 Thread Sam Bobroff
The wait_state member of eeh_ops does not need to be platform dependent; it's just logic around eeh_ops.get_state(). Therefore, merge the two (slightly different!) platform versions into a new function, eeh_wait_state() and remove the eeh_ops member. While doing this, also correct: * The wait

[PATCH 04/14] powerpc/eeh: Cleanup EEH_POSTPONED_PROBE

2018-09-11 Thread Sam Bobroff
Currently a flag, EEH_POSTPONED_PROBE, is used to prevent an incorrect message "EEH: No capable adapters found" from being displayed during the boot of powernv systems. It is necessary because, on powernv, the call to eeh_probe_devices() made from eeh_init() is too early and EEH can't yet be

[PATCH 14/14] powerpc/eeh: Cleanup control flow in eeh_handle_normal_event()

2018-09-11 Thread Sam Bobroff
Rather than mixing "if (state)" blocks and gotos, convert entirely to "if (state)" blocks to make the state machine behaviour clearer. Signed-off-by: Sam Bobroff --- arch/powerpc/kernel/eeh_driver.c | 196 +++ 1 file changed, 94 insertions(+), 102 deletions(-) diff

[PATCH 08/14] powerpc/eeh: Cleanup field names in eeh_rmv_data

2018-09-11 Thread Sam Bobroff
Change the name of the fields in eeh_rmv_data to clarify their usage. Change "edev_list" to "removed_vf_list" because it does not contain generic edevs, but rather only edevs that contain virtual functions (which need to be removed during recovery). Similarly, change "removed" to

[PATCH 06/14] powerpc/eeh: Cleanup eeh_add_virt_device()

2018-09-11 Thread Sam Bobroff
Remove the unnecessary cast through void * on the first parameter and remove the unused second parameter (always NULL). Signed-off-by: Sam Bobroff --- arch/powerpc/kernel/eeh_driver.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/eeh_driver.c

[PATCH 03/14] powerpc/eeh: Fix use of EEH_PE_KEEP on wrong field

2018-09-11 Thread Sam Bobroff
eeh_add_to_parent_pe() sometimes removes the EEH_PE_KEEP flag, but it incorrectly removes it from pe->type, instead of pe->state. However, rather than clearing it from the correct field, remove it. Inspection of the code shows that it can't ever have had any effect (even if it had been cleared

[PATCH 11/14] powerpc/eeh: Cleanup unnecessary eeh_pe_state_mark_with_cfg()

2018-09-11 Thread Sam Bobroff
The function eeh_pe_state_mark_with_cfg() just performs the work of eeh_pe_state_mark() and then, conditionally, the work of eeh_pe_state_clear(). However it is only ever called with a constant state such that the condition is always true, so replace it by direct calls. Signed-off-by: Sam Bobroff

[PATCH 10/14] powerpc/eeh: Cleanup eeh_enabled()

2018-09-11 Thread Sam Bobroff
Signed-off-by: Sam Bobroff --- arch/powerpc/include/asm/eeh.h | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index b48b08ed9be3..247f09ce44de 100644 --- a/arch/powerpc/include/asm/eeh.h +++

[PATCH 12/14] powerpc/eeh: Cleanup eeh_pe_state_mark()

2018-09-11 Thread Sam Bobroff
Currently, eeh_pe_state_mark() marks a PE (and it's children) with a state and then performs additional processing if that state included EEH_PE_ISOLATED. The state parameter is always a constant at the call site, so rearrange eeh_pe_state_mark() into two functions and just call the appropriate

[PATCH 05/14] powerpc/eeh: Cleanup unused field in eeh_dev

2018-09-11 Thread Sam Bobroff
The 'bus' member of struct eeh_dev is assigned to once but never used, so remove it. Signed-off-by: Sam Bobroff --- arch/powerpc/include/asm/eeh.h | 1 - arch/powerpc/kernel/eeh_driver.c | 1 - 2 files changed, 2 deletions(-) diff --git a/arch/powerpc/include/asm/eeh.h

[PATCH 07/14] powerpc/eeh: Cleanup list_head field names

2018-09-11 Thread Sam Bobroff
Instances of struct eeh_pe are placed in a tree structure using the fields "child_list" and "child", so place these next to each other in the definition. The field "child" is a list entry, so remove the unnecessary and misleading use of the list initializer, LIST_HEAD(), on it. The eeh_dev

[PATCH 09/14] powerpc/eeh: Cleanup logic in eeh_rmv_from_parent_pe()

2018-09-11 Thread Sam Bobroff
Move the call to eeh_dev_to_pe() up, so that later it's clear that "pe" isn't NULL. Signed-off-by: Sam Bobroff --- arch/powerpc/kernel/eeh_pe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c index

[PATCH 01/14] powerpc/eeh: Fix possible null deref in eeh_dump_dev_log()

2018-09-11 Thread Sam Bobroff
If an error occurs during an unplug operation, it's possible for eeh_dump_dev_log() to be called when edev->pdn is null, which currently leads to dereferencing a null pointer. Handle this by skipping the error log for those devices. Signed-off-by: Sam Bobroff --- arch/powerpc/kernel/eeh.c | 5

[PATCH 02/14] powerpc/eeh: Fix null deref for devices removed during EEH

2018-09-11 Thread Sam Bobroff
If a device is removed during EEH processing (either by a driver's handler or as part of recovery), it can lead to a null dereference in eeh_pe_report_edev(). To handle this, skip devices that have been removed. Signed-off-by: Sam Bobroff --- arch/powerpc/kernel/eeh_driver.c | 4 1 file

Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules

2018-09-11 Thread Masahiro Yamada
2018-09-12 0:40 GMT+09:00 Rob Herring : > On Mon, Sep 10, 2018 at 10:04 AM Rob Herring wrote: >> >> There is nothing arch specific about building dtb files other than their >> location under /arch/*/boot/dts/. Keeping each arch aligned is a pain. >> The dependencies and supported targets are all

[PATCH 7/7] macintosh/via-macii, macintosh/adb-iop: Clean up whitespace

2018-09-11 Thread Finn Thain
Signed-off-by: Finn Thain --- drivers/macintosh/adb-iop.c | 48 --- drivers/macintosh/via-macii.c | 286 +- 2 files changed, 174 insertions(+), 160 deletions(-) diff --git a/drivers/macintosh/adb-iop.c b/drivers/macintosh/adb-iop.c index

[PATCH 5/7] macintosh/via-macii: Simplify locking

2018-09-11 Thread Finn Thain
Modifying the request queue or changing the current state requires mutual exclusion. Use local_irq_disable() consistently for this rather than disabling the ADB interrupt. This simplifies the locking scheme and brings via-macii into line with the other ADB drivers. Tested-by: Stan Johnson

[PATCH 6/7] macintosh/via-macii, macintosh/adb-iop: Modernize printk calls

2018-09-11 Thread Finn Thain
Add missing severity level to log messages. Signed-off-by: Finn Thain --- drivers/macintosh/adb-iop.c | 2 +- drivers/macintosh/via-macii.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/macintosh/adb-iop.c b/drivers/macintosh/adb-iop.c index

[PATCH 1/7] macintosh: Use common code to access RTC

2018-09-11 Thread Finn Thain
Now that the 68k Mac port has adopted the via-pmu driver, the same RTC code can be shared between m68k and powerpc. Replace duplicated code in arch/powerpc and arch/m68k with common RTC accessors for Cuda and PMU. Drop the problematic WARN_ON which was introduced in commit 22db552b50fa

[PATCH 4/7] macintosh/via-macii: Remove BUG_ON assertions

2018-09-11 Thread Finn Thain
The BUG_ON assertions I added to the via-macii driver over a decade ago haven't fired AFAIK. Some can never fire (by inspection). One assertion checks for a NULL pointer, but that would merely substitute a BUG crash for an Oops crash. Remove the pointless BUG_ON assertions and replace the others

[PATCH 2/7] macintosh/adb: Rework printk output again

2018-09-11 Thread Finn Thain
Avoid the KERN_CONT problem by avoiding message fragments. The problem arises during async ADB bus probing, when ADB messages may get mixed up with other messages. See also, commit 4bcc595ccd80 ("printk: reinstate KERN_CONT for printing continuation lines"). Remove a number of printk()

[PATCH 0/7] Miscellaneous Macintosh fixes and clean up

2018-09-11 Thread Finn Thain
This series has some minor fixes and cleanups under drivers/macintosh, including a patch to rework recent printk changes in adb-hid.c. There's also a re-based RTC code de-duplication patch. Finn Thain (7): macintosh: Use common code to access RTC macintosh/adb: Rework printk output again

[PATCH 3/7] macintosh/via-macii: Synchronous bus reset

2018-09-11 Thread Finn Thain
Make the reset operation synchronous, like the other ADB drivers. The reset request is static data but callers may not know that. This way the struct is not in use when the reset method returns. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/macintosh/via-macii.c | 3 ++- 1 file

Re: v4.17 regression: PowerMac G3 won't boot, was Re: [PATCH v5 1/3] of: cache phandle nodes to reduce cost of of_find_node_by_phandle()

2018-09-11 Thread Finn Thain
[The Cc list got pruned so I'm forwarding Stan's reply for the benefit of the list archives and any other interested parties.] On Mon, 10 Sep 2018, Stan Johnson wrote: > On 9/10/18 6:53 AM, Rob Herring wrote: > > > ... > > Can you try this patch (w/o Ben's patch). I think the problem is if >

Re: [PATCH 2/3] Documentation: dt: binding: fsl: update property description for RCPM

2018-09-11 Thread Li Yang
On Mon, Sep 10, 2018 at 3:46 AM Ran Wang wrote: > > Hi Scott, > > On 2018/9/8 4:23, Scott Wood wrote: > > > > On Fri, 2018-08-31 at 11:52 +0800, Ran Wang wrote: > > > +Optional properties: > > > + - big-endian : Indicate RCPM registers is big-endian. A RCPM node > > > + that doesn't have this

Re: [PATCH] of: fix phandle cache creation for DTs with no phandles

2018-09-11 Thread Frank Rowand
On 09/11/18 07:56, Rob Herring wrote: > With commit 0b3ce78e90fc ("of: cache phandle nodes to reduce cost of > of_find_node_by_phandle()"), a G3 PowerMac fails to boot. The root cause > is the DT for this system has no phandle properties when booted with > BootX. of_populate_phandle_cache() does

Re: v4.17 regression: PowerMac G3 won't boot, was Re: [PATCH v5 1/3] of: cache phandle nodes to reduce cost of of_find_node_by_phandle()

2018-09-11 Thread Frank Rowand
On 09/10/18 05:53, Rob Herring wrote: > On Sun, Sep 09, 2018 at 07:04:25PM +0200, Benjamin Herrenschmidt wrote: >> On Fri, 2018-08-31 at 14:58 +1000, Benjamin Herrenschmidt wrote: >>> A long shot, but something to consider, is that I failed to cover the cases of dynamic devicetree

Re: [PATCH v3 6/9] kbuild: consolidate Devicetree dtb build rules

2018-09-11 Thread Rob Herring
On Mon, Sep 10, 2018 at 10:04 AM Rob Herring wrote: > > There is nothing arch specific about building dtb files other than their > location under /arch/*/boot/dts/. Keeping each arch aligned is a pain. > The dependencies and supported targets are all slightly different. > Also, a cross-compiler

[PATCH] of: fix phandle cache creation for DTs with no phandles

2018-09-11 Thread Rob Herring
With commit 0b3ce78e90fc ("of: cache phandle nodes to reduce cost of of_find_node_by_phandle()"), a G3 PowerMac fails to boot. The root cause is the DT for this system has no phandle properties when booted with BootX. of_populate_phandle_cache() does not handle the case of no phandles correctly.

[PATCH v10 5/5] powernv/pseries: consolidate code for mce early handling.

2018-09-11 Thread Mahesh J Salgaonkar
From: Mahesh Salgaonkar Now that other platforms also implements real mode mce handler, lets consolidate the code by sharing existing powernv machine check early code. Rename machine_check_powernv_early to machine_check_common_early and reuse the code. Signed-off-by: Mahesh Salgaonkar ---

[PATCH v10 4/5] powerpc/pseries: Dump the SLB contents on SLB MCE errors.

2018-09-11 Thread Mahesh J Salgaonkar
From: Mahesh Salgaonkar If we get a machine check exceptions due to SLB errors then dump the current SLB contents which will be very much helpful in debugging the root cause of SLB errors. Introduce an exclusive buffer per cpu to hold faulty SLB entries. In real mode mce handler saves the old

[PATCH v10 3/5] powerpc/pseries: Display machine check error details.

2018-09-11 Thread Mahesh J Salgaonkar
From: Mahesh Salgaonkar Extract the MCE error details from RTAS extended log and display it to console. With this patch you should now see mce logs like below: [ 142.371818] Severe Machine check interrupt [Recovered] [ 142.371822] NIP [dca301b8]: init_module+0x1b8/0x338

[PATCH v10 2/5] powerpc/pseries: flush SLB contents on SLB MCE errors.

2018-09-11 Thread Mahesh J Salgaonkar
From: Mahesh Salgaonkar On pseries, as of today system crashes if we get a machine check exceptions due to SLB errors. These are soft errors and can be fixed by flushing the SLBs so the kernel can continue to function instead of system crash. We do this in real mode before turning on MMU.

[PATCH v10 1/5] powerpc/pseries: Define MCE error event section.

2018-09-11 Thread Mahesh J Salgaonkar
From: Mahesh Salgaonkar On pseries, the machine check error details are part of RTAS extended event log passed under Machine check exception section. This patch adds the definition of rtas MCE event section and related helper functions. Signed-off-by: Mahesh Salgaonkar --- ---

[PATCH v10 0/5] powerpc/pseries: Machine check handler improvements.

2018-09-11 Thread Mahesh J Salgaonkar
This patch series includes some improvement to Machine check handler for pSeries. This patch series drops the sysctl knob patch that was proposed in v7. The SLB recovery code now uses flush_and_reload_slb() from mce_power.c. Patch 1 defines MCE error event section. Patch 2 implements a real mode

[PATCH v3 6/6] powerpc/pci: Reduce code duplication in pci_add_device_node_info

2018-09-11 Thread Sergey Miroshnichenko
It is possible now to allocate and fill a new pdn with add_one_dev_pci_data Signed-off-by: Sergey Miroshnichenko --- arch/powerpc/kernel/pci_dn.c | 38 +++- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/kernel/pci_dn.c

[PATCH v3 5/6] PCI/powerpc/eeh: Add pcibios hooks for preparing to rescan

2018-09-11 Thread Sergey Miroshnichenko
Reading an empty slot returns all ones, which triggers a false EEH error event on PowerNV. New callbacks pcibios_rescan_prepare/done are introduced to pause/resume the EEH during rescan. In the same time it makes possible to miss a real EEH event during rescan. Signed-off-by: Sergey

[PATCH v3 4/6] powerpc/powernv/pci: Enable reassigning the bus numbers

2018-09-11 Thread Sergey Miroshnichenko
PowerNV doesn't depend on PCIe topology info from DT anymore, and now it is able to enumerate the fabric and assign the bus numbers. This is enabled by the pci=realloc command line switch. Signed-off-by: Sergey Miroshnichenko --- arch/powerpc/kernel/pci_dn.c | 12 1 file changed,

[PATCH v3 2/6] powerpc/pci: Create pci_dn on demand

2018-09-11 Thread Sergey Miroshnichenko
The pci_dn structures can be created not only from DT, but also directly from newly discovered PCIe devices, so allocate them dynamically. Signed-off-by: Sergey Miroshnichenko --- arch/powerpc/kernel/pci_dn.c | 63 ++-- 1 file changed, 60 insertions(+), 3

[PATCH v3 3/6] powerpc/pci: Use DT to create pci_dn for root bridges only

2018-09-11 Thread Sergey Miroshnichenko
Endpoint's pci_dn can be created dynamically. Signed-off-by: Sergey Miroshnichenko --- arch/powerpc/kernel/pci_dn.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c index e2b39b562b53..8bcf10fb13ad 100644 ---

[PATCH v3 1/6] powerpc/pci: Access PCI config space directly w/o pci_dn

2018-09-11 Thread Sergey Miroshnichenko
The pci_dn structures are retrieved from a DT, but hot-plugged PCIe devices don't have them. Don't stop PCIe I/O in absence of pci_dn, so it is now possible to discover new devices. Signed-off-by: Sergey Miroshnichenko --- arch/powerpc/kernel/rtas_pci.c | 97 +++-

[PATCH v3 0/6] powerpc/powernv/pci: Discover surprise-hotplugged PCIe devices during rescan

2018-09-11 Thread Sergey Miroshnichenko
This patchset allows hotplugged PCIe devices to be enumerated during a bus rescan being issued via sysfs on PowerNV platforms, when the "Presence Detect Changed" interrupt is not available. As a first part of our work on adding support for hotplugging PCIe bridges full of devices (without special

Re: [PATCH 1/2] powerpc/boot: Fix crt0.S syntax for clang

2018-09-11 Thread Segher Boessenkool
On Mon, Sep 10, 2018 at 06:57:13PM +1000, Joel Stanley wrote: > Clang's assembler does not like the syntax of the cmpdi: > > arch/powerpc/boot/crt0.S:168:22: error: unexpected modifier on variable > reference > cmpdi 12,RELACOUNT@l > ^ >

[PATCH v2] KVM: PPC: Book3S HV: Don't use compound_order to determine host mapping size

2018-09-11 Thread Nicholas Piggin
THP paths can defer splitting compound pages until after the actual remap and TLB flushes to split a huge PMD/PUD. This causes radix partition scope page table mappings to get out of synch with the host qemu page table mappings. This results in random memory corruption in the guest when running

Re: [PATCH] KVM: PPC: Book3S HV: Don't use compound_order to determine host mapping size

2018-09-11 Thread Nicholas Piggin
On Tue, 11 Sep 2018 20:01:54 +1000 Paul Mackerras wrote: > On Tue, Sep 04, 2018 at 06:16:01PM +1000, Nicholas Piggin wrote: > > THP paths can defer splitting compound pages until after the actual > > remap and TLB flushes to split a huge PMD/PUD. This causes radix > > partition scope page table

Patch "powerpc/platforms/85xx: fix t1042rdb_diu.c build errors & warning" has been added to the 4.18-stable tree

2018-09-11 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/platforms/85xx: fix t1042rdb_diu.c build errors & warning to the 4.18-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the

Patch "powerpc/platforms/85xx: fix t1042rdb_diu.c build errors & warning" has been added to the 4.14-stable tree

2018-09-11 Thread gregkh
This is a note to let you know that I've just added the patch titled powerpc/platforms/85xx: fix t1042rdb_diu.c build errors & warning to the 4.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the

Re: [PATCH] KVM: PPC: Book3S HV: Don't use compound_order to determine host mapping size

2018-09-11 Thread Paul Mackerras
On Tue, Sep 04, 2018 at 06:16:01PM +1000, Nicholas Piggin wrote: > THP paths can defer splitting compound pages until after the actual > remap and TLB flushes to split a huge PMD/PUD. This causes radix > partition scope page table mappings to get out of synch with the host > qemu page table