Pull request: scottwood/linux.git next
Contains fixes for CPM GPIO and an FSL PCI erratum workaround, plus a minor cleanup patch. The following changes since commit f2ac428e0edabbca41b9dfe9473a90147962e4e9: powerpc/pseries/cpuidle: add polling idle for shared processor guests (2018-01-18 15:43:44 +1100) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/scottwood/linux.git next for you to fetch changes up to c095ff93f901c1620b28dce4d813dd548bc5236b: powerpc/sysdev: change CPM GPIO to platform_device (2018-01-20 23:29:02 -0600) Christophe Leroy (1): powerpc/sysdev: change CPM GPIO to platform_device Joakim Tjernlund (1): powerpc/fsl_pci: Correct fsl_pci_mcheck_exception Vasyl Gomonovych (1): powerpc/fsl_pci: Fix ptr_ret.cocci warnings arch/powerpc/include/asm/cpm.h | 2 +- arch/powerpc/include/asm/cpm1.h | 2 + arch/powerpc/sysdev/Makefile | 3 +- arch/powerpc/sysdev/cpm1.c | 33 - arch/powerpc/sysdev/cpm2.c | 11 -- arch/powerpc/sysdev/cpm_common.c | 5 ++- arch/powerpc/sysdev/cpm_gpio.c | 80 arch/powerpc/sysdev/fsl_pci.c| 6 +-- 8 files changed, 99 insertions(+), 43 deletions(-) create mode 100644 arch/powerpc/sysdev/cpm_gpio.c
Re: [PATCH v10 01/27] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled
Ram Pai writes: > VM_PKEY_BITx are defined only if CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS > is enabled. Powerpc also needs these bits. Hence lets define the > VM_PKEY_BITx bits for any architecture that enables > CONFIG_ARCH_HAS_PKEYS. > Reviewed-by: Aneesh Kumar K.V > Signed-off-by: Ram Pai > --- > fs/proc/task_mmu.c |4 ++-- > include/linux/mm.h |9 + > 2 files changed, 7 insertions(+), 6 deletions(-) > > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c > index 339e4c1..b139617 100644 > --- a/fs/proc/task_mmu.c > +++ b/fs/proc/task_mmu.c > @@ -674,13 +674,13 @@ static void show_smap_vma_flags(struct seq_file *m, > struct vm_area_struct *vma) > [ilog2(VM_MERGEABLE)] = "mg", > [ilog2(VM_UFFD_MISSING)]= "um", > [ilog2(VM_UFFD_WP)] = "uw", > -#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS > +#ifdef CONFIG_ARCH_HAS_PKEYS > /* These come out via ProtectionKey: */ > [ilog2(VM_PKEY_BIT0)] = "", > [ilog2(VM_PKEY_BIT1)] = "", > [ilog2(VM_PKEY_BIT2)] = "", > [ilog2(VM_PKEY_BIT3)] = "", > -#endif > +#endif /* CONFIG_ARCH_HAS_PKEYS */ > }; > size_t i; > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index ea818ff..01381d3 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -228,15 +228,16 @@ extern int overcommit_kbytes_handler(struct ctl_table > *, int, void __user *, > #define VM_HIGH_ARCH_4 BIT(VM_HIGH_ARCH_BIT_4) > #endif /* CONFIG_ARCH_USES_HIGH_VMA_FLAGS */ > > -#if defined(CONFIG_X86) > -# define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at > once (x86) */ > -#if defined (CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS) > +#ifdef CONFIG_ARCH_HAS_PKEYS > # define VM_PKEY_SHIFT VM_HIGH_ARCH_BIT_0 > # define VM_PKEY_BIT0VM_HIGH_ARCH_0 /* A protection key is a 4-bit > value */ > # define VM_PKEY_BIT1VM_HIGH_ARCH_1 > # define VM_PKEY_BIT2VM_HIGH_ARCH_2 > # define VM_PKEY_BIT3VM_HIGH_ARCH_3 > -#endif > +#endif /* CONFIG_ARCH_HAS_PKEYS */ > + > +#if defined(CONFIG_X86) > +# define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at > once (x86) */ > #elif defined(CONFIG_PPC) > # define VM_SAO VM_ARCH_1 /* Strong Access Ordering > (powerpc) */ > #elif defined(CONFIG_PARISC) > -- > 1.7.1 > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majord...@kvack.org. For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: mailto:"d...@kvack.org";> em...@kvack.org
[RFC PATCH v2 0/1] of: easier debugging for node life cycle issues
I got a bug report for a DT node refcounting problem in the I2C subsystem. This patch was a huge help in validating the bug report and the proposed solution. So, I thought I bring it to attention again. Thanks Tyrel, for the initial work! Note that I did not test the dynamic updates, only of_node_{get|put} so far. I read that Tyrel checked dynamic updates extensively with this patch. And since DT overlays are also used within our Renesas dev team, this will help there, as well. Tested on a Renesas Salvator-XS board (R-Car H3). Changes since RFC v1: * rebased to v4.15-rc8 * fixed commit abbrev and one of the sysfs paths in commit desc * removed trailing space and fixed pointer declaration in code I consider all the remaining checkpatch issues irrelevant for this patch. So what about applying it? Kind regards, Wolfram Tyrel Datwyler (1): of: introduce event tracepoints for dynamic device_node lifecyle drivers/of/dynamic.c | 32 ++-- include/trace/events/of.h | 93 +++ 2 files changed, 105 insertions(+), 20 deletions(-) create mode 100644 include/trace/events/of.h -- 2.11.0
[RFC PATCH v2 1/1] of: introduce event tracepoints for dynamic device_node lifecyle
From: Tyrel Datwyler This patch introduces event tracepoints for tracking a device_nodes reference cycle as well as reconfig notifications generated in response to node/property manipulations. With the recent upstreaming of the refcount API several device_node underflows and leaks have come to my attention in the pseries (DLPAR) dynamic logical partitioning code (ie. POWER speak for hotplugging virtual and physcial resources at runtime such as cpus or IOAs). These tracepoints provide a easy and quick mechanism for validating the reference counting of device_nodes during their lifetime. Further, when pseries lpars are migrated to a different machine we perform a live update of our device tree to bring it into alignment with the configuration of the new machine. The of_reconfig_notify trace point provides a mechanism that can be turned for debuging the device tree modifications with out having to build a custom kernel to get at the DEBUG code introduced by commit 00aa37206e1a54 ("of/reconfig: Add debug output for OF_RECONFIG notifiers"). The following trace events are provided: of_node_get, of_node_put, of_node_release, and of_reconfig_notify. These trace points require a kernel built with ftrace support to be enabled. In a typical environment where debugfs is mounted at /sys/kernel/debug the entire set of tracepoints can be set with the following: echo "of:*" > /sys/kernel/debug/tracing/set_event or echo 1 > /sys/kernel/debug/tracing/events/of/enable The following shows the trace point data from a DLPAR remove of a cpu from a pseries lpar: cat /sys/kernel/debug/tracing/trace | grep "POWER8@10" cpuhp/23-147 [023] 128.324827: of_node_put: refcount=5, dn->full_name=/cpus/PowerPC,POWER8@10 cpuhp/23-147 [023] 128.324829: of_node_put: refcount=4, dn->full_name=/cpus/PowerPC,POWER8@10 cpuhp/23-147 [023] 128.324829: of_node_put: refcount=3, dn->full_name=/cpus/PowerPC,POWER8@10 cpuhp/23-147 [023] 128.324831: of_node_put: refcount=2, dn->full_name=/cpus/PowerPC,POWER8@10 drmgr-7284 [009] 128.439000: of_node_put: refcount=1, dn->full_name=/cpus/PowerPC,POWER8@10 drmgr-7284 [009] 128.439002: of_reconfig_notify: action=DETACH_NODE, dn->full_name=/cpus/PowerPC,POWER8@10, prop->name=null, old_prop->name=null drmgr-7284 [009] 128.439015: of_node_put: refcount=0, dn->full_name=/cpus/PowerPC,POWER8@10 drmgr-7284 [009] 128.439016: of_node_release: dn->full_name=/cpus/PowerPC,POWER8@10, dn->_flags=4 Signed-off-by: Tyrel Datwyler [wsa: fixed commit abbrev and one of the sysfs paths in commit desc, removed trailing space and fixed pointer declaration in code] Signed-off-by: Wolfram Sang --- drivers/of/dynamic.c | 32 ++-- include/trace/events/of.h | 93 +++ 2 files changed, 105 insertions(+), 20 deletions(-) create mode 100644 include/trace/events/of.h diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index ab988d88704da0..b0d6ab5a35b8c6 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -21,6 +21,9 @@ static struct device_node *kobj_to_device_node(struct kobject *kobj) return container_of(kobj, struct device_node, kobj); } +#define CREATE_TRACE_POINTS +#include + /** * of_node_get() - Increment refcount of a node * @node: Node to inc refcount, NULL is supported to simplify writing of @@ -30,8 +33,10 @@ static struct device_node *kobj_to_device_node(struct kobject *kobj) */ struct device_node *of_node_get(struct device_node *node) { - if (node) + if (node) { kobject_get(&node->kobj); + trace_of_node_get(refcount_read(&node->kobj.kref.refcount), node->full_name); + } return node; } EXPORT_SYMBOL(of_node_get); @@ -43,8 +48,10 @@ EXPORT_SYMBOL(of_node_get); */ void of_node_put(struct device_node *node) { - if (node) + if (node) { + trace_of_node_put(refcount_read(&node->kobj.kref.refcount) - 1, node->full_name); kobject_put(&node->kobj); + } } EXPORT_SYMBOL(of_node_put); @@ -75,24 +82,7 @@ const char *action_names[] = { int of_reconfig_notify(unsigned long action, struct of_reconfig_data *p) { int rc; -#ifdef DEBUG - struct of_reconfig_data *pr = p; - - switch (action) { - case OF_RECONFIG_ATTACH_NODE: - case OF_RECONFIG_DETACH_NODE: - pr_debug("notify %-15s %pOF\n", action_names[action], - pr->dn); - break; - case OF_RECONFIG_ADD_PROPERTY: - case OF_RECONFIG_REMOVE_PROPERTY: - case OF_RECONFIG_UPDATE_PROPERTY: - pr_debug("notify %-15s %pOF:%s\n", action_names[action], - pr->dn, pr->prop->name); - break; - - } -#endif + trace_of_reconfig_notify(action, p);
Re: [RFC PATCH v2 1/1] of: introduce event tracepoints for dynamic device_node lifecyle
On Sun, 21 Jan 2018 15:31:17 +0100 Wolfram Sang wrote: > From: Tyrel Datwyler > > This patch introduces event tracepoints for tracking a device_nodes > reference cycle as well as reconfig notifications generated in response > to node/property manipulations. > > With the recent upstreaming of the refcount API several device_node > underflows and leaks have come to my attention in the pseries (DLPAR) > dynamic logical partitioning code (ie. POWER speak for hotplugging > virtual and physcial resources at runtime such as cpus or IOAs). These > tracepoints provide a easy and quick mechanism for validating the > reference counting of device_nodes during their lifetime. > > Further, when pseries lpars are migrated to a different machine we > perform a live update of our device tree to bring it into alignment with > the configuration of the new machine. The of_reconfig_notify trace point > provides a mechanism that can be turned for debuging the device tree > modifications with out having to build a custom kernel to get at the > DEBUG code introduced by commit 00aa37206e1a54 ("of/reconfig: Add debug > output for OF_RECONFIG notifiers"). > > The following trace events are provided: of_node_get, of_node_put, > of_node_release, and of_reconfig_notify. These trace points require a > kernel built with ftrace support to be enabled. In a typical environment > where debugfs is mounted at /sys/kernel/debug the entire set of > tracepoints can be set with the following: > > echo "of:*" > /sys/kernel/debug/tracing/set_event > > or > > echo 1 > /sys/kernel/debug/tracing/events/of/enable > > The following shows the trace point data from a DLPAR remove of a cpu > from a pseries lpar: > > cat /sys/kernel/debug/tracing/trace | grep "POWER8@10" > > cpuhp/23-147 [023] 128.324827: > of_node_put: refcount=5, dn->full_name=/cpus/PowerPC,POWER8@10 > cpuhp/23-147 [023] 128.324829: > of_node_put: refcount=4, dn->full_name=/cpus/PowerPC,POWER8@10 > cpuhp/23-147 [023] 128.324829: > of_node_put: refcount=3, dn->full_name=/cpus/PowerPC,POWER8@10 > cpuhp/23-147 [023] 128.324831: > of_node_put: refcount=2, dn->full_name=/cpus/PowerPC,POWER8@10 >drmgr-7284 [009] 128.439000: > of_node_put: refcount=1, dn->full_name=/cpus/PowerPC,POWER8@10 >drmgr-7284 [009] 128.439002: > of_reconfig_notify: action=DETACH_NODE, > dn->full_name=/cpus/PowerPC,POWER8@10, > prop->name=null, old_prop->name=null >drmgr-7284 [009] 128.439015: > of_node_put: refcount=0, dn->full_name=/cpus/PowerPC,POWER8@10 >drmgr-7284 [009] 128.439016: > of_node_release: dn->full_name=/cpus/PowerPC,POWER8@10, dn->_flags=4 > > Signed-off-by: Tyrel Datwyler > [wsa: fixed commit abbrev and one of the sysfs paths in commit desc, > removed trailing space and fixed pointer declaration in code] > Signed-off-by: Wolfram Sang From the tracing perspective: Reviewed-by: Steven Rostedt (VMware) -- Steve > ---
Re: powerpc: Use octal numbers for file permissions
On Thu, 2017-01-12 at 03:54:13 UTC, Russell Currey wrote: > Symbolic macros are unintuitive and hard to read, whereas octal constants > are much easier to interpret. Replace macros for the basic permission > flags (user/group/other read/write/execute) with numeric constants > instead, across the whole powerpc tree. > > Introducing a significant number of changes across the tree for no runtime > benefit isn't exactly desirable, but so long as these macros are still > used in the tree people will keep sending patches that add them. Not only > are they hard to parse at a glance, there are multiple ways of coming to > the same value (as you can see with 0444 and 0644 in this patch) which > hurts readability. > > Signed-off-by: Russell Currey > Reviewed-by: Cyril Bur Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/57ad583f2086d55ada284c54bfc440 cheers
Re: powerpc/pseries: Don't give a warning when HPT resizing isn't available
On Fri, 2017-03-17 at 01:11:19 UTC, David Gibson wrote: > As of 438cc81a41 "powerpc/pseries: Automatically resize HPT for memory hot > add/remove" when running on the pseries platform, we always attempt to > use the PAPR extension to resize the hashed page table (HPT) when we add > or remove memory. > > This is fine, but when the extension is available we'll give a harmless, > but scary warning. This patch suppresses the warning in this case. It > will still warn if the feature is supposed to be available, but didn't > work. > > Signed-off-by: David Gibson Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/7339390d772ddee0447886d72c3aeb cheers
Re: [v3, 3/6] dt: booting-without-of: DT fix s/#interrupt-cell/#interrupt-cells/
On Fri, 2017-06-02 at 12:38:46 UTC, Geert Uytterhoeven wrote: > Signed-off-by: Geert Uytterhoeven > Acked-by: Rob Herring Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/4be4119d1fbd93c44d5c639735c312 cheers
Re: powerpc: Expose TSCR via sysfs
On Thu, 2017-09-07 at 17:11:12 UTC, Anton Blanchard wrote: > From: Anton Blanchard > > The thread switch control register (TSCR) is a per core register > that configures how the CPU shares resources between SMT threads. > > Exposing it via sysfs allows us to tune it at run time. > > Signed-off-by: Anton Blanchard Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/b6d34eb4d280c893d0f442f4b9e039 cheers
Re: selftests/powerpc: Add alignment handler selftest
On Mon, 2017-10-16 at 05:04:02 UTC, Andrew Donnellan wrote: > Add a selftest to exercise the powerpc alignment fault handler. > > Signed-off-by: Michael Neuling > Signed-off-by: Andrew Donnellan Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/8d1915873d492b8e1f03bbcab527db cheers
Re: powerpc/perf: Change the data type for the variable 'ncpu' in IMC code
On Tue, 2017-10-31 at 09:52:00 UTC, Anju T Sudhakar wrote: > Change the data type for the variable 'ncpu' in ppc_core_imc_cpu_offline(), > since cpumask_any_but() returns an 'int' value. > > Signed-off-by: Anju T Sudhakar > Reported-by: David Binderman Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/074db39e00bb0d35cda7de9a4bae3a cheers
Re: powerpc/watchdog: improve watchdog comments
On Wed, 2017-11-01 at 00:27:33 UTC, Nicholas Piggin wrote: > The overview comments in the powerpc watchdog are out of date after > several iterations and changes of the code. Bring them up to date. > > Signed-off-by: Nicholas Piggin Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/723b113319baa8d8b5f619a94348fa cheers
Re: powerpc/mm: Remove unused flag arg in global_invalidates
On Mon, 2017-11-06 at 12:27:44 UTC, "Aneesh Kumar K.V" wrote: > Signed-off-by: Aneesh Kumar K.V Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/76b03dc07eebe9c8829bc4c40ae357 cheers
Re: [1/4] powerpc: define __ARCH_IRQ_EXIT_IRQS_DISABLED
On Thu, 2017-11-16 at 16:00:49 UTC, Nicholas Piggin wrote: > powerpc calls irq_exit() with local irqs disabled, therefore it > can define __ARCH_IRQ_EXIT_IRQS_DISABLED. > > Signed-off-by: Nicholas Piggin Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/c16bee4bded5449ec3b3ec73579ba2 cheers
Re: [3/4] cpuidle/powernv: avoid double irq enable coming out of idle
On Thu, 2017-11-16 at 16:00:51 UTC, Nicholas Piggin wrote: > Since e1689795a7 ("cpuidle: Add common time keeping and irq enabling"), > cpuidle drivers are expected to return from ->enter with irqs disabled. > > Update the cpuidle-powernv snooze loop to disable irqs before returning. > > Signed-off-by: Nicholas Piggin Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/f1343d044629f11e7d63ef1a07edb1 cheers
Re: [4/4] cpuidle/powernv: avoid double irq enable coming out of idle
On Thu, 2017-11-16 at 16:00:52 UTC, Nicholas Piggin wrote: > Since e1689795a7 ("cpuidle: Add common time keeping and irq enabling"), > cpuidle drivers are expected to return from ->enter with irqs disabled. > > Update the cpuidle-powernv snooze and cede loops to disable irqs before > returning. > > Signed-off-by: Nicholas Piggin Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/ced54c08d8e4060d59c10629ea5a4c cheers
Re: [v3] powerpc/powernv: Add ppc_pci_reset_phbs parameter to issue a PHB reset
On Fri, 2017-11-17 at 18:58:59 UTC, "Guilherme G. Piccoli" wrote: > During a kdump kernel boot in PowerPC, we request a reset of the PHBs > to the FW. It makes sense, since if we are booting a kdump kernel it > means we had some trouble before and we cannot rely in the adapters' > health; they could be in a bad state, hence the reset is needed. > > But this reset is useful not only in kdump - there are situations, > specially when debugging drivers, that we could break an adapter in > a way it requires such reset. One can tell to just go ahead and > reboot the machine, but happens that many times doing kexec is much > faster, and so preferable than a full power cycle. > > This patch adds the ppc_pci_reset_phbs parameter to perform such reset. > > Signed-off-by: Guilherme G. Piccoli Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/45baee1416a0086dccaa8a94c70e67 cheers
Re: [1/2] powerpc/lib/code-patching: refactor patch_instruction()
On Fri, 2017-11-24 at 07:31:07 UTC, Christophe Leroy wrote: > patch_instruction() uses almost the same sequence as > __patch_instruction() > > This patch refactor it so that patch_instruction() uses > __patch_instruction() instead of duplicating code. > > Signed-off-by: Christophe Leroy > Acked-by: Balbir Singh Series applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/8cf4c05712f04a405f0dacebcca8f0 cheers
Re: powerpc/hash: Skip non initialized page size in init_hpte_page_sizes
On Tue, 2017-11-28 at 08:34:40 UTC, "Aneesh Kumar K.V" wrote: > One of the easiest way to test config with 4K HPTE is to disable 64K hardware > page size like below. > > int __init htab_dt_scan_page_sizes(unsigned long node, > > size -= 3; prop += 3; > base_idx = get_idx_from_shift(base_shift); > - if (base_idx < 0) { > + if (base_idx < 0 || base_idx == MMU_PAGE_64K) { > /* skip the pte encoding also */ > prop += lpnum * 2; size -= lpnum * 2; > > But then this results in error in other part of the code such as MPSS parsing > where we look at 4K base page size and 64K actual page size support. > > This patch fix MPSS parsing by ignoring the actual page sizes marked > unsupported. In reality this can happen only with a corrupt device tree. But > it > is good to tighten the error check. > > Signed-off-by: Aneesh Kumar K.V Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/10527e808123f4b12db604993638b3 cheers
Re: selftest/powerpc: Add additional option to mmap_bench test
On Tue, 2017-11-28 at 08:36:39 UTC, "Aneesh Kumar K.V" wrote: > This patch adds --pgfault and --iterations options to mmap_bench test. With > --pgfault we touch every page mapped. This helps in measuring impact in the > page fault path with a patch series. > > Signed-off-by: Aneesh Kumar K.V Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/be68fb64f763b7b6ddb202e0a931f4 cheers
Re: powerpc/radix: Remove trace_tlbie call from radix__flush_tlb_all
On Thu, 2017-11-30 at 09:05:54 UTC, Mahesh J Salgaonkar wrote: > From: Mahesh Salgaonkar > > radix__flush_tlb_all() is called only in kexec path in real mode and any > tracepoints at this stage will make kexec to fail if enabled. > > To verify enable tlbie trace before kexec. > > $ echo 1 > /sys/kernel/debug/tracing/events/powerpc/tlbie/enable > == kexec into new kernel and kexec fails. > > Fix this by not calling trace_tlbie from radix__flush_tlb_all(). > > Fixes: 0428491cba92 ("powerpc/mm: Trace tlbie(l) instructions") > Signed-off-by: Mahesh Salgaonkar > Acked-by: Balbir Singh Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/8d81296cfcce89013a714feb8d2500 cheers
Re: [V6, 1/4] powerpc/firmware: Add definitions for new drc-info firmware feature
On Fri, 2017-12-01 at 23:19:40 UTC, Michael Bringmann wrote: > Firmware Features: Define new bit flag representing the presence of > new device tree property "ibm,drc-info". The flag is used to tell > the front end processor whether the Linux kernel supports the new > property, and by the front end processor to tell the Linux kernel > that the new property is present in the device tree. > > Signed-off-by: Michael Bringmann Series applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/3f38000eda485f466153d37c4f9201 cheers
Re: [V2] powerpc/mm: Invalidate subpage_prot() system call on radix platforms
On Mon, 2017-12-04 at 05:49:22 UTC, Anshuman Khandual wrote: > Radix enabled platforms don't support subpage_prot() system calls. But > at present the system call goes through without an error and fails > later on while validating expected subpage accesses. Lets not allow > the system call on powerpc radix platforms to begin with to prevent > this confusion in user space. > > Signed-off-by: Anshuman Khandual Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/5b2b80714796073ec9e196c7aeec59 cheers
Re: [1/3] powerpc/perf: Remove thread_imc_pmu global variable from
On Mon, 2017-12-11 at 05:58:35 UTC, Anju T Sudhakar wrote: > Remove the global variable 'thread_imc_pmu', since it is not used in the code. > > Signed-off-by: Anju T Sudhakar > Reviewed-by: madhavan Srinivasan Series applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/e7673818d9510043f11502e55afee5 cheers
Re: [v2] platform/powernv: Add debugfs interface for imc-mode and imc-command
On Wed, 2017-12-13 at 06:09:54 UTC, Anju T Sudhakar wrote: > In memory Collection (IMC) counter pmu driver controls the ucode's execution > state. At the system boot, IMC perf driver pause the ucode. Ucode state is > changed to "running" only when any of the nest units are monitored or profiled > using perf tool. ... > > Signed-off-by: Anju T Sudhakar Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/684d984038aa2b8ec3ab4b9d314257 cheers
Re: powerpc: dts: Remove leading 0x and 0s from bindings notation
On Thu, 2017-12-14 at 16:54:00 UTC, Mathieu Malaterre wrote: > Improve the DTS files by removing all the leading "0x" and zeros to fix the > following dtc warnings: > > Warning (unit_address_format): Node /XXX unit name should not have leading > "0x" > > and > > Warning (unit_address_format): Node /XXX unit name should not have leading 0s > > Converted using the following command: > > find . -type f \( -iname *.dts -o -iname *.dtsi \) -exec sed -E -i -e > "s/@0x([0-9a-fA-F\.]+)\s?\{/@\L\1 \{/g" -e "s/@0+([0-9a-fA-F\.]+)\s?\{/@\L\1 > \{/g" {} + > > For simplicity, two sed expressions were used to solve each warnings > separately. > > To make the regex expression more robust a few other issues were resolved, > namely setting unit-address to lower case, and adding a whitespace before the > the opening curly brace: > > https://elinux.org/Device_Tree_Linux#Linux_conventions > > This is a follow up to commit 4c9847b7375a ("dt-bindings: Remove leading 0x > from bindings notation") > > Reported-by: David Daney > Suggested-by: Rob Herring > Signed-off-by: Mathieu Malaterre Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/600ecc1936be075f611f299755e2de cheers
Re: powerpc/pseries/cpuidle: add polling idle for shared processor guests
On Tue, 2017-10-10 at 07:11:09 UTC, Nicholas Piggin wrote: > For shared processor guests (e.g., KVM), add an idle polling mode rather > than immediately returning to the hypervisor when the guest CPU goes > idle. > > Test setup is a 2 socket POWER9 with 4 guests running, each with vCPUs > equal to 1/2 of real of CPUs. Saturated each guest with tbench. Using > polling idle gives about 1.4x throughput. > > Kernel compile speed was not changed significantly. > > Signed-off-by: Nicholas Piggin Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/f2ac428e0edabbca41b9dfe9473a90 cheers
Re: [1/9] powerpc/powernv: Remove real mode access limit for early allocations
On Fri, 2017-12-22 at 11:17:08 UTC, Nicholas Piggin wrote: > This removes the RMA limit on powernv platform, which constrains > early allocations such as PACAs and stacks. There are still other > restrictions that must be followed, such as bolted SLB limits, but > real mode addressing has no constraints. > > Signed-off-by: Nicholas Piggin Patches 1-6 applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/1513c33d7174e87a079cfa2666cb9a cheers
Re: [v10, 02/17] powerpc/64: Add #defines for paca->soft_enabled flags
On Wed, 2017-12-20 at 03:55:42 UTC, Madhavan Srinivasan wrote: > Two #defines, IRQ_ENABLED and IRQ_DISABLED, are added to be used when > updating paca->soft_enabled. Replace the hardcoded values used when > updating paca->soft_enabled with IRQ_[EN/DIS]ABLED. No logic change. > > Signed-off-by: Madhavan Srinivasan Patchs 2-17 applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/c2e480ba822718190e58849b79a76d cheers
Re: [v3] powerpc/64s: Improve local TLB flush for boot and MCE on POWER9
On Sat, 2017-12-23 at 15:15:50 UTC, Nicholas Piggin wrote: > There are several cases outside the normal address space management > where a CPU's entire local TLB is to be flushed: > > 1. Booting the kernel, in case something has left stale entries in > the TLB (e.g., kexec). > > 2. Machine check, to clean corrupted TLB entries. ... > > The TLB flush is no longer called when restoring from deep idle states. > This was not be done as a separate step because booting secondaries > uses the same cpu_restore as idle restore, which needs the TLB flush. > > Signed-off-by: Nicholas Piggin Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/d4748276ae14ce951a3254852dddc3 cheers
Re: [1/2] powerpc: System reset avoid interleaving oops using die synchronisation
On Sat, 2017-12-23 at 16:49:22 UTC, Nicholas Piggin wrote: > The die() oops path contains a serializing lock to prevent oops > messages from being interleaved. In the case of a system reset > initiated oops (e.g., qemu nmi command), __die was being called > which lacks that synchronisation and oops reports could be > interleaved across CPUs. > > A recent patch 4388c9b3a6ee7 ("powerpc: Do not send system reset > request through the oops path") changed this to __die to avoid > the debugger() call, but there is no real harm to calling it twice > if the first time fell through. So go back to using die() here. > This was observed to fix the problem. > > Fixes: 4388c9b3a6ee7 ("powerpc: Do not send system reset request through the > oops path") > Signed-off-by: Nicholas Piggin > Reviewed-by: David Gibson Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/4552d128c26e0f0f27a5bd2fadc240 cheers
Re: powerpc/xive: Properly use static keyword for inline function
On Tue, 2017-12-26 at 13:00:17 UTC, Mathieu Malaterre wrote: > Fix fatal warning during compilation: > > In file included from arch/powerpc/xmon/xmon.c:54:0: > ./arch/powerpc/include/asm/xive.h:157:20: error: no previous prototype for > âxive_smp_prepare_cpuâ [-Werror=missing-prototypes] > extern inline int xive_smp_prepare_cpu(unsigned int cpu) { return -EINVAL; } > ^ > > Signed-off-by: Mathieu Malaterre > Reviewed-by: Cédric Le Goater Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/38833faa112c10dd6e3d888f8b53de cheers
Re: powerpc/xmon: Do not compute/store the major opcode
On Tue, 2017-12-26 at 13:25:47 UTC, Mathieu Malaterre wrote: > In commit 5b102782c7f4 ("powerpc/xmon: Enable disassembly files (compilation > changes)") usage of variable `op` has been removed. Completely remove opcode > computation since not used anymore. > > Fix fatal warning: > > arch/powerpc/xmon/ppc-dis.c: In function âlookup_powerpcâ: > arch/powerpc/xmon/ppc-dis.c:96:17: error: variable âopâ set but not used > [-Werror=unused-but-set-variable] >unsigned long op; > ^~ > > Signed-off-by: Mathieu Malaterre Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/104d55ae4df928c205268c1eb83b80 cheers
Re: [1/2] powerpc: Fix old-style function definition
On Tue, 2017-12-26 at 14:12:33 UTC, Mathieu Malaterre wrote: > Fix warnings such as: > > arch/powerpc/platforms/powermac/backlight.c: In function > âpmac_backlight_get_legacy_brightnessâ: > arch/powerpc/platforms/powermac/backlight.c:189:5: error: old-style function > definition [-Werror=old-style-definition] > int pmac_backlight_get_legacy_brightness() > ^~~~ > > Signed-off-by: Mathieu Malaterre Series applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/4a7b8a499724c98493023e1e3009aa cheers
Re: [1/2] powerpc/tm: Fix endianness flip on trap
On Sun, 2017-12-31 at 23:20:45 UTC, Gustavo Romero wrote: > Currently it's possible that a thread on PPC64 LE has its endianness > flipped inadvertently to Big-Endian resulting in a crash once the process > is back from the signal handler. > > If giveup_all() is called when regs->msr has the bits MSR.FP and MSR.VEC > disabled (and hence MSR.VSX disabled too) it returns without calling > check_if_tm_restore_required() which copies regs->msr to ckpt_regs->msr if > the process caught a signal whilst in transactional mode. Then once in > setup_tm_sigcontexts() MSR from ckpt_regs.msr is used, but since > check_if_tm_restore_required() was not called previuosly, gp_regs[PT_MSR] > gets a copy of invalid MSR bits as MSR in ckpt_regs was not updated from > regs->msr and so is zeroed. Later when leaving the signal handler once in > sys_rt_sigreturn() the TS bits of gp_regs[PT_MSR] are checked to determine > if restore_tm_sigcontexts() must be called to pull in the correct MSR state > into the user context. Because TS bits are zeroed > restore_tm_sigcontexts() is never called and MSR restored from the user > context on returning from the signal handler has the MSR.LE (the endianness > bit) forced to zero (Big-Endian). That leads, for instance, to 'nop' being > treated as an illegal instruction in the following sequence: > > tbegin. > beq 1f > trap > tend. > 1:nop > > on PPC64 LE machines and the process dies just after returning from the > signal handler. > > PPC64 BE is also affected but in a subtle way since forcing Big-Endian on > a BE machine does not change the endianness. > > This commit fixes the issue described above by ensuring that once in > setup_tm_sigcontexts() the MSR used is from regs->msr instead of from > ckpt_regs->msr and by ensuring that we pull in only the MSR.FP, MSR.VEC, > and MSR.VSX bits from ckpt_regs->msr. > > The fix was tested both on LE and BE machines and no regression regarding > the powerpc/tm selftests was observed. > > Signed-off-by: Gustavo Romero Series applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/1c200e63d055ec0125e44a5e386b9b cheers
Re: [V7] cxl: Add support for ASB_Notify on POWER9
On Thu, 2018-01-11 at 08:55:25 UTC, Christophe Lombard wrote: > The POWER9 core supports a new feature: ASB_Notify which requires the > support of the Special Purpose Register: TIDR. > > The ASB_Notify command, generated by the AFU, will attempt to > wake-up the host thread identified by the particular LPID:PID:TID. > > This patch assign a unique TIDR (thread id) for the current thread which > will be used in the process element entry. > > Signed-off-by: Christophe Lombard > Reviewed-by: Philippe Bergheaud > Acked-by: Frederic Barrat > Reviewed-by: Vaibhav Jain > Acked-by: Andrew Donnellan Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/b1db551324f72fa14ad82ca31237a7 cheers
Re: powerpc: restore alphabetic order in Kconfig
On Thu, 2018-01-04 at 15:35:25 UTC, Christophe Leroy wrote: > This patch restores the alphabetic order which was broken by > commit 1e0fc9d1eb2b0 ("powerpc/Kconfig: Enable STRICT_KERNEL_RWX > for some configs") > > Fixes: 1e0fc9d1eb2b0 ("powerpc/Kconfig: Enable STRICT_KERNEL_RWX for some > configs") > Signed-off-by: Christophe Leroy > Acked-by: Balbir Singh Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/4ec591e51a4b0aedb6c7f1a8cd722a cheers
Re: [1/2] powerpc/xive: Move definition of ESB bits
On Fri, 2018-01-12 at 02:39:27 UTC, Benjamin Herrenschmidt wrote: > >From xive.h to xive-regs.h since it's a HW register definition > and it can be used from assembly > > Signed-off-by: Benjamin Herrenschmidt Series applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/12c1f339cd49119e39063ae67f02d9 cheers
Re: [4/6] KVM: PPC: Book3S HV: Improve handling of debug-trigger HMIs on POWER9
On Wed, 2018-01-17 at 09:51:13 UTC, Paul Mackerras wrote: > Hypervisor maintenance interrupts (HMIs) are generated by various > causes, signalled by bits in the hypervisor maintenance exception > register (HMER). In most cases calling OPAL to handle the interrupt > is the correct thing to do, but the "debug trigger" HMIs signalled by > PPC bit 17 (bit 46) of HMER are used to invoke software workarounds > for hardware bugs, and OPAL does not have any code to handle this > cause. The debug trigger HMI is used in POWER9 DD2.0 and DD2.1 chips > to work around a hardware bug in executing vector load instructions to > cache inhibited memory. In POWER9 DD2.2 chips, it is generated when > conditions are detected relating to threads being in TM (transactional > memory) suspended mode when the core SMT configuration needs to be > reconfigured. > > The kernel currently has code to detect the vector CI load condition, > but only when the HMI occurs in the host, not when it occurs in a > guest. If a HMI occurs in the guest, it is always passed to OPAL, and > then we always re-sync the timebase, because the HMI cause might have > been a timebase error, for which OPAL would re-sync the timebase, thus > removing the timebase offset which KVM applied for the guest. Since > we don't know what OPAL did, we don't know whether to subtract the > timebase offset from the timebase, so instead we re-sync the timebase. > > This adds code to determine explicitly what the cause of a debug > trigger HMI will be. This is based on a new device-tree property > under the CPU nodes called ibm,hmi-special-triggers, if it is > present, or otherwise based on the PVR (processor version register). > The handling of debug trigger HMIs is pulled out into a separate > function which can be called from the KVM guest exit code. If this > function handles and clears the HMI, and no other HMI causes remain, > then we skip calling OPAL and we proceed to subtract the guest > timebase offset from the timebase. > > The overall handling for HMIs that occur in the host (i.e. not in a > KVM guest) is largely unchanged, except that we now don't set the flag > for the vector CI load workaround on DD2.2 processors. > > This also removes a BUG_ON in the KVM code. BUG_ON is generally not > useful in KVM guest entry/exit code since it is difficult to handle > the resulting trap gracefully. > > Signed-off-by: Paul Mackerras Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/d075745d893c78730e4a3b7a60fca2 cheers
Re: [RESEND] powerpc: mpic_timer: avoid struct timeval
On Tue, 2018-01-16 at 17:01:50 UTC, Arnd Bergmann wrote: > In an effort to remove all instances of 'struct timeval' > from the kernel, I'm changing the powerpc mpic_timer interface > to use plain seconds instead. There is only one user of this > interface, and that doesn't use the microseconds portion, so > the code gets noticeably simpler in the process. > > Signed-off-by: Arnd Bergmann Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/11ed8c5569b149a065184dc8ce2241 cheers
Re: [RESEND] spufs: use timespec64 for timestamps
On Tue, 2018-01-16 at 17:00:35 UTC, Arnd Bergmann wrote: > The switch log prints the tv_sec portion of timespec as a 32-bit > number, while overflows in 2106. It also uses the timespec type, > which is safe on 64-bit architectures, but deprecated because > it causes overflows in 2038 elsewhere. > > This changes it to timespec64 and printing a 64-bit number for > consistency. > > Signed-off-by: Arnd Bergmann > Acked-by: Jeremy Kerr Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/cef37ac119b1abffcb41a9a7067929 cheers
Re: [kernel] powerpc/powernv/ioda: Finish removing explicit max window size check
On Thu, 2018-01-18 at 02:51:03 UTC, Alexey Kardashevskiy wrote: > 9003a2498 removed checn from the DMA window pages allocator, however > the VFIO driver tests limits before doing so by calling > the get_table_size hook which was left behind; this fixes it. > > Fixes: 9003a2498 "powerpc/powernv/ioda: Remove explicit max window size check" > Signed-off-by: Alexey Kardashevskiy Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/ae677ff02f2ddb0980953efd4afed1 cheers
Re: powerpc/watchdog: remove arch_trigger_cpumask_backtrace
On Wed, 2018-01-17 at 12:47:22 UTC, Nicholas Piggin wrote: > The powerpc NMI IPIs may not be recoverable if they are taken in > some sections of code, and also there have been and still are issues > with taking NMIs (in KVM guest code, in firmware, etc) which makes them > a bit dangerous to use. > > Generic code like softlockup detector and rcu stall detectors really > hammer on trigger_*_backtrace, which has lead to further problems > because we've implemented it with the NMI. > > So stop providing NMI backtraces for now. Importantly, the powerpc code > uses NMI IPIs in crash/debug, and the SMP hardlockup watchdog. So if the > softlockup and rcu hang detection traces are not being printed because > the CPU is stuck with interrupts off, then the hard lockup watchdog > should get it with the NMI IPI. > > Fixes: 2104180a5369 ("powerpc/64s: implement arch-specific hardlockup > watchdog") > Signed-of-by: Nicholas Piggin Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/47712a921bb781caf69fca9eae43be cheers
Re: [v10,03/27] powerpc: initial pkey plumbing
On Fri, 2018-01-19 at 01:50:24 UTC, Ram Pai wrote: > Basic plumbing to initialize the pkey system. > Nothing is enabled yet. A later patch will enable it > once all the infrastructure is in place. > > Signed-off-by: Ram Pai Patches 3-27 applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/92e3da3cf193fd27996909956c12a2 cheers
Re: powerpc/64s: Fix ps3 build error due to tlbiel_all()
On Fri, 2018-01-19 at 08:55:31 UTC, Michael Ellerman wrote: > The recent changes to TLB handling broke the PS3 build: > > arch/powerpc/include/asm/book3s/64/tlbflush.h:30: undefined reference to > `.hash__tlbiel_all' > > Fix it by adding an fallback version of tlbiel_all() for non-native > builds. It should never be called, due to checks in callers so it > calls BUG(). We should probably clean it up further but this will > suffice for now. > > Fixes: d4748276ae14 ("powerpc/64s: Improve local TLB flush for boot and MCE > on POWER9") > Signed-off-by: Michael Ellerman Applied to powerpc next. https://git.kernel.org/powerpc/c/7a074fc08389f43b448ebef74bf56b cheers
Re: [PATCH 02/13] powerpc/powernv: Set correct configuration space size for opencapi devices
On 20/01/18 20:52, Michael Ellerman wrote:> On my Power8 PowerVM LPAR: Will fix... -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
[PATCH v2 0/6] Nintendo Wii GPIO driver
This series adds a driver for the GPIO controller used in the Nintendo Wii game console. The driver itself, and the related devicetree work should be pretty uncontroversial, but due to the system architecture of the Wii, I also had to extend an old resource allocation hack to kernel/resource.c: On the Wii, there are two separate RAM ranges, with MMIO right in the middle, but AFAIK, Linux on PPC32 doesn't support discontiguous memory properly. So the hack is to allocate one big RAM range with a hole (marked as reserved memory) for MMIO in the middle. Because this series touches different subsystems (GPIO, DT, core resource management), I guess it should be picked up patch-by-patch by the different maintainers. The main difference between v2 and the previous version is that I rewrote the driver on top of the GPIO_GENERIC library, saving 60 lines of code. Jonathan Neuschäfer (6): resource: Extend the PPC32 reserved memory hack powerpc: wii: Explicitly configure GPIO owner for poweroff pin gpio: Add GPIO driver for Nintendo Wii dt-bindings: gpio: Add binding for Wii GPIO controller powerpc: wii.dts: Add ngpios property powerpc: wii.dts: Add GPIO line names .../bindings/gpio/nintendo,hollywood-gpio.txt | 27 + .../devicetree/bindings/powerpc/nintendo/wii.txt | 9 +- arch/powerpc/boot/dts/wii.dts | 9 ++ arch/powerpc/platforms/embedded6xx/wii.c | 7 ++ drivers/gpio/Kconfig | 9 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-hlwd.c | 123 + kernel/resource.c | 21 +++- 8 files changed, 197 insertions(+), 9 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/nintendo,hollywood-gpio.txt create mode 100644 drivers/gpio/gpio-hlwd.c -- 2.15.1
[PATCH v2 3/6] gpio: Add GPIO driver for Nintendo Wii
The Nintendo Wii's chipset (called "Hollywood") has a GPIO controller that supports a configurable number of pins (up to 32), interrupts, and some special mechanisms to share the controller between the system's security processor (an ARM926) and the PowerPC CPU. Pin multiplexing is not supported. This patch adds a basic driver for this GPIO controller. Interrupt support will come in a later patch. This patch is based on code developed by Albert Herranz and the GameCube Linux Team, file arch/powerpc/platforms/embedded6xx/hlwd-gpio.c, available at https://github.com/DeltaResero/GC-Wii-Linux-Kernels, but has grown quite dissimilar. Signed-off-by: Jonathan Neuschäfer Cc: Albert Herranz Cc: Segher Boessenkool --- v2: - Change hlwd_gpio_driver.driver.name to "gpio-hlwd" to match the filename (was "hlwd_gpio") - Remove unnecessary include of linux/of_gpio.h, as suggested by Linus Walleij. - Add struct device pointer to context struct to make it possible to use dev_info(hlwd->dev, "..."), as suggested by Linus Walleij - Use the GPIO_GENERIC library to reduce code size, as suggested by Linus Walleij - Use iowrite32be instead of __raw_writel for big-endian MMIO access, as suggested by Linus Walleij - Remove commit message paragraph suggesting to diff against the original driver, because it's so different now --- drivers/gpio/Kconfig | 9 drivers/gpio/Makefile| 1 + drivers/gpio/gpio-hlwd.c | 123 +++ 3 files changed, 133 insertions(+) create mode 100644 drivers/gpio/gpio-hlwd.c diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index d6a8e851ad13..47606dfe06cc 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -229,6 +229,15 @@ config GPIO_GRGPIO Select this to support Aeroflex Gaisler GRGPIO cores from the GRLIB VHDL IP core library. +config GPIO_HLWD + tristate "Nintendo Wii (Hollywood) GPIO" + depends on OF_GPIO + select GPIO_GENERIC + help + Select this to support the GPIO controller of the Nintendo Wii. + + If unsure, say N. + config GPIO_ICH tristate "Intel ICH GPIO" depends on PCI && X86 diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 4bc24febb889..492f62d0eb59 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -54,6 +54,7 @@ obj-$(CONFIG_GPIO_FTGPIO010) += gpio-ftgpio010.o obj-$(CONFIG_GPIO_GE_FPGA) += gpio-ge.o obj-$(CONFIG_GPIO_GPIO_MM) += gpio-gpio-mm.o obj-$(CONFIG_GPIO_GRGPIO) += gpio-grgpio.o +obj-$(CONFIG_GPIO_HLWD)+= gpio-hlwd.o obj-$(CONFIG_HTC_EGPIO)+= gpio-htc-egpio.o obj-$(CONFIG_GPIO_ICH) += gpio-ich.o obj-$(CONFIG_GPIO_INGENIC) += gpio-ingenic.o diff --git a/drivers/gpio/gpio-hlwd.c b/drivers/gpio/gpio-hlwd.c new file mode 100644 index ..cf3f05a1621c --- /dev/null +++ b/drivers/gpio/gpio-hlwd.c @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0+ +// Copyright (C) 2008-2009 The GameCube Linux Team +// Copyright (C) 2008,2009 Albert Herranz +// Copyright (C) 2017-2018 Jonathan Neuschäfer +// +// Nintendo Wii (Hollywood) GPIO driver + +#include +#include +#include +#include +#include +#include +#include + +/* + * Register names and offsets courtesy of WiiBrew: + * https://wiibrew.org/wiki/Hardware/Hollywood_GPIOs + * + * Note that for most registers, there are two versions: + * - HW_GPIOB_* Is always accessible by the Broadway PowerPC core, but does + * always give access to all GPIO lines + * - HW_GPIO_* Is only accessible by the Broadway PowerPC code if the memory + * firewall (AHBPROT) in the Hollywood chipset has been configured to allow + * such access. + * + * The ownership of each GPIO line can be configured in the HW_GPIO_OWNER + * register: A one bit configures the line for access via the HW_GPIOB_* + * registers, a zero bit indicates access via HW_GPIO_*. This driver uses + * HW_GPIOB_*. + */ +#define HW_GPIOB_OUT 0x00 +#define HW_GPIOB_DIR 0x04 +#define HW_GPIOB_IN0x08 +#define HW_GPIOB_INTLVL0x0c +#define HW_GPIOB_INTFLAG 0x10 +#define HW_GPIOB_INTMASK 0x14 +#define HW_GPIOB_INMIR 0x18 +#define HW_GPIO_ENABLE 0x1c +#define HW_GPIO_OUT0x20 +#define HW_GPIO_DIR0x24 +#define HW_GPIO_IN 0x28 +#define HW_GPIO_INTLVL 0x2c +#define HW_GPIO_INTFLAG0x30 +#define HW_GPIO_INTMASK0x34 +#define HW_GPIO_INMIR 0x38 +#define HW_GPIO_OWNER 0x3c + + +struct hlwd_gpio { + struct gpio_chip gpioc; + void __iomem *regs; + struct device *dev; +}; + +static int hlwd_gpio_probe(struct platform_device *pdev) +{ + struct hlwd_gpio *hlwd; + struct resource *regs_resource; + u32 ngpios; + int res; + + hlwd = devm_kzalloc(&pdev->dev, sizeof(*hlwd), GFP_KERNEL); + if (!hlwd) + retur
[PATCH v2 6/6] powerpc: wii.dts: Add GPIO line names
These are the GPIO line names on a Nintendo Wii, as documented in: https://wiibrew.org/wiki/Hardware/Hollywood_GPIOs Signed-off-by: Jonathan Neuschäfer --- v2: - no change --- arch/powerpc/boot/dts/wii.dts | 8 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/boot/dts/wii.dts b/arch/powerpc/boot/dts/wii.dts index 7235e375919c..07d5e84e98b1 100644 --- a/arch/powerpc/boot/dts/wii.dts +++ b/arch/powerpc/boot/dts/wii.dts @@ -178,6 +178,14 @@ gpio-controller; ngpios = <24>; + gpio-line-names = + "POWER", "SHUTDOWN", "FAN", "DC_DC", + "DI_SPIN", "SLOT_LED", "EJECT_BTN", "SLOT_IN", + "SENSOR_BAR", "DO_EJECT", "EEP_CS", "EEP_CLK", + "EEP_MOSI", "EEP_MISO", "AVE_SCL", "AVE_SDA", + "DEBUG0", "DEBUG1", "DEBUG2", "DEBUG3", + "DEBUG4", "DEBUG5", "DEBUG6", "DEBUG7"; + /* * This is commented out while a standard binding * for i2c over gpio is defined. -- 2.15.1
[PATCH v2 1/6] resource: Extend the PPC32 reserved memory hack
On the Nintendo Wii, there are two ranges of physical memory, and MMIO in between, but Linux on ppc32 doesn't support discontiguous memory. Therefore a hack was introduced in commit c5df7f775148 ("powerpc: allow ioremap within reserved memory regions") and commit de32400dd26e ("wii: use both mem1 and mem2 as ram"): - Treat the area from the start of the first memory area (MEM1) to the end of the second (MEM2) as one big memory area, but mark the part that doesn't belong to MEM1 or MEM2 as reserved. - Only on the Wii, allow ioremap to be used on reserved memory. This hack, however, doesn't account for the "resource"-based API in kernel/resource.c, because __request_region performs its own checks. Extend the hack to kernel/resource.c, to allow more drivers to allocate their MMIO regions on the Wii. Signed-off-by: Jonathan Neuschäfer Cc: Albert Herranz --- v2: - CC Albert Herranz, who introduced this hack in 2009. --- kernel/resource.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/kernel/resource.c b/kernel/resource.c index 54ba6de3757c..bb3d329329da 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -1134,6 +1134,24 @@ resource_size_t resource_alignment(struct resource *res) static DECLARE_WAIT_QUEUE_HEAD(muxed_resource_wait); +/* + * On some ppc32 platforms (Nintendo Wii), reserved memory is used to work + * around the fact that Linux doesn't support discontiguous memory (all memory + * is treated as one large area with holes punched in it), and reserved memory + * is allowed to be allocated. + */ +#ifdef CONFIG_PPC32 +static bool conflict_ignored(struct resource *conflict) +{ + extern int __allow_ioremap_reserved; + + return __allow_ioremap_reserved && + (conflict->flags & IORESOURCE_SYSRAM); +} +#else +static bool conflict_ignored(struct resource *conflict) { return false; } +#endif + /** * __request_region - create a new busy resource region * @parent: parent resource descriptor @@ -1166,8 +1184,9 @@ struct resource * __request_region(struct resource *parent, res->desc = parent->desc; conflict = __request_resource(parent, res); - if (!conflict) + if (!conflict || conflict_ignored(conflict)) break; + if (conflict != parent) { if (!(conflict->flags & IORESOURCE_BUSY)) { parent = conflict; -- 2.15.1
[PATCH v2 2/6] powerpc: wii: Explicitly configure GPIO owner for poweroff pin
The Hollywood chipset's GPIO controller has two sets of registers: One for access by the PowerPC CPU, and one for access by the ARM coprocessor (but both are accessible from the PPC because the memory firewall (AHBPROT) is usually disabled when booting Linux, today). The wii_power_off function currently assumes that the poweroff GPIO pin is configured for use via the ARM side, but the upcoming GPIO driver configures all pins for use via the PPC side, breaking poweroff. Configure the owner register explicitly in wii_power_off to make wii_power_off work with and without the new GPIO driver. I think the Wii can be switched to the generic gpio-poweroff driver, after the GPIO driver is merged. Signed-off-by: Jonathan Neuschäfer --- v2: - no change --- arch/powerpc/platforms/embedded6xx/wii.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c index 79a1fe54ebc9..6e6db1e16d71 100644 --- a/arch/powerpc/platforms/embedded6xx/wii.c +++ b/arch/powerpc/platforms/embedded6xx/wii.c @@ -45,6 +45,7 @@ #define HW_GPIO_BASE(idx) (idx * 0x20) #define HW_GPIO_OUT(idx) (HW_GPIO_BASE(idx) + 0) #define HW_GPIO_DIR(idx) (HW_GPIO_BASE(idx) + 4) +#define HW_GPIO_OWNER (HW_GPIO_BASE(1) + 0x1c) #define HW_GPIO_SHUTDOWN (1<<1) #define HW_GPIO_SLOT_LED (1<<5) @@ -177,6 +178,12 @@ static void wii_power_off(void) local_irq_disable(); if (hw_gpio) { + /* +* set the owner of the shutdown pin to ARM, because it is +* accessed through the registers for the ARM, below +*/ + clrbits32(hw_gpio + HW_GPIO_OWNER, HW_GPIO_SHUTDOWN); + /* make sure that the poweroff GPIO is configured as output */ setbits32(hw_gpio + HW_GPIO_DIR(1), HW_GPIO_SHUTDOWN); -- 2.15.1
[PATCH v2 4/6] dt-bindings: gpio: Add binding for Wii GPIO controller
The Nintendo Wii game console has a GPIO controller, which is used for the optical disk slot LED, buttons, poweroff, etc. This patch adds a binding for this GPIO controller. Signed-off-by: Jonathan Neuschäfer Reviewed-by: Rob Herring --- v2: - Drop the leading zero in the example, as suggested by Rob Herring - Add some text to the commit message, as suggested by Linus Walleij --- .../bindings/gpio/nintendo,hollywood-gpio.txt | 27 ++ .../devicetree/bindings/powerpc/nintendo/wii.txt | 9 +--- 2 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/nintendo,hollywood-gpio.txt diff --git a/Documentation/devicetree/bindings/gpio/nintendo,hollywood-gpio.txt b/Documentation/devicetree/bindings/gpio/nintendo,hollywood-gpio.txt new file mode 100644 index ..20fc72d9e61e --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/nintendo,hollywood-gpio.txt @@ -0,0 +1,27 @@ +Nintendo Wii (Hollywood) GPIO controller + +Required properties: +- compatible: "nintendo,hollywood-gpio +- reg: Physical base address and length of the controller's registers. +- gpio-controller: Marks the device node as a GPIO controller. +- #gpio-cells: Should be <2>. The first cell is the pin number and the + second cell is used to specify optional parameters: + - bit 0 specifies polarity (0 for normal, 1 for inverted). + +Optional properties: +- ngpios: see Documentation/devicetree/bindings/gpio/gpio.txt +- interrupt-controller: Marks the device node as an interrupt controller. +- #interrupt-cells: Should be two. +- interrupts: Interrupt specifier for the controller's Broadway (PowerPC) + interrupt. +- interrupt-parent: phandle of the parent interrupt controller. + +Example: + + GPIO: gpio@d8000c0 { + #gpio-cells = <2>; + compatible = "nintendo,hollywood-gpio"; + reg = <0x0d8000c0 0x40>; + gpio-controller; + ngpios = <24>; + } diff --git a/Documentation/devicetree/bindings/powerpc/nintendo/wii.txt b/Documentation/devicetree/bindings/powerpc/nintendo/wii.txt index 36afa322b04b..a3dc4b9fa11a 100644 --- a/Documentation/devicetree/bindings/powerpc/nintendo/wii.txt +++ b/Documentation/devicetree/bindings/powerpc/nintendo/wii.txt @@ -152,14 +152,7 @@ Nintendo Wii device tree 1.l) The General Purpose I/O (GPIO) controller node - Represents the dual access 32 GPIO controller interface. - - Required properties: - - - #gpio-cells : <2> - - compatible : should be "nintendo,hollywood-gpio" - - reg : should contain the IPC registers location and length - - gpio-controller + see Documentation/devicetree/bindings/gpio/nintendo,hollywood-gpio.txt 1.m) The control node -- 2.15.1
[PATCH v2 5/6] powerpc: wii.dts: Add ngpios property
The Hollywood GPIO controller supports 32 GPIOs, but on the Wii, only 24 are used. Signed-off-by: Jonathan Neuschäfer --- v2: - no change --- arch/powerpc/boot/dts/wii.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/boot/dts/wii.dts b/arch/powerpc/boot/dts/wii.dts index 40b324b6391e..7235e375919c 100644 --- a/arch/powerpc/boot/dts/wii.dts +++ b/arch/powerpc/boot/dts/wii.dts @@ -176,6 +176,7 @@ compatible = "nintendo,hollywood-gpio"; reg = <0x0d8000c0 0x40>; gpio-controller; + ngpios = <24>; /* * This is commented out while a standard binding -- 2.15.1
Re: [PATCH v2 1/5] powerpc/mm: Enhance 'slice' for supporting PPC32
Le 20/01/2018 à 18:56, Segher Boessenkool a écrit : Hi! On Sat, Jan 20, 2018 at 09:22:50AM +0100, christophe leroy wrote: On PPC32, the address space is limited to 4Gbytes, hence only the low slices will be used. As of today, the code uses SLICE_LOW_TOP (0x1ul) and compares it with addr to determine if addr refers to low or high space. On PPC32, such a (addr < SLICE_LOW_TOP) test is always false because 0x1ul degrades to 0. Therefore, the patch modifies SLICE_LOW_TOP to (0xul) and modifies the tests to (addr <= SLICE_LOW_TOP) which will then always be true on PPC32 as addr has type 'unsigned long' while not modifying the PPC64 behaviour. It should work to define SLICE_LOW_TOP as 0x1ull and keep everything else the same, no? great, yes it works indeed. I don't think so. When I had the missing prototype, the compilation goes ok, including the final link. Which means at the end the code is not included since radix_enabled() evaluates to 0. Many many parts of the kernel are based on this assumption. Segher, what is your opinion on the above ? Can we consider that a ' if (nbits)' will always be compiled out when nbits is a #define constant, or should we duplicate the macros as suggested in order to avoid unneccessary 'if' test on platforms where 'nbits' is always not null by definition ? Doing things like if (nbits) some_undeclared_function(); will likely work in practice if the condition evaluates to false at compile time, but a) it will warn; b) it is just yuck; and c) it will not always work (for example, you get the wrong prototype in this case, not lethal here with most ABIs, but ugh). Just make sure to declare all functions, or define it to some empty thing, or #ifdeffery if you have to. There are many options, it is not hard, and if it means you have to pull code further apart that is not so bad: you get cleaner, clearer code. Ok, if I understand well, your comment applies to the following indeed, so you confirm the #ifdef is necessary. --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -553,9 +553,11 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, struct hstate *hstate = hstate_file(file); int mmu_psize = shift_to_mmu_psize(huge_page_shift(hstate)); +#ifdef CONFIG_PPC_RADIX_MMU if (radix_enabled()) return radix__hugetlb_get_unmapped_area(file, addr, len, pgoff, flags); +#endif return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1); } #endif However, my question was related to another part of the current patchset, where the functions are always refined: On PPC32 we set: +#define SLICE_LOW_SHIFT28 +#define SLICE_HIGH_SHIFT 0 On PPC64 we set: #define SLICE_LOW_SHIFT28 #define SLICE_HIGH_SHIFT 40 We define: +#define slice_bitmap_zero(dst, nbits) \ + do { if (nbits) bitmap_zero(dst, nbits); } while (0) We have a function with: { slice_bitmap_zero(ret->low_slices, SLICE_NUM_LOW); slice_bitmap_zero(ret->high_slices, SLICE_NUM_HIGH); } So the question is to find the better approach. Is the above approach correct, including performance wise ? Or should we define two sets of the macro slice_bitmap_zero(), one for CONFIG_PPC32 with the 'if (nbits)' test and one for CONFIG_PPC64 without the unnecessary test ? Or should we avoid this macro entirely and instead do something like: { bitmap_zero(ret->low_slices, SLICE_NUM_LOW); #if SLICE_NUM_HIGH != 0 bitmap_zero(ret->high_slices, SLICE_NUM_HIGH); #endif } And if we say the 'macro' approach is OK, should it be better the use a static inline function instead ? Thanks, Christophe